Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

LaTeX – Break in math

I would like to be able to break lines in a math environment but in a way that keeps a symbol in front of the formula.

For example, the sum (sigma) followed by a long formula. So it goes out of the page but I would like to keep the formula next to the sigma even if there’s a line break.

Here’s a snippet so you can better reproduce it.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

\documentclass{article}
\usepackage{amsmath,amsfonts,amssymb,mathtools}

% allows me to increase the font size of math blocks
\usepackage{graphicx} % \scalebox
\usepackage{environ}
\NewEnviron{mymath}{%
    \[
        \scalebox{1.3}{$\BODY$}
    \]
}

\begin{document}
    Lorem ipsum dolor sit amet
    \begin{mymath}
        \sum \limits _{\substack{
            yyyyyyy,\\
            zzzzzzzz,\\
            www
        }}
        (
            xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        ) + (
            xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        )
    \end{mymath}
\end{document}

And here’s a screenshot of what I’m trying to achieve.
enter image description here

So as you can see, I’m trying to keep the second parenthesis next to the sigma but under the first parenthesis.

>Solution :

First off: don’t scale elements that contain text! If you don’t like the size of your math block, use an appropriate font size instead.

You can use the split environment from amsmath :

\documentclass{article}
\usepackage{mathtools}

\begin{document}
    Lorem ipsum dolor sit amet
    \[
    \begin{split}
        \sum \limits_{\substack{
            yyyyyyy,\\
            zzzzzzzz,\\
            www
        }}
       & (
            xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        ) +\\
        &(
            xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        )
    \end{split}
    \]
\end{document}

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading