压缩表格大小以及其中的文本和数字

压缩表格大小以及其中的文本和数字

在此处输入图片描述我有一张桌子

\begin{table}[H]
    \centering
    \caption{$M=0$, $\N_=0$}
    \begin{threeparttable}
        \begin{tabular}{llllllllllll}\toprule
            \multicolumn{6}{c}{\textbf{$ a=0.9 $}} &    \multicolumn{6}{c}{\textbf{\textbf{$a=0.01 $ }}}\\
            $r $ & $ R $ &   $ I$ &     
            $ r $ & $ R $ &   $I$ & $r_h $ & $R $ &   $ \I$ &  $ r $ & $ R $  &  $ I $    
            \\\midrule
            1 & 4.117 & -2.276 & 5 & 9.945 & -13.193 & 1 & 3.342 & -2.499  & 5 & 9.654 & -13.287
            \\\addlinespace
            10 & 18.856 & -26.574 & 25 & 46.295 & -66.445 & 10  & 18.875 & -26.579 & 25 & 46.336 & -66.595 
            \\\addlinespace
            50 & 95.815 & -137.889 & 100 & 154.583 & -222.62 & 50 & 92.533 & -133.197  & 100 & 184.99 & -266.399
            \\\addlinespace
            125 & 220.856 & -318.064 & 200 & 207.097 & -298.274  & 125 & 231.107 & -332.831 & 200 & 368.982 & -531.431
            \\\addlinespace
            225 & 208.599 & -300.428 & 300 & 200.393 & -288.622  & 225 & 415.178 & -597.960  & 300 & 555.026 & -799.399
            \\\bottomrule
        \end{tabular}
        \begin{tablenotes}
            \item
        \end{tablenotes}
    \end{threeparttable}
    \begin{threeparttable}
        \begin{tabular}{llllllllllll}\toprule
            \multicolumn{6}{c}{\textbf{$ a=0.1 $}} &    \multicolumn{6}{c}{\textbf{\textbf{$a=0.2 $ }}}\\
            $r_h $ & $R $ &   $ I$ &     
            
            $ r $ & $ R $ &   $ I $ & $r $ & $R $ &   $ I$ &  $ r $ &  $R $ &   $ I $    
            \\\midrule
            1  & 3.448 & -2.578  & 5  & 9.846 & -13.354 &  1 & 4.304 & -2.479   & 5   & 10.059 & -13.428
            \\\addlinespace
            10  & 18.911 & -26.692   & 25  & 46.538 & -66.661  & 10  & 19.132 & -26.766  & 25  & 46.762 & -66.735
            \\\addlinespace
            50  & 92.734 & -133.262  & 100 & 185.186 & -266.456  & 50  & 92.959 & -133.335  & 100 & 185.411 & -266.530
            \\\addlinespace
            125 & 231.418 & -333.0535  & 200 & 370.119 & -532.844  & 125 & 231.643 & -333.127  & 200 & 370.344 & -532.917 
            \\\addlinespace
            225 & 416.353  & -599.439 & 300 & 555.059 & -799.231 &  225 & 416.578 & -599.513& 300 & 555.283 & -799.302
            \\\bottomrule
        \end{tabular}
        \begin{tablenotes}
            \item
        \end{tablenotes}
    \end{threeparttable}
\label{table:1}
\end{table}

像这样。我想压缩它的尺寸以适合列的一侧。两个表重叠了。那么我该怎么做呢?请帮助我。

答案1

您有两个选择:要么减少所有值的小数位数以减小表格宽度,要么旋转表格环境。对于前者,我siunitx仅应用了 3 个有效数字,标记后至少有一位小数.。如果您需要有效数字,您可以应用sidewaystable,而不是常规table旋转 who 环境;sidewaystable在包中定义rotating。另一个选项是在(或)landscape中定义的环境。lscapepdflscape

确保两个表格之间至少保留一个空白区域以强制换行,这样表格就可以相互叠放在一起。

这是使用的示例siunitx

\documentclass{article}
% \usepackage{geometry}   % Alters default layout
\usepackage{array}
% \usepackage{pdflscape}  % For the landscape environment
% \usepackage{rotating}   % For sidewaystable environment
\usepackage{threeparttable}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{caption}

