# Aligning equations with left and right comment

I'd like to align multiple equations below each other such that the central operator is always centered, but have a column for commenting on the right and a column for \iff-arrows and \Rightarrow-arrows on the left. This is as far as I got:

\begin{align*}
&& A &\aprecdot \mathfrak{G}^{\signminus 1}_1(\mathfrak{G}(C))
&& \text{by \eqref{eq:C}} \\
\iff && \mathfrak{G}(A) &\cprecdot \mathfrak{G}(\mathfrak{G}^{\signminus 1}_1(\mathfrak{G}(C)))
&& \text{by \eqref{eq:D}} \\
\iff && \mathfrak{G}(A) &\cprecdot \mathfrak{G}(C)
&& \text {by axiom 1.} \\
\iff && \mathfrak{G}^{\signminus 1}_1(\mathfrak{G}(A)) &\aprecdot \mathfrak{G}^{\signminus 1}_1(\mathfrak{G}(C)) \\
\iff && A &\aprecdot B
\end{align*}


It works quite well, but the problem is that if I have several of these below each other, separated by text, this looks ugly because the column widths are quite different. Therefore I want to put the \iff-arrows to the left border and the comments, while left-aligned, at a fixed distance from the right border. How can I do this?

• Welcome to TeX.SX! Please complete the code to a compilable example. In particular the commands \aprecdot, \cprecdot and \signminus should be defined. – egreg Oct 29 '14 at 18:03
• depending on how long (how many lines) your "list" becomes, you might consider using \intertext or \shortintertext (requires mathtools) within a single align* structure. – barbara beeton Oct 29 '14 at 18:37
• The flalign environment might be what you need. – A.Ellett Oct 29 '14 at 20:10

I agree with A. Ellet. flalign is probably the best option if you are trying to have any kind of commentary. Here is a more basic example which just solves for a specific variable:

\documentclass{article}

\usepackage{amsmath}
\usepackage{amssymb}

\begin{document}

\begin{flalign*}
&& d &= v_{o}t + \frac{1}{2}at^{2} && \text{A kinematic equation} \\
\Rightarrow && d - v_{o}t &= \frac{1}{2}at^{2} && \text{Another comment} \\
\Rightarrow && \frac{2(d - v_{o}t)}{a} &= t^{2} && \text{One here too} \\
\Rightarrow && \sqrt{\frac{2(d - v_{o}t)}{a}} &= t && \text{Solved for $t$}
\end{flalign*}

\end{document}


This produces

I'm not really sure how to get the comments and arrows closer to the overall equation though.

• Thanks! This is exactly what I was looking for, I didn't want the comments any nearer anyway. Works perfectly! – 黄雨伞 Oct 30 '14 at 11:15

You can center the entries in a column of an amsmath alignment with a trick involving the internals of amsmath. The alignment is first scanned to get the column widths, which are stored in \maxcolumn@width under the format

\or<widht1>\or<width2>\or...


so we can exploit this by defining a macro \Cen that just passes its second argument when the measuring is made and then uses the computed column width to center its argument. The macro has two arguments: the first is the column number, the second is the material.

I have also changed the definition of \cprecdot to be a relation symbol rather than a binary operation. I also introduced a shorthand for \mathfrak{G} and removed \signminus which just gives a very bad result (but the document is yours, so do as you prefer).

\documentclass{article}
\usepackage{amsmath,amssymb,graphicx}

\newcommand{\cprecdot}{\prec\joinrel\mathrel{\cdot}}
\newcommand{\aprecdot}{\mathbin{\dot{\ast}}}
\newcommand{\fG}{\mathfrak{G}}

\makeatletter
\newcommand{\Cen}[2]{%
\ifmeasuring@
#2%
\else
\makebox[\ifcase\expandafter #1\maxcolumn@widths\fi]{$\displaystyle#2$}%
\fi
}
\makeatother

\begin{document}
\begin{align*}
&& \Cen{3}{A \aprecdot \fG^{-1}_1(\fG(C))}
&& \text{by \eqref{eq:C}} \\
&\iff & \Cen{3}{\fG(A) \cprecdot \fG(\fG^{-1}_1(\fG(C)))}
&& \text{by \eqref{eq:D}} \\
&\iff & \Cen{3}{\fG(A) \cprecdot \fG(C)}
&& \text {by axiom 1.} \\
&\iff & \Cen{3}{\fG^{-1}_1(\fG(A)) \aprecdot \fG^{-1}_1(\fG(C))} \\
&\iff & \Cen{3}{A \aprecdot B}
\end{align*}

\end{document}


I'm not entirely clear on what effect you want, but here's an example of using the flalign environment.

% arara: pdflatex
% arara: pdflatex
% arara: open
\documentclass{article}
\usepackage{amsmath,amssymb}
\let\aprecdot\cdot
\let\signminus\pm
\let\cprecdot\cdot
\pagestyle{empty}
\usepackage{lipsum}
\begin{document}

\lipsum[1]
\begin{flalign*}
&      &  & A                                              & \aprecdot \mathfrak{G}^{\signminus 1}_1(\mathfrak{G}(C))               &  &  &  & \text{by \eqref{eq:C}}                                                                                                \\
& \iff &  & \mathfrak{G}(A)                                & \cprecdot \mathfrak{G}(\mathfrak{G}^{\signminus 1}_1(\mathfrak{G}(C))) &  &  &  & \text{by \eqref{eq:D}}
\intertext{Here's something in the middle of the text}
& \iff &  & \mathfrak{G}(A)                                & \cprecdot \mathfrak{G}(C)                                              &  &  &  & \text {by axiom 1.}                                                                                                   \\
& \iff &  & \mathfrak{G}^{\signminus 1}_1(\mathfrak{G}(A)) & \aprecdot \mathfrak{G}^{\signminus 1}_1(\mathfrak{G}(C))             \\
& \iff &  & A                                              & \aprecdot B
\end{flalign*}
\lipsum[2]
\end{document}


Also, since you only provided a partial example, I wasn't sure where \aprecdot,\signimuns, or \cprecdot were defined....