问题
我想要使用没有标题的longtblr
表单(例如,“表 1:测试表”)。tabularray
最小工作示例
\documentclass{article}
\usepackage{caption}
\captionsetup{
format=plain,
labelsep=newline,
justification=justified,
singlelinecheck=false,
labelfont=bf,
textfont=it,
}
\usepackage{booktabs}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
% Format tabularray longtblr: Use captionsetup settings, no captions on succeeding pages
\DefTblrTemplate{firsthead}{default}{%
\addtocounter{table}{-1}%
\captionof{table}[\InsertTblrText{entry}]{\InsertTblrText{caption}}%
}
\DefTblrTemplate{middlehead, lasthead}{default}{}
\DefTblrTemplate{contfoot-text}{default}{}
% Format tabularray talltblr
\SetTblrStyle{note-tag}{font=\rmfamily}
\SetTblrTemplate{note}{plain}
\begin{document}
\begin{booktabs}[
long,
note{a} = {Test note.},
]{
colspec = {XXXX},
}
\toprule
Test Column A\TblrNote{a} & Test Column B & Test Column C & Test Column D \\
\midrule
Test & Test & Test & Test \\
\vdots & \vdots & \vdots & \vdots \\
Test & Test & Test & Test \\
\bottomrule
\end{booktabs}
\end{document}
模板default
设置适用于文档中的其他表格,并且按预期工作。我只需要一个没有标题的表格,但它们在longtblr
s 和talltblr
s 中被强制使用。
尝试的解决方案
我知道此 StackExchange 线程但添加下面的带有外部规范的代码片段theme = blank
不起作用。
\NewTblrTheme{blank}{
\SetTblrStyle{firsthead, middlehead,lasthead}{}
}
答案1
您可能需要重新定义自定义主题中的默认模板才能获得结果
\NewTblrTheme{blank}{
\DefTblrTemplate{firsthead}{default}{}%
\DefTblrTemplate{middlehead,lasthead}{default}{}%
\DefTblrTemplate{contfoot-text}{default}{}%
}
不确定这是否是一个答案,但我们开始吧:
\documentclass{article}
\usepackage{caption}
\captionsetup{
format=plain,
labelsep=newline,
justification=justified,
singlelinecheck=false,
labelfont=bf,
textfont=it,
}
\usepackage{booktabs}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
% Format tabularray longtblr: Use captionsetup settings, no captions on succeeding pages
\DefTblrTemplate{firsthead}{default}{%
\addtocounter{table}{-1}%
\captionof{table}[\InsertTblrText{entry}]{\InsertTblrText{caption}}%
}
\DefTblrTemplate{middlehead, lasthead}{default}{}
\DefTblrTemplate{contfoot-text}{default}{}
% Format tabularray talltblr
\SetTblrStyle{note-tag}{font=\rmfamily}
\SetTblrTemplate{note}{plain}
\NewTblrTheme{blank}{
\addtocounter{table}{-1}%
\DefTblrTemplate{firsthead}{default}{}%
\DefTblrTemplate{middlehead, lasthead}{default}{}%
\DefTblrTemplate{contfoot-text}{default}{}%
}
\begin{document}
\begin{booktabs}[
theme=blank,
long,
note{a} = {Test note.},
]{
colspec = {XXXX},
}
\toprule
Test Column A\TblrNote{a} & Test Column B & Test Column C & Test Column D \\
\midrule
Test & Test & Test & Test \\
\vdots & \vdots & \vdots & \vdots \\
Test & Test & Test & Test \\
\bottomrule
\end{booktabs}
\vspace{1cm}
\begin{booktabs}[
long,
note{a} = {Test note.},
]{
colspec = {XXXX},
}
\toprule
Test Column A\TblrNote{a} & Test Column B & Test Column C & Test Column D \\
\midrule
Test & Test & Test & Test \\
\vdots & \vdots & \vdots & \vdots \\
Test & Test & Test & Test \\
\bottomrule
\end{booktabs}
\end{document}