I am new to StackExchange, so any suggestions to improve my question framing are welcome.
I have some trouble getting the caption of my table aligned. Since I need a landscape, multipage table, I am using threeparttablex combined with longtable. I figured out that commenting out the margin adjustments in line 10 in the MWE below fixes my problem, but I do like to keep my margins that way in the rest of my document.
Note: The captions of the other 'regular' threeparttables (no x, no longtable) in my document are fine. Also, I tried \centering at multiple locations in this table, which didn't help.
My question is: how to align the table caption with this table, while also keeping my margins at 2.6cm? Thanks in advance!
\documentclass{book}
\usepackage[flushleft]{threeparttable}
\usepackage{longtable}
\usepackage{pdflscape}
\usepackage{threeparttablex}
\usepackage{caption}
\usepackage{booktabs}
\usepackage[margin=2.6cm]{geometry} %commenting this out fixes the caption alignment
%adjust table caption setup
\DeclareCaptionLabelSeparator*{spaced}{\\[2ex]}
\captionsetup[table]{textfont=it,justification=raggedright,singlelinecheck=false,labelsep=spaced, skip=0pt}
\begin{document}
\begin{landscape}
\begin{ThreePartTable}
\begin{TableNotes}
\small
\item \textit{Note.} Table notes
\end{TableNotes}
\begin{longtable}{p{1cm}p{1cm}p{3cm}p{3cm}p{3cm}p{3cm}p{3cm}}
\caption{My caption}\\
\toprule
Header & Header & Header & Header & Header & Header & Header \\
\midrule
\endfirsthead
\multicolumn{7}{l}{\textit{My caption (continued)}}\\ %cheating a little bit here
\toprule
Header & Header & Header & Header & Header & Header & Header \\
\midrule
\endhead
\midrule
\multicolumn{7}{r}{{\textit{Continued on next page}}} \\
\midrule
\endfoot
\bottomrule
\insertTableNotes
\endlastfoot
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1\\
\end{longtable}
\end{ThreePartTable}
\end{landscape}
\end{document}
singlelinecheck=false
because my table caption should be on the top left (and not in the middle). – Elisabeth May 10 at 9:43