views:

2082

answers:

2

Is it possible to get multline like behavior within a gather environment? I have a set of equations in a gather environment, but one of them is too long, and I'd like to split it up onto two lines where the first line is left-aligned and the second line is right-aligned (just like multline). If there is a way of aligning individual lines within the gather or split environment (like flushleft or flushright but functional in mathmode) this would solve the problem.

A: 

I haven't tested this, but you can try putting \hfill in front of the second line.

Having said that: IMHO, multline behavior inside a gather environment is undesirable. Especially if you have the fleqn option enabled, you should consider the following option: put the long equation inside a split, with alignment on the left side of the equality. Assuming the right hand side is too long, put its second part on a new line (still inside the split) and use \hspace{1cm} (or some other length) to indent the second part a bit further.

For an overview of all AMS multiline blocks, see the amsmath documentation.

Martijn
Unfortunately \hfill doesn't seem to work... normally I'd agree that aligning equals signs looks better, however in my case I have a series of equalities that differ drastically in how much is on either side of the equality, making things look very unbalanced (as one line sticks way out from the line before). Within this context, a multline like behavior would look best for a line that is too long for the page.
Dan
Shame it doesn't work. I'm out of ideas right now.
Martijn
+1  A: 

The mathtools package has an inner multlined environment similar to gathered and the likes, but it required a small amount of manual tweaking:

\documentclass{article}

\usepackage{amsmath}
\usepackage{mathtools}

\begin{document}

% \begin{multline}
%   \framebox[0.65\linewidth]{\strut} \\
%   \framebox[0.6\linewidth]{\strut} \\
%   \framebox[0.65\linewidth]{\strut} \\
%   \framebox[0.6\linewidth]{\strut}
% \end{multline}

\begin{gather}
  \framebox[0.8\linewidth]{\strut} \\
  \begin{multlined}[b][\linewidth-3\multlinegap]
    \framebox[0.65\linewidth]{\strut} \\
    \framebox[0.6\linewidth]{\strut} \\
    \framebox[0.65\linewidth]{\strut} \\
    \framebox[0.6\linewidth]{\strut}
  \end{multlined} \\
  \framebox[0.4\linewidth]{\strut}
\end{gather}

\end{document}
Philipp