将小页面脚注的宽度与其所在的表格环境相匹配

将小页面脚注的宽度与其所在的表格环境相匹配

我已经将表格注释放在了\minipage环境内部\table。我想传递\minipage一个宽度参数,以便它能够匹配其所\table在的任意宽度。

梅威瑟:

\documentclass[12pt]{article}
\usepackage{booktabs}
\begin{document}
    \begin{table}
        \centering
        \begin{tabular}{l*{4}{c}}
            \toprule
            & (1) & (2) & (3) & (4) \\
            \midrule
            Outcome & 0.057 & 0.066 & 0.054 & 0.051 \\
            & (0.025) & (0.032) & (0.041) & (0.028) \\
            \bottomrule
        \end{tabular}
        \begin{minipage}{\linewidth}
%       \begin{minipage}{\textwidth} -- what should go in this width argument?
            \footnotesize \textit{This is my footnote explaining the table. I would like to substitute something in for minipage's width argument such that this minipage footnote will have the same width as the table in whose environment it sits. }
        \end{minipage}
    \end{table}
Here's some text just to show how wide a paragraph is for comparison. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
\end{document}

截屏:

脚注过宽的表格截图

我已经尝试过linewidth\textwidth,结果相同。如果有更好的设置来实现我的目标,并且不涉及minipage,我很高兴听到这个消息——但如果可能的话,它应该与兼容tabular

我的表格是由 Stata 的esttab命令生成的——我认为这不会影响答案,但我提到它是为了帮助那些搜索相同问题的 Stata 用户。

答案1

在该包的帮助下threeparttable

在此处输入图片描述

\documentclass[12pt]{article}
\usepackage{booktabs}
\usepackage{threeparttable}
\begin{document}
    \begin{table}
        \centering
        \begin{threeparttable}
            \begin{tabular}{l*{4}{c}}
                \toprule
                  & (1) & (2) & (3) & (4) \\
                \midrule
                Outcome & 0.057 & 0.066 & 0.054 & 0.051 \\
                & (0.025) & (0.032) & (0.041) & (0.028) \\
                \bottomrule
            \end{tabular}
            \begin{tablenotes}[flushleft]
                \setlength\labelsep{0pt}
                \footnotesize 
                \itshape
                \item This is my footnote explaining the table. I would like to substitute something in for minipage's width argument such that this minipage footnote will have the same width as the table in whose environment it sits. 
            \end{tablenotes}
        \end{threeparttable}
    \end{table}
Here's some text just to show how wide a paragraph is for comparison. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
\end{document}

\end{document}

相关内容