1

Let us consider the following scenario.

If I write like the following, it will appear in table of contents as "Hai Hello".

      \subsection{Hai Hello}

But I want to hide "Hello" in table of contents. The table of contents have to show only "Hai".

How can I do this?

  • 1
    Try \subsection[Hai]{Hai Hello} ;-) – user31729 Jun 30 '15 at 17:55
2

Basically any documentclass I've used so far has sectioning commands such as \section, \subsection etc. which provide an optional argument which is meant for the title designed for the ToC, whereas the mandatory is used in the document text as heading.

This was introduced to limit the length of ToC entries, but it can be used to abbreviate headings for the ToC as well.

An automatic 'shortening' requires more work.

\documentclass{article}
\usepackage{blindtext}
\begin{document}
\tableofcontents
\clearpage
\section[Super]{Super section}
\subsection[Hai]{Hai Hello}
\end{document}

enter image description here

|improve this answer|||||
  • 1
    the ams document classes have a different mechanism; by default, the full title goes into the toc, and the short version is used only for running heads. (but there is a documented workaround.) so it's really important to read the relevant documentation. – barbara beeton Jun 30 '15 at 18:17
  • 1
    @barbarabeeton: I've never used ams classes. I admit, that the O.P. was not very clear about his class – user31729 Jun 30 '15 at 18:18
  • 1
    you're probably entirely safe with what you answered. there aren't all that many people in this forum who do use the ams classes, and those who do usually say so. just being my usual nit-pickerly self. – barbara beeton Jun 30 '15 at 18:28
  • @barbarabeeton: I am aware that the ams class do something (well, strange) regarding the ToC, perhaps I'll add another solution too, but not right now. – user31729 Jun 30 '15 at 18:31
  • 1
    i gave the gory details about tocs and amsbook in my answer to How to hide a footnote in a section title from the table of contents. a pointer to that might be sufficient. – barbara beeton Jun 30 '15 at 18:34

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