行列の2行目は左揃えではなく中央揃えになっています

行列の2行目は左揃えではなく中央揃えになっています

初めて LaTeX に方程式を直接挿入するので、明らかなことを見逃しているに違いありません。

単純な 2 行 2 列のマトリックスがあります。ただし、マトリックスの一番上の行は希望どおり (左揃え) に配置されていますが、2 番目の行は中央揃えになっているようです。この行の配置を指定する方法はありますか?

現在の結果:

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

目標結果:

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

マークアップ:

\begin{figure}[h]
\Large
    \begin{displaymath}
        \Delta\tau_{xy}^{k} = \left\{\begin{matrix} 
        Q/L_k & if\; Agent\; k\; uses\; curve\; xy\; in\; its\; tour\\
        0 & otherwise
    \end{matrix}\right.
\end{displaymath}
\end{figure}

答え1

dcases*から使用できますmathtools。ここで、最初の列は数式モード、2 番目の列はテキスト モードです。

\documentclass{article}
\usepackage{mathtools}
\begin{document}
    \begin{equation}
        \Delta\tau_{xy}^{k} =
        \begin{dcases*}
        Q/L_k & if Agent  $k$ uses curve $xy$ in its tour\\
        0     & otherwise
        \end{dcases*}
   \end{equation}
\end{document}

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

ここでも同じ使用法ですcases

\documentclass{article}
\usepackage{mathtools}
\begin{document}
    \begin{equation}
        \Delta\tau_{xy}^{k} =
        \begin{cases}
        Q/L_k & \text{if Agent  $k$ uses curve $xy$ in its tour}\\
        0     & \text{otherwise}
        \end{cases}
   \end{equation}
\end{document}

この場合、2番目の列の内容を\tex{...}マクロで囲む必要があることに注意してください。

答え2

matrixの関連コマンドamsmathすべてに列がc入力されています。簡単な方法は、casesと を使用することです。または、 で手動で設定して、array希望する配置にすることもできます。

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

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\[
  \Delta\tau_{xy}^{k} = \left\{\begin{matrix}
    Q/L_k & \text{if Agent~$k$ uses curve~$xy$ in its tour} \\
    0 & \text{otherwise}
  \end{matrix}\right.
\]

\[
  \Delta\tau_{xy}^{k} = \left\{\begin{array}{@{}ll@{}}
    Q/L_k & \text{if Agent~$k$ uses curve~$xy$ in its tour} \\
    0 & \text{otherwise}
  \end{array}\right.\kern-\nulldelimiterspace
\]

\end{document}

関連情報