使用 tabulararray 将备注和注释放在一个单独的、右边不齐的段落中

使用 tabulararray 将备注和注释放在一个单独的、右边不齐的段落中

\raggedright使用 时,如何才能在单个段落中实现备注和注释tabularray?我所寻找的是threeparttable与使用paraflushleft包选项时获得的行为大致相同的行为(参见下面的示例)。

\documentclass{article}
\usepackage{tabularx}
\usepackage[para, flushleft]{threeparttable}
\begin{document}
  \begin{table}
    \begin{threeparttable}
      \caption{A \texttt{threeparttable} table}
      \begin{tabularx}{\linewidth}{@{}Xcc@{}}
        \hline
        & A & B \\
        \hline
        A row heading\tnote{a} & a & 123 \\
        Another row heading & b & 456 \\
        Yet another row heading & c & 789 \\
        \hline
      \end{tabularx}
      \begin{tablenotes}
        \emph{Note}: A few words describing something noteworthy.
        \item[a] A table footnote that goes on for a few words more than this.
      \end{tablenotes}
    \end{threeparttable}
  \end{table}
\end{document}

带有 para 和 flushleft 包选项的 threeparttable

我最好的解决办法是编辑“内联注释”模板的定义并删除\par末尾的(见下面的示例)。但这会在第一个注释前添加一个水平空格并拉伸单词间距。

\documentclass{article}
\usepackage{tabularray}
\DefTblrTemplate{remark}{inline-noclosingpar}{%Identical to the remark inline template except for the commented line
  \UseTblrAlign{remark}
  \UseTblrIndent{remark}
  \UseTblrHang{remark}
  \leavevmode
  \MapTblrRemarks
  {
    \UseTblrTemplate{remark-tag}{default}
    \UseTblrTemplate{remark-sep}{default}
    \UseTblrTemplate{remark-text}{default}
    \quad
  }
  % \par%Commented out to remove the row break between the remarks and the notes
}
\DefTblrTemplate{lastfoot}{mytemplate}{%
  \UseTblrTemplate{remark}{default}
  \UseTblrTemplate{note}{default}
}
\NewTblrTheme{mytheme}{
  \SetTblrTemplate{remark}{inline-noclosingpar}
  \SetTblrTemplate{note}{inline}
  \SetTblrTemplate{lastfoot}{mytemplate}
}
\begin{document}
  \begin{table}
    \begin{talltblr}[
      theme=mytheme,
      caption={A \texttt{tabularray} table},
      remark{Note}={A few words describing something noteworthy.},
      note{a}={A table footnote that goes on for a few words more than this.}
    ]{
      colspec={@{}Xcc@{}},
      width=\linewidth
    }
      \hline
      & A & B \\
      \hline
      A row heading\TblrNote{a} & a & 123 \\
      Another row heading & b & 456 \\
      Yet another row heading & c & 789 \\
      \hline
    \end{talltblr}
  \end{table}
\end{document}

talltblr 带有自定义页脚模板

答案1

tabularray和之间的注释和备注格式有所不同threeparttable。经过一些重新定义,它们看起来非常相似。

笔记:%我发现在模板的每一行后面添加以避免出现虚假空格非常重要 。

是

\documentclass{article}
\usepackage{tabularray} 

% emulate threeparttable <<<<<<<<<<
\DefTblrTemplate{remark-sep}{three}{:\space}
\DefTblrTemplate{note-sep}{three}{\,}   

\DefTblrTemplate{remark}{inline-noclosingpar}{% similar to the remark plain 
\MapTblrRemarks{%
    \noindent%
    \UseTblrTemplate{remark-tag}{default}%
    \UseTblrTemplate{remark-sep}{three}%
    \UseTblrTemplate{remark-text}{default}% 
    \space\space}
}

    
\DefTblrTemplate{note}{inline-three}{%
    \MapTblrNotes{%
        \noindent%
        \UseTblrTemplate{note-tag}{default}%
        \UseTblrTemplate{note-sep}{three}%
        \UseTblrTemplate{note-text}{default}%
        \space}
}

\DefTblrTemplate{lastfoot}{mytemplate}{%
    \UseTblrTemplate{remark}{inline-noclosingpar}%
    \UseTblrTemplate{note}{inline-three}%
}
\NewTblrTheme{mytheme}{%
    \SetTblrTemplate{lastfoot}{mytemplate}%
}
\begin{document}        

    \begin{table}
        \begin{talltblr}[
            theme=mytheme,
            caption={A \texttt{tabularray} table emulating a \texttt{threeparttable}},
            remark{Note}={A few words describing something noteworthy.},
            note{a}={A table footnote that goes on for a few words more than this.}
            ]{
                colspec={@{}Xcc@{}},
                width=\linewidth
            }
            \hline
            & A & B \\
            \hline
            A row heading\TblrNote{a} & a & 123 \\
            Another row heading & b & 456 \\
            Yet another row heading & c & 789 \\
            \hline
        \end{talltblr}
    \end{table}
\end{document}

Z Z

相关内容