
第一次將方程式直接插入 LaTeX,所以毫無疑問我錯過了顯而易見的事情。
我有一個簡單的 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
.這裡第一列處於數學模式,第二列處於文字模式。
\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}
請注意,在這種情況下,第二列內容需要包含在\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}