4

I have the following simple problem. The name of one of my sections is very long. Hence I decided to have a line break in its title. For the header I use a short version of this title. So it looks something like this

\section[Short]{Long title part 1 \newline Long title part 2}

Now I wonder the following: How would it be possible to avoid that the \newline will be also used in the Table of Contents? Is there a way to do that?

3
  • 2
    In the standard and most contributed classes, the table of contents will use the short title not the one with the \newline – David Carlisle Jun 11 '13 at 21:11
  • Welcome to TeX.SX! What document class are you using? – egreg Jun 11 '13 at 21:11
  • Thanx. I use {scrbook} and you are right the short title will be in the table of contens.. I hadn't recognized that earlier.. But that makes the situation even worse... – BigFella Jun 11 '13 at 21:34
6

Since you are using scrbook the manual (page 86) suggests you can use an optional argument of

[head={heading text}, tocentry={toc text}]{long main section heading}

enter image description here

enter image description here

\documentclass[headings=optiontoheadandtoc]{scrbook}
\listfiles
\begin{document}

\tableofcontents
\chapter[head={cc heading text}, tocentry={cc toc text}]{long main cc heading}
zzz

\section[head={ss heading text}, tocentry={sstoc text}]{ss heading}

zzzz

\clearpage

aaaa
\clearpage
hhhh
\end{document}
5
  • After installing the 3.10 KOMA I tried this out. I works perfect when I use \chapter[head={short},tocentry={toc}]{LONG}, however I does not work with \section – BigFella Jun 12 '13 at 5:11
  • @BigFella works for me: see updated answer (Note this is why questions should always include complete small documents showing the problem) – David Carlisle Jun 12 '13 at 7:53
  • Thank you @David Carlisle. I was trying out your simple example and it works. Going back to my original file where it did not work, I realized after some trial and error that it also worked there when I was commenting out the folling lines in a sty file that I was loading. \RequirePackage[calcwidth]{titlesec} \titleformat{\section}[hang]{\sffamily\bfseries} {\Large\thesection}{12pt}{\Large}[{\titlerule[0.5pt]}] Without these lines it works. But I am not quite sure what it is about these lines that causes the problems.. – BigFella Jun 12 '13 at 21:40
  • @BigFella I don't really use koma but they are big classes with lots of built in hooks and customisation possibilities, so it wouldn't be a surprise if packages like titlesec that are designed to add hooks and customisation possibilities to the rather simple interfaces of the standard classes don't really work. If at all possible it's best to to it the koma way if you go that route rather than load lots of packages adding similar features with different syntax. – David Carlisle Jun 12 '13 at 22:02
  • Thanx. I am happy that it works now and will just leave the titlesec out.. – BigFella Jun 12 '13 at 22:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.