Why \allowbreak is not working?

So, here's the code I have:

\usepackage{amsthm}

\begin{theorem}
...could be now considered as an algebraic structure $DB_E = \left\langle \mathbb{S},\allowbreak \mathbb{E},\allowbreak f,\allowbreak \mathbb{V},\allowbreak \mathbb{R},\allowbreak \mathbb{C},\allowbreak Op_a,\allowbreak Op_c,\allowbreak Op_m \right\rangle$.
\end{theorem}


and here is the result (grey area denotes the edge of the page):

Obviously, \allowbreak does not do anything. Why is it?

-
Perhaps try '\mathlist' as shown here: tex.stackexchange.com/questions/19094/allowing-line-break-at-in-inline-math-mode‌​-breaks-citations –  rickhg12hs Jun 18 '13 at 7:14
Just don't use \left and \right, which in this case do nothing. Then \allowbreak will work. –  egreg Jun 18 '13 at 7:51
Welcome to TeX.SE! I have two requests: Given the answer, could you edit the question title so that other people with a similar problem will find your question more easily? Could you also insert a few linebreaks in your code so that it will be easier for someone else to get an overview of your formula/text? :-) –  Lover of Structure Jun 18 '13 at 8:34

This is another case for which \left and \right are not appropriate:

1. there is no delimiter to increase the size of;

2. the spaces after commas cannot participate to stretching or shrinking together with the other spaces in the same line;

3. the formula is not breakable across lines under any circumstance.

So the first step to do is to remove \left and \right (and to disable any automatic feature in the editor). Then a carefully placed \linebreak[0] will help in the pagination.

\documentclass[a4paper]{article}
\usepackage{amsfonts,amsthm}
\newtheorem{theorem}{Theorem}

\begin{document}

\noindent\parbox{4cm}{
\begin{theorem}
...could be now considered as an algebraic structure $DB_E = \langle \mathbb{S},\mathbb{E},f, \mathbb{V},\mathbb{R},\mathbb{C},\linebreak[0] Op_a,Op_c,Op_m \rangle$.
\end{theorem}
}

\noindent\parbox{6.5cm}{
\begin{theorem}
...could be now considered as an algebraic structure $DB_E = \langle \mathbb{S},\mathbb{E},f,\linebreak[0] \mathbb{V},\mathbb{R},\mathbb{C}, Op_a,Op_c,Op_m \rangle$.
\end{theorem}
}

\begin{theorem}
...could be now considered as an algebraic structure $DB_E = \langle \mathbb{S},\mathbb{E},\linebreak[0] f,\mathbb{V},\mathbb{R},\mathbb{C}, Op_a,Op_c,Op_m \rangle$.
\end{theorem}

\end{document}


-
Note that, by default, there's no stretching or shrinking of the spaces after commas (\thinmuskip) in math. –  Hendrik Vogt Jun 18 '13 at 15:31
@HendrikVogt There could be. ;-) –  egreg Jun 18 '13 at 16:35

You could try the following middlebreak macro:

[not using at all \left and \right was better in your posted case, as pointed out in comments; but then look at the second proposal below for more general usage]

\documentclass{article}
\usepackage{amsfonts,amsthm}
\newtheorem{theorem}{Theorem}

% to be used within a \left \right pair
\def\middlebreak {\nulldelimiterspace0pt
\right.\allowbreak\mskip 0mu plus .5mu \nulldelimiterspace0pt\left.}%

\begin{document}

{%
\hsize 3cm
\begin{theorem}
...could be now considered as an algebraic structure $DB_E = \left\langle \mathbb{S},\middlebreak \mathbb{E},\middlebreak f,\middlebreak \mathbb{V},\middlebreak \mathbb{R},\middlebreak \mathbb{C},\middlebreak Op_a,\middlebreak Op_c,\middlebreak Op_m \right\rangle$.
\end{theorem}
}%

