三部分表 - 顶部的表注释

三部分表 - 顶部的表注释

我正在使用threeparttable环境在文档中创建表格。我希望它tablenotes出现在表格标题之后和实际表格之前;相反,它出现在表格底部。我该怎么做?

下面给出了一个最小的工作示例:

\documentclass[12pt, a4paper, twoside]{article}
\usepackage{titlesec}
\usepackage[T1]{fontenc}
\usepackage{float}
\usepackage{tabulary}
\usepackage[para]{threeparttable}
\usepackage{array,booktabs,longtable,tabularx}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}% <-- added
\usepackage{caption}% <-- added
\setlength{\LTcapwidth}{7in}
\usepackage{ltablex}% <-- added
\usepackage{siunitx}% <-- added
\usepackage[flushleft]{threeparttablex}

\begin{document}

\begin{table}[h!]
        \begin{threeparttable}[b]
        \footnotesize
        \centering
        \caption{Multinomial Model}
            \begin{tabular}{lrr}
    \toprule
    & \multicolumn{1}{c}{ABS} & \multicolumn{1}{c}{CB} \\
    \midrule
    (Intercept) & 5.482 & 3.4871 \\
    ABC & 1.1173 & 1.1933 \\
    DEF & 8.1752* & 2.6836 \\
    \bottomrule
            \multicolumn{3}{c}{*p<0.1; **p<0.05; ***p<0.01} \\
            \bottomrule
            \end{tabular}%
            \label{tab:mlogit}%
            \begin{tablenotes}
    \footnotesize
    Note: These are estimates of multinomial logit model. 
\end{tablenotes}
\end{threeparttable}
\end{table}%
\end{document}

答案1

我建议将“注释”移至表格标题:

\documentclass[12pt, a4paper, twoside]{article}
\usepackage[para]{threeparttable}
\usepackage{booktabs,longtable,tabularx}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{caption}
\setlength{\LTcapwidth}{7in}
\usepackage{ltablex}
\usepackage{siunitx}
\usepackage[flushleft]{threeparttablex}

\begin{document}

\begin{table}[h!]
        \begin{threeparttable}[b]
        \footnotesize
        \centering
\caption[Multinomial Model]% <-- appear in LoT if exist
        {Multinomial Model\vspace{1ex}
        \footnotesize
        Note: These are estimates of multinomial logit model.
                            }
        \begin{tabular}{lrr}
    \toprule
& \multicolumn{1}{c}{ABS} & \multicolumn{1}{c}{CB} \\
    \midrule
(Intercept) & 5.482 & 3.4871 \\
ABC & 1.1173 & 1.1933 \\
DEF & 8.1752* & 2.6836 \\
    \midrule[1pt]
\multicolumn{3}{c}{*p<0.1; **p<0.05; ***p<0.01} \\
    \bottomrule
        \end{tabular}%
        \label{tab:mlogit}%
\end{threeparttable}
\end{table}%
\end{document}

在此处输入图片描述

答案2

我只需将其添加到表格中即可:

....
\begin{tabular}{lrr}
\multicolumn{3}{p{6cm}}{Note: These are estimated of multinomial logit model.}\\
\toprule
...

答案3

您可以按如下方式定义swapthreeparttable环境,但可能您应该简单地将注释添加到标题中。

注意,表格后面仍然需要输入注释文字。

\documentclass[12pt, a4paper, twoside]{article}
\usepackage[para]{threeparttable}
\usepackage{booktabs}

\usepackage{caption}

\usepackage{etoolbox}
\newbox\globalTPTbox
\makeatletter
\newenvironment{swapthreeparttable}
 {\patchcmd{\TPT@measurement}
    {\par\box\@tempboxb}
    {\global\setbox\globalTPTbox=\copy\@tempboxb}
    {}{}%
  \threeparttable}
 {\par\medskip\box\globalTPTbox\endthreeparttable}
\makeatother

\begin{document}

\begin{table}[h!]
\centering

\begin{swapthreeparttable}
\caption{Multinomial Model}
\label{tab:mlogit}

\begin{tabular}{lrr}
  \toprule
  & \multicolumn{1}{c}{ABS} & \multicolumn{1}{c}{CB} \\
  \midrule
  (Intercept) & 5.482          & 3.4871 \\
  ABC         & 1.1173         & 1.1933 \\
  DEF         & 8.1752\rlap{*} & 2.6836 \\
  \midrule[\heavyrulewidth]
  \multicolumn{3}{c}{\footnotesize *$\,p<0.1$; **$\,p<0.05$; ***$\,p<0.01$} \\
  \bottomrule
\end{tabular}

\begin{tablenotes}
\footnotesize
Note: These are estimates of multinomial logit model. 
\end{tablenotes}

\end{swapthreeparttable}
\end{table}

\end{document}

在此处输入图片描述

这是我喜欢的版本(实际上我threeparttable根本不会使用)。

\documentclass[12pt, a4paper, twoside]{article}
\usepackage[para]{threeparttable}
\usepackage{booktabs}

\usepackage{caption}

\begin{document}

\begin{table}[h!]
\centering

\begin{threeparttable}
\caption[Multinomial Model]{Multinomial Model. Note: These are estimates of multinomial logit model.}
\label{tab:mlogit}

\begin{tabular}{lrr}
  \toprule
  & \multicolumn{1}{c}{ABS} & \multicolumn{1}{c}{CB} \\
  \midrule
  (Intercept) & 5.482          & 3.4871 \\
  ABC         & 1.1173         & 1.1933 \\
  DEF         & 8.1752\rlap{*} & 2.6836 \\
  \midrule[\heavyrulewidth]
  \multicolumn{3}{c}{\footnotesize *$\,p<0.1$; **$\,p<0.05$; ***$\,p<0.01$} \\
  \bottomrule
\end{tabular}

\end{threeparttable}
\end{table}

\end{document}

在此处输入图片描述

相关内容