我有代码:
\documentclass{article}
\usepackage{siunitx}
\begin{document}
\begin{table}
\caption{Solution}
\renewcommand{\arraystretch}{1.3}
\sisetup{separate-uncertainty,table-column-width=6em}
\begin{tabular}{lS[table-format = 3.2(3)]
S[table-format = 1.2(3)]}
\hline\hline
{GJH} &{JHG} & {KJH} \\
\hline
GGG & 75.91(18) & 77.71(21) \\
GHJ & 122.73(159) & 452.37(71) \\
GHGKJ & 21.96(33) & 77.28(25) \\
JGKJ & 78.1(3) & 54.6(4) \\
\hline
\end{tabular}\\
\begin{tabular}{lS[table-format = 2.3,table-space-text-post=\hspace{3.8em}]
S[table-format = 2.3,table-space-text-post=\hspace{4.7em}]@{\hskip -0.66em}}
JHI & 21.1 & 19.4 \\
GKJK & 8.8 & 8.1 \\
JHGK & 13.6 & 10.4 \\
JHGK & 3.7 & 1.71 \\
JKGHJ & -8.28 & -7.69 \\
GKJ & -4.55 & -2.87 \\
GKJH & 0.690 & 0.712 \\
JGK & 0.037 & 0.014 \\
JHGK & 3.50 & 3.70 \\
GKJ & 4.24 & 4.88 \\
JHK & 11.389 & 1.008 \\
\hline
\end{tabular}
\quad
\begin{tabular}{ll}
\hline\hline
{GDHDG} & {Values} \\
\hline
HJGJH & 1.665656 \\
JKG & 0.789456 \\
JGK & 0.45655 \\
JK & 0.45456 \\
JHGJ & 78956 \\
GJKHG & 66589 \\
HFJFGH & 7.454 \\
\hline
\end{tabular}
\end{table}
\end{document}
如何对齐表格以使双线具有相同的高度?
答案1
您可能喜欢...
带有位置选项的表格[t]
嵌套在带有p
列类型的表格中。除此之外,还对水平居中进行了一些努力(正如您在上一个问题的回答下方的评论中询问的那样),并使用了booktabs
答案中的规则:
\documentclass{article}
\usepackage{siunitx}
\usepackage{booktabs}
\begin{document}
\begin{table}
\centering
\caption{Solution}
\renewcommand{\arraystretch}{1.2}
\sisetup{separate-uncertainty,table-column-width=7em}
\begin{tabular}{>{\raggedleft} p{0.60\linewidth}
>{\raggedright}p{0.35\linewidth}}
\begin{tabular}[t]{l S[table-format = 3.2(3)]
S[table-format = 3.2(3)]}
\toprule
GJH & \hphantom{x}{JHG} & \hphantom{x}{KJH} \\
\midrule
GGG & 75.91(18) & 77.71(21) \\
GHJ & 122.73(159) & 452.37(71) \\
GHGKJ & 21.96(33) & 77.28(25) \\
JGKJ & 78.1(3) & 4.6(4) \\
\midrule
\end{tabular}
\begin{tabular}{lS[table-format = 6.3]
S[table-format = 6.3]
}
JHI & 21.1 & 19.4 \\
GKJK & 8.8 & 8.1 \\
JHGK & 13.6 & 10.4 \\
JHGK & 3.7 & 1.71 \\
JKGHJ & -8.28 & -7.69 \\
GKJ & -4.55 & -2.87 \\
GKJH & 0.690 & 0.712 \\
JGK & 0.037 & 0.014 \\
JHGK & 3.50 & 3.70 \\
GKJ & 4.24 & 4.88 \\
JHK & 11.389 & 1.008 \\
\bottomrule
\end{tabular}
&
\begin{tabular}[t]{ll}
\toprule
GDHDG & Values \\
\midrule
HJGJH & 1.665656 \\
JKG & 0.789456 \\
JGK & 0.45655 \\
JK & 0.45456 \\
JHGJ & 78956 \\
GJKHG & 66589 \\
HFJFGH & 7.454 \\
\bottomrule
\end{tabular}
\end{tabular}
\end{table}
\end{document}
答案2
通过将optabulars
中的两个对齐,您可以实现以下布局:t
minipages
\documentclass{article}
\usepackage{siunitx}a
\begin{document}
\begin{table}
\caption{Solution}
\centering
\renewcommand{\arraystretch}{1.3}
\sisetup{separate-uncertainty,table-column-width=6em}
\begin{minipage}[t]{0.57\textwidth}
\begin{tabular}[t]{lS[table-format = 3.2(3)]
S[table-format = 3.2(2)]}
\hline\hline
{GJH} &{JHG} & {KJH} \\
\hline
GGG & 75.91(18) & 77.71(21) \\
GHJ & 122.73(159) & 452.37(71) \\
GHGKJ & 21.96(33) & 77.28(25) \\
JGKJ & 78.1(3) & 54.6(4) \\
\hline
\end{tabular}\\
\begin{tabular}{lS[table-format = -2.3]
S[table-format = -2.3]}
JHI & 21.1 & 19.4 \\
GKJK & 8.8 & 8.1 \\
JHGK & 13.6 & 10.4 \\
JHGK & 3.7 & 1.71 \\
JKGHJ & -8.28 & -7.69 \\
GKJ & -4.55 & -2.87 \\
GKJH & 0.690 & 0.712 \\
JGK & 0.037 & 0.014 \\
JHGK & 3.50 & 3.70 \\
GKJ & 4.24 & 4.88 \\
JHK & 11.389 & 1.008 \\
\hline
\end{tabular}
\end{minipage}\quad
\begin{minipage}[t]{0.3\textwidth}
\begin{tabular}[t]{ll}
\hline\hline
{GDHDG} & {Values} \\
\hline
HJGJH & 1.665656 \\
JKG & 0.789456 \\
JGK & 0.45655 \\
JK & 0.45456 \\
JHGJ & 78956 \\
GJKHG & 66589 \\
HFJFGH & 7.454 \\
\hline
\end{tabular}
\end{minipage}
\end{table}
\end{document}
旁注:我还稍微改变了table-format
一些S
类型单元格的选项,以消除大量过满框警告。
答案3
我试图更好地对齐列。不幸的是,一些列的小数与\pm
其他列的开头对齐。
\documentclass{article}
\usepackage{siunitx}
\begin{document}
\begin{table}
\caption{Solution}
\centering
\renewcommand{\arraystretch}{1.3}
\sisetup{separate-uncertainty,table-column-width=6em}
\begin{tabular}[t]{lS[table-format = -2.3]
S[table-format = -2.3]}
\hline\hline
{GJH} &{JHG} & {KJH} \\
\hline
GGG & \multicolumn{1}{S[table-format = 3.2(3)]}{75.91(18)}
& \multicolumn{1}{S[table-format = 3.2(2)]}{77.71(21)} \\
GHJ & \multicolumn{1}{S[table-format = 3.2(3)]}{122.73(159)}
& \multicolumn{1}{S[table-format = 3.2(2)]}{452.37(71)} \\
GHGKJ & \multicolumn{1}{S[table-format = 3.2(3)]}{21.96(33)}
& \multicolumn{1}{S[table-format = 3.2(2)]}{77.28(25)} \\
JGKJ & \multicolumn{1}{S[table-format = 3.2(3)]}{78.1(3)}
& \multicolumn{1}{S[table-format = 3.2(2)]}{54.6(4)} \\
\hline
JHI & 21.1 & 19.4 \\
GKJK & 8.8 & 8.1 \\
JHGK & 13.6 & 10.4 \\
JHGK & 3.7 & 1.71 \\
JKGHJ & -8.28 & -7.69 \\
GKJ & -4.55 & -2.87 \\
GKJH & 0.690 & 0.712 \\
JGK & 0.037 & 0.014 \\
JHGK & 3.50 & 3.70 \\
GKJ & 4.24 & 4.88 \\
JHK & 11.389 & 1.008 \\
\hline
\end{tabular}\quad
\begin{tabular}[t]{ll}
\hline\hline
{GDHDG} & {Values} \\
\hline
HJGJH & 1.665656 \\
JKG & 0.789456 \\
JGK & 0.45655 \\
JK & 0.45456 \\
JHGJ & 78956 \\
GJKHG & 66589 \\
HFJFGH & 7.454 \\
\hline
\end{tabular}
\end{table}
\end{document}