GeneralURGENT: Page Style for page numbering

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
cern73
Posts: 2
Joined: Sun Apr 13, 2008 8:23 am

URGENT: Page Style for page numbering

Post by cern73 »

hello everybody
I am writing my Phd thesis and I need to have the page number in the top of the pages and centered
what pagestyle or packages allows me to do that ? I have been stuck with this problem for a while and it is a graduate school absolute requirement for the thesis format as far as page numbering is concerened

pls help ASAP

thnx alot

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Re: URGENT: Page Style for page numbering

Post by meho_r »

Try package fancyhdr for customizing headers and footers.
You can get page numbers in header, centered this way:

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead[C]{\thepage}
\fancyfoot{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

URGENT: Page Style for page numbering

Post by Stefan Kottwitz »

Hi cern73,

welcome to the board!
Just in case you didn't find the documentation of fancyhdr until now, you may find it on CTAN: here.

You might notice, that some pages will have a different style, like the first page of a chapter. If you need to change that too, you could use \fancypagestyle{plain}{...}, see 7 Redefining plain style in the package documentation.

Stefan
cern73
Posts: 2
Joined: Sun Apr 13, 2008 8:23 am

Re: URGENT: Page Style for page numbering

Post by cern73 »

Hello guys
meho_r
the lines you have written are helful in setting the page number in the middle of the bottom of the page
I need the page number to be centered at THE TOP of the page
I am still stuck with this problem and readying the manual of fancyhdr is not helpful
pls help!
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

URGENT: Page Style for page numbering

Post by Stefan Kottwitz »

Hi cern73,

consider following small example:

Code: Select all

\documentclass[a4paper,10pt]{report}
\usepackage{fancyhdr}
\fancyhf{}
\fancyhead[C]{\thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\fancypagestyle{plain}{}
\pagestyle{fancy}
\begin{document}
\chapter{One}
\section{one}
text
\newpage
text
\end{document}
It should show what was meant by meho_r and me.

Stefan
Post Reply