With threeparttable
and the regular tabular
environment I was able to achieve the formatting of a custom note (flush left, spanning the entire width of the table, no label, while keeping the table footnotes indented) by adding it outside of the tablenotes
environment (but within the threeparttable
environment, see code below and table 1 in the screenshot).
Now I am trying to replicate this formatting with the combination threeparttablex
+ longtable
but I am struggling to achieve the same effect. The only viable option so far seems to be adding it below insertTableNotes
. But then the custom note would be treated as a normal row that increases the table width instead of being wrapped:
Does anyone have a solution for replicating the formatting from table 1 without manually specifying the table width?
Note: The reasons why I am not using the \note
command or the flushleft
option from threeparttablex
are that 1) I would like to be able to pass a note without label and 2) flushleft
doesn't perfectly left-align the text.
\documentclass{article}
\usepackage[referable]{threeparttablex}
\usepackage{longtable}
\usepackage{booktabs}
\begin{document}
\begin{center}
\begin{threeparttable}
\caption{tabular}
\begin{tabular}{l c c c c c }
\toprule
type & cyl & disp & hp & drat & mpg\\
\midrule
Ferrari & 6 & 160 & 110 & 3.9 & 3.2\\
VW & 6 & 160 & 110 & 3.9 & 3.7 \\
Chevrolet & 4\tnote{a} & 108 & 93 & 3.85 & 3.5\\
Tesla & 6 & 258 & 110 & 3.08 \\
Ford & 8 & 360 & 175\tnote{b} & 3.15 & 32.6 \\
\bottomrule
\end{tabular}\footnotesize
\begin{tablenotes}\footnotesize
\item [a] A note that might as well span multiple rows despite being a footnote.
\item [b] Another short note.
\end{tablenotes}
Here is some other stuff outside the tablenotes environment that might span multiple lines.
\end{threeparttable}
\end{center}
\begin{ThreePartTable}
\begin{TableNotes}\footnotesize
\item [a] A note that might as well span multiple rows despite being a footnote.
\item [b] Another short note.
\end{TableNotes}
\begin{longtable}{l c c c c c }
\caption{longtable}\\
\toprule
type & cyl & disp & hp & drat & mpg\\
\midrule
Ferrari & 6 & 160 & 110 & 3.9 & 3.2\\
VW & 6 & 160 & 110 & 3.9 & 3.7 \\
Chevrolet & 4\tnote{a} & 108 & 93 & 3.85 & 3.5\\
Tesla & 6 & 258 & 110 & 3.08 \\
Ford & 8 & 360 & 175\tnote{b} & 3.15 & 32.6 \\
\bottomrule
\insertTableNotes\\
\footnotesize
Here is some other stuff... but it will be treated as a normal row and not be confined to the table width.
\end{longtable}
\end{ThreePartTable}
\end{document}
Best Answer
Here is a solution using the
tabularray
package.Note: I used the default
TblrNote
command to insert usual table notes. To add the custom note I changed theremark
template and inserted that as a new theme.