[texhax] Insert chapter and section heading into document header

Jerry jerry at seibercom.net
Sun Dec 16 02:04:50 CET 2012


On Sat, 15 Dec 2012 19:25:14 +0000
Schwartz, Steven J articulated:

> Jerry wrote on 2012-12-15:
> ----------------
> 
> > %I am attempting to use this to get the headers correct/=
> > \fancyhead{r}{\chaptertitlename\ \thechapter\ \thesection
> > \thesubsection}
> > 
> > The problem is that it does not stay in sync with the document. In
> > fact the first page has:
> > 
> > "Article II 1.1.C" when it should be "Article I 1"
> > 
> > I would really appreciate any assistance that someone might be able
> > to afford me.
> 
> I'll keep this short as others on the list will be more proficient,
> but I think you'll need to get the information you need into the
> appropriate \leftmark or \rightmark commands. Although it's a bit
> confusing, read section 9 of the fancyhdr documentation, noting in
> particular:
> 
> "The \leftmark contains the Left argument of the Last \markboth on
> the page, the \rightmark contains the Right argument of the fiRst
> \markboth or the only argument of the fiRst \markright on the page."
> 
> This is designed to be clever in twosided printing, for example, and
> to show on a spread the information corresponding to the beginning on
> the left page and the end on the right page (I think). The rest of
> that section of the documentation shows how to re-define, e.g.,
> \sectionmark (which is called when you issue a \section command) to
> put the information you want, and format it as you want, into
> \markboth or \markright. I'll stop here as I've hit the limit of my
> ignorance, but suggest you play with these and replace your 
> 
> \fancyhead{r}{\chaptertitlename\ \thechapter\ \thesection
> \thesubsection}
> 
> with something like
> 
> \fancyhead{r}{\rightmark}
> 
> In essence, your problem stems from the fact that the output from
> things like \thechapter depends on WHEN in your latex run that
> command is executed and the header put together by latex. 

I am beginning to think it either cannot be done; or at the very least,
it is beyond my skill level. Since I used code that forces all of the
"chapters" to run together rather than each starting on a new page, it
appears that I cannot accomplish my task. I just spend over two hours
trying every thing I know without success.

What pisses me off is that I can do this in MS Word.


More information about the texhax mailing list