Latex Multiline Equations

我的未来我决定 提交于 2019-12-08 03:06:01

问题


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.


回答1:


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}



回答2:


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.



来源:https://stackoverflow.com/questions/1436529/latex-multiline-equations

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!