Aligning multiple lines of text in an align environment

One option is to use the aligned construct for the multi-line comments as below.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
  a + b &= \quad \text{short reason} \\
  c + d &= \quad \begin{aligned}[t]&\text{a really long and} \\
                                   &\text{complicated reason}\end{aligned}\\
  e + f \text{.}
\end{align}
\end{document}

enter image description here


with use of parbox:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{align}
  a + b &= \quad \text{short reason} \\
  c + d &= \quad \parbox[t]{0.35\textwidth}{
                    really long and complicated\\
                    reason in two lines} \\
  e + f &=\text{.}
\end{align}
\end{document}

enter image description here

(red lines indicate text borders)

supplement: considering comment of barbara beton, the above solution should be:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{align}
  a + b & = \quad \text{short reason} \\
  c + d & = \quad \parbox[t]{0.35\textwidth}{\raggedright  % <--- 
                    really long and complicated\\
                    reason in two lines} \\
  e + f & = .
\end{align}
\end{document}

in this simple case result is the same as at the first case, however if there's really long word that can't fit on the first line, added \ragged will avoid wide spaces between words in the first line.


A variation on @AboAmmar's answer, but using an environment that takes text and paragraphs:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
  a + b &= \quad \text{short reason} \\
  c + d &= \quad \begin{tabular}{@{}p{0.8\textwidth}}
                    really long and\\
                    complicated reason
                 \end{tabular} \\
  e + f &=\text{.}
\end{align}
\end{document}

to produce

enter image description here

Of course, the 0.8\textwidth might need tweaking...

Tags:

Align