TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I made PDFs with Texmaker the page numbers are by default at the bottom of the page (i.e. in the footer) and are centred. How do I change this?

share|improve this question
the fancyhdr package can arrange this for you. someone may even tell you how, if you provide a minimal example that can be patched for instructional purposes. – wasteofspace Feb 21 '13 at 9:41
see tex.stackexchange.com/questions/20109/… as well – macmadness86 Feb 24 '13 at 2:09

depending on the document class you're using, you might not even need fancyhdr (Which is why a minimal example would be useful, so we know ›where‹ you are). For example, the komascript bundle comes with the scrpage2 package, which, however, also works with other classes as well. Here's what I use, except I put them in the footer rather than the header:

\documentclass[12pt]{scrartcl} % or article, etc.
\clearscrheadfoot %clears headers + footers
\ohead{\thepage\hspace*{3em}} %sets new header

See also »adapting page headers and footers« in scrguien.pdf

share|improve this answer

as mentioned, you could use the fancyhdr package. It is more complicated, but I use it for everything anyway, because it is so robust. A couple things to note:

  1. I use xelatex
  2. I use fancyhdr in conjunction with geometry (notice the options includefoot and includehead: These keep the header and footer within margins, but if you check out the geometry package, you can find all kinds of settings.

The main thing you want to look at is \rhead{\thepage}

\thepage is the page number variable (counter)

Here is an example:

\lhead{} \chead{} \rhead{\thepage} %sets header left center right
\lfoot{} \cfoot{} \rfoot{} %sets footer left center right
\renewcommand{\headrulewidth}{0.0pt} %optional horizontal rule thickness
\renewcommand{\footrulewidth}{0.0pt} %optional horizontal rule thickness
\pagestyle{fancy}%ADD HEADER FOOTER TO PAGE EXCEPT TITLE PAGE %ensure fancyhdr is applied to doc
%USE \thispagestyle{EMPTY} BELOW MAKETITLE IF YOU USE IT OR \thispagestyle{FANCY}

Test Document

Another thing to note. If you are using the article class and you use a \maketitle command, by default, the first page will not have the header/footer from fancyhdr, but will have the default page number. To deal with this, use

  • \thispagestyle{empty} % disable header/footer
  • \thispagestyle{fancy} % apply fancyhdr header/footer

Let us assume you want the title page to have no header/footer. You will run into another problem, namely that the page number counter still starts with the title page, but you want page 1 to be the first page with content. To solve this, just put a

  • \setcounter{page}{1} % sets the counter to value

on whichever page you want to be page 1.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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