安排宽度 tabularx{} 并注意

安排宽度 tabularx{} 并注意

下面的代码打印出一个页面宽度表。如果我尝试自定义1\textwidth它,它看起来甚至更糟。希望你能帮忙,提前谢谢。

在此处输入图片描述

\documentclass[11pt,authoryear,sort&compress]{report}
\usepackage{booktabs,tabulary,array,tabularx}
\usepackage{siunitx}
\usepackage{threeparttable}
\usepackage{geometry}
\usepackage{booktabs}

\begin{document}
    
\begin{table}[!ht]
    \centering
    \tiny % \footnotesize
    \begin{tabularx}{1\textwidth}{lc} % {0.75\textwidth}{l*{1}{C}} 
        \toprule
        &Estimate\\ 
        \midrule
        %Politicized recruitment & 0.030*(0.013) \\
        %(Intercept) & 3.445***(0.095) \\
        Politicized recruitment & 0.030* \\
        &(0.013) \\
        (Intercept) & 3.445***\\
        &(0.095) \\
        \midrule
        R-squared (adj.) & 0.098\\
        N & 3872 \\
        \bottomrule 
        \addlinespace
        \multicolumn{2}{@{}p{\textwidth}@{}}{\tiny Result from fixed effect regression with bootstrapped standard errors based on 2000 replications. Significance tests assume normal sampling distribution. Conditional R2 is calculated from all data. ‡ p < 0.100, * p < 0.050, ** p < 0.010, *** p < 0.001} \\
    \end{tabularx}
    %\caption{} 
    %\label{}
\end{table} 
\end{document}

答案1

正如之前的评论所指出的(可能有些含蓄),这里没有必要使用环境tabularx。也没有必要去\tiny

相反,将数据列中的数字与小数点对齐似乎是一个好主意,这可以借助包S提供的列类型来实现siunitx——您的代码恰好会加载该包。而且,既然您加载了包threeparttable,您不妨使用它来将图例的宽度限制为环境的宽度tabular

在此处输入图片描述

\documentclass[11pt]{report}
\usepackage{booktabs,siunitx,threeparttable,ragged2e}
\begin{document}

\begin{table}[!ht]
\sisetup{%
  input-symbols         = (),
  table-format          = 1.3,
  table-space-text-post = $^{***}$,
  table-space-text-pre  = ( }
    \centering
    \begin{threeparttable}
    %\caption{...} 
    %\label{...}
    \begin{tabular}{@{} w{l}{6cm} S @{}}  
        \toprule
        &{Estimate}\\ 
        \midrule
        Politicized recruitment & 0.030$^{*}$ \\
        &(0.013) \\
        Intercept & 3.445$^{***}$\\
        &(0.095) \\
        \midrule
        $R^2$ (adj.) & {0.098}\\
        $N$ & {3872} \\
        \bottomrule 
    \end{tabular}
        
    \footnotesize
    \RaggedRight 
    Result from fixed effect regression with bootstrapped standard 
    errors based on 2000 replications. Significance tests assume 
    normal sampling distribution. Conditional $R^2$ is calculated 
    from all data.

    \smallskip
    ‡ $p < 0.100$, * $p < 0.050$, ** $p < 0.010$, \mbox{*** $p < 0.001$}
    \end{threeparttable}
\end{table} 
\end{document}

相关内容