[OS X TeX] fancyhdr question

Luis Sequeira lfsequeira at gmail.com
Fri Oct 14 13:52:24 CEST 2011

> Greetings,
> I am using the article documentclass and the following header formatting:
> \usepackage{fancyhdr}
> \pagestyle{fancy}
> \lhead{\smaller\nouppercase{\textsc{\leftmark}}}
> \chead{}
> \rhead{\smaller\nouppercase{\textit{\rightmark}}}
> \lfoot{}
> \cfoot{\smaller\thepage}
> \rfoot{}
> The documentation for fancyhdr points out that if one wants both the current section (\leftmark) and subsection (\rightmark) to appear in one's header (and the code above shows that I do), on the first page of a new section the \rightmark will be empty and hence the subsection, even though it appears on that page, will not show up in the header for that page.  The documentation then notes:
>  If this is a problem you must manually insert extra \markright 
>  commands or redefine the ... \sectionmark command to issue a
>  \markboth command with two decent parameters.
> Alas, although it looks like it would be easy for a TeX whiz, I have no idea how to implement these solutions.  I have spent a good bit of time trying to hunt more concrete code on the web, to no avail.  A relevant URL or a code snippet would be most appreciated.
> Chris Menzel

I tried a small example with a section and a subsection starting in the first page of that section and the title of the subsection DOES APPEAR on the right - so apparently your problem has already been solved (probably the documentation is older than the implementation and the author of fancyhdr has solved the problem for you already :-)).

[By the way, the only change I had to make was because \smaller was unrecognized - perhaps you meant \small instead?]

Luis Sequeira

More information about the macostex-archives mailing list