I am finishing up my PhD thesis soon but just having a small problem with formatting. I want a header at the top of each page, which is the name of the current section. I also want the page numbers to appear at the bottom of the page justified right.
I can get the section header to appear using the following for the page style:
but this also results in the page numbers appearing on the top of the page to the right of the header. Is there any way I can keep the section header but move the page numbers to the bottom right?
Any help is greatly appreciated,
Thank you
Last edited by cgnieder on Sat Aug 10, 2013 2:31 pm, edited 1 time in total.
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
It's hard to tell what you should do. It would be best for you to prepare a compilable minimal working example. Code snippets are not helpful at all. A MWE reproduces your problem and gives us the opportunity to test possible solutions. Please use the codebutton, you can preview your post and click on Open in writelatex just above yur code to see if it is compilable.
If you are using a KOMA documentclass, you should take a look at package scrpage2 (also from the KOMA-bundle). Using a standardclass, you can use fancyhdr as well as scrpage2.
Best regards
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
\documentclass[a4paper,12pt]{report}
\begin{document}
\pagestyle{myheadings}\makeatletter
\pagenumbering{arabic}
\renewcommand{\sectionmark}[1]{\markboth{}{\bf\thesection : #1}}
\chapter{}
\section{Section 1}
Some text here
\clearpage
\newpage
\section{Section 2}
Some more text here
\end{document}
On page 1 the page number appears bottom center and then on page 2 it appears top right. The name of the section "1.2: Section 2" appears on the header from the second page of each chapter onwards, which is what I want. I just need to get the page number on the bottom of the page and aligned to the right hand side. I hope this is clear.
I asked a guy in my University and he gave me a solution that works well. The page number is now appearing on the bottom right of each page. It involved the fancyhdr package like you thought. Here is the code in case anyone else needs to use it in future. Thanks for your responses.
\documentclass[a4paper,12pt]{report}
\usepackage{fancyhdr}
\usepackage[nouppercase]{scrpage2}
\setlength{\headheight}{15.2pt}
\setlength{\headsep}{10pt}
\begin{document}
\fancypagestyle{newstyle}{
\fancyhf{} % clear all header and footer fields
\fancyhead[l]{\bfseries \nouppercase \rightmark} % except the center
\fancyfoot[R]{\thepage} % except the center
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}}
\pagestyle{newstyle}
\chapter{}
\section{Section 1}
Some text here
\clearpage
\newpage
\section{Section 2}
Some more text here
\clearpage
\newpage
\section{Section 3}
Some more text here
\end{document}
I didn't realize you would be satisfied with the page number at the bottom. However, fancehdr and scrpage2 both are supposed to do the same job, and so are competing. You should remove scrpage2 from your example, this should give you an error message.
EDIT: I'm sorry, i didn't read your first post again. I prefer the question again in a follow-up post (MWE), so no information can get lost.
\documentclass[a4paper,12pt]{report}
\usepackage{blindtext}% adds the blindtext
\usepackage{showframe}% shows a framed header, type area and footer
\setlength{\headheight}{1.1\baselineskip}
%\setlength{\headsep}{10pt}
\usepackage[nouppercase,automark]{scrpage2}
\clearscrheadfoot
\pagestyle{scrheadings}
%See the KOMA-script documentation for more information
\ihead{\rightmark}
%\ihead[]{\headmark}%helpful for two-sided printing
\ofoot[\pagemark]{\pagemark}
\begin{document}
\blinddocument
\blinddocument
\blinddocument
\end{document}
Best regards
Johannes
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
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