{%
\hsize 7cm
\begin{theorem}
...could be now considered as an algebraic structure $DB_E = \left\langle \mathbb{S},\middlebreak \mathbb{E},\middlebreak f,\middlebreak \mathbb{V},\middlebreak \mathbb{R},\middlebreak \mathbb{C},\middlebreak Op_a,\middlebreak Op_c,\middlebreak Op_m \right\rangle$.
\end{theorem}
}%

\begin{theorem}
...could be now considered as an algebraic structure $DB_E = \left\langle \mathbb{S},\middlebreak \mathbb{E},\middlebreak f,\middlebreak \mathbb{V},\middlebreak \mathbb{R},\middlebreak \mathbb{C},\middlebreak Op_a,\middlebreak Op_c,\middlebreak Op_m \right\rangle$.
\end{theorem}

\end{document}


\documentclass{article}
\usepackage{amsfonts,amsthm}
\newtheorem{theorem}{Theorem}

\newlength{\IrresponsibleFantasy}

\newcommand*{\ReserveVerticalSpace}[1]
{\setlength{\IrresponsibleFantasy}{#1}\global\IrresponsibleFantasy=\IrresponsibleFantasy
\parbox{0pt}{\rule{0pt}{\IrresponsibleFantasy}}}

\newcommand*{\middlebreak}{\nulldelimiterspace0pt
\right.\allowbreak\mskip 0mu plus .5mu \nulldelimiterspace0pt
\left.\parbox{0pt}{\rule{0pt}{\IrresponsibleFantasy}}}%

\begin{document}

{%
\hsize 3cm
\begin{theorem}
...could be now considered as an algebraic structure $DB_E = \left\langle\ReserveVerticalSpace{1cm} \mathbb{S},\middlebreak \mathbb{E}, \middlebreak {X^X}^X, \middlebreak f,\middlebreak \mathbb{V},\middlebreak \mathbb{R},\middlebreak \mathbb{C}, \middlebreak {q_q}_q, \middlebreak Op_a,\middlebreak Op_c,\middlebreak Op_m \right\rangle$.
\end{theorem}
}%

{%
\hsize 7cm
\begin{theorem}
...could be now considered as an algebraic structure $DB_E = \left\langle\ReserveVerticalSpace{1cm} \mathbb{S},\middlebreak \mathbb{E}, \middlebreak {X^X}^X, \middlebreak f,\middlebreak \mathbb{V},\middlebreak \mathbb{R},\middlebreak \mathbb{C}, \middlebreak {q_q}_q, \middlebreak Op_a,\middlebreak Op_c,\middlebreak Op_m \right\rangle$.
\end{theorem}
}%

\begin{theorem}
...could be now considered as an algebraic structure $DB_E = \left\langle\ReserveVerticalSpace{1cm} \mathbb{S},\middlebreak \mathbb{E}, \middlebreak {X^X}^X, \middlebreak f,\middlebreak \mathbb{V},\middlebreak \mathbb{R},\middlebreak \mathbb{C}, \middlebreak {q_q}_q, \middlebreak Op_a,\middlebreak Op_c,\middlebreak Op_m \right\rangle$.
\end{theorem}

\end{document}


-
You did test that right? try adding \test before \right\rangle, where \test is \def\test{x^{(2)}}. Now \rangle and \langle is scalled differently. Best solution is never to use \left...\right in text-mode math. –  daleif Jun 18 '13 at 8:14
@daleif Well then add a phantom of the required height/depth. Removing the use of \left and \right was I admit the first thing to recommend to the OP in the case at hand; I didn't look at the actual enclosed contents. If items had varied more in height and depth I would have adjusted the method. –  jfbu Jun 18 '13 at 9:03
Another point is that in many cases \left...\right in the text create unnecessary large fences disrupting the line spacing. I general: don't encourage users to use it in the text –  daleif Jun 18 '13 at 9:55
@jfbu your second proposal is truly neat. But bad bad you not to have added a strut among the first words of the text before the math group: look at your second example the one with \hsize7cm! –  jfbu Jun 18 '13 at 9:58
i haven't researched \middlebreak, but it appears that it causes the paragraph to be set ragged right, which wasn't requested. –  barbara beeton Jun 18 '13 at 16:36