Let us consider the following scenario.

      \subsection{Hai Hello}


How can I do this?

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

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}


• 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
• @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
• 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
• 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