# Aligning the comments in align mode

I was trying eqnarray to align inequalities but I kept getting the error of missing  inserts, so I am trying now align, but now I would like to align the comments This is the code \begin{alignat*}{2} 12 \left( \frac{1}{4}(2x-1)-x \right) &< \,12 \left( \frac{x}{6}-\frac{1}{3} \right) \mbox{\,\,\,\,\,\,\,\,\,\,\,\leftarrow$multiplicar por 12} \\\\ -6x - 3 &< \,2x -4 \mbox{\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,$\leftarrow$simplificar} \\\\ (-6x - 3) - 2x &< (2x - 4) - 2x \mbox{\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,$\leftarrow$restar$2x\$} \\ \\
\end{alignat*}


as you can see the comments are not aligned, of course I can do it manually but I wonder if it can be done automatically, so I want the left arrows to be aligned as well

You can easily do that. You shouldn't use eqnarray, which is deprecated and can produce bad horizontal spacing.

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{alignat*}{2} 12 \left( \frac{1}{4}(2x-1)-x \right) &<12 \left( \frac{x}{6}-\frac{1}{3} \right) & \qquad \leftarrow\enspace & \text{multiplicar por 12} \\
-6x - 3 &< 2x -4 & \leftarrow\enspace & \text{simplificar} \\
(-6x - 3) - 2x &< (2x - 4) - 2x & \leftarrow\enspace & \text{restar }2x
\end{alignat*}

\end{document}


Here are two ways:

1. a regular align that uses the regular spacing parameters associated with spreading out multiple equations on the same line; and

2. using a fixed-gap from the alignment operator. This requires you to set the RHS inside a zero-width box and inserting a fixed-width horizontal space that suits your needs.

\documentclass{article}
\usepackage{mathtools}
\newcommand{\insertbox}[1]{\fbox{\rule{#1}{\ht\strutbox}}}
\begin{document}

\begin{align*}
\insertbox{50pt} & < \insertbox{30pt}
&& \text{Some text here} \\
\insertbox{25pt} & < \insertbox{25pt}
&& \text{Some more text here} \\
\insertbox{45pt} & < \insertbox{35pt}
&& \text{Some final text here}
\end{align*}

\begin{align*}
\insertbox{50pt} & < \mathrlap{\insertbox{30pt}}
\hspace{100pt}\text{Some text here} \\
\insertbox{25pt} & < \mathrlap{\insertbox{25pt}}
\hspace{100pt}\text{Some more text here} \\
\insertbox{45pt} & < \mathrlap{\insertbox{35pt}}
\hspace{100pt}\text{Some final text here}
\end{align*}

\end{document}


In both instances the \text{<text>} part is left-aligned. This should ensure proper alignment of any similar-sized symbols (like \leftarrow`).