Consider the MWE below. If I \usepackage{floatrow}
the longtable
is not horizontal centered. If I comment out \usepackage{floatrow}
the table is properly horizontal centered.
How can I get this snippet working (both use floatrow
and center the longtable
)?
Credits: Landscape construction (stripped down by me for MWE): Steven B. Segletes in this answer.
Without usepackage floatrow in below MWE (correct):
With usepackage floatrow in below MWE (not centered anymore):
MWE:
\documentclass{article}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{pdflscape}
\usepackage{afterpage}
\usepackage{setspace}
\usepackage[a4paper]{geometry}
% >> 'PROBLEM' package
\usepackage{floatrow}
% << 'PROBLEM' package
\begin{document}
Document is portrait
\afterpage{%
\clearpage% Flush earlier floats (otherwise order might not be correct)
\newgeometry{left=1cm, right=1cm,top=1cm,bottom=1cm}
\begin{landscape}% Landscape page
\pagestyle{empty}
\centering % Center table
\vspace{0pt}
\begin{singlespacing}
\begin{longtable}{rr}
\caption{Table is landscape.}
\tabularnewline
\textbf{Col1} & \textbf{Col2}\tabularnewline
\midrule
\endfirsthead
\caption{Caption (Continued)}\tabularnewline
\textbf{Col1} & \textbf{Col2}\tabularnewline
\midrule
\endhead
\bottomrule
\multicolumn{2}{r}{Cont}
\endfoot
\bottomrule
\endlastfoot
A & B \tabularnewline
C & D \tabularnewline
\end{longtable}
\end{singlespacing}
\end{landscape}
\clearpage% Flush page
}
\restoregeometry
\end{document}
\centering
never has any affect on longtable. – David Carlisle Jul 22 '16 at 19:17[l]
or[r]
but\centering
,\flushright
don't do anything as they are always full width. – David Carlisle Jul 22 '16 at 19:20