Page LayoutToC and headers with book class

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
Sonia
Posts: 1
Joined: Thu Nov 19, 2009 6:34 pm

ToC and headers with book class

Post by Sonia »

Hi all!

I'm using the book class of latex, and I want ToC and running title be different.

My code is:

\chapter[indicator for running title]{full title}

Unfortunately, running title is shown in ToC. Instead, I want the full title appears in ToC (but maintaining the running title in headers).

Thanks in advance...

%Sonia

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

ToC and headers with book class

Post by gmedina »

Hi,

you could modify the \@chapter command as defined in book.cls. Take a look at the following example:

Code: Select all

\documentclass{book}
\usepackage{lipsum}% just to generate some text

\makeatletter
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
                       \if@mainmatter
                         \refstepcounter{chapter}%
                         \typeout{\@chapapp\space\thechapter.}%
                         \addcontentsline{toc}{chapter}%
                                   {\protect\numberline{\thechapter}#2}%
                       \else
                         \addcontentsline{toc}{chapter}{#2}%
                       \fi
                    \else
                      \addcontentsline{toc}{chapter}{#2}%
                    \fi
                    \chaptermark{#1}%
                    \addtocontents{lof}{\protect\addvspace{10\p@}}%
                    \addtocontents{lot}{\protect\addvspace{10\p@}}%
                    \if@twocolumn
                      \@topnewpage[\@makechapterhead{#2}]%
                    \else
                      \@makechapterhead{#2}%
                      \@afterheading
                    \fi}
\makeatother

\begin{document}
\tableofcontents

\chapter[Short title]{Long title}
\lipsum[1-20]

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply