# logo at the left & right at the header of a Book (two sided)

I want to add logo in the header of a book. The logo should be either at the left or at the right corner w.r.t odd/even page. Please help me to correct my code:

\documentclass[
paper=a4, % it's the default anyway
fontsize=12pt,
twoside
]{book}
\usepackage[paperwidth=7.25in, paperheight=9.5in,bindingoffset=.75in]{geometry}
\usepackage{fancyhdr}
\usepackage{makeidx}         % allows index generation
\usepackage[demo]{graphicx}
\pagestyle{fancy}
{%
\usepackage{lipsum}
\begin{document}
\lipsum
\newpage
\lipsum
\end{document}

• Have you considered reading the fancyhdr documentation for starters? Your use of \chead with a nested \fancyhead is wrong. – Werner Dec 23 '14 at 15:13
• Use LO´ for left on odd page and ´RE´ for right on even pages, see the fancy hdr doc on page 6f. – MaxNoe Dec 23 '14 at 15:17
• @ Werner Yes, Its an error, I have modified it. Please help me next. – user1942348 Dec 23 '14 at 15:19

Package fancyhdr uses some deprecated commands in its defaults. But that doesn't matter anymore, after using \fancyhf and clearing the defaults (thanks egreg).

I recommend using package scrlayer-scrpage from the KOMA-bundlea. The syntax is pretty similar. \lehead stands for the left-even head, \rohead for the right-odd head. The naming convention is similar for footers (\lofoot, \cefoot etc).

\documentclass{book}
\usepackage[paperwidth=7.25in,
paperheight=9.5in,bindingoffset=.75in]{geometry}
\usepackage{mwe}
\begin{document}
\lipsum[1-20]
\end{document}


Note: book sets the pagenumber in the outer head. Package scrlayer-scrpage will just overwrite that if requested by the user. Package fancyhdr just overwrites the settings of book without user interaction.

• It's true that fancyhdr uses the deprecated \rm and \sl commands. However, when one does \fancyhf{}, that should always be done when using the package, those commands will have no effect. To the contrary, see tex.stackexchange.com/questions/219225/… for an amusing bug of scrlayer-scrpage. – egreg Dec 23 '14 at 18:12

fancyhdr provides Odd and Even-page placement as well as choosing between the Left or Right side of the page. So, for Left-side on Odd pages, use LO, and Right-side on Even pages, use RE:

\documentclass[twoside]{book}
\usepackage[paperwidth=7.25in, paperheight=9.5in,bindingoffset=.75in]{geometry}
\usepackage{fancyhdr,graphicx,lipsum}
\pagestyle{fancy}

Note that the book document class issues \thispagestyle{plain} on the first page of every \chapter. In those instances you'll lose your fancy page style, unless you re-issue \pagestyle{fancy} or redefined plain`.