1

Question

I want \tnotex to behave like \tnote in terms of dealing with parenthesis for the marker.

\tnote:

\tnote strips parenthesis in the table but shows them in the notes section for the marker.

MWE 1 (\tnote)

\documentclass{scrreprt}

\usepackage{booktabs}
\usepackage[online,referable]{threeparttablex}
\usepackage{multicol}

\begin{document}

\begin{table}[htb]
\centering
\begin{threeparttable}
\caption{MWE 1}
\label{tab:mwe_1}
\begin{tabular*}{0.75\textwidth}{@{\extracolsep{\fill} }
    l
    c
    @{\extracolsep{0.1\linewidth}}
    c
    c
    @{}
}
\toprule
& \multicolumn{3}{c}{Multicolumn} \\
\cmidrule(lr){2-4}
& \textbf{One}\tnote{1} & \textbf{Two} & \textbf{Three} \\
& [sub] & [sub] & [sub] \\
\midrule
A\tnote{1} & 1234\tnote{a} & 12 & 12 \\
B\tnote{2} & 123 & {-} & 12345\tnote{a} \\
C\tnote{3} & 123 & 123 & {-} \\
\bottomrule
\end{tabular*}
\begin{tablenotes}
\setlength\multicolsep{0pt}
\begin{multicols}{2}
\footnotesize
\item[1)] Note 1
\item[2)] Note 2
\item[3)] Note 3
\item[a)] Note a
\note note
\source source
\end{multicols}
\end{tablenotes}
\end{threeparttable}
\end{table}

\end{document}

\tnotex:

Unfortunately, \tnotex behaves differently and shows the parenthesis in the table as well.

MWE 2 (\tnotex)

\documentclass{scrreprt}

\usepackage{booktabs}
\usepackage[online,referable]{threeparttablex}
\usepackage{multicol}

\begin{document}

\begin{table}[htb]
\centering
\begin{threeparttable}
\caption{MWE 2}
\label{tab:mwe_2}
\begin{tabular*}{0.75\textwidth}{@{\extracolsep{\fill} }
    l
    c
    @{\extracolsep{0.1\linewidth}}
    c
    c
    @{}
}
\toprule
& \multicolumn{3}{c}{Multicolumn} \\
\cmidrule(lr){2-4}
& \textbf{One}\tnotex{tn:1} & \textbf{Two} & \textbf{Three} \\
& [sub] & [sub] & [sub] \\
\midrule
A\tnotex{tn:2} & 1234\tnotex{tn:a} & 12 & 12 \\
B\tnotex{tn:2} & 123 & {-} & 12345\tnotex{tn:a} \\
C\tnotex{tn:3} & 123 & 123 & {-} \\
\bottomrule
\end{tabular*}
\begin{tablenotes}
\setlength\multicolsep{0pt}
\begin{multicols}{2}
\footnotesize
\item[1)] \label{tn:1} Note 1
\item[2)] \label{tn:2} Note 2
\item[3)] \label{tn:3} Note 3
\item[a)] \label{tn:a} Note a
\note note
\source source
\end{multicols}
\end{tablenotes}
\end{threeparttable}
\end{table}

\end{document}

Some more

I already looked up the code for threeparttablex but honestly I am more into C / C++ etc. and do not have enough time at the moment to dig deeper into the TeX rabbit hole.

I hope someone can provide me a quick (and maybe dirty) fix.

Thank you and have a nice day.

1 Answer 1

1

One quick fix is to not enter the closing parentheses in the item labels, and instead put the parenthesis separately in the internal package command that processes the labels, which is \TPTnoteLabel. This command is documented in the documentation of the original threeparttable package (page 1, emphasis mine):

Some options are provided for common variations of the table notes:

  • para Notes come one-after-another without line breaks
  • flushleft No hanging indentation on notes
  • online \item tag is printed normal size, not superscript
  • normal restores default formatting

[...]

These few options will not give you every format you might want, so you may find that you need to redefine one or more of the configuration commands. Note that mixing options with redefinitions is unlikely to work smoothly [...] Configuration commands:

  • \TPTtagStyle: Command with one argument to set appearance of the tag (number) in \tnote{tag}. It defaults to nil. It could be \textit.
  • [...]
  • \TPTnoteLabel: Command with one argument to format the item label in the tablenotes list (\makelabel); default uses \tnote.

So, without using any of these options, you can configure the formatting of the note numbers/labels in the table and in the list of notes separately by redefining these two commands, for example:

\renewcommand{\TPTnoteLabel}[1]{(#1)}

to surround the label with parentheses. However, the MWE provided uses the online option, so this is one of the cases which "is unlikely to work smoothly". Indeed, to do a redefinition here requires to overwrite the online option entirely. You can find the original definition in the package source, and because this code contains an @ symbol the redefinition needs to be surrounded by \makeatletter and \makeatother.

MWE:

\documentclass{scrreprt}

\usepackage{booktabs}
\usepackage[online,referable]{threeparttablex}
\usepackage{multicol}
\makeatletter
\def\TPT@opt@online{%
 \def\TPTnoteSettings{\leftmargin1.5em \labelwidth1em \labelsep.5em\relax}%
 \def\TPTnoteLabel##1{\TPTtagStyle{##1})\hfil}%
}
\makeatother
\begin{document}
\begin{table}[htb]
\centering
\begin{threeparttable}
\caption{MWE 2}
\label{tab:mwe_2}
\begin{tabular*}{0.75\textwidth}{@{\extracolsep{\fill} }
    l
    c
    @{\extracolsep{0.1\linewidth}}
    c
    c
    @{}
}
\toprule
& \multicolumn{3}{c}{Multicolumn} \\
\cmidrule(lr){2-4}
& \textbf{One}\tnotex{tn:1} & \textbf{Two} & \textbf{Three} \\
& [sub] & [sub] & [sub] \\
\midrule
A\tnotex{tn:2} & 1234\tnotex{tn:a} & 12 & 12 \\
B\tnotex{tn:2} & 123 & {-} & 12345\tnotex{tn:a} \\
C\tnotex{tn:3} & 123 & 123 & {-} \\
\bottomrule
\end{tabular*}
\begin{tablenotes}
\setlength\multicolsep{0pt}
\begin{multicols}{2}
\footnotesize
\item[1] \label{tn:1} Note 1
\item[2] \label{tn:2} Note 2
\item[3] \label{tn:3} Note 3
\item[a] \label{tn:a} Note a
\note note
\source source
\end{multicols}
\end{tablenotes}
\end{threeparttable}
\end{table}

\end{document}

Result:

enter image description here

1
  • Thank you very much! Regarding the "online" parameter, I am actually not quite sure whether I need it at all. So many thanks again for outlining both approaches.
    – Chilippso
    Aug 23, 2021 at 13:24

You must log in to answer this question.

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