[texhax] Insert chapter and section heading into document header

Jerry jerry at seibercom.net
Tue Dec 18 12:24:52 CET 2012


On Tue, 18 Dec 2012 02:46:41 -0800
Donald Arseneau articulated:

> Jerry <jerry at seibercom.net> writes:
> 
> > I am still very new to Latex. I am in the process of creating a
> > document that requires that the "Chapter" + "Section" +
> > "subsection" if applicable be included in the document header. This
> > is a large one sided report.    
> 
> [... lots of un-beginnerly complicated stuff ...]
> 
> > %Format section numbering
> > \def\thesection{\arabic{section}.}
> > \def\thesubsection{\arabic{section}.\Alph{subsection}}
> > \def\thesubsubsection{\arabic{section}.\Alph{subsection}.\Roman{subsubsection}}
> > 
> > %I am attempting to use this to get the headers correct/=
> > \fancyhead{r}{\chaptertitlename\ \thechapter\ \thesection
> > \thesubsection}
> 
> First, I don't think you mean for the headings to look like
> "The Chapter Title I 2.2.5"... you have repeated the section 
> number ("2").
> 
> I don't belive you want the chapter number after the chapter 
> title. That was probably sloppy typing/asking though, because
> your report of "Article II 1.1.C" below suggests you really used:
> \fancyhead{r}{\chaptername\ \thechapter\ \thesection \thesubsection}
> 
> > The problem is that it does not stay in sync with the document.
> 
> Now the meat of your problem: You have not defined the things that 
> are supposed to control the headers! They are \chaptermark,
> \sectionmark, and \subsectionmark.
> 
> % Note that the section number is included in \thesubsection
> \renewcommand\chaptermark[1]{\markright{\chaptername\ \thechapter}}
> \renewcommand\sectionmark[1]{\markright{\chaptername\ \thechapter\
> \thesection}}
> \renewcommand\subsectionmark[1]{\markright{\chaptername\ \thechapter\
> \thesubsection}}
> 
> And your heading should specify:
> 
> \fancyhead{r}{\rightmark}
> 
> If you want to include the actual title in any of the header marks,
> use "#1" in the definition of the relevant mark command.
> 
> If you really are a beginner diving into internal macros and
> document-class creation, then ask when you get confused about what to
> define, before getting pissed off.

Sorry if I appear "pissed off", but I really am not. I believe the word
that would most correctly describe the situation is "frustrated". In
any case, I believe I have tried all that you described above;
however, I will take a fresh look at it perhaps later today or
definitely sometime this week.

Since the project was completed successfully in MS Word, there is no
longer an urgency to it. However, I would like to learn more about
Latex. By the way, your remark, "If you want to include the actual
title in any of the header marks, use "#1" in the definition of the
relevant mark command", is the first I have seen of that. Finding
accurate, concise documentation in a centralized location appears to
be as hard as finding a virgin in a whore house. At least that has been
my experience so far. I would love to find an all encompassing book,
but have not been able to locate such an item. Do you have any
suggestions?


-- 
Jerry ♔

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the Reply-To header.
__________________________________________________________________



More information about the texhax mailing list