2

I wonder how to restore width of the caption in threeparttable environment to regular table environment. It is important that caption is inside threeparttable environment. In other words I want to increase caption width (Figure 1).

enter image description here

The minimal working example goes as follows:

\documentclass{article}
\usepackage{threeparttable,booktabs}

\begin{document}

\begin{table}
\centering
\begin{threeparttable}
\caption{This is example table with width equal to default width in table environment}
\begin{tabular}{cccc}
\toprule
Col 1& Col 2 & Col 3 & Col 4 \\
\midrule
1 &  2 &  3 &  4 \\
5 &  6 &  7 &  8 \\
9 & 10 & 11 & 12 \\
\bottomrule
\end{tabular}
\begin{tablenotes}[flushleft]\footnotesize
\item[1] Long, long, long, long, long, long, note
\end{tablenotes}
\end{threeparttable}
\end{table}

\end{document}

When I insert \renewcommand\TPTminimum{\linewidth} before \caption{...} the width extends, but the table in left aligned (Figure 2 below).

Figure2

Any suggestion or pointer is greatly appreciated.

5
  • 1
    Why is it important that the caption is inside threeparttable?
    – egreg
    Nov 5, 2017 at 12:03
  • @egreg Because I need to put footnote also in the caption.
    – Andrej
    Nov 5, 2017 at 12:18
  • The environment basically typesets a \vbox where the \hsize is the maximum between the table width and \TPTminimum.
    – egreg
    Nov 5, 2017 at 12:27
  • You can move the caption outside threeparttable, but still inside table. Nov 5, 2017 at 12:49
  • @MichaelPalmer Now I use \caption{This is example table with width equal \ldots\tnote{a}} outside the threeparttable. However, the notes are printed below the table but the footnote mark in caption is omitted.
    – Andrej
    Nov 5, 2017 at 12:54

1 Answer 1

3

The macro \tnote is defined in such a way that it will not function outside the threeparttable environment. This is mostly to prevent it from showing up in the \listoftables.

\documentclass{article}
\usepackage{threeparttable,booktabs}

\begin{document}

\listoftables

\begin{table}
\let\TPToverlap=\TPTrlap
\centering
\caption{This is example table with width equal to default width in table 
  environment\tnote{1}}
\begin{threeparttable}
\begin{tabular}{cccc}
\toprule
Col 1& Col 2 & Col 3 & Col 4 \\
\midrule
1 &  2 &  3 &  4 \\
5 &  6 &  7 &  8 \\
9 & 10 & 11 & 12 \\
\bottomrule
\end{tabular}
\begin{tablenotes}[flushleft]\footnotesize
\item[1] Long, long, long, long, long, long, note
\end{tablenotes}
\end{threeparttable}
\end{table}

\end{document}

demo 1


If you also want the notes wider, you can put the tabular inside another tabular.

\documentclass{article}
\usepackage{threeparttable,booktabs}

\newlength{\mymargin}

\begin{document}

\begin{table}
\begin{threeparttable}
\caption{This is example table with width equal to default width in table 
  environment\tnote{1}}
\begin{tabular}{@{}p{\textwidth}@{}}
\centering
\begin{tabular}{cccc}
\toprule
Col 1& Col 2 & Col 3 & Col 4 \\
\midrule
1 &  2 &  3 &  4 \\
5 &  6 &  7 &  8 \\
9 & 10 & 11 & 12 \\
\bottomrule
\end{tabular}
\end{tabular}
\begin{tablenotes}[flushleft]\footnotesize
\item[1] Long, long, long, long, long, long, note
\end{tablenotes}
\end{threeparttable}
\end{table}

\end{document}

demo 2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .