使用如下布局:
\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}
\begin{document}
\begin{center}
\begin{tblr}{ colspec = {Q[l, mode=math] Q[c, si={table-format=-1.4}]},
row{1} = {guard, mode=text},
row{2-Z} = {rowsep=0pt},
row{2} = {abovesep=2pt},
row{odd[3-Z]} = {belowsep=0.5ex},
}
\toprule
Expression & Value \\
\toprule
a^2 + b^2 & -1.2345 \\
a^2 + b^2 & -1.2345 \\
a^2 + b^2 & -1.2345 \\
a^2 + b^2 & -1.2345 \\
a^2 + b^2 & -1.2345 \\
\bottomrule
\end{tblr}
\end{center}
\end{document}
我们如何创建下表?
\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}
\begin{document}
\begin{center}
\captionof{table}{Parameter values used in numerical simulations of system.}
\label{tab1}
\begin{tabular}{c|c|c|c|c|c|c|c|c|c|c|c}
\hline
& \beta & \mu & \alpha_{1} & p_{1} & \phi & \xi & \psi & p_{2} & p_{3} & \theta & \alpha_{2} \\
\hline
\hline
State 1 & 0.2 & 0.2 & 0.12 & 0.11 & 0.1 & 0.11 & 0.1 & 0.12 & 0.11 & 0.1 & 0.1\\
\hline
State 2 & 0.21 & 0.22 & 0.11 & p_{1} & 0.1 & 0.11 & 0.12 & 0.1 & 0.11 & 0.1 & 0.11\\
\hline
\end{tabular}
\end{center}
\end{document}
答案1
通常有助于阅读有关表格的介绍性文字。阅读所用包的文档也很有帮助。包的tabularray
文档简洁明了。非常值得一读。
编辑:
哎呀,我忘了表格标题。现在添加了...
\documentclass{article}
\usepackage[skip=1ex, font=small, labelfont=bf]{caption}
\usepackage{tabularray}
\UseTblrLibrary{siunitx}
\begin{document}
\begin{table}[ht]
\centering
\caption{Parameter values used in numerical simulations of system.}
\begin{tblr}{hlines, vline{2-Y}=solid,
colspec = {l *{11}{Q[c, si={table-format=1.2}]}},
cell{1}{2-Z} = {guard, mode=math},
}
& \beta & \mu & \alpha_1 & p_1 & \phi & \xi & \psi & p_2 & p_3 & \theta & \alpha_2 \\
State 1 & 0.2 & 0.2 & 0.12 & 0.11 & 0.1 & 0.11 & 0.1 & 0.12 & 0.11 & 0.1 & 0.1 \\
State 2 & 0.21 & 0.22 & 0.11 & \SetCell{guard, c, $} p_1
& 0.1 & 0.11 & 0.12 & 0.1 & 0.11 & 0.1 & 0.11 \\
\end{tblr}
\end{table}
\end{document}