For a project I am working on, tabularray has been suggested in the answers to my previous questions (see here and here).
However, there will be other floats (figures, listings, etc.) with captions styled via \usepackage{caption}. The problem is that the caption provided by tabularray does not react to the settings made with \usepackage{caption}.
Since the design requirement is that all caption have to look the same, it is required to re-style the caption of longtblr.
Starting point
tabularray provides with the \DefTblrTemplate macro a possible way to re-style the macro manually.
\documentclass{scrreprt}
\usepackage{tabularray} % for table typesetting
% modifying the captions of tabularray
\DefTblrTemplate{caption-tag}{default}{\small \bfseries Table\hspace{0.25em}\thetable}
\DefTblrTemplate{caption-sep}{default}{\small \bfseries :\enskip}
\DefTblrTemplate{caption-text}{default}{\small\InsertTblrText{caption}}
% setting the captions for all floats except tabularray
\usepackage{caption}
\captionsetup{format=plain,labelformat=simple,labelfont=bf,font=small,labelsep = colon}
\begin{document}
\begin{longtblr}[
caption = {The Caption of the {\ttfamily longtblr} environment.},
]{
colspec = {rccl},
hline{Z} = {0.08em},
hline{2} = {0.05em},
row{1} = {font=\bfseries},
rowhead = 1,
}
date & time & time zone & event \
2019/01/01 & 00:00 & CET & server installation finished\
2019/01/01 & 00:05 & CET & server successfully booted\
2019/01/01 & 00:06 & CET & starting xyz daemon\
\end{longtblr}
\begin{table}[h!]
\centering
\caption{Caption of a standard table styled with {\ttfamily captions}.}\vspace{0.25cm}
\begin{tabular}{rccl}
\textbf{date} & \textbf{time} & \textbf{time zone} & \textbf{event} \
\hline
2019/01/01 & 00:00 & CET & server installation finished\
2019/01/01 & 00:05 & CET & server successfully booted\
2019/01/01 & 00:06 & CET & starting xyz daemon\
\hline
\end{tabular}
\end{table}
\end{document}
This produces very similar caption styling; except for the space between "Table" and the number (which is not a big deal for me and could easily be fixed). However, a user would have to do the setup twice.
Question
- Is there an easy way to copy the caption settings of
\usepackage{caption}totabularray? - Or is it easier to re-define the standard
\captionmacro manually instead of relying on the\usepackage{caption}?
I have tried to use an if-statement and helper macros, which of course lead to missing \csname or expansion errors. And honestly, the code was getting quite messy.
