2

How can I achieve have remarks and notes in a single, \raggedright paragraph when using tabularray? What I'm looking for is much the same behavior that we get from using threeparttable with the para and flushleft package options (see example below).

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

threeparttable with para and flushleft package options

My best crack at this has been to edit the definition of the "remark inline" template and remove the \par at the end (see example below). But this adds a horizontal space before the first remark and stretches the interword spacing.

\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 with custom footer template

0

1 Answer 1

4

There are differences in the format of notes and remarks between tabularray and threeparttable. With a few redefinitions, they look pretty similar.

Note: I found it is very important to add % after each line of the templates to avoid spurious spaces.

z

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

zz

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .