2

In an amsmath environment, the \tag* command is quite smart: If its argument fits on the same line, to the right of the formula, it goes there, otherwise it is moved to the next line; in both cases it is shoved to the very right.

I need a command that does the same, but in the opposite direction: If the argument fits on the left of the formula, it would be set there, otherwise it is moved to a line on its own before the formula; in both cases it would be shoved to the very left.

It is basically the behavior of \tag using the leqno option, but that does not help me, as I need both variants, sometimes on the same line.

How can I achieve that?

1 Answers1

1

enter image description here

The leqno option causes \tag to do what you describe:

\documentclass[leqno]{article}

\usepackage{amsmath}

\begin{document}

short
\begin{equation}
\tag{XX} 1=2
\end{equation}

long
\begin{equation}
\tag{YY} 1=2+2+2+2+2+2+2+2+2+2+2+2+2+2+2+2+
2+2+2+2+2+2+2+2+2
\end{equation}

\end{document}
David Carlisle
  • 757,742
  • Thanks, I did not now that. But in my case, I need both variants in the same environment, sometimes even in the same line. Is that possible? – Joachim Breitner Feb 13 '15 at 16:58
  • 1
    @JoachimBreitner anything is of course possible (you can always go into amsmath and pull out the definitions in the leqno case and copy them making a \ltag or whatever available even if right align is the default) But given the wording of barbara's question I suspect someone has already done that and she has an answer primed so ping her with a @ comment on your question:-) – David Carlisle 8 mins ago – David Carlisle Feb 13 '15 at 17:11