Page LayoutChange Position of Page Number

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
ParkaDude
Posts: 4
Joined: Tue Jun 26, 2012 1:21 pm

Change Position of Page Number

Post by ParkaDude »

Dear all,

I'm writing a thesis utilizing a template, but I need to make minor changes in order to comply with the requirements of my university (which doesn't provide a downloadable template).

The template I'm using is attached:
  • top, right page number
  • page number absent at the first page of each chapter
  • page number absent in acknowledgement and in all the preamble parts with \OnePageChapter I would need:
    • page numbers on every page
    • bottom, centered
I've been searching and trying for long, but I can't really change this. Can someone give me a hand?
Attachments
thesis.cls
The used class file.
(41.76 KiB) Downloaded 1175 times
Last edited by localghost on Tue Jun 26, 2012 5:48 pm, edited 1 time in total.

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

HcN
Posts: 5
Joined: Fri Jun 22, 2012 4:59 pm

Change Position of Page Number

Post by HcN »

Hi ParkaDude,

I think what you need here is just to redefine the "plain" style of fancyhdr.

Code: Select all

\usepackage{fancyhdr}
\fancypagestyle{plain}{
\fancyfoot[C]{\thepage}}
\pagestyle{plain}
The plain style is the one that applies to every part of your document that does not consist of text. Ergo, first pages of chapter, part etc ... as well as empty/double pages. It is fine if it is what you want, else you can type the command \thispagestyle{empty} on relevant pages to empty them.
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Change Position of Page Number

Post by cgnieder »

It would be very appreciated if you'd post a Infominimal working example next time. It's very tedious to figure out a custom class by oneself! Anyway, use for example fancyhdr and set header and footer to your liking after \begin{document}:

Code: Select all

% arara: pdflatex
\documentclass{thesis}
\usepackage{lipsum} % for dummy text

\title{My Title}
\author{Author}{Name}
\advisor{Dr}{Advisor}
\reader{Reader}
\degree{Full Degree}{Degree}
\otherdegrees{Other Degrees}
\dept{University}{Departement}
\abstract{\lipsum[1]}

\usepackage{fancyhdr}

\begin{document}
% reset header and footer:
\pagestyle{fancy}
\renewcommand\headrulewidth{0pt}
\lhead{}\chead{}\rhead{}
\cfoot{\vspace*{1.5\baselineskip}\thepage}

\chapter{Test}
\lipsum
\lipsum

\end{document}
Regards

PS: Welcome to the LaTeX community!
site moderator & package author
ParkaDude
Posts: 4
Joined: Tue Jun 26, 2012 1:21 pm

Change Position of Page Number

Post by ParkaDude »

Thanks guy for helping me!

So, I included the fancyhdr package as you suggested, and this partially solved the problem.

Now, the page number are bottom centered. But, since the command is after the "\begin{document}" command, roman numbered pages still have the page number on the top right corner. Plus, the first page of each chapter is still not numbered.

I apologize for not including a working example! But this time I did :) (see point 1, below).

Now, two options ahead:

(0) Quick-and-dirty-solution: can you guyssuggest me a standard thesis template, maybe easy to use, with chapters organized as single tex files? If that template has the fancyhdr package included, that should work. (My problem is that I found a myriad of thesis templates of other universities, but no one does exactly fit the style requirements of my institution. I couldn't find a "neutral" one.)

(1) I attach here a working example, that's the toy sample available on the internet. Starting from that one, I've been able to modify the cls file by trial and error to comply with the needed style. Except for the page numbers! If any of you good guys can
Attachments
thesis sample.rar
Thesis sample.
(35.73 KiB) Downloaded 428 times
ParkaDude
Posts: 4
Joined: Tue Jun 26, 2012 1:21 pm

Change Position of Page Number

Post by ParkaDude »

UPDATE!

I found this:
http://theoval.cmp.uea.ac.uk/~nlct/late ... hesis.html

that should do the job. This is a pretty simple and neutral template, I'm working on it.
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Change Position of Page Number

Post by cgnieder »

A combination of HcN's and my solutions solves both issues:

Code: Select all

% arara: pdflatex
\documentclass{thesis}
\usepackage{lipsum} % for dummy text

\title{My Title}
\author{Author}{Name}
\advisor{Dr}{Advisor}
\reader{Reader}
\degree{Full Degree}{Degree}
\otherdegrees{Other Degrees}
\dept{University}{Departement}
\abstract{\lipsum[1]}

\usepackage{fancyhdr}
\fancypagestyle{empty}{\fancyfoot[C]{\vspace*{1.5\baselineskip}\thepage}}
\fancypagestyle{plain}{\fancyfoot[C]{\vspace*{1.5\baselineskip}\thepage}}
\begin{document}
% reset header and footer:

\pagenumbering{roman}
\pagestyle{plain}
\renewcommand\headrulewidth{0pt}

\chapter*{Preface}
\lipsum

\chapter{Test}
\pagenumbering{arabic}
\lipsum
\lipsum

\end{document}
Regards
site moderator & package author
ParkaDude
Posts: 4
Joined: Tue Jun 26, 2012 1:21 pm

Change Position of Page Number

Post by ParkaDude »

Thank you so much for this help!

Using your example and a simpler template I almost achieved the final result.

Thrashing that template helped me a lot to understand how LaTeX works.

Now, the problem persists because of two small changes:

(0) the abstract page should be numbered, but it isn't. (I tried \setcounter{page}, but it doesn't work.)

(1) the preface pages (Title, Authorization page, Signature page and Acknowledgements) should be mentioned in the \tableofcontents, and they are not.

Code: Select all

\documentclass[a4paper,12pt]{report}
\usepackage{graphicx}    % to insert PostScript figures
\usepackage{setspace}    % double space!
\usepackage{fancyhdr}
\usepackage{lipsum} % for dummy text
\onehalfspacing

\begin{document}

\pagenumbering{roman}
\pagestyle{plain}

\title{Sample}
\author{That guy}
\date{Aug 2012}

\maketitle

\chapter*{Title}
Foo bar. Foo bar. Foo bar. Foo bar. Foo bar.

\chapter*{Authorization page}
Foo bar. Foo bar. Foo bar. Foo bar. Foo bar.

\chapter*{Signature page}
Foo bar. Foo bar. Foo bar. Foo bar.

\chapter*{Acknowledgements}
Foo bar. Foo bar. Foo bar. Foo bar. Foo bar.

\tableofcontents
\listoffigures
\listoftables

\begin{abstract}
\setcounter{page}{10}
Abstract. Foo bar. Foo bar. Foo bar. Foo bar.
\end{abstract}

\pagenumbering{arabic}

\chapter{Test}
\lipsum
\lipsum

\bibliographystyle{ieeetr}
\bibliography{refs}

\end{document}
Post Reply