将宽表放入页面中,但不要太小

将宽表放入页面中,但不要太小

我的论文有一张宽表:

\begin{table}[h]
\centering
\begin{adjustbox}{width=1\textwidth}
\begin{tabular}{lcccccccccc}
\toprule
\multirow{2}[3]{*}{Condition} & \multicolumn{4}{c}{EMO RE} & \multicolumn{5}{c}{Pairwise Comparisons} \\
\cmidrule(lr){2-5} \cmidrule(lr){6-11}
 & Angry & Fearful & Happy & Neutral & Angry-Fearful & Angry-Happy & Angry-Neutral &Fearful-Happy & Fearful-Neutral & Happy-Neutral\\
\midrule
Congruent & 5 & 8 & 12 & 2 & 5 & 8 & 12 & 2 & 8 & 12  \\
Incongruent-Body Focus & 6 & 9 & 2 & 6 & 5 & 8 & 12 & 8 & 12 & 2  \\ 
Incongruent Voice Focus & 7 & 9 & 5 & 8 & 5 & 8 & 12 & 2 & 8 & 12  \\ 
\bottomrule
\end{tabular}
\end{adjustbox}
\end{table}

我使用调整框来适应页面,效果不错,但现在文本太小了,看起来一点也不好看。您有什么建议吗?

在此处输入图片描述

答案1

我建议您采用一种tabularx环境并允许在第 6 列至第 11 列中自动换行。您可能还应该允许在第 1 列中自动换行。

如果您可以缩短第 6 列至第 11 列的列标题,则可以实现简单的tabular环境。请参阅下面第二个表格以了解此想法的应用。

在此处输入图片描述

\documentclass{article} % or some other suitable document class
\usepackage{geometry}   % set page parameters suitably
\usepackage{booktabs,tabularx}
% define two new column types:
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcolumntype{M}{>{\raggedright\arraybackslash\hangafter=1\hangindent=1em}m{\mylen}}
\newlength\mylen
\begin{document}

