6

I had a look at a few of the questions regarding align and split but didn't see anything which addressed this particular alignment issue:

I have something like the following equations, with conditions right-aligned. One of the conditions is longer than the space permitted by the column, which pushes everything off the page and moves the equation numbers below all the lines.

\begin{align}
& x = a + b + c + d + e + f + g + h + i + j, & \text{some condition} \\
& y = a + b + c + d + e + f + g + h + i + j, & \text{some much longer condition}
\end{align}

I would like to split this up so that it looks something like:

   x = a + b + c + d + e + f + g + h + i + j      some condition (1)

   y = a + b + c + d + e + f + g + h + i + j
                                                                 (2)
                                      some much longer condition

I tried to solve this with the split environment but without any luck, despite trying many different positions of &'s such as:

\begin{align}
& x = a + b + c + d + e + f + g + h + i + j, & \text{some condition} \\
\begin{split}
& y = a + b + c + d + e + f + g + h + i + j, \\
                                 & \text{some much longer condition}
\end{split}
\end{align}

In the end I just broke up the long condition into two lines as in the below, but I am not sure that the product looks as good.

\begin{align}
& x = a + b + c + d + e + f + g + h + i + j, & \text{some condition} \\
& y = a + b + c + d + e + f + g + h + i + j, \begin{split}
                                                  \text{some} \\
                                                  \text{much} \\
                                                  \text{longer} \\
                                                  \text{condition}
                                             \end{split}
\end{align}

Is there any way to achieve my original goal using the align environment?


Here's a MWE:

\documentclass{article}

\usepackage{amsmath}
\usepackage{mathtools}

\setlength{\textwidth}{30em}

\begin{document}
\section{No split}
\begin{align}
& x = a + b + c + d + e + f + g + h + i + j, & \text{some condition} \\
& y = a + b + c + d + e + f + g + h + i + j, & \text{some much longer condition}
\end{align}
\section{Attempted whole line split}
\begin{align}
& x = a + b + c + d + e + f + g + h + i + j, & \text{some condition} \\
\begin{split}
& y = a + b + c + d + e + f + g + h + i + j, \\
                                 & \text{some much longer condition}
\end{split}
\end{align}
\section{Word break split}
\begin{align}
& x = a + b + c + d + e + f + g + h + i + j, & \text{some condition} \\
& y = a + b + c + d + e + f + g + h + i + j, \begin{split}
                                                  \text{some} \\
                                                  \text{much} \\
                                                  \text{longer} \\
                                                  \text{condition}
                                             \end{split}
\end{align}
\end{document}

Screenshot:

screenshot

2 Answers 2

6

You can set the "longer explanation" inside a zero-width box and let it extend across the align alignment points:

enter image description here

\documentclass{article}

\usepackage{amsmath}

\setlength{\textwidth}{30em}

\begin{document}

\begin{align}
  & x = a + b + c + d + e + f + g + h + i + j, & \text{some condition} \\
  & y = a + b + c + d + e + f + g + h + i + j, & \\
  & & \makebox[0pt][r]{some much longer condition} \nonumber
\end{align}

\end{document}

Vertical alignment of the tag (2) is possible:

enter image description here

\begin{align}
  & x = a + b + c + d + e + f + g + h + i + j, & \text{some condition} \\
  & \begin{array}{@{} l}
    y = a + b + c + d + e + f + g + h + i + j, \\
    \mathstrut
  \end{array} & 
  \begin{array}{ r @{}}
    \mathstrut \\
    \makebox[0pt][r]{some much longer condition}        
  \end{array}
\end{align}
2
  • I didn't know about \makebox, thank you. Is there a way to get the equation number to be centered across the two lines as in split?
    – codebeard
    Commented Nov 28, 2016 at 6:19
  • Note the styling of the contents of \makebox may not agree with that \text chooses in the previous line. Perhaps use the \mathrlap{\text{...}} instead (with mathtools). Commented Nov 28, 2016 at 6:49
1

You also can have these variants, playing with \llap and align, or \parbox{some width} and flalign:

\documentclass{article}

\usepackage{mathtools}
\usepackage[showframe]{geometry}
\setlength{\textwidth}{30em}

\begin{document}

\begin{align}
  & x = a + b + c + d + e + f + g + h + i + j, & \text{some condition} & \\
  & y = a + b + c + d + e + f + g + h + i + j,\\
  & &\llap{some much longer condition}& \nonumber
\end{align}

\begin{flalign}
   & & x & = a + b + c + d + e + f + g + h + i + j, & & \text{some condition} \\
  & & y & = a + b + c + d + e + f + g + h + i + j, & &\parbox[t]{2.5cm}{\raggedright some much longer condition}
\end{flalign}

\end{document} 

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .