# autobreak formula but doesn't work

I have a long formula , I use autobreak as follows,but it doesn't work

\begin{align}
\begin{autobreak}
{E_{{S_{t + 1}}}}\left[ {\left. {E\left[ {\left. {{G_{t + 1}}} \right|{S_t},{S_{t + 1}}} \right]} \right|{S_{t + 1}}} \right] = {E_{{S_{t + 1}}}}\left[ {\left. {E\left[ {\left. {{G_{t + 1}}} \right|{S_{t + 1}}} \right]} \right|{S_{t + 1}}} \right] = \sum\limits_{{S_{t + 1}}} {P\left( {\left. {{S_{t + 1}}} \right|{S_t}} \right)V\left( {{S_{t + 1}}} \right)}
\end{autobreak}
\end{align}


It still overflows the page,how to let long formula breakline?

Is there some useful and general template how to insert formula into document?That solve these problems?

• Duplicate of autobreak not working if left and right delimeter breaks but that also has no answer. Sep 21 '19 at 2:48
• @Henri Menke , maybe my problem is not the same as this,since I don't have \left ,\right. And I have an additional question,a "perfect" template for equation. Sep 21 '19 at 2:54
• Ctrl+F "\left": 11 matches. ??? Sep 21 '19 at 2:55
• Oh...you are right. my ignorant eye Sep 21 '19 at 2:59

You can use multline or align, take your pick.

However you should drop all \left and \right here, and also the useless braces. For the outer brackets, \bigl[ and \bigr] suffice.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{multline}
E_{S_{t + 1}}\bigl[E[G_{t + 1}\mid S_t,S_{t + 1}] \mid S_{t + 1}\bigr] \\
=E_{S_{t + 1}}\bigl[E[G_{t + 1}\mid S_{t + 1}] \mid S_{t + 1}\bigr] =
\sum_{S_{t + 1}} P(S_{t + 1}\mid S_t) V(S_{t + 1})
\end{multline}

\begin{align}
E_{S_{t + 1}}\bigl[E[G_{t + 1}\mid S_t,S_{t + 1}] \mid S_{t + 1}\bigr]
&=E_{S_{t + 1}}\bigl[E[G_{t + 1}\mid S_{t + 1}] \mid S_{t + 1}\bigr] \notag \\
&=\sum_{S_{t + 1}} P(S_{t + 1}\mid S_t) V(S_{t + 1})
\end{align}

\end{document}


Another possibility is split:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

$$\begin{split} E_{S_{t + 1}}\bigl[E[G_{t + 1}\mid S_t,S_{t + 1}] \mid S_{t + 1}\bigr] &=E_{S_{t + 1}}\bigl[E[G_{t + 1}\mid S_{t + 1}] \mid S_{t + 1}\bigr] \\ &=\sum_{S_{t + 1}} P(S_{t + 1}\mid S_t) V(S_{t + 1}) \end{split}$$

\end{document}


I wouldn't use autobreqak environment. With manual breaking of your equation (using split environment and \MoveEqLeft function from amsmath package

\documentclass{article}
\usepackage{mathtools}
%\usepackage{autobreak}

\begin{document}
$$\begin{split} \MoveEqLeft E_{S_{t + 1}} \bigl[E [G_{t + 1} \big| S_t, S_{t + 1}] \big| S_{t + 1} \bigr] \\ & = E_{S_{t + 1}}\bigl[E [ G_{t + 1} \big| S_{t + 1} ] \big| S_{t + 1} \bigr] = \sum_{S_{t + 1}} P\bigl(S_{t + 1} \big| S_t \bigr) V(S_{t + 1}) \end{split}$$
\end{document}


Addendum: one more solution, using multlined from the package mathtools:

\documentclass{article}
\usepackage{mathtools}

\begin{document}
$$\begin{multlined}[0.8\linewidth] E_{S_{t + 1}} \bigl[E [G_{t + 1} \big| S_t, S_{t + 1}] \big| S_{t + 1} \bigr] \\ = E_{S_{t + 1}}\bigl[E [ G_{t + 1} \big| S_{t + 1} ] \big| S_{t + 1} \bigr] = \sum_{S_{t + 1}}P\bigl(S_{t + 1} \big| S_t \bigr) V(S_{t + 1}) \end{multlined}$$
\end{document}


(red lines indicate text borders)

• It seems quite nice ,thx Sep 21 '19 at 7:42