40

I work with documentclass report and use fancyhdr package for chapters in this way:

\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\chaptermark}[1]{\markright{\thechapter\ #1}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\fancyhf{}
\fancyhead[LO]{\bfseries\nouppercase\rightmark}
\fancyhead[RE]{\bfseries\nouppercase\leftmark}
\fancyhead[RO]{\bfseries\nouppercase\thepage} 
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\addtolength{\headheight}{0.5pt}
\fancypagestyle{plain}{
\fancyhead{} 
\renewcommand{\headrulewidth}{0pt} 
}

I would like to change space between the line and the following text. Can anyone help me?

4
  • 4
    fancyhdr isn't involved: the relevant parameter is \headsep. Perhaps using geometry is the best strategy.
    – egreg
    Commented May 19, 2012 at 20:18
  • You have two redefinitions of \chaptermark and two competing settings of \headrulewidth. Please consider eliminating the deadwood code.
    – Mico
    Commented May 19, 2012 at 22:13
  • @Mico The second definition of \headrulewidth is correct, being in \fancypagestyle
    – egreg
    Commented May 19, 2012 at 22:51
  • @egreg: Thanks, I hadn't noticed this feature.
    – Mico
    Commented May 19, 2012 at 22:54

1 Answer 1

54

As @egreg pointed out in the comments, you have to adjust the length headsep. This can be done in the following ways:

  1. Use the command \setlength{\headsep}{0.2in} where you can put the relevant value of length.

  2. Use the package geometry as \usepackage[margin=1in,headsep=.2in]{geometry}.

As pointed in the comment by @Mico in the comments, you have defined \renewcommand{\chaptermark}.....two times. Please correct them.

5
  • The second \fancyhead{} is correct, being in \fancypagestyle. The same for \headrulewidth.
    – egreg
    Commented May 19, 2012 at 22:52
  • @egreg: Sorry overlooked it. Thanks for the edit.
    – user11232
    Commented May 19, 2012 at 22:57
  • Thanks, both solutions are working. I'm just a little bit confused now... Should I delete one of the renewcommands for \chaptermark and \headrulewidth or not?
    – Laura
    Commented May 20, 2012 at 11:55
  • @Jane: headrulewidth is ok. Everything depends on your class and whether two side/what do you want as header. I feel that the first three renewcommands -- \renewcommand{\chaptermark}[1]{\markboth{#1}{}} \renewcommand{\chaptermark}[1]{\markright{\thechapter\ #1}} \renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}} can be safely removed if you wish.
    – user11232
    Commented May 20, 2012 at 13:17
  • I want to mantain both top and bottom margin while increasing the space between page header and text block, and finally have that same space between the text and footer, too. Increasing headsep and footskip by the same amount AND then decreasing textheight accordingly doesn't do the trick, as there isn't an equivalent definition of headsep for the footer. Any help?
    – mariovilar
    Commented Aug 29, 2023 at 20:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .