在三部分表中对齐表格注释

在三部分表中对齐表格注释

我正在使用该threeparttable环境制作表格。表格注释总是缩进的。如何让注释与表格齐平?

\documentclass[a4paper,12pt]{article}

\usepackage[flushleft]{threeparttable}

\begin{document}

\begin{table}[ht] \centering
\begin{threeparttable}
\caption{Title For My Table}
\begin{tabular}{l*{3}{c}}
\hline\hline
&\multicolumn{1}{c}{Outcome 1}&\multicolumn{1}{c}{Outcome 2 }&\multicolumn{1}{c}{Outcome 3 }\\

\hline
Independent Variable 1              &      0.0316         &     0.00186         &  0.0001   \\
                    &    (0.0284)         &    (0.0256)         &    (0.0221)          \\
[1em]
Independent Variable 1                &      0.0226 ***&     -0.0154 *  &     -0.0125          \\
                    &   (0.00833)         &   (0.00887)         &    (0.0107)             \\
[1em]
Independent Variable 1                &      0.0180         &    -0.00997         &     -0.0245                \\
                    &    (0.0122)         &   (0.00972)         &    (0.0255)                \\
[1em]
Independent Variable 1               &      0.0270 *  &     -0.0180 *  &     -0.0222                \\
                    &    (0.0141)         &   (0.00915)         &    (0.0153)                 \\
\hline
Observations        &         585         &         585         &         448                 \\
\hline\hline

\end{tabular}



    \begin{tablenotes}
      \tiny
      \item I'm writing the notes down here and I want them to be alligned with the table. However, there is a small indent. 

    \end{tablenotes}
\end{threeparttable}
\end{table}


\end{document}

答案1

环境中项目的语法tablenotes\item[<some marker>} ...。如果您不打算使用标记,即,如果您要编写\item ...,则应添加指令

\setlength\labelsep{0pt}

在环境开始时tablenotes

一个单独的问题:由于表中的数字看起来如果它们在小数点标记上对齐可能更容易解析,因此您可能需要使用诸如dcolumn及其d列类型之类的包来使表更具可读性。

在此处输入图片描述

\documentclass[a4paper,12pt]{article}
\usepackage[flushleft]{threeparttable}
\usepackage{dcolumn}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\begin{document}

\begin{table}[ht] \centering
\begin{threeparttable}
\caption{Title For My Table}

\begin{tabular}{ l d{2.7} d{2.6} d{2.5} }
\hline\hline
&\multicolumn{1}{c}{Outcome 1}
&\multicolumn{1}{c}{Outcome 2}
&\multicolumn{1}{c}{Outcome 3}\\
\hline
Independent Variable 1 & 0.0316 & 0.00186 & 0.0001 \\
& (0.0284) & (0.0256) & (0.0221) \\[1em]
Independent Variable 2 & 0.0226^{***} & -0.0154^{*} & -0.0125 \\
& (0.00833) & (0.00887) & (0.0107) \\[1em]
Independent Variable 3 & 0.0180 & -0.00997 & -0.0245 \\
& (0.0122) & (0.00972) & (0.0255) \\[1em]
Independent Variable 4 & 0.0270^{*} & -0.0180^{*} & -0.0222 \\
& (0.0141) & (0.00915) & (0.0153) \\
\hline
Observations 
& \multicolumn{1}{c}{585} 
& \multicolumn{1}{c}{585} 
& \multicolumn{1}{c}{448} \\
\hline\hline
\end{tabular}

\begin{tablenotes}
\setlength\labelsep{0pt}
\footnotesize
\item I'm writing the notes down here and I want them to be aligned with the table. Now, there's no longer small indent.
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document} 

答案2

对于稍后看到这一点的人来说,简单的[flushleft]操作对我来说就足够了,而 Mico 的建议\setlength\labelsep{0pt}在我的应用程序中却没有任何作用。

...
\begin{tablenotes}[flushleft]
    \item Your note text here.
\end{tablenotes}
...

答案3

与@Mico 答案中的结果相同,您也可以通过在 中添加选项来获得 ,而无需将其设置\labelsep为零,即写入然后从中省略标签:para\begin{tablenotes}\begin{tablenotes}[para]item

\documentclass[a4paper,12pt]{article}
\usepackage[flushleft]{threeparttable} % <---
\usepackage{dcolumn}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\begin{document}

\begin{table}[ht] \centering
\begin{threeparttable}
\caption{Title For My Table}

\begin{tabular}{ l d{2.7} d{2.6} d{2.5} }
\hline\hline
&\multicolumn{1}{c}{Outcome 1}
&\multicolumn{1}{c}{Outcome 2}
&\multicolumn{1}{c}{Outcome 3}\\
\hline
Independent Variable 1  
    & 0.0316        & 0.00186       & 0.0001    \\
    & (0.0284)      & (0.0256)      & (0.0221)  \\[1ex]
Independent Variable 2  
    & 0.0226^{***}  & -0.0154^{*}   & -0.0125   \\
    & (0.00833)     & (0.00887)     & (0.0107)  \\[1ex]
Independent Variable 3 
    & 0.0180        & -0.00997      & -0.0245   \\
    & (0.0122)      & (0.00972)     & (0.0255)  \\[1ex]
Independent Variable 4 
    & 0.0270^{*}    & -0.0180^{*}   & -0.0222   \\
    & (0.0141)      & (0.00915)     & (0.0153)  \\
\hline
Observations
& \multicolumn{1}{c}{585}
& \multicolumn{1}{c}{585}
& \multicolumn{1}{c}{448} \\
\hline\hline
\end{tabular}

\begin{tablenotes}[para]    % <---
\footnotesize
I'm writing the notes down here and I want them to be aligned with the table. Now, there's no longer small indent. It is eliminated by adding option `para` to `tablenotes`.
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document} 

在此处输入图片描述

注意:选项para可以添加到以下选项中threeparttable

\usepackage[flushleft, para]{threeparttable}

但在这种情况下,所有三个部分表注释都处于段落模式。

相关内容