Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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):

enter image description here

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

share|improve this question
    
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
4  
Just don't use \left and \right, which in this case do nothing. Then \allowbreak will work. –  egreg Jun 18 '13 at 7:51
1  
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

2 Answers 2

up vote 11 down vote accepted

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}

enter image description here

share|improve this answer
    
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}

middlebreak

\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}

middlebreakII

share|improve this answer
3  
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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