使用adjustbox调整表格大小但不改变字体

使用adjustbox调整表格大小但不改变字体

我有以下表格,我已使用adjustbox重新调整。但是,字体大小现在太小了。如何解决这个问题?

\begin{table}[htbp]
  \centering
  \caption{Add caption}
  \begin{adjustbox}{width=\textwidth}
    \begin{tabular}{rrrrr}
    \toprule
    \toprule
          &       &       &       &  \\
\cmidrule{2-5}          & \multicolumn{1}{l}{Professional, Managerial, Technical} & \multicolumn{1}{l}{Clerical, Sales} & \multicolumn{1}{l}{Production, Operators} & \multicolumn{1}{l}{Service} \\
\cmidrule{2-5}    \multicolumn{1}{l}{\textit{Non-routine cognitive}} &       &       &       &  \\
    \multicolumn{1}{l}{O*NET non-routine cognitive analytic} & \multicolumn{1}{c}{1.19} & \multicolumn{1}{c}{-0.30} & \multicolumn{1}{c}{-0.38} & \multicolumn{1}{c}{-0.93} \\
          & \multicolumn{1}{c}{(0.43)} & \multicolumn{1}{c}{(0.69)} & \multicolumn{1}{c}{(0.67)} & \multicolumn{1}{c}{(0.98)} \\
    \multicolumn{1}{l}{O*NET non-routine cognitive interpersonal} & \multicolumn{1}{c}{1.03} & \multicolumn{1}{c}{-0.34} & \multicolumn{1}{c}{-0.38} & \multicolumn{1}{c}{-0.42} \\
          & \multicolumn{1}{c}{(0.87)} & \multicolumn{1}{c}{(0.65)} & \multicolumn{1}{c}{(0.82)} & \multicolumn{1}{c}{(0.75)} \\
    \multicolumn{1}{l}{\textit{Routine cognitive and manual }} &       &       &       &  \\
    \multicolumn{1}{l}{O*NET routine cognitive} & \multicolumn{1}{c}{-0.23} & \multicolumn{1}{c}{0.45} & \multicolumn{1}{c}{0.19} & \multicolumn{1}{c}{-0.52} \\
          & \multicolumn{1}{c}{(0.81)} & \multicolumn{1}{c}{(1.09)} & \multicolumn{1}{c}{(0.69)} & \multicolumn{1}{c}{(0.91)} \\
    \multicolumn{1}{l}{O*NET routine manual} & \multicolumn{1}{c}{-0.86} & \multicolumn{1}{c}{-0.48} & \multicolumn{1}{c}{0.98} & \multicolumn{1}{c}{0.05} \\
          & \multicolumn{1}{c}{(0.57)} & \multicolumn{1}{c}{(0.64)} & \multicolumn{1}{c}{(0.66)} & \multicolumn{1}{c}{(0.69)} \\
    \multicolumn{1}{l}{\textit{Non-routine manual }} &       &       &       &  \\
    \multicolumn{1}{l}{O*NET non-routine manual} & \multicolumn{1}{c}{-0.81} & \multicolumn{1}{c}{-0.59} & \multicolumn{1}{c}{0.95} & \multicolumn{1}{c}{0.14} \\
          & \multicolumn{1}{c}{(0.55)} & \multicolumn{1}{c}{(0.51)} & \multicolumn{1}{c}{(0.76)} & \multicolumn{1}{c}{(0.47)} \\
          &       &       &       &  \\
    \bottomrule
    \end{tabular}%
    \end{adjustbox}
  \label{tab:addlabel}%
\end{table}%

答案1

  • 您的表格似乎是由一些表格生成器生成的,因此它充满了混乱multicolumn{1}{...}{...},在下面的 MWE 中将它们全部删除
  • 对于数字,使用包S中定义的列类型siunitx
  • 列标题中的文本被分成更多行
  • 列之间距离的确定留给宏\extracolsep{\fill}
