LaTeX forum ⇒ Page LayoutProblems with page headers (fancyhead)

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
ceke
Posts: 13
Joined: Thu Nov 20, 2008 9:45 am

Problems with page headers (fancyhead)

Postby ceke » Sun Jan 25, 2009 12:58 pm

Hej guys!

I have a problem with the fancyheadings package.

I have a style that prints the chapter name on odd pages and section marks on even pages, pretty much like the default.

Now, if there is a chapter with no sections in it, for example a simple summary chapter at the end, the problem is that LaTeX seems to remember the last section mark (from the previous chapter). I would like to kill this one and print nothing for the case when the chapters have no sections.

Looking at the FAQ and the "LaTeX companion" and also the documentation for "fancyheadings", I find.... nothing.

Anyone here who knows?

Best regards,
/C

daleif
Posts: 199
Joined: Wed Nov 19, 2008 12:46 am

Postby daleif » Sun Jan 25, 2009 3:22 pm

by default \chapter only writes to the \leftmark, I would suggest redefining \chaptermark to add its title to both marks (i.e. fill in both arguments of \markboth and not just the left one)

BTW: if you were using memoir (which has a better header interface build in), it would be enough with

  1. \addtopsmarks{<name of style>}{}{
  2. \createmark{chapter}{both}{shownumber}{\@chapapp\ }{. \ }
  3. }

ceke
Posts: 13
Joined: Thu Nov 20, 2008 9:45 am

Postby ceke » Sun Jan 25, 2009 3:56 pm

Hi again!

Adding this to my code:
  1. \renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter. #1}{\chaptername\ \thechapter. #1}}


did not help. It seems like fancyhead is redefining the markers. The only workaround I found so far is to add the following at the top of the no-sections chapter

  1. \fancyhead[LO]{}
  2. \fancyhead[LE]{\thepage}
  3. \fancyhead[RO]{\thepage}


Not sure I understood your reply correctly though.

Cheers,
/C

daleif
Posts: 199
Joined: Wed Nov 19, 2008 12:46 am

Postby daleif » Sun Jan 25, 2009 4:15 pm

Please post a minimal example then.

i.e. a short dicumetn showing what you do and displays your problem.

leave out anything unnessary

User avatar
localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Sun Jan 25, 2009 4:24 pm

ceke wrote:[...] I have a problem with the fancyheadings package. [...]

You better take a look at packages like fancyhdr or titlesec. Nevertheless you should meet the request of daleif for a minimal working example (MWE). A possible solution for your problem could be to use the \markboth command.


Best regards
Thorsten¹
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1


Return to “Page Layout”

Who is online

Users browsing this forum: No registered users and 4 guests