threeparttable:当使用 flushleft 时,如何更改 threeparttable 表格注释的字体大小?

threeparttable:当使用 flushleft 时,如何更改 threeparttable 表格注释的字体大小?

我想根据修改tnotes的字体大小threeparttables这种用户聚集的方法

功能方法的最小工作示例(MWE):

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

只要我不添加到flushleft的前导码配置中,此解决方案就可以正常threeparttable工作。一旦我添加此附加配置,上面的解决方案就不再起作用。


非功能性方法的最小工作示例(MWE):

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

关于如何解决这个问题有什么想法吗?

答案1

您可以添加\footnotesize到另一个宏:

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

在此处输入图片描述

答案2

您可以通过运行

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

在序言中。

完整的 MWE——请注意,它在每个环境开始时都运行\smallskip和:\footnotesizetablenotes

在此处输入图片描述

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

相关内容