Page Layout ⇒ Book: Long title in CONTENTS but short title in HEADER
Book: Long title in CONTENTS but short title in HEADER
Hi,
The title of one of my book chapters is too long to be displayed correctly in the RUNNING HEADER. I know that I can add a short title by doing
\chapter[Short title]{Long title}
Then, however, the short title also appears in the TABLE OF CONTENTS where I would like the long title to be displayed. Therefore, I'm simply looking for a way to have the short title in the RUNNING HEADER but the long title in the TABLE OF CONTENTS.
Does anybody have an idea how to solve this easily?
Thanks!
pdfTEX-1.40.3
book class
The title of one of my book chapters is too long to be displayed correctly in the RUNNING HEADER. I know that I can add a short title by doing
\chapter[Short title]{Long title}
Then, however, the short title also appears in the TABLE OF CONTENTS where I would like the long title to be displayed. Therefore, I'm simply looking for a way to have the short title in the RUNNING HEADER but the long title in the TABLE OF CONTENTS.
Does anybody have an idea how to solve this easily?
Thanks!
pdfTEX-1.40.3
book class
NEW: TikZ book now 40% off at Amazon.com for a short time.
Book: Long title in CONTENTS but short title in HEADER
you have to redefine an internal macro:
Code: Select all
\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}
Book: Long title in CONTENTS but short title in HEADER
Hi,
you could use the fancyhdr package, as the following example suggets:
Please refer to the package User's manual for further information.
you could use the fancyhdr package, as the following example suggets:
Code: Select all
\documentclass{book}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{lipsum}% just to generate some text
\begin{document}
\tableofcontents
\chapter{A chapter with a really relly relly relly relly relly relly relly relly relly relly relly relly relly relly relly relly relly relly relly relly relly relly relly relly relly relly relly relly relly relly relly relly relly relly relly relly relly relly long title}
\fancyhf{}
\fancyhead[RO,LE]{\MakeUppercase{\chaptername\ \thechapter. A short title}}
\fancyhead[RE,LO]{\thepage}
\lipsum[1-40]
\chapter{Test}
\fancyhf{}
\fancyhead[RO,LE]{\leftmark}
\fancyhead[RE,LO]{\thepage}
\lipsum[1-40]
\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Book: Long title in CONTENTS but short title in HEADER
Thanks phi. That did the trick. Thanks to gmedina as well.phi wrote:you have to redefine an internal macro:
Book: Long title in CONTENTS but short title in HEADER
Hi,
I'm facing the same problem as "bierholen" and was just wondering if "phi's" marco also works for "sections", and, therefore, whether it would be possible just to replace "chapter" with "section" within that macro. If that works: fine -- if not, does somebody have suggestions on how a macro that allows for short sections in the header and long sections in TOC would have to look like?
Although may work fine in a typical bookclass it did not work for me using the option "oneside". While the short title appears on subsequent pages, it does not, however, appear on the first page on which the section initially begins.
One possibility how to circumvent these difficulties can be found @ http://www.developpez.net/forums/d52725 ... titre-long and consists of:
Sections that are too long can be redefined by \mysection{short title}{long title}. Any other suggestions? Thanks!
François
I'm facing the same problem as "bierholen" and was just wondering if "phi's" marco also works for "sections", and, therefore, whether it would be possible just to replace "chapter" with "section" within that macro. If that works: fine -- if not, does somebody have suggestions on how a macro that allows for short sections in the header and long sections in TOC would have to look like?
Although
Code: Select all
\section[short title]{long title\sectionmark{header}}
\sectionmark{header}
One possibility how to circumvent these difficulties can be found @ http://www.developpez.net/forums/d52725 ... titre-long and consists of:
Code: Select all
\newcommand{\mysection}[2]{%
\sectionmark{#1}%
\section{#2}%
\sectionmark{#1}%
}
François
Book: Long title in CONTENTS but short title in HEADER
a bit too late, but isnt it easier to just manually specify the marks for the problematic chapters, like this:
ofc you have to adjust it to the header/footer type you're using, but it doesnt effect the TOC entry at all. in my case it does the trick 
and ofc its identical to what gmedina suggested, but you just redefine the mark.
Code: Select all
\chapter{very long title bla bla bla}
\markboth{very long title}{}

and ofc its identical to what gmedina suggested, but you just redefine the mark.