4

This question already has an answer here:

I have a problem with a too long line in the theorem environment. The following example shows the problem, I need a line break in the heading, but there is none. Any suggestions?

\documentclass[a4paper,10pt,twocolumn]{article}

\usepackage{theorem}
{\theoremheaderfont{\upshape\bfseries}
 \theorembodyfont{\normalfont\slshape}
 \newtheorem{definition}{Definition}}

\begin{document}

\begin{definition}[Long heading that should have a line break]
A definition is a statement of the meaning of a term (a word, phrase, or other set of symbols).
Definitions can be classified into two large categories, intensional definitions (which try to give the essence of a term) and extensional definitions (which list every single object that a term describes).
A term may have many different senses and multiple meanings, and thus require multiple definitions.
\end{definition}

\end{document}

Output

Thanks for your help!

marked as duplicate by Mico, egreg, Werner, Svend Tveskæg, Heiko Oberdiek Sep 9 '15 at 11:29

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

4

With the help of another topic I found a solution myself, if anyone is interested, the solution is below. I switched the package "theorem" with "ntheorem" and added some formation commands, which I adapted from another topic:

\documentclass[a4paper,10pt,twocolumn]{article}

\usepackage{ntheorem}

\makeatletter
\renewtheoremstyle{plain}% Adds automatic line break, if heading is too long
  {\item{\theorem@headerfont ##1\ ##2\theorem@separator}~}
  {\item{\theorem@headerfont ##1\ ##2\ (##3)\theorem@separator}~}
\makeatother

{\theoremheaderfont{\upshape\bfseries}
 \theorembodyfont{\normalfont\slshape}
 \newtheorem{definition}{Definition}}

\begin{document}

\begin{definition}[Long heading that should have a line break]
A definition is a statement of the meaning of a term (a word, phrase, or other set of symbols).
Definitions can be classified into two large categories, intensional definitions (which try to give the essence of a term) and extensional definitions (which list every single object that a term describes).
A term may have many different senses and multiple meanings, and thus require multiple definitions.
\end{definition}

\end{document}

enter image description here

Note 1: Can some mod please mark this as solved? (Or delete it, if this is an uninteresting question.) I somehow wasn't able to login first so I asked this question as guest and now found a solution myself.

Note 2: This solution is different compared to the ones already present in this forum! This solution does not work with theorem package and this solution requires eight more lines of code plus the result is different (I don't want a line break AFTER the heading just INSIDE the heading).

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