18

I am writing my thesis and I am using document class thesis. I want the page numbering appearing at bottom of the pages and centered.

\documentclass[12pt,a4paper, oneside, bold]{thesis}
\usepackage[left=3cm,right=2cm,top=3cm,bottom=2cm]{geometry}
\begin{document}
My text....
\end{document}

I tried writing something like that:

\documentclass[12pt,a4paper, oneside, bold]{thesis}
\usepackage[left=3cm,right=2cm,top=3cm,bottom=2cm]{geometry}
\usepackage{fancyhdr} 
\fancyhf{}
\cfoot{\thepage}

\begin{document}
    My text
\end{document}

But nothing is working. Any suggestions please.

2
  • Welcome to TeX.SX! You can have a look on our starter guide to familiarize yourself further with our format. Jun 3, 2013 at 10:24
  • 4
    In your second example you have to call \pagestyle{fancy} to activate the page style provided by fancyhdr. Jun 3, 2013 at 10:25

2 Answers 2

16

The package fancyhdr allows you the modification of the header. However the package fancyhdr doesn't overwrite the default styles instead it defines a new one named fancy. So you have to use \pagestyle{fancy}:

\documentclass[12pt,a4paper, oneside, bold]{thesis}
\usepackage[left=3cm,right=2cm,top=3cm,bottom=2cm]{geometry}
\usepackage{fancyhdr} 
\fancyhf{}
\cfoot{\thepage}
\pagestyle{fancy}    
\begin{document}
    My text
\end{document}
5
  • 4
    There is a simpler method here: just write \pagestyle{plain} in the header stackoverflow.com/a/12653885/952234 . Oct 26, 2020 at 7:19
  • However, your method works with poemscol package. Oct 26, 2020 at 10:11
  • @Yaroslav, your solution seems better to me. It is simpler and doesn't give unnecessary header and footer lines. Thanks!
    – Amazeunmb
    Jan 29, 2022 at 9:26
  • @YaroslavNikitenko you should write this as an answer. Is far more efficient!
    – deps_stats
    Jul 11, 2023 at 1:00
  • @deps_stats done, thanks to you and Amazeunmb (can't notify twice). Jul 20, 2023 at 12:10
3

Write in the header or body

\pagestyle{plain}

The \pagestyle command changes the style from the current page on throughout the remainder of your document.

The valid options are:

  • plain - Just a plain page number.
  • empty - Produces empty heads and feet - no page numbers.
  • headings - Puts running headings on each page. The document style specifies what goes in the headings.
  • myheadings - You specify what is to go in the heading with the \markboth or the \markright commands.

Pro: doesn't require additional packages.

Con: the author of the question actually used fancyhdr (I don't know the reason). Several people pointed that my answer in comments would be also useful, that is why I'm posting it here.

See more about page styles and fancyhdr in the Wikibook on LaTeX.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .