Tariq
2008-05-02 20:56:07 UTC
Hi TeXperts,
I have been deeply frustrated with not being able to get the headers
in the "Table of Contents" in my book to conform with the headers in
the rest of the book. Briefly, I am using \documentclass{book} and I
want to have headers that look like those in the TeXBook (i.e., in
italic, except that mine are set in bold italic and I have section
title alternating with chapter title). I have used fancyhdr package
and followed the advice in its documentation to get the results I
wanted. I am suing the following code
%
%
\pagestyle{fancy} \fancyhf{}
\renewcommand\headrule{\hrule height 0pt}
\pagestyle{fancy}
\fancyheadoffset[LE,RO]{40pt}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\fancyhf{}
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
\fancypagestyle{plain}{%
\fancyhead{}
\renewcommand{\headrulewidth}{0pt}
}
%%
%% To get the headers in italic for chapter and section, I have the
following code
\renewcommand{\chaptermark}[1]{%
\markboth{{\spaceskip = .22em plus 0.02em minus 0.02em \itshape
\chaptername
\ \thechapter\ \ \ $\bullet$ \ \ #1}}{}}
%
\renewcommand{\sectionmark}[1]{%
\markright{{\spaceskip = .22em plus 0.02em minus 0.02em \itshape
Section
\ \thesection\ \ \ $\bullet$ \ \ #1}}{}}
%%
To get the same look for the headers in the frontmatter (such as
Preface, Acknowledgments etc), I have something like the following
\chapter*{Preface\markboth{\itshape P\MakeLowercase{reface}}{}}
This all seems to work quite well for everything **EXCEPT** for the
Table of Contents. I have tried the following:
\tableofcontents\markboth{\itshape T\MakeLowercase{able of} C
\MakeLowercase{ontents}}{}
On the surface, it looks like the code for the Preface above, and it
seems to conform to the rest of the document **BUT** fails when the
Table of Contents is longer than 2 pages!!! The headers in the Table
of Contents are all set in uppercase (not in italics). Is there a way
to correct this? This sort of things makes my book appear nonuniform
and nonprofessional. I am sure there is some workaround but I have
nearly given up on how to do it. I would greatly appreciate any advice
and suggestions. BTW, I am sure this problems plagues my List of
Figures and List of Tables also, but I have not been able to test it
because the list of figures and tables does not go beyond one or two
pages yet.
Regards,
Tariq
I have been deeply frustrated with not being able to get the headers
in the "Table of Contents" in my book to conform with the headers in
the rest of the book. Briefly, I am using \documentclass{book} and I
want to have headers that look like those in the TeXBook (i.e., in
italic, except that mine are set in bold italic and I have section
title alternating with chapter title). I have used fancyhdr package
and followed the advice in its documentation to get the results I
wanted. I am suing the following code
%
%
\pagestyle{fancy} \fancyhf{}
\renewcommand\headrule{\hrule height 0pt}
\pagestyle{fancy}
\fancyheadoffset[LE,RO]{40pt}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\fancyhf{}
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
\fancypagestyle{plain}{%
\fancyhead{}
\renewcommand{\headrulewidth}{0pt}
}
%%
%% To get the headers in italic for chapter and section, I have the
following code
\renewcommand{\chaptermark}[1]{%
\markboth{{\spaceskip = .22em plus 0.02em minus 0.02em \itshape
\chaptername
\ \thechapter\ \ \ $\bullet$ \ \ #1}}{}}
%
\renewcommand{\sectionmark}[1]{%
\markright{{\spaceskip = .22em plus 0.02em minus 0.02em \itshape
Section
\ \thesection\ \ \ $\bullet$ \ \ #1}}{}}
%%
To get the same look for the headers in the frontmatter (such as
Preface, Acknowledgments etc), I have something like the following
\chapter*{Preface\markboth{\itshape P\MakeLowercase{reface}}{}}
This all seems to work quite well for everything **EXCEPT** for the
Table of Contents. I have tried the following:
\tableofcontents\markboth{\itshape T\MakeLowercase{able of} C
\MakeLowercase{ontents}}{}
On the surface, it looks like the code for the Preface above, and it
seems to conform to the rest of the document **BUT** fails when the
Table of Contents is longer than 2 pages!!! The headers in the Table
of Contents are all set in uppercase (not in italics). Is there a way
to correct this? This sort of things makes my book appear nonuniform
and nonprofessional. I am sure there is some workaround but I have
nearly given up on how to do it. I would greatly appreciate any advice
and suggestions. BTW, I am sure this problems plagues my List of
Figures and List of Tables also, but I have not been able to test it
because the list of figures and tables does not go beyond one or two
pages yet.
Regards,
Tariq