如何删除 tabularray 中很长的标题中的缩进?

如何删除 tabularray 中很长的标题中的缩进?

我有一张如下表格。如何格式化以使标题从第二行开始没有任何缩进?

\documentclass{article}
\usepackage{tabularray}
    
\begin{document}
    
\begin{longtblr}
[caption = {Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Long Caption}, 
label={tab:typewise_WTL}]
{width = \textwidth,
colsep=2pt,
colspec= {*{9}{X[c,m]}},
columns={font=\smaller},
column{1} = {font=\smaller\bfseries},
vline{2-Y}={solid},
hline{1-Z}={solid},
rowhead = 2,
row{1-2} = {font=\smaller\bfseries},
rowsep = 1pt}
\SetCell[r=2]{c}{Type} & \SetCell[r=1,c=2]{c}{25\% of $ABC_{max}$} &  & \SetCell[r=1,c=2]{c}{50\% of $ABC_{max}$} &  & \SetCell[r=1,c=2]{c}{75\% of $ABC_{max}$} &  & \SetCell[r=1,c=2]{c}{100\% of $ABC_{max}$} &  \\
& S2 & S3 & S2 & S3 & S2 & S3 & S2 & S3 \\
I & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z \\ 
II & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z \\
III & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z \\
\end{longtblr}
\end{document}

在此处输入图片描述

答案1

可以定义一个新主题,更改与标题格式相关的模板,以便标题文本和Table 1:都是单个段落,从而避免默认缩进。

这样,更改就只具有局部范围。

A

\documentclass{article}
\usepackage{tabularray}

%****************************************       added <<<<<<<<< 
\NewTblrTheme{CaptionNotIndented}{%
     \DeclareTblrTemplate{caption-tag}{default}{}
     \DeclareTblrTemplate{caption-sep}{default}{}
     \DeclareTblrTemplate{caption-text}{default}{Table\hspace{0.25em}\thetable:\enskip\InsertTblrText{caption}}
}
%****************************************

\begin{document}%
    
    \begin{longtblr}
        [theme=CaptionNotIndented, % use the new theme <<<
        caption = {Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Very Long Caption}, 
        label={tab:typewise_WTL}]
        {width = \textwidth,
            colsep=2pt,
            colspec= {*{9}{X[c,m]}},
            columns={font=\small}, % changed >> \small
        column{1} = {font=\small\bfseries},% changed >> \small
            vline{2-Y}={solid},
            hline{1-Z}={solid},
            rowhead = 2,
            row{1-2} = {font=\small\bfseries},% changed >> \small
            rowsep = 1pt}
        \SetCell[r=2]{c}{Type} & \SetCell[r=1,c=2]{c}{25\% of $ABC_{max}$} &  & \SetCell[r=1,c=2]{c}{50\% of $ABC_{max}$} &  & \SetCell[r=1,c=2]{c}{75\% of $ABC_{max}$} &  & \SetCell[r=1,c=2]{c}{100\% of $ABC_{max}$} &  \\
        & S2 & S3 & S2 & S3 & S2 & S3 & S2 & S3 \\
        I & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z \\ 
        II & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z \\
        III & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z & X/Y/Z \\
    \end{longtblr}

\end{document}

相关内容