我有下表;
\begin{table}[htbp]
\scriptsize
\sisetup{round-mode=places}
\begin{tabular}{lS[round-precision=2]
S[round-precision=2]S[round-precision=2]S[round-precision=2]S[round-precision=2]
S[round-precision=2]S[round-precision=2]S[round-precision=2]
S[round-precision=2]S[round-precision=2]S[round-precision=2]S[round-precision=2]
S[round-precision=2]S[round-precision=2]} \hline \hline
\\ \hline
ZR & [-23.0457 & 29.572025] & -10.765862 & 12.058692 & -11.031138 & 11.065893 & -28.195796 & 28.162882 & -39.643381 & 39.66185 & -10.765862 & 11.065893 & -22.074058 & 23.699934 \\
OP & -22.726045 & .31390256 & -9.1251163 & 2.1487149 & -6.7200799 & 9.546617 & -15.378546 & 27.88493 & -21.525421 & 39.567726 & -6.7200799 & .31390256 & -14.935931 & 15.236132 \\
IS & -4.7930777 & 3.9469064 & -4.7311899 & 3.7447689 & -2.5053514 & 2.2386198 & -.45707635 & .38682361 & -.44266571 & .44049075 & -.44266571 & .38682361 & -2.6230893 & 2.1830086 \\
\hline \hline
\end{tabular}
\end{table}
每个奇数(偶数)列对应一个区间的下限(上限);有没有办法在每个数字的左边(右边)添加方括号 [ ],而不必手动执行此操作(如第一行中的前两个值所示)?我快要疯了,寻找答案……
答案1
对于此输出
使用
\begin{tabular}{l
>{[}S[round-precision=2]
S[round-precision=2]<{]}
...
在列之前插入,在列之后>{[}
插入。[
<{]}
或者使用
\begin{tabular}{l
>{[}S[table-format=4.2]@{}
S[table-format=3.2]<{]}
对齐括号并获得更紧凑的输出。@{}
删除列间空间。
最后,你可以使用\renewcommand{\arraystretch}{<factor>}
\documentclass[10pt,a4paper]{article}
\usepackage{siunitx}
\begin{document}
\begin{table}[htbp]
\renewcommand{\arraystretch}{1.3}% expand the cells
\scriptsize
\sisetup{round-mode=places}
\begin{tabular}{l *{7}{>{[}S[table-format=4.2]@{}S[table-format=3.2]<{]} } }
\hline \hline
\\ \hline
ZR & -23.0457 & 29.57202 & -10.765862 & 12.058692 & -11.031138 & 11.065893 & -28.195796 & 28.162882 & -39.643381 & 39.66185 & -10.765862 & 11.065893 & -22.074058 & 23.699934 \\
OP & -22.726045 & .31390256 & -9.1251163 & 2.1487149 & -6.7200799 & 9.546617 & -15.378546 & 27.88493 & -21.525421 & 39.567726 & -6.7200799 & .31390256 & -14.935931 & 15.236132 \\
IS & -4.7930777 & 3.9469064 & -4.7311899 & 3.7447689 & -2.5053514 & 2.2386198 & -.45707635 & .38682361 & -.44266571 & .44049075 & -.44266571 & .38682361 & -2.6230893 & 2.1830086 \\
\hline \hline
\end{tabular}
\end{table}
\end{document
*{7}{<column(s) format>}
重复列格式 7 次。