I'm using longtabu
(longtable) for splitting a table on 2 and more pages, and i want to show different captions on pages.
This works fine, however i need the first caption to be aligned left, and the next captions aligned right.
I tried using \captionsetup
from caption package, by putting it before \endfirsthead
to set a different alignment for the first caption, but it changes alignments for all the pages. Any idea how i can achieve different alignments?
Minimal example
\documentclass[12pt,a4paper]{article}
\usepackage{longtable}
\usepackage{tabu}
\usepackage{caption}
\captionsetup[table]{labelformat=simple,justification=raggedright,singlelinecheck=false}
\begin{document}
\begin{longtabu}{|X|}
\captionsetup{justification=raggedleft,singlelinecheck=false}
\caption{First caption\label{tab:cap1}}\\
\hline
\endfirsthead
\caption[]{continued}\\
\endhead
\hline 1 \\
\hline 2 \\
\hline 3 \\
\hline 4 \\
\hline 5 \\
\hline 6 \\
\hline 7 \\
\hline 8 \\
\hline 9 \\
\hline 10 \\
\hline 11 \\
\hline 12 \\
\hline 13 \\
\hline 14 \\
\hline 15 \\
\hline 16 \\
\hline 1 \\
\hline 2 \\
\hline 3 \\
\hline 4 \\
\hline 5 \\
\hline 6 \\
\hline 7 \\
\hline 8 \\
\hline 9 \\
\hline 10 \\
\hline 11 \\
\hline 12 \\
\hline 13 \\
\hline 14 \\
\hline 15 \\
\hline 16 \\
\hline 1 \\
\hline 2 \\
\hline 3 \\
\hline 4 \\
\hline 5 \\
\hline 6 \\
\hline 7 \\
\hline 8 \\
\hline 9 \\
\hline 10 \\
\hline 11 \\
\hline 12 \\
\hline 13 \\
\hline 14 \\
\hline 15 \\
\hline 16 \\
\hline
\end{longtabu}
\end{document}
Best Answer
You could define a couple of new commands that change the
captionsetup
and then pass arguments tocaption
. It is then possible to set a document-wide parameter, such aslabelfont=bf
that affects both captions.