\documentclass{article}
\usepackage{geometry}    added
\usepackage{siunitx}    % consider v3
\usepackage{booktabs, makecell}

\begin{document}
    \begin{table}[htbp]
    \centering
\caption{Add caption}
\label{tab:addlabel}
\sisetup{
    table-align-text-before=false, 
    input-open-uncertainty =,
    input-close-uncertainty=,
    table-format={(}-1.2{)}
         }
\setlength\tabcolsep{0pt}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}} l *{4}{S} }
    \toprule
    & {\makecell[b]{Professional,\\ Managerial,\\ Technical}}
        & {\makecell[b]{Clerical,\\ Sales}}
            & {\makecell[b]{Production,\\ Operators}}
                & {Service} \\
    \midrule  
\textit{Non-routine cognitive} 
    &   &   &   &  \\
O*NET non-routine cognitive analytic
    & 1.19      & -0.30     & -0.38     & -0.93     \\
    & (0.43)    & (0.69)    & (0.67)    & (0.98)    \\
    \addlinespace
O*NET non-routine cognitive interpersonal
    & 1.03      & -0.34     & -0.38     & -0.42     \\
    & (0.87)    & (0.65)    & (0.82)    & (0.75)    \\
\textit{Routine cognitive and manual}
    &           &           &           &           \\
O*NET routine cognitive
    & -0.23     & 0.45      & 0.19      & -0.52     \\
    & (0.81)    & (1.09)    & (0.69)    & (0.91)    \\
    \addlinespace
O*NET routine manual
    & -0.86     & -0.48     & 0.98      & 0.05      \\
    & (0.57)    & (0.64)    & (0.66)    & (0.69)    \\
\textit{Non-routine manual}
    &           &           &           &           \\
O*NET non-routine manual
    & -0.81     & -0.59     & 0.95      & 0.14      \\
    & (0.55)    & (0.51)    & (0.76)    & (0.47)    \\
    \bottomrule
\end{tabular*}
    \end{table}
\end{document}

在此处输入图片描述

(红线表示文本区域边框)

答案2

首先,去掉包装纸adjustbox以及所有 84 个 [!]\multicolumn包装纸。这些包装纸每一个都是坏的。双-\toprule也相当值得怀疑。然后,使用tabularx环境并允许在四个数据列中自动换行。哦,将数字与小数点对齐会很好。

在此处输入图片描述

