I am trying to get threeparttable
to work with the tufte-book
class. Naturally, when I use the follwing the caption will be placed in the margin. In this case, cleveref
has no problems in getting the reference right (i.e. it correctly prints the "Table"):
\documentclass{tufte-book}
\usepackage{threeparttable}
\usepackage{cleveref}
\begin{document}
\begin{table}
\centering
\begin{threeparttable}
\caption{Table caption}
\begin{tabular}{cc}
Some & tabular \\
Contents & \ldots
\end{tabular}
\end{threeparttable}
\label{tab:foo}
\end{table}
See \cref{tab:foo}.
\end{document}
Now I want to put the caption above the table, similar to the requirement in this question.
Since it looks like redefining caption is not feasible, I tried to roll my own caption by defining (as a starting point):
\newcommand{\mycaption}[1]{\refstepcounter{table}Table~\thetable:~#1}
Using \mycaption{Table}
instead of \caption{Table caption}
in the above example yields:
This puts the caption in the right place, but some features are missing:
- Centering the caption above the table if it is shorter than one line.
- Getting the references right with
\cref
. (This could not be resolved even after rerunning the document several times.) - Adding the table to the list of tables.
- Possibility of providing a short form of the caption for the list of tables as asecond argument.
Is there any way to either a) use the existing \caption
functionality and simply change the position to above the tabular
or b) extend my \mycaption
command to behave just like \caption
in the standard classes, i.e. meet requirements 1-4?