# Break an inline math formula

I have a theorem that looks like this:

Now I would like to break the (A....D) math expression. The problem is, that nothing I did from the solution of this answer helped (since probably people will direct me to that answer), that is:

• breaking the math expression in two different math expression separated by a comma did nothing and if I added a \\ it broke the expression, but it looked ugly since the part on the second line wasn't aligned properly to the right
• \allowbreak did nothing

\makeatletter
\def\old@comma{,}
\catcode\,=13
\def,{%
\ifmmode%
\old@comma\discretionary{}{}{}%
\else%
\old@comma%
\fi%
}
\makeatother


caused an error, since I'm using TikZ where some parameters are separated by a comma.

Does someone know any other solution, please ?

• Please add a minimal working example of your input. – Joseph Wright Aug 16 '12 at 17:26
• The question you mentioned - did you check out its linked posts? This one might be helpful: tex.stackexchange.com/a/19100 – Audrey Aug 16 '12 at 17:27
• Given that the math expression in question appears to be quite long, it may be an excellent idea to display it on a line by itself, rather than typeset it in inline style. – Mico Aug 16 '12 at 19:22

Since it appears that the solution from Allowing line break at ',' in inline math mode? works for you, except that it causes problems elsewhere, you could restrict the redefinition of the comma character to be local to the paragraph where you are having this problem, by enclosing it in a brace group. Here I have applied this redefinition only to the second paragraph, and you can see that this redefinition is local.

## Code:

\documentclass{article}
\usepackage{showframe}

\begin{document}
Here is some very long text followed by a very long equation like $a,b,c,d,e,f,g,h,i,j,k,l$ etc

{
\def\OldComma{,}
\catcode\,=13
\def,{%
\ifmmode%
\OldComma\discretionary{}{}{}%
\else%
\OldComma%
\fi%
}%
Here is some very long text followed by a very long equation like $a,b,c,d,e,f,g,h,i,j,k,l$ etc.%
}

Here is some very long text followed by a very long equation like $a,b,c,d,e,f,g,h,i,j,k,l$ etc
\end{document}

• Sorry for getting back at this so late. Your solution works best, since it alignes everything properly to the right (which the \allowbreak solution doesn't, so text looks choppy there). But somehow all the lines of paragraph with locally defined "," break approx 1cm earlier on the right side then the other paragraphs do. do you know how to fix this ? – l7ll7 Aug 24 '12 at 9:42

Without a minimal example (that actually runs on its own) one can only guess, but my suspicion is that you use \left( A ... \right). If that is the case then nothing will break whatever you try, because the \left/\right construct will produce a sub-formula that is unbreakable.

The only solution in that case would be to not use \left/\right but \bigl and \bigr (or \biggl or whatever size you need for the parantheses). Then \allowbreak inside should work.

• There wouldn't be any legal break point anyway, since the shown formula hasn't any operation or relation symbol, but the remark about \left and \right is very important. – egreg Aug 16 '12 at 23:12
• @egreg yes there wouldn't but my answer was based on the statement that a legal breakpoint was added (as in \allowbreak that the OP mentioned he tried). From that and the look of the formula I deduced that he may have used left/right – Frank Mittelbach Aug 17 '12 at 6:38

Add \penalty 0 (leave a space after the zero) after the comma where you want the break to be. This will add a suitable break point.

However, this should really be a last resort. Try and modify the paragraph to fit the formula better.

• The OP already said \allowbreak didn't work and that is just an abbreviation for \penalty 0 :-) – Frank Mittelbach Aug 17 '12 at 6:38