texlive[60140] Master/texmf-dist: tabularray (1aug21)

commits+karl at tug.org commits+karl at tug.org
Sun Aug 1 22:37:17 CEST 2021


Revision: 60140
          http://tug.org/svn/texlive?view=revision&revision=60140
Author:   karl
Date:     2021-08-01 22:37:16 +0200 (Sun, 01 Aug 2021)
Log Message:
-----------
tabularray (1aug21)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/tabularray/tabularray.pdf
    trunk/Master/texmf-dist/doc/latex/tabularray/tabularray.tex
    trunk/Master/texmf-dist/tex/latex/tabularray/tabularray.sty

Modified: trunk/Master/texmf-dist/doc/latex/tabularray/tabularray.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/tabularray/tabularray.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tabularray/tabularray.tex	2021-08-01 20:37:02 UTC (rev 60139)
+++ trunk/Master/texmf-dist/doc/latex/tabularray/tabularray.tex	2021-08-01 20:37:16 UTC (rev 60140)
@@ -6,8 +6,11 @@
 \usepackage{codehigh} % https://ctan.org/pkg/codehigh
 \usepackage{tabularray}
 \usepackage{array,multirow,amsmath}
-\usepackage{chemmacros}
+\usepackage{chemmacros,environ}
 
+\usepackage[firstpage=true]{background}
+\backgroundsetup{contents={}}
+
 \UseTblrLibrary{booktabs,diagbox,siunitx}
 
 \usepackage{hyperref}
@@ -14,7 +17,7 @@
 \hypersetup{
   colorlinks=true,
   urlcolor=blue3,
-  linkcolor=red3,
+  linkcolor=blue3,
 }
 
 \usepackage{tcolorbox}
