Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I wanted to put the title of the chapter on even header and the title of the section of the chapter to the odd pages.

My headers are now are using this code:

 \begin{document}

\frontmatter % Use roman page numbering style (i, ii, iii, iv...) for the pre-content pages

\setstretch{1.3} % Line spacing of 1.3

% Define the page headers using the FancyHdr package and set up for one-sided printing
\fancyhead{} % Clears all page headers and footers
\rhead{\thepage} % Sets the right side header to show the page number
\lhead{} % Clears the left side page header

\pagestyle{fancy} % Finally, use the "fancy" page style to implement the FancyHdr headers

Moreover, chapters are in separate files and called in a main file.

share|improve this question

1 Answer 1

You can simply use the selectors E and O for even and odd pages. Here is a MWE:

\documentclass{book}
\usepackage{lipsum}
\usepackage{fancyhdr}

\fancyfoot{}
\fancyhead[RO,LE]{\thepage}
\fancyhead[LO]{\leftmark}
\fancyhead[RE]{\rightmark}

\begin{document}

\pagestyle{fancy}

\chapter{Chapter}
\section{section}

\lipsum
\lipsum

\end{document}

Here is the output: enter image description here

You can modify the way chapter and section are displayed by redefining \chaptermark and \sectionmark.

share|improve this answer
    
I used it but nothing happen. –  ali amidi Jan 12 '13 at 16:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.