2

I have made a long table, on landscape orientation, using tabularray. I'm happy with the table itself, my question is: how can I remove the hanging indent within the table caption on the second (continued) page?

Here is the table:

PAGE 1

PAGE 2

And the code:

\documentclass{article}
%% PACKAGES
\usepackage{caption}            % Captions
\usepackage{array}              % Tables
\usepackage{booktabs}           % Tables
\usepackage{multirow}           % Tables
\usepackage{geometry}           % page geometry - for landscape
\usepackage{pdflscape}          % landscape page
\usepackage{tabularray}         % long table
\usepackage{lipsum}             % filler words

% set long table specifications
\NewTblrTheme{thesis}{
    \SetTblrStyle{caption}{hang=0pt,format=plain,font=\bfseries}
    \SetTblrStyle{head}{hang=0pt,format=plain,font=\bfseries}
    \SetTblrStyle{conthead}{hang=0pt,format=plain,font=\bfseries}
}

% caption setup 
\captionsetup{format=plain, justification=justified, font=small, labelfont=bf, textfont=bf}

% create \tab command
\newcommand\tab{\hspace{10mm}}

\begin{document}

% text from document

\newgeometry{margin=1in}
\begin{landscape}
\singlespacing
\begin{longtblr}[
    theme=thesis,
    caption={Long caption that spans multiple lines. Long caption that spans multiple lines. Long caption that spans multiple lines. Long caption that spans multiple lines. Long caption that spans multiple lines. Long caption that spans multiple lines. Long caption that spans multiple lines. Long caption that spans multiple lines. Long caption that spans multiple lines.}, 
    label={tbl:example}
    ]{% 
    rowhead=2,
    colspec={X[1.4,c,m]X[2.55,l,h]X[2.3,l,h]X[2.7,l,h]}
    }
 & \multicolumn{3}{c}{These columns are explained here} \\
 & \textbf{Column 1} & \textbf{Column 2} & \textbf{Column 3} \\
\hline
Row 1
& \textb{Text here} \par 
    \tab Values values values \par 
    Text here \par 
    \tab values values vlues \par 
    \textbf{Text here} \par 
    \tab \textbf{values values values}\par 
    Text here \par
    \tab values values values \par 
    \textbf{Text here} \par
    \tab \textbf{values values values}
& \textbf{Text} \par
    \tab \textbf{values values} \par 
    \textbf{Text} \par
    \tab \textbf{Values values} 
& \textbf{Text} \par
    \tab \textbf{Values values } \par 
    \textbf{Text} \par 
    \tab \textbf{values values} \\
\hline
Row 2 & \lipsum[1-1][1-2] & \lipsum[1-1][1-5] & \lipsum[1-1][1-2] \\
\hline
Row 3 & \lipsum[1-1][1-5] & \lipsum[1-1][1-2] & \lipsum[1-1][1-2] \\
\hline
Row 4 & \lipsum[1-1][1-5] & \lipsum[1-1][1-2] & \lipsum[1-1][1-4] \\
\hline
Row 5 & \lipsum[1-1][1-2] & \lipsum[1-1][1-4] & \lipsum[1-1][1-2] \\
\hline
\end{longtblr}
\doublespacing
\end{landscape}
\restoregeometry

% text from document

\end{document}

P.S. I show Row 1 the way it is to give a better idea why I need to use tabularray package (the multiple different number lines, indents, and cell alignments).

1 Answer 1

4

Redefine the capcont template. And, by the way, I had to correct some errors to get it working

\documentclass{article}
%% PACKAGES
\usepackage{caption}            % Captions
\usepackage{array}              % Tables
\usepackage{booktabs}           % Tables
\usepackage{multirow}           % Tables
\usepackage{geometry}           % page geometry - for landscape
\usepackage{pdflscape}          % landscape page
\usepackage{tabularray}         % long table
\usepackage{lipsum}             % filler words

% set long table specifications
\NewTblrTheme{thesis}{
    \SetTblrStyle{caption}{hang=0pt,format=plain,font=\bfseries}
    \SetTblrStyle{head}{hang=0pt,format=plain,font=\bfseries}
    \SetTblrStyle{conthead}{hang=0pt,format=plain,font=\bfseries}
}

% <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
% Redefine continuation caption
% <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
\DefTblrTemplate{capcont}{default}{%
  \par
  \UseTblrTemplate {caption-tag}{default}%
  \UseTblrTemplate {caption-sep}{default}%
  \UseTblrTemplate {caption-text}{default}
  \UseTblrTemplate {conthead-text}{default}
  \par
}
% >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

% caption setup 
\captionsetup{format=plain, justification=justified, font=small, labelfont=bf, textfont=bf}
    
% create \tab command
\newcommand\tab{\hspace{10mm}}

\begin{document}

% text from document

\newgeometry{margin=1in}
\begin{landscape}
%\singlespacing
\begin{longtblr}[
    theme=thesis,
    caption={Long caption that spans multiple lines. Long caption that spans multiple lines. Long caption that spans multiple lines. Long caption that spans multiple lines. Long caption that spans multiple lines. Long caption that spans multiple lines. Long caption that spans multiple lines. Long caption that spans multiple lines. Long caption that spans multiple lines.}, 
    label={tbl:example}
    ]{% 
    rowhead=2,
    colspec={X[1.4,c,m]X[2.55,l,h]X[2.3,l,h]X[2.7,l,h]}
    }
 & \multicolumn{3}{c}{These columns are explained here} \\
 & \textbf{Column 1} & \textbf{Column 2} & \textbf{Column 3} \\
\hline
Row 1
& \textbf{Text here} \par 
    \tab Values values values \par 
    Text here \par 
    \tab values values vlues \par 
    \textbf{Text here} \par 
    \tab \textbf{values values values}\par 
    Text here \par
    \tab values values values \par 
    \textbf{Text here} \par
    \tab \textbf{values values values}
& \textbf{Text} \par
    \tab \textbf{values values} \par 
    \textbf{Text} \par
    \tab \textbf{Values values} 
& \textbf{Text} \par
    \tab \textbf{Values values } \par 
    \textbf{Text} \par 
    \tab \textbf{values values} \\
\hline
Row 2 & \lipsum[1-1][1-2] & \lipsum[1-1][1-5] & \lipsum[1-1][1-2] \\
\hline
Row 3 & \lipsum[1-1][1-5] & \lipsum[1-1][1-2] & \lipsum[1-1][1-2] \\
\hline
Row 4 & \lipsum[1-1][1-5] & \lipsum[1-1][1-2] & \lipsum[1-1][1-4] \\
\hline
Row 5 & \lipsum[1-1][1-2] & \lipsum[1-1][1-4] & \lipsum[1-1][1-2] \\
\hline
\end{longtblr}
%\doublespacing
\end{landscape}
\restoregeometry

% text from document

\end{document}

enter image description here

1
  • Thank you! This is what I was looking for. Also, sorry about the errors, I updated the code.
    – Genevieve
    Feb 15, 2022 at 21:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .