# Page numbering doesen't work

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:

\documentclass[a4paper,11pt]{article}
\usepackage{geometry}
\usepackage{multirow}
\usepackage{anysize}
\usepackage[utf8]{inputenc}
\usepackage[magyar]{babel}

\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage[LGRgreek]{mathastext}

\geometry{left=3.5cm,right=3.5cm}

\usepackage{array}

\usepackage{subcaption}
\usepackage{subfig}

\DeclareUnicodeCharacter{B0}{\textdegree}
\DeclareMathOperator{\Sp}{Sp}
\DeclareMathOperator{\ud}{d}
\DeclareMathOperator{\divv}{div}
\DeclareMathOperator{\rot}{rot}
\DeclareMathOperator{\ctg}{ctg}
\DeclareMathOperator{\tg}{tg}
\DeclareMathOperator{\tgh}{th}
\DeclareMathOperator{\sh}{sh}
\DeclareMathOperator{\ch}{ch}
\DeclareMathOperator{\cth}{cth}
\DeclareMathOperator{\arcctg}{arcctg}
\DeclareMathOperator{\arctg}{arctg}
\DeclareMathOperator{\arsh}{arsh}
\DeclareMathOperator{\arch}{arch}
\DeclareMathOperator{\arth}{arth}
\DeclareMathOperator{\arcth}{arcth}
\newcommand{\dd}{\mathrm{d}}

\pagenumbering{arabic}

\begin{document}

\setcounter{page}{1}
\end{document}


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
• 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

\DeclareUnicodeCharacter{B0}{\textdegree}


so I've removed it.

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

\addtolength{\hoffset}{-2cm}


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

\addtolength{\textheight}{10cm}


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