我有一張表,cases
其中一列中有建議的內容這裡。我面臨的問題是第一列有一些文本,並且使用cases
與第一列中的文本內聯留下空白。我已經嘗試過建議的解決方案這裡,但並不能解決問題。有沒有辦法讓第二列案例與第一列文字水平對齊。也要刪除案例行和下一行之後的垂直空間。
微量元素
\documentclass{article}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{siunitx}
\begin{document}
\renewcommand{\arraystretch}{1.3}
\begin{tabular}{p{5.5cm}p{5cm}}
Velocity of light in vacuum & $c = \SI{2.998d8}{\meter\per\second}$\\
Gravitational constant & \[ G = \begin{cases} \SI{6.67d-11}{\meter\cubed\per\kilo\gram\per\second\squared} \\
\SI{6.67d-8}{\centi\meter\cubed\per\gram\per\second\squared}\end{cases} \] \\
Acceleration of free fall & $ g = \SI{9.807}{\meter\per\second\squared}$ \\\end{tabular}
\end{document}
答案1
像這樣:
- 正如@Οὖτις所提到的,數學應該是內聯的
- 無關:
- 你使用舊的(版本2)
siunitx
sintay。我建議使用新的,由套件版本 3 引入的(請參閱下面的 MWE) - 您可以透過使用該
tabularray
套件來獲得更簡單的表程式碼
- 你使用舊的(版本2)
\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{amsmath,
booktabs,
siunitx}
\begin{document}
\noindent\begin{tblr}{colspec = {l X[l, mode=math]},
rowsep=3pt} % 5pt. pw desired bigger vertical distance between math terms
Velocity of light in vacuum
& c = \SI{2.998d8}{\meter\per\second} \\
Gravitational constant
& G = \begin{cases}
\qty{6.67e-11}{\meter\cubed\per\kilo\gram\per\second\squared} \\
\qty{6.67e-8}{\cm\cubed\per\gram\per\second\squared}
\end{cases} \\
Acceleration of free fall
& g = \qty{9.807}{\meter\per\second\squared} \\
\end{tblr}
\end{document}
答案2
這是可能的nicematrix
\documentclass{article}
\usepackage{amsmath}
\usepackage{siunitx}
\usepackage{nicematrix}
\newcolumntype{e}{@{$\mspace{\thickmuskip}$}c@{$\mspace{\thickmuskip}$}}
\begin{document}
\begin{equation*}
\everymath{\displaystyle}
\begin{NiceArray}[cell-space-limits=1.1pt]{p[l]{5.5cm} r e l}
\text{Velocity of light in vacuum}
& c
& =
& \SI{2.998d8}{\meter\per\second}
\\
\text{Gravitational constant}
& G
& =
&
\begin{cases}
\SI{6.67d-11}{\meter\cubed\per\kilo\gram\per\second\squared} \\
\SI{6.67d-8}{\centi\meter\cubed\per\gram\per\second\squared}
\end{cases}
\\
\text{Acceleration of free fall}
& g
& =
& \SI{9.807}{\meter\per\second\squared}
\end{NiceArray}
\end{equation*}
\end{document}