这是我生成此表的努力。我想知道为什么我会出错?错误是“未定义序列”。或者,欢迎使用任何更好的格式来制表以下示例数据。
\begin{table}
\centering
\captionsetup{width=10cm}
\caption{Initial, post-etch and post SPM treatment heights.}
\label{tab:2}
\begin{tabular}{l *{3}{S[table-format=4.0]}}
\toprule
{Wafer \#} & {Initial height} & {Post-etch height}&{Post SPM treatment} &{SPM treatment}$ \\
& \si{\mu m} & \si{\mu m} &\si{nm}\\
\midrule
$Length (mm)$ & 1.4725 & 1.5875 & 142.5 & 112\\
$Width (mm)$ & 1.4725 & 1.575& 142.5& 113 \\
$Thickness (mm)$ & 1.495 & 1.5925& 132.5& 145 \\
$Young modulus (GPa))$ & 1.492 & 1.66 & 190& 456\\
$Young modulus (GPa)$ & 1.465 & 1.63& 197.5& 5454 \\
$TYoung modulus (GPa)$ & 1.2525 & 1.4625& 192.5 & 543\\
$Young modulus (GPa)$ & 1.2525 & 1.4625& 192.5& 903 \\
$Boundary conditions$ & 1.2525 & 1.4625& 192.5& 5353 \\
$Applied load$ & 1.2525 & 1.4625& 192.5& 434 \\
$Young modulus (GPa)$ & 1.2525 & 1.4625& 192.5& 5345 \\
\bottomrule
\end{tabular}
\end{table}
答案1
这是有效的,请注意已加载的包和表的更改。
\documentclass{article}
\usepackage{siunitx,booktabs,caption}
\begin{document}
\begin{table}
\centering
\captionsetup{width=10cm}
\caption{Initial, post-etch and post SPM treatment heights.}
\label{tab:2}
\begin{tabular}{
l
S[table-format=1.4]
S[table-format=1.4]
S[table-format=3.1]
S[table-format=4.0]
}
\toprule
{Wafer \#} & {Initial} & {Post-etch} & {Post SPM} & {SPM} \\
& {height} & {height} & {treatment} & {treatment} \\
& \si{\micro\meter}
& \si{\micro\meter}
& \si{\nano\meter} \\
\midrule
Length (\si{mm}) & 1.4725 & 1.5875 & 142.5 & 112 \\
Width (\si{mm}) & 1.4725 & 1.575 & 142.5 & 113 \\
Thickness (\si{mm}) & 1.495 & 1.5925 & 132.5 & 145 \\
Young modulus (\si{GPa}) & 1.492 & 1.66 & 190 & 456 \\
Young modulus (\si{GPa}) & 1.465 & 1.63 & 197.5 & 5454 \\
TYoung modulus (\si{GPa}) & 1.2525 & 1.4625 & 192.5 & 543 \\
Young modulus (\si{GPa}) & 1.2525 & 1.4625 & 192.5 & 903 \\
Boundary conditions & 1.2525 & 1.4625 & 192.5 & 5353 \\
Applied load & 1.2525 & 1.4625 & 192.5 & 434 \\
Young modulus (\si{GPa}) & 1.2525 & 1.4625 & 192.5 & 5345 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
答案2
我建议这样做,另外使用makecell
:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[showframe]{geometry}
\usepackage{siunitx, booktabs, caption, makecell}
\DeclareSIUnit\micron{\micro\metre}
\renewcommand\theadfont{\normalsize\upshape}
\begin{document}
\begin{table}
\centering
\captionsetup{width=10cm}\setlength\extrarowheight{3pt}
\caption{Initial, post-etch and post SPM treatment heights.}
\label{tab:2}
\begin{tabular}{ @{}>{\itshape}l *{2}{S[table-format=1.4]}S[table-format=3.1]S[table-format=4.0]}
\toprule
{\thead{Wafer \#\\ (\si{\micron})}} & {\thead{Initial height\\ (\si{\micron})}} & {\thead{Post-etch \\ height (\si{\micron})}}
& {\thead{Post SPM\\ treatment (\si{\nm})}} & {\thead{SPM\\ treatment}} \\
\midrule
Length (mm) & 1.4725 & 1.5875 & 142.5 & 112\\
Width (mm) & 1.4725 & 1.575& 142.5& 113 \\
Thickness (mm) & 1.495 & 1.5925& 132.5& 145 \\
Young modulus (GPa) & 1.492 & 1.66 & 190& 456\\
Young modulus (GPa) & 1.465 & 1.63& 197.5& 5454 \\
TYoung modulus (GPa) & 1.2525 & 1.4625& 192.5 & 543\\
Young modulus (GPa) & 1.2525 & 1.4625& 192.5& 903 \\
Boundary conditions & 1.2525 & 1.4625& 192.5& 5353 \\
Applied load & 1.2525 & 1.4625& 192.5& 434 \\
Young modulus (GPa) & 1.2525 & 1.4625& 192.5& 5345 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}