Hi, I wonder if there is a way to set different headers for even and odd pages of report class with 'oneside' option. I know fancyhdr can do this but for 'twoside' options.
Many thanks.
Page Layout ⇒ different header for odd and even page of oneside report
different header for odd and even page of oneside report
Last edited by spiegboy on Sun Jul 18, 2010 3:00 am, edited 1 time in total.
NEW: TikZ book now 40% off at Amazon.com for a short time.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
different header for odd and even page of oneside report
The most obvious solution to me seems to check whether the »page« counter is odd or even and then create a suitable header. This can be done with structures provided by the ifthen package as shown in the code below.
Compare the header content by just replacing the »fancy« page style with the »headings« style.
Thorsten
Code: Select all
\documentclass[11pt,a4paper,english]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{fancyhdr,ifthen}
\usepackage{blindtext}
% Setup for headers and footers (fancyhdr)
\fancyhf{}
\lhead{\ifthenelse{\isodd{\value{page}}}{\rightmark}{\leftmark}}
\rhead{\thepage}
\pagestyle{fancy}
\begin{document}
\blinddocument
\end{document}
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: different header for odd and even page of oneside report
Absolutely brilliant!
Many thanks.
Many thanks.