I'm trying to typeset a multi-line numbered equation with the following properties:
- first line is aligned left
- leftmost characters of all the remaining lines are vertically aligned, and the whole block of these lines is as far to the right as possible (so that the longest line does not create an overful
hbox).
This can be done with the following code:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\begin{document}
\begin{multline*}
first\ line\ 1111111111111111=\\
\begin{aligned}
&=second\ line\ 222222222222222\\
&=third\ line\ 333333333333333333
\end{aligned}
\end{multline*}
\end{document}
(note that the first line may be quite short, as in the example above, or very long, so that it would not fit in one line together with the second line). However, this setup does not seem to allow for separate numbering of every line. multline environment allows only for a single number, centered with respect to the aligned block. How can I number all or some of the lines separately?
Remark 1: A workaround I'm currently using is align with manual positive or negative spacing before the first alignment tab. MWE:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\begin{document}
\begin{align}
first\ line\ 11111111111111111111111111111111111=\hspace{-60pt}&\nonumber\\
&=second\ line\ 222222222222222\\
&=third\ line\ 333333333333333333\nonumber
\end{align}
\end{document}
Of course it is not ideal as it is based on guessing the correct spacing (it can be improved by using some phantoms, but it would most likely be very tedious and not feasible in regular usage).
Remark 2: This post provides some brilliant workarounds for numbering in multline. Sadly, I don't understand the code provided there very well and couldn't reproduce the ideas in my case. However, it may be helpful for someone smarter than me.

