2

Please consider this code snips:

\def\chaptermark##1{\markboth{\@chapapp\ \thechapter\ ##1}{##1}}    % left mark & right marks

and

\def\sectionmark##1{\markright{##1}}

How can I redefine \sectionmark{} so that it contains the value (the ##1 argument) from \chaptermark##1 in \markright{}?

i.e something like this :

\def\sectionmark{\markright{\chaptermark##1{##1}}}

2
  • 1
    I might be missing something here, but if a chapter has already set the right mark to ##1, why do you need the section to also set it explicitly? Commented Dec 7, 2010 at 4:03
  • What I am after is that in my header, I want to make leftmark corresond to "PageNumber | Chapter ChapterNumber" while I want rightmark to be "ChapterTitle | PageNumber". The problem is that rightmark is determined by sectionmark which is the section title, so I want to redefine sectionmark to contain by the chapter title.
    – user2330
    Commented Dec 7, 2010 at 13:29

2 Answers 2

3

My thought is to define some sort of dummy variable/quantity with a default value which is changed as appropriate by \chaptermark and used by \sectionmark. For instance (keeping in mind I don't use \def much/at all):

\def\dummy {some default value}
\def\chaptermark##1{\markboth{\@chapapp\ \thechapter\ ##1}{##1} \def\dummy{##1}}
\def\sectionmark{\markright{\dummy}}
1
  • I was beating about the bush the whole time, very good for your answer. \def\dummy {Chapter Dummy} \def\chaptermark##1{\def\dummy{##1}} \def\chaptermark##1{\markboth{\@chapapp\ \thechapter\ ##1}{##1} \def\dummy{##1}} \def\sectionmark##1{\markright{\dummy}}
    – user2330
    Commented Dec 7, 2010 at 14:15
1

Just what I was looking for, in my case I wanted a different style when there is only a chapter title but no sections (table of contets, glossary, etc in my thesis) and the rest that contains section to display the chapter but with different style. In case someone wonders this is the working code

\def\dummy{dummy}
\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{\thechapter. #1 }}{\thechapter. #1} \def\dummy{#1}}
\renewcommand{\sectionmark}[1]{\markboth{\thechapter. \dummy}{\thechapter. \dummy}}

You must log in to answer this question.