I'm looking for a way to place some text flushed to the right margin (like \tag*{…}
does) at the end of each line of an equation. The equation has multiple columns, and I need to control the alignment (right, center or left) of each column. Furthermore, I don't want the environment to add extra space before the first column, after the last column or between columns.
I tried the following, which does not work because only a single \tag{…}
is allowed for the whole equation.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\begin{array}{@{}r@{}c@{}l@{}}
a&bbbbb&c \tag*{a, b and c} \\
x&y&z \tag*{other stuff}\\
\end{array}
\]
\end{document}
It would be cool if I could also do this for sub-cases
(lines after a big opening brace), like numcases
does (but numcases
does not support \tag
, and adds extra spaces everywhere).
Things I tried (after browsing through quite a few questions here):
equationarray
from theeqnarray
package looks promissing, but it does not support the\tag{…}
command, only\notag
(I tried and failed to manually call the internals of what\tag{…}
does).align
adds extra space betweenalign
andempheq
do not supportrcl
column specifications and add extra spacealignat*
has everything exceptrcl
column specification (it is hardcoded to berlrlrl…
)
Right now my best bet is to put a marker with tikz
and draw the label as an overlay (I am not extremely interested in precise \label
/\ref
references, I can make all labels point to the whole multi-line equation if needed, so drawing with tikz
is a crude, but viable solution).
Best Answer
You can abuse
IEEEtrantools
(but I recommend not pushing material that belongs in the equation to the right margin, which should be reserved for reference marks or numbers).Note that you are responsible for avoding overlaps.
Original answer for reference