我有一张有 9 列的表,其代码是
\documentclass{article}
\begin{document}
\begin {table}[h]
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|}
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9\\
Vector Indicator & $X_i$ & $Y_i$ & $d_i$ & $Z_i+d_i \cdot \arctan(2^{-1})$ & $\sum_{0}^{\infty}d_i \cdot \arctan(2^{-i})$ & i & $2^{-i}$ & $\arctan(2^{-i})$\\
X0,Y0 & 0.920505 & 0.390731 & -1 & 23.000 & -45 & 0 & 1 & 45\\
X1,Y1 & 1.311235982 & -0.52977372 & 1 & -22 & -18.43494882 & 1 & 0.5 & 26.56505\\
0 & 1 & 45\\
X2,Y2 & 1.576122844 & 0.125844266 & -1 & 4.565051177 & -32.47119229 & 2 & 0.25 & 14.03624 \\
X3,Y3 & 1.607583911 & -0.26818645 & 1 & -9.471192291 & -25.34617594 & 3 & 0.125 & 7.12502 \\
X4,Y4 & 1.641107217 & -0.06723846 & 1 & -2.346175942 & -21.76984157 & 4 & 0.0625 & 3.57633\\
X5,Y5 & 1.64530962 & 0.035330745 & -1 & 1.230158433 & -23.55975218 & 5 & 0.03125 & 1.78991\\
X6,Y6 & 1.646413706 & -0.01608518 & 1 & -0.559752175 & -22.66457846 & 6 & 0.015625 & 0.89517\\
X7,Y7 & 1.646665037 & 0.009640033 & -1 & 0.335421535 & -23.11219264 & 7 & 0.0078125 & 0.44761\\
X8,Y8 & 1.64674035 & -0.00322454 & 1 & -0.112192636 & -22.88838214 & 8 & 0.00390625 & 0.22381\\
X9,Y9 & 1.646752945 & 0.003208042 & -1 & 0.111617865 & -23.00028781 & 9 & 0.001953125 & 0.11191\\
X10,Y10 & 1.646759211 & -8.27E-06 & 1 & -0.000287813 & -22.94433492 & 10 & 0.000976563 & 0.05595\\
X11,Y11 & 1.646759219 & 0.001599891 & -1 & 0.055665079 & -22.97231137 & 11 & 0.000488281 & 0.02798\\
X12,Y12 & 1.64676 & 0.00079581 & -1 & 0.027688627 & -22.9862996 & 12 & 0.000244141 & 0.01399\\
X13,Y13 & 1.646760195 & 0.000393768 & -1 & 0.0137004 & -22.99329371 & 13 & 0.00012207 & 0.00699 \\
X14,Y14 & 1.646760243 & 0.000192748 & -1 & 0.006706286 & -22.99679077 & 14 & 6.10E-05 & 0.0035\\
X15,Y15 & 1.646760255 & 9.22E-05 & -1 & 0.003209229 & -22.9985393 & 15 & 3.05E-05 & 0.00175\\
X16,Y16 & 1.646760257 & 4.20E-05 & -1 & 0.001460701 & -22.99941356 & 16 & 1.53E-05 & 0.00087 \\
\hline
\end{tabular}
\end{center}
\end {table}
\end{document}
在输出中,表格显示如下
如何才能让最后两列出现在输出中?
答案1
我尽可能地缩小了:
\documentclass{article}
\usepackage{siunitx,booktabs}
\begin{document}
\begin{table}
\centering
\sisetup{group-digits=false}
\scriptsize
\addtolength{\tabcolsep}{-4.25pt}
\begin{tabular}{
@{}
l
S[table-format=1.9]
S[table-format=-1.9]
S[table-format=-1.0]
S[table-format=-2.9]
S[table-format=-2.9]
S[table-format=2.0]
S[table-format=1.9]
S[table-format=2.5]
@{}
}
\toprule
\multicolumn{1}{c}{1} & {2} & {3} & {4} & {5} & {6} & {7} & {8} & {9}\\
\midrule
VI & {$X_i$} & {$Y_i$} & {$d_i$} &
{$f(Z_i,d_i)$} &
{$S$} & {$i$} &
{$2^{-i}$} & {$g(i)$}\\
\midrule
X0,Y0 & 0.920505 & 0.390731 & -1 & 23.000 & -45 & 0 & 1 & 45\\
X1,Y1 & 1.311235982 & -0.52977372 & 1 & -22 & -18.43494882 & 1 & 0.5 & 26.56505\\
0 & 1 & 45\\
X2,Y2 & 1.576122844 & 0.125844266 & -1 & 4.565051177 & -32.47119229 & 2 & 0.25 & 14.03624 \\
X3,Y3 & 1.607583911 & -0.26818645 & 1 & -9.471192291 & -25.34617594 & 3 & 0.125 & 7.12502 \\
X4,Y4 & 1.641107217 & -0.06723846 & 1 & -2.346175942 & -21.76984157 & 4 & 0.0625 & 3.57633\\
X5,Y5 & 1.64530962 & 0.035330745 & -1 & 1.230158433 & -23.55975218 & 5 & 0.03125 & 1.78991\\
X6,Y6 & 1.646413706 & -0.01608518 & 1 & -0.559752175 & -22.66457846 & 6 & 0.015625 & 0.89517\\
X7,Y7 & 1.646665037 & 0.009640033 & -1 & 0.335421535 & -23.11219264 & 7 & 0.0078125 & 0.44761\\
X8,Y8 & 1.64674035 & -0.00322454 & 1 & -0.112192636 & -22.88838214 & 8 & 0.00390625 & 0.22381\\
X9,Y9 & 1.646752945 & 0.003208042 & -1 & 0.111617865 & -23.00028781 & 9 & 0.001953125 & 0.11191\\
X10,Y10 & 1.646759211 & -0.00000827 & 1 & -0.000287813 & -22.94433492 & 10 & 0.000976563 & 0.05595\\
X11,Y11 & 1.646759219 & 0.001599891 & -1 & 0.055665079 & -22.97231137 & 11 & 0.000488281 & 0.02798\\
X12,Y12 & 1.64676 & 0.00079581 & -1 & 0.027688627 & -22.9862996 & 12 & 0.000244141 & 0.01399\\
X13,Y13 & 1.646760195 & 0.000393768 & -1 & 0.0137004 & -22.99329371 & 13 & 0.00012207 & 0.00699\\
X14,Y14 & 1.646760243 & 0.000192748 & -1 & 0.006706286 & -22.99679077 & 14 & 0.000061 & 0.0035\\
X15,Y15 & 1.646760255 & 0.0000922 & -1 & 0.003209229 & -22.9985393 & 15 & 0.0000305 & 0.00175\\
X16,Y16 & 1.646760257 & 0.000042 & -1 & 0.001460701 & -22.99941356 & 16 & .0000153 & 0.00087\\
\midrule[\heavyrulewidth]
\multicolumn{9}{@{}l@{}}{VI means Vector Indicator} \\
\addlinespace
\multicolumn{9}{@{}l@{}}{$f(Z_i,d_i)=Z_i+d_i \cdot \arctan(2^{-1})$} \\
\addlinespace
\multicolumn{9}{@{}l@{}}{$S=\sum_{0}^{\infty}d_i \cdot \arctan(2^{-i})$} \\
\addlinespace
\multicolumn{9}{@{}l@{}}{$g(i)=\arctan(2^{-i})$}
\end{tabular}
\end {table}
\end{document}
答案2
表格中的数据本身存在一些问题。首先,您将指数表示法与长浮点表示法混合在一起。其次,双字标题可以写在两行上,例如Vector Indicator
和$\sum_{0}^{\infty}d_i \cdot \arctan(2^{-i})$
等。
\documentclass{article}
\usepackage{rotating,booktabs} % sidewaystable
\begin{document}
\begin {sidewaystable}[h]
\centering
\begin{tabular}{*{9}{c}}
\toprule
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9\\ \midrule
Vector Indicator & $X_i$ & $Y_i$ & $d_i$ & $Z_i+d_i \cdot \arctan(2^{-1})$ & $\sum_{0}^{\infty}d_i \cdot \arctan(2^{-i})$ & i & $2^{-i}$ & $\arctan(2^{-i})$\\
X0,Y0 & 0.920505 & 0.390731 & -1 & 23.000 & -45 & 0 & 1 & 45\\
X1,Y1 & 1.311235982 & -0.52977372 & 1 & -22 & -18.43494882 & 1 & 0.5 & 26.56505\\
0 & 1 & 45 &&&&&&\\
X2,Y2 & 1.576122844 & 0.125844266 & -1 & 4.565051177 & -32.47119229 & 2 & 0.25 & 14.03624 \\
X3,Y3 & 1.607583911 & -0.26818645 & 1 & -9.471192291 & -25.34617594 & 3 & 0.125 & 7.12502 \\
X4,Y4 & 1.641107217 & -0.06723846 & 1 & -2.346175942 & -21.76984157 & 4 & 0.0625 & 3.57633\\
X5,Y5 & 1.64530962 & 0.035330745 & -1 & 1.230158433 & -23.55975218 & 5 & 0.03125 & 1.78991\\
X6,Y6 & 1.646413706 & -0.01608518 & 1 & -0.559752175 & -22.66457846 & 6 & 0.015625 & 0.89517\\
X7,Y7 & 1.646665037 & 0.009640033 & -1 & 0.335421535 & -23.11219264 & 7 & 0.0078125 & 0.44761\\
X8,Y8 & 1.64674035 & -0.00322454 & 1 & -0.112192636 & -22.88838214 & 8 & 0.00390625 & 0.22381\\
X9,Y9 & 1.646752945 & 0.003208042 & -1 & 0.111617865 & -23.00028781 & 9 & 0.001953125 & 0.11191\\
X10,Y10 & 1.646759211 & -8.27E-06 & 1 & -0.000287813 & -22.94433492 & 10 & 0.000976563 & 0.05595\\
X11,Y11 & 1.646759219 & 0.001599891 & -1 & 0.055665079 & -22.97231137 & 11 & 0.000488281 & 0.02798\\
X12,Y12 & 1.64676 & 0.00079581 & -1 & 0.027688627 & -22.9862996 & 12 & 0.000244141 & 0.01399\\
X13,Y13 & 1.646760195 & 0.000393768 & -1 & 0.0137004 & -22.99329371 & 13 & 0.00012207 & 0.00699 \\
X14,Y14 & 1.646760243 & 0.000192748 & -1 & 0.006706286 & -22.99679077 & 14 & 6.10E-05 & 0.0035\\
X15,Y15 & 1.646760255 & 9.22E-05 & -1 & 0.003209229 & -22.9985393 & 15 & 3.05E-05 & 0.00175\\
X16,Y16 & 1.646760257 & 4.20E-05 & -1 & 0.001460701 & -22.99941356 & 16 & 1.53E-05 & 0.00087 \\
\bottomrule
\end{tabular}
\end {sidewaystable}
\end{document}
使用\tiny
和\renewcommand{\tabcolsep}{1.5pt}
我们得到以下不可接受的小表格:
再试一次:
修改如下:
\documentclass{article}
\usepackage{booktabs} % sidewaystable
\begin{document}
\begin {table}[htbp]
\centering\footnotesize
\renewcommand{\tabcolsep}{4pt}
\begin{tabular}{@{}*{9}{c}@{}}
\toprule
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9\\
{Vector } & & & & $Z_i+d_i \times$ & $\sum_{0}^{\infty}d_i \times$ & & & \\
{ Indicator} & $X_i$ & $Y_i$ & $d_i$ & $\arctan(1/2)$ & $\arctan(1/2)$ & i & $2^{-i}$ & $\arctan(2^{-i})$\\
\midrule
X0,Y0 & 0.920505 & 0.390731 & -1 & 23.000 & -45 & 0 & 1 & 45\\
X1,Y1 & 1.311235982 & -0.52977372 & 1 & -22 & -18.43494882 & 1 & 0.5 & 26.56505\\
0 & 1 & 45 &&&&&&\\
X2,Y2 & 1.576122844 & 0.125844266 & -1 & 4.565051177 & -32.47119229 & 2 & 0.25 & 14.03624 \\
X3,Y3 & 1.607583911 & -0.26818645 & 1 & -9.471192291 & -25.34617594 & 3 & 1.25E-1 & 7.12502 \\
X4,Y4 & 1.641107217 & -0.06723846 & 1 & -2.346175942 & -21.76984157 & 4 & 6.25E-2 & 3.57633\\
X5,Y5 & 1.64530962 & 0.035330745 & -1 & 1.230158433 & -23.55975218 & 5 & 3.12E-2 & 1.78991\\
X6,Y6 & 1.646413706 & -0.01608518 & 1 & -0.559752175 & -22.66457846 & 6 & 1.56E-2 & 0.89517\\
X7,Y7 & 1.646665037 & 0.009640033 & -1 & 0.335421535 & -23.11219264 & 7 & 7.81E-3 & 0.44761\\
X8,Y8 & 1.64674035 & -0.00322454 & 1 & -0.112192636 & -22.88838214 & 8 & 3.91E-3 & 0.22381\\
X9,Y9 & 1.646752945 & 0.003208042 & -1 & 0.111617865 & -23.00028781 & 9 &1.95E-3 & 0.11191\\
X10,Y10 & 1.646759211 & -8.27E-06 & 1 & -0.000287813 & -22.94433492 & 10 & 9.76E-4 & 0.05595\\
X11,Y11 & 1.646759219 & 0.001599891 & -1 & 0.055665079 & -22.97231137 & 11 & 4.88E-4 & 0.02798\\
X12,Y12 & 1.64676 & 0.00079581 & -1 & 0.027688627 & -22.9862996 & 12 & 2.44E-4 & 0.01399\\
X13,Y13 & 1.646760195 & 0.000393768 & -1 & 0.0137004 & -22.99329371 & 13 & 1.22E-4 & 0.00699 \\
X14,Y14 & 1.646760243 & 0.000192748 & -1 & 0.006706286 & -22.99679077 & 14 & 6.10E-5 & 0.0035\\
X15,Y15 & 1.646760255 & 9.22E-05 & -1 & 0.003209229 & -22.9985393 & 15 & 3.05E-5 & 0.00175\\
X16,Y16 & 1.646760257 & 4.20E-05 & -1 & 0.001460701 & -22.99941356 & 16 & 1.53E-5 & 0.00087 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
答案3
这是一个解决方案,它使用包的内置舍入功能siunitx
在九列中的六列中仅显示 5 位有效数字。
\documentclass{article}
\usepackage[a4paper,margin=1in]{geometry} % choose margins suitably
\usepackage{amsmath,siunitx,booktabs}
\sisetup{round-mode=places,
round-precision=5,
group-digits=false,
scientific-notation = fixed,
fixed-exponent = 0}
\begin{document}
\begin{table}[h]
\setlength\medmuskip{0mu} % no space around "+" symbols
\centering
$\begin{array}{@{} c
S[table-format= 1.5]
S[table-format=-1.5]
S[table-format=-1.0]
S[table-format=-2.5]
S[table-format=-2.5]
S[table-format= 2.0]
S[table-format= 1.5]
S[table-format= 2.5] @{}}
\toprule
1 & {2} & {3} & {4} & {5} & {6} & {7} & {8} & {9}\\
\text{Vect.\ Ind.} & {X_i} & {Y_i} & {d_i}
& {Z_i+d_i \arctan \frac12}
& {\sum\limits_{i=0}^{\infty}d_i \arctan \frac{1}{2^i}}
& {i} & {2^{-i}} & \arctan 2^{-i}\\
\midrule
X0,Y0 & 0.920505 & 0.390731 & -1 & 23.000 & -45 & 0 & 1 & 45\\
X1,Y1 & 1.311235982 & -0.52977372 & 1 & -22 & -18.43494882 & 1 & 0.5 & 26.56505\\
0 & 1 & 45\\
X2,Y2 & 1.576122844 & 0.125844266 & -1 & 4.565051177 & -32.47119229 & 2 & 0.25 & 14.03624 \\
X3,Y3 & 1.607583911 & -0.26818645 & 1 & -9.471192291 & -25.34617594 & 3 & 0.125 & 7.12502 \\
X4,Y4 & 1.641107217 & -0.06723846 & 1 & -2.346175942 & -21.76984157 & 4 & 0.0625 & 3.57633\\
X5,Y5 & 1.64530962 & 0.035330745 & -1 & 1.230158433 & -23.55975218 & 5 & 0.03125 & 1.78991\\
X6,Y6 & 1.646413706 & -0.01608518 & 1 & -0.559752175 & -22.66457846 & 6 & 0.015625 & 0.89517\\
X7,Y7 & 1.646665037 & 0.009640033 & -1 & 0.335421535 & -23.11219264 & 7 & 0.0078125 & 0.44761\\
X8,Y8 & 1.64674035 & -0.00322454 & 1 & -0.112192636 & -22.88838214 & 8 & 0.00390625 & 0.22381\\
X9,Y9 & 1.646752945 & 0.003208042 & -1 & 0.111617865 & -23.00028781 & 9 & 0.001953125 & 0.11191\\
X10,Y10 & 1.646759211 & -8.27E-06 & 1 & -0.000287813 & -22.94433492 & 10 & 0.000976563 & 0.05595\\
X11,Y11 & 1.646759219 & 0.001599891 & -1 & 0.055665079 & -22.97231137 & 11 & 0.000488281 & 0.02798\\
X12,Y12 & 1.64676 & 0.00079581 & -1 & 0.027688627 & -22.9862996 & 12 & 0.000244141 & 0.01399\\
X13,Y13 & 1.646760195 & 0.000393768 & -1 & 0.0137004 & -22.99329371 & 13 & 0.00012207 & 0.00699 \\
X14,Y14 & 1.646760243 & 0.000192748 & -1 & 0.006706286 & -22.99679077 & 14 & 6.10E-05 & 0.0035\\
X15,Y15 & 1.646760255 & 9.22E-05 & -1 & 0.003209229 & -22.9985393 & 15 & 3.05E-05 & 0.00175\\
X16,Y16 & 1.646760257 & 4.20E-05 & -1 & 0.001460701 & -22.99941356 & 16 & 1.53E-05 & 0.00087 \\
\bottomrule
\end{array}$
\end {table}
\end{document}