[Tex/LaTex] Break an inline math formula

line-breakingmath-mode

I have a theorem that looks like this:

enter image description here

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
  • adding

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

Best Answer

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.

enter image description here

Notes:

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}
Related Question