# threeparttablex in combination with floatrow: Table not centered anymore

I use threeparttablex to provide longtables with the threeparttable functionality. That works well in general.

However, I need to load floatrow as follows:

\usepackage{floatrow}
\DeclareFloatFont{small}{\small}% "scriptsize" is defined by floatrow, "tiny" not
\floatsetup[table]{font=small, capposition=top}


Unfortunately, now the threeparttablex tables are not centered anymore.

Does anyone have a solution for this problem?

Here is a MWE:

\documentclass[a4paper,
11pt,
oneside,
numbers=noenddot,
toc=listof,
toc=bibliography,
BCOR=8.25mm,
DIV=11]{scrbook} %draft fuer preview; ,BCOR=1cm,DIV=11, (DIV=10 wäre Standard)

\usepackage[T1]{fontenc} % Zeichentabelle, fuer deutschen Zeichensatz

\usepackage{amsmath}
\usepackage{amssymb} % mehr Symbole
\usepackage{upgreek}
\usepackage{wasysym} % für $\checked$
\usepackage[utf8]{inputenc} % UTF8-Zeichensatz (zur Eingabe)

\usepackage[ngerman, british]{babel} % ngerman
\selectlanguage{british}

\usepackage{booktabs} % spezielle Tabellen zulassen
\usepackage{longtable} % Tabellen über mehr als eine Zeile zulassen
\setlength{\LTpre}{12pt} % removing white spaces before and after longtable
\setlength{\LTpost}{0pt}

\usepackage{siunitx}
\sisetup{
group-digits=true,          %% Zifferngruppierung an/aus
group-minimum-digits=4,     %% Ziffern ab # Ziffern gruppieren
detect-all = true
%   detect-weight=true,detect-inline-weight=math
}
%
\usepackage{floatrow}
\DeclareFloatFont{small}{\small}% "scriptsize" is defined by floatrow, "tiny" not
\floatsetup[table]{font=small, capposition=top}

\usepackage[skip=0pt, labelsep=period, labelfont=bf]{caption}

\usepackage[flushleft]{threeparttable} % Um notes in den Tabellen zu haben
\usepackage[referable]{threeparttablex}

\begin{document}

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.

Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.

Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis.

\begin{ThreePartTable}
\begin{TableNotes}
\setlength\labelsep{0pt}
\small
\item
\emph{Note.} FA1--FA3 = Extracted factors. Factor loadings $\geq .40$ are in boldface.
\end{TableNotes}
\begin{longtable}{
l
S[table-format=1.2, detect-weight, detect-family=true]
S[table-format=1.2, detect-weight, detect-family=true]
S[table-format=1.2, detect-weight, detect-family=true]
}
\caption{Factor loadings for principal factor analysis with Promax rotation of the agency facets scales.} \\
\toprule
Item &   {FA1} &   {FA2} &   {FA3}  \\ \midrule
\multicolumn{4}{c}%
{\tablename\ \thetable\ -- \textit{Continued from previous page}} \\
\toprule
Item &   {FA1} &   {FA2} &   {FA3}  \\ \midrule
\bottomrule
\multicolumn{4}{r}{\textit{Continued on next page}} \\
\endfoot
\bottomrule
\insertTableNotes
%       \multicolumn{4}{r}{\textit{Continued on next page}} \\
\endlastfoot
competence 1 & \textbf{0.75} & -0.14 & 0.04 \\
competence 2 & \textbf{0.84} & -0.06 & -0.07 \\
competence 3 & \textbf{0.84} & -0.08 & -0.06 \\
competence 4 & \textbf{0.55} & 0.11 & -0.15 \\
competence 5 & \textbf{0.72} & 0.10 & -0.12 \\
competence 6 & \textbf{0.65} & 0.01 & 0.03 \\
competence 7 & \textbf{0.81} & -0.07 & 0.01 \\
competence 8 & \textbf{0.81} & -0.07 & 0.06 \\
competence 9 & \textbf{0.60} & 0.08 & 0.11 \\
competence 10 & \textbf{0.58} & 0.03 & 0.25 \\
beliefs 2 & 0.23 & \textbf{0.41} & -0.05 \\
beliefs 3 & 0.24 & \textbf{0.40} & -0.05 \\
beliefs 4 & -0.14 & \textbf{0.79} & 0.00 \\
beliefs 5 & -0.10 & \textbf{0.80} & -0.04 \\
beliefs 6 & -0.09 & \textbf{0.76} & 0.03 \\
beliefs 7 & -0.13 & \textbf{0.80} & 0.06 \\
beliefs 8 & 0.09 & \textbf{0.67} & 0.00 \\
beliefs 9 & 0.06 & \textbf{0.70} & -0.01 \\
beliefs 10 & 0.14 & \textbf{0.53} & 0.09 \\
personality 1 & 0.09 & 0.08 & \textbf{0.49} \\
personality 2 & -0.01 & -0.06 & \textbf{0.71} \\
personality 3 & -0.01 & 0.00 & \textbf{0.63} \\
personality 5 & -0.10 & 0.10 & \textbf{0.66} \\
personality 6 & 0.04 & 0.09 & \textbf{0.54} \\
personality 8 & -0.05 & -0.13 & \textbf{0.49} \\ \midrule
\emph{Explained variance} & \itshape .21 & \itshape .16 & \itshape .09
\label{tab:PFA_agency} \\
\end{longtable}
\end{ThreePartTable}

