threeparttable: Wie ändere ich die Schriftgröße der Tabellennotizen von threeparttable, wenn ich auch „flushleft“ verwende?

threeparttable: Wie ändere ich die Schriftgröße der Tabellennotizen von threeparttable, wenn ich auch „flushleft“ verwende?

Ich möchte die Schriftgröße ändern tnotesbasierend threeparttablesaufdieser Ansatz des Benutzers egreg.

Minimales Arbeitsbeispiel (MWE) des funktionalen Ansatzes:

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

\appto\TPTnoteSettings{\footnotesize}% <-- decreases font size of tnote

\begin{document}
    \begin{table}
        \begin{threeparttable}[b]
            \caption{A caption}
            \begin{tabular}{llll}
                \toprule
                Test\tnote{1} & some & text & to have room\\
                \bottomrule
            \end{tabular}
            \begin{tablenotes}
                \item [1] the first tnote
            \end{tablenotes}
        \end{threeparttable}
    \end{table}
\end{document}

Diese Lösung funktioniert einwandfrei, solange ich NICHT flushleftdie Präambelkonfiguration von threeparttablehinzufüge. Sobald ich diese zusätzliche Konfiguration hinzufüge, funktioniert die obige Lösung nicht mehr.


Minimales Arbeitsbeispiel (MWE) des nicht-funktionalen Ansatzes:

\documentclass{article}
\usepackage{booktabs}
\usepackage[flushleft]{threeparttable}% <-- added `para` and `flushleft`
\usepackage{etoolbox}

\appto\TPTnoteSettings{\footnotesize}% <-- decreases font size of tnote

\begin{document}
    \begin{table}
        \begin{threeparttable}[b]
            \caption{A caption}
            \begin{tabular}{llll}
                \toprule
                Test\tnote{1} & some & text & to have room\\
                \bottomrule
            \end{tabular}
            \begin{tablenotes}
                \item [1] the first tnote
            \end{tablenotes}
        \end{threeparttable}
    \end{table}
\end{document}

Irgendwelche Ideen, wie man das lösen kann?

Antwort1

Sie können \footnotesizezu einem anderen Makro hinzufügen:

\documentclass{article}
\usepackage{booktabs}
\usepackage[flushleft]{threeparttable}
\usepackage{etoolbox}

\appto\TPTdoTablenotes{\footnotesize}

\begin{document}

\begin{table}

\begin{threeparttable}[b]
  \caption{A caption}

  \begin{tabular}{llll}
  \toprule
  Test\tnote{1} & some & text & to have room\\
  \bottomrule
  \end{tabular}
  \begin{tablenotes}
  \item [1] the first tnote long enough to see at least a line break
  \end{tablenotes}
\end{threeparttable}

\end{table}

\end{document}

Bildbeschreibung hier eingeben

Antwort2

Ihr Formatierungsziel kann stabil erreicht werden, indem Sie

\usepackage{etoolbox}
\AtBeginEnvironment{tablenotes}{\footnotesize}

in der Präambel.

Ein vollständiges MWE – beachten Sie, dass es sowohl \smallskipals auch \footnotesizebeim Start jeder tablenotesUmgebung ausgeführt wird:

Bildbeschreibung hier eingeben

\documentclass{article}
\usepackage{booktabs}
\usepackage[flushleft,para]{threeparttable}

\usepackage{etoolbox}
\AtBeginEnvironment{tablenotes}{\smallskip\footnotesize}

\begin{document}
    \begin{table}
    \centering
    \begin{threeparttable}
        \caption{A caption}
        \begin{tabular}{llll}
        \toprule
        Test\tnote{1} & some & text & to have room\\
        \bottomrule
        \end{tabular}
        \begin{tablenotes}
        \item[1] The first tnote
        \end{tablenotes}
    \end{threeparttable}
    \end{table}
\end{document}

verwandte Informationen