[Tex/LaTex] How to add last name to page number in header

formattingheader-footer

Okay so I am writing a report where in the header, my teacher is requiring that I put both the page number and my last name in the upper-left hand corner of each page (excluding the title page). Now I have managed to put the page number in the upper-left hand corner using

\pagestyle{myheadings}

but this doesn't solve my issue of putting my last name right next to the page number. Help?

Best Answer

The documentation of the fancyhdr package will be extremely helpful to you. Essentially, you need to do the following:

\documentclass{article}
\usepackage{fancyhdr}
    \fancyfoot{}
    \lhead{Yourname, \thepage}
    \pagestyle{fancy}
\usepackage{lipsum}
\begin{document}
\lipsum
\end{document}

Since your title page is the only one that's different, you can just say \thispagestyle{empty} on your title page, and you'll get no headers or footers.

If fancyhdr's default of a header rule bothers you, put in \renewcommand{\headrulewidth}{0pt} to kill it.