3

Issue

I want to use a longtblr from tabularray with no captions (e.g., "Table 1: Test Table").

Minimum Working Example

\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}

The default template settings are for other tables in the document and are working as intended. I just need one table without a caption but they are forced in longtblrs and talltblrs.

enter image description here

Solutions Tried

I am aware of this StackExchange thread but adding the snippet below with the outer specification theme = blank does not work.

\NewTblrTheme{blank}{
    \SetTblrStyle{firsthead, middlehead,lasthead}{}
}

1 Answer 1

3

You probably need to re-define default templates in the custom theme to get the result

\NewTblrTheme{blank}{
    \DefTblrTemplate{firsthead}{default}{}%
    \DefTblrTemplate{middlehead,lasthead}{default}{}%
    \DefTblrTemplate{contfoot-text}{default}{}%
}

Not sure if this is an answer but here we go:

\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}

enter image description here

You must log in to answer this question.

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