@@ -26,13 +29,22 @@
 
 \newcommand*{\K}[1]{\texttt{#1}}
 \newcommand*{\V}[1]{\texttt{#1}}
+\newcommand*{\None}{$\times$}
 
+\NewTblrEnviron{newtblr}
+\SetTblrOuter[newtblr]{long}
+\SetTblrInner[newtblr]{
+  hlines = {white}, column{1,2} = {co=1}, colsep = 5pt,
+  row{odd} = {brown8}, row{even} = {gray8},
+  row{1} = {fg=white, bg=purple2, font=\bfseries\sffamily},
+}
+
 \NewTblrEnviron{spectblr}
 \SetTblrOuter[spectblr]{long}
 \SetTblrInner[spectblr]{
-  hlines = {white},
-  row{odd}={brown8},row{even}={gray8},row{1}={fg=white,bg=purple2,font=\bfseries\sffamily},
-  column{2} = {co=1},
+  hlines = {white}, column{2} = {co=1}, colsep = 5pt,
+  row{odd} = {brown8}, row{even} = {gray8},
+  row{1} = {fg=white, bg=purple2, font=\bfseries\sffamily},
   rowhead = 1,
 }
 
@@ -47,12 +59,10 @@
 
 \renewcommand*{\thefootnote}{*}
 
-\newcommand*{\myversion}{2021L}
-\newcommand*{\mydate}{Version \myversion\ (\the\year-\mylpad\month-\mylpad\day)\\\myrepo}
-\newcommand*{\myrepo}{\url{https://github.com/lvjr/tabularray}}
+\newcommand*{\myversion}{2021M}
 \newcommand*{\mylpad}[1]{\ifnum#1<10 0\the#1\else\the#1\fi}
 
-\colorlet{highback}{\ifodd\month azure9\else blue9\fi}
+\colorlet{highback}{azure9}
 \CodeHigh{language=latex/table,style/main=highback,style/code=highback}
 \NewCodeHighEnv{code}{style/main=gray9,style/code=gray9}
 \NewCodeHighEnv{demo}{style/main=gray9,style/code=gray9,demo}
@@ -61,11 +71,82 @@
 
 \begin{document}
 
-\title{\sffamily\color{red3}Tabularray: Typeset Tabulars and Arrays with \LaTeX3}
-\author{Jianrui Lyu (tolvjr at 163.com)}
-\date{\mydate}
-\maketitle
+\savegeometry{standard}
+\newgeometry{left=0pt,right=0pt}
 
+\begin{titlepage}
+
+\backgroundsetup{
+  scale = 1,
+  angle = 0,
+  opacity = 1,
+  %color = black,
+  contents = {
+    \begin{tblr}{
+      width = \paperwidth, columns = {1}, rows= {4em},
+      cell{odd}{odd} = {gray9}, cell{even}{even} = {gray9},
+    }
+      & & & & & & & & & & & & & & \\
+      & & & & & & & & & & & & & & \\
+      & & & & & & & & & & & & & & \\
+      & & & & & & & & & & & & & & \\
+      & & & & & & & & & & & & & & \\
+      & & & & & & & & & & & & & & \\
+      & & & & & & & & & & & & & & \\
+      & & & & & & & & & & & & & & \\
+      & & & & & & & & & & & & & & \\
+      & & & & & & & & & & & & & & \\
+      & & & & & & & & & & & & & & \\
+      & & & & & & & & & & & & & & \\
+      & & & & & & & & & & & & & & \\
+      & & & & & & & & & & & & & & \\
+      & & & & & & & & & & & & & & \\
+      & & & & & & & & & & & & & & \\
+      & & & & & & & & & & & & & & \\
+      & & & & & & & & & & & & & & \\
+      & & & & & & & & & & & & & & \\
+      & & & & & & & & & & & & & & \\
+    \end{tblr}
+  }
+}
+
+\noindent
+\begin{tblr}{
+  colspec = {lX}, colsep = 12mm, hlines = {2pt, white},
+  row{odd} = {azure8}, row{even} = {gray8},
+  row{1} = {6em,azure2,fg=white,font=\LARGE\bfseries\sffamily},
+  row{2-Z} = {3em,font=\Large},
+}
+  Tabularray & Typeset Tabulars and Arrays with \LaTeX3 \\
+  Author     & Jianrui Lyu (tolvjr at 163.com) \\
+  Version    & \myversion\ (\the\year-\mylpad\month-\mylpad\day) \\
+  Code       & \url{https://github.com/lvjr/tabularray} \\
+  Code       & \url{https://bitbucket.org/lvjr/tabularray} \\
+  Issue      & \url{https://github.com/lvjr/tabularray/issues} \\
+  Forum      & \url{https://github.com/lvjr/tabularray/discussions} \\
+\end{tblr}
+
+\begin{codehigh}[boxsep=6mm]
+\begin{tblr}{
+  colspec = {lX}, colsep = 12mm, hlines = {2pt, white},
+  row{odd} = {azure8}, row{even} = {gray8},
+  row{1} = {6em,azure2,fg=white,font=\LARGE\bfseries\sffamily},
+  row{2-Z} = {3em,font=\Large},
+}
+  Tabularray & Typeset Tabulars and Arrays with \LaTeX3 \\
+  Author     & Jianrui Lyu (tolvjr at 163.com) \\
+  Version    & \myversion\ (\the\year-\mylpad\month-\mylpad\day) \\
+  Code       & \url{https://github.com/lvjr/tabularray} \\
+  Code       & \url{https://bitbucket.org/lvjr/tabularray} \\
+  Issue      & \url{https://github.com/lvjr/tabularray/issues} \\
+  Forum      & \url{https://github.com/lvjr/tabularray/discussions} \\
+\end{tblr}
+\end{codehigh}
+
+\end{titlepage}
+
+\loadgeometry{standard}
+
 \tableofcontents
 
 \chapter{Overview of Features}
@@ -177,7 +258,7 @@
 For some users who are familiar with word processors,
 these \verb!t! and \verb!b! columns are counter-intuitive.
 In \verb!tabularray! package, there are another two column types \verb!h! and \verb!f!,
-which will align cell text at row head and row foot, respectively:
+which will align cell text at the head and the foot, respectively:
 
 \begin{demohigh}
 \begin{tblr}{Q[h,4em]Q[t,4em]Q[m,4em]Q[b,4em]Q[f,4em]}
@@ -191,9 +272,8 @@
 
 \section{Multirow Cells}
 
-The above \verb!h! and \verb!f! columns are necessary for multirow cells.
-In \verb!tabularray!, the \verb!t! and \verb!b! in the optional argument of \verb!\multirow! commands
-will be treated as \verb!h! and \verb!f!, respectively:
+The above \verb!h! and \verb!f! alignments are necessary
+when we write multirow cells with \verb!\SetCell! command in \verb!tabularray!.
 
 \begin{demo}
 \begin{tabular}{|l|l|l|l|}
@@ -210,8 +290,8 @@
 \begin{demohigh}
 \begin{tblr}{|l|l|l|l|}
 \hline
- \multirow[t]{4}{1.5cm}{Multirow Cell One} & Alpha &
- \multirow[b]{4}{1.5cm}{Multirow Cell Two} & Alpha \\
+ \SetCell[r=4]{h,1.5cm} Multirow Cell One & Alpha &
+ \SetCell[r=4]{f,1.5cm} Multirow Cell Two & Alpha \\
  & Beta  & & Beta \\
  & Gamma & & Gamma \\
  & Delta & & Delta \\
@@ -222,7 +302,7 @@
 Note that you don't need to load \verb!multirow! package first,
 since \verb!tabularray! doesn't depend on it.
 Furthermore, \verb!tabularray! will always typeset decent multirow cells.
-First, it will set correct vertical \verb!c! alignment,
+First, it will set correct vertical middle alignment,
 even though some rows have large height:
 
 \begin{demo}
@@ -239,7 +319,7 @@
 \begin{demohigh}
 \begin{tblr}{|l|m{4em}|}
 \hline
- \multirow[c]{4}{1.5cm}{Multirow} & Alpha  \\
+ \SetCell[r=4]{m,1.5cm} Multirow & Alpha  \\
  & Beta  \\
  & Gamma \\
  & Delta Delta Delta \\
@@ -263,7 +343,7 @@
 \begin{demohigh}
 \begin{tblr}{|l|m{4em}|}
 \hline
- \multirow[c]{2}{1cm}{Line \\ Line \\ Line \\ Line} & Alpha \\
+ \SetCell[r=2]{m,1cm} {Line \\ Line \\ Line \\ Line} & Alpha \\
 \cline{2}
  & Beta \\
 \hline
@@ -477,191 +557,37 @@
 \end{tblr}
 \end{demohigh}
 
-\section{New Table Commands}
+\chapter{Basic Interfaces}
 
-All commands which change the specifications of tables \textcolor{red3}{must} be defined with \verb!\NewTableCommand!.
-The following example demonstrates how to define similar rules as in \verb!booktabs! package:
+\section{Old and New Interfaces}
 
-\begin{codehigh}
-\NewTableCommand\toprule{\hline[0.08em]}
-\NewTableCommand\midrule{\hline[0.05em]}
-\NewTableCommand\bottomrule{\hline[0.08em]}
-\begin{tblr}{llll}
-\toprule
- Alpha   & Beta  & Gamma   & Delta \\
-\midrule
- Epsilon & Zeta  & Eta     & Theta \\
- Iota    & Kappa & Lambda  & Mu    \\
- Nu      & Xi    & Omicron & Pi    \\
-\bottomrule
-\end{tblr}
-\end{codehigh}
+With \verb!tabularray! package, you can change the styles of tables via old interfaces or new interfaces.
 
-\chapter{The Old Interfaces}
-
-With tabularray package, you can still use improved table commands to change the styles of tables.
+The old interfaces consist of some table commands inside the table contents.
 Same as \verb!tabular! and \verb!array! environments,
 all table commands \textcolor{red3}{must} be put at the beginning ot the cell text.
 Also, new table commands \textcolor{red3}{must} be defined with \verb!\NewTableCommand!.
 
-\section{Hline Commands}
+The new interfaces consist of some options inside the mandatory argument,
+hence totally separating the styles and the contents of tables.
 
-The \verb!\hline! command has an optional argument which accepts key-value options.
-The available keys are described in Table \ref{key:hvline}.
+\begin{newtblr}[
+  caption = {Old Interfaces and New Interfaces},
+  label = {key:interface},
+]{verb}
+  Old Interfaces                                 & New Interfaces          \\
+  \verb!\SetHlines!                              & \K{hlines}              \\
+  \verb!\SetHline!, \verb!\hline!, \verb!\cline! & \K{hline}, \K{rowspec}  \\
+  \verb!\SetVlines!                              & \K{vlines}              \\
+  \verb!\SetVline!, \verb!\vline!, \verb!\rline! & \K{vline}, \K{colspec}  \\
+  \verb!\SetCells!                               & \K{cells}               \\
+  \verb!\SetCell!                                & \K{cell}                \\
+  \verb!\SetRows!                                & \K{rows}                \\
+  \verb!\SetRow!                                 & \K{row}, \K{rowspec}    \\
+  \verb!\SetColumns!                             & \K{columns}             \\
+  \verb!\SetColumn!                              & \K{column}, \K{colspec} \\
+\end{newtblr}
 
-\begin{demohigh}
-\begin{tblr}{llll}
-\hline
- Alpha   & Beta  & Gamma  & Delta \\
-\hline[dashed]
- Epsilon & Zeta  & Eta    & Theta \\
-\hline[dotted]
- Iota    & Kappa & Lambda & Mu    \\
-\hline[2pt,blue5]
-\end{tblr}
-\end{demohigh}
-
-The \verb!\cline! command also has an optional argument which is the same as \verb!\hline!.
-
-\begin{demohigh}
-\begin{tblr}{llll}
-\cline{1-4}
- Alpha   & Beta  & Gamma  & Delta \\
-\cline[dashed]{1,3}
- Epsilon & Zeta  & Eta    & Theta \\
-\cline[dashed]{2,4}
- Iota    & Kappa & Lambda & Mu    \\
-\cline[2pt,blue5]{-}
-\end{tblr}
-\end{demohigh}
-
-You can use child selectors in the mandatory argument of \verb!\cline!.
-
-\begin{demohigh}
-\begin{tblr}{llll}
-\cline{1-4}
- Alpha   & Beta  & Gamma  & Delta \\
-\cline[dashed]{odd}
- Epsilon & Zeta  & Eta    & Theta \\
-\cline[dashed]{even}
- Iota    & Kappa & Lambda & Mu    \\
-\cline[2pt,blue5]{-}
-\end{tblr}
-\end{demohigh}
-
-\section{Cell Commands}
-
-The \verb!\SetCell! command has a mandatory argument for setting the styles of current cell.
-The available keys are described in Table \ref{key:cell}.
-
-\begin{demohigh}
-\begin{tblr}{llll}
-\hline[1pt]
- Alpha   & \SetCell{bg=teal2,fg=white} Beta & Gamma & Delta \\
-\hline
- Epsilon & Zeta & \SetCell{r,font=\scshape} Eta & Theta \\
-\hline
- Iota    & Kappa & Lambda & Mu    \\
-\hline[1pt]
-\end{tblr}
-\end{demohigh}
-
-The \verb!\SetCell! command also has an optional argument for setting the multispan of current cell.
-The available keys are described in Table \ref{key:cellspan}.
-
-\begin{demohigh}
-\begin{tblr}{|X|X|X|X|X|X|}
-\hline
- Alpha & Beta & Gamma & Delta & Epsilon & Zeta \\
-\hline
- \SetCell[c=2]{c} Eta & 2-2
-              & \SetCell[c=2]{c} Iota & 2-4
-                              & \SetCell[c=2]{c} Lambda  & 2-6 \\
-\hline
- \SetCell[c=3]{l} Nu & 3-2 & 3-3
-                      & \SetCell[c=3]{l} Pi & 3-5 & 3-6   \\
-\hline
- \SetCell[c=6]{r} Tau & 4-2 & 4-3 & 4-4 & 4-5 & 4-6 \\
-\hline
-\end{tblr}
-\end{demohigh}
-
-\section{Row Commands}
-
-The \verb!\SetRow! command has a mandatory argument for setting the styles of current row.
-The available keys are described in Table \ref{key:row}.
-
-\begin{demohigh}
-\begin{tblr}{llll}
-\hline[1pt]
- \SetRow{azure8} Alpha & Beta & Gamma & Delta \\
-\hline
- \SetRow{blue8,c} Epsilon & Zeta & Eta & Theta \\
-\hline
- \SetRow{violet8} Iota & Kappa & Lambda & Mu \\
-\hline[1pt]
-\end{tblr}
-\end{demohigh}
-
-\section{Column Types}
-
-The \verb!tabularray! package has only one type of primitive column: the \verb!Q! column.
-Other types of columns are defined as \verb!Q! columns with some keys.
-
-\begin{codehigh}
-\NewColumnType{l}{Q[l]}
-\NewColumnType{c}{Q[c]}
-\NewColumnType{r}{Q[r]}
-\NewColumnType{t}[1]{Q[t,wd=#1]}
-\NewColumnType{m}[1]{Q[m,wd=#1]}
-\NewColumnType{b}[1]{Q[b,wd=#1]}
-\NewColumnType{h}[1]{Q[h,wd=#1]}
-\NewColumnType{f}[1]{Q[f,wd=#1]}
-\NewColumnType{X}[1][]{Q[co=1,#1]}
-\end{codehigh}
-
-\begin{demohigh}
-\begin{tblr}{|t{15mm}|m{15mm}|b{20mm}|}
- Alpha   & Beta  & {Gamma\\Gamma} \\
- Epsilon & Zeta  & {Eta\\Eta} \\
- Iota    & Kappa & {Lambda\\Lambda} \\
-\end{tblr}
-\end{demohigh}
-
-Any new column type must be defined with \verb!\NewColumnType! command.
-It can have an optional argument when it's defined.
-
-\section{Row Types}
-
-The \verb!tabularray! package has only one type of primitive row: the \verb!Q! row.
-Other types of rows are defined as \verb!Q! rows with some keys.
-
-\begin{codehigh}
-\NewRowType{l}{Q[l]}
-\NewRowType{c}{Q[c]}
-\NewRowType{r}{Q[r]}
-\NewRowType{t}[1]{Q[t,ht=#1]}
-\NewRowType{m}[1]{Q[m,ht=#1]}
-\NewRowType{b}[1]{Q[b,ht=#1]}
-\NewRowType{h}[1]{Q[h,ht=#1]}
-\NewRowType{f}[1]{Q[f,ht=#1]}
-\end{codehigh}
-
-\begin{demohigh}
-\begin{tblr}{rowspec={|t{12mm}|m{10mm}|b{10mm}|}}
- Alpha   & Beta  & {Gamma\\Gamma} \\
- Epsilon & Zeta  & {Eta\\Eta} \\
- Iota    & Kappa & {Lambda\\Lambda} \\
-\end{tblr}
-\end{demohigh}
-
-Any new row type must be defined with \verb!\NewRowType! command.
-It can have an optional argument when it's defined.
-
-\chapter{The New Interfaces}
-
-With \verb!tabularray! package, you can separate style and content totally in tables.
-
 \section{Hlines and Vlines}
 
 All available keys for hlines and vlines are described in Table \ref{key:hvline}.
@@ -673,11 +599,13 @@
 ]{}
   Key & Description and Values & Initial Value \\
   \underline{\K{dash}} & dash style: \V{solid}, \V{dashed} or \V{dotted} & \V{solid} \\
-  \K{text}             & replace hline/vline with text (like \V{!} specifier in \K{colspec}) & None \\
-  \underline{\K{wd}}   & rule width dimension & None \\
-  \underline{\K{fg}}   & rule color name & None \\
+  \K{text}             & replace hline/vline with text (like \V{!} specifier in \K{colspec}) & \None \\
+  \underline{\K{wd}}   & rule width dimension & \None \\
+  \underline{\K{fg}}   & rule color name & \None \\
 \end{spectblr}
 
+\subsection{Hlines and Vlines in New Interfaces}
+
 Options \verb!hlines! and \verb!vlines! are for setting all hlines and vlines, respectively.
 With empty value, all hlines/vlines will be solid.
 
@@ -686,9 +614,6 @@
  Alpha   & Beta  & Gamma   & Delta   \\
  Epsilon & Zeta  & Eta     & Theta   \\
  Iota    & Kappa & Lambda  & Mu      \\
- Nu      & Xi    & Omicron & Pi      \\
- Rho     & Sigma & Tau     & Upsilon \\
- Phi     & Chi   & Psi     & Omega   \\
 \end{tblr}
 \end{demohigh}
 
@@ -696,15 +621,11 @@
 
 \begin{demohigh}
 \begin{tblr}{
- hlines = {1pt,solid},
- vlines = {red3,dashed},
+ hlines = {1pt,solid}, vlines = {red3,dashed},
 }
  Alpha   & Beta  & Gamma   & Delta   \\
  Epsilon & Zeta  & Eta     & Theta   \\
  Iota    & Kappa & Lambda  & Mu      \\
- Nu      & Xi    & Omicron & Pi      \\
- Rho     & Sigma & Tau     & Upsilon \\
- Phi     & Chi   & Psi     & Omega   \\
 \end{tblr}
 \end{demohigh}
 
@@ -746,19 +667,16 @@
 
 \begin{demohigh}
 \begin{tblr}{
- hlines = {1}{-}{dashed},
- hlines = {2}{-}{solid},
+ hlines = {1}{-}{dashed}, hlines = {2}{-}{solid},
 }
  Alpha   & Beta  & Gamma   & Delta   \\
  Epsilon & Zeta  & Eta     & Theta   \\
  Iota    & Kappa & Lambda  & Mu      \\
- Nu      & Xi    & Omicron & Pi      \\
- Rho     & Sigma & Tau     & Upsilon \\
- Phi     & Chi   & Psi     & Omega   \\
 \end{tblr}
 \end{demohigh}
 
 Options \verb!hline{i}! and \verb!vline{j}! are for setting some hlines and vlines, respectively.
+Their values are the same as options \verb!hliness! and \verb!vlines!:
 
 \begin{demohigh}
 \begin{tblr}{
@@ -775,7 +693,25 @@
 \end{tblr}
 \end{demohigh}
 
-At last we show the usage of \verb!text! key by the following example%
+You can use \verb!X!, \verb!Y!, \verb!Z! to denote the last three childs, respectively.
+It is especially useful when you are writing long tables:
+
+\begin{demohigh}
+\begin{tblr}{
+ hline{1,Z} = {2pt},
+ hline{2,Y} = {1pt},
+ hline{3-X} = {dashed},
+}
+ Alpha   & Beta  & Gamma   & Delta   \\
+ Epsilon & Zeta  & Eta     & Theta   \\
+ Iota    & Kappa & Lambda  & Mu      \\
+ Nu      & Xi    & Omicron & Pi      \\
+ Rho     & Sigma & Tau     & Upsilon \\
+ Phi     & Chi   & Psi     & Omega   \\
+\end{tblr}
+\end{demohigh}
+
+Now we show the usage of \verb!text! key by the following example%
 \footnote{Code from \url{https://tex.stackexchange.com/questions/603023/tabularray-and-tabularx-column-separator}.}:
 
 \begin{demohigh}
@@ -795,10 +731,89 @@
 
 You need to load \verb!chemmacros! package for the \verb!\ch! command.
 
+\subsection{Hlines and Vlines in Old Interfaces}
+
+The \verb!\hline! command has an optional argument which accepts key-value options.
+The available keys are described in Table \ref{key:hvline}.
+
+\begin{demohigh}
+\begin{tblr}{llll}
+\hline
+ Alpha   & Beta  & Gamma  & Delta \\
+\hline[dashed]
+ Epsilon & Zeta  & Eta    & Theta \\
+\hline[dotted]
+ Iota    & Kappa & Lambda & Mu    \\
+\hline[2pt,blue5]
+\end{tblr}
+\end{demohigh}
+
+The \verb!\cline! command also has an optional argument which is the same as \verb!\hline!.
+
+\begin{demohigh}
+\begin{tblr}{llll}
+\cline{1-4}
+ Alpha   & Beta  & Gamma  & Delta \\
+\cline[dashed]{1,3}
+ Epsilon & Zeta  & Eta    & Theta \\
+\cline[dashed]{2,4}
+ Iota    & Kappa & Lambda & Mu    \\
+\cline[2pt,blue5]{-}
+\end{tblr}
+\end{demohigh}
+
+You can use child selectors in the mandatory argument of \verb!\cline!.
+
+\begin{demohigh}
+\begin{tblr}{llll}
+\cline{1-4}
+ Alpha   & Beta  & Gamma  & Delta \\
+\cline[dashed]{odd}
+ Epsilon & Zeta  & Eta    & Theta \\
+\cline[dashed]{even}
+ Iota    & Kappa & Lambda & Mu    \\
+\cline[2pt,blue5]{-}
+\end{tblr}
+\end{demohigh}
+
+Commands \verb!\SetHline! combines the usages of \verb!\hline! and \verb!\cline!:
+ 
+\begin{demohigh}
+\begin{tblr}{llll}
+\SetHline{1-3}{blue5,1pt}
+ Alpha   & Beta  & Gamma  & Delta \\
+ Epsilon & Zeta  & Eta    & Theta \\
+ Iota    & Kappa & Lambda & Mu    \\
+\SetHline{2-4}{teal5,1pt}
+\end{tblr}
+\end{demohigh}
+
+\begin{demohigh}
+\begin{tblr}{llll}
+\SetHline[1]{1-3}{blue5,1pt}
+\SetHline[2]{1-3}{azure5,1pt}
+ Alpha   & Beta  & Gamma  & Delta \\
+ Epsilon & Zeta  & Eta    & Theta \\
+ Iota    & Kappa & Lambda & Mu    \\
+\SetHline[1]{2-4}{teal5,1pt}
+\SetHline[2]{2-4}{green5,1pt}
+\end{tblr}
+\end{demohigh}
+
+In fact, table command \verb!\SetHline[<index>]{<columns>}{<styles>}! at the beginning of row \verb!i!
+is the same as table option \verb!hline{i}={<index>}{<columns>}{<styles>}!.
+
+Also, table command \verb!\SetHlines[<index>]{<columns>}{<styles>}! at the beginning of some row
+is the same as table option \verb!hlines={<index>}{<columns>}{<styles>}!.
+
+The usages of table commands \verb!\vline!, \verb!\rline!, \verb!\SetVline!, \verb!\SetVlines!
+are similar to those of \verb!\hline!, \verb!\cline!, \verb!\SetHline!, \verb!\SetHlines!, respectively.
+But normally you don't need to use them.
+
 \section{Cells and Spancells}
 
 All available keys for cells are described in Table \ref{key:cell} and Table \ref{key:cellspan}.
-\nopagebreak
+
 \begin{spectblr}[
   caption = {Keys for the Content of Cells},
   label = {key:cell},
@@ -812,13 +827,13 @@
     & vertical alignment: \V{t} (top), \V{m} (middle), \V{b} (bottom),
       \V{h} (head) or \V{f} (foot)
     & \V{t} \\
-  \underline{\K{wd}} & width dimension & None \\
-  \underline{\K{bg}} & background color name & None \\
-  \K{fg}    & foreground color name & None \\
-  \K{font}  & font commands & None \\
-  \K{preto} & prepend text to the cell & None \\
-  \K{appto} & append text to the cell & None \\
-  \K{cmd}   & execute command for the cell text & None \\
+  \underline{\K{wd}} & width dimension & \None \\
+  \underline{\K{bg}} & background color name & \None \\
+  \K{fg}    & foreground color name & \None \\
+  \K{font}  & font commands & \None \\
+  \K{preto} & prepend text to the cell & \None \\
+  \K{appto} & append text to the cell & \None \\
+  \K{cmd}   & execute command for the cell text & \None \\
 \end{spectblr}
 \vspace{-2em}
 \begin{spectblr}[
@@ -830,6 +845,8 @@
   \K{c} & number of columns the cell spans & 1 \\
 \end{spectblr}
 
+\subsection{Cells and Spancells in New Interfaces}
+
 Option \verb!cells! is for setting all cells.
 \nopagebreak
 \begin{demohigh}
@@ -862,6 +879,62 @@
 \end{tblr}
 \end{demohigh}
 
+\subsection{Cells and Spancells in Old Interfaces}
+
+The \verb!\SetCell! command has a mandatory argument for setting the styles of current cell.
+The available keys are described in Table \ref{key:cell}.
+
+\begin{demohigh}
+\begin{tblr}{llll}
+\hline[1pt]
+ Alpha   & \SetCell{bg=teal2,fg=white} Beta & Gamma \\
+\hline
+ Epsilon & Zeta & \SetCell{r,font=\scshape} Eta \\
+\hline
+ Iota    & Kappa & Lambda \\
+\hline[1pt]
+\end{tblr}
+\end{demohigh}
+
+The \verb!\SetCell! command also has an optional argument for setting the multispan of current cell.
+The available keys are described in Table \ref{key:cellspan}.
+
+\begin{demohigh}
+\begin{tblr}{|X|X|X|X|X|X|}
+\hline
+ Alpha & Beta & Gamma & Delta & Epsilon & Zeta \\
+\hline
+ \SetCell[c=2]{c} Eta & 2-2
+              & \SetCell[c=2]{c} Iota & 2-4
+                              & \SetCell[c=2]{c} Lambda  & 2-6 \\
+\hline
+ \SetCell[c=3]{c} Nu & 3-2 & 3-3
+                      & \SetCell[c=3]{c} Pi & 3-5 & 3-6   \\
+\hline
+ \SetCell[c=6]{c} Tau & 4-2 & 4-3 & 4-4 & 4-5 & 4-6 \\
+\hline
+\end{tblr}
+\end{demohigh}
+
+\begin{demohigh}
+\begin{tblr}{|X|X|X|X|X|X|}
+\hline
+ Alpha & Beta    & Gamma   & Delta & Epsilon & Zeta \\
+\hline
+ \SetCell[r=2]{m} Eta
+       & Theta   & Iota    & Kappa & Lambda  & \SetCell[r=2]{m} Mu  \\
+\hline
+ Nu    & Xi      & Omicron & Pi    & Rho     & Sigma \\
+\hline
+\end{tblr}
+\end{demohigh}
+
+In fact, table command \verb!\SetCell[<span>]{<styles>}! at the beginning of cell at row \verb!i!
+and column \verb!j! is the same as table option \verb!cell{i}{j}={<span>}{<styles>}!.
+
+Also, table command \verb!\SetCells[<span>]{<styles>}! at the beginning of some cell
+is the same as table option \verb!cells={<span>}{<styles>}!.
+
 \section{Rows and Columns}
 
 All available keys for rows and columns are described in Table \ref{key:row} and Table \ref{key:column}.
@@ -879,19 +952,19 @@
     & vertical alignment: \V{t} (top), \V{m} (middle), \V{b} (bottom),
       \V{h} (head) or \V{f} (foot)
     & \V{t} \\
-  \underline{\K{ht}} & height dimension & None \\
-  \underline{\K{bg}} & background color name & None \\
-  \K{fg} & foreground color name & None \\
-  \K{font} & font commands & None \\
+  \underline{\K{ht}} & height dimension & \None \\
+  \underline{\K{bg}} & background color name & \None \\
+  \K{fg} & foreground color name & \None \\
+  \K{font} & font commands & \None \\
   \K{abovesep} & set vertical space above the row & \V{2pt} \\
-  \K{abovesep+} & increase vertical space above the row & None \\
+  \K{abovesep+} & increase vertical space above the row & \None \\
   \K{belowsep} & set vertical space below the row & \V{2pt} \\
-  \K{belowsep+} & increase vertical space below the row & None \\
+  \K{belowsep+} & increase vertical space below the row & \None \\
   \K{rowsep} & set vertical space above and below the row & \V{2pt} \\
-  \K{rowsep+} & increase vertical space above and below the row & None \\
-  \K{preto} & prepend text to every cell (like \V{>} specifier in \K{rowspec}) & None \\
-  \K{appto} & append text to every cell (like \V{<} specifier in \K{rowspec}) & None \\
-  \K{cmd}   & execute command for every cell text & None \\
+  \K{rowsep+} & increase vertical space above and below the row & \None \\
+  \K{preto} & prepend text to every cell (like \V{>} specifier in \K{rowspec}) & \None \\
+  \K{appto} & append text to every cell (like \V{<} specifier in \K{rowspec}) & \None \\
+  \K{cmd}   & execute command for every cell text & \None \\
 \end{spectblr}
 \vspace{-2em}
 \begin{spectblr}[
@@ -907,30 +980,30 @@
     & vertical alignment: \V{t} (top), \V{m} (middle), \V{b} (bottom),
       \V{h} (head) or \V{f} (foot)
     & \V{t} \\
-  \underline{\K{wd}} & width dimension & None \\
-  \underline{\K{co}} & coefficient for the extendable column (\V{X} column) & None \\
-  \underline{\K{bg}} & background color name & None \\
-  \K{fg} & foreground color name & None \\
-  \K{font} & font commands & None \\
+  \underline{\K{wd}} & width dimension & \None \\
+  \underline{\K{co}} & coefficient for the extendable column (\V{X} column) & \None \\
+  \underline{\K{bg}} & background color name & \None \\
+  \K{fg} & foreground color name & \None \\
+  \K{font} & font commands & \None \\
   \K{leftsep} & set horizontal space to the left of the column & \V{6pt} \\
-  \K{leftsep+} & increase horizontal space to the left of the column & None \\
+  \K{leftsep+} & increase horizontal space to the left of the column & \None \\
   \K{rightsep} & set horizontal space to the right of the column & \V{6pt} \\
-  \K{rightsep+} & increase horizontal space to the right of the column & None \\
+  \K{rightsep+} & increase horizontal space to the right of the column & \None \\
   \K{colsep} & set horizontal space to both sides of the column & \V{6pt} \\
-  \K{colsep+} & increase horizontal space to both sides of the column & None \\
-  \K{preto} & prepend text to every cell (like \V{>} specifier in \K{colspec}) & None \\
-  \K{appto} & append text to every cell (like \V{<} specifier in \K{colspec}) & None \\
-  \K{cmd}   & execute command for every cell text & None \\
+  \K{colsep+} & increase horizontal space to both sides of the column & \None \\
+  \K{preto} & prepend text to every cell (like \V{>} specifier in \K{colspec}) & \None \\
+  \K{appto} & append text to every cell (like \V{<} specifier in \K{colspec}) & \None \\
+  \K{cmd}   & execute command for every cell text & \None \\
 \end{spectblr}
 
+\subsection{Rows and Columns in New Interfaces}
+
 Options \verb!rows! and \verb!columns! are for setting all rows and columns, respectively.
 \nopagebreak
 \begin{demohigh}
 \begin{tblr}{
- hlines,
- vlines,
- rows = {7mm},
- columns = {15mm,c},
+ hlines, vlines,
+ rows = {7mm}, columns = {15mm,c},
 }
  Alpha   & Beta  & Gamma   & Delta \\
  Epsilon & Zeta  & Eta     & Theta \\
@@ -967,17 +1040,16 @@
  Delta & Epsilon & Zeta  \\
  Eta   & Theta   & Iota  \\
  Kappa & Lambda  & Mu    \\
- Nu Xi Omikron & Pi Rho Sigma & Tau Upsilon Phi \\
+ Nu Xi Omicron & Pi Rho Sigma & Tau Upsilon Phi \\
 \end{tblr}
 \end{demohigh}
 
 The following example demonstrates the usages of
 \verb!abovesep!, \verb!belowsep!, \verb!leftsep!, \verb!rightsep! keys.
-\nopagebreak
+%\nopagebreak
 \begin{demohigh}
 \begin{tblr}{
- hlines,
- vlines,
+ hlines, vlines,
  rows = {abovesep=1pt,belowsep=5pt},
  columns = {leftsep=1pt,rightsep=5pt},
 }
@@ -999,8 +1071,110 @@
 \end{tblr}
 \end{demohigh}
 
-\section{The Whole Table}
+\subsection{Rows and Columns in Old Interfaces}
 
+The \verb!\SetRow! command has a mandatory argument for setting the styles of current row.
+The available keys are described in Table \ref{key:row}.
+
+\begin{demohigh}
+\begin{tblr}{llll}
+\hline[1pt]
+ \SetRow{azure8} Alpha & Beta & Gamma & Delta \\
+\hline
+ \SetRow{blue8,c} Epsilon & Zeta & Eta & Theta \\
+\hline
+ \SetRow{violet8} Iota & Kappa & Lambda & Mu \\
+\hline[1pt]
+\end{tblr}
+\end{demohigh}
+
+In fact, table command \verb!\SetRow{<styles>}! at the beginning of row \verb!i!
+is the same as table option \verb!row{i}={<styles>}!.
+
+Also, table command \verb!\SetRows{<styles>}! at the beginning of some row
+is the same as table option \verb!rows={<styles>}!.
+
+The usages of table commands \verb!\SetColumn! and \verb!\SetColumns!
+are similar to those of \verb!\SetRow! and \verb!\SetRows!, respectively.
+But normally you don't need to use them.
+
+\section{Colspec and Rowspec}
+
+Options \verb!colspec!/\verb!rowspec! are for setting column/row specifications
+with column/row type specifiers.
+
+\subsection{Colspec and Width}
+
+Option \verb!width! are for setting the width of the table with extendable columns.
+The following example demonstrates the usage of \verb!width! option.
+\nopagebreak
+\begin{demohigh}
+\begin{tblr}{width=0.8\textwidth, colspec={|l|X[2]|X[3]|X[-1]|}}
+ Alpha   & Beta  & Gamma  & Delta \\
+ Epsilon & Zeta  & Eta    & Theta \\
+ Iota    & Kappa & Lambda & Mu    \\
+\end{tblr}
+\end{demohigh}
+
+\subsection{Column Types}
+
+The \verb!tabularray! package has only one type of primitive column: the \verb!Q! column.
+Other types of columns are defined as \verb!Q! columns with some keys.
+
+\begin{codehigh}
+\NewColumnType{l}{Q[l]}
+\NewColumnType{c}{Q[c]}
+\NewColumnType{r}{Q[r]}
+\NewColumnType{t}[1]{Q[t,wd=#1]}
+\NewColumnType{m}[1]{Q[m,wd=#1]}
+\NewColumnType{b}[1]{Q[b,wd=#1]}
+\NewColumnType{h}[1]{Q[h,wd=#1]}
+\NewColumnType{f}[1]{Q[f,wd=#1]}
+\NewColumnType{X}[1][]{Q[co=1,#1]}
+\end{codehigh}
+
+\begin{demohigh}
+\begin{tblr}{|t{15mm}|m{15mm}|b{20mm}|}
+ Alpha   & Beta  & {Gamma\\Gamma} \\
+ Epsilon & Zeta  & {Eta\\Eta} \\
+ Iota    & Kappa & {Lambda\\Lambda} \\
+\end{tblr}
+\end{demohigh}
+
+Any new column type must be defined with \verb!\NewColumnType! command.
+It can have an optional argument when it's defined.
+
+\subsection{Row Types}
+
+The \verb!tabularray! package has only one type of primitive row: the \verb!Q! row.
+Other types of rows are defined as \verb!Q! rows with some keys.
+
+\begin{codehigh}
+\NewRowType{l}{Q[l]}
+\NewRowType{c}{Q[c]}
+\NewRowType{r}{Q[r]}
+\NewRowType{t}[1]{Q[t,ht=#1]}
+\NewRowType{m}[1]{Q[m,ht=#1]}
+\NewRowType{b}[1]{Q[b,ht=#1]}
+\NewRowType{h}[1]{Q[h,ht=#1]}
+\NewRowType{f}[1]{Q[f,ht=#1]}
+\end{codehigh}
+
+\begin{demohigh}
+\begin{tblr}{rowspec={|t{12mm}|m{10mm}|b{10mm}|}}
+ Alpha   & Beta  & {Gamma\\Gamma} \\
+ Epsilon & Zeta  & {Eta\\Eta} \\
+ Iota    & Kappa & {Lambda\\Lambda} \\
+\end{tblr}
+\end{demohigh}
+
+Any new row type must be defined with \verb!\NewRowType! command.
+It can have an optional argument when it's defined.
+
+\chapter{Extra Interfaces}
+
+\section{Table Specifications}
+
 All available keys for the whole table are described in Table \ref{key:table}.
 
 \begin{spectblr}[
@@ -1008,9 +1182,6 @@
   label = {key:table},
 ]{}
   Key & Description and Values & Initial Value \\
-  \K{rowspec} & set row specifications with row type specifiers & None \\
-  \K{colspec} & set column specifications with column type specifiers & None \\
-  \K{width} & width of the table with extendable columns & None \\
   \K{rulesep} & space between two hlines or vlines & \V{2pt} \\
   \K{stretch} & stretch ratio for struts added to cell text & \V{1} \\
   \K{abovesep} & set vertical space above every row & \V{2pt} \\
@@ -1023,16 +1194,6 @@
   \K{vspan} & vertical span algorithm: \V{default} or \V{even} & \V{default} \\
 \end{spectblr}
 
-The following example demonstrates the usage of \verb!width! key.
-\nopagebreak
-\begin{demohigh}
-\begin{tblr}{width=0.8\textwidth, colspec={|l|X[2]|X[3]|X[-1]|}}
- Alpha   & Beta  & Gamma  & Delta \\
- Epsilon & Zeta  & Eta    & Theta \\
- Iota    & Kappa & Lambda & Mu    \\
-\end{tblr}
-\end{demohigh}
-
 The following example shows that we can replace \verb!\doublerulesep! parameter with \verb!rulesep! key.
 \nopagebreak
 \begin{demohigh}
@@ -1158,6 +1319,80 @@
 \end{mytblr} Text
 \end{demohigh}
 
+If not giving the optional argument to \verb!\SetTblrInner! or \verb!\SetTblrOuter! command,
+we set the default specifications for \verb!tblr! environment.
+And different tabularray environments could have different default specifications.
+
+\section{New Table Commands}
+
+All commands which change the specifications of tables \textcolor{red3}{must} be defined with \verb!\NewTableCommand!.
+The following example demonstrates how to define a new table command:
+
+\begin{demohigh}
+\NewTableCommand\myhline{\hline[0.1em,red5]}
+\begin{tblr}{llll}
+\myhline
+ Alpha   & Beta  & Gamma   & Delta \\
+ Epsilon & Zeta  & Eta     & Theta \\
+ Iota    & Kappa & Lambda  & Mu    \\
+\myhline
+\end{tblr}
+\end{demohigh}
+
+\section{Expand Macros First}
+
+\verb!Tabularray! need to see every \verb!&! and \verb!\\! when splitting the table body
+with \verb!l3regex!. And you can not put cell text inside any table command defined with
+\verb!\NewTableCommand!. But you could use outer specification \verb!expand! to make \verb!tabularray!
+expand every occurrence of a specified macro \underline{once} before splitting the table body:
+
+\begin{demohigh}
+\def\tblrbody{
+ \hline
+  20 & 30 & 40 \\
+  50 & 60 & 70 \\
+ \hline
+}
+\begin{tblr}[expand=\tblrbody]{ccc}
+ \hline
+  AA & BB & CC \\
+  \tblrbody
+  DD & EE & FF \\
+  \tblrbody
+  GG & HH & II \\
+ \hline
+\end{tblr}
+\end{demohigh}
+
+With this \verb!expand! option, you can also use \verb!environ! package
+to define a new environment based on \verb!tblr! environment:
+
+\begin{demohigh}
+\NewEnviron{fancytblr}{
+ Before Text
+ \begin{tblr}[expand=\BODY]{hlines}
+   \BODY
+ \end{tblr}
+ After Text
+}
+\begin{fancytblr}
+  One   & Two   & Three \\
+  Four  & Five  & Six   \\
+  Seven & Eight & Nine  \\
+\end{fancytblr}
+\end{demohigh}
+
+\section{Use Verbatim Commands}
+
+With inner specification \verb!verb!, you can write \verb!\verb! commands in the cell text:
+
+\begin{demohigh}
+\begin{tblr}{hlines,verb}
+  20 & 30 & \verb!\hello{world}!40 \\
+  50 & \verb!\hello!60 & 70 \\
+\end{tblr}
+\end{demohigh}
+
 \section{Counters and Lengths}
 
 Counters \verb!rownum!, \verb!colnum!, \verb!rowcount!, \verb!colcount! can be used in cell text:
@@ -1214,16 +1449,18 @@
   remark{Source} = {Made up by myself. Made up by myself. Made up by myself.},
 ]{
   colspec = {XXX}, width = 0.85\linewidth,
-  row{odd} = {gray9}, row{even} = {brown9}, rowhead = 2, rowfoot = 1,
+  rowhead = 2, rowfoot = 1,
+  row{odd} = {gray9}, row{even} = {brown9},
+  row{1-2} = {purple7}, row{Z} = {blue7},
 }
 \hline
- \SetRow{purple7} Head & Head & Head \\
+ Head    & Head  & Head    \\
 \hline
- \SetRow{purple7} Head & Head & Head \\
+ Head    & Head  & Head    \\
 \hline
  Alpha   & Beta  & Gamma   \\
 \hline
- Epsilon & Zeta\TblrNote{a} & Eta \\
+ Epsilon & Zeta\TblrNote{a}       & Eta    \\
 \hline
  Iota    & Kappa\TblrNote{$\dag$} & Lambda \\
 \hline
@@ -1365,7 +1602,7 @@
 \hline
  Phi     & Chi   & Psi     \\
 \hline
- Alpha   & Beta  & Gamma\footnote{Hello}   \\
+ Alpha   & Beta  & Gamma   \\
 \hline
  Epsilon & Zeta  & Eta     \\
 \hline
@@ -1401,7 +1638,7 @@
 %\hline
 % Phi     & Chi   & Psi     \\
 \hline
- \SetRow{blue7} Foot & Foot & Foot \\
+ Foot    & Foot  & Foot    \\
 \hline
 \end{longtblr}
 
@@ -1431,16 +1668,18 @@
   remark{Source} = {Made up by myself. Made up by myself. Made up by myself.},
 ]{
   colspec = {XXX}, width = 0.85\linewidth,
-  row{odd} = {gray9}, row{even} = {brown9}, rowhead = 2, rowfoot = 1,
+  rowhead = 2, rowfoot = 1,
+  row{odd} = {gray9}, row{even} = {brown9},
+  row{1-2} = {purple7}, row{Z} = {blue7},
 }
 \hline
- \SetRow{purple7} Head & Head & Head \\
+ Head    & Head  & Head    \\
 \hline
- \SetRow{purple7} Head & Head & Head \\
+ Head    & Head  & Head    \\
 \hline
  Alpha   & Beta  & Gamma   \\
 \hline
- Epsilon & Zeta\TblrNote{a} & Eta \\
+ Epsilon & Zeta\TblrNote{a}       & Eta    \\
 \hline
  Iota    & Kappa\TblrNote{$\dag$} & Lambda \\
 \hline
@@ -1464,7 +1703,7 @@
 \hline
  Phi     & Chi   & Psi     \\
 \hline
- \SetRow{blue7} Foot & Foot & Foot \\
+ Foot    & Foot  & Foot    \\
 \hline
 \end{longtblr}
 \end{codehigh}
@@ -1489,33 +1728,43 @@
 
 \begin{spectblr}[
   caption = {Outer Specifications for Table Heads and Table Foots}
-]{}
+]{verb}
   Key Nama            & Key Description & Initial Value \\
   \V{headsep}         & vertical space between table head and table body & \V{6pt} \\
   \V{footsep}         & vertical space between table foot and table body & \V{6pt} \\
-  \V{presep}          & vertical space between table head and the above text & \texttt{1.5\string\bigskipamount} \\
-  \V{postsep}         & vertical space between table foot and the below text & \texttt{1.5\string\bigskipamount} \\
-  \V{theme}           & table theme (including settings for templates and styles) & None \\
-  \V{caption}         & table caption & None \\
-  \V{entry}           & short table caption to be put in List of Tables & None \\
-  \V{label}           & table label & None \\
-  \V{note\{<name>\}}   & table note with \V{<name>} as tag & None \\
-  \V{remark\{<name>\}} & table remark with \V{<name>} as tag & None \\
+  \V{presep}          & vertical space between table head and the above text & \verb!1.5\bigskipamount! \\
+  \V{postsep}         & vertical space between table foot and the below text & \verb!1.5\bigskipamount! \\
+  \V{theme}           & table theme (including settings for templates and styles) & \None \\
+  \V{caption}         & table caption & \None \\
+  \V{entry}           & short table caption to be put in List of Tables & \None \\
+  \V{label}           & table label & \None \\
+  \V{note\{<name>\}}   & table note with \V{<name>} as tag & \None \\
+  \V{remark\{<name>\}} & table remark with \V{<name>} as tag & \None \\
 \end{spectblr}
 
+If you write \verb!entry=none!, \verb!tabularray! package will not add an entry in List of Tables.
+Therefore \verb!caption=text,entry=none! is similar to \verb!\caption[]{text}! in \verb!longtable!.
+
+If you write \verb!label=none!, \verb!tabularray! package will not step \verb!table! counter,
+and set the \verb!caption-tag! and \verb!caption-sep! elements (see below) to empty.
+Therefore \verb!caption=text,entry=none,label=none! is similar to \verb!\caption*{text}!
+in \verb!longtable!, except for the counter.
+
 \section{Customize Templates}
 
 \subsection{Overview of Templates}
 
-The template system for table heads and table foots in \verb!tabularray! is largely inspired by \verb!beamer!,
-\verb!caption! and \verb!longtable! packages. You can use \verb!\DefTblrTemplate! command to define and
-modify templates, and \verb!\SetTblrTemplate! command to choose default templates. In defining templates,
+The template system for table heads and table foots in \verb!tabularray! is largely inspired
+by \verb!beamer!, \verb!caption! and \verb!longtable! packages. For elements in Table \ref{tblr:element},
+you can use \verb!\DefTblrTemplate! to define and modify templates,
+and use \verb!\SetTblrTemplate! to choose default templates. In defining templates,
 you can include other templates with \verb!\UseTblrTemplate! and \verb!\ExpTblrTemplate! commands.
 
 \begin{spectblr}[
-  caption = {Templates for Table Heads and Table Foots}
+  caption = {Elements for Table Heads and Table Foots},
+  label = {tblr:element},
 ]{}
-  Template Name    & Template Description \\
+  Element Name     & Element Description and Default Template \\
   \V{contfoot-text}& continuation text in the foot, normally ``Continued on next page'' \\
   \V{contfoot}     & continuation paragraph in the foot, normally including \V{contfoot-text} template \\
   \V{conthead-text}& continuation text in the head, normally ``(Continued)'' \\
@@ -1542,11 +1791,14 @@
   \V{foot}         & setting all of \V{firstfoot}, \V{middlefoot} and \V{lastfoot} \\
 \end{spectblr}
 
-A template which only includes short text is called a \underline{sub template}.
-Normally there is one \verb!-! in the name of a sub template.
-A template which includes one or more paragraphs is called a \underline{main template}.
-Normally there isn't any \verb!-! in the name of a main template.
+An element which only includes short text is called a \underline{sub element}.
+Normally there is one \verb!-! in the name of a sub element.
+An element which includes one or more paragraphs is called a \underline{main element}.
+Normally there isn't any \verb!-! in the name of a main element.
 
+For each of the above elements, two templates \verb!normal! and \verb!empty! are always defined.
+You can select one of them with \verb!\SetTblrTemplate! command.
+
 \subsection{Continuation Templates}
 
 Let us have a look at the code for defining templates of continuation text first:
@@ -1560,7 +1812,7 @@
 
 In the above code, command \verb!\DefTblrTemplate! defines the templates with name \verb!normal!,
 and then command \verb!\SetTblrTemplate! sets the templates with name \verb!normal! as default.
-The \verb!normal! template is always defined and set as default for any template element in \verb!tabularray!.
+The \verb!normal! template is always defined and set as default for any element in \verb!tabularray!.
 Therefore you had better use another name when defining new templates.
 
 If you use \verb!default! as template name in \verb!\DefTblrTemplate!,
@@ -1574,8 +1826,8 @@
 
 You may modify the code to customize continuation text to fit your needs.
 
-The \verb!contfoot! and \verb!conthead! templates normally
-include their sub templates with \verb!\UseTblrTemplate! commands.
+The templates for \verb!contfoot! and \verb!conthead! normally
+include the templates of their sub elements with \verb!\UseTblrTemplate! commands.
 But you can also handle user settings such as horizontal alignment here.
 
 \begin{codehigh}
@@ -1688,19 +1940,10 @@
 
 \section{Change Styles}
 
-You may change the styles of template elements.
-
-\begin{codehigh}
-\SetTblrStyle{firsthead}{font=\bfseries}
-\SetTblrStyle{firstfoot}{fg=blue2}
-\SetTblrStyle{middlefoot}{\itshape}
-\SetTblrStyle{caption-tag}{red2}
-\end{codehigh}
-
 All available keys for template elements are described in Table \ref{key:element}.
 
 \begin{spectblr}[
-  caption = {Keys for the Styles of Template Elements},
+  caption = {Keys for the Styles of Elements},
   label = {key:element},
   remark{Note} = {In most cases, you can omit the underlined key names and write only their values.
                   The keys \K{halign}, \K{indent} and \K{hang} are only for main templates.}
@@ -1713,9 +1956,18 @@
   \K{hang}               & hangindent value \\
 \end{spectblr}
 
+You may change the styles of elements with \verb!\SetTblrStyle! command:
+
+\begin{codehigh}
+\SetTblrStyle{firsthead}{font=\bfseries}
+\SetTblrStyle{firstfoot}{fg=blue2}
+\SetTblrStyle{middlefoot}{\itshape}
+\SetTblrStyle{caption-tag}{red2}
+\end{codehigh}
+
 When you write \verb!\UseTblrTemplate{element}{default}! in defining a template,
-beside including the code of template \verb!element!, the foreground color and font commands
-of the template \verb!element! will be set up automatically.
+beside including template code of the \verb!element!, the foreground color and font commands
+of the \verb!element! will be set up automatically.
 In contrast, \verb!\ExpTblrTemplate{element}{default}! will only include template code.
 
 \section{Define Themes}
@@ -1736,14 +1988,39 @@
 After defining the theme \verb!fancy!, you can use it
 by writing \verb!theme=fancy! in the optional argument of \verb!longtblr! environment.
 
+\section{Control Page Breaks}
+
+Just like \verb!longtable! package, inside \verb!longtblr! environment,
+you can use \verb!\\*! or \verb!\nopagebreak! to prohibit a page break,
+and use \verb!\pagebreak! to force a page break.
+
+\section{Floatable Tall Tables}
+
+There is also a \verb!talltblr! environment as an alternative to \verb!threeparttable! environment.
+It can not cross multiple pages, but it can be put inside \verb!table! environment.
+
+\begin{demohigh}
+TEXT\begin{talltblr}[
+  caption = {Long Long Long Long Tabular},
+  entry = {Short Caption},
+  label = {tblr:tall},
+  note{a} = {It is the first footnote.},
+  note{$\dag$} = {It is the second long long long long long long footnote.},
+]{
+  colspec = {XXX}, width = 0.5\linewidth, hlines,
+}
+  Alpha   & Beta  & Gamma \\
+  Epsilon & Zeta  & Eta\TblrNote{a} \\
+  Iota    & Kappa & Lambda\TblrNote{$\dag$} \\
+\end{talltblr}TEXT
+\end{demohigh}
+
 \chapter{Use Some Libraries}
 
-\mywarning{chapter}
-
 The \verb!tabularray! package emulates or fixes some commands in other packages.
 To avoid potential conflict, you need to enable them with \verb!\UseTblrLibrary! command.
 
-\section{Library \V{booktabs}}
+\section{Library \texttt{booktabs}}
 
 When you write \verb!\UseTblrLibrary{booktabs}!,
 \verb!tabularray! package will define commands \verb!\toprule!, \verb!\midrule!,
@@ -1764,6 +2041,7 @@
 \end{demohigh}
 
 At this moment, \verb!trim! options for \verb!\cmidrule! command are not supported.
+(As a workaround, you may insert an empty column to separate two \verb!\cmidrule!'s.)
 But rule colors are possible just like \verb!\hline! and \verb!\cline! commands.
 
 \begin{demohigh}
@@ -1780,7 +2058,7 @@
 \end{tblr}
 \end{demohigh}
 
-\section{Library \V{diagbox}}
+\section{Library \texttt{diagbox}}
 
 When writing \verb!\UseTblrLibrary{diagbox}! in the preamble of the document,
 \verb!tabularray! package loads \verb!diagbox! package,
@@ -1815,48 +2093,70 @@
 \end{tblr}$
 \end{demohigh}
 
-\section{Library \V{siunitx}}
+\section{Library \texttt{siunitx}}
 
 When writing \verb!\UseTblrLibrary{siunitx}! in the preamble of the document,
 \verb!tabularray! package loads \verb!siunitx! package,
-and defines \verb!S! column for \verb!tblr! environment.
+and defines \verb!S! column as \verb!Q! column with \verb!si! key.
 
 \begin{demohigh}
 \begin{tblr}{
   hlines, vlines,
   colspec={
-    S[table-format=2.2]
-    S[table-format=2.2]
-    S[table-format=2.2]
+    S[table-format=3.2]
+    S[table-format=3.2]
+    S[table-format=3.2]
   }
 }
  {{{Head}}} & {{{Head}}} & {{{Head}}} \\
-    11      &    11      &    11      \\
+   111      &   111      &   111      \\
      2.1    &     2.2    &     2.3    \\
     33.11   &    33.22   &    33.33   \\
 \end{tblr}
 \end{demohigh}
 
+\begin{demohigh}
+\begin{tblr}{
+  hlines, vlines,
+  colspec={
+    Q[si={table-format=3.2},c]
+    Q[si={table-format=3.2},c]
+    Q[si={table-format=3.2},c]
+  }
+}
+ {{{Head}}} & {{{Head}}} & {{{Head}}} \\
+   111      &   111      &   111      \\
+     2.1    &     2.2    &     2.3    \\
+    33.11   &    33.22   &    33.33   \\
+\end{tblr}
+\end{demohigh}
+
 Note that you need to use \underline{triple} pairs of braces to guard non-numeric cells.
-If you need to apply other specifications for the \verb!S! columns,
-you need to move \verb!siunitx! options into \verb!si! keys of the \verb!Q! columns.
 
+Also you must use \verb!l!, \verb!c! or \verb!r! to set horizontal alignment for non-numeric cells:
+
 \begin{demohigh}
 \begin{tblr}{
-  hlines, vlines,
+  hlines, vlines, columns={6em},
   colspec={
-    Q[si={table-format=2.2},blue7]
-    Q[si={table-format=2.2},teal7]
-    Q[si={table-format=2.2},purple7]
+    Q[si={table-format=3.2,table-number-alignment=left},l,blue7]
+    Q[si={table-format=3.2,table-number-alignment=center},c,teal7]
+    Q[si={table-format=3.2,table-number-alignment=right},r,purple7]
   }
 }
  {{{Head}}} & {{{Head}}} & {{{Head}}} \\
-    11      &    11      &    11      \\
+   111      &   111      &   111      \\
      2.1    &     2.2    &     2.3    \\
     33.11   &    33.22   &    33.33   \\
 \end{tblr}
 \end{demohigh}
 
+Both \verb!S! and \verb!s! columns are supported. In fact, These two columns are defined as follows:
+\begin{codehigh}
+\NewColumnType{S}[1][]{Q[si={##1},c]}
+\NewColumnType{s}[1][]{Q[si={##1},c,cmd=\TblrUnit]}
+\end{codehigh}
+
 \chapter{The Source Code}
 
 %\CodeHigh{lite}

Modified: trunk/Master/texmf-dist/tex/latex/tabularray/tabularray.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tabularray/tabularray.sty	2021-08-01 20:37:02 UTC (rev 60139)
+++ trunk/Master/texmf-dist/tex/latex/tabularray/tabularray.sty	2021-08-01 20:37:16 UTC (rev 60140)
@@ -12,7 +12,7 @@
 
 \NeedsTeXFormat{LaTeX2e}
 \RequirePackage{expl3}
-\ProvidesExplPackage{tabularray}{2021-07-01}{2021L}
+\ProvidesExplPackage{tabularray}{2021-08-01}{2021M}
   {Typeset tabulars and arrays with LaTeX3}
 
 \RequirePackage{xparse}
@@ -359,6 +359,7 @@
 \__tblr_data_new_key:nnn { row } { @row-foot }   { dim }
 \__tblr_data_new_key:nnn { row } { @row-upper }  { dim }
 \__tblr_data_new_key:nnn { row } { @row-lower }  { dim }
+\__tblr_data_new_key:nnn { row } { break }       { int }
 
 \int_new:N \g__tblr_data_column_key_count_int
 \__tblr_data_new_key:nnn { column } { width }       { dim }
@@ -858,12 +859,30 @@
       }
   }
 
+\tl_new:N \l__tblr_child_from_tl
+\tl_new:N \l__tblr_child_to_tl
+
 \cs_new_protected_nopar:Npn \__tblr_get_childs_normal_aux:w #1 - #2 \scan_stop
   {
-    \int_step_inline:nnn {#1} {#2}
+    \__tblr_child_name_to_index:nN {#1} \l__tblr_child_from_tl
+    \__tblr_child_name_to_index:nN {#2} \l__tblr_child_to_tl
+    \int_step_inline:nnn { \l__tblr_child_from_tl } { \l__tblr_child_to_tl }
       { \clist_put_right:Nn \l_tblr_childs_clist {##1} }
   }
 
+\regex_const:Nn \c__tblr_child_name_regex { ^ [X-Z] $ }
+
+%% Convert X, Y, Z to the indexes of the last three childs, respectively
+\cs_new_protected_nopar:Npn \__tblr_child_name_to_index:nN #1 #2
+  {
+    \regex_match:NnTF \c__tblr_child_name_regex {#1}
+      {
+        \tl_set:Nx #2
+          { \int_eval:n { \l_tblr_childs_total_tl + \int_from_alph:n {#1} - 26 } }
+      }
+      { \tl_set:Nx #2 { #1 } }
+  }
+
 %%% --------------------------------------------------------
 %%  \section{New Table Commands}
 %%% --------------------------------------------------------
@@ -929,6 +948,20 @@
     \int_set:Nn \c at colnum {#2}
   }
 
+%% Table commands are defined only inside tblr environments,
+%% but some packages such as csvsimple need to use them outside tblr environments,
+%% therefore we define some of them first here.
+\ProvideDocumentCommand \SetHlines  { o m m } {}
+\ProvideDocumentCommand \SetHline   { o m m } {}
+\ProvideDocumentCommand \SetVlines  { o m m } {}
+\ProvideDocumentCommand \SetVline   { o m m } {}
+\ProvideDocumentCommand \SetCells   { o m } {}
+\ProvideDocumentCommand \SetCell    { o m } {}
+\ProvideDocumentCommand \SetRows    { o m } {}
+\ProvideDocumentCommand \SetRow     { o m } {}
+\ProvideDocumentCommand \SetColumns { o m } {}
+\ProvideDocumentCommand \SetColumn  { o m } {}
+
 %%% --------------------------------------------------------
 %%> \section{New Content Commands}
 %%% --------------------------------------------------------
@@ -1958,8 +1991,9 @@
     abovesep+ .code:n = \__tblr_row_gadd_dimen:ne { abovesep } { \dim_eval:n {#1} },
     belowsep+ .code:n = \__tblr_row_gadd_dimen:ne { belowsep } { \dim_eval:n {#1} },
     rowsep+   .meta:n = { abovesep+ = #1, belowsep+ = #1},
-    nobreak   .code:n = \__tblr_prop_gput:nxx { row }
-                          { [\int_eval:n {\c at rownum - 1}] / nobreak } { true },
+    break     .code:n = \__tblr_row_gput:nn { break } {#1},
+    pagebreak   .meta:n = { break = 1 },
+    nopagebreak .meta:n = { break = -1 },
     unknown   .code:n = \__tblr_row_unknown_key:V \l_keys_key_str,
   }
 
@@ -2028,6 +2062,16 @@
   }
 \cs_generate_variant:Nn \__tblr_row_unknown_key:n { V }
 
+\NewTableCommand \pagebreak
+  {
+    \tblr_set_row:nn {} { break = 1 }
+  }
+
+\NewTableCommand \nopagebreak
+  {
+    \tblr_set_row:nn {} { break = -1 }
+  }
+
 %%% --------------------------------------------------------
 %%  \section{Column Types and Row Types}
 %%% --------------------------------------------------------
@@ -2357,6 +2401,8 @@
 \NewTblrEnviron { tblr }
 \NewTblrEnviron { longtblr }
 \SetTblrOuter [ longtblr ] { long }
+\NewTblrEnviron { talltblr }
+\SetTblrOuter [ talltblr ] { tall }
 
 \tl_new:N \l__tblr_env_name_tl
 \bool_new:N \l__tblr_math_mode_bool
@@ -2378,16 +2424,16 @@
     \int_gincr:N \g_tblr_level_int
     \__tblr_clear_prop_lists:
     \__tblr_clear_spec_lists:
-    \__tblr_enable_table_commands:
-    \LogTblrTracing { step = split ~ table}
-    \__tblr_split_table:n {#3}
-    \LogTblrTracing { command }
     \LogTblrTracing { step = init ~ table ~ outer ~ spec}
     \__tblr_init_table_outer_spec:
-    \LogTblrTracing { outer }
     \LogTblrTracing { step = parse ~ table ~ options }
     \__tblr_parse_table_option:n {#1}
+    \LogTblrTracing { outer }
     \LogTblrTracing { option }
+    \__tblr_enable_table_commands:
+    \LogTblrTracing { step = split ~ table}
+    \__tblr_split_table:n {#3}
+    \LogTblrTracing { command }
     \bool_if:NT \g__tblr_use_intarray_bool { \__tblr_init_table_data: }
     \LogTblrTracing { step = init ~ table ~ inner ~ spec}
     \__tblr_init_table_inner_spec:
@@ -2439,35 +2485,54 @@
     \regex_replace_all:NVN \c__tblr_remove_braces_regex \c__tblr_remove_braces_tl #1
   }
 
+\tl_new:N \l__tblr_body_tl
+\tl_new:N \l__tblr_expand_tl
+\seq_new:N \l__tblr_lines_seq
+
+%% Expand every occurrence of the specified macro once
+%% #1: table content; #2: macro to be expanded
+\cs_new_protected:Npn \__tblr_expand_table_body:nN #1 #2
+  {
+    \tl_clear:N \l__tblr_body_tl
+    \cs_set_protected:Npn \__tblr_expand_table_body_aux:w ##1 #2
+      {
+        \tl_put_right:Nn \l__tblr_body_tl {##1}
+        \peek_meaning:NTF \q_stop
+          { \use_none:n }
+          { \exp_last_unbraced:NV \__tblr_expand_table_body_aux:w #2 }
+      }
+    \__tblr_expand_table_body_aux:w #1 #2 \q_stop
+  }
+
 %% Split table content to cells and store them
 %% #1: table content
-
-\seq_new:N \l_tblr_lines_seq
-
 \cs_new_protected:Npn \__tblr_split_table:n #1
   {
+    \tl_set:Nx \l__tblr_expand_tl { \__tblr_spec_item:nn { outer } { expand } }
+    \tl_set:Nx \l__tblr_expand_tl { \tl_head:N \l__tblr_expand_tl }
+    \tl_if_empty:NTF \l__tblr_expand_tl
+      { \tl_set:Nn \l__tblr_body_tl {#1} }
+      { \exp_args:NnV \__tblr_expand_table_body:nN {#1} \l__tblr_expand_tl }
     \int_zero:N \c at rowcount
     \int_zero:N \c at colcount
-    \__tblr_split_table_to_lines:nN { #1 } \l_tblr_lines_seq
-    \__tblr_split_lines_to_cells:N \l_tblr_lines_seq
+    \__tblr_split_table_to_lines:NN \l__tblr_body_tl \l__tblr_lines_seq
+    \__tblr_split_lines_to_cells:N \l__tblr_lines_seq
   }
 
 %% Split table content to a sequence of lines
-%% #1: table content, #2: resulting sequence of lines
-\cs_new_protected:Npn \__tblr_split_table_to_lines:nN #1 #2
+%% #1: tl with table contents, #2: resulting sequence of lines
+\cs_new_protected:Npn \__tblr_split_table_to_lines:NN #1 #2
   {
-    \tl_set:Nn \l_tmpa_tl { #1 }
-    \__tblr_insert_braces:N \l_tmpa_tl
-    \seq_set_split:NnV \l_tmpa_seq { \\ } \l_tmpa_tl
+    \__tblr_insert_braces:N #1
+    \seq_set_split:NnV \l_tmpa_seq { \\ } #1
     \seq_clear:N #2
     \seq_map_inline:Nn \l_tmpa_seq
       {
         \tl_if_head_eq_meaning:nNTF {##1} *
           {
-            \tl_set:Nn \l__tblr_b_tl { \SetRow{nobreak} }
+            \tl_set:Nn \l__tblr_b_tl { \SetRow { break = -1 } }
             \tl_set:Nx \l__tblr_c_tl { \tl_tail:n {##1} }
             \tl_trim_spaces:N \l__tblr_c_tl %% Ignore spaces between * and [dimen]
-            \tl_log:N \l__tblr_c_tl
             \tl_if_head_eq_meaning:VNT \l__tblr_c_tl [
               {
                 \tl_put_right:Nn \l__tblr_b_tl { \RowBefore at AddBelowSep }
@@ -2699,6 +2764,8 @@
     @vline-count = 0,
   }
 
+\tl_new:N \l__tblr_inner_spec_verb_tl
+
 \cs_new_protected:Npn \__tblr_init_table_inner_spec:
   {
     \prop_map_inline:Nn \g__tblr_initial_table_prop
@@ -2745,6 +2812,7 @@
         \__tblr_spec_gput:nen { vline }
           { [\int_eval:n { \c at colcount + 1}] / ##1 } {##2}
       }
+    \tl_clear:N \l__tblr_inner_spec_verb_tl
     \keys_set:nv { tblr } { l__tblr_default_ \l__tblr_env_name_tl _inner_tl }
   }
 
@@ -2755,7 +2823,7 @@
 \clist_new:N \g__tblr_table_known_keys_clist
 \clist_gset:Nn \g__tblr_table_known_keys_clist
   {
-    colspec, rowspec, width, hspan, vspan, stretch,
+    colspec, rowspec, width, hspan, vspan, stretch, verb,
     column, row, cell, vline, hline, columns, rows, cells, vlines, hlines,
     leftsep, rightsep, colsep, abovesep, belowsep, rowsep, rulesep,
     rowhead, rowfoot,
@@ -2769,6 +2837,8 @@
     hspan .code:n = \__tblr_keys_gput:nn { hspan } {#1},
     vspan .code:n = \__tblr_keys_gput:nn { vspan } {#1},
     stretch .code:n = \__tblr_keys_gput:nn { stretch } {#1},
+    verb   .tl_set:N = \l__tblr_inner_spec_verb_tl,
+    verb  .default:n = lite,
     columns .code:n = \__tblr_set_every_column_aux:n {#1},
     rows    .code:n = \__tblr_set_every_row_aux:n {#1},
     cells   .code:n = \__tblr_set_every_cell_aux:n {#1},
@@ -2851,7 +2921,8 @@
 
 \keys_define:nn { tblr-outer }
   {
-    long    .code:n = \__tblr_outer_gput_spec:nn { long } {true},
+    long    .code:n = \__tblr_outer_gput_spec:nn { long } { true },
+    tall    .code:n = \__tblr_outer_gput_spec:nn { tall } { true },
     halign  .code:n = \__tblr_outer_gput_spec:nn { halign } {#1},
     valign  .code:n = \__tblr_outer_gput_spec:nn { valign } {#1},
     l       .meta:n = { halign = l },
@@ -2860,6 +2931,7 @@
     t       .meta:n = { valign = t },
     m       .meta:n = { valign = m },
     b       .meta:n = { valign = b },
+    expand  .code:n = \__tblr_outer_gput_spec:nn { expand } {#1},
     headsep .code:n = \__tblr_outer_gput_spec:nn { headsep } {#1},
     footsep .code:n = \__tblr_outer_gput_spec:nn { footsep } {#1},
     presep  .code:n = \__tblr_outer_gput_spec:nn { presep }  {#1},
@@ -3252,7 +3324,11 @@
             \seq_map_variable:NNn \l_tmpa_seq \l_tmpa_tl
               {
                 \__tblr_remove_braces:N \l_tmpa_tl
-                \hbox_set:Nn \l_tmpa_box { \l__tblr_f_tl \l_tmpa_tl }
+                \hbox_set:Nn \l_tmpa_box
+                  {
+                    \l__tblr_f_tl
+                    \__tblr_rescan_cell_tokens:N \l_tmpa_tl
+                  }
                 \tl_set:Nx \l__tblr_w_tl
                   { \dim_max:nn { \l__tblr_w_tl } { \box_wd:N \l_tmpa_box } }
               }
@@ -3267,8 +3343,8 @@
 \cs_new_protected:Npn \__tblr_get_vcell_and_sizes:NN #1 #2
   {
     \group_begin:
-    \vbox_set_top:Nn \l_tmpa_box { \__tblr_make_vcell_text:nN #1 #2 }
-    \vbox_set:Nn \l_tmpb_box { \__tblr_make_vcell_text:nN #1 #2 }
+    \vbox_set_top:Nn \l_tmpa_box { \__tblr_make_vcell_text:NN #1 #2 }
+    \vbox_set:Nn \l_tmpb_box { \__tblr_make_vcell_text:NN #1 #2 }
     \dim_gset:Nn \g__tblr_cell_wd_dim { \box_wd:N \l_tmpb_box }
     \dim_gset:Nn \g__tblr_cell_ht_dim
       { \box_ht:N \l_tmpb_box + \box_dp:N \l_tmpb_box }
@@ -3312,7 +3388,7 @@
 
 %% #1: cell text; #2: box width
 %% All halign commands are defined at the beginning of the file
-\cs_new_protected:Npn \__tblr_make_vcell_text:nN #1 #2
+\cs_new_protected:Npn \__tblr_make_vcell_text:NN #1 #2
   {
     \dim_set:Nn \tex_hsize:D { #2 }
     \@arrayparboxrestore
@@ -3319,10 +3395,23 @@
     \cs:w __tblr_halign_command_ \g__tblr_cell_halign_tl : \cs_end:
     \mode_leave_vertical:
     \box_use:N \l__tblr_strut_ht_box
-    \bool_if:NTF \l__tblr_math_mode_bool { $#1$ } { #1 }
+    \bool_if:NTF \l__tblr_math_mode_bool
+      { $#1$ }
+      { \__tblr_rescan_cell_tokens:N #1 }
     \box_use:N \l__tblr_strut_dp_box
   }
 
+\cs_new_protected:Npn \__tblr_rescan_cell_tokens:N #1
+  {
+    \tl_if_empty:NTF \l__tblr_inner_spec_verb_tl
+      { #1 }
+      {
+        \regex_replace_all:nnN { . } { \c{string} \0 } #1
+        \tl_set:Nx #1 { #1 }
+        \exp_args:NV \tex_scantokens:D #1
+      }
+  }
+
 %% #1: total height dimension; #2: head dimension; #3: foot dimension;
 %% #4: tl for resulting upper size; #5: tl for resulting lower size
 
@@ -4315,6 +4404,7 @@
 \DefTblrTemplate { contfoot-text } { normal } { Continued ~ on ~ next ~ page }
 \SetTblrTemplate { contfoot-text } { normal }
 
+\DefTblrTemplate { contfoot } { empty } { }
 \DefTblrTemplate { contfoot } { plain }
   {
     \noindent
@@ -4338,6 +4428,7 @@
 \DefTblrTemplate { conthead-text } { normal } { ( Continued ) }
 \SetTblrTemplate { conthead-text } { normal }
 
+\DefTblrTemplate { conthead } { empty } { }
 \DefTblrTemplate { conthead } { plain }
   {
     \noindent
@@ -4364,6 +4455,7 @@
 
 \tl_new:N \l__tblr_caption_short_tl
 
+\DefTblrTemplate { caption-lot } { empty } { }
 \DefTblrTemplate { caption-lot } { normal }
   {
     \tl_set:Nx \l__tblr_caption_short_tl { \InsertTblrText { entry } }
@@ -4377,12 +4469,15 @@
 %% We need to use \hspace and \enskip, but not ~ or \space,
 %% since we want a correct hangindent caption paragraph.
 
+\DefTblrTemplate { caption-tag } { empty } { }
 \DefTblrTemplate { caption-tag } { normal } { Table \hspace{0.25em} \thetable }
 \SetTblrTemplate { caption-tag } { normal }
 
+\DefTblrTemplate { caption-sep } { empty } { }
 \DefTblrTemplate { caption-sep } { normal } { : \enskip }
 \SetTblrTemplate { caption-sep } { normal }
 
+\DefTblrTemplate { caption-text } { empty } { }
 \DefTblrTemplate { caption-text } { normal } { \InsertTblrText { caption } }
 \SetTblrTemplate { caption-text } { normal }
 
@@ -4389,6 +4484,7 @@
 \box_new:N \l__tblr_caption_box
 \box_new:N \l__tblr_caption_left_box
 
+\DefTblrTemplate { caption } { empty } { }
 \DefTblrTemplate { caption } { plain }
   {
     \hbox_set:Nn \l__tblr_caption_box
@@ -4441,6 +4537,7 @@
   }
 \SetTblrTemplate { caption } { normal }
 
+\DefTblrTemplate { capcont } { empty } { }
 \DefTblrTemplate { capcont } { plain }
   {
     \hbox_set:Nn \l__tblr_caption_box
@@ -4536,6 +4633,7 @@
       { \textsuperscript { \sffamily \UseTblrFont { note-tag } #1 } }
   }
 
+\DefTblrTemplate { note-tag } { empty } { }
 \DefTblrTemplate { note-tag } { normal }
   {
     \textsuperscript { \sffamily \UseTblrFont { note-tag } \InsertTblrNoteTag }
@@ -4548,12 +4646,15 @@
   }
 \SetTblrTemplate { note-target } { normal }
 
+\DefTblrTemplate { note-sep } { empty } { }
 \DefTblrTemplate { note-sep } { normal } { \space }
 \SetTblrTemplate { note-sep } { normal }
 
+\DefTblrTemplate { note-text } { empty } { }
 \DefTblrTemplate { note-text } { normal } { \InsertTblrNoteText }
 \SetTblrTemplate { note-text } { normal }
 
+\DefTblrTemplate { note } { empty } { }
 \DefTblrTemplate { note } { plain }
   {
     \MapTblrNotes
@@ -4608,6 +4709,7 @@
 %%> \section{Table Remarks Templates}
 %%% --------------------------------------------------------
 
+\DefTblrTemplate { remark-tag } { empty } { }
 \DefTblrTemplate { remark-tag } { normal }
   {
     \itshape \UseTblrFont { remark-tag } \InsertTblrRemarkTag
@@ -4614,12 +4716,15 @@
   }
 \SetTblrTemplate { remark-tag } { normal }
 
+\DefTblrTemplate { remark-sep } { empty } { }
 \DefTblrTemplate { remark-sep } { normal } { : \space }
 \SetTblrTemplate { remark-sep } { normal }
 
+\DefTblrTemplate { remark-text } { empty } { }
 \DefTblrTemplate { remark-text } { normal } { \InsertTblrRemarkText }
 \SetTblrTemplate { remark-text } { normal }
 
+\DefTblrTemplate { remark } { empty } { }
 \DefTblrTemplate { remark } { plain }
   {
     \MapTblrRemarks
@@ -4687,10 +4792,12 @@
     foot .meta:n = { firstfoot, middlefoot, lastfoot },
   }
 
+\DefTblrTemplate { head } { empty } { }
+\DefTblrTemplate { foot } { empty } { }
+
 \DefTblrTemplate { firsthead } { normal }
   {
     \UseTblrTemplate { caption } { default }
-    \UseTblrTemplate { caption-lot } { default }
   }
 
 \DefTblrTemplate { middlehead, lasthead } { normal }
@@ -4793,8 +4900,7 @@
     \__tblr_get_table_width:
     \__tblr_build_table_head_aux:Nn \l__tblr_table_firsthead_box
       {
-        \tl_set:Nn \l_tmpa_tl { \InsertTblrText { label } }
-        \tl_if_empty:NF \l_tmpa_tl { \exp_args:NV \label \l_tmpa_tl }
+        \__tblr_build_table_label_entry:
         \UseTblrTemplate { firsthead } { default }
       }
     \__tblr_build_table_head_aux:Nn
@@ -4809,6 +4915,35 @@
       \l__tblr_table_lastfoot_box  { \UseTblrTemplate { lastfoot } { default } }
   }
 
+\cs_new_protected:Npn \__tblr_build_tall_table_head_foot:
+  {
+    \__tblr_get_table_width:
+    \__tblr_build_table_head_aux:Nn \l__tblr_table_firsthead_box
+      {
+        \__tblr_build_table_label_entry:
+        \UseTblrTemplate { firsthead } { default }
+      }
+    \__tblr_build_table_foot_aux:Nn
+      \l__tblr_table_lastfoot_box  { \UseTblrTemplate { lastfoot } { default } }
+  }
+
+\cs_new_protected:Npn \__tblr_build_table_label_entry:
+  {
+    \tl_set:Nx \l_tmpa_tl { \InsertTblrText { label } }
+    \tl_if_eq:NnTF \l_tmpa_tl { none }
+      {
+        \SetTblrTemplate { caption-tag }{ empty }
+        \SetTblrTemplate { caption-sep }{ empty }
+      }
+      {
+        \refstepcounter { table }
+        \tl_if_empty:NF \l_tmpa_tl { \exp_args:NV \label \l_tmpa_tl }
+      }
+    \tl_set:Nx \l_tmpb_tl { \InsertTblrText { entry } }
+    \tl_if_eq:NnF \l_tmpb_tl { none }
+      { \UseTblrTemplate { caption-lot } { default } }
+  }
+
 \cs_new_protected:Npn \__tblr_build_table_head_aux:Nn #1 #2
   {
     \vbox_set:Nn #1
@@ -4835,14 +4970,27 @@
   {
     \tl_if_eq:enTF { \__tblr_spec_item:nn { outer } { long } } { true }
       { \__tblr_build_long_table:e { \__tblr_spec_item:nn { outer } { halign } } }
-      { \__tblr_build_short_table:e { \__tblr_spec_item:nn { outer } { valign } } }
+      {
+        \tl_if_eq:enTF { \__tblr_spec_item:nn { outer } { tall } } { true }
+          {
+            \__tblr_build_tall_table:e
+              { \__tblr_spec_item:nn { outer } { valign } }
+          }
+          {
+            \__tblr_build_short_table:e
+              { \__tblr_spec_item:nn { outer } { valign } }
+          }
+      }
   }
 
 \dim_new:N \l__tblr_remain_height_dim
-\tl_new:N \l__tblr_long_from_tl
-\tl_new:N \l__tblr_long_to_tl
+\int_new:N \l__tblr_long_from_int
+\int_new:N \l__tblr_long_to_int
+\int_new:N \l__tblr_curr_i_int
+\int_new:N \l__tblr_prev_i_int
 \int_new:N \l__tblr_table_page_int
-\bool_new:N \l__tblr_table_page_break_bool
+\bool_new:N \l__tblr_page_break_curr_bool
+\bool_new:N \l__tblr_page_break_prev_bool
 
 %% #1: table alignment
 %% For long table, we need to leave hmode first to get correct \pagetotal
@@ -4862,37 +5010,29 @@
     \hrule height ~ 0pt
     \LogTblrTracing { page }
     \int_set:Nn \l__tblr_table_page_int {1}
-    \refstepcounter { table }
     \__tblr_build_head_foot:
     \dim_set:Nn \l__tblr_remain_height_dim
       { \pagegoal - \pagetotal - \l__tblr_row_head_foot_dim }
-    \tl_set:Nx \l__tblr_long_from_tl { \int_eval:n { \l__tblr_row_head_tl + 1 } }
-    \tl_set:Nx \l__tblr_long_to_tl
-      { \int_eval:n { \c at rowcount - ( \l__tblr_row_foot_tl + 0 ) } }
-    \int_step_variable:nnNn
-      { \l__tblr_long_from_tl } { \l__tblr_long_to_tl } \l__tblr_i_tl
+    \int_set:Nn \l__tblr_long_from_int { \l__tblr_row_head_tl + 1 }
+    \int_set:Nn \l__tblr_long_to_int { \c at rowcount - ( \l__tblr_row_foot_tl + 0 ) }
+    \int_set:Nn \l__tblr_curr_i_int { \l__tblr_long_from_int - 1 }
+    \int_do_while:nNnn { \l__tblr_curr_i_int } < { \l__tblr_long_to_int }
       {
-        \dim_set:Nn \l_tmpa_dim
-          {
-            \__tblr_data_item:nen { row } { \l__tblr_i_tl } { abovesep }
-            +
-            \__tblr_data_item:nen { row } { \l__tblr_i_tl } { @row-height }
-            +
-            \__tblr_data_item:nen { row } { \l__tblr_i_tl } { belowsep }
-            +
-            \__tblr_spec_item:ne { hline }
-              { [ \int_eval:n { \l__tblr_i_tl + 1} ] / @hline-height }
-          }
+        \int_set_eq:NN \l__tblr_prev_i_int \l__tblr_curr_i_int
+        \__tblr_get_next_table_rows:NNNN
+          \l__tblr_long_to_int \l__tblr_curr_i_int
+          \l_tmpa_dim \l__tblr_page_break_curr_bool
         \__tblr_check_table_page_break:NNN
-          \l__tblr_remain_height_dim \l_tmpa_dim \l__tblr_table_page_break_bool
-        \bool_if:NTF \l__tblr_table_page_break_bool
+          \l__tblr_remain_height_dim \l_tmpa_dim \l__tblr_page_break_prev_bool
+        \bool_if:NTF \l__tblr_page_break_prev_bool
           {
-            \__tblr_do_if_tracing:nn { page } { \tl_log:N \l__tblr_i_tl }
-            \int_compare:nNnT
-              { \l__tblr_i_tl - \l__tblr_long_from_tl } > {1}
+            \__tblr_do_if_tracing:nn { page } { \int_log:N \l__tblr_curr_i_int }
+            \int_compare:nNnF
+              { \l__tblr_prev_i_int - \l__tblr_long_from_int } < {0}
               {
                 \__tblr_build_page_table:nnx {#1}
-                  { \l__tblr_long_from_tl } { \int_eval:n { \l__tblr_i_tl - 1 } }
+                  { \int_use:N \l__tblr_long_from_int }
+                  { \int_use:N \l__tblr_prev_i_int }
                 \int_incr:N \l__tblr_table_page_int
               }
             \newpage
@@ -4901,10 +5041,24 @@
             \LogTblrTracing { page }
             \dim_set:Nn \l__tblr_remain_height_dim
               { \pagegoal - \pagetotal - \l__tblr_row_head_foot_dim - \l_tmpa_dim }
-            \tl_set_eq:NN \l__tblr_long_from_tl \l__tblr_i_tl
+            \int_set:Nn \l__tblr_long_from_int { \l__tblr_prev_i_int + 1 }
           }
           {
-            \dim_add:Nn \l__tblr_remain_height_dim { -\l_tmpa_dim }
+            \bool_if:NTF \l__tblr_page_break_curr_bool
+              {
+                \__tblr_build_page_table:nnx {#1}
+                  { \int_use:N \l__tblr_long_from_int }
+                  { \int_use:N \l__tblr_curr_i_int }
+                \int_incr:N \l__tblr_table_page_int
+                \newpage
+                \hbox{}\kern-\topskip\nobreak
+                \noindent
+                \LogTblrTracing { page }
+                \dim_set:Nn \l__tblr_remain_height_dim
+                  { \pagegoal - \pagetotal - \l__tblr_row_head_foot_dim }
+                \int_set:Nn \l__tblr_long_from_int { \l__tblr_curr_i_int + 1 }
+              }
+              { \dim_add:Nn \l__tblr_remain_height_dim { -\l_tmpa_dim } }
           }
       }
     \int_compare:nNnTF { \l__tblr_table_page_int } = {1}
@@ -4916,13 +5070,49 @@
         \box_set_eq:NN \l__tblr_table_head_box \l__tblr_table_lasthead_box
         \box_set_eq:NN \l__tblr_table_foot_box \l__tblr_table_lastfoot_box
       }
-    \__tblr_build_page_table:nnn
-      {#1} { \l__tblr_long_from_tl } { \l__tblr_long_to_tl }
+    \__tblr_build_page_table:nnn {#1}
+      { \int_use:N \l__tblr_long_from_int } { \int_use:N \l__tblr_long_to_int }
     \skip_vertical:n { \__tblr_spec_item:nn { outer } { postsep } }
     \hrule height ~ 0pt
   }
 \cs_generate_variant:Nn \__tblr_build_long_table:n { e }
 
+%% #1: int with index of the last row; #2: int with index of current row;
+%% #3: row dimension; #4: break page or not.
+\cs_new_protected:Npn \__tblr_get_next_table_rows:NNNN #1 #2 #3 #4
+  {
+    \bool_set_true:N \l_tmpa_bool
+    \dim_zero:N #3
+    \bool_set_false:N #4
+    \bool_while_do:Nn \l_tmpa_bool
+      {
+        \int_incr:N #2
+        \dim_add:Nn #3
+          {
+            \__tblr_data_item:nen { row } { \int_use:N #2 } { abovesep }
+            +
+            \__tblr_data_item:nen { row } { \int_use:N #2 } { @row-height }
+            +
+            \__tblr_data_item:nen { row } { \int_use:N #2 } { belowsep }
+            +
+            \__tblr_spec_item:ne { hline }
+              { [ \int_eval:n { #2 + 1 } ] / @hline-height }
+          }
+        \int_compare:nNnTF {#2} < {#1}
+          {
+            \tl_set:Nx \l__tblr_b_tl
+              { \__tblr_data_item:nen { row } { \int_eval:n { #2 + 1 } } { break } }
+            \int_compare:nNnTF { \l__tblr_b_tl } < { 0 }
+              { \bool_set_true:N \l_tmpa_bool }
+              {
+                \bool_set_false:N \l_tmpa_bool
+                \int_compare:nNnT { \l__tblr_b_tl } > { 0 } { \bool_set_true:N #4 }
+              }
+          }
+          { \bool_set_false:N \l_tmpa_bool }
+      }
+  }
+
 \box_new:N \l__tblr_table_head_box
 \box_new:N \l__tblr_table_foot_box
 \dim_new:N \l__tblr_table_head_foot_dim
@@ -5000,6 +5190,28 @@
   }
 
 %% #1: table alignment
+%% For tall table, we need to leave vmode first.
+%% Since there may be \centering in table environment,
+%% We use \raggedright to reset alignement for table head/foot.
+\cs_new_protected:Npn \__tblr_build_tall_table:n #1
+  {
+    \mode_leave_vertical:
+    \raggedright
+    \__tblr_build_tall_table_head_foot:
+    \__tblr_build_one_table:nn {1} {\c at rowcount}
+    \vbox_set:Nn \l__tblr_table_box
+      {
+        \box_use:N \l__tblr_table_firsthead_box
+        \hrule height ~ 0pt
+        \box_use:N \l__tblr_table_box
+        \hrule height ~ 0pt
+        \box_use:N \l__tblr_table_lastfoot_box
+      }
+    \__tblr_valign_whole:Nn \l__tblr_table_box #1
+  }
+\cs_generate_variant:Nn \__tblr_build_tall_table:n { e }
+
+%% #1: table alignment
 %% For short table, we need to leave vmode first
 \cs_new_protected:Npn \__tblr_build_short_table:n #1
   {
@@ -5886,7 +6098,8 @@
 \NewTblrLibrary { siunitx }
   {
     \RequirePackage { siunitx }
-    \NewColumnType { S } [1] [] { Q[si = {##1}] }
+    \NewColumnType { S } [1] [] { Q[si = {##1}, c] }
+    \NewColumnType { s } [1] [] { Q[si = {##1}, c, cmd = \TblrUnit] }
     \__tblr_data_new_key:nnn { cell } { si } { str }
     \keys_define:nn { tblr-column }
       {
@@ -5895,12 +6108,20 @@
     \cs_new_protected:Npn \__tblr_siunitx_setcolumn:n ##1
       {
         \__tblr_column_gput_cell:nn { si } {##1}
-        \__tblr_process_text_for_every_column_cell:n { \__tblr_siunitx_tablenum:n }
+        \__tblr_process_text_for_every_column_cell:n { \TblrNum }
       }
-    \cs_new_protected:Npn \__tblr_siunitx_tablenum:n ##1
+    \NewDocumentCommand \TblrNum { m }
       {
-        \tl_if_head_is_group:nTF {##1}
-          { ##1 }
+        \__tblr_siunitx_process:Nn \tablenum {##1}
+      }
+    \NewDocumentCommand \TblrUnit { m }
+      {
+        \__tblr_siunitx_process:Nn \si {##1}
+      }
+    \cs_new_protected:Npn \__tblr_siunitx_process:Nn ##1 ##2
+      {
+        \tl_if_head_is_group:nTF {##2}
+          { ##2 }
           {
             \group_begin:
             \tl_set:Nx \l_tmpa_tl
@@ -5909,7 +6130,7 @@
                   { \int_use:N \c at rownum } { \int_use:N \c at colnum } { si }
               }
             \exp_args:NV \sisetup \l_tmpa_tl
-            \tablenum {##1}
+            ##1 {##2}
             \group_end:
           }
       }



More information about the tex-live-commits mailing list.