I'm using the fancyhdr package with the book class, and I need to not only lengthen the header to be wider than \textwidth (e.g., using \fancyheadoffset) but also to control its position.

[EDITED TO REPLACE IMAGE WITH MWE]

For example, the following sample shows that I have section titles that start well to the left of the main text. I would like to extend the header so that its left edge aligns with the section number while preserving the alignment with the text on the right edge. And I need this to work for both odd and even pages.

\documentclass{book}
\usepackage{fancyhdr}
\usepackage{kantlipsum}
\usepackage[calcwidth]{titlesec}

\setlength{\textwidth}{5.0in}
\setlength{\oddsidemargin}{1.5in}
\setlength{\evensidemargin}{1.5in}

\titleformat{\section}
{\Large\bfseries}{\hspace*{-1in}\thesection}{1em}{}

\pagestyle{fancy}
\fancyhf{}

\renewcommand{\sectionmark}[1]{\markright{{\it #1}}}

\begin{document}
\section{Section One}
\kant[1]
\section{Section Two}
\kant[2]
\section{Section Three}
\kant[3]
\section{Section Four}
\kant[4]

\end{document}

• You already know that command. You just say e.g. \fancyheadoffset[leh,roh]{15pt} and, if your document is using a two-sided layout, it will all be applied appropriately. (You may want [loh,reh] of course, as your offset seems to be opposite from mine, but it is the same idea. – cfr Nov 21 '15 at 2:56
• But that's not a command to specify the 'precise position on the page' by any stretch of the imagination. – cfr Nov 21 '15 at 2:57

If you just want the command to have inner/outer-sensitive offset, you just add the options to \fancyhoffset. For example:

\documentclass[a4paper]{book}
\usepackage{geometry}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhf[loh,reh]{Left Odd Right Even}
\fancyhf[leh,roh]{Left Even Right Odd}
\fancyhf[cf]{\thepage}
\usepackage{kantlipsum}
\begin{document}
\kant[1-20]
\end{document}


Replacing

\fancyheadoffset[loh,reh]{20mm}


with

% \fancyheadoffset[loh,reh]{20mm}


flips the effect:

EDIT

Since you want the offset always on the left of the page, it is even easier (if a bit odd for a book):

\documentclass{book}
\usepackage{fancyhdr}
\usepackage{kantlipsum}
\usepackage[calcwidth]{titlesec}

% Note that setting these manually is not at all wise use e.g. geometry instead
\setlength{\textwidth}{5.0in}
\setlength{\oddsidemargin}{1.5in}
\setlength{\evensidemargin}{1.5in}

\titleformat{\section}
{\Large\bfseries}{\hspace*{-1in}\thesection}{1em}{}

\pagestyle{fancy}
\fancyhf{}

\renewcommand{\sectionmark}[1]{\markright{{\itshape #1}}}% \it ought not be used with LaTeX 2e!!

\begin{document}
\section{Section One}
\kant[1]
\section{Section Two}
\kant[2]
\section{Section Three}
\kant[3]
\section{Section Four}
\kant[4-8]

\end{document}


• I was not aware of the options to \fancyheadoffset. Based on the above example, I found that \fancyheadoffset[leh,loh]{1in} achieved the desired effect. – Grant Petty Nov 21 '15 at 3:11
• @GrantPetty I just edited using your code. You can just say [lh] since you want the same for both odd and even pages. I used metric, but that's not compulsory ;). – cfr Nov 21 '15 at 3:13
• I couldn't find any reference to the 'h' option in the documentation. What does it do? – Grant Petty Nov 21 '15 at 3:18
• [lh] for left header, regardless whether even or odd. [rh] for right header. I don't think I used a [h] but, if I did and you point it out, I'll correct it. – cfr Nov 21 '15 at 3:33
• I had seen options 'le', 're' 'ro' etc., no 'rh' or 'lh'. Apparently I haven't found the definitive documentation for fancyhdr. – Grant Petty Nov 21 '15 at 3:49