This is very similar to A vertically centered equation number on a multline environment, but the answers won't apply to my case it seems.
I have
\begin{multline}
X = \\
LOOOOOOOOOOOOOOOOOOOOOOOOOOONG
\end{multline}
and like how the output looks without a line number. Now I want to add a line number to the right, but the second line is too long. How do I put it in the first line (to the right!)?
I know about \raisetag, but I would prefer an exact solution. My second line has a non-trivial height.
Edit: I should add that LOOOOOOOOOONG is nearly as long as my text width.
Edit: This is a more appropriate example:
\begin{multline}
X = \\
\framebox[\linewidth]{LONG}
\end{multline}
Edit: Once again a more elaborate example to show that egreg's answer does not answer my question. My use case is an integral expression that I do not want to break. It does not matter how it looks or what its contents is. Its line is pretty damn close to the available linewidth.
\documentclass{article}
\usepackage{mathtools}
\usepackage[showframe]{geometry}
\setlength{\multlinegap}{0pt}
\begin{document}
This works fine:
\begin{equation}
\begin{multlined}[t]%
X = \\%
\framebox[\dimexpr.9\linewidth\relax]{some expression shorter than the next}%
\end{multlined}%
\end{equation}%
Note the equation number in this harder case:
\begin{equation}%
\begin{multlined}[t]%
X = \\%
\framebox[\dimexpr\linewidth-1.666666pt\relax]{long expression that I do not want to break}%
\end{multlined}%
\end{equation}%
This solves the equation number problem, but messes up horizontal positioning. It actually goes over the right border:
\begin{equation}%
\begin{multlined}[t]%
X = \\%
\mathmakebox[.9\width][l]{%
\framebox[\dimexpr\linewidth-1.666666pt\relax]{long expression that I do not want to break}%
}%
\end{multlined}%
\end{equation}
\end{document}


multlinedis just a single block. It would be shifted also withmultiline. – egreg Feb 03 '15 at 22:59multlinehas the same problem as your solution, but this does not mean 1) that this is what I want, nor 2) that this is how it has to be. I want a short first line, left-aligned, with an equation number on the right; and a very long second line, potentially filling the line, right-aligned, with no equation number. – bers Feb 03 '15 at 23:48\mathmakebox[.9\width][l]{...}. No automatic solution, I'm afraid. – egreg Feb 03 '15 at 23:49\mathmakebox[.5\width][c]{\framebox[\linewidth]{LONG}}looks like it's working. I'll try further with that, thanks so far! – bers Feb 04 '15 at 00:38[c]as well as[l]influence the positioning of the first line (not flush left any longer). But it's better than nothing. – bers Feb 04 '15 at 00:43