9

I try to make a comment on the right (or left) of one line of proof. But the align* environment automatically move the whole equations to the left to leave space for the comment. But I still want the equations to be in the center (the comment is short enough that it won't be conflicting the equations). How could I achieve this?

To be more specific, I used the code

 \begin{align*}
 equation0 &= equation1
           &= equation2
           &= equation3 && \text{make a comment here}
           &= equation4
\end{align*}

I just want to put \text{make a comment here} on the right without affecting the original alignment of the equations.

12

Omit the && and use \rlap{\text{make a comment here}}, which causes the comment to have no width "to the right", meaning it starts at the same place but doesn't actually take up any space in the alignment. For a comment on the left, use \llap instead of \rlap, which causes leftward space to be ignored.

In response to the question in the comment: in align* or equation* specifically (or any other unnumbered environment) you can hijack the "equation label" to contain a comment by using \tag*{\text{make a comment here}} rather than \rlap. This will place the comment on the left if amsmath was loaded with the leqno option. In a numbered equation, it is not a good idea to put something flush right.

| improve this answer | |
  • By the way, do you know how to make the "\rlap{\text{make a comment here}}" thing to the rightmost? It seems that \hfill or \raggedright does not work. – user69818 Apr 14 '13 at 3:01
  • Added to the answer. – Ryan Reich Apr 14 '13 at 3:05
  • Thanks for the answer. But before today I always used amsart and \tag to make comments on equations (by default of amsart, \tag appears on the left). But this time the comment is a bit longer that makes the equations move to the right. – user69818 Apr 14 '13 at 3:12
  • As long as the comment is short enough that it would not actually overlap the equation, you could use \rlap or \llap with \tag* to make the tag have effective width zero. – Ryan Reich Apr 14 '13 at 3:14
  • 2
    Instead of \rlap{...} I would recommend \makebox[0pt][l]{...} that's slightly less efficient but also less surprising in other contexts (try starting a paragraph with \rlap). – egreg Apr 14 '13 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.