Page Layoutfancyhdr | Customized Page Headers on even and odd Pages

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
nenu28
Posts: 28
Joined: Mon Jun 27, 2011 11:24 am

fancyhdr | Customized Page Headers on even and odd Pages

Post by nenu28 »

Hello,

I am writing a document in LaTeX with report class and i would like to do this :
  1. All the odd pages of my documents should have header containing the title of the document.
  2. All the even page of the document should have header containing each chapter title (for example: Chapter 1 Introduction, Chapter 2 Literature Review, Chapter 3 Methodology, ...)
I read the fancyhdr package guide but could not find something connected to what i want. I tried to set this

Code: Select all

\fancyhead{} % clear all header fields
\fancyhead[RO,LE]{text}
\fancyfoot{} % clear all footer fields
\renewcommand{\headrulewidth}{0.4pt}
which i found in the preview's guide but does not help.
So, is there someone who can help me to fix this problem ?

Thanks in advance

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

justdeath
Posts: 69
Joined: Mon Sep 05, 2011 10:27 am

fancyhdr | Customized Page Headers on even and odd Pages

Post by justdeath »

Hi, so twoside option works with report:

Code: Select all

\documentclass[twoside]{report}
\usepackage{fancyhdr}

\fancyhead[LE]{\thepage}
\fancyhead[RE]{right}
\fancyhead[LO]{left}
\fancyhead[RO]{\thepage}
\pagestyle{fancy}

\begin{document}
Some text
\newpage
More text
\newpage
Even more text
\end{document}
Also, if you don't like the page margins, use the geometry package:

Code: Select all

\usepackage[margin=2cm]{geometry}
See also http://latex-community.org/forum/viewto ... 47&t=20274
nenu28
Posts: 28
Joined: Mon Jun 27, 2011 11:24 am

Re: fancyhdr | Customized Page Headers on even and odd Pages

Post by nenu28 »

Thanks so much, they are all work as i wanted !

Thank you
Post Reply