\documentclass{article}
\usepackage[margin=3cm]{geometry}  % choose page parameters suitably
\usepackage[T1]{fontenc}
\usepackage{booktabs,tabularx,dcolumn}
\newcolumntype{C}{>{\centering}X}
\newcolumntype{d}[1]{D..{#1}}
\newcommand\mC[1]{\multicolumn{1}{C}{#1}}
\usepackage[skip=0.3333\baselineskip]{caption} % optional
\begin{document}

\begin{table}[htbp]

\caption{Add caption}
\label{tab:3}

\begin{tabularx}{\textwidth}{@{} l *{4}{d{2.2}} @{}}
\toprule
  & 
  \mC{Professional, Managerial, Technical} & 
  \mC{Clerical, Sales} & 
  \mC{Production, Operators} & 
  \multicolumn{1}{c@{}}{Service} \\
\cmidrule(l){2-5}    
\textit{Non-routine cognitive}  \\
O*NET non-routine cognitive analytic 
     & 1.19 & -0.30 & -0.38 & -0.93 \\
     & (0.43) & (0.69) & (0.67) & (0.98) \\
O*NET non-routine cognitive interpersonal 
     & 1.03 & -0.34 & -0.38 & -0.42 \\
     & (0.87) & (0.65) & (0.82) & (0.75) \\
\addlinespace
\textit{Routine cognitive and manual}\\
O*NET routine cognitive & -0.23 & 0.45 & 0.19 & -0.52 \\
          & (0.81) & (1.09) & (0.69) & (0.91) \\
O*NET routine manual & -0.86 & -0.48 & 0.98 & 0.05 \\
          & (0.57) & (0.64) & (0.66) & (0.69) \\
\addlinespace
\textit{Non-routine manual } \\
O*NET non-routine manual & -0.81 & -0.59 & 0.95 & 0.14 \\
          & (0.55) & (0.51) & (0.76) & (0.47) \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}

答案3

这有帮助吗

在此处输入图片描述

    \begin{table}[htbp]
  \centering
  \caption{Add caption}
  % \begin{adjustbox}{width=\textwidth}
    \begin{tabular}{rrrrr}
    \toprule
    \toprule
          &       &       &       &  \\          
          & \makecell{Professional, \\Managerial, \\Technical} 
            & \makecell{Clerical, \\Sales\\ \phantom{Technical}} 
                & \makecell{Production, \\Operators\\ \phantom{Technical}} 
                    & \makecell{Service\\ \phantom{Technical}\\ \phantom{Technical}} \\ \cmidrule{2-5}
    \multicolumn{1}{l}{\textit{Non-routine cognitive}} &       &       &       &  \\
    \multicolumn{1}{l}{O*NET non-routine cognitive analytic} & \multicolumn{1}{c}{1.19} & \multicolumn{1}{c}{-0.30} & \multicolumn{1}{c}{-0.38} & \multicolumn{1}{c}{-0.93} \\
          & \multicolumn{1}{c}{(0.43)} & \multicolumn{1}{c}{(0.69)} & \multicolumn{1}{c}{(0.67)} & \multicolumn{1}{c}{(0.98)} \\
    \multicolumn{1}{l}{O*NET non-routine cognitive interpersonal} & \multicolumn{1}{c}{1.03} & \multicolumn{1}{c}{-0.34} & \multicolumn{1}{c}{-0.38} & \multicolumn{1}{c}{-0.42} \\
          & \multicolumn{1}{c}{(0.87)} & \multicolumn{1}{c}{(0.65)} & \multicolumn{1}{c}{(0.82)} & \multicolumn{1}{c}{(0.75)} \\
    \multicolumn{1}{l}{\textit{Routine cognitive and manual }} &       &       &       &  \\
    \multicolumn{1}{l}{O*NET routine cognitive} & \multicolumn{1}{c}{-0.23} & \multicolumn{1}{c}{0.45} & \multicolumn{1}{c}{0.19} & \multicolumn{1}{c}{-0.52} \\
          & \multicolumn{1}{c}{(0.81)} & \multicolumn{1}{c}{(1.09)} & \multicolumn{1}{c}{(0.69)} & \multicolumn{1}{c}{(0.91)} \\
    \multicolumn{1}{l}{O*NET routine manual} & \multicolumn{1}{c}{-0.86} & \multicolumn{1}{c}{-0.48} & \multicolumn{1}{c}{0.98} & \multicolumn{1}{c}{0.05} \\
          & \multicolumn{1}{c}{(0.57)} & \multicolumn{1}{c}{(0.64)} & \multicolumn{1}{c}{(0.66)} & \multicolumn{1}{c}{(0.69)} \\
    \multicolumn{1}{l}{\textit{Non-routine manual }} &       &       &       &  \\
    \multicolumn{1}{l}{O*NET non-routine manual} & \multicolumn{1}{c}{-0.81} & \multicolumn{1}{c}{-0.59} & \multicolumn{1}{c}{0.95} & \multicolumn{1}{c}{0.14} \\
          & \multicolumn{1}{c}{(0.55)} & \multicolumn{1}{c}{(0.51)} & \multicolumn{1}{c}{(0.76)} & \multicolumn{1}{c}{(0.47)} \\
          &       &       &       &  \\
    \bottomrule
    \end{tabular}%
    % \end{adjustbox}
  \label{tab:addlabel}%
\end{table}

相关内容