I am having trouble left aligning longtable
captions in Table 1, starting at the same table object left margin. I am essentially attempting to achieve what I have done in Table 2.
I came across a thread that recommends using LTcapwidth
. This works when I manually alter textwidth
factors (e.g. \setlength{\LTcapwidth}{.76\textwidth}
for Table 1 in MWE), however, I am working on manuscript with a lot of longtables
and would want to use a more flexible solution, rather than manually tweak \textwidth
for all of them.
Minimum Working Example
\documentclass{article}
\usepackage{multirow}
\usepackage{longtable}
\usepackage{array}
\usepackage{booktabs}
\usepackage{floatrow}
\begin{document}
\section{Table Woes}
%%%\setlength{\LTcapwidth}{.76\textwidth}
\begin{longtable}[c]{
@{}
>{\arraybackslash}p{0.10\linewidth}
>{\arraybackslash}p{0.10\linewidth}
>{\arraybackslash}p{0.10\linewidth}
>{\arraybackslash}p{0.10\linewidth}
>{\arraybackslash}p{0.10\linewidth}
>{\arraybackslash}p{0.10\linewidth}
@{}
}
\caption{Caption needs to be left aligned beginning at same starting position as table}
\label{tab:longtable_captionlable} \\
\toprule
Col 1 & Col 2 & Col 3 & Col 4 & Col 5 & Col 6 \\
\midrule
1 & 2 & 3 & 4 & 5 & 6 \\
1 & 2 & 3 & 4 & 5 & 6 \\
1 & 2 & 3 & 4 & 5 & 6 \\
\bottomrule
\end{longtable}
\begin{table}[h]
\begin{floatrow}
\ttabbox
{\caption{Using floatrow, caption is properly left aligned from the beginning of left table margin.}\label{tab:table_captionlable}}
{\begin{tabular}{|p{0.10\textwidth}|p{0.10\textwidth}|p{0.10\textwidth}|p{0.10\textwidth}|p{0.10\textwidth}|p{0.10\textwidth}|}
\hline
Col 1 & Col 2 & Col 3 & Col 4 & Col 5 & Col 6 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 \\
1 & 2 & 3 & 4 & 5 & 6 \\
1 & 2 & 3 & 4 & 5 & 6 \\
\hline
\end{tabular}}%
\end{floatrow}
\end{table}
\end{document}
\floatsetup[longtable]{LTcapwidth=table}
in your preamble, after loadingfloatrow
?