threeparttable: ¿Cómo cambiar el tamaño de fuente de las notas de la tabla de threeparttable cuando también se usa flushleft?

threeparttable: ¿Cómo cambiar el tamaño de fuente de las notas de la tabla de threeparttable cuando también se usa flushleft?

Quiero modificar el tamaño de fuente de tnotesen threeparttablesfunción deeste enfoque de usuario egreg.

Ejemplo mínimo de trabajo (MWE) de enfoque funcional:

\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}

Esta solución funciona completamente bien siempre y cuando NO la agregue flushlefta la configuración del preámbulo de threeparttable. Tan pronto como agrego esta configuración adicional, la solución superior ya no funciona.


Ejemplo mínimo de trabajo (MWE) de enfoque no funcional:

\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}

¿Alguna idea sobre cómo solucionar esto?

Respuesta1

Puedes agregar \footnotesizea otra macro:

\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}

ingrese la descripción de la imagen aquí

Respuesta2

Su objetivo de formato se puede lograr de manera sólida ejecutando

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

en el preámbulo.

Un MWE completo: tenga en cuenta que se ejecuta tanto \smallskipcomo \footnotesizeal inicio de cada tablenotesentorno:

ingrese la descripción de la imagen aquí

\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}

información relacionada