I use sharelatex and I tried a lot of page numbering code, but none of them show me the number of the page.

My code begins with this:











And doesen't appear to me the number on the bottom of the page or elsewhere. Could someone help me please?

  • Sorry, it was a wrong title. – Alíz Apr 16 '15 at 18:07
  • 1
    You're creating a non-existent document. What happens when you place some characters on the page... anything. – Werner Apr 16 '15 at 18:10
  • I don't understand. Everywhere I see this code for page numbering, but for me, it doesen't work. – Alíz Apr 16 '15 at 18:13
  • (La)TeX creates the page numbering as part of the output routine. And this output routine is only executed if there's something on the page. Since you haven't provided anything, nothing is created. Period. – Werner Apr 16 '15 at 18:15
  • ...what happens when you insert \mbox{} between \begin{document} and \end{document} as well? Do you see the page numbers then? – Werner Apr 16 '15 at 18:16

There are a number of problems with your code:

  1. You're creating a non-existent document.

    (La)TeX inserts page numbers during page shipout. And, page shipout only occurs when there's content to be shipped out. Since that's not happening, no page numbers may be visible.

  2. amsmath and mathastext doesn't always work together well.

  3. The code doesn't compile with


    so I've removed it.

  4. While you're using geometry to set the document layout, you're adjusting it with other manual techniques:


    Of these, the last line adds 10cm to the existing \textheight. And since you're using an A4 paper size with "default margins", there's not enough room for the text block to fit on the page, despite pushing the content up by 2cm (\voffset).

After all the errors are fixed, removing


allows you to see the page numbers.

For future reference,

  1. when using geometry, use it (and only it) to adjust your layout;

  2. Add the showframe option to see the actual layout. There's also the showframe package which does the same. It'll help you make sense of layout problems.

  • The problem is that when I remove this, \DeclareUnicodeCharacter{B0}{\textdegree} I can't write ő letter. – Alíz Apr 16 '15 at 19:58
  • Use \H{o}..... – Werner Apr 16 '15 at 19:58

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.