biblioteca de subtítulos para el paquete tabularray

biblioteca de subtítulos para el paquete tabularray

Estoy intentando (de alguna manera) implementar uncaption biblioteca para tabularray, según la respuestaaquí

Como mencionó @Ulrike, la respuesta original da advertencias conhyperref a la definición de anclajes de hipervínculos dobles, por lo que intenté omitir uno de los anclajes para generarlo.

Además, verifiqué y tengo que agregar un espacio virtual adicional de 1 punto para subtítulos continuos, de lo contrario, el espacio vertical entre la primera línea de la tabla y el título no coincidiría.

Mi pregunta es: ¿De dónde viene el espacio extra? ¿Agregar el comando vspace es la mejor opción para evitarlo? ¿Y hay alguna otra consideración que estoy omitiendo?

\ProvidesPackage{tblr-caption}[2024/01/02 package tblr-caption]
\RequirePackage{tabularray}
\RequirePackage{caption}

\@ifundefined{KOMAClassName}
{}
{\PackageWarningNoLine{tblr-caption}{KOMAScript class detected. Setup caption position using 'captions=<option>'}}
\@ifpackageloaded{hyperref}{%
    \newenvironment{nohyp}{\begin{NoHyper}}{\end{NoHyper}}
    }{%
    \newenvironment{nohyp}{}{}
    }


\ExplSyntaxOn
\prg_generate_conditional_variant:Nnn \tl_if_empty:n { e } { TF }
\let \IfTokenListEmpty = \tl_if_empty:eTF
\ExplSyntaxOff

\NewTblrLibrary{caption}
{%
    \SetTblrOuter[talltblr,longtblr]{headsep=0pt}
    \DefTblrTemplate{firsthead}{default}{%
        \addtocounter{table}{-1}%
        \IfTokenListEmpty{\InsertTblrText{entry}}{%
            \begin{nohyp}%
                \captionsetup{type=table}
                \caption{\InsertTblrText{caption}}%
            \end{nohyp}%
        }{%
            \begin{nohyp}%
                \captionsetup{type=table}
                \caption[\InsertTblrText{entry}]{\InsertTblrText{caption}}%
            \end{nohyp}%
        }%
    }
    \DefTblrTemplate{middlehead,lasthead}{default}{%
        \addtocounter{table}{-1}%
        \captionsetup{type=table}%
        \caption[]{\InsertTblrText{caption} \UseTblrTemplate{conthead}{default}}
        \vspace*{1pt}%
    }
    \SetTblrTemplate{caption-lot}{empty}
}

MWE para probar:

\documentclass[12pt]{article}
\usepackage[spanish,mexico]{babel}
\usepackage{lipsum}
\usepackage[singlespacing]{setspace}
\usepackage{tabularray}
\usepackage{hyperref} %% must be loaded for tblr-caption to work
\usepackage{tblr-caption} %% must be loaded after hyperref
\UseTblrLibrary{caption}

\captionsetup[table]{%
    format=plain,
    labelsep = newline,
    singlelinecheck = false,
    labelfont = bf,
    textfont = it,
    font = {small,singlespacing},
    position = above,
}%

\DefTblrTemplate{conthead-text}{default}{(Continuación)}
\DefTblrTemplate{contfoot-text}{default}{Continúa en la siguiente página}

\begin{document}
    
    \section{Introduction}
    
    \begin{table}[htbp]
        \centering
        \captionsetup{width=5cm}
        \caption{caption using tabular and caption package}
        \begin{tabular}{|c|c|c|c|}
            \hline
            a & b & filler text & filler text\\
            \hline
            a & b & filler text & filler text\\
            \hline
            a & b & filler text & filler text\\
            \hline
            a & b & filler text & filler text\\
            \hline
        \end{tabular}
        \label{tab:my_label}
    \end{table}
    
    \begin{table}[htbp]
        \centering
        \begin{talltblr}[caption={caption using tabularray package}]{colspec={cccc},hline{1,2,Z} = {0.05em}}
            a & b & filler text & filler text\\
            a & b & filler text & filler text\\
            a & b & filler text & filler text\\
            a & b & filler text & filler text\\
        \end{talltblr}
    \end{table}
    
        \begin{longtblr}[
        caption = {The Caption of {\ttfamily longtblr} environment.},
        entry = {The Caption in LOT},
        label=table1,
        %       headsep=0pt,
        ]{
            colspec = {rccl},
            hline{1,2,Z} = {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\\
        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\\
        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\\
        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\\
        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\\
        2019/01/01 & 00:06 & CET & starting xyz daemon\\
        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\\
        2019/01/01 & 00:06 & CET & starting xyz daemon\\
        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}
\end{document}

EDITAR: Sin el \vspace*{1pt}in, tblr-captionobtengo una discrepancia entre el espaciado vertical del primer título de un longtblr y su título continuo como se ve en la siguiente imagen (el primero es el subtítulo, el segundo es el título principal de un longtblr)

Subtítulo continuo frente a primer título: longtblr (sin vspace 1pt)

Respuesta1

El problema era que estaba usando una plantilla incorrecta. En lugar de conthead, debería haber usadoconthead-text .

La definición corregida es:

\DefTblrTemplate{middlehead,lasthead}{default}{%
    \addtocounter{table}{-1}%
    \captionsetup{type=table}%
    \caption[]{\InsertTblrText{caption} \UseTblrTemplate{conthead-text}{default}}%
}

información relacionada