3

In a threeparttable the \tnote superscript goes out of the table border when @{} is used:

\documentclass{book}
\usepackage{booktabs}
\usepackage[flushleft]{threeparttable}
\begin{document}
\begin{threeparttable}
  \begin{tabular}{@{}ll@{}}
    \toprule
    First column header & Second column header\tnote{a}\\
    \midrule
    a & b \\
    c & d \\
    \bottomrule
    \end{tabular}
    \begin{tablenotes}
        \item[a] A note.
    \end{tablenotes}
\end{threeparttable}
\end{document}

enter image description here

How to avoid it?

CarLaTeX
  • 62,716
  • 3
    Depends on if you want to avoid it always. \let\TPTrlap\relax – Ulrike Fischer Mar 02 '17 at 18:07
  • The note mark is typeset in a zero width box. You avoid the issue either by not using @{} or by using the trick suggested by Ulrike. – egreg Mar 02 '17 at 18:19
  • @UlrikeFischer Are there any side effects using your solution? May it damage other things? – CarLaTeX Mar 02 '17 at 18:47
  • 2
    Well it will "damage" the default behaviour of \tnote to stick in the space behind a column. But if you don't want this behaviour redefining it is ok. You can keep the change local by doing only before the \tnote. – Ulrike Fischer Mar 02 '17 at 19:17
  • Why do you want @{}? Don't you think it looks bad? – cfr Mar 02 '17 at 23:24
  • @cfr I have some tables with @{} because otherwise they don't fit the page, I'd like to do all the table looks the same. I don't find it bad... – CarLaTeX Mar 03 '17 at 07:10

1 Answers1

1

Since Ulrike's solution increase the width of only one column of the table, which seems out of proportion afterwards, I tried another solution with \phantoms:

\documentclass{book}
\usepackage{booktabs}
\usepackage[flushleft]{threeparttable}
\usepackage{float}
\usepackage{caption}
\usepackage[margin=10pt,labelfont=bf,labelsep=period,format=hang,
indention=0cm]{caption}
\captionsetup[table]{position=above, aboveskip=2pt}

\begin{document}
\begin{table} 
    \centering
    \caption{Original table}
    \begin{threeparttable}
        \begin{tabular}{@{}ll@{}}
            \toprule
            First column header & Second column header\tnote{a}\\
            \midrule
            a & b \\
            c & d \\
            \bottomrule
        \end{tabular}
        \begin{tablenotes}
            \item[a] A note.
        \end{tablenotes}
    \end{threeparttable}
\end{table}
\begin{table}
    \centering
    \caption{Table with Ulrike's command}
    \begin{threeparttable}
        \let\TPTrlap\relax
        \begin{tabular}{@{}ll@{}}
            \toprule
            First column header & Second column header\tnote{a}\\
            \midrule
            a & b \\
            c & d \\
            \bottomrule
        \end{tabular}
        \begin{tablenotes}
            \item[a] A note.
        \end{tablenotes}
    \end{threeparttable}
\end{table}
\begin{table}
    \centering
    \caption{Table with one \textbackslash\texttt{panthom}}
    \begin{threeparttable}
        \begin{tabular}{@{}ll@{}}
            \toprule
            First column header & Second column header\tnote{a}\phantom{\textsuperscript{a}}\\
            \midrule
            a & b \\
            c & d \\
            \bottomrule
        \end{tabular}
        \begin{tablenotes}
            \item[a] This looks the same as Ulrike's table.
        \end{tablenotes}
    \end{threeparttable}
\end{table}
\begin{table}
    \centering
    \caption{Table with two \textbackslash\texttt{panthom}s}
    \begin{threeparttable}
        \begin{tabular}{@{}ll@{}}
            \toprule
            First column header\phantom{\textsuperscript{a}} & Second column header\tnote{a}\phantom{\textsuperscript{a}}\\
            \midrule
            a & b \\
            c & d \\
            \bottomrule
        \end{tabular}
        \begin{tablenotes}
            \item[a] This is the solution I prefer.
        \end{tablenotes}
    \end{threeparttable}
\end{table}
\begin{table}
    \centering
    \caption{Table without @\{\}}
    \begin{threeparttable}
        \begin{tabular}{ll}
            \toprule
            First column header & Second column header\tnote{a}\\
            \midrule
            a & b \\
            c & d \\
            \bottomrule
        \end{tabular}
        \begin{tablenotes}
            \item[a] This is the solution egreg and cfr prefer.
        \end{tablenotes}
    \end{threeparttable}
\end{table}
\end{document}

enter image description here

CarLaTeX
  • 62,716