3

I use text at some lines of an align environment to justify how we go from one line to another. I would like to keep the maths centered, and text to be aligned to the right, but I did not succeed:

  \begin{align}
    a &= bbbbbb &\nonumber \\
    cccc  & =  dd & \text{(using Eq. 1)} & \nonumber \\
    e &= f & \text{(using Thm. 2)} 
  \end{align}

gives enter image description here which is OK for the maths, but not for the text as it is not completely at the end of the lign.

Using the flalign environement instead aligns the math equations to the left, while I'd like to keep them centered.

What is the cleanest way to achieve this ?

2
  • Will there be several texts (on different lines) in this multiline equation?
    – Bernard
    Commented Aug 30, 2019 at 11:34
  • @Bernard Yes, sorry, I have edited my question with a more representative example Commented Aug 30, 2019 at 11:39

2 Answers 2

2

I propose one of these two dolutions, both based on the flalign environment:

\documentclass{article}
\usepackage{mathtools}
\usepackage{eqparbox}
\usepackage[showframe]{geometry}

\begin{document}

  \begin{flalign}
  & & a &= bbbbbb &\nonumber \\
 & & cccc & = dd & \text{(using Eq. 1)} & \nonumber \\
 & & e &= f & \text{(using Thm. 2)}
  \end{flalign}

  \begin{flalign}
  & & a &= bbbbbb \nonumber \\
 & & cccc & = dd & \eqparbox{C}{(using Eq. 1)} & \nonumber \\
 & & e &= f & \eqparbox{C}{(using Thm. 2)}
 \end{flalign}

\end{document} 

enter image description here

1

In order to center the equations you need to make the text not to occupy any space. This has the consequence that you can't align the texts to the right (but this is good, as we read from left to right).

The \zerotext command accepts an optional argument to avoid overlapping (shown in the last example).

\documentclass{article}
\usepackage{amsmath}

\usepackage{showframe} % just for the example

\newcommand{\zerotext}[2][0pt]{\makebox[#1][l]{\qquad#2}}

\begin{document}

% for checking alignment
\begin{align}
a     &= bbbbbb \nonumber \\
cccc  &= dd     \nonumber \\
e     &= f       
\end{align}

\begin{equation}
\begin{alignedat}[b]{2}
a     &= bbbbbb & \\
cccc  &= dd     & \zerotext{(using Eq. 1)} \\
e     &= f      & \zerotext{(using Thm. 2)} 
\end{alignedat}
\end{equation}

\begin{equation}
\begin{alignedat}[b]{2}
a     &= bbbbbb+cccccccccc & \\
cccc  &= dd                & \zerotext[4em]{(using Eq. 1)} \\
e     &= f                 & \zerotext[4em]{(using Thm. 2)} 
\end{alignedat}
\end{equation}

\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 .