\captionsetup[table]{position=top, skip=6pt}
\sisetup{
    round-mode = places,
    round-precision = 1,
    minimum-decimal-digits = 1,
}
\newcommand\N{N}
\newcommand\I{I}


\begin{document}
\begin{table}[tbh]
    \setlength\tabcolsep{4pt}
    \centering
    \caption{$M=0$, $\N=0$}\label{table:1}
    \begin{threeparttable}
        \begin{tabular}{@{}
                *4{r S[table-format=3.1] S[table-format=-3.1]}
            @{}}
            \toprule
            \multicolumn{6}{c}{\textbf{$a = 0.9$}} & \multicolumn{6}{c}{\textbf{\textbf{$a = 0.01$}}} \\\addlinespace
            \cmidrule(r){1-3} \cmidrule(lr){4-6} \cmidrule(lr){7-9} \cmidrule(l){10-12}
            $r$ & $R$ & $I$ & $r$ & $R$ & $I$ & $r_h$ & $R$ &   $\I$ &  $r$ & $R$  & $I$ \\
            \midrule
              1 &   4.117 &   -2.276 &   5 &   9.945 &  -13.193 &   1 &   3.342 &   -2.499 &   5 &   9.654 &  -13.287 \\ \addlinespace
             10 &  18.856 &  -26.574 &  25 &  46.295 &  -66.445 &  10 &  18.875 &  -26.579 &  25 &  46.336 &  -66.595 \\ \addlinespace
             50 &  95.815 & -137.889 & 100 & 154.583 & -222.62  &  50 &  92.533 & -133.197 & 100 & 184.99  & -266.399 \\ \addlinespace
            125 & 220.856 & -318.064 & 200 & 207.097 & -298.274 & 125 & 231.107 & -332.831 & 200 & 368.982 & -531.431 \\ \addlinespace
            225 & 208.599 & -300.428 & 300 & 200.393 & -288.622 & 225 & 415.178 & -597.960 & 300 & 555.026 & -799.399 \\
            \bottomrule
        \end{tabular}
        \begin{tablenotes}
            \item
        \end{tablenotes}
    \end{threeparttable}
    
    \begin{threeparttable}
        \begin{tabular}{@{}
                *4{r S[table-format=3.1] S[table-format=-3.1]}
            @{}}
            \toprule
            \multicolumn{6}{c}{\textbf{$ a=0.1 $}} &    \multicolumn{6}{c}{\textbf{\textbf{$a=0.2 $ }}}\\ \addlinespace
            \cmidrule(r){1-3} \cmidrule(lr){4-6} \cmidrule(lr){7-9} \cmidrule(l){10-12}
            $r$ & $R$ & $I$ & $r$ & $R$ & $I$ & $r_h$ & $R$ &   $\I$ &  $r$ & $R$  & $I$ \\
            \midrule
            1  & 3.448 & -2.578  & 5  & 9.846 & -13.354 &  1 & 4.304 & -2.479   & 5   & 10.059 & -13.428
            \\\addlinespace
            10  & 18.911 & -26.692   & 25  & 46.538 & -66.661  & 10  & 19.132 & -26.766  & 25  & 46.762 & -66.735
            \\\addlinespace
            50  & 92.734 & -133.262  & 100 & 185.186 & -266.456  & 50  & 92.959 & -133.335  & 100 & 185.411 & -266.530
            \\\addlinespace
            125 & 231.418 & -333.0535  & 200 & 370.119 & -532.844  & 125 & 231.643 & -333.127  & 200 & 370.344 & -532.917 
            \\\addlinespace
            225 & 416.353  & -599.439 & 300 & 555.059 & -799.231 &  225 & 416.578 & -599.513& 300 & 555.283 & -799.302
            \\\bottomrule
        \end{tabular}
        \begin{tablenotes}
            \item
        \end{tablenotes}
    \end{threeparttable}
\end{table}
\end{document}

在此处输入图片描述


编辑。

建议表格中的表格无法容纳一列。为此,您需要将它们分成两半并应用进一步的格式。由于标题会重复,因此可以将其移至顶部。我通常不赞成使用垂直线,但我觉得在这种情况下一行可能会有所帮助。