% basic tabularx version
\begin{table}[h]
\renewcommand\tabularxcolumn[1]{m{#1}}
\setlength\tabcolsep{2pt} % default: 6pt
\settowidth\mylen{Incongruent-}
\addtolength\mylen{1.5ex}
\begin{tabularx}{\textwidth}{@{} M *{4}{c} *{6}{C} @{}}
\toprule
Condition & 
\multicolumn{4}{c}{EMO RE} & 
\multicolumn{6}{c@{}}{Pairwise Comparisons} \\
\cmidrule(lr){2-5} \cmidrule(l){6-11}
 & Angry & Fearful & Happy & Neutral & 
 Angry-Fearful & Angry-Happy     & Angry-Neutral &
 Fearful-Happy & Fearful-Neutral & Happy-Neutral\\
\midrule
Congruent               & 5 & 8 & 12 & 2 & 5 & 8 & 12 & 2 & 8 & 12  \\
Incongruent-Body Focus  & 6 & 9 & 2 & 6 & 5 & 8 & 12 & 8 & 12 & 2  \\ 
Incongruent-Voice Focus & 7 & 9 & 5 & 8 & 5 & 8 & 12 & 2 & 8 & 12  \\ 
\bottomrule
\end{tabularx}
\end{table}

% compact version
\begin{table}[h]
\centering
\setlength\tabcolsep{4pt} % default: 6pt
\settowidth\mylen{Incongruent-}
\addtolength\mylen{1.5ex}
\begin{tabular}{@{} M *{10}{c} @{}}
\toprule
Condition & 
\multicolumn{4}{c}{EMO RE} & 
\multicolumn{6}{c@{}}{Pairwise Comparisons} \\
\cmidrule(lr){2-5} \cmidrule(l){6-11}
& Angry & Fearful & Happy & Neutral & A-F & A-H & A-N & F-H & F-N & H-N \\
\midrule
Congruent               & 5 & 8 & 12 & 2 & 5 & 8 & 12 & 2 & 8 & 12  \\
Incongruent-Body Focus  & 6 & 9 & 2 & 6 & 5 & 8 & 12 & 8 & 12 & 2  \\ 
Incongruent-Voice Focus & 7 & 9 & 5 & 8 & 5 & 8 & 12 & 2 & 8 & 12  \\ 
\midrule[\heavyrulewidth]
\multicolumn{11}{@{}l}{Abbreviations: A-F: Angry-Fearful, A-H: Angry-Happy, etc.}
\end{tabular}
\end{table}

\end{document}

答案2

切勿缩放表格。这会导致表格中使用的字体大小不一致。

由于您没有提供任何有关文档布局的信息,我们只能猜测。因此,下面的 MWE(最小工作示例)只能提供一个想法,告诉您如何解决您的问题:

  • 在表格中使用较小的字体大小
  • 减少列之间的间隔
  • 用两行写列标题

在 MWE 中使用了带有列的包tblr环境。使用它们,表代码更短更简单,数字也更整齐:tabularraySsiunitx

\documentclass{article}
\usepackage[margin=25mm]{geometry}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}

\begin{document}
    \begin{table}[ht]
    \small
\begin{tblr}{colsep=3pt,
             colspec = {@{} l *{10}{X[c,m, si={table-format=2.0}]} @{}},
             row{1,2} = {guard}
            }
    \toprule
\SetCell[r=2]{m}    Condition
    &  \SetCell[c=4]{c} EMO RE
        &   &   &   &  \SetCell[c=6]{c}    Pairwise Comparisons
                        &   &   &   &   &                       \\
    \cmidrule[r]{2-5} 
    \cmidrule[r]{6-11}
    & Angry 
        & Fearful 
            &   Happy 
                & Neutral 
                    & Angry-Fearful 
                        & Angry-Happy 
                            & Angry-Neutral
                                & Fearful-Happy
                                    & Fearful-Neutral
                                        & Happy-Neutral     \\
    \midrule
Congruent 
    & 5 & 8 & 12& 2 & 5 & 8 & 12& 2 & 8 & 12                \\
Incongruent-Body Focus 
    & 6 & 9 & 2 & 6 & 5 & 8 & 12& 8 & 12 & 2                \\
Incongruent Voice Focus 
    & 7 & 9 & 5 & 8 & 5 & 8 & 12& 2 & 8 & 12                \\
    \bottomrule
    \end{tblr}
\end{table}
\end{document}

在此处输入图片描述

红线显示页面的文本块边框。

附录:
在@Mico 答案(+1)中复制表格样式,使用rblrtableČ

\documentclass{article}
\usepackage{geometry}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx} 
\usepackage{caption}
\newlength\mylen            % for second example

\begin{document}
    \begin{table}[htb]
    \settowidth\mylen{Incongruent-}
\begin{tblr}{colsep=2pt,
             colspec = {@{}   Q[l, m, wd=\mylen, cmd={\hangafter=1\hangindent=1ex}]
                        *{10}{X[c, m, si={table-format=2.0}]}
                        @{}},
             row{1,2} = {guard}
            }
    \toprule
Condition
    &  \SetCell[c=4]{c} EMO RE
        &   &   &   &  \SetCell[c=6]{c}    Pairwise Comparisons
                        &   &   &   &   &                       \\
    \cmidrule[r]{2-5}
    \cmidrule[r]{6-11}
    & Angry
        & Fearful
            &   Happy
                & Neutral
                    & Angry-Fearful
                        & Angry-Happy
                            & Angry-Neutral
                                & Fearful-Happy
                                    & Fearful-Neutral
                                        & Happy-Neutral     \\
    \midrule
Congruent
    & 5 & 8 & 12& 2 & 5 & 8 & 12& 2 & 8 & 12                \\
Incongruent-Body Focus
    & 6 & 9 & 2 & 6 & 5 & 8 & 12& 8 & 12 & 2                \\
Incongruent Voice Focus
    & 7 & 9 & 5 & 8 & 5 & 8 & 12& 2 & 8 & 12                \\
    \bottomrule
    \end{tblr}
\end{table}

\end{document}

在此处输入图片描述

相关内容