2

Given the following set of equations as an example:

`...
\begin{align}
    x &= y^2 + 3 \\
    y + 3 &= 11
\end{align}`

The equations will be center aligned with respect to the "=" sign and tagged on the left with equation numbers. Is there a way I can add a note to the side of one of the equations without affecting the positioning of the equations (i.e. not shifting the group of equations upon insertion of the note)?

I've tried '{flalign}', but the group of equations shifts upon addition of the note. I've tried to find a way to add an additional tag on the right, but have come up empty. I've used '\qquad', but that, too, shifts the group of equations.

Here is the reason: aesthetics. If I have two groups of equations that are centered (using gather or similar), the group of equations that includes the note will be shifted from the other groups of equations. I just think this looks sloppy... call me picky.

Example output:

(left)         (center)           (right)
(1)            xyz = abc
(2)            abc = xyz
{next math group}
(3)            cba = abc
(4)            yzx = cba        some text

Thanks in advance.

  • This might help. You could remove the $s from the definition of \Domain if you don't always need math mode, and rename the command to suit your semantic usage. I remember seeing other related questions too; I'll keep looking a bit. – Paul Gessler Mar 11 '14 at 19:52
  • 2
    for a line of text between two aligned equations, use \intertext. (requires amsmath, and i'm sure this has been asked/answered before.) – barbara beeton Mar 11 '14 at 19:58
  • I realize that I can insert text between equations using '\intertext', but I would like the note to be beside the equation. If there were a way to add an additional tag to the right a given equation, that would also solve my problem. – Matthew McKenna Mar 11 '14 at 20:03
  • Does this answer help? tex.stackexchange.com/questions/159800/…. The first solution uses falign but puts a phantom of the note on the opposite side, thus preserving the centering. – Steven B. Segletes Mar 11 '14 at 20:03
  • @Steven : I think it just might work, thanks! – Matthew McKenna Mar 11 '14 at 20:12
4

A solution with flalignand \llap, so no \phantom is used. Two cases may happen : either the note is short enough to not overlap the equation, or it is too long. For the first case, I define a shorteqnote command; in the second case, the note has to be written on the next line; a \longeqnote command is defined. A note is supposed to be at most one line long (anyway, would that be sensible?).

        \documentclass[ a4paper, leqno]{article}

        \usepackage[utf8]{inputenc}
        \usepackage[T1]{fontenc}
        \usepackage{lmodern}
        \usepackage[showframe, textwidth = 15cm, nomarginpar, noheadfoot]{geometry}

        \usepackage{mathtools}

        \newcommand{\shorteqnote}[1]{ &  & \text{\small\llap{#1}}}
        \newcommand{\longeqnote}[1]{& & \\ \notag  &  &  &  &  & \text{\small\llap{#1}}}

        \begin{document}

        This results in this :
        \begin{flalign}
         &  & xyz  & = abc \\
          &  &           abc  & = xyz  &  & \\
        \shortintertext{next math group: }
            &  &           cba &= abc \shorteqnote{(A short note)} \\
            &  &        x^2 + y^2  + z^2& = x^2 + y^2 + z^2 \longeqnote{(A longer note:  True only in characteristic 2)}
        \end{flalign}

        \end{document}​ 

enter image description here

| improve this answer | |
  • What package has \shortnote in it? – Francis Davey Jun 14 '15 at 19:40
  • 'Twas a typo for \shorteqnote. Thanks for pointing it. I've made the correction. – Bernard Jun 14 '15 at 19:53
  • Thanks. I am not a very good latex person and don't know what's out there. Have to look a lot of things up. – Francis Davey Jun 14 '15 at 19:55
  • Oh, it's very simple: \llap is a plain TeX command which inserts a box at the left of the cursor (from right to left, so to say), then sets the cursor at the position it had before insertion. Thus the width of the inserted box is not taken into account. This way you might, for instance, write in the left margin. Similarly there is a \rlap command. – Bernard Jun 14 '15 at 20:01
  • Thanks! That explanation of \llap is very helpful. I have everything working, except that the equation numbers are still coming out on the right hand side. – Francis Davey Jun 14 '15 at 20:02

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.