Using the fancyhdr
package, is it possible to change(increase or decrease) the headrule length without changing the header length?
In the picture related, one can see that the headrule rectangle(in red) does not have the same size length as header. This is exactly what I want. Actually, I would like headrule and textwidth with the same length, but header should be bigger than both.
By using, for example:
\fancyheadoffset{1 cm}
I can make the header bigger than textwidth. But the headrule grows as well, and both header and headrule have the same length.
In this other example that I am adding, one can see the expanded header, with the logo, and the headrule with the same size as the header.
What if I want to make the headrule with the same size as the footrule (or with whatever size/align I want), keeping the header unchanged?
Best Answer
You can simply redefine
\headrule
; in the following example I used two new lengths\HFleft
and\HFright
to control the left and right trimming of the headrule, respectively; simply changing the values for those lengths you can shorten the headrule in the desired way. An auxiliary \FHoffset length is used as the argument of\fancyheadoffset
. Some examples:Initially,
\FHoffset
is set to0cm
as well as both trimmings:Setting
\FHoffset
to1cm
and\FHleft
and\FHright
to1cm
, the width of the headrule will be equal to\textwidth
and the headrule will span the text width:Changing the settings to
the result is now
and with
we get