Page LayoutProblems with page headers (fancyhead)

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

Problems with page headers (fancyhead)

Post by ceke »

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

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
daleif
Posts: 199
Joined: Wed Nov 19, 2008 12:46 am

Problems with page headers (fancyhead)

Post by daleif »

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

Code: Select all

\addtopsmarks{<name of style>}{}{
 \createmark{chapter}{both}{shownumber}{\@chapapp\ }{. \ }
}
ceke
Posts: 13
Joined: Thu Nov 20, 2008 9:45 am

Problems with page headers (fancyhead)

Post by ceke »

Hi again!

Adding this to my code:

Code: Select all

\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

Code: Select all

\fancyhead[LO]{}
\fancyhead[LE]{\thepage} 
\fancyhead[RO]{\thepage}
Not sure I understood your reply correctly though.

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

Re: Problems with page headers (fancyhead)

Post by daleif »

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: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Problems with page headers (fancyhead)

Post by localghost »

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¹
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

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