# Let title distinct in mainmatter and TOC and header

Title in mainmatter (long title):

Sec.1 The introduction of TEX --- A powerful typsetting system

blabla...

Sec.2 installation

blabla...

Title in TOC (short title, line break before em dsah):

Sec.1  TEX
--- A typsetting system ....................... 1

Sec.2  Installation .................................. 2


Sec.1 TEX --- A typesetting system

-
It depends on the class you are using. For example, memoir provides two optional arguments to \section just to distinguish among the actual title, the short title for the toc and the short title for the header. –  egreg May 23 '11 at 8:41

In the article document class you can use the optional argument of \section to change the entry in the ToC; this change will also affect the header, but using \markright you can control header; the following example illustrates this:

\documentclass{article}
\usepackage{lipsum}% just to generate filler text

\begin{document}
\tableofcontents

\section[\TeX\\--- A typsetting system]{The introduction of \TeX ---A powerful typsetting system}
\markright{Section \thesection. \TeX ---A typsetting system}
\lipsum[1-20]

\end{document}


The memoir document class offers two optional arguments for the \section command; the first one will control the ToC entry, and the second one will control the header; a little example:

\documentclass{memoir}
\usepackage{lipsum}% just to generate filler text