Code: Select all
\documentclass[11pt]{article}\usepackage{mathtools}\begin{document}\begin{align*}3+x &=4 && \text{comment}\\x &=4-3 && \text{another comment}\\x &=1 && \text{yet another comment}\\\end{align*}\end{document}
Code: Select all
\documentclass[11pt]{article}\usepackage{mathtools}\begin{document}\begin{align*}3+x &=4 && \text{comment}\\x &=4-3 && \text{another comment}\\x &=1 && \text{yet another comment}\\\end{align*}\end{document}
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Code: Select all
\documentclass[11pt]{article}\usepackage{mathtools}\begin{document}\begin{align*}3+x &=4 && \hspace{-2.7cm}\text{comment}\\x &=4-3 && \hspace{-2.7cm}\text{another comment}\\x &=1 && \hspace{-2.7cm}\text{yet another comment}\\\end{align*}\end{document}
alignat*
environment to have more control about the horizontal space.
Code: Select all
\documentclass[11pt]{article}\usepackage[T1]{fontenc}\usepackage{mathtools} % loads »amsmath«\begin{document}\begin{alignat*}{2}3+x &=4 & \quad & \text{comment} \\x &=4-3 & & \text{another comment} \\x &=1 & & \text{yet another comment}\end{alignat*}\end{document}
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p