2

I am using the threeparttable environment to create tables in my document. I want that tablenotes should appear right after the caption of the table and before the actual table; instead, it appears on the bottom of the table. How I can do this?

A minimal working example is given below:

\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}
  • Have you tried inserting the tablenotes environment before the tabular environment? – Mico Nov 10 '16 at 11:49
  • 1
    yes but in this case table note is moved before the caption and I want it between Table caption and the actual table. – Ahmed Arif Nov 10 '16 at 12:15
1

I suggest to move "Note" to the table caption:

\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}

enter image description here

  • For a simple note like this that works well (+1). I'm not so sure it would work for the sort of tablenotes I've used, which are along the lines of a) from Ref. 1\\b) from Ref.2 (Ref. 3 gives the range 1-2)... But in my case putting it on top of the table would be strange. – Chris H Nov 10 '16 at 13:30
  • I tried but it did not work. Following error appears. File ended while scanning use of \caption@ydblarg – Ahmed Arif Nov 10 '16 at 13:45
  • @AhmedArif, it works with your MWE. If your final document has different document class and preambe, than you should inform us about them. – Zarko Nov 10 '16 at 13:58
  • @ChrisH, in my answer the tablenotesare not used. If OP would instead \multicolumn{3}{c}{*p<0.1; **p<0.05; ***p<0.01} use tablenotes correctly, than the notes*p<0.1, **p<0.05 and ` ***p<0.0` is possible to manage to be referable. Please ask separate question, if you have problem with this issues. – Zarko Nov 10 '16 at 14:04
  • @Zarko mine worked fine a couple of years ago. I was just pointing out that your answer was a substitute table note for tablenotes in the OP's case but not in all cases. The refs were just an example of such a case. – Chris H Nov 10 '16 at 14:10
0

I would just add it to the table itself:

....
\begin{tabular}{lrr}
\multicolumn{3}{p{6cm}}{Note: These are estimated of multinomial logit model.}\\
\toprule
...
  • But in case table note is a bit longer, it creates problems. – Ahmed Arif Nov 10 '16 at 11:16
0

You could define a swapthreeparttable environment as follows, but probably you should simply add the note to the caption.

Note that you still need to enter the text of the notes after the table.

\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}

enter image description here

Here's the version I'd prefer (actually I wouldn't use threeparttable at all).

\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}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.