# How can I get a line break in a theorem headline?

I have a theorem title, which is longer then the page width. How do I get the title in two lines?

\begin{theorem}[this title is to long for one line]
the theorem
\end{theorem}

-

Can you provide more information on the document class and packages you are using? For example, the following code seems to cope with long titles and descriptions but may not be addressing your problem:

\documentclass{amsart}
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem}[this theorem has a long title that extends well over a line but is handled without any manual intervention on the author's partand even this description goes over a line]
body of the theorem
\end{theorem}
\end{document}


If you could provide a similar Minimal Working Example that shows your problem this would help others to comment on it more usefully than I have here.

Following on from your comment (and assuming you mean scrbook for the class then using the amsthm package may suffice, e.g.:

\documentclass[11pt,a4paper,twoside ,fleqn,headsepline]{scrbook}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem}[this theorem has a long title that extends well over a line but is handled without any manual intervention on the author's part and even this description goes over a line]
Body of the theorem
\end{theorem}
\end{document}

-
thanks for the answer, it seems to be my document class: \documentclass[11pt,a4paper,twoside ,fleqn,headsepline]{scrapbook} but scrbook has the best layout I found –  Klaus Aug 18 '11 at 15:17
You can have a theorem style in most document classes but you may need to load appropriate math packages to achieve what you want to do, I used amsart because that provides a base math setup and you didn't specify which class and styles you were using. I have added an example in the answer above to show one possible approach for a theorem in the class you've chosen. –  mas Aug 18 '11 at 15:27
ah not using \usepackage{amsthm} was the problem, thx –  Klaus Aug 18 '11 at 15:43

A solution for LaTeX default theorem environment:

\makeatletter
\renewcommand*{\@opargbegintheorem}[3]{\trivlist
\item[\hskip \labelsep{\bfseries #1\ #2}] \textbf{(#3)}\ \itshape}
\makeatother


Here the macro \@opargbegintheorem is redefined, which originally contains

  \item[\hskip \labelsep{\bfseries #1\ #2\ (#3)}]\itshape}


so the optional theorem title has been moved to after the label instead if being within, so now line breaks are possible.

Test example:

\documentclass{book}
\newtheorem{theorem}{Theorem}
\makeatletter
\renewcommand*{\@opargbegintheorem}[3]{\trivlist
\item[\hskip \labelsep{\bfseries #1\ #2}] \textbf{(#3)}\ \itshape}
\makeatother
\begin{document}
\begin{theorem}[This theorem has a very long title which requires a line break]
text
\end{theorem}
\end{document}


So much for information. I recommend using a capable theorem package such as amssthm or ntheorem which extends LaTeX's theorem capabilities.

-
Perhaps you should mention that ntheorem doesn't solve this "too long title" problem and that your hack won't work with it. On the other hand, amsthm doesn't any problem at all with this kind of thing. –  Philippe Goutet Sep 25 '11 at 20:35
@Philippe: Yes, it's just a fix of an internal macro. If a theorem package would be used, the situation has to be revisited. As you confirm, no problem with amsthm, I assume it can be solved with ntheorem as well. When I've got some time, I could add a fix as well. For now especially my recommendation of using a capable package stands, which is always better than a "hack", and I prefer amsthm , as mentioned here. –  Stefan Kottwitz Sep 25 '11 at 21:02