\end{document}


Here's a minimal example which demonstrates that the problem is caused by the combination of floatrow and longtable.

\documentclass{article}
\usepackage{longtable,showframe}
\usepackage{floatrow}

\begin{document}

\begin{longtable}{lccc}
\caption{Caption which must extend to quite a long thing if we're going to see the problem clearly.} \\
competence 1 & \textbf{0.75} & -0.14 & 0.04 \\
competence 2 & \textbf{0.84} & -0.06 & -0.07 \\
\end{longtable}

\end{document}


The floatrow documentation mentions the fact that longtable has been modified to work with floatrow. What it fails to make clear is that this is not something longtable does, but something floatrow does.

In floatrow.sty, we find

\AtBeginDocument{%
\@ifundefined{LT@array}{\@tempswafalse}{\@tempswatrue}
\if@tempswa\RequirePackage{fr-longtable}\fi}


So, floatrow is loading fr-longtable.sty if longtable has been loaded before the document begins.

It is possible - although I can't confirm this - that the patch worked OK with the version of longtable available at the time.

\ProvidesPackage{floatrow}
[2008/08/02 v0.3b floatrow: float package extension]


shows floatrow to have last been updated in 2008, while

\ProvidesPackage{fr-longtable}
[2007/11/28 v0.1b (beta) floatrow: additions for longtable]


shows the longtable patch to be from 2007. In contrast,

\ProvidesPackage{longtable}
[2014/10/28 v4.11 Multi-page Table package (DPC)]


tells us that longtable was last updated in 2014.

So one possibility is that the patch worked in 2007 but does not work now.

The most straightforward way to workaround this particular issue, at least, is to explicitly tell longtable that it should be centred

\begin{longtable}[c]{lccc}


However, this will not work if you wanted the table to be set left or right as the caption is misplaced in those cases. That is

\begin{longtable}[l]{lccc}
...

\begin{longtable}[c]{lccc}
...

\begin{longtable}[l]{lccc}


produces

So the problem is obviously somewhat deeper than a simple failure to specify a default alignment when redefining the longtable environment.

Indeed, it is not even the patch itself which is the problem. Blocking the loading of the patch does not resolve the issue. In fact, not loading floatrow doesn't resolve it either. It appears to be a longtable issue which can be reproduced even without floatrow, as noted by David in chat ... [That is, this has been reported to the author of longtable...]

The only reason loading floatrow appears to cause it is that floatrow fails to make centring the default, which longtable itself does.

\documentclass{article}
\usepackage{longtable,showframe}
\usepackage{floatrow}

\begin{document}

\begin{longtable}[l]{lccc}
\caption{Caption which must extend to quite a long thing if we're going to see the problem clearly.} \\
competence 1 & \textbf{0.75} & -0.14 & 0.04 \\
competence 2 & \textbf{0.84} & -0.06 & -0.07 \\
\end{longtable}
\begin{longtable}[c]{lccc}
\caption{Caption which must extend to quite a long thing if we're going to see the problem clearly.} \\
competence 1 & \textbf{0.75} & -0.14 & 0.04 \\
competence 2 & \textbf{0.84} & -0.06 & -0.07 \\
\end{longtable}
\begin{longtable}[r]{lccc}
\caption{Caption which must extend to quite a long thing if we're going to see the problem clearly.} \\
competence 1 & \textbf{0.75} & -0.14 & 0.04 \\
competence 2 & \textbf{0.84} & -0.06 & -0.07 \\
\end{longtable}

\end{document}

• Brillant. Perfect answer, Sherlock Holmes style. – Dr. Manuel Kuehner Oct 28 '16 at 23:44