1

Normally in align environments, I can align equations with an additional column on the right explaining the steps, eg:

\begin{align*}
-1 &= x \\
-2 &= 2x && \text{multiply by 2} \\
\end{align*}

I want to write a double inequality, so a relation aligned at 2 points, with a separate column on the right with an explanation text box. Ideally it would be something like the following, where '&' denotes no extra space between the text on the right and left, and '&&' denotes a noticeable separation:

\begin{align*}
-1 &< x &< 4 \\
-2 &< 2x &< 8 && \text{multiply by 2} \\
\end{align*}

It seems that since columns are by default meant to have 2 aligned expressions and not 3, the 3rd expression in the inequality is its own column, meaning that whatever separation exists between the 1st two expressions and the 3rd exists between the 3rd expression and the text box. So in the {align*} environment (in the above example), there is noticeable separation between the 1st two expressions and the 3rd, and in the {alignat*} environment, everything is crowded together, with no separation between the 3rd expression and the text box.

Example using {alignat*}:

\begin{alignat*}{3}
-1 &< x & < 4 \\
-2 &< 2x & < 8 & & \text{multiply by 2} \\
\end{alignat*}

Regarding tables or arrays, I don't know how I would right-align the last column in this way. Anyone have any ideas?

1 Answer 1

3

enter image description here

\documentclass{article}

\usepackage{amsmath}

\begin{document}

alignat
\begin{alignat*}{3}
-1 &< x && < 4 \\
-2 &< 2x&& < 8 & \qquad \text{multiply by 2} \\
\end{alignat*}


\end{document}
1
  • Thanks so much, this is perfect! Commented Jun 25, 2020 at 21:13

You must log in to answer this question.

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