將小頁腳註的寬度與其所在的表格環境相符

將小頁腳註的寬度與其所在的表格環境相符

我已將表格註釋放置在一個\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}

相關內容