# acmsmall class: linebreak in theorem headline

I have a theorem in a acmsmall document where no linebreak in the headline occurs despite its length:

\documentclass[prodmode,acmtosn]{acmsmall}

\begin{document}
\begin{theorem}[long long long long long long long long long long long long long long long long long long long long long long long long long long title]
content...
\end{theorem}
\end{document}


Its related to these questions: 1 2 but I guess that I'm obliged to use the builtin theorem setup and can't switch to amsthm or ntheorem.

Theorems are lists. The headlines are set through the optional argument of \item, and in your class actually in a \box. There won't break.

You can try to fake a suitable look by changing the behaviour for an empty optional argument. But imho it would be better to shorten the title.

\documentclass[prodmode,acmtosn]{acmsmall}
\makeatletter
\def\@opargbegintheorem#1#2#3{%
\trivlist
\item[\hskip 12pt
\hskip \labelsep
{\ifitalicenv{\scshape{#1}}\else{\itshape#1}\fi%
\savebox\@tempboxa{\ifitalicenv{\scshape#3}\else{\itshape#3}\fi}%
\ifdim\wd\@tempboxa>\z@%
\ {\rmfamily #2}\unskip\hskip5pt\relax$($\box\@tempboxa$)$.%
\else \ {\rmfamily #2}\unskip\hskip5pt\relax
\fi\unskip\hskip5pt}]
\ifitalicenv\itshape\else\upshape\fi\hskip-\labelsep}

\makeatother

\begin{document}
\begin{theorem}[blub]
content...
\end{theorem}

\begin{theorem}[] {$($\scshape long long long long long long long long long long long long long long long long long long long long long long long long long long title$)$.\unskip\hskip5pt}
content...
\end{theorem}
\end{document}