5

I have a problem with longtable and the position of a table note created by threeparttablex, as the MWE below demonstrates. The first table stretches to the full textwidth and the position of the table note is incorrect. The second table does not specify any table size and the table note is correct. Am I doing something wrong?

\documentclass[11pt]{scrartcl}

\usepackage[showframe]{geometry}
\usepackage{longtable,threeparttablex,booktabs}

\begin{document}

\begin{ThreePartTable}
 \begin{TableNotes}[para,flushleft]This is a wrong tablenote\end{TableNotes}
 \setlength\LTleft{0pt}
 \setlength\LTright{0pt}
 \begin{longtable}{@{\hskip\tabcolsep\extracolsep\fill}l*{3}{c}}
  \caption{Longtable with Full Textwidth}\\
  \toprule
   Variable 1 & 1.85   & 0.92   & 1.11   \\
              & (0.34) & (0.24) & (0.14) \\
  \bottomrule
  \insertTableNotes
 \end{longtable}
\end{ThreePartTable}

\begin{ThreePartTable}
 \begin{TableNotes}[para,flushleft]This is a good tablenote\end{TableNotes}
 \begin{longtable}[c]{l*{3}{c}}
  \caption{Normal Longtable}\\
  \toprule
   Variable 1 & 1.85   & 0.92   & 1.11   \\
              & (0.34) & (0.24) & (0.14) \\
  \bottomrule
  \insertTableNotes
 \end{longtable}
\end{ThreePartTable}

\end{document}

enter image description here

6
  • It seems that the table notes width is computed taking into account only the natural width of the table without the \fill component.
    – egreg
    Dec 8, 2013 at 19:08
  • @egreg Mh, yes. I wanted to double check that I did not miss something completely obvious, the correct width (to me) is the main function of threeparttables. Do you think that can be fixed?
    – Jörg
    Dec 8, 2013 at 20:05
  • I'm not sure. But my idea about tables is that trying to spread them to the line width is wrong.
    – egreg
    Dec 8, 2013 at 20:06
  • @egreg I agree to some extent, but it appears to be common in many (most?) Economics journals.
    – Jörg
    Dec 8, 2013 at 20:14
  • 2
    Thus they can make difficult for the readers to follow the data in one row. It may be a good technique. ;-)
    – egreg
    Dec 8, 2013 at 20:15

1 Answer 1

5

It appears that threeparttablex is only able to measure the natural width of the table, so the “\fill” components are not taken into account. But since you know the width, in that case, you can redefine \TPTminimum for the duration of the environment:

\documentclass[11pt]{scrartcl}

\usepackage[showframe]{geometry}
\usepackage{longtable,threeparttablex,booktabs}

\begin{document}

\begin{ThreePartTable}
 \setlength\LTleft{0pt}
 \setlength\LTright{0pt}
 \renewcommand\TPTminimum{\textwidth} %%% we want full width
 \begin{TableNotes}[para,flushleft]
  This is a wrong tablenote
  This is a wrong tablenote
  This is a wrong tablenote
  This is a wrong tablenote
  This is a wrong tablenote
\end{TableNotes}
 \begin{longtable}{@{\hskip\tabcolsep\extracolsep\fill}l*{3}{c}}
  \caption{Longtable with Full Textwidth}\\
  \toprule
   Variable 1 & 1.85   & 0.92   & 1.11   \\
              & (0.34) & (0.24) & (0.14) \\
  \bottomrule
  \insertTableNotes
 \end{longtable}
\end{ThreePartTable}

\begin{ThreePartTable}
 \begin{TableNotes}[para,flushleft]This is a good tablenote\end{TableNotes}
 \begin{longtable}[c]{l*{3}{c}}
  \caption{Normal Longtable}\\
  \toprule
   Variable 1 & 1.85   & 0.92   & 1.11   \\
              & (0.34) & (0.24) & (0.14) \\
  \bottomrule
  \insertTableNotes
 \end{longtable}
\end{ThreePartTable}

\end{document}

enter image description here

2
  • Thanks a lot. I'll let the package maintainer know of this, maybe he's interested in incorporating it.
    – Jörg
    Dec 9, 2013 at 10:44
  • Actually it might more be a longtable problem? How does one get longtable to report the true width? The width I get back are the same in both cases. I use the data stored in the .aux file to calculate the width. But that does not take the \fill into account.
    – daleif
    Dec 9, 2013 at 11:21

You must log in to answer this question.

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