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?

\tagif you specifiedleqnooption to the document oramsmathpackage. – David Carlisle Feb 13 '15 at 16:50leqnooption will do it for the entire document; you should also use thetbtagsoption, 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? – barbara beeton Feb 13 '15 at 16:54leqno, thanks. I clarified the question accordingly. – Joachim Breitner Feb 13 '15 at 17:01\tagconstruction. that may deserve a separate question. – barbara beeton Feb 13 '15 at 17:13