在LaTeX中如何在多個表中具有相同的字體大小?

在LaTeX中如何在多個表中具有相同的字體大小?

我有兩張桌子。一個有更多的列,而另一個只有很少的列。現在的問題是字體大小不一樣。

表一包含大量資料:

%-------------------------------------------
\begin{table}[H]
\begin{adjustbox}{width=1\textwidth}
\begin{tabular}{|l|l|l|l|l|l|l|}
\hline
\rowcolor[HTML]{ECF4FF} 
Treatment                         & Estimate. Mean in group Faunus   control & Estimate. Mean in group Faunus   with Tannin & p-value & statistic.t & conf.int1 & conf.int2 \\ \hline
p6\_gallic\_acid                  & 1.199                                    & 0.460                                        & 0.003   & 3.463       & 0.29      & 1.185     \\ \hline
p11\_di\_galloylglucose\_ester    & 1.037                                    & 0.419                                        & 0.006   & 3.127       & 0.204     & 1.032     \\ \hline
p22\_tri\_galloylglucose\_ester   & 0.370                                    & 0.187                                        & 0.026   & 2.369       & 0.024     & 0.342     \\ \hline
p28\_tetra\_galloylglucose\_ester & 0.665                                    & 0.220                                        & 0.003   & 3.387       & 0.170     & 0.720     \\ \hline
\end{tabular}
\end{adjustbox}
\caption{T-test}
\label{Table:6.24}
\end{table}
%-------------------------------------------

第二個表相對較小:

%-------------------------------------------
\begin{table}[H]
\tiny
\begin{adjustbox}{width=1\textwidth}
\begin{tabular}{|l|l|}
\hline
\rowcolor[HTML]{ECF4FF} 
Material                          & p     \\ \hline
p6\_gallic\_acid                  & 0.003 \\ \hline
p11\_di\_galloylglucose\_ester    & 0.02  \\ \hline
p22\_tri\_galloylglucose\_ester   & 0.01  \\ \hline
p28\_tetra\_galloylglucose\_ester & 0.02  \\ \hline
\end{tabular}
\end{adjustbox}
\caption{Wilcoxon test}
\label{Table:6.25}
\end{table}
%-------------------------------------------

這就是他們的樣子。可以清楚地看到它們與螢幕正確契合,但是它們的字體大小不一樣。

在此輸入影像描述

有人可以幫我解決這個問題嗎?我想要一張表格,它們都適合螢幕,而且字體大小相同。

答案1

跟著我重複:做不是用於\adjustbox將表格插入文字區塊的寬度。

相反,我建議您 (a) 為第一個表中的標題行提供更多結構,並 (b) 使用環境tabular*將表的寬度設為\textwidth.對於第二個表,我建議您使用普通tabular環境。哦,通過省略所有垂直規則並採用較少但間隔良好的水平規則,使表格具有更開放的“外觀”,會很好。

在此輸入影像描述

\documentclass{article} % or some other suitable document class
\usepackage[a4paper,margin=2.5cm]{geometry} % set page parameters suitably
\usepackage[T1]{fontenc}
\usepackage{booktabs,array,siunitx}
\begin{document}

\begin{table}[ht]
\setlength\tabcolsep{0pt}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} l cc *{4}{S[table-format=1.3]} }
\toprule
Treatment
& \multicolumn{2}{c}{Mean in group Faunus} 
& {$p$-val} & {$t$-stat} & {CI 1} & {CI 2} \\ 
\cmidrule{2-3}
& Control & with Tannin \\
\midrule
p6\_gallic\_acid                  & 1.199 & 0.460 & 0.003 & 3.463 & 0.29  & 1.185 \\ 
p11\_di\_galloylglucose\_ester    & 1.037 & 0.419 & 0.006 & 3.127 & 0.204 & 1.032 \\ 
p22\_tri\_galloylglucose\_ester   & 0.370 & 0.187 & 0.026 & 2.369 & 0.024 & 0.342 \\ 
p28\_tetra\_galloylglucose\_ester & 0.665 & 0.220 & 0.003 & 3.387 & 0.170 & 0.720 \\ 
\bottomrule
\end{tabular*}
\caption{Student-$t$ test}
\label{Table:6.24}
\end{table}

\begin{table}[ht]
\centering
\begin{tabular}{@{} l S[table-format=1.3] @{}}
\toprule 
Material & {$p$-val} \\ 
\midrule
p6\_gallic\_acid                  & 0.003 \\ 
p11\_di\_galloylglucose\_ester    & 0.02  \\ 
p22\_tri\_galloylglucose\_ester   & 0.01  \\ 
p28\_tetra\_galloylglucose\_ester & 0.02  \\ 
\bottomrule
\end{tabular}
\caption{Wilcoxon test}
\label{Table:6.25}
\end{table}
\end{document}

相關內容