The para
setting in threeparttable
uses an interesting collection of penalties and glue but I think you just want to change the length indicated (the default is 1em
I changed it to 6em
here) Unrelated but I also changed [h]
to [htp]
as using h
on its own is asking the float to go to the end of the document.
\documentclass[12pt]{memoir}
\usepackage[para,online,flushleft]{threeparttable}
\makeatletter
\def\TPT@doparanotes{\par
\prevdepth\z@ \TPT@hsize
\TPTnoteSettings
\parindent\z@ \pretolerance 8
\linepenalty 200
\renewcommand\item[1][]{\relax\ifhmode \begingroup
\unskip
\advance\hsize 10em % \hsize is scratch register, based on real hsize
\penalty -45 \hskip\z@\@plus\hsize \penalty-19
\hskip .15\hsize \penalty 9999 \hskip-.15\hsize
\hskip .01\hsize\@plus-\hsize\@minus.01\hsize
\hskip 6em\@plus .3em
%%%%%
\endgroup\fi
\tnote{##1}\,\ignorespaces}%
\let\TPToverlap\relax
\def\endtablenotes{\par}%
}
\makeatother
\begin{document}
\par
Lets test the threeparttable package.
\begin{table}[htp]
\caption{Some very informative caption}
\begin{center}
\begin{threeparttable}
\begin{tabular}{c c c c}
\toprule
\textbf{1st Column} & \textbf{2nd Colimn} & \textbf{3rd Colimn} & \textbf{4th Colimn} \\ \midrule
QWERTY\tnote{1} & & & \\
ASDFGH\tnote{2} & & & \\ \bottomrule
\end{tabular}
\begin{tablenotes}
\item[1] qwerty; \item[2] asdfgh
\end{tablenotes}
\end{threeparttable}
\end{center}
\label{table:simDisimCoefNewDef}
\end{table}
\end{document}
I still am having issues with the \centerline
command; this isn't the best centering command to use, I'd recommend the \begin{center}
environment or {\centering ... }
instead.
So the real answer to your question is to use
\renewcommand{\TPTminimum}{\linewidth}
to redefine the minimum amount of space that is used by the caption and the notes in the threeparttable environment. Doing so like this gives a result that, strictly, is what you asked for:
\documentclass[12pt]{article}
\usepackage{threeparttable}
\usepackage{booktabs}
\begin{document}
\begin{table}[h]
\begin{threeparttable}
\renewcommand{\TPTminimum}{\linewidth}
\caption{The is ment to be a very long table caption, which is wider than the table itself.}
\label{table:meanerrorbaseline}
{\centering
\begin{tabular}{cc}
\toprule
Endowment & Mean error \\
\midrule
0 & 1.67 \\
1 & 1.49* \\
2 & 1.42** \\
3 & 1.30*** \\
4 & 1.15*** \\
5 & 1.15*** \\
6 & 1.09*** \\
7 & 1.02*** \\
8 & 0.92*** \\
9 & 0.85*** \\
10 & 0.76** \\
\bottomrule
\end{tabular}
}
\begin{tablenotes}
\small
\item The note is ment to be wider than the table itself, without having to make the table wider and making it look ugly.
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}
...it looks like this:
Your next logical question would be, "How do I center the table within the caption?" The only recommended solution I could find to this was in Why isn't my table centering with threeparttable?. The answers there either omitted the caption at the top of the table or did not deal with the wide table issue (omitting the \renewcommand{\TPTminimum}{...}
). Using the \makebox...
solution, we come close to what is desired, but only if the caption is left off, or moved to the bottom:
\documentclass[]{article}
\usepackage{threeparttable}
\usepackage{booktabs}
\begin{document}
\begin{table}[h]
\begin{threeparttable}
\renewcommand{\TPTminimum}{\linewidth}
%\caption{The is ment to be a very long table caption, which is wider than the table itself.}
%\label{table:meanerrorbaseline}
\makebox[\linewidth]{%
\begin{tabular}{cc}
\toprule
Endowment & Mean error \\
\midrule
0 & 1.67 \\
1 & 1.49* \\
2 & 1.42** \\
3 & 1.30*** \\
4 & 1.15*** \\
5 & 1.15*** \\
6 & 1.09*** \\
7 & 1.02*** \\
8 & 0.92*** \\
9 & 0.85*** \\
10 & 0.76** \\
\bottomrule
\end{tabular}}
\begin{tablenotes}
\small
\item The note is meant to be wider than the table itself, without having to make the table wider and making it look ugly.
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}
Without the caption, this appears as:
So how do we get both? The solution I came up with uses extra columns on the sides of the table that pad the table, centering it within the caption. It is a bit of a hack, but it solves the problem in a way that other more elegant solutions cannot.
The code:
\documentclass[]{article}
\usepackage{threeparttable}
\usepackage{booktabs}
\begin{document}
\begin{table}[h]
\begin{threeparttable}
%\renewcommand{\TPTminimum}{\linewidth}
\caption{The is ment to be a very long table caption, which is wider than the table itself.}
\label{table:meanerrorbaseline}
\begin{tabular}{cccc}
\cmidrule[\heavyrulewidth]{2-3} % \toprule
~\rule{1in}{0in} & Endowment & Mean error & \rule{1in}{0in}~ \\
\cmidrule[\lightrulewidth]{2-3} % \midrule
& 0 & 1.67 & \\
& 1 & 1.49* & \\
& 2 & 1.42** & \\
& 3 & 1.30*** & \\
& 4 & 1.15*** & \\
& 5 & 1.15*** & \\
& 6 & 1.09*** & \\
& 7 & 1.02*** & \\
& 8 & 0.92*** & \\
& 9 & 0.85*** & \\
& 10 & 0.76** & \\
\cmidrule[\heavyrulewidth]{2-3} % \bottomrule
\end{tabular}
\begin{tablenotes}
\small
\item The note is meant to be wider than the table itself, without having to make the table wider and making it look ugly.
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}
This appears as:
Best Answer
\item[<marker>]
without the optional marker argument uses an empty marker as default. The marker is put into\tnote
, more or less a wrapper for\textsuperscript
(an empty superscript in math mode). Then\item
appends the space\labelsep
.In short we have:
$^{}$\kern\labelsep
The first adds space
\scriptspace
(see "The TeXbook", "Appendix G. Generating Boxes from formulas", rule 18c). The amount is 0.5 pt.\labelsep
is0.2em
or about 2 pt. Thus the overall space is about 2.5 pt.The space can therefore be removed by:
The following example also adds some vertical space between the notes, by patching
\TPTdoTablenotes
: