[Tex/LaTex] Can’t get \fancyheadoffset to work

calculationserrorsfancyhdrheader-footer

I have loaded the fancyhdr package and I want to make the headers and footers wider (clamp them to the margin), so I inserted the following line after the package has loaded:

\fancyheadoffset[LE,RO]{\marginparsep + \marginparwidth}

This is from an example in the document Page layout in LaTeX. But when I try to compile I get the following error:

Missing number, treated as zero

two times, and equally many plus signs in my document. When I enter \marginparsep in the body text, I also found that this gave the same error message. Why is it missing? I need it! 😛

Best Answer

You have two options:

  1. Load the calc package:

    \usepackage{calc}
    \fancyheadoffset[LE,RO]{\marginparsep + \marginparwidth}
    
  2. Use the e-TeX \dimexpr:

    \fancyheadoffset[LE,RO]{\dimexpr\marginparsep+\marginparwidth\relax}
    
Related Question