複数行に並べると余分なスペースができる

複数行に並べると余分なスペースができる

給餌

\documentclass{article}
\pagestyle{empty} 
\usepackage{mathtools}
\begin{document}
\[
  \begin{multlined}[c]
    \text{Line}\ 1\\
      \begin{aligned}[c]
        &\text{Line}\ 2.1\\
        \lor\ &\text{Line}\ 2.2\\
        \lor\ &\text{Line}\ 2.3
      \end{aligned}\text{stuff to the right}
  \end{multlined}
\]
\end{document}

利回りpdflatex

シンプルな出力

ご覧のとおり、「右側のもの」の直前に空白があります。

これはそれほど悪くないと思うかもしれませんが、さらに悪いことが起こります。

\documentclass{article}
\pagestyle{empty} 
\usepackage{mathtools}
\begin{document}
\[
  \begin{multlined}[c]
    \text{Line}\ 1\\
    \land \begin{aligned}[c]
      \left(
      \begin{aligned}[c]
        &\text{Line}\ 2.1\\
        \lor\ &\text{Line}\ 2.2\\
        \lor\ &\text{Line}\ 2.3
      \end{aligned}
    \right)
    \end{aligned}
  \end{multlined}
\]
\end{document}

生産する

出力

ご覧のとおり、右閉じ括弧の左側に余分な空白があります。数式が長く、環境のネストが増えると、空白が増えます。このスペースはどこから来るのでしょうか。 ? \mskip-5muBtw. などのハードコードされた負の距離を入れずに、このスペースを取り除くにはどうすればよいでしょうか。 の\mleft(…\mright)代わりに、\left(…\right) 同じ問題が発生します。

答え1

MWE の望ましい結果は次のようになると思います。

ここに画像の説明を入力してください

pmatrix代わりに以下を使用しますaligned:

\documentclass{article}
\pagestyle{empty}
\usepackage{mathtools}
\begin{document}
\[\setlength\arraycolsep{2pt}
  \begin{multlined}
    \text{Line}\ 1\\
    \land \begin{pmatrix}
                &\text{Line } 2.1\\
        \lor    &\text{Line } 2.2\\
        \lor    &\text{Line } 2.3
      \end{pmatrix}
  \end{multlined}
\]
\end{document}

または以下を使用しますarray:

\documentclass{article}
\pagestyle{empty}
\usepackage{mathtools}

\begin{document}
\[\setlength\arraycolsep{3pt}
  \begin{multlined}
    \text{Line}\ 1\\
    \land \left(\begin{array}{rl}
                &\text{Line } 2.1\\
        \lor    &\text{Line } 2.2\\
        \lor    &\text{Line } 2.3\\
                \end{array}\right)
  \end{multlined}
\]
\end{document}

ここに画像の説明を入力してください

答え2

スペースがどこから来るのかわかりません。行の距離と表示スタイルを維持しながらスペースを取り除く方法は次のとおりです。

\documentclass{article}
\pagestyle{empty} 
\usepackage{mathtools}
\begin{document}
\[
  \begin{multlined}[c]
    \text{Line}\ 1\\
      \begin{alignedat}[c]{1}
        &\text{Line}\ 2.1\\
        \lor\ &\text{Line}\ 2.2\\
        \lor\ &\text{Line}\ 2.3
      \end{alignedat}\text{stuff to the right}
  \end{multlined}
\]
\end{document}

収穫

出力

関連情報