0

I'm generally quite happy with the behavior of threeparttable, but there sometimes appears unwanted line breaks in the table notes even though I'm using the para option. For instance, in the below MWE, there is an unwanted line break after the "a" note.

How can I ensure that there won't be any line breaks between notes?

Note that the MWE is just a sample table to illustrate the problem. More generally, I am able to generate these unwanted line breaks by incrementally adding a few words. (This suggests that one solution would be to rephrase the notes, but I would prefer not to have to do that.)

\documentclass{article}
\usepackage[para]{threeparttable}
\usepackage{tabularx}
\begin{document}
  \begin{table}
    \begin{threeparttable}
      \caption{Lorem ipsum dolor sit amet, consectetur}

      {
        \begin{tabularx}{\linewidth}{X r r}
          & \textbf{A} & \textbf{B} \\
          Lorem\tnote{a} ipsum\tnote{b} dolor\tnote{c} sit amet, consectetur adipisicing elit & 123 & 456
        \end{tabularx}
      }

      \begin{tablenotes}
        Note. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.
        \item[a] Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
        \item[b] Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
        \item[c] Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
      \end{tablenotes}
    \end{threeparttable}
  \end{table}
\end{document}

Result

1 Answer 1

2

That is a feature, so notes don't start at the end of a line.

I'll take this as a suggestion for a configurable parameter to control how much of the note needs to fit on its initial line. Without that convenience you are stuck redefining a macro.

\makeatletter
\def\TPT@doparanotes{\par
   \prevdepth\z@ \TPT@hsize
   \TPTnoteSettings
   \parindent\z@ \pretolerance 8
   \linepenalty 200
   \renewcommand\item[1][]{\relax\ifhmode \begingroup
       \unskip
       \penalty -45 \hskip\z@\@plus 10pt\penalty-19
       \hskip 25pt \penalty 9999 \hskip-25pt
       \hskip 1em\@plus3pt
      \endgroup\fi
      \tnote{##1}\,\ignorespaces}%
   \let\TPToverlap\relax
   \def\endtablenotes{\par}%
}
\makeatother

And if you absolutely need a flush right margin, it could be

\makeatletter
\def\TPT@doparanotes{\par
   \prevdepth\z@ \TPT@hsize
   \TPTnoteSettings
   \parindent\z@ \pretolerance 8
   \linepenalty 200
   \renewcommand\item[1][]{\relax\ifhmode \begingroup
       \unskip
       \hskip 1em\@plus3pt
      \endgroup\fi
      \tnote{##1}\,\ignorespaces}%
   \let\TPToverlap\relax
   \def\endtablenotes{\par}%
}
\makeatother
1
  • That is a good way of taking my question :-) I think it is a good thing that notes don't start at the end of the line, but I felt that the default behavior was a little excessive. Thank you for your suggested alternatives.
    – Fredrik P
    Commented Sep 27, 2020 at 4:20

You must log in to answer this question.

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