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?

5
  • 1
    that is \tag if you specified leqno option to the document or amsmath package. Feb 13, 2015 at 16:50
  • 1
    as david says, the leqno option will do it for the entire document; you should also use the tbtags option, otherwise the number will be set at the vertical center of a group. but you don't say if you want this for the whole document, or only for selected displays -- which is it? Feb 13, 2015 at 16:54
  • I didn’t know about leqno, thanks. I clarified the question accordingly. Feb 13, 2015 at 17:01
  • @barbarabeeton not whole document (see comments below my answer) Feb 13, 2015 at 17:03
  • 1
    for situations on which only one tag is placed on an equation, this question provides an answer: Switch between leqno and reqno options (of amsmath) in the same document. but putting two numbers on the same line is an entirely different kettle of fish, and it's not trivial. i'll have to research/experiment to see if it's even feasible with just a \tag construction. that may deserve a separate question. Feb 13, 2015 at 17:13

1 Answer 1

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}
2
  • 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? Feb 13, 2015 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 Feb 13, 2015 at 17:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .