脚注标记悬挂在文本旁边(与表格左侧齐平)

脚注标记悬挂在文本旁边(与表格左侧齐平)

我正在使用threeparttable环境包在表格下方直接生成脚注tablenotes。我的常规脚注(使用KOMA-script)将脚注标记挂在页边距中。我希望表格注释的行为类似,如下所示:

  some table with bottom rule
  ___________________________
1 Tablenote...

另一个例子:

我的脚注如下所示,我希望表格注释也能如此

我在 Google 上搜索过,也尝试过修改一些定义,但都threeparttable.sty无济于事。

编辑:

请参阅下文的 MWE。

\documentclass[11pt,
twoside=false,
letterpaper,
hidelinks,
parskip=half+,
%onehalfspacing,  % see setstrecj after \begin{document}
bibliography=numbered,
numbers=noenddot,
]{scrartcl}
%
\usepackage[para]{threeparttable}
\usepackage{booktabs}
\usepackage{footnotebackref}
\usepackage{tablefootnote}
%
\renewcommand{\TPTnoteSettings}{
    \renewcommand{\baselinestretch}{0.8}
    \setlength\leftmargin{0.0em}%
    \setlength\labelwidth{0.0em}%
    \setlength\labelsep{0.0em}%
    %   \rightskip\tabcolsep \leftskip\tabcolsep
}%
% http://mirror.las.iastate.edu/tex-archive/macros/latex/contrib/threeparttable/threeparttable.sty
% Attempted this///
%\def\tnote#1{\protect\TPToverlap{\makebox[0em][r]{\textsuperscript{\TPTtagStyle{#1}}}}}% TRYING TO REDEFINE THE tnote SO THAT IT IS GLUED TO THE LEFT SIDE... BUT THE PROBLEM IS THAT IT CHANGES FOR BOTH, also the notes are still indented slightly
%
% SO MY IDEA IS TO CHANGE THE SURROUND THE \tnote INSTANCE WITH A MAKE BOX AS IT APPEARS IN THE tablenotes environment
%
%but I get lost here
%\def\tablenotes{\TPT@defaults 
%   \@ifnextchar[\TPT@setuptnotes\TPTdoTablenotes} % ]
%\let\endtablenotes\endlist
%\def\TPT@setuptnotes[#1]{% process formatting options
%   \@for\@tempa:=#1\do{\@nameuse{TPT@opt@\romannumeral-`a\@tempa}}%
%   \TPTdoTablenotes
%}
%%
%\def\TPTdoTablenotes{%
%   \par \prevdepth\z@ \TPT@hsize 
%   \list{}{\topsep\z@skip \partopsep\z@skip 
%       \itemsep\z@ \parsep\z@ \itemindent\z@
%       \TPTnoteSettings
%       \let\makelabel\TPTnoteLabel
%}}
%
% so I figured I'd try to change how it is done in para mode
% I cant seem to get it working here also
\def\TPT@opt@para{\let\TPTdoTablenotes\TPT@doparanotes}
\def\TPT@doparanotes{\par
    \prevdepth\z@ \TPT@hsize
    \TPTnoteSettings
    \parindent\z@ \pretolerance 8
    \linepenalty 200
    \renewcommand\item[1][]{\relax\ifhmode \begingroup
        \unskip
        \advance\hsize 10em % \hsize is scratch register, based on real hsize
        \penalty -45 \hskip\z@\@plus\hsize \penalty-19
        \hskip .15\hsize \penalty 9999 \hskip-.15\hsize
        \hskip .01\hsize\@plus-\hsize\@minus.01\hsize 
        \hskip 1em\@plus .3em
        \endgroup\fi
        \makebox[0em][r]{\tnote{##1}\,\ignorespaces}%
    \let\TPToverlap\relax
    \def\endtablenotes{\par}%
}
\begin{document}
%
\begin{table}[tbph]
    \begin{threeparttable}[t]
    \centering
    \begin{tabular}{lccc}
    \toprule
    Line 1\tnote{a}      & 630.0                           &                                 & 65.0 \\
    Line 2\tnote{b}                        & 251.0                           &                                 & 64.0 \\
    \midrule
    Total                           &                                 &                                 &  \\
    \bottomrule
    \end{tabular}%
    \begin{tablenotes}\footnotesize
        \item[]Some note without a number \\ Multiline\\
        \item[a]M Another \\ Multiline\\
        \item[b] A run on long long long line that extends past the table
        \item[1] One same; \item[2] line
    \end{tablenotes}
\end{threeparttable}
\end{table}%
%
\end{document}

答案1

{NiceTabular}在的最新版本(2020/07/15 的 5.0 版)中nicematrix,您有一个命令\tabularnote,注释以 列表类型在表格末尾编写enumitem。 提供的所有选项enumitem都可用于自定义该列表。

\documentclass[11pt]{scrartcl}

\usepackage{booktabs}
\usepackage{nicematrix}
\usepackage{enumitem}

\begin{document}

\NiceMatrixOptions 
  {
    notes = 
     {
       code-before = \footnotesize ,
       enumitem-keys = 
        {
          labelsep = 1 mm , 
          labelwidth = 2 cm ,
          leftmargin = 0 pt ,
          align = right ,
        }
     }
  }

\begin{table}[tbph]
    \centering
    \caption{My table}
    \begin{NiceTabular}{lccc}
    \toprule
    Line 1\tabularnote{A very very very very very very very very very very very very  long note} & 630.0 & & 65.0 \\
    Line 2\tabularnote{A long note but not as long as the previous one} & 251.0 & & 64.0 \\
    \midrule
    Total & & &  \\
    \bottomrule
    \end{NiceTabular}%
\end{table}%

\end{document}

上述代码的输出

相关内容