[Tex/LaTex] Left-align text in math-mode and break equations

alignline-breakingmath-mode

I have the following MWE

\documentclass[11pt, a4paper]{article}


\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage{amsfonts, amsmath, amssymb, amsfonts}



\begin{document}

\begin{align}
\emph{This should be left-aligned and have no eq-number}\\
1&\neq 1+2+3+4+5+6+7+8+9+01000000+2\\ %should be broken
1&\neq 1+2+3+4+5+6+7+8+9+01000000+2   %should be broken
\end{align}


\end{document}

I would like to achieve the following

  1. The first line should be left-aligned and have no number
  2. The second and third line should be broken as they are too long

Is it possible to do so with the align-environment?

Best Answer

You can use \intertext or \shortintertext for the left aligned text, depending on the required spacing. \shortintertext gives tighter spacing.

For breaking the lines, you can place them in multlined environments from the mathtools package. You can specify the width as an optional argument if that is preferred, and also customize other aspects of the environment. See the package documentation for more information.

\documentclass[11pt, a4paper]{article}
\usepackage{mathtools}

\begin{document}

\begin{align}
  \shortintertext{\emph{This should be left-aligned and have no eq-number}}
  1 &\neq \begin{multlined}[t][7cm]
      1+2+3+4+5+6\\
      {}+7+8+9+01000000+2
    \end{multlined}\\
  1 &\neq \begin{multlined}[t]
    1+2+3+4+5+6+7+8+9\\
    {}+01000000+2
  \end{multlined}
\end{align}

\end{document}

Output 1

Alternatively you can use only the align environment, and use the \nonumber command on lines that shouldn't be numbered, although I personally find the multlined approach better. To get the binary operators to the right of \neq one can use \hpantom{\neq{}} which inserts a space with equal width as \neq and the following space.

\documentclass[11pt, a4paper]{article}
\usepackage{amsmath}

\begin{document}

\begin{align}
  \intertext{\emph{This should be left-aligned and have no eq-number}}
  1 &\neq 1+2+3+4+5+6 \nonumber\\
    &\hphantom{\neq{}}+7+8+9+01000000+2\\
  1 &\neq 1+2+3+4+5+6+7+8+9 \nonumber\\
    &\hphantom{\neq{}}+01000000+2
\end{align}

\end{document}

Output 2