1

Is it possible to create a custom environment based on talltblr (from the tabularray-package)? Like \NewTblrEnviron for tblr, but with the possibility to make footnotes and a caption.

I would like to create a standard global table layout (table header font, spaces and toprule\midrule\bottomrule) for both text and math tables, so I don't have to place all the settings for every table. I can add the settings to talltblr by \SetTblrInner, but I need other default settings for tables containing math content. Therefore, I would like to know how to make a new environment based on talltblr.

See MWE and MWE outcome picture below.

\documentclass{article}

\usepackage{tabularray}%
    \UseTblrLibrary{amsmath,booktabs}%

% Standard text header setup
\SetTblrInner[talltblr]{%
        hline{1,Z}  = {1pt,purple},% top & bottomrule
        hline{2}    = {0.3pt,purple},% midrule
        row{1}      = {font=\sffamily\bfseries\color{teal}, halign=c, abovesep+=2pt},% header
        row{2}      = {abovesep+=1pt},% extra space under midrule
        stretch     = 1.3,% vertical stretch
}

% Math header setup
% \SetTblrInner[mathtalltblr]{%
        % hline{1,Z}  = {1pt,purple},% top & bottomrule
        % hline{2}    = {0.3pt,purple},% midrule
        % row{1}      = {mode=text, font=\sffamily\bfseries\color{teal}, halign=c, abovesep+=2pt},% header
        % row{2}      = {abovesep+=1pt},% extra space under midrule
        % row{2-Z}    = {mode=dmath, rowsep+=7pt},% table content
        % stretch     = 1.3,% vertical stretch
% }

%--------------------------------------------------------------%
\begin{document}
%--------------------------------------------------------------%

%---------------------------%
\section{Text table}

Referencing tables automatically by \ref{tblr:talltabfntest}.

\bigskip

\noindent\begin{talltblr}[
    caption = {Footnote table with caption footnote\TblrNote{a}},
    entry   = {Caption for LoT without footnote},
    label   = {tblr:talltabfntest},
    note{a} = {It is the footnote text.},
]{
    colspec = { *{4}{l} },
}
% Header
            Treatments &
            Response\TblrNote{a} &
            Num \\
% Table
            Treatment 1 & 0.0003262 & 0.562 \\
            Treatment 2 & 0.0015681 & 0.910 \\
            Treatment 3 & 0.0009271 & 0.296 \\
            Treatment 1 & 0.0003262 & 0.562 \\
            Treatment 2 & 0.0015681 & 0.910 \\
            Treatment 3 & 0.0009271 & 0.296 \\
\end{talltblr}

\bigskip

%---------------------------%
\section{Math table}

Referencing tables automatically by \ref{tblr:talltabmathtest}.

\bigskip

\noindent$\begin{talltblr}[
    caption = {A math mode table with a lot of display-\-style columns},
    label   = {tblr:talltabmathtest},
    note{*} = {It is the footnote text.},
]{
    colspec = { *{4}{X[c,m]} },
% Math header extra setup
    row{1}  = {mode=text},% header
    row{2-Z}= {mode=dmath, rowsep+=7pt},% table content
}
% Header
        Head 1 &
        Head 2 &
        Head 3 &
        Head 4 \\
% Table
        \int\cos{x} \; dx &
        \sin{x} + c &
        \int\limits_{x\in C}\! x \; dx &
        \dfrac{1}{4} 
    \\
        \int_0^2x^2 \; dx\TblrNote{*} &
        e^x + c &
        \prod_{i=1}^ni=n! &
        \tfrac{1}{4}
    \\
        \int\sec^2{x} \; dx &
        \frac{[f(x+h) - f(x)}{h} & 
        \sqrt{y} &
        \frac{2}{4} \\
\end{talltblr}$

\end{document}

example

1 Answer 1

1

In fact, longtblr and talltblr are defined as follows:

\NewTblrEnviron{longtblr}
\SetTblrOuter[longtblr]{long}
\NewTblrEnviron{talltblr}
\SetTblrOuter[talltblr]{tall}

Therefore what you want is the following definitions:

\NewTblrEnviron{mathtalltblr}
\SetTblrOuter[mathtalltblr]{tall}
\SetTblrInner[mathtalltblr]{
  hline{1,Z} = {1pt,purple},
  %% more specs
}
1
  • Thank you very much! This answers my question perfectly!
    – Elise
    Jan 22, 2022 at 16:51

You must log in to answer this question.

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