tables add tag
CarLaTeX
Is it possible to create a new kind of `longtblr`, "Quadro" in the example, with its own numbering, and its own LoT, in a more elegant way than the following?

```
\documentclass{book}
\usepackage[T1]{fontenc}
\usepackage{geometry}

\usepackage{tabularray}
\NewTblrEnviron{quadro}
\SetTblrOuter[quadro]{
    label=none,
    long, 
    entry=none,
    }

\usepackage{newfloat}
\DeclareFloatingEnvironment[
    fileext=loq,
    listname={List of Quadros},
    name=Quadro,
    placement=tbhp,
    ]{qua}

%\usepackage{hyperref}

\begin{document}
\listoftables
\listofquas
 
\chapter{Chapter}
\section{Section}
\begin{longtblr}[
  caption = {An ordinary long table},
  label = {tab:longtab},
  ]{
    colspec = {*3{c}},
    rowhead = 1,
  }
  Column 1 & Column 2 & Column 3\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
\end{longtblr}
\refstepcounter{qua}\addcontentsline{loq}{table}{\thequa\enspace\enspace Un quadro}
\begin{quadro}[   
    caption={Quadro \thequa: Un quadro},    
    ]{
    colspec = {*3{c}},
    rowhead = 1,
    }
  Column 1 & Column 2 & Column 3\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
  a & b & c\\
  d & e & f\\
\end{quadro}    
\end{document}
```

![image.png](/image?hash=adcbb60bbc87c31599d9bab7065986645e6b388340a4055eb5e228cc56d07538)

![image.png](/image?hash=948dda2081b269f8b9b5ca45bfdc19a700e9902753fc836bdd7a0ff015c4ce94)

![image.png](/image?hash=b293f8bc60aa33d145b7d9f6b710bc92ac6fcac172daf455837b110ff9d83852)

![image.png](/image?hash=9a379c649f7a391a8b4ff2d526571998257b8f5d07e9289df1dc76ea082f580b)
Top Answer
samcarter
Normally, tabularray has the name of the list (`lot`) and the name of the counter (`table`) hard coded in the code, but what if we patch it to use macros instead? Then we can redefine these macros between the different types of tables (I don't know if this is more elegant, but it saves you from having to add the list entry manually):



```
\documentclass{article}

\usepackage{tabularray}

\NewTblrEnviron{quadro}
\SetTblrOuter[quadro]{long}

\usepackage{newfloat}
\DeclareFloatingEnvironment[
    fileext=loq,
    listname={List of Quadros},
    name=Quadro,
    placement=tbhp,
    ]{qua}

\usepackage{xpatch}
\def\listtype{lot}
\def\countertype{table}

\ExplSyntaxOn
\DeclareTblrTemplate { caption-lot } { normal }
  {
    \tl_if_empty:NTF \lTblrEntryTl
      { \tl_set_eq:NN \l__tblr_caption_short_tl \lTblrCaptionTl }
      { \tl_set_eq:NN \l__tblr_caption_short_tl \lTblrEntryTl }
    \addcontentsline { \listtype } { table }
      { \protect\numberline { \csname the\countertype\endcsname } { \l__tblr_caption_short_tl } }
  }
\SetTblrTemplate { caption-lot } { normal }

\DeclareTblrTemplate { caption-tag } { normal } { \tablename\hspace{0.25em}\csname the\countertype\endcsname }
\SetTblrTemplate { caption-tag } { normal }

\xpatchcmd{\__tblr_build_table_label_entry:}
  {\refstepcounter { table }}
  {\refstepcounter { \countertype }}
  {}
  {\typeout{Patch failed}}
\ExplSyntaxOff

\AtBeginEnvironment{quadro}{%
  \def\listtype{loq}%
  \def\countertype{qua}%
  \def\tablename{Quadro}%
}

\begin{document}

\listoftables
\listofquas

\begin{longtblr}[
  caption = {An ordinary long table},
  label = {tab:longtab},
  ]{
    colspec = {*3{c}},
    rowhead = 1,
  }
  Column 1 & Column 2 & Column 3\\
  a & b & c\\
\end{longtblr}

\begin{longtblr}[
  caption = {more long table},
  label = {tab:longtttab},
  ]{
    colspec = {*3{c}},
    rowhead = 1,
  }
  Column 1 & Column 2 & Column 3\\
  a & b & c\\
\end{longtblr}

\begin{quadro}[   
    caption={Un quadro},    
    ]{
    colspec = {*3{c}},
    rowhead = 1,
    }
  Column 1 & Column 2 & Column 3\\
  a & b & c\\
\end{quadro}    

\begin{longtblr}[
  caption = {Another ordinary long table},
  label = {tab:longttab},
  ]{
    colspec = {*3{c}},
    rowhead = 1,
  }
  Column 1 & Column 2 & Column 3\\
  a & b & c\\
\end{longtblr}

\end{document}
```

![Screenshot 2026-05-08 at 18.50.15.png](/image?hash=ef07f7cc422dac650ab22626a7772ecf380e9f39bc28b323350372aa35203daf)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.