多行中断 \substack?

多行中断 \substack?

我要处理一些很长的方程式,它们无法放在一行中,并且喜欢使用 -environmentmultlinedmathtools将它们放入(例如)-environment 中align,特别是如果我想将需要两行数量的 2-3 个操作打包成一个块(在 MWE 中,为了简洁起见只有一个)。

但是,multlined当有 时, 会崩溃\substack,请参见下面的 MWE。环境似乎以某种方式试图“ multline\substack,但我无法阻止multline“看到”\substack以避免这种情况。

MWE(利用来自https://tex.stackexchange.com/a/180549/42225和文档):

\documentclass[12pt,fleqn]{article}
\usepackage{amsmath}
\usepackage{mathtools}

\begin{document}
\noindent A long equation using \texttt{multline} and \texttt{$\backslash$substack},
%
\begin{multline*}
    \mathcal{X}=\sum_{\substack{i,j,k,\ell,m,n,p,q,r,s,t\\ i+j\equiv 1 \bmod{2}}}  \binom{...}{i} \binom{...}{j} \binom{...}{k} \binom{...}{\ell} \binom{...}{m} \binom{...}{n} \cdot\ldots\\
    \ldots \cdot \binom{...}{p} \binom{...}{q} \binom{...}{r} \binom{...}{s} \binom{...}{t},
\end{multline*}
%
breaks when using \texttt{multlined} instead of \texttt{multline},
%
\begin{align*}
\MoveEqLeft[2]% default is 2em
    \mathcal{X}\\
    &\!\begin{multlined}[t][\linewidth-\mathindent-2em-\multlinegap]
        =\sum_{\substack{i,j,k,\ell,m,n,p,q,r,s,t\\ i+j\equiv 1 \bmod{2}}}  \binom{...}{i} \binom{...}{j} \binom{...}{k} \binom{...}{\ell} \binom{...}{m} \binom{...}{n} \cdot\ldots\\
        \ldots \cdot \binom{...}{p} \binom{...}{q} \binom{...}{r} \binom{...}{s} \binom{...}{t},
    \end{multlined}\\
    &=1,
\end{align*}
%
but still works fine without \texttt{$\backslash$substack},
%
\begin{align*}
\MoveEqLeft[2]% default is 2em
    \mathcal{X}\\
    &\!\begin{multlined}[t][\linewidth-\mathindent-2em-\multlinegap]
        =\sum_{i,j,k,\ell,m,n,p,q,r,s,t}  \binom{...}{i} \binom{...}{j} \binom{...}{k} \binom{...}{\ell} \binom{...}{m} \binom{...}{n} \cdot\ldots\\
        \ldots \cdot \binom{...}{p} \binom{...}{q} \binom{...}{r} \binom{...}{s} \binom{...}{t}.
    \end{multlined}\\
    &=1,
\end{align*}

\end{document}

答案1

借助stackengine您可以获得:

在此处输入图片描述

在下面的代码中我借用了作者stacengine在他的回答中提供的解决方案下标内的新行

\documentclass[12pt,fleqn]{article}
\usepackage{mathtools}
\usepackage{stackengine}

    \begin{document}
\noindent A long equation using \texttt{multline} and \texttt{$\backslash$substack},
%
\begin{multline*}
    \mathcal{X}=\sum_{\substack{i,j,k,\ell,m,n,p,q,r,s,t\\ i+j\equiv 1 \bmod{2}}}  \binom{...}{i} \binom{...}{j} \binom{...}{k} \binom{...}{\ell} \binom{...}{m} \binom{...}{n} \cdot\ldots\\
    \binom{...}{p} \binom{...}{q} \binom{...}{r} \binom{...}{s} \binom{...}{t},
\end{multline*}
%
breaks when using \texttt{multlined} instead of \texttt{multline},
%
\begin{align*}\def\useanchorwidth{T}\stackMath
%\MoveEqLeft[2]% default is 2em
\mathcal{X}
    &\begin{multlined}[t][\linewidth-\mathindent-2em-\multlinegap]
        =\mathop{\stackunder{\sum}{\def\stackalignment{c}%
               \stackunder[2pt]{\scriptscriptstyle i,j,k,\ell,m,n,p,q,r,s,t}
                               {\scriptscriptstyle i+j\equiv 1 \bmod{2}}
               }}  
        \binom{...}{i} \binom{...}{j} \binom{...}{k} \binom{...}{\ell} \binom{...}{m} \binom{...}{n} \cdot\ldots\\
        \ldots \cdot \binom{...}{p} \binom{...}{q} \binom{...}{r} \binom{...}{s} \binom{...}{t},
    \end{multlined}\\
    &=1,
\end{align*}
%
but works fine without \texttt{$\backslash$substack},
%
\begin{align*}
\MoveEqLeft[2]% default is 2em
    \mathcal{X}\\
    &\!\begin{multlined}[t][\linewidth-\mathindent-2em-\multlinegap]
        =\sum_{i,j,k,\ell,m,n,p,q,r,s,t}  \binom{...}{i} \binom{...}{j} \binom{...}{k} \binom{...}{\ell} \binom{...}{m} \binom{...}{n} \cdot\ldots\\
        \ldots \cdot \binom{...}{p} \binom{...}{q} \binom{...}{r} \binom{...}{s} \binom{...}{t}.
    \end{multlined}\\
    &=1,
\end{align*}
    \end{document}

看起来alignsubstackmultiline彼此之间并没有太大的关系 :-(,也就是说,这里存在一个错误。

相关内容