我在 LaTeX 中使用tabular
3 列环境。我想用垂直线将第 1 列与第 2 列和第 3 列分开。
目前我只能在每一行单独创建一条垂直线,结果是行与行之间的线条不匹配。
\begin{table}{ht}
\caption{Model Input Information: Materials}
\centering
\begin{tabular}{c c c}
\hline\hline
Available Materials \vline & Material Input Parameters & Description \\
\hline
Fused Silica (delta eV = 9) & alpha & Avalanche Coefficient [$cm{^2}$/J] \\
Fused Silica (delta eV = 7.5) & delta eV & Material Band Gap [eV] \\
GaAs & me & Effective Electron Mass [kg] \\
ZnSe & n0 & Linear Refractive Index \\
Ge & n2 & Non-Linear Refractive Index \\
$HfO_2$ & T & Effective Decay Constant [fs] \\
$TiO_2$ & & \\
$Ta_2O_5$ & & \\
$Al_2O_3$ & & \\
$SiO_2$ & & \\
\hline
\end{tabular}
\label{table:MaterialInputs}
\end{table}
第一行显示的\vline
是我最初尝试如何去做的。
答案1
表格格式规范中的A|
表示垂直规则:
\documentclass{article}
\begin{document}
\begin{table}[ht]
\caption{Model Input Information: Materials}
\centering
\begin{tabular}{c | c | c}
\hline\hline
Available Materials & Material Input Parameters & Description \\
\hline
Fused Silica (delta eV = 9) & alpha & Avalanche Coefficient [$cm{^2}$/J] \\
Fused Silica (delta eV = 7.5) & delta eV & Material Band Gap [eV] \\
GaAs & me & Effective Electron Mass [kg] \\
ZnSe & n0 & Linear Refractive Index \\
Ge & n2 & Non-Linear Refractive Index \\
$HfO_2$ & T & Effective Decay Constant [fs] \\
$TiO_2$ & & \\
$Ta_2O_5$ & & \\
$Al_2O_3$ & & \\
$SiO_2$ & & \\
\hline
\end{tabular}
\label{table:MaterialInputs}
\end{table}
\end{document}
一些评论:
我建议你不要使用垂直规则,而是使用
booktabs
包裹。为了正确排版化学化合物,您可以使用各种包。在下面的例子中,我使用
\ce
了mhchem
。为了正确排版单位,我建议
siunitx
包装。还要注意,位置说明符应该放在方括号内,例如
\begin{table}[ht]
显示其中一些建议的示例代码:
\documentclass{article}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{mhchem}
\sisetup{per-mode = symbol}
\begin{document}
\begin{table}[ht]
\caption{Model Input Information: Materials}
\centering
\begin{tabular}{c c c}
\toprule
Available Materials & Material Input Parameters & Description \\
\midrule
Fused Silica (delta eV = 9) & alpha & Avalanche Coefficient [\si{\cm\squared\per\joule}] \\
Fused Silica (delta eV = 7.5) & delta eV & Material Band Gap [\si{\electronvolt}] \\
\ce{GaAs} & me & Effective Electron Mass [\si{\kilogram}] \\
\ce{ZnSe} & n0 & Linear Refractive Index \\
\ce{Ge} & n2 & Non-Linear Refractive Index \\
\ce{HfO_2} & T & Effective Decay Constant [fs] \\
\ce{TiO_2} & & \\
\ce{Ta_2O_5} & & \\
\ce{Al_2O_3} & & \\
\ce{SiO_2} & & \\
\bottomrule
\end{tabular}
\label{table:MaterialInputs}
\end{table}
\end{document}