# Different headheight in odd or even pages with fancyhdr

With the fancyhdr package I would like to set different headheight in odd and even pages, do I tried with

\setlength{\headheight}{\ifthenelse{\isodd{\value{page}}}{.5cm}{3cm}}


but it didn't work.

• what about textheight? – touhami Oct 2 '16 at 13:27
• doesn't work better – math45 Oct 2 '16 at 14:06
• Your text has to begin at the same height on the physical page, I suppose? – Bernard Oct 2 '16 at 14:15
• what i mean is that the body text will be pushed down in odd pages so you need to change the text height (this is same as what Bernard points) – touhami Oct 2 '16 at 15:53

Here is a solution

\documentclass{book}

%--- just for the example
\textheight=20\baselineskip
\usepackage{mwe}
%---

\usepackage{etoolbox}
\makeatletter
\makeatother

\begin{document}
\lipsum[1-20]
\end{document}


What i think better: change textheight too

\documentclass{book}

%--- just for the example
\textheight=20\baselineskip
\usepackage{mwe}
%---

\usepackage{etoolbox}
\makeatletter
\makeatother

\begin{document}
\lipsum[1-20]
\end{document}


• one can change \topmargin to avoid changing \textheight – touhami Oct 2 '16 at 16:04