我意识到r先水平排序,然后垂直排序。在这种情况下,分隔条可能不太合适;这必须由您决定。

以下是第二个示例的代码:

\documentclass[twocolumn]{revtex4-2}
\usepackage{array}
\usepackage{threeparttable}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{hyperref}
\usepackage{kantlipsum}

\sisetup{
    round-mode = figures,
    round-precision = 4,
    minimum-decimal-digits = 1,
}
\newcommand\N{N}
\newcommand\I{I}
\newcommand\srone{\specialrule{\lightrulewidth}{\aboverulesep}{2pt}}
\newcommand\srtwo{\specialrule{\heavyrulewidth}{2pt}{\belowrulesep}}

\begin{document}
\title{The Title}
\date{\today}
\begin{abstract}
\kant[2][1-3]
\end{abstract}
\maketitle

\section{The section}
\kant[1]

\begin{table}[tbh]
    \setlength\tabcolsep{3pt}
    \footnotesize
    \renewcommand{\arraystretch}{1.25}
    \centering
    \caption{$M=0$, $\N=0$}\label{table:1}
    \begin{threeparttable}
        \begin{tabular}{@{}
                r S[table-format=-3.3] S[table-format=-3.3]
                @{\hspace{12pt}} !{\vrule width 0.2pt} @{\hspace{12pt}}
                r S[table-format=-3.3] S[table-format=-3.3]
            @{}}
            \toprule
            \multicolumn{1}{c}{$r$} & $R$ & \multicolumn{1}{c}{$I$} &
            \multicolumn{1}{c}{$r$} & $R$ & $I$ \\
            \midrule[\heavyrulewidth]
            \multicolumn{6}{c}{\textbf{$a = 0.9$}} \\
            \srone
              1 &   4.117 &   -2.276 &   5 &   9.945 &  -13.193 \\
             10 &  18.856 &  -26.574 &  25 &  46.295 &  -66.445 \\
             50 &  95.815 & -137.889 & 100 & 154.583 & -222.62  \\
            125 & 220.856 & -318.064 & 200 & 207.097 & -298.274 \\
            225 & 208.599 & -300.428 & 300 & 200.393 & -288.622 \\
            \srtwo
            \multicolumn{6}{c}{\textbf{\textbf{$a=0.2 $ }}}\\
            \srone
              1 &   4.304 & -2.479   &   5 &  10.059 &  -13.428 \\ 
             10 &  19.132 & -26.766  &  25 &  46.762 &  -66.735 \\ 
             50 &  92.959 & -133.335 & 100 & 185.411 & -266.530 \\ 
            125 & 231.643 & -333.127 & 200 & 370.344 & -532.917 \\ 
            225 & 416.578 & -599.513 & 300 & 555.283 & -799.302 \\
            \srtwo
            \multicolumn{6}{c}{\textbf{$ a=0.1 $}} \\
            \srone
              1 &   3.448 & -2.578    &   5 &   9.846 &  -13.354 \\
             10 &  18.911 & -26.692   &  25 &  46.538 &  -66.661 \\
             50 &  92.734 & -133.262  & 100 & 185.186 & -266.456 \\
            125 & 231.418 & -333.0535 & 200 & 370.119 & -532.844 \\
            225 & 416.353 & -599.439  & 300 & 555.059 & -799.231 \\
            \srtwo
            \multicolumn{6}{c}{\textbf{\textbf{$a = 0.01$}}} \\
            \srone
              1 &   3.342 &   -2.499 &   5 &   9.654 &  -13.287 \\
             10 &  18.875 &  -26.579 &  25 &  46.336 &  -66.595 \\ 
             50 &  92.533 & -133.197 & 100 & 184.99  & -266.399 \\ 
            125 & 231.107 & -332.831 & 200 & 368.982 & -531.431 \\ 
            225 & 415.178 & -597.960 & 300 & 555.026 & -799.399 \\ 
            \bottomrule
        \end{tabular}
        \begin{tablenotes}
            \item[$\dag$] Annotation
        \end{tablenotes}
    \end{threeparttable}
\end{table}

\kant[2-8]

\end{document}

在此处输入图片描述

相关内容