1

I've got a simple question, I think. But I can't seem to find the answer to it anywhere. I want page numbers at the top right of each page of my document. How do I do this?

I tried doing:

\documentclass[12pt]{article}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[R]{\thepage}

\begin{document}

My text.

\end{document}

While this did result in page numbers being at the top right, I don't like the horizontal lines across the top of each page that this produces.

1

Use \renewcommand{\headrulewidth}{0pt} for example to set the head rule with to zero -- it won't appear then. The same can be applied to \footrulewidth, if necessary.

\documentclass[12pt]{article}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\fancyhead[R]{\thepage}

\begin{document}

My text.

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.