Page Layout ⇒ Book: Long title in CONTENTS but short title in HEADER
Book: Long title in CONTENTS but short title in HEADER
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
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
Book: Long title in CONTENTS but short title in HEADER
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
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}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
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
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.