summaryrefslogtreecommitdiff
path: root/macros/latex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-07-02 03:02:09 +0000
committerNorbert Preining <norbert@preining.info>2021-07-02 03:02:09 +0000
commitc4d400d058136a9045857b99d816595e7a655125 (patch)
treec94ed379e2025f98ef92962c8aedaaa4f207a96c /macros/latex
parentc840f97520ba98156a0ed525d6b5d05ab6a324f6 (diff)
CTAN sync 202107020302
Diffstat (limited to 'macros/latex')
-rw-r--r--macros/latex/contrib/brandeis-dissertation/brandeis-dissertation.dtx9
-rw-r--r--macros/latex/contrib/brandeis-dissertation/brandeis-dissertation.pdfbin171196 -> 171451 bytes
-rw-r--r--macros/latex/contrib/brandeis-thesis/brandeis-thesis.dtx36
-rw-r--r--macros/latex/contrib/brandeis-thesis/brandeis-thesis.pdfbin149947 -> 150200 bytes
-rw-r--r--macros/latex/contrib/easybook/easybook.dtx177
-rw-r--r--macros/latex/contrib/easybook/easybook.pdfbin550218 -> 554175 bytes
-rw-r--r--macros/latex/contrib/jsclasses/README.md2
-rw-r--r--macros/latex/contrib/jsclasses/jsclasses.dtx8
-rw-r--r--macros/latex/contrib/jsclasses/jsclasses.pdfbin412399 -> 412473 bytes
-rw-r--r--macros/latex/contrib/jsclasses/okumacro.dtx21
-rw-r--r--macros/latex/contrib/jsclasses/okumacro.pdfbin173352 -> 175557 bytes
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix-french.pdfbin461406 -> 463607 bytes
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix-french.tex42
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix.dtx648
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix.pdfbin1300431 -> 1330962 bytes
-rw-r--r--macros/latex/contrib/seminar/Changes5
-rw-r--r--macros/latex/contrib/seminar/doc/semsamp3.pdfbin37704 -> 27644 bytes
-rw-r--r--macros/latex/contrib/seminar/doc/semsamp3.tex5
-rw-r--r--macros/latex/contrib/seminar/latex/seminar.cls4
-rw-r--r--macros/latex/contrib/seminar/latex/seminar.sty2
-rw-r--r--macros/latex/contrib/tabularray/README2
-rw-r--r--macros/latex/contrib/tabularray/tabularray.pdfbin426537 -> 652813 bytes
-rw-r--r--macros/latex/contrib/tabularray/tabularray.sty2143
-rw-r--r--macros/latex/contrib/tabularray/tabularray.tex1216
24 files changed, 3597 insertions, 723 deletions
diff --git a/macros/latex/contrib/brandeis-dissertation/brandeis-dissertation.dtx b/macros/latex/contrib/brandeis-dissertation/brandeis-dissertation.dtx
index 767651386f..564e175581 100644
--- a/macros/latex/contrib/brandeis-dissertation/brandeis-dissertation.dtx
+++ b/macros/latex/contrib/brandeis-dissertation/brandeis-dissertation.dtx
@@ -22,7 +22,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
%<package>\ProvidesPackage{brandeis-dissertation}
%<*package>
- [2020/04/09 v3.11 .dtx brandeis-dissertation file]
+ [2020/06/29 v3.12 .dtx brandeis-dissertation file]
%</package>
%<package>\LoadClass[12pt]{article}
%<package>\RequirePackage[margin=1in]{geometry}
@@ -205,6 +205,7 @@
% \changes{v3.0}{2020/02/28}{Initial version}
% \changes{v3.1}{2020/04/09}{Formatting update}
% \changes{v3.11}{2020/04/09}{Documentation update}
+% \changes{v3.12}{2021/06/29}{Dean signature update}
%
% \GetFileInfo{brandeis-dissertation.dtx}
%
@@ -252,10 +253,10 @@
% \title{LaTeXing Your Dissertation}
% \author{Deanna Daly}
% \graduationmonth{May}
-% \graduationyear{2020}
+% \graduationyear{2021}
% \program{Philosophy}
% \advisor{Alan Turing}
-% \signoff{Eric Chasalow}{Dean}
+% \signoff{Wendy Cadge}{Dean}
% \committee{Bertrand Russell, Philosophy\\
% Alfred North Whitehead, Mathematics\\
% Ludwig Wittgenstein, Philosophy\\
@@ -301,7 +302,7 @@
% \title{LaTeXing Your Dissertation}
% \author{Deanna Daly}
% \graduationmonth{May}
-% \graduationyear{2020}
+% \graduationyear{2021}
% \program{Philosophy}
% \advisor{Alan Turing}
% \signoff{Eric Chasalow}{Dean}
diff --git a/macros/latex/contrib/brandeis-dissertation/brandeis-dissertation.pdf b/macros/latex/contrib/brandeis-dissertation/brandeis-dissertation.pdf
index 5fda9fe22f..0a63d5927c 100644
--- a/macros/latex/contrib/brandeis-dissertation/brandeis-dissertation.pdf
+++ b/macros/latex/contrib/brandeis-dissertation/brandeis-dissertation.pdf
Binary files differ
diff --git a/macros/latex/contrib/brandeis-thesis/brandeis-thesis.dtx b/macros/latex/contrib/brandeis-thesis/brandeis-thesis.dtx
index b148381de9..e57e1b05bf 100644
--- a/macros/latex/contrib/brandeis-thesis/brandeis-thesis.dtx
+++ b/macros/latex/contrib/brandeis-thesis/brandeis-thesis.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2020 by Deanna Daly <gradschool@brandeis.edu>
+% Copyright (C) 2021 by Brandeis University <gradschool@brandeis.edu>
% -------------------------------------------------------
%
% This file may be distributed and/or modified under the
@@ -22,23 +22,34 @@
%<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
%<package>\ProvidesClass{brandeis-thesis}
%<*package>
- [2020/04/09 v3.1 .dtx brandeis-thesis file]
+ [2021/06/29 v3.2 .dtx brandeis-thesis file]
%</package>
-%<package>\LoadClass[12pt]{article}
+%<package>\LoadClass[12pt,oneside]{book}
+%<package>\RequirePackage[immediate]{silence}
+%<package>\WarningFilter[temp]{latex}{Command}
+%<package>\RequirePackage{sectsty}
+%<package>\DeactiveWarningFilters[temp]
%<package>\RequirePackage[margin=1in]{geometry}
%<package>\RequirePackage{setspace}
%<package>\RequirePackage{titlesec}
%<package>\RequirePackage[utf8]{inputenc}
%<package>\RequirePackage[english]{babel}
%<package>\RequirePackage{csquotes}
+%<package>\RequirePackage{mathptmx}
+%<package>\RequirePackage{tocloft}
+%<package>\allsectionsfont{\normalsize\bfseries}
+%<package>\renewcommand{\cftchapfont}{\normalfont}
+%<package>\renewcommand{\cftchappagefont}{\normalfont}
+%<package>\renewcommand{\cfttoctitlefont}{\normalsize\bfseries}
+%<package>\renewcommand{\cftloftitlefont}{\normalsize\bfseries}
+%<package>\renewcommand{\cftlottitlefont}{\normalsize\bfseries}
+%<package>\setlength{\cftaftertoctitleskip}{12pt}
+%<package>\setlength{\cftafterloftitleskip}{12pt}
+%<package>\setlength{\cftafterlottitleskip}{12pt}
%<package>\AtBeginEnvironment{quote}{\singlespacing}
-%
-%<package>\titleformat*{\section}{\normalsize\bfseries}
-%<package>\titleformat*{\subsection}{\normalsize\bfseries}
-%<package>\titleformat*{\subsubsection}{\normalsize\bfseries}
-%
-%<package>\renewcommand\graduationmonth[1]{\def\@graduationmonth{#1}}
-%<package>\renewcommand\graduationyear[1]{\def\@graduationyear{#1}}
+%<package>\pagestyle{plain}
+%<package>\newcommand\graduationmonth[1]{\def\@graduationmonth{#1}}
+%<package>\newcommand\graduationyear[1]{\def\@graduationyear{#1}}
%<package>\newcommand\program[1]{\def\@program{#1}}
%<package>\newcommand\advisor[1]{\def\@advisor{#1}}
%<package>\newcommand\degreetype[1]{\def\@degreetype{#1}}
@@ -159,6 +170,7 @@
%
% \changes{v3.0}{2020/01/21}{Initial version}
% \changes{v3.1}{2020/04/09}{Formatting update}
+% \changes{v3.2}{2020/06/29}{Formatting update}
%
% \GetFileInfo{brandeis-thesis.dtx}
%
@@ -205,7 +217,7 @@
% \title{LaTeXing Your Thesis}
% \author{Deanna Daly}
% \graduationmonth{May}
-% \graduationyear{2020}
+% \graduationyear{2021}
% \program{Computer Science}
% \advisor{Alan Turing}
% \degreetype{Science}
@@ -249,7 +261,7 @@
% \title{LaTeXing Your Thesis}
% \author{Deanna Daly}
% \graduationmonth{May}
-% \graduationyear{2020}
+% \graduationyear{2021}
% \program{Computer Science}
% \advisor{Alan Turing}
% \degreetype{Science}
diff --git a/macros/latex/contrib/brandeis-thesis/brandeis-thesis.pdf b/macros/latex/contrib/brandeis-thesis/brandeis-thesis.pdf
index b7361daedb..6970ee794c 100644
--- a/macros/latex/contrib/brandeis-thesis/brandeis-thesis.pdf
+++ b/macros/latex/contrib/brandeis-thesis/brandeis-thesis.pdf
Binary files differ
diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx
index 66e7ffba49..a8f24a2dc6 100644
--- a/macros/latex/contrib/easybook/easybook.dtx
+++ b/macros/latex/contrib/easybook/easybook.dtx
@@ -28,7 +28,7 @@
%
% \title{\sffamily easybook 文档类手册}
% \author{瞿毅}
-% \date{2021/06/30\hskip\ccwd\relax v1.26n\thanks{\url{https://gitee.com/texl3/easybook}}}
+% \date{2021/07/01\hskip\ccwd\relax v1.26o\thanks{\url{https://gitee.com/texl3/easybook}}}
%
% \maketitle
% \begin{abstract}
@@ -40,7 +40,8 @@
% 使用 \cls{easybook} 文档类编写文档前您可能需要满足以下的条件:
% \begin{itemize}
% \item 使用 \hologo{XeLaTeX}(推荐)或 \hologo{LuaLaTeX} 两种编译方式。
-% \item 由于用到了一些 \LaTeX 和宏包较新的功能,建议安装最新的 \TeX 发行版,例如 \TeX Live 2021或 \hologo{MiKTeX} 21.2之后的版本。
+% \item 由于用到了一些 \LaTeX 和宏包较新的功能,建议安装最新的 \TeX 发行版,例如 \TeX Live 2021 或 \hologo{MiKTeX} 21.2 之后的版本。
+% \item 虽然手册对基本用法做了介绍,但这并不是入门教程,您应当具有一定的 \LaTeX 使用基础。
% \end{itemize}
%
% \subsection{基本用法}
@@ -139,7 +140,7 @@
%
% \begin{function}[rEXP,added = 2021-01-05,updated = 2021-01-13]{paper}
% \begin{syntax}
-% paper = <(a4paper)|b5paper|letterpaper|...>
+% paper = <(a4paper)|b5paper|c5paper|letterpaper|...>
% \end{syntax}
% 设置页面大小,交给 \pkg{geometry} 宏包处理,可使用它支持的所有规格。建议选项 \opt{b5paper} 和 \opt{zihao = 5},选项 \opt{a4paper} 和 \opt{zihao = -4} 配合。
% \end{function}
@@ -157,7 +158,7 @@
% floatpage = <true|(false)>
% \end{syntax}
% 开启这个选项后浮动环境 \env{table} 和 \env{figure} 的比例参数会使用默认值,关闭它则尽可能避免出现浮动页,使图表环境与正文段落更加紧凑,减少多余的空白版面。
-% \changes{v1.26n}{2021/06/15}{增加浮动环境比例参数选项 \opt{floatpage}。}
+% \changes{v1.26o}{2021/06/15}{增加浮动环境比例参数选项 \opt{floatpage}。}
% \end{function}
%
% \subsection{article 模式}
@@ -179,7 +180,7 @@
% \tn{backmatter}
% \tn{cleardoublepage}\oarg{页面风格|(empty)}
% \end{syntax}
-% \tn{frontmatter} 为前言区命令,章标题不编号,页码可设置为例如 \opt{roman}、\opt{Alph} 等格式,带有星号的命令 \tn{frontmatter*} 不使用清双页命令 \tn{cleardoublepage}。\tn{mainmatter} 为主文区命令,章标题正常编号且页码为从1开始计数的阿拉伯数字,\tn{mainmatter*} 命令不使用 \tn{cleardoublepage}。\tn{backmatter} 为后记区命令,页码格式与编号保持不变,章标题不编号。在奇数页使用命令 \tn{cleardoublepage} 时可选参数为下一页多出的空白偶数页的页面风格,默认为 \opt{empty} 即空的页眉页脚。
+% \tn{frontmatter} 为前言区命令,章标题不编号,页码可设置为例如 \opt{roman}、\opt{Alph} 等格式,带有星号的命令 \tn{frontmatter*} 不使用清双页命令 \tn{cleardoublepage}。\tn{mainmatter} 为主文区命令,章标题正常编号且页码为从 1 开始计数的阿拉伯数字,\tn{mainmatter*} 命令不使用 \tn{cleardoublepage}。\tn{backmatter} 为后记区命令,页码格式与编号保持不变,章标题不编号。在奇数页使用命令 \tn{cleardoublepage} 时可选参数为下一页多出的空白偶数页的页面风格,默认为 \opt{empty} 即空的页眉页脚。
% \changes{v1.23}{2021/02/20}{重新定义文档结构划分命令。}
% \end{function}
%
@@ -191,7 +192,7 @@
% \tn{listoftables*+}\oarg{键值列表}
% \tn{listoflstlistings*+}\oarg{键值列表}
% \end{syntax}
-% \tn{listoffigures} 命令输出图片目录,\tn{listoftables} 输出表格目录,\tn{listoflstlistings} 输出代码目录。带有星号的目录命令不将标题添加进主文档目录,带有+号的目录命令可以使当前标题编号。\tn{tableofcontents+} 的+号含义则是输出双语目录,需要与双语目录标题命令 \tn{bichapter} 等或设置图片、表格和代码等英文目录的标题配合使用,附加代码是中文与英文目录之间的代码,可以插入目录样式和换页等命令。可选参数的 \meta{键值列表} 如下:
+% \tn{listoffigures} 命令输出图片目录,\tn{listoftables} 输出表格目录,\tn{listoflstlistings} 输出代码目录。带有星号的目录命令不将标题添加进主文档目录,带有 + 号的目录命令可以使当前标题编号。\tn{tableofcontents+} 的 + 号含义则是输出双语目录,需要与双语目录标题命令 \tn{bichapter} 等或设置图片、表格和代码等英文目录的标题配合使用,附加代码是中文与英文目录之间的代码,可以插入目录样式和换页等命令。可选参数的 \meta{键值列表} 如下:
% \changes{v1.25}{2021/05/05}{命令 \tn{tableofcontents} 可以输出双语目录。}
% \end{function}
%
@@ -239,7 +240,7 @@
% \tn{EBeforeAddBitoc*}\marg{加入目录英文标题前的代码}
% \end{syntax}
% \tn{appendix} 命令后的章节标题变为附录形式。英文目录中附录标题的格式用可选参数修改,英文附录目录前名字默认为 Appendix\tn{space},后名字默认为空,名字之间用一个半角逗号分开,也可以只有一部分,表示英文附录目录前名字。英文附录目录数字输出命令默认为 \tn{Alph}\{chapter\}。
-% \changes{v1.26n}{2021/06/13}{增加调整英文目录格式的钩子 \tn{EBeforeAddBitoc}。}
+% \changes{v1.26o}{2021/06/13}{增加调整英文目录格式的钩子 \tn{EBeforeAddBitoc}。}
% \end{function}
%
% \tn{EBeforeAddBitoc} 是一个作用于局部范围的英文目录钩子,可以插入标题或目录设置的命令改变英文目录中标题的显示格式,也可以覆盖上述的目录前后名字和编号等设置,带有星号的命令会重置之前的代码,放置在导言区或 \tn{bichapter} 等命令前生效。
@@ -254,10 +255,10 @@
% \ \oarg{水平偏移}\parg{下标代码}
% \end{syntax}
% 上标和下标的功能来自 \pkg{spbmark} 宏包,\tn{super}、\tn{sub} 和 \tn{supersub} 三个命令可以用于输出上标和下标。它们根据当前处于文本模式还是数学模式来匹配相应的模式,或者可以使用它们的星号变体命令来强制使用数学模式。也可以使用键值列表对偏移量进行全局设置,详情见小节 \ref{subsec:style}。
-% \changes{v1.26n}{2021/06/28}{增加可以调整相对位置和格式的上标和下标命令 \tn{super}、\tn{sub} 和 \tn{supersub}。}
+% \changes{v1.26o}{2021/06/28}{增加可以调整相对位置和格式的上标和下标命令 \tn{super}、\tn{sub} 和 \tn{supersub}。}
% \end{function}
%
-% 垂直和水平偏移默认值都是0 pt,\meta{对齐方式} 的参数与 \opt{supersubalign} 相同。\meta{格式代码} 用于格式化上标和下标,可以插入字体或颜色等命令。代码中的最后一个命令可以接受一个为上标或下标的参数。\tn{textsuperscript} 和 \tn{textsubscript} 命令已被重新定义并且分别等价于 \tn{super} 和 \tn{sub},如果您需要使用它们的原始定义创建新命令,则可以使用 \tn{spb@textsuperscript@save} 和 \tn{spb@textsubscript@save} 命令。
+% 垂直和水平偏移默认值都是 0 pt,\meta{对齐方式} 的参数与 \opt{supersubalign} 相同。\meta{格式代码} 用于格式化上标和下标,可以插入字体或颜色等命令。代码中的最后一个命令可以接受一个为上标或下标的参数。\tn{textsuperscript} 和 \tn{textsubscript} 命令已被重新定义并且分别等价于 \tn{super} 和 \tn{sub},如果您需要使用它们的原始定义创建新命令,则可以使用 \tn{spb@textsuperscript@save} 和 \tn{spb@textsubscript@save} 命令。
%
% \section{接口选项}
% \label{sec:interface options}
@@ -313,10 +314,10 @@
% 主题颜色用到这三个颜色,可以使用 \tn{definecolor} 命令进行更改,类似地更改超链接颜色见小节 \ref{subsec:hyperlinks}。
% \changes{v1.10}{2021/01/08}{可以自定义主题颜色。}
% \end{function}
-% \item[color-all] 统一设置主题的各部分颜色,参数是6个十六进制数字组成的 HTML 颜色代码,任意颜色的代码可以在常见的图片处理工具拾色器中查看。
+% \item[color-all] 统一设置主题的各部分颜色,参数是 6 个十六进制数字组成的 HTML 颜色代码,任意颜色的代码可以在常见的图片处理工具拾色器中查看。
% \item[multoc] 开启多栏目录,与节 \ref{sec:document command} 中目录命令的同名选项有相同效果。
% \item[withpart] 使章跟随每一部分编号,默认不跟随。
-% \item[footwith] 使脚注跟随编号的计数器,默认跟随章,当开启新的一章时脚注编号从1开始。
+% \item[footwith] 使脚注跟随编号的计数器,默认跟随章,当开启新的一章时脚注编号从 1 开始。
% \item[rulewidth] 调整页眉、定理盒子以及代码框线条的粗细。
% \item[uppercase] 使用 \tn{rightmark} 及 \tn{leftmark} 获取标题内容设置页眉页脚时英文是否大小写。
% \item[figure-sep] 图片标题编号的连接符。
@@ -367,7 +368,7 @@
% 超链接颜色用到这三个颜色,可以使用 \tn{definecolor} 命令进行更改。
% \changes{v1.10}{2021/01/08}{可以自定义超链接颜色。}
% \end{function}
-% \item[linkcol-all] 统一设置超链接的各部分颜色,参数是6个十六进制数字组成的 HTML 颜色代码,任意颜色的代码可以在常见的图片处理工具拾色器中查看。
+% \item[linkcol-all] 统一设置超链接的各部分颜色,参数是 6 个十六进制数字组成的 HTML 颜色代码,任意颜色的代码可以在常见的图片处理工具拾色器中查看。
% \item[linktoc] 将目录中的超链接取消、置于标题上、置于页码上或置于标题和页码上。
% \end{optdesc}
%
@@ -441,7 +442,7 @@
%
% \begin{optdesc}
% \item[backend] 参考文献处理后端,默认用传统的 \hologo{BibTeX} 处理参考文献。
-% \item[bib-style] 参考文献格式为中国的参考文献推荐标准GB/T 7714-2015,有顺序编码制和著者-出版年制两种风格,理工科类一般使用顺序编码制,文科类一般使用著者-出版年制。若使用其它格式,使用 \hologo{BibTeX} 处理时需确保正确的 \opt{bst} 文件,使用 \hologo{biber} 处理可使用 \pkg{biblatex} 宏包支持的参考文献风格名称。
+% \item[bib-style] 参考文献格式为中国的参考文献推荐标准 GB/T 7714-2015,有顺序编码制和著者-出版年制两种风格,理工科类一般使用顺序编码制,文科类一般使用著者-出版年制。若使用其它格式,使用 \hologo{BibTeX} 处理时需确保正确的 \opt{bst} 文件,使用 \hologo{biber} 处理可使用 \pkg{biblatex} 宏包支持的参考文献风格名称。
% \item[cite-style] 标注参考文献的风格,\opt{backend = bibtex} 选项下可使用 \opt{super}(数字上标标注,默认)或 \opt{numbers}(数字标注)等 \pkg{natbib} 宏包带有的标注风格,\opt{backend = biblatex} 选项下可使用 \pkg{biblatex} 宏包支持的标注风格名称。
% \item[datafile] 参考文献数据库的文件名,可以是单个文件也可以是以括号包裹并以英文逗号分隔的文件列表,使用 \hologo{biber} 处理时要带有 \opt{bib} 后缀,若不在当前文件夹名称需要包含路径。只有设置数据库的文件名才会载入 \pkg{natbib} 或 \pkg{biblatex} 宏包,之后才可使用相关配置命令,否则需要手动载入相关宏包配置参考文献。
% \end{optdesc}
@@ -469,7 +470,7 @@
%
% \subsection{定理样式}
% \label{subsec:theorem of style}
-% \begin{function}[EXP,added = 2021-01-12,updated = 2021-06-16]{thmbox,within,headpunct,bodyfont,notefont,headfont,headindent,spaceabove,spacebelow,spacepost,headformat}
+% \begin{function}[EXP,added = 2021-01-12,updated = 2021-07-01]{thmbox,within,headpunct,bodyfont,notefont,headfont,headindent,spaceabove,spacebelow,spacepost,headformat,brackets}
% \begin{syntax}
% thmbox = <true|(false)>
% within = <(chapter)|section|其它环境|空置>
@@ -482,9 +483,11 @@
% spacebelow = <弹性长度|(0.75ex plus .1ex)>
% spacepost = <刚性长度|(\tn{ccwd})>
% headformat = <(\tn{NAME}\tn{space}\tn{NUMBER}\tn{NOTE})>
+% brackets = \{<左括号>,<右括号>\}
% \end{syntax}
% \ding{229} 以上选项路径为 \opt{thmset/...}
% \changes{v1.21}{2021/01/12}{增加配置定理环境样式的选项。}
+% \changes{v1.26o}{2021/07/01}{增加配置公式标签括号选项 \opt{brackets}。}
% \end{function}
%
% \begin{optdesc}
@@ -499,6 +502,7 @@
% \item[spacebelow] 定理环境后的间距。
% \item[spacepost] 定理标题后与第一段内容的间隔。
% \item[headformat] 定理开头部分各组成元素的排列和格式,这个选项一般不需要使用,其中 \tn{NAME}、\tn{NUMBER} 和 \tn{NOTE} 分别代表标题、编号和题注。
+% \item[brackets] 设置行间公式编号标签的括号,以英文逗号分隔,分别为左右括号。
% \end{optdesc}
%
% \begin{function}[added = 2021-01-12,updated = 2021-06-15]{\declaretheorem,\EBNewTheorem,\declaretheoremstyle}
@@ -507,10 +511,10 @@
% \tn{EBNewTheorem}\marg{定理环境名}\oarg{英文标题}\marg{中文标题}\parg{盒子样式|(tc-theorem)}\oarg{键值列表}
% \tn{declaretheoremstyle}\oarg{键值列表}\marg{定理样式名}
% \end{syntax}
-% 文档类已预置8个定理环境,环境名及对应的定理标题名见小节 \ref{subsec:theorem},如果需要新的定理标题名或定理样式可使用这两个命令,由 \pkg{thmtools} 提供支持,用法与它的同名命令一致。
+% 文档类已预置 8 个定理环境,环境名及对应的定理标题名见小节 \ref{subsec:theorem},如果需要新的定理标题名或定理样式可使用这两个命令,由 \pkg{thmtools} 提供支持,用法与它的同名命令一致。
% \changes{v1.23}{2021/03/12}{重新定义了新定理环境命令 \tn{newtheorem}。}
% \changes{v1.24}{2021/04/25}{增加定义定理环境命令 \tn{EBNewTheorem}。}
-% \changes{v1.26n}{2021/06/15}{定义新定理环境的命令调整为 \tn{declaretheorem}。}
+% \changes{v1.26o}{2021/06/15}{定义新定理环境的命令调整为 \tn{declaretheorem}。}
% \end{function}
%
% \begin{optdesc}
@@ -616,10 +620,10 @@
% \tn{markrule}\oarg{长度|(\tn{textwidth})}\parg{颜色名}\marg{线宽|(0.75pt)}[<上间距>+<下间距>]
% \end{syntax}
% 命令 \tn{easyhead} 和 \tn{easyfoot} 的使用方法与 \tn{fancyhead} 和 \tn{fancyfoot} 完全相同,它们需要在 \opt{head-foot} 选项中使用,设置的是一个名为 \opt{fancy} 的页面风格。\pkg{fancyhdr} 将页眉页脚分成了左中右和奇数页(odd)、偶数页(even)共12个部分,可选参数中E、O代表偶数、奇数,L、C、R代表左、中、右部分。单面打印时,含有偶数的选项无效。
-% \changes{v1.26n}{2021/06/14}{增加页眉页脚的横线绘制命令 \tn{markrule}。}
+% \changes{v1.26o}{2021/06/14}{增加页眉页脚的横线绘制命令 \tn{markrule}。}
% \end{function}
%
-% 命令 \tn{markrule} 用于绘制页眉页脚横线,长度默认为页面文本区的宽度,上下间距为横线与上下方部件的间距,带有长度单位,间距长度之间用+号分开,若只有一部分则表示上间距,这个命令也可以在正文中绘制横线。下面举一个设置页眉内容的例子:
+% 命令 \tn{markrule} 用于绘制页眉页脚横线,长度默认为页面文本区的宽度,上下间距为横线与上下方部件的间距,带有长度单位,间距长度之间用 + 号分开,若只有一部分则表示上间距,这个命令也可以在正文中绘制横线。下面举一个设置页眉内容的例子:
% \begin{ctexexam}
% \hdrset
% {
@@ -646,7 +650,7 @@
% afterfnmark = <脚注标记后的代码>
% \end{syntax}
% \ding{229} 以上选项路径为 \opt{hdrset/...} \\
-% 上面几个选项用于设置脚注格式,\opt{fnparskip} 和 \opt{fnparindent} 选项仅在 \opt{fnhang = true} 时有效。\opt{fnhang} 用于将脚注设置为悬挂缩进的格式,\opt{fnmark-pos} 选项设置脚注编号的位置,正常文本或是上标形式。\opt{fnmark-num} 选项设置脚注编号的格式,默认为原生样式 \opt{plain},还可以改为 \opt{pifont} 的各个版本,从左往右依次为普通版、阴文衬线版、阳文无衬线版和阴文无衬线版,缺点是它们的编号仅包括1-10。
+% 上面几个选项用于设置脚注格式,\opt{fnparskip} 和 \opt{fnparindent} 选项仅在 \opt{fnhang = true} 时有效。\opt{fnhang} 用于将脚注设置为悬挂缩进的格式,\opt{fnmark-pos} 选项设置脚注编号的位置,正常文本或是上标形式。\opt{fnmark-num} 选项设置脚注编号的格式,默认为原生样式 \opt{plain},还可以改为 \opt{pifont} 的各个版本,从左往右依次为普通版、阴文衬线版、阳文无衬线版和阴文无衬线版,缺点是它们的编号仅包括 1-10。
% \changes{v1.25}{2021/05/12}{增加脚注样式设置选项。}
% \end{function}
%
@@ -715,14 +719,14 @@
% \end{function}
%
% \begin{optdesc}
-% \item[lolskip] \opt{lolskip} 是代码目录中章之间的代码标题的距离,与 \CTeX 的表格目录和图片目录中章之间的标题距离选项 \opt{lotskip} 和 \opt{lofskip} 类似,它们的值均默认0.8 pc,在 article 模式中此选项失效。
+% \item[lolskip] \opt{lolskip} 是代码目录中章之间的代码标题的距离,与 \CTeX 的表格目录和图片目录中章之间的标题距离选项 \opt{lotskip} 和 \opt{lofskip} 类似,它们的值均默认 0.8 pc,在 article 模式中此选项失效。
% \item[belowoffset] \opt{belowoffset} 选项为主文档目录标题下方的间距补偿,一般为负值,用于抵消 \opt{format} 中额外的垂直间距。\opt{(level)} 中的 \opt{belowoffset} 与之意义类似,代表 figure、table 和 lstlisting 三个级别,也可以使用 \opt{list} 统一设置,一般为正值。
% \item[tocline] 目录标签整体使用 \opt{tocline} 设置,在图表标签的参数中 \#1 代表编号,代码标签中则是 \tn{thelstlisting} 代表编号,标签中还可包含标签名称,默认标签名称与图、表和代码环境的标题名称一致。下面举个设置标签的例子:
% \begin{ctexexam}
% \tocset
% {
% hang = false,
-% tocline-fig = 图#1\hspace{\ccwd},
+% tocline-fig = 图 #1\hspace{\ccwd},
% tocline-lst = 代码\thelstlisting\hspace{\ccwd}
% }
% \end{ctexexam}
@@ -824,7 +828,7 @@
% \ \tn{item} <习题内容>
% \tn{end}\marg{exercise}
% \end{syntax}
-% 习题环境 \env{exercise} 的标题紧接上一节编号并加入目录与页眉,当使用星号参数时不进行编号,使用+号参数独立编号并启用 \pkg{tcolorbox} 支持生成标题,并使 \opt{color} 生效。第三个 \meta{键值列表} 的选项与小节 \ref{subsec:sort list} 排序列表相同,\opt{number} 的编号格式也是如此。第一个 \meta{键值列表} 中包含的选项如下:
+% 习题环境 \env{exercise} 的标题紧接上一节编号并加入目录与页眉,当使用星号参数时不进行编号,使用 + 号参数独立编号并启用 \pkg{tcolorbox} 支持生成标题,并使 \opt{color} 生效。第三个 \meta{键值列表} 的选项与小节 \ref{subsec:sort list} 排序列表相同,\opt{number} 的编号格式也是如此。第一个 \meta{键值列表} 中包含的选项如下:
% \changes{v1.23}{2021/02/08}{增加准确的习题盒子标题目录锚点。}
% \end{function}
%
@@ -835,7 +839,7 @@
% number = <习题编号格式|(1.)>
% numsep = <编号与标题的间距|(0.5\tn{ccwd})>
% \end{syntax}
-% 第二个 \meta{键值列表} 在是否使用+号参数时用法不同,使用+号参数时为 \pkg{tcolorbox} 的盒子选项,例如 \opt{boxrule} 和 \opt{fontupper}。不使用+号参数时相当于设置 \tn{ctexset}\{section = {\#1}\} 键值选项列表,例如 \opt{format} 和 \opt{beforeskip}。另外还可以使用 \tn{exerprologue} 命令在习题环境开始前插入一段内容,可以是文本或者代码,需要在每一个习题环境前使用。
+% 第二个 \meta{键值列表} 在是否使用 + 号参数时用法不同,使用 + 号参数时为 \pkg{tcolorbox} 的盒子选项,例如 \opt{boxrule} 和 \opt{fontupper}。不使用 + 号参数时相当于设置 \tn{ctexset}\{section = {\#1}\} 键值选项列表,例如 \opt{format} 和 \opt{beforeskip}。另外还可以使用 \tn{exerprologue} 命令在习题环境开始前插入一段内容,可以是文本或者代码,需要在每一个习题环境前使用。
% \end{function}
%
% \begin{ctexexam}
@@ -936,6 +940,26 @@
% \qtyrange[unit-color = green]{1.5}{4}{kg}
% \end{ctexexam}
%
+% \subsection{计数器}
+% \begin{function}[added = 2021-06-30]{\newcounter,\EBUseCounter}
+% \begin{syntax}
+% \tn{newcounter}\marg{计数器}\oarg{父计数器}
+% \tn{EBUseCounter*}\oarg{父计数器}\parg{编号|(arabic)}\marg{计数器}\marg{内容}\oarg{分隔符|(.)}\parg{数值}
+% \end{syntax}
+% \tn{newcounter} 是 \LaTeX 自带的创建计数器命令,\tn{EBUseCounter} 将会以一定的格式使用由它创建的计数器,将会以 \tn{the}\meta{父计数器}\meta{分隔符}\tn{the}\meta{计数器}\meta{内容} 输出当前内容。
+% \changes{v1.26o}{2021/06/30}{增加计数器使用命令 \tn{EBUseCounter}。}
+% \end{function}
+%
+% 需要注意的是 \tn{EBUseCounter} 仅具有 \textbf{输出功能},并不会改变计数器原有的绑定关系。默认每使用一次命令 \meta{计数器} 的值增加 1,带有星号的命令使 \meta{计数器} 保持当前值,\meta{编号} 为 arabic 和 alpha 等格式,\meta{数值} 可以手动将 \meta{计数器} 设为指定值。
+%
+% 在一定的场合下可能用到 \tn{EBUseCounter} 命令,比如通过新建快捷命令在一些位置使用定理环境的计数器,使用 \tn{labelformat} 设置计数器的引用标签需添加 eb@:
+% \begin{ctexexam}
+% \labelformat{eb@theorem}{定理 #1}
+% \newcommand{\theoremhead}[1]
+% {定理 \EBUseCounter[chapter]{theorem}{\hspace{\ccwd}#1}}
+% \theoremhead{定理标题}\label{thm:theorem}
+% \end{ctexexam}
+%
% \subsection{化学式}
% \begin{function}[added = 2021-01-05]{\ch,\chemfig}
% \begin{syntax}
@@ -1015,24 +1039,6 @@
% 该环境由 \pkg{setspace} 提供,可以指定环境内段落的行距,使用浮点数控制行距倍数。
% \end{function}
%
-% \subsection{计数器}
-% \begin{function}[added = 2021-06-30]{\newcounter,\EBUseCounter}
-% \begin{syntax}
-% \tn{newcounter}\marg{计数器}\oarg{父计数器}
-% \tn{EBUseCounter*}\oarg{父计数器的值}\parg{编号|(arabic)}\marg{计数器}\marg{内容}\oarg{分隔符|(.)}
-% \end{syntax}
-% \tn{newcounter} 是 \LaTeX 自带的创建计数器命令,\tn{EBUseCounter} 将会以一定的格式使用由它创建的计数器,将会以 \tn{the}\meta{父计数器}\meta{分隔符}\meta{计数器}\meta{内容} 输出当前内容。带有星号的命令不会使计数器的值增加,所以可以使用当前 \tn{the}\meta{计数器} 的值,\meta{编号} 为 arabic 和 alpha 等格式。
-% \changes{v1.26n}{2021/06/30}{增加计数器使用命令 \tn{EBUseCounter}。}
-% \end{function}
-%
-% 在一定的场合下可能用到 \tn{EBUseCounter} 命令,比如通过新建快捷命令在一些位置使用定理环境的计数器,使用 \tn{labelformat} 设置它的引用标签前缀需添加 eb@:
-% \begin{ctexexam}
-% \labelformat{eb@theorem}{定理#1}
-% \newcommand{\theoremhead}[1]
-% {定理\space\EBUseCounter[chapter]{theorem}{#1}}
-% \theoremhead{定理标题}\label{thm:theorem}
-% \end{ctexexam}
-%
% \subsection{下划线}
% \begin{function}[added = 2021-04-03]{\uline,\uuline,\uwave}
% \begin{syntax}
@@ -1128,7 +1134,7 @@
%<*class>
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{l3keys2e}
-\ProvidesExplClass{easybook}{2021/06/30}{1.26n}
+\ProvidesExplClass{easybook}{2021/07/01}{1.26o}
{Typeset Chinese books or notes}
\bool_set_false:N \l__eb_compile_draft_bool
@@ -1376,7 +1382,7 @@
%<*package>
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{etoolbox}
-\ProvidesExplPackage{easybase}{2021/06/30}{1.26n}
+\ProvidesExplPackage{easybase}{2021/07/01}{1.26o}
{Typeset Chinese books or notes}
\cs_generate_variant:Nn \eb_ctex_define:nn { nx }
@@ -1828,19 +1834,10 @@
\dim_set:Nn \footnotesep { \dim_use:N \box_ht:N \strutbox }
\bool_if:NT \l__eb_chap_counter_withpart_bool
{ \counterwithin*{chapter}{part} }
- \str_case:VnF \l__eb_foot_counter_parent_choice_tl
+ \str_case:Vn \l__eb_foot_counter_parent_choice_tl
{
- { part } { \use_i:nn }
- { page } { \use_ii:nn }
- }
- { \use_none:nn }
- {
- \counterwithout*{footnote}{chapter}
- \counterwithin*{footnote}{part}
- }
- {
- \counterwithout*{footnote}{chapter}
- \counterwithin*{footnote}{page}
+ { part } { \counterwithin*{footnote}{part} }
+ { page } { \counterwithin*{footnote}{page} }
}
\bool_if:NTF \l__eb_footnote_hang_bool
{ \booltrue{FN@hangfoot} }
@@ -2106,21 +2103,26 @@
\newcounter{bichapter}
\newcounter{bisection}[bichapter]
\newcounter{bisubsection}[bisection]
-\NewDocumentCommand{\EBUseCounter}{soD(){arabic}mmO{.}}
+\cs_set_protected:Npn \eb_current_label:n #1
+ {
+ \tl_set:Nx \@currentlabel
+ {
+ \use:c { p@#1 }
+ \tl_use:c { the#1 }
+ }
+ }
+\NewDocumentCommand{\EBUseCounter}{soD(){arabic}mmO{.}d()}
{
\IfBooleanF{#1}{\stepcounter{#4}}
- \tl_set:cn { eb@the#4 }
+ \IfValueT{#7}{\setcounter{#4}{#7}}
+ \tl_set:cn { theeb@#4 }
{
\IfValueT{#2}{\use:c { the#2 }#6}
\use:c {#3}{#4}\space #5
}
- \tl_use:c { eb@the#4 }
- \tl_remove_once:cn { eb@the#4 } {#5}
- \tl_set:Nx \@currentlabel
- {
- \use:c { p@eb@#4 }
- \use:c { eb@the#4 }
- }
+ \tl_use:c { theeb@#4 }
+ \tl_remove_once:cn { theeb@#4 } {#5}
+ \eb_current_label:n { eb@#4 }
}
\cs_new:Npn \eb_arabic:n #1 { \int_to_arabic:v { c@#1 } }
\cs_new:Npn \eb_section_counter_prefix:n #1
@@ -2161,8 +2163,7 @@
\def\CTEX@thechapter{\CTEX@bichapter@number}
\def\CTEX@postchapter{\CTEX@postbichapter}
\eb@before@addbitoc@hook
- \addcontentsline{tec}{#1}
- {\use:c { CTEX@#1@tocline }{#1}{#2}}
+ \addcontentsline{tec}{#1}{\use:c { CTEX@#1@tocline }{#1}{#2}}
\group_end:
}
\seq_const_from_clist:Nn \c__eb_bitoc_title_level_seq
@@ -2626,7 +2627,6 @@
\RenewDocumentCommand{\declaretheorem}{O{}m}
{\AfterPreamble{\eb@declare@theorem@save[#1]{#2}}}
\cs_set_eq:NN \newtheorem \declaretheorem
-
\prop_new:N \l__eb_thmtools_entry_prop
\clist_const:Nn \c__eb_thmtools_entry_clist
{
@@ -2646,11 +2646,31 @@
\l__eb_thmtools_entry_prop \c__eb_thmtools_entry_clist
\prop_map_inline:Nn \l__eb_thmtools_entry_prop
{ \eb_ctex_define:nn { thmset } { #1 .tl_set:N = #2 } }
+\NewDocumentCommand{\eb_assign_tag_brackets:n}
+ {>{\SplitArgument{1}{,}}m}
+ {\eb_assign_tag_brackets_pos:nn #1}
+\cs_new_protected:Npn \eb_assign_tag_brackets_pos:nn #1#2
+ {
+ \tl_set:Nn \eb@tag@brackets@left {#1}
+ \tl_set:Nn \eb@tag@brackets@right {#2}
+ }
+\cs_gset:Npn \tagform@ #1
+ {
+ \maketag@@@
+ {
+ \color{ctex@emph}
+ \eb@tag@brackets@left
+ \ignorespaces #1\unskip\@@italiccorr
+ \eb@tag@brackets@right
+ }
+ }
\eb_ctex_define:nn { thmset }
{
thmbox .bool_set:N = \l__eb_thmbox_bool,
thmbox .default:n = true,
- thmbox .initial:n = false
+ thmbox .initial:n = false,
+ brackets .code:n = \eb_assign_tag_brackets:n {#1},
+ brackets .initial:n = { (,) }
}
\ctex_set:nn { thmset }
{
@@ -2731,8 +2751,6 @@
\skip_set:Nn \abovedisplayshortskip { 0pt }
\skip_set:Nn \belowdisplayshortskip { 5pt plus 1pt minus 1pt }
}
-\cs_gset:Npn \tagform@ #1
- { \maketag@@@{\color{ctex@emph}(\ignorespaces #1\unskip\@@italiccorr)} }
\ctex_at_end_package:nn { unicode-math }
{ \msg_redirect_module:nnn { unicode-math } { warning } { info } }
@@ -2744,7 +2762,7 @@
number .initial:n = { 1. },
title .tl_set:N = \eb@tc@exercise@title,
title .initial:n = \c__eb_name_exercise_tl,
- numsep .dim_set:N = \eb@tc@exercise@numsep,
+ numsep .dim_set:N = \eb@toc@exercise@numsep,
numsep .initial:n = 0.5\ccwd
}
\ctex_at_end_package:nn { tcolorbox }
@@ -2787,6 +2805,11 @@
\newtcbox[auto~counter]{\eb@tc@exercise@box}[1]{tc-exercise,#1}
\tl_new:N \eb@tc@list@prologue
\cs_new:Npn \exerprologue #1 { \tl_gset:Nn \eb@tc@list@prologue {#1} }
+ \cs_new:Npn \eb_tcb_toc_counter_numsep:n #1
+ {
+ \thetcbcounter
+ \hspace{\use:c { eb@toc@#1@numsep }}
+ }
\NewDocumentEnvironment{outline}{O{}D(){\abstractname}o+b}
{
\begin{tcolorbox}[tc-outline,title = #2,IfValueT = {#3}{#3}]
@@ -2809,19 +2832,21 @@
{
\markright
{
- \thetcbcounter
- \hspace{\eb@tc@exercise@numsep}
+ \eb_tcb_toc_counter_numsep:n { exercise }
\eb@tc@exercise@title
}
\addcontentsline{toc}{section}
{
- \thetcbcounter
- \hspace{\eb@toc@section@numsep}
+ \eb_tcb_toc_counter_numsep:n { section }
\eb@tc@exercise@title
}
}
}{
- \IfBooleanF{#1}{\thetcbcounter\hspace{\eb@tc@exercise@numsep}}
+ \IfBooleanF{#1}
+ {
+ \eb_tcb_toc_counter_numsep:n { exercise }
+ \eb_current_label:n { tcbcounter }
+ }
\eb@tc@exercise@title
}
}{
diff --git a/macros/latex/contrib/easybook/easybook.pdf b/macros/latex/contrib/easybook/easybook.pdf
index f348bf50bc..5463fbf874 100644
--- a/macros/latex/contrib/easybook/easybook.pdf
+++ b/macros/latex/contrib/easybook/easybook.pdf
Binary files differ
diff --git a/macros/latex/contrib/jsclasses/README.md b/macros/latex/contrib/jsclasses/README.md
index 3d2e2b2b22..284efa7815 100644
--- a/macros/latex/contrib/jsclasses/README.md
+++ b/macros/latex/contrib/jsclasses/README.md
@@ -37,7 +37,7 @@ distributed separately.
## Release Date
-2020-10-09
+2021-07-01
Haruhiko Okumura,
Japanese TeX Development Community
diff --git a/macros/latex/contrib/jsclasses/jsclasses.dtx b/macros/latex/contrib/jsclasses/jsclasses.dtx
index 08d6bd4486..37567b64d9 100644
--- a/macros/latex/contrib/jsclasses/jsclasses.dtx
+++ b/macros/latex/contrib/jsclasses/jsclasses.dtx
@@ -9,13 +9,13 @@
% pLaTeX2ε新ドキュメントクラス(日本語 TeX 開発コミュニティ版)
% 原作者:奥村晴彦 <okumura@okumuralab.org>
%
-% Copyright 1993-2020
+% Copyright 1993-2021
% The LaTeX3 Project and any individual authors listed elsewhere
% in this file.
%
% Copyright 1995-1999 ASCII Corporation.
% Copyright 1999-2016 Haruhiko Okumura
-% Copyright 2016-2020 Japanese TeX Development Community
+% Copyright 2016-2021 Japanese TeX Development Community
%
% \fi
%
@@ -32,7 +32,7 @@
%<*driver>
\ProvidesFile{jsclasses.dtx}
%</driver>
- [2020/10/09 jsclasses (okumura, texjporg)]
+ [2021/06/28 jsclasses (okumura, texjporg)]
%<*driver>
\documentclass{jsarticle}
\usepackage{doc}
@@ -1088,7 +1088,7 @@
%</class>
%<*minijs>
%% min/goth -> jis/jisg (for pLaTeX only)
-\ifx\ucs\@undefined
+\ifnum\jis"2121="3000 \else
\@for\@tempa:=5,6,7,8,9,10,10.95,12,14.4,17.28,20.74,24.88\do{%
\expandafter\let\csname JY1/mc/m/n/\@tempa\endcsname\relax
\expandafter\let\csname JY1/gt/m/n/\@tempa\endcsname\relax
diff --git a/macros/latex/contrib/jsclasses/jsclasses.pdf b/macros/latex/contrib/jsclasses/jsclasses.pdf
index b1783be1fb..f41951d9e6 100644
--- a/macros/latex/contrib/jsclasses/jsclasses.pdf
+++ b/macros/latex/contrib/jsclasses/jsclasses.pdf
Binary files differ
diff --git a/macros/latex/contrib/jsclasses/okumacro.dtx b/macros/latex/contrib/jsclasses/okumacro.dtx
index 0c9648258e..e2d70e4770 100644
--- a/macros/latex/contrib/jsclasses/okumacro.dtx
+++ b/macros/latex/contrib/jsclasses/okumacro.dtx
@@ -12,7 +12,7 @@
% http://oku.edu.mie-u.ac.jp/~okumura/
%
%<okumacro>\NeedsTeXFormat{pLaTeX2e}
-%<okumacro>\ProvidesPackage{okumacro}[2019/07/25 okumura, texjporg]
+%<okumacro>\ProvidesPackage{okumacro}[2021/07/01 okumura, texjporg]
%<*driver>
\documentclass{jsarticle}
\usepackage{doc}
@@ -399,7 +399,7 @@
% [2016-12-04] \pLaTeX で通るコードが \upLaTeX で通らなくなることを防ぐために,u\pLaTeX の場合にはU+FF0D,U+2014で定義したものも別途用意しました。
%
% \begin{macrocode}
-\ifx\ucs\@undefined\else
+\ifnum\jis"2121="3000 % upTeX check
\begingroup
\kansujichar1="FF0D
\kansujichar2="2014
@@ -1161,12 +1161,19 @@
% とりあえず |amsmath| の |equation(*)|,|align(*)| 環境の類だけここで直しておきます。
% このあたりはまた見直します。
%
+% [2021-07-01] |okumacro| が有ると |xalignat| 上部のアキが大きくなる現象
+% (forum:3029)が報告されました。|js*| クラスのための修正だったはずですが,
+% |js*| クラスを使った場合でも「修正しない方がバランスが良い」という挙動
+% ^^A 少なくとも\TeX\ Live 2014--2021は同じ挙動。
+% ^^A https://oku.edu.mie-u.ac.jp/tex/mod/forum/discuss.php?d=3029
+% だったため,削除しました。
+%
% \begin{macrocode}
-\@ifundefined{widebaselines}{}{%
- \let\endmathdisplaysave=\endmathdisplay
- \def\endmathdisplay{\widebaselines\endmathdisplaysave}}
- \let\start@alignsave=\start@align
- \def\start@align{\vspace{4pt}\start@alignsave}
+%\@ifundefined{widebaselines}{}{%
+% \let\endmathdisplaysave=\endmathdisplay
+% \def\endmathdisplay{\widebaselines\endmathdisplaysave}}
+% \let\start@alignsave=\start@align
+% \def\start@align{\vspace{4pt}\start@alignsave}
% \end{macrocode}
%
% 以上で終わりです。
diff --git a/macros/latex/contrib/jsclasses/okumacro.pdf b/macros/latex/contrib/jsclasses/okumacro.pdf
index 78b40bb433..d01f531572 100644
--- a/macros/latex/contrib/jsclasses/okumacro.pdf
+++ b/macros/latex/contrib/jsclasses/okumacro.pdf
Binary files differ
diff --git a/macros/latex/contrib/nicematrix/nicematrix-french.pdf b/macros/latex/contrib/nicematrix/nicematrix-french.pdf
index 55b39da0c4..30ae5840fa 100644
--- a/macros/latex/contrib/nicematrix/nicematrix-french.pdf
+++ b/macros/latex/contrib/nicematrix/nicematrix-french.pdf
Binary files differ
diff --git a/macros/latex/contrib/nicematrix/nicematrix-french.tex b/macros/latex/contrib/nicematrix/nicematrix-french.tex
index 5339ea7ac8..cfa537184b 100644
--- a/macros/latex/contrib/nicematrix/nicematrix-french.tex
+++ b/macros/latex/contrib/nicematrix/nicematrix-french.tex
@@ -213,7 +213,8 @@ lettres |L|, |C| et |R|, \pkg{nicematrix} doit être chargé avec l'option
\begin{Verbatim}
\usepackage[define-L-C-R]{nicematrix}
\end{Verbatim}
-
+\textbf{Cette clé sera probablement supprimée dans une future version de
+ \pkg{nicematrix}.}
\section{L'espace vertical entre les rangées}
@@ -688,12 +689,13 @@ défaut de ce premier argument obligatoire est |1-1|.}.
-\subsection{Petite remarque}
+\subsection{Positionnement horizontal du contenu des blocs}
-On remarquera que le centrage horizontal du contenu des blocs est
-correct même si un espacement des colonnes a été demandé par une instruction
-comme |!{\qquad}| dans le préambule (ce n'est pas le cas avec |\multicolumn|).
-Dans l'exemple suivant, l'en-tête «Premier groupe» est correctement centré.
+Par défaut, le positionnement horizontal des contenus des blocs est calculé sur
+le \emph{contenu} des colonnes impliquées. De ce fait, dans l'exemple suivant,
+l'en-tête «Premier groupe» est correctement centré même si un espacement
+des colonnes a été demandé par une instruction comme |!{\qquad}| dans le
+préambule (ce n'est pas le cas avec |\multicolumn|).
\medskip
\begin{center}
@@ -701,8 +703,8 @@ Dans l'exemple suivant, l'en-tête «Premier groupe» est correctement centré.
\begin{BVerbatim}
\begin{NiceTabular}{@{}c!{\qquad}ccc~emphase#!{\qquad}+ccc~@{}}
\toprule
-& ~emphase#\Block{1-3}{Premier groupe}+ & & & \Block{1-3}{Deuxième groupe} \\
-Rang & 1A & 1B & 1C & 2A & 2B & 2C \\
+Rang & ~emphase#\Block{1-3}{Premier groupe}+ & & & \Block{1-3}{Deuxième groupe} \\
+ & 1A & 1B & 1C & 2A & 2B & 2C \\
\midrule
1 & 0.657 & 0.913 & 0.733 & 0.830 & 0.387 & 0.893\\
2 & 0.343 & 0.537 & 0.655 & 0.690 & 0.471 & 0.333\\
@@ -717,8 +719,8 @@ Rang & 1A & 1B & 1C & 2A & 2B & 2C \\
\begin{center}
\begin{NiceTabular}{@{}c!{\qquad}ccc!{\qquad}ccc@{}}
\toprule
-& \Block{1-3}{Premier groupe} & & & \Block{1-3}{Deuxième groupe} \\
-Rang & 1A & 1B & 1C & 2A & 2B & 2C \\
+Rang & \Block{1-3}{Premier groupe} & & & \Block{1-3}{Deuxième groupe} \\
+ & 1A & 1B & 1C & 2A & 2B & 2C \\
\midrule
1 & 0.657 & 0.913 & 0.733 & 0.830 & 0.387 & 0.893\\
2 & 0.343 & 0.537 & 0.655 & 0.690 & 0.471 & 0.333\\
@@ -728,7 +730,11 @@ Rang & 1A & 1B & 1C & 2A & 2B & 2C \\
\end{NiceTabular}
\end{center}
-
+\medskip
+\colorbox{yellow!50}{\bfseries Nouveau 5.17}\enskip Pour avoir un positionnement
+horizontal du contenu du bloc qui s'appuie sur les limites des colonnes du
+tableau LaTeX (et non sur le contenu de ces colonnes), il faut utiliser les clés
+|L|, |R| et |C| de la commande |\Block|.
\section{Les filets horizontaux et verticaux}
@@ -1004,6 +1010,12 @@ arum & iris & jacinthe & muguet
\end{NiceTabular}
\end{center}
+
+\bigskip
+\colorbox{yellow!50}{\textbf{Nouveau 5.17}}\enskip La clé
+|hvlines-except-borders| est similaire à la clé |hvlines| mais ne trace pas les
+filets sur les bords horizontaux et verticaux du tableau.
+
\bigskip
\subsubsection{Les coins (vides)}
\label{corners}
@@ -1016,7 +1028,7 @@ Pour chacun de ces coins, on appellera \emph{coin vide} (ou tout simplement
\emph{coin}) la réunion de toutes les cases vides situées dans au moins un
rectangle entièrement constitué de cases vides partant de ce coin.\footnote{Pour
être complet, on doit préciser que toute case située dans un bloc (même si
- elle vide) n'est pas prise en compte pour la détermination des coins. Ce
+ elle est vide) n'est pas prise en compte pour la détermination des coins. Ce
comportement est naturel.}
\smallskip
@@ -4158,6 +4170,10 @@ est utilisée est considérée comme vide. Cette commande peut être utilisée p
fixer la largeur des colonnes sans interférer avec le tracé des lignes en
pointillés par \pkg{nicematrix}.
+\medskip
+\item Une case d'une colonne de type |p|, |m| ou |t| est toujours non vide.
+\emph{Attention} : Ne pas se fier à ce point car il est susceptible de changer.
+
\end{itemize}
@@ -4710,7 +4726,7 @@ a_{41} & a_{42} & a_{43} & \Block[draw]{}{a_{44}} \\
On remarquera que les traits que l'on vient de tracer sont dessinés \emph{après}
la matrice sans modifier la position des composantes de celle-ci. En revanche,
-les traits tracés par |\hline|, le spécificateur «\verb+|+» ou les options
+les traits tracés par |\hline|, |\Hline|, le spécificateur «\verb+|+» ou les options
|hlines|, |vlines| et |hvlines| «écartent» les composantes de la
matrice.\footnote{Pour la commande |\cline|, voir la remarque
p.~\pageref{remark-cline}.}
diff --git a/macros/latex/contrib/nicematrix/nicematrix.dtx b/macros/latex/contrib/nicematrix/nicematrix.dtx
index 43fb1accbd..5e195b9103 100644
--- a/macros/latex/contrib/nicematrix/nicematrix.dtx
+++ b/macros/latex/contrib/nicematrix/nicematrix.dtx
@@ -15,8 +15,8 @@
%
% \fi
% \iffalse
-\def\myfileversion{5.16}
-\def\myfiledate{2021/06/20}
+\def\myfileversion{5.17}
+\def\myfiledate{2021/07/01}
%
%
%<*batchfile>
@@ -263,7 +263,8 @@ version 2005/12/01 or later.
% \begin{Verbatim}
% \usepackage[define-L-C-R]{nicematrix}
% \end{Verbatim}
-%
+% \textbf{This key will probably be deleted in a future version of
+% \pkg{nicematrix}.}
%
% \section{The vertical space between the rows}
%
@@ -725,13 +726,14 @@ version 2005/12/01 or later.
%
%
%
-% \subsection{A small remark}
+% \subsection{Horizontal position of the content of the block}
%
-% One should remark that the horizontal centering of the contents of the blocks
-% is correct even when an instruction such as |!{\qquad}| has been used in the
-% preamble of the array in order to increase the space between two columns (this
-% is not the case with |\multicolumn|). In the following example, the header
-% ``First group'' is correctly centered.
+% By default, the horizontal position of the content of a block is computed
+% by using the positions of the \emph{contents} of the columns implied in that
+% block. That's why, in the following example, the header ``First group'' is
+% correctly centered despite the instruction |!{\qquad}| in the preamble which
+% has been used to increase the space between the columns (this
+% is not the behaviour of |\multicolumn|).
%
% \medskip
% \begin{center}
@@ -739,8 +741,8 @@ version 2005/12/01 or later.
% \begin{BVerbatim}
% \begin{NiceTabular}{@{}c!{\qquad}ccc~emphase#!{\qquad}+ccc@{}}
% \toprule
-% & ~emphase#\Block{1-3}{First group}+ & & & \Block{1-3}{Second group} \\
-% Rank & 1A & 1B & 1C & 2A & 2B & 2C \\
+% Rank & ~emphase#\Block{1-3}{First group}+ & & & \Block{1-3}{Second group} \\
+% & 1A & 1B & 1C & 2A & 2B & 2C \\
% \midrule
% 1 & 0.657 & 0.913 & 0.733 & 0.830 & 0.387 & 0.893\\
% 2 & 0.343 & 0.537 & 0.655 & 0.690 & 0.471 & 0.333\\
@@ -755,8 +757,8 @@ version 2005/12/01 or later.
% \begin{center}
% \begin{NiceTabular}{@{}c!{\qquad}ccc!{\qquad}ccc@{}}
% \toprule
-% & \Block{1-3}{First group} & & & \Block{1-3}{Second group} \\
-% Rank & 1A & 1B & 1C & 2A & 2B & 2C \\
+% Rank & \Block{1-3}{First group} & & & \Block{1-3}{Second group} \\
+% & 1A & 1B & 1C & 2A & 2B & 2C \\
% \midrule
% 1 & 0.657 & 0.913 & 0.733 & 0.830 & 0.387 & 0.893\\
% 2 & 0.343 & 0.537 & 0.655 & 0.690 & 0.471 & 0.333\\
@@ -766,6 +768,11 @@ version 2005/12/01 or later.
% \end{NiceTabular}
% \end{center}
%
+% \medskip
+% \colorbox{yellow!50}{\bfseries New 5.17}\enskip In order to have an horizontal
+% positionning of the content of the block computed with the limits of the
+% columns of the LaTeX array (and not with the contents of those columns), one
+% may use the key |L|, |R| and |C| of the command |\Block|.
%
%
% \section{The rules}
@@ -1026,6 +1033,10 @@ version 2005/12/01 or later.
% \end{NiceTabular}
% \end{center}
%
+% \bigskip
+% \colorbox{yellow!50}{\bfseries New 5.17}\enskip The key
+% |hvlines-except-corners| is similar to the key |hvlines| but does not draw the
+% rules on the horizontal and vertical borders of the array.
%
% \subsubsection{The (empty) corners}
%
@@ -4099,6 +4110,11 @@ version 2005/12/01 or later.
% meaning as |\hspace| except that the cell where it is used is considered as
% empty. This command can be used to fix the width of some columns of the matrix
% without interfering with \pkg{nicematrix}.
+%
+% \medskip
+% \item A cell of a column of type |p|, |m| or |t| is always considered as not
+% emtpy. \emph{Caution} : One should not rely upon that point because it may
+% change if a future version of \pkg{nicematrix}.
% % \end{itemize}
%
%
@@ -4644,7 +4660,7 @@ version 2005/12/01 or later.
%
% We should remark that the rules we have drawn are drawn \emph{after} the
% construction of the array and thus, they don't spread the cells of the array.
-% We recall that, on the other side, the command |\hline|, the specifier ``"|"''
+% We recall that, on the other side, the commands |\hline| and |\Hline|, the specifier ``"|"''
% and the options |hlines|, |vlines| and |hvlines| spread the
% cells.\footnote{For the command |\cline|, see the remark
% p.~\pageref{remark-cline}.}
@@ -5867,17 +5883,27 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \medskip
-% The parameters of position of the label of a block. For the horizontal
-% position, the possible values are |c|, |r| and |l|. For the vertical position,
-% the possible values are |c|, |t| and |b|. Of course, it would be interesting to
-% program a key |T| and a key |B|.
+% The parameters of the horizontal position of the label of a block. If the user
+% uses the key |c| or |C|, the value is |c|. If the user uses the key |l| or
+% |L|, the value is |l|. If the user uses the key |r| or |R|, the value is |r|.
+% If the user has used a capital letter, the boolean
+% |\l_@@_hpos_of_block_cap_bool| will be raised (in the second pass of the
+% analyze of the keys of the command |\Block|).
% \begin{macrocode}
\tl_new:N \l_@@_hpos_of_block_tl
\tl_set:Nn \l_@@_hpos_of_block_tl { c }
+\bool_new:N \l_@@_hpos_of_block_cap_bool
+% \end{macrocode}
+%
+% \medskip
+% For the vertical position, the possible values are |c|, |t| and |b|. Of
+% course, it would be interesting to program a key |T| and a key |B|.
+% \begin{macrocode}
\tl_new:N \l_@@_vpos_of_block_tl
\tl_set:Nn \l_@@_vpos_of_block_tl { c }
% \end{macrocode}
%
+%
% \medskip
% Used when the key |draw-first| is used for |\Ddots| or |\Iddots|.
% \begin{macrocode}
@@ -6428,6 +6454,14 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
+% The boolean |\l_@@_except_borders_bool| will be raised when the key
+% |hvlines-except-borders| will be used (but that key has also other effects).
+% \begin{macrocode}
+\bool_new:N \l_@@_except_borders_bool
+% \end{macrocode}
+%
+%
+% \bigskip
% The dimension |\l_@@_left_margin_dim| correspond to the option |left-margin|.
% Idem for the right margin. These parameters are involved in the creation of
% the ``medium nodes'' but also in the placement of the delimiters and the
@@ -6592,6 +6626,12 @@ version 2005/12/01 or later.
\clist_set:Nn \l_@@_vlines_clist { all }
\clist_set:Nn \l_@@_hlines_clist { all }
} ,
+ hvlines-except-borders .code:n =
+ {
+ \clist_set:Nn \l_@@_vlines_clist { all }
+ \clist_set:Nn \l_@@_hlines_clist { all }
+ \bool_set_true:N \l_@@_except_borders_bool
+ } ,
parallelize-diags .bool_set:N = \l_@@_parallelize_diags_bool ,
% \end{macrocode}
%
@@ -8549,6 +8589,10 @@ version 2005/12/01 or later.
% \begin{macrocode}
\int_gzero:N \c@jCol
\tl_gclear:N \g_@@_preamble_tl
+% \end{macrocode}
+% |\g_tmpb_bool| will be raised if you have a \verb+|+ at the end of the preamble.
+% \begin{macrocode}
+ \bool_gset_false:N \g_tmpb_bool
\tl_if_eq:NnTF \l_@@_vlines_clist { all }
{
\tl_gset:Nn \g_@@_preamble_tl
@@ -8609,7 +8653,13 @@ version 2005/12/01 or later.
{ ! \str_if_eq_p:Vn \g_@@_right_delim_tl { . } }
{ \bool_set_false:N \l_@@_NiceArray_bool }
% \end{macrocode}
-%
+%
+% \medskip
+% We want to remind whether there is a specifier \verb+|+ at the end of the preamble.
+% \begin{macrocode}
+ \bool_if:NT \g_tmpb_bool { \bool_set_true:N \l_@@_bar_at_end_of_pream_bool }
+% \end{macrocode}
+%
% \bigskip
% We complete the preamble with the potential ``exterior columns''.
% \begin{macrocode}
@@ -8774,11 +8824,16 @@ version 2005/12/01 or later.
\tl_gput_right:Nx \g_@@_internal_code_after_tl
{ \@@_vline:nn { \@@_succ:n \c@jCol } { \int_use:N \l_tmpa_int } }
\int_zero:N \l_tmpa_int
+ \str_if_eq:nnT { #1 } { \q_stop }
+ { \bool_gset_true:N \g_tmpb_bool }
\@@_patch_preamble:n #1
}
}
% \end{macrocode}
%
+% \begin{macrocode}
+\bool_new:N \l_@@_bar_at_end_of_pream_bool
+% \end{macrocode}
%
% \medskip
% For |p|, |m| and |b|
@@ -8870,7 +8925,7 @@ version 2005/12/01 or later.
\str_if_eq:VnTF \g_@@_left_delim_tl { . }
{
% \end{macrocode}
-% In that case, in fact, the firt letter of the preamble must be considered as
+% In that case, in fact, the first letter of the preamble must be considered as
% the left delimiter of the array.
% \begin{macrocode}
\tl_gset:Nn \g_@@_left_delim_tl { #1 }
@@ -8879,29 +8934,26 @@ version 2005/12/01 or later.
}
{
\tl_gput_right:Nn \g_@@_preamble_tl { ! { \enskip } }
- \tl_gput_right:Nx \g_@@_internal_code_after_tl
- { \@@_delimiter:nnn #1 { \@@_succ:n \c@jCol } \c_true_bool }
- \tl_if_in:nnTF { ( [ \{ ) ] \} } { #2 }
- {
- \@@_error:nn { delimiter~after~opening } { #2 }
- \@@_patch_preamble:n
- }
- { \@@_patch_preamble:n #2 }
+ \@@_patch_preamble_vii_i:nn { #1 } { #2 }
}
}
+ { \@@_patch_preamble_vii_i:nn { #1 } { #2 } }
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_preamble_vii_i:nn #1 #2
+ {
+ \tl_gput_right:Nx \g_@@_internal_code_after_tl
+ { \@@_delimiter:nnn #1 { \@@_succ:n \c@jCol } \c_true_bool }
+ \tl_if_in:nnTF { ( [ \{ ) ] \} } { #2 }
{
- \tl_gput_right:Nx \g_@@_internal_code_after_tl
- { \@@_delimiter:nnn #1 { \@@_succ:n \c@jCol } \c_true_bool }
- \tl_if_in:nnTF { ( [ \{ ) ] \} } { #2 }
- {
- \@@_error:nn { delimiter~after~opening } { #2 }
- \@@_patch_preamble:n
- }
- { \@@_patch_preamble:n #2 }
+ \@@_error:nn { delimiter~after~opening } { #2 }
+ \@@_patch_preamble:n
}
+ { \@@_patch_preamble:n #2 }
}
% \end{macrocode}
-%
%
% \bigskip
% For |)|, |]| and |\}|. We have two arguments for the following command because
@@ -9018,7 +9070,259 @@ version 2005/12/01 or later.
% \end{macrocode}
%
%
+% \bigskip
+% \subsection{The redefinition of \textbackslash multicolumn}
+%
+% \medskip
+% The following command must \emph{not} be protected since it begins with
+% |\multispan| (a TeX primitive).
+% \begin{macrocode}
+\cs_new:Npn \@@_multicolumn:nnn #1 #2 #3
+ {
+ \multispan { #1 }
+ \begingroup
+% \end{macrocode}
+%
+% \medskip
+% You do the expansion of the (small) preamble with the tools of \pkg{array}.
+% \begin{macrocode}
+ \@temptokena = { #2 }
+ \@tempswatrue
+ \@whilesw \if@tempswa \fi { \@tempswafalse \the \NC@list }
+% \end{macrocode}
+%
+% \medskip
+% Now, we patch the (small) preamble as we have done with the main preamble of
+% the array.
+% \begin{macrocode}
+ \tl_gclear:N \g_@@_preamble_tl
+ \exp_after:wN \@@_patch_m_preamble:n \the \@temptokena \q_stop
+% \end{macrocode}
+%
+% \medskip
+% The following line creates the preamble. This line is a adaptation of a line
+% of the initial definition of |\multicolumn|.
+% \begin{macrocode}
+ \exp_args:NV \@mkpream \g_@@_preamble_tl
+% \end{macrocode}
+%
+% \medskip
+% Now, you do a treatment specific to \pkg{nicematrix} which has no equivalent
+% in the original definition of |\multicolumn|.
+% \begin{macrocode}
+ \int_compare:nNnT { #1 } > 1
+ {
+ \seq_gput_left:Nx \g_@@_multicolumn_cells_seq
+ { \int_use:N \c@iRow - \@@_succ:n \c@jCol }
+ \seq_gput_left:Nn \g_@@_multicolumn_sizes_seq { #1 }
+ \seq_gput_right:Nx \g_@@_pos_of_blocks_seq
+ {
+ { \int_use:N \c@iRow }
+ { \int_eval:n { \c@jCol + 1 } }
+ { \int_use:N \c@iRow }
+ { \int_eval:n { \c@jCol + #1 } }
+ }
+ }
+% \end{macrocode}
+%
+% \medskip
+% The following lines were in the original definition of |\multicolumn|.
+% \begin{macrocode}
+ \cs_set:Npn \@sharp { #3 }
+ \set@typeset@protect
+ \cs_set_eq:NN \@startpbox \@@startpbox
+ \cs_set_eq:NN \@endpbox \@@endpbox
+ \@arstrut
+ \@preamble
+ \hbox { }
+ \endgroup
+ \int_gadd:Nn \c@jCol { #1 - 1 }
+ \int_compare:nNnT \c@jCol > \g_@@_col_total_int
+ { \int_gset_eq:NN \g_@@_col_total_int \c@jCol }
+ \ignorespaces
+ }
+% \end{macrocode}
+%
+% \bigskip
+% The following commands will patch the (small) preamble of the |\multicolumn|.
+% All those commands have a |m| in their name to recall that they deal with the
+% redefinition of |\multicolumn|.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_m_preamble:n #1
+ {
+ \str_case:nnF { #1 }
+ {
+ c { \@@_patch_m_preamble_i:n #1 }
+ l { \@@_patch_m_preamble_i:n #1 }
+ r { \@@_patch_m_preamble_i:n #1 }
+ > { \@@_patch_m_preamble_ii:nn #1 }
+ ! { \@@_patch_m_preamble_ii:nn #1 }
+ @ { \@@_patch_m_preamble_ii:nn #1 }
+ | { \@@_patch_m_preamble_iii:n #1 }
+ p { \@@_patch_m_preamble_iv:nnn t #1 }
+ m { \@@_patch_m_preamble_iv:nnn c #1 }
+ b { \@@_patch_m_preamble_iv:nnn b #1 }
+ \@@_w: { \@@_patch_m_preamble_v:nnnn { } #1 }
+ \@@_W: { \@@_patch_m_preamble_v:nnnn { \cs_set_eq:NN \hss \hfil } #1 }
+ \@@_true_c: { \@@_patch_m_preamble_vi:n #1 }
+ C { \@@_error:nn { old~column~type } #1 }
+ L { \@@_error:nn { old~column~type } #1 }
+ R { \@@_error:nn { old~column~type } #1 }
+ \q_stop { }
+ }
+ { \@@_fatal:nn { unknown~column~type } { #1 } }
+ }
+% \end{macrocode}
+%
+% \medskip
+% For |c|, |l| and |r|
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_m_preamble_i:n #1
+ {
+ \tl_gput_right:Nn \g_@@_preamble_tl
+ {
+ > { \@@_Cell: \tl_set:Nn \l_@@_cell_type_tl { #1 } }
+ #1
+ < \@@_end_Cell:
+ }
+% \end{macrocode}
+%
+% We test for the presence of a |<|.
+% \begin{macrocode}
+ \@@_patch_m_preamble_x:n
+ }
+% \end{macrocode}
+%
+% \medskip
+% For |>|, |!| and |@|
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_m_preamble_ii:nn #1 #2
+ {
+ \tl_gput_right:Nn \g_@@_preamble_tl { #1 { #2 } }
+ \@@_patch_m_preamble:n
+ }
+% \end{macrocode}
+%
+%
+% \medskip
+% For \verb+|+
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_m_preamble_iii:n #1
+ {
+ \tl_gput_right:Nn \g_@@_preamble_tl { #1 }
+ \@@_patch_m_preamble:n
+ }
+% \end{macrocode}
+%
+% \medskip
+% For |p|, |m| and |b|
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_m_preamble_iv:nnn #1 #2 #3
+ {
+ \tl_gput_right:Nn \g_@@_preamble_tl
+ {
+ > {
+ \@@_Cell:
+ \begin { minipage } [ #1 ] { \dim_eval:n { #3 } }
+ \mode_leave_vertical:
+ \arraybackslash
+ \vrule height \box_ht:N \@arstrutbox depth 0 pt width 0 pt
+ }
+ c
+ < {
+ \vrule height 0 pt depth \box_dp:N \@arstrutbox width 0 pt
+ \end { minipage }
+ \@@_end_Cell:
+ }
+ }
+% \end{macrocode}
+% We test for the presence of a |<|.
+% \begin{macrocode}
+ \@@_patch_m_preamble_x:n
+ }
+% \end{macrocode}
+%
+% \medskip
+% For |w| and |W|
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_m_preamble_v:nnnn #1 #2 #3 #4
+ {
+ \tl_gput_right:Nn \g_@@_preamble_tl
+ {
+ > {
+ \hbox_set:Nw \l_@@_cell_box
+ \@@_Cell:
+ \tl_set:Nn \l_@@_cell_type_tl { #3 }
+ }
+ c
+ < {
+ \@@_end_Cell:
+ #1
+ \hbox_set_end:
+ \bool_if:NT \g_@@_rotate_bool \@@_rotate_cell_box:
+ \@@_adjust_size_box:
+ \makebox [ #4 ] [ #3 ] { \box_use_drop:N \l_@@_cell_box }
+ }
+ }
+% \end{macrocode}
+% We test for the presence of a |<|.
+% \begin{macrocode}
+ \@@_patch_m_preamble_x:n
+ }
+% \end{macrocode}
+%
+% \medskip
+% For |\@@_true_c:| which will appear in our redefinition of the columns of type
+% |S| (of \pkg{siunitx}).
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_m_preamble_vi:n #1
+ {
+ \tl_gput_right:Nn \g_@@_preamble_tl { c }
+% \end{macrocode}
+% We test for the presence of a |<|.
+% \begin{macrocode}
+ \@@_patch_m_preamble_x:n
+ }
+% \end{macrocode}
+%
%
+% After a specifier of column, we have to test whether there is one or several
+% |<{..}| because, after those potential |<{...}|, we have to insert
+% |!{\skip_horizontal:N ...}| when the key |vlines| is used.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_m_preamble_x:n #1
+ {
+ \str_if_eq:nnTF { #1 } { < }
+ \@@_patch_m_preamble_ix:n
+ {
+ \tl_if_eq:NnTF \l_@@_vlines_clist { all }
+ {
+ \tl_gput_right:Nn \g_@@_preamble_tl
+ { ! { \skip_horizontal:N \arrayrulewidth } }
+ }
+ {
+ \exp_args:NNx
+ \clist_if_in:NnT \l_@@_vlines_clist { \@@_succ:n \c@jCol }
+ {
+ \tl_gput_right:Nn \g_@@_preamble_tl
+ { ! { \skip_horizontal:N \arrayrulewidth } }
+ }
+ }
+ \@@_patch_m_preamble:n { #1 }
+ }
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_m_preamble_ix:n #1
+ {
+ \tl_gput_right:Nn \g_@@_preamble_tl { < { #1 } }
+ \@@_patch_m_preamble_x:n
+ }
+% \end{macrocode}
+%
+%
+%
% \bigskip
% The command |\@@_put_box_in_flow:| puts the box |\l_tmpa_box| (which contains
% the array) in the flow. It is used for the environments with delimiters.
@@ -9457,7 +9761,7 @@ version 2005/12/01 or later.
% The command |\@@_create_col_nodes:| will construct a special last row.
% That last row is a false row used to create the |col| nodes and to fix the
% width of the columns (when the array is constructed with an option which
-% specify the width of the columns).
+% specifies the width of the columns).
% \begin{macrocode}
\cs_new:Npn \@@_create_col_nodes:
{
@@ -9609,11 +9913,28 @@ version 2005/12/01 or later.
}
\endpgfpicture
}
+% \end{macrocode}
+%
+% \bigskip
+% We want to remove the exterior |\arraycolsep| of a environment |{NiceArray}|.
+% \begin{macrocode}
+ \bool_lazy_all:nT
+ {
+ \l_@@_NiceArray_bool
+ { \bool_not_p:n \l_@@_NiceTabular_bool }
+ { \clist_if_empty_p:N \l_@@_vlines_clist }
+ { \bool_not_p:n \l_@@_exterior_arraycolsep_bool }
+ { ! \l_@@_bar_at_end_of_pream_bool }
+ }
+ { \skip_horizontal:n { - \col@sep } }
+% \end{macrocode}
+%
+% \bigskip
+% \begin{macrocode}
\bool_if:NT \g_@@_last_col_found_bool
{
\hbox_overlap_right:n
{
- % \skip_horizontal:N \col@sep
\skip_horizontal:N \g_@@_width_last_col_dim
\bool_if:NT \l_@@_code_before_bool
{
@@ -11703,62 +12024,10 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
-%
-% \bigskip
-% In the environment |{NiceArray}|, the command |\multicolumn| will be linked to
-% the following command |\@@_multicolumn:nnn|.
% \begin{macrocode}
\cs_set_eq:NN \@@_old_multicolumn \multicolumn
-\cs_new:Npn \@@_multicolumn:nnn #1 #2 #3
- {
-% \end{macrocode}
-% We have to act in an expandable way since it will begin by a |\multicolumn|.
-% \begin{macrocode}
- \exp_args:NNe
- \@@_old_multicolumn
- { #1 }
- {
- \exp_args:Ne \str_case:nn { \str_foldcase:n { #2 } }
- {
- l { > \@@_Cell: l < \@@_end_Cell: }
- r { > \@@_Cell: r < \@@_end_Cell: }
- c { > \@@_Cell: c < \@@_end_Cell: }
- { l | } { > \@@_Cell: l < \@@_end_Cell: | }
- { r | } { > \@@_Cell: r < \@@_end_Cell: | }
- { c | } { > \@@_Cell: c < \@@_end_Cell: | }
- { | l } { | > \@@_Cell: l < \@@_end_Cell: }
- { | r } { | > \@@_Cell: r < \@@_end_Cell: }
- { | c } { | > \@@_Cell: c < \@@_end_Cell: }
- { | l | } { | > \@@_Cell: l < \@@_end_Cell: | }
- { | r | } { | > \@@_Cell: r < \@@_end_Cell: | }
- { | c | } { | > \@@_Cell: c < \@@_end_Cell: | }
- }
- }
- { #3 }
-% \end{macrocode}
-% The |\peek_remove_spaces:n| is mandatory.
-% \begin{macrocode}
- \peek_remove_spaces:n
- {
- \int_compare:nNnT #1 > 1
- {
- \seq_gput_left:Nx \g_@@_multicolumn_cells_seq
- { \int_use:N \c@iRow - \int_use:N \c@jCol }
- \seq_gput_left:Nn \g_@@_multicolumn_sizes_seq { #1 }
- \seq_gput_right:Nx \g_@@_pos_of_blocks_seq
- {
- { \int_use:N \c@iRow }
- { \int_use:N \c@jCol }
- { \int_use:N \c@iRow }
- { \int_eval:n { \c@jCol + #1 - 1 } }
- }
- }
- \int_gadd:Nn \c@jCol { #1 - 1 }
- \int_compare:nNnT \c@jCol > \g_@@_col_total_int
- { \int_gset_eq:NN \g_@@_col_total_int \c@jCol }
- }
- }
% \end{macrocode}
+%
%
%
% \bigskip
@@ -11813,7 +12082,8 @@ version 2005/12/01 or later.
{ #2 }
{
#1 , #3 ,
- down = \exp_not:n { #4 } , up = \exp_not:n { #5 }
+ down = \exp_not:n { #4 } ,
+ up = \exp_not:n { #5 }
}
}
\prg_replicate:nn { #2 - 1 } { & \multicolumn { 1 } { c } { } }
@@ -12950,15 +13220,22 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% The command |\@@_draw_hlines:| draws all the vertical rules excepted in the
+% The command |\@@_draw_vlines:| draws all the vertical rules excepted in the
% blocks, in the virtual blocks (determined by a command such as |\Cdots|) and in
% the corners (if the key |corners| is used).
% \begin{macrocode}
\cs_new_protected:Npn \@@_draw_vlines:
{
\int_step_inline:nnn
- { \bool_if:NTF \l_@@_NiceArray_bool 1 2 }
- { \bool_if:NTF \l_@@_NiceArray_bool { \@@_succ:n \c@jCol } \c@jCol }
+ {
+ \bool_if:nTF { \l_@@_NiceArray_bool && ! \l_@@_except_borders_bool }
+ 1 2
+ }
+ {
+ \bool_if:nTF { \l_@@_NiceArray_bool && ! \l_@@_except_borders_bool }
+ { \@@_succ:n \c@jCol }
+ \c@jCol
+ }
{
\tl_if_eq:NnF \l_@@_vlines_clist { all }
{ \clist_if_in:NnT \l_@@_vlines_clist { ##1 } }
@@ -13131,8 +13408,15 @@ version 2005/12/01 or later.
\cs_new_protected:Npn \@@_draw_hlines:
{
\int_step_inline:nnn
- { \bool_if:NTF \l_@@_NiceArray_bool 1 2 }
- { \bool_if:NTF \l_@@_NiceArray_bool { \@@_succ:n \c@iRow } \c@iRow }
+ {
+ \bool_if:nTF { \l_@@_NiceArray_bool && ! \l_@@_except_borders_bool }
+ 1 2
+ }
+ {
+ \bool_if:nTF { \l_@@_NiceArray_bool && ! \l_@@_except_borders_bool }
+ { \@@_succ:n \c@iRow }
+ \c@iRow
+ }
{
\tl_if_eq:NnF \l_@@_hlines_clist { all }
{ \clist_if_in:NnT \l_@@_hlines_clist { ##1 } }
@@ -13180,7 +13464,6 @@ version 2005/12/01 or later.
%
% \subsection*{The key hvlines}
%
-%
% The following command tests whether the current position in the array (given by
% |\l_tmpa_tl| for the row and |\l_tmpb_tl| for the column) would provide an
% horizontal rule towards the right in the block delimited by the four arguments
@@ -13603,7 +13886,6 @@ version 2005/12/01 or later.
% \bigskip
% \textbf{Vertical dotted lines}\par\nobreak
%
-%
% \medskip
% \begin{macrocode}
\cs_new_protected:Npn \@@_vdottedline:n #1
@@ -14106,6 +14388,12 @@ version 2005/12/01 or later.
r .value_forbidden:n = true ,
c .code:n = \tl_set:Nn \l_@@_hpos_of_block_tl c ,
c .value_forbidden:n = true ,
+ L .code:n = \tl_set:Nn \l_@@_hpos_of_block_tl l ,
+ L .value_forbidden:n = true ,
+ R .code:n = \tl_set:Nn \l_@@_hpos_of_block_tl r ,
+ R .value_forbidden:n = true ,
+ C .code:n = \tl_set:Nn \l_@@_hpos_of_block_tl c ,
+ C .value_forbidden:n = true ,
t .code:n = \tl_set:Nn \l_@@_vpos_of_block_tl t ,
t .value_forbidden:n = true ,
b .code:n = \tl_set:Nn \l_@@_vpos_of_block_tl b ,
@@ -14461,6 +14749,15 @@ version 2005/12/01 or later.
r .value_forbidden:n = true ,
c .code:n = \tl_set:Nn \l_@@_hpos_of_block_tl c ,
c .value_forbidden:n = true ,
+ L .code:n = \tl_set:Nn \l_@@_hpos_of_block_tl l
+ \bool_set_true:N \l_@@_hpos_of_block_cap_bool ,
+ L .value_forbidden:n = true ,
+ R .code:n = \tl_set:Nn \l_@@_hpos_of_block_tl r
+ \bool_set_true:N \l_@@_hpos_of_block_cap_bool ,
+ R .value_forbidden:n = true ,
+ C .code:n = \tl_set:Nn \l_@@_hpos_of_block_tl c
+ \bool_set_true:N \l_@@_hpos_of_block_cap_bool ,
+ C .value_forbidden:n = true ,
t .code:n = \tl_set:Nn \l_@@_vpos_of_block_tl t ,
t .value_forbidden:n = true ,
b .code:n = \tl_set:Nn \l_@@_vpos_of_block_tl b ,
@@ -14634,9 +14931,8 @@ version 2005/12/01 or later.
% |!{\hspace{1cm}}| in the preamble which increases the space between the
% columns (by adding, in fact, that space to the previous column, that is to say
% the second column of the tabular), we will create \emph{two} nodes relative to
-% the block: the node |1-1-block| and the node |1-1-block-short|. The latter
-% will be used by \pkg{nicematrix} to put the label of the node. The first one
-% won't be used explicitely.
+% the block: the node |1-1-block| and the node |1-1-block-short|.
+%
% \begin{Verbatim}
% \begin{NiceTabular}{cc!{\hspace{1cm}}c}
% \Block{2-2}{our block} & & one \\
@@ -14705,58 +15001,71 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \medskip
-% We construct the |short| node.
+% Now, we create the ``short node'' which, in general, will be used to put the
+% label (that is to say the content of the node). However, if one the keys |L|, |C| or
+% |R| is used (that information is provided by the boolean
+% |\l_@@_hpos_of_block_cap_bool|), we don't need to create that node since the
+% normal node is used to put the label.
+%
% \begin{macrocode}
- \dim_set_eq:NN \l_tmpb_dim \c_max_dim
- \int_step_inline:nnn \l_@@_first_row_int \g_@@_row_total_int
+ \bool_if:NF \l_@@_hpos_of_block_cap_bool
{
+ \dim_set_eq:NN \l_tmpb_dim \c_max_dim
+% \end{macrocode}
+% The short node is constructed by taking into account the \emph{contents} of
+% the columns involved in at least one cell of the block. That's why we have to
+% do a loop over the rows of the array.
+% \begin{macrocode}
+ \int_step_inline:nnn \l_@@_first_row_int \g_@@_row_total_int
+ {
% \end{macrocode}
% We recall that, when a cell is empty, no (normal) node is created in that
% cell. That's why we test the existence of the node before using it.
% \begin{macrocode}
- \cs_if_exist:cT
- { pgf @ sh @ ns @ \@@_env: - ##1 - #2 }
- {
- \seq_if_in:NnF \g_@@_multicolumn_cells_seq { ##1 - #2 }
+ \cs_if_exist:cT
+ { pgf @ sh @ ns @ \@@_env: - ##1 - #2 }
{
- \pgfpointanchor { \@@_env: - ##1 - #2 } { west }
- \dim_set:Nn \l_tmpb_dim { \dim_min:nn \l_tmpb_dim \pgf@x }
+ \seq_if_in:NnF \g_@@_multicolumn_cells_seq { ##1 - #2 }
+ {
+ \pgfpointanchor { \@@_env: - ##1 - #2 } { west }
+ \dim_set:Nn \l_tmpb_dim { \dim_min:nn \l_tmpb_dim \pgf@x }
+ }
}
}
- }
% \end{macrocode}
% If all the cells of the column were empty, |\l_tmpb_dim| has still the same
% value |\c_max_dim|. In that case, you use for |\l_tmpb_dim| the value of the
% position of the vertical rule.
% \begin{macrocode}
- \dim_compare:nNnT \l_tmpb_dim = \c_max_dim
- {
- \@@_qpoint:n { col - #2 }
- \dim_set_eq:NN \l_tmpb_dim \pgf@x
- }
- \dim_set:Nn \l_tmpd_dim { - \c_max_dim }
- \int_step_inline:nnn \l_@@_first_row_int \g_@@_row_total_int
- {
- \cs_if_exist:cT
- { pgf @ sh @ ns @ \@@_env: - ##1 - \int_use:N \l_@@_last_col_int }
+ \dim_compare:nNnT \l_tmpb_dim = \c_max_dim
+ {
+ \@@_qpoint:n { col - #2 }
+ \dim_set_eq:NN \l_tmpb_dim \pgf@x
+ }
+ \dim_set:Nn \l_tmpd_dim { - \c_max_dim }
+ \int_step_inline:nnn \l_@@_first_row_int \g_@@_row_total_int
{
- \seq_if_in:NnF \g_@@_multicolumn_cells_seq { ##1 - #2 }
+ \cs_if_exist:cT
+ { pgf @ sh @ ns @ \@@_env: - ##1 - \int_use:N \l_@@_last_col_int }
{
- \pgfpointanchor
- { \@@_env: - ##1 - \int_use:N \l_@@_last_col_int }
- { east }
- \dim_set:Nn \l_tmpd_dim { \dim_max:nn \l_tmpd_dim \pgf@x }
+ \seq_if_in:NnF \g_@@_multicolumn_cells_seq { ##1 - #2 }
+ {
+ \pgfpointanchor
+ { \@@_env: - ##1 - \int_use:N \l_@@_last_col_int }
+ { east }
+ \dim_set:Nn \l_tmpd_dim { \dim_max:nn \l_tmpd_dim \pgf@x }
+ }
}
}
+ \dim_compare:nNnT \l_tmpd_dim = { - \c_max_dim }
+ {
+ \@@_qpoint:n { col - \@@_succ:n { \l_@@_last_col_int } }
+ \dim_set_eq:NN \l_tmpd_dim \pgf@x
+ }
+ \@@_pgf_rect_node:nnnnn
+ { \@@_env: - #1 - #2 - block - short }
+ \l_tmpb_dim \l_tmpa_dim \l_tmpd_dim \l_tmpc_dim
}
- \dim_compare:nNnT \l_tmpd_dim = { - \c_max_dim }
- {
- \@@_qpoint:n { col - \@@_succ:n { \l_@@_last_col_int } }
- \dim_set_eq:NN \l_tmpd_dim \pgf@x
- }
- \@@_pgf_rect_node:nnnnn
- { \@@_env: - #1 - #2 - block - short }
- \l_tmpb_dim \l_tmpa_dim \l_tmpd_dim \l_tmpc_dim
% \end{macrocode}
%
% \medskip
@@ -14806,7 +15115,10 @@ version 2005/12/01 or later.
% We retrieve (in |\pgf@x|) the $x$-value of the center of the block.
% \begin{macrocode}
\pgfpointanchor
- { \@@_env: - #1 - #2 - block - short }
+ {
+ \@@_env: - #1 - #2 - block
+ \bool_if:NF \l_@@_hpos_of_block_cap_bool { - short }
+ }
{
\str_case:Vn \l_@@_hpos_of_block_tl
{
@@ -14853,7 +15165,10 @@ version 2005/12/01 or later.
\pgftransformshift
{
\pgfpointanchor
- { \@@_env: - #1 - #2 - block - short }
+ {
+ \@@_env: - #1 - #2 - block
+ \bool_if:NF \l_@@_hpos_of_block_cap_bool { - short }
+ }
{
\str_case:Vn \l_@@_hpos_of_block_tl
{
@@ -15148,14 +15463,36 @@ version 2005/12/01 or later.
% \end{macrocode}
%
%
+% \bigskip
+% We will extract the potential keys |l|, |r| and |c| and pass the other keys to
+% the environment |{NiceArrayWithDelims}|.
+% \begin{macrocode}
+\keys_define:nn { NiceMatrix / Auto }
+ {
+ l .code:n = \tl_set:Nn \l_@@_type_of_col_tl l ,
+ r .code:n = \tl_set:Nn \l_@@_type_of_col_tl r ,
+ c .code:n = \tl_set:Nn \l_@@_type_of_col_tl c
+ }
+% \end{macrocode}
+%
% \begin{macrocode}
\NewDocumentCommand \AutoNiceMatrixWithDelims { m m O { } m O { } m ! O { } }
{
\int_zero_new:N \l_@@_nb_rows_int
\int_zero_new:N \l_@@_nb_cols_int
\@@_set_size:n #4 \q_stop
- \begin { NiceArrayWithDelims } { #1 } { #2 }
- { * { \l_@@_nb_cols_int } { c } } [ #3 , #5 , #7 ]
+% \end{macrocode}
+% The group is for the protection of |\l_@@_type_of_col_tl|.
+% \begin{macrocode}
+ \group_begin:
+ \tl_set:Nn \l_@@_type_of_col_tl c
+ \keys_set_known:nnN { NiceMatrix / Auto } { #3, #5, #7 } \l_tmpa_tl
+ \use:x
+ {
+ \exp_not:N \begin { NiceArrayWithDelims } { #1 } { #2 }
+ { * { \int_use:N \l_@@_nb_cols_int } { \l_@@_type_of_col_tl } }
+ [ \l_tmpa_tl ]
+ }
\int_compare:nNnT \l_@@_first_row_int = 0
{
\int_compare:nNnT \l_@@_first_col_int = 0 { & }
@@ -15166,7 +15503,7 @@ version 2005/12/01 or later.
{
\int_compare:nNnT \l_@@_first_col_int = 0 { & }
% \end{macrocode}
-% You put |{ }| before |#6| to avoid a hasty expansion of a potential
+% We put |{ }| before |#6| to avoid a hasty expansion of a potential
% |\arabic{iRow}| at the beginning of the row which would result in an incorrect
% value of that |iRow| (since |iRow| is incremented in the first cell of the row
% of the |\halign|).
@@ -15181,6 +15518,7 @@ version 2005/12/01 or later.
\int_compare:nNnT \l_@@_last_col_int > { -1 } { & } \\
}
\end { NiceArrayWithDelims }
+ \group_end:
}
% \end{macrocode}
%
@@ -16108,10 +16446,20 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \begin{macrocode}
+\@@_msg_new:nn { define-L-C-R }
+ {
+ You~have~used~the~key~'define-L-C-R'.~Please~note~that~this~key~
+ will~probably~be~deleted~in~a~future~version~of~'nicematrix'.\\
+ However,~you~can~go~on.
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
\keys_define:nn { NiceMatrix / Package }
{
- define-L-C-R .bool_set:N = \c_@@_define_L_C_R_bool ,
- define-L-C-R .default:n = true ,
+ define-L-C-R .code:n =
+ \@@_error:n { define-L-C-R }
+ \bool_set_true:N \c_@@_define_L_C_R_bool ,
renew-dots .bool_set:N = \l_@@_renew_dots_bool ,
renew-dots .value_forbidden:n = true ,
renew-matrix .code:n = \@@_renew_matrix: ,
@@ -17465,13 +17813,25 @@ version 2005/12/01 or later.
% The version 5.15b is compatible with the version 3.0+ of \pkg{siunitx}
% (previous versions were not).
%
-% % \subsection*{Changes between versions 5.15 and 5.16}
+% \subsection*{Changes between versions 5.15 and 5.16}
%
% It's now possible to use the cells corresponding to the contents of the nodes
% (of the form |i-j|) in the |\CodeBefore| when the key |create-cell-nodes| of
% that |\CodeBefore| is used. The medium and the large nodes are also available
% if the corresponding keys are used.
%
+% \subsection*{Changes between versions 5.16 and 5.17}
+%
+% The key |define-L-C-R| (only available at load-time) now raises a (non fatal)
+% error (that key will probably be deleted in a future version of \pkg{nicematrix}).
+%
+% Keys |L|, |C| and |R| for the command |\Block|.
+%
+% Key |hvlines-except-borders|.
+%
+% It's now possible to use a key |l|, |r| or |c| with the command
+% |\pAutoNiceMatrix| (and the similar ones).
+%
% \PrintIndex
%
% \tableofcontents
diff --git a/macros/latex/contrib/nicematrix/nicematrix.pdf b/macros/latex/contrib/nicematrix/nicematrix.pdf
index 40b867d72e..2f690d6409 100644
--- a/macros/latex/contrib/nicematrix/nicematrix.pdf
+++ b/macros/latex/contrib/nicematrix/nicematrix.pdf
Binary files differ
diff --git a/macros/latex/contrib/seminar/Changes b/macros/latex/contrib/seminar/Changes
index 74dafdcc9c..67471621c3 100644
--- a/macros/latex/contrib/seminar/Changes
+++ b/macros/latex/contrib/seminar/Changes
@@ -1,4 +1,5 @@
------ seminar.sty
+----- seminar.cls
+1.63a 2021-07-01 - fix for semsamp3.tes
1.63 2021-06-30 - make it run with current latex version (seminar.ls†|.sty)
1.62a 2021-06-12 - added statement in README
1.62 2014-05-12 - moved code into pst-ovl
@@ -8,3 +9,5 @@
1.6 2012-12-27 - use the macros from package pst-ovl (hv)
+----- seminar.sty
+1.71 2021-06-30 - exists only for compatibility
diff --git a/macros/latex/contrib/seminar/doc/semsamp3.pdf b/macros/latex/contrib/seminar/doc/semsamp3.pdf
index 7173793ea1..daf74260ab 100644
--- a/macros/latex/contrib/seminar/doc/semsamp3.pdf
+++ b/macros/latex/contrib/seminar/doc/semsamp3.pdf
Binary files differ
diff --git a/macros/latex/contrib/seminar/doc/semsamp3.tex b/macros/latex/contrib/seminar/doc/semsamp3.tex
index 3d6b5923a9..e101a342bf 100644
--- a/macros/latex/contrib/seminar/doc/semsamp3.tex
+++ b/macros/latex/contrib/seminar/doc/semsamp3.tex
@@ -15,7 +15,7 @@
%% ====
% Show page(s) 1,3
%%
-\documentclass[landscape,rules]{exaseminar}
+\documentclass[landscape,rules]{seminar}
\pagestyle{empty}
\setlength\textwidth{172.40709pt}
% use **dvips -T 297mm,210mm <file>**!
@@ -24,15 +24,12 @@
\def\FileDate{June 2002}
\def\FileInfoB{Backgrounds}
\def\FileVersion{1.0}
-\StartShownPreambleCommands
-\documentclass{seminar}
\usepackage{sem-dem}% General utility macros
\HyperSetUp\hypersetup{pdfpagemode=UseOutlines}% Open the document with bookmarks shown
\newcommand\MySeminarOutlinePresentation{%
\SeminarOutlinePresentation{Where we are}{LightBlue}{RoyalBlue}{yellow}%
\SeminarHeader{\LARGE\HLe{Demonstration of \MakeLowercase{\FileInfoB}}}}
\VerbatimFootnotes % To allow verbatim material in footnotes
-\StopShownPreambleCommands
\begin{document}
\SeminarFirstSlide \SeminarListOfSlides
\renewcommand{\slidestretch}{1}% Komprimieren der Zeilen
diff --git a/macros/latex/contrib/seminar/latex/seminar.cls b/macros/latex/contrib/seminar/latex/seminar.cls
index b2d6bfeec0..1a3ed512e8 100644
--- a/macros/latex/contrib/seminar/latex/seminar.cls
+++ b/macros/latex/contrib/seminar/latex/seminar.cls
@@ -5,8 +5,8 @@
%% Fixes from David Carlisle, Denis Girou,
%% and Frank Küster/Günter Milde (a4paper option fix)
%%
-\def\fileversion{1.63}
-\def\filedate{2021/06/30}
+\def\fileversion{1.63a}
+\def\filedate{2021/07/01}
%%
%% This is a style for typesetting notes and slides.
%%
diff --git a/macros/latex/contrib/seminar/latex/seminar.sty b/macros/latex/contrib/seminar/latex/seminar.sty
index a5f0f7d4c0..cdc30567f6 100644
--- a/macros/latex/contrib/seminar/latex/seminar.sty
+++ b/macros/latex/contrib/seminar/latex/seminar.sty
@@ -3,7 +3,7 @@
%% This is file `seminar.sty'
%%
\def\fileversion{1.71}
-\def\filedate{24/06/30}
+\def\filedate{21/06/30}
%%
%% LaTeX document style `seminar', for use with LaTeX v2.09.
%% This is a style for typesetting notes and slides.
diff --git a/macros/latex/contrib/tabularray/README b/macros/latex/contrib/tabularray/README
index b4714bd0a7..c2a7000e2d 100644
--- a/macros/latex/contrib/tabularray/README
+++ b/macros/latex/contrib/tabularray/README
@@ -1,4 +1,6 @@
Package: Typeset tabulars and arrays with LaTeX3
Author: Jianrui Lyu <tolvjr@163.com>
+CTAN: https://ctan.org/pkg/tabularray
Repository: https://github.com/lvjr/tabularray
+Repository: https://bitbucket.org/lvjr/tabularray
License: The LaTeX Project Public License 1.3
diff --git a/macros/latex/contrib/tabularray/tabularray.pdf b/macros/latex/contrib/tabularray/tabularray.pdf
index 05c0d50e11..ba8b283884 100644
--- a/macros/latex/contrib/tabularray/tabularray.pdf
+++ b/macros/latex/contrib/tabularray/tabularray.pdf
Binary files differ
diff --git a/macros/latex/contrib/tabularray/tabularray.sty b/macros/latex/contrib/tabularray/tabularray.sty
index 8e5c2b9369..0a12e61ba5 100644
--- a/macros/latex/contrib/tabularray/tabularray.sty
+++ b/macros/latex/contrib/tabularray/tabularray.sty
@@ -12,11 +12,16 @@
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
-\ProvidesExplPackage{tabularray}{2021-06-05}{2021K}
+\ProvidesExplPackage{tabularray}{2021-07-01}{2021L}
{Typeset tabulars and arrays with LaTeX3}
\RequirePackage{xparse}
-\AtBeginDocument{\@ifpackageloaded{xcolor}{\RequirePackage{ninecolors}}{}}
+
+\AtBeginDocument
+ {
+ \@ifpackageloaded{xcolor}{\RequirePackage{ninecolors}}{}
+ \@ifpackageloaded{hyperref}{\hypersetup{pdfborder={0 0 0}}}{}
+ }
\ExplSyntaxOn
@@ -57,6 +62,7 @@
\prg_generate_conditional_variant:Nnn \prop_if_in:Nn { c } { T }
\prg_generate_conditional_variant:Nnn \str_if_eq:nn { xn } { TF }
\prg_generate_conditional_variant:Nnn \tl_if_eq:nn { en } { T, TF }
+\prg_generate_conditional_variant:Nnn \tl_if_head_eq_catcode:nN { VN } { TF }
\prg_generate_conditional_variant:Nnn \tl_if_head_eq_meaning:nN { VN } { T, TF }
\tl_new:N \l__tblr_a_tl
@@ -97,12 +103,26 @@
\box_new:N \l__tblr_c_box % for cell box
\box_new:N \l__tblr_d_box
+%% Total number of tblr tables
+\int_new:N \g__tblr_table_count_int
+
+%% Some commands for horizontal alignment
+\cs_new_eq:NN \__tblr_halign_command_l: \raggedright
+\cs_new_eq:NN \__tblr_halign_command_c: \centering
+\cs_new_eq:NN \__tblr_halign_command_r: \raggedleft
+
%% Some counters for row and column numbering
\newcounter{rownum}
\newcounter{colnum}
\newcounter{rowcount}
\newcounter{colcount}
+%% Some dimensions for row and column spacing
+\dim_new:N \abovesep
+\dim_new:N \belowsep
+\dim_new:N \leftsep
+\dim_new:N \rightsep
+
%%% --------------------------------------------------------
%% \section{Data Structures Based on Property Lists}
%%% --------------------------------------------------------
@@ -113,7 +133,10 @@
{
\prop_gclear_new:c { g__tblr_text_ \int_use:N \g_tblr_level_int _prop }
\prop_gclear_new:c { g__tblr_command_ \int_use:N \g_tblr_level_int _prop }
- \prop_gclear_new:c { g__tblr_table_ \int_use:N \g_tblr_level_int _prop }
+ \prop_gclear_new:c { g__tblr_inner_ \int_use:N \g_tblr_level_int _prop }
+ \prop_gclear_new:c { g__tblr_note_ \int_use:N \g_tblr_level_int _prop }
+ \prop_gclear_new:c { g__tblr_remark_ \int_use:N \g_tblr_level_int _prop }
+ \prop_gclear_new:c { g__tblr_more_ \int_use:N \g_tblr_level_int _prop }
\prop_gclear_new:c { g__tblr_row_ \int_use:N \g_tblr_level_int _prop }
\prop_gclear_new:c { g__tblr_column_ \int_use:N \g_tblr_level_int _prop }
\prop_gclear_new:c { g__tblr_cell_ \int_use:N \g_tblr_level_int _prop }
@@ -184,7 +207,7 @@
{ \dim_compare_p:nNn { #3 } > { \l__tblr_put_if_larger_tl } }
{ \prop_put:Nnn #1 { #2 } { #3 } }
}
-\cs_generate_variant:Nn \__tblr_put_if_larger:Nnn { Nnx, Nxn, Nxx }
+\cs_generate_variant:Nn \__tblr_put_if_larger:Nnn { Nnx, Nxn, Nxx, NnV }
\cs_new_protected:Npn \__tblr_gput_if_larger:Nnn #1 #2 #3
{
@@ -215,63 +238,78 @@
%% \section{Data Structures Based on Token Lists}
%%% --------------------------------------------------------
-\cs_new_protected:Npn \__tblr_clear_text_lists:
+\cs_new_protected:Npn \__tblr_clear_spec_lists:
{
- \__tblr_clear_one_text_lists:n { text }
- \__tblr_clear_one_text_lists:n { hline }
- \__tblr_clear_one_text_lists:n { vline }
+ %\__tblr_clear_one_spec_lists:n { row }
+ %\__tblr_clear_one_spec_lists:n { column }
+ %\__tblr_clear_one_spec_lists:n { cell }
+ \__tblr_clear_one_spec_lists:n { text }
+ \__tblr_clear_one_spec_lists:n { hline }
+ \__tblr_clear_one_spec_lists:n { vline }
+ \__tblr_clear_one_spec_lists:n { outer }
}
-\cs_new_protected:Npn \__tblr_clear_one_text_lists:n #1
+\cs_new_protected:Npn \__tblr_clear_one_spec_lists:n #1
{
\clist_if_exist:cTF { g__tblr_#1_ \int_use:N \g_tblr_level_int _clist }
{
\clist_map_inline:cn { g__tblr_#1_ \int_use:N \g_tblr_level_int _clist }
{
- \tl_gclear:c { g__tblr_text_ \int_use:N \g_tblr_level_int _#1_##1_tl }
+ \tl_gclear:c { g__tblr_spec_ \int_use:N \g_tblr_level_int _#1_##1_tl }
}
}
{ \clist_new:c { g__tblr_#1_ \int_use:N \g_tblr_level_int _clist } }
}
-\cs_new_protected:Npn \__tblr_text_gput:nnn #1 #2 #3
+\cs_new_protected:Npn \__tblr_spec_gput:nnn #1 #2 #3
{
\tl_gset:cn
- { g__tblr_text_ \int_use:N \g_tblr_level_int _#1_#2_tl } {#3}
+ { g__tblr_spec_ \int_use:N \g_tblr_level_int _#1_#2_tl } {#3}
\clist_gput_right:cx { g__tblr_#1_ \int_use:N \g_tblr_level_int _clist } {#2}
}
-\cs_generate_variant:Nn \__tblr_text_gput:nnn { nne, nnV, nen, nee, neV }
+\cs_generate_variant:Nn \__tblr_spec_gput:nnn { nne, nnV, nen, nee, neV }
-\cs_new:Npn \__tblr_text_item:nn #1 #2
+\cs_new:Npn \__tblr_spec_item:nn #1 #2
{
- \tl_if_exist:cT { g__tblr_text_ \int_use:N \g_tblr_level_int _#1_#2_tl }
+ \tl_if_exist:cT { g__tblr_spec_ \int_use:N \g_tblr_level_int _#1_#2_tl }
{
\exp_args:Nv \exp_not:n
- { g__tblr_text_ \int_use:N \g_tblr_level_int _#1_#2_tl }
+ { g__tblr_spec_ \int_use:N \g_tblr_level_int _#1_#2_tl }
}
}
-\cs_generate_variant:Nn \__tblr_text_item:nn { ne }
+\cs_generate_variant:Nn \__tblr_spec_item:nn { ne }
-\cs_new_protected:Npn \__tblr_text_gput_if_larger:nnn #1 #2 #3
+\cs_new_protected:Npn \__tblr_spec_gput_if_larger:nnn #1 #2 #3
{
- \tl_set:Nx \l__tblr_put_if_larger_tl { \__tblr_text_item:nn {#1} {#2} }
+ \tl_set:Nx \l__tblr_put_if_larger_tl { \__tblr_spec_item:nn {#1} {#2} }
\bool_lazy_or:nnT
{ \tl_if_empty_p:N \l__tblr_put_if_larger_tl }
{ \dim_compare_p:nNn {#3} > { \l__tblr_put_if_larger_tl } }
- { \__tblr_text_gput:nnn {#1} {#2} {#3} }
+ { \__tblr_spec_gput:nnn {#1} {#2} {#3} }
+ }
+\cs_generate_variant:Nn \__tblr_spec_gput_if_larger:nnn { nne, nnV, nen, nee, neV }
+
+\cs_new_protected:Npn \__tblr_spec_gadd_dimen_value:nnn #1 #2 #3
+ {
+ \__tblr_spec_gput:nne {#1} {#2}
+ { \dim_eval:n { \__tblr_spec_item:ne {#1} {#2} + #3 } }
}
-\cs_generate_variant:Nn \__tblr_text_gput_if_larger:nnn { nne, nnV, nen, nee, neV }
+\cs_generate_variant:Nn \__tblr_spec_gadd_dimen_value:nnn { nne, nnV, nen, nee }
-\cs_new_protected:Npn \__tblr_text_log:n #1
+\cs_new_protected:Npn \__tblr_spec_log:n #1
{
\clist_gremove_duplicates:c
{ g__tblr_#1_ \int_use:N \g_tblr_level_int _clist }
- \tl_log:n { ----------~----------~----------~----------~---------- }
+ \tl_log:x
+ {
+ The ~ spec ~ list ~ #1 _ \int_use:N \g_tblr_level_int
+ \space contains ~ the ~ pairs:
+ }
\clist_map_inline:cn { g__tblr_#1_ \int_use:N \g_tblr_level_int _clist }
{
\tl_log:x
{
- \space { #1 ##1 } ~\space=>~\space { \__tblr_text_item:nn {#1} {##1} }
+ \space { ##1 } ~\space=>~\space { \__tblr_spec_item:nn {#1} {##1} }
}
}
}
@@ -336,6 +374,7 @@
\__tblr_data_new_key:nnn { cell } { halign } { str }
\__tblr_data_new_key:nnn { cell } { valign } { str }
\__tblr_data_new_key:nnn { cell } { background } { str }
+\__tblr_data_new_key:nnn { cell } { font } { str }
\__tblr_data_new_key:nnn { cell } { omit } { int }
\__tblr_data_new_key:nnn { cell } { @cell-width } { dim }
\__tblr_data_new_key:nnn { cell } { @cell-height } { dim }
@@ -350,12 +389,12 @@
\tl_const:Nn \g__tblr_data_cell_index_number_tl {2}
\int_new:N \g__tblr_array_int
-\cs_new_protected:Npn \__tblr_initial_table_data:
+\cs_new_protected:Npn \__tblr_init_table_data:
{
- \clist_map_function:NN \g__tblr_data_clist \__tblr_initial_one_data:n
+ \clist_map_function:NN \g__tblr_data_clist \__tblr_init_one_data:n
}
-\cs_new_protected:Npn \__tblr_initial_one_data:n #1
+\cs_new_protected:Npn \__tblr_init_one_data:n #1
{
\int_gincr:N \g__tblr_array_int
\intarray_new:cn { g__tblr_#1_ \int_use:N \g__tblr_array_int _intarray }
@@ -507,18 +546,18 @@
\cs_new_protected:Npn \__tblr_data_int_from_str:n #1
{
- \tl_if_exist:cTF { g__tblr_data_#1_to_int_tl }
+ \tl_if_exist:cTF { g__tblr_data_ \tl_to_str:n {#1} _to_int_tl }
{
\tl_gset_eq:Nc \g__tblr_data_int_from_value_tl
- { g__tblr_data_#1_to_int_tl }
+ { g__tblr_data_ \tl_to_str:n {#1} _to_int_tl }
}
{
\int_gincr:N \g__tblr_data_str_value_count_int
- \tl_gset:cx { g__tblr_data_#1_to_int_tl }
+ \tl_gset:cx { g__tblr_data_ \tl_to_str:n {#1} _to_int_tl }
{ \int_use:N \g__tblr_data_str_value_count_int }
- \tl_gset:cx
+ \tl_gset:cn
{ g__tblr_data_ \int_use:N \g__tblr_data_str_value_count_int _to_str_tl }
- { #1 }
+ { \exp_not:n {#1} }
\tl_gset:Nx \g__tblr_data_int_from_value_tl
{ \int_use:N \g__tblr_data_str_value_count_int }
}
@@ -661,7 +700,8 @@
{ \__tblr_data_key_to_int:nnn {#1} {#2} {#3} }
{ \g__tblr_data_int_from_value_tl }
}
-\cs_generate_variant:Nn \__tblr_data_gadd_dimen_value:nnnn { nnne, nnnV, nene }
+\cs_generate_variant:Nn \__tblr_data_gadd_dimen_value:nnnn
+ { nnne, nnnV, nenn, nene }
\cs_new_protected:Npn \__tblr_array_gadd_value:Nnn #1 #2 #3
{
@@ -678,39 +718,39 @@
{
\cs_set_protected:Npn \__tblr_data_gput:nnnn #1 #2 #3 #4
{
- \__tblr_prop_gput:nnn {#1} { [#2] / #3 } {#4}
+ \__tblr_spec_gput:nnn {#1} { [#2] / #3 } {#4}
}
\cs_set_protected:Npn \__tblr_data_gput:nnnnn #1 #2 #3 #4 #5
{
- \__tblr_prop_gput:nnn {#1} { [#2][#3] / #4 } {#5}
+ \__tblr_spec_gput:nnn {#1} { [#2][#3] / #4 } {#5}
}
\cs_set:Npn \__tblr_data_item:nnn #1 #2 #3
{
- \__tblr_prop_item:nn {#1} { [#2] / #3 }
+ \__tblr_spec_item:nn {#1} { [#2] / #3 }
}
\cs_set:Npn \__tblr_data_item:nnnn #1 #2 #3 #4
{
- \__tblr_prop_item:nn {#1} { [#2][#3] / #4 }
+ \__tblr_spec_item:nn {#1} { [#2][#3] / #4 }
}
\cs_set_protected:Npn \__tblr_data_log:n #1
{
- \__tblr_prop_log:n {#1}
+ \__tblr_spec_log:n {#1}
}
\cs_set_protected:Npn \__tblr_data_gput_if_larger:nnnn #1 #2 #3 #4
{
- \__tblr_prop_gput_if_larger:nnn {#1} { [#2] / #3 } {#4}
+ \__tblr_spec_gput_if_larger:nnn {#1} { [#2] / #3 } {#4}
}
\cs_set_protected:Npn \__tblr_data_gput_if_larger:nnnnn #1 #2 #3 #4 #5
{
- \__tblr_prop_gput_if_larger:nnn {#1} { [#2][#3] / #4 } {#5}
+ \__tblr_spec_gput_if_larger:nnn {#1} { [#2][#3] / #4 } {#5}
}
\cs_set_protected:Npn \__tblr_data_gadd_dimen_value:nnnn #1 #2 #3 #4
{
- \__tblr_prop_gadd_dimen_value:nnn {#1} { [#2] / #3 } {#4}
+ \__tblr_spec_gadd_dimen_value:nnn {#1} { [#2] / #3 } {#4}
}
\cs_set_protected:Npn \__tblr_data_gadd_dimen_value:nnnnn #1 #2 #3 #4 #5
{
- \__tblr_prop_gadd_dimen_value:nnn {#1} { [#2][#3] / #4 } {#5}
+ \__tblr_spec_gadd_dimen_value:nnn {#1} { [#2][#3] / #4 } {#5}
}
}
}
@@ -890,6 +930,40 @@
}
%%% --------------------------------------------------------
+%%> \section{New Content Commands}
+%%% --------------------------------------------------------
+
+%% We need to emulate or fix some commands such as \diagbox in other packages
+%% These commands must be defined with \NewContentCommand command
+%% We only enable them inside tblr environment to avoid potential conflict
+
+\clist_new:N \g__tblr_content_commands_clist
+
+\msg_new:nnn { tabularray } { defined-content-command }
+ { Content ~ commnad ~ #1 has ~ been ~ defined! }
+
+\NewDocumentCommand \NewContentCommand { m O{0} o m }
+ {
+ \clist_if_in:NnTF \g__tblr_content_commands_clist { #1 }
+ {
+ \msg_warning:nnn { tabularray } { defined-content-command } { #1 }
+ \clist_log:N \g__tblr_content_commands_clist
+ }
+ {
+ \__tblr_make_xparse_arg_spec:nnN { #2 } { #3 } \l__tblr_a_tl
+ \exp_args:NcV \NewDocumentCommand
+ { __tblr_content_command_ \cs_to_str:N #1 :w } \l__tblr_a_tl { #4 }
+ \clist_gput_right:Nn \g__tblr_content_commands_clist { #1 }
+ }
+ }
+
+\cs_new_protected:Npn \__tblr_enable_content_commands:
+ {
+ \clist_map_inline:Nn \g__tblr_content_commands_clist
+ { \cs_set_eq:Nc ##1 { __tblr_content_command_ \cs_to_str:N ##1 :w } }
+ }
+
+%%% --------------------------------------------------------
%% \section{New Dash Styles}
%%% --------------------------------------------------------
@@ -1068,12 +1142,12 @@
{
\tl_clear:N \l__tblr_hline_num_tl
\tl_set:Nx \l__tblr_hline_count_tl
- { \__tblr_text_item:ne { hline } { [\int_use:N \c@rownum] / @hline-count } }
+ { \__tblr_spec_item:ne { hline } { [\int_use:N \c@rownum] / @hline-count } }
%% \l__tblr_hline_count_tl may be empty when rowspec has extra |'s
\int_compare:nNnTF { \l__tblr_hline_count_tl + 0 } = {0}
{
\tl_set:Nx \l__tblr_hline_num_tl { 1 }
- \__tblr_text_gput:nen { hline }
+ \__tblr_spec_gput:nen { hline }
{ [\int_use:N \c@rownum] / @hline-count } { 1 }
}
{
@@ -1095,7 +1169,7 @@
{
\tl_set:Nx \l__tblr_hline_count_tl
{ \int_eval:n { \l__tblr_hline_count_tl + 1 } }
- \__tblr_text_gput:nee { hline }
+ \__tblr_spec_gput:nee { hline }
{ [\int_use:N \c@rownum] / @hline-count } { \l__tblr_hline_count_tl }
\tl_set_eq:NN \l__tblr_hline_num_tl \l__tblr_hline_count_tl
}
@@ -1131,18 +1205,18 @@
\__tblr_get_childs:nx {#1} { \int_use:N \c@colcount }
\clist_map_inline:Nn \l_tblr_childs_clist
{
- \__tblr_text_gput:nee { hline }
+ \__tblr_spec_gput:nee { hline }
{ [\int_use:N \c@rownum][##1](\l__tblr_hline_num_tl) / @dash }
{ \l__tblr_hline_dash_tl }
\tl_if_empty:NF \l__tblr_hline_wd_tl
{
- \__tblr_text_gput:nee { hline }
+ \__tblr_spec_gput:nee { hline }
{ [\int_use:N \c@rownum][##1](\l__tblr_hline_num_tl) / wd }
{ \l__tblr_hline_wd_tl }
}
\tl_if_empty:NF \l__tblr_hline_fg_tl
{
- \__tblr_text_gput:nee { hline }
+ \__tblr_spec_gput:nee { hline }
{ [\int_use:N \c@rownum][##1](\l__tblr_hline_num_tl) / fg }
{ \l__tblr_hline_fg_tl }
}
@@ -1156,13 +1230,13 @@
{
\tl_if_eq:nnTF {#1} {above}
{
- \__tblr_prop_gput:nnx { table }
+ \__tblr_prop_gput:nnx { inner }
{ baseline } { \int_eval:n { \c@rownum - 1 } }
}
{
\tl_if_eq:nnT {#1} {below}
{
- \__tblr_prop_gput:nnx { table } { baseline } { \int_use:N \c@rownum }
+ \__tblr_prop_gput:nnx { inner } { baseline } { \int_use:N \c@rownum }
}
}
}
@@ -1267,12 +1341,12 @@
{
\tl_clear:N \l__tblr_vline_num_tl
\tl_set:Nx \l__tblr_vline_count_tl
- { \__tblr_text_item:ne { vline } { [\int_use:N \c@colnum] / @vline-count } }
+ { \__tblr_spec_item:ne { vline } { [\int_use:N \c@colnum] / @vline-count } }
%% \l__tblr_vline_count_tl may be empty when colspec has extra |'s
\int_compare:nNnTF { \l__tblr_vline_count_tl + 0 } = {0}
{
\tl_set:Nx \l__tblr_vline_num_tl { 1 }
- \__tblr_text_gput:nen { vline }
+ \__tblr_spec_gput:nen { vline }
{ [\int_use:N \c@colnum] / @vline-count } { 1 }
}
{
@@ -1294,7 +1368,7 @@
{
\tl_set:Nx \l__tblr_vline_count_tl
{ \int_eval:n { \l__tblr_vline_count_tl + 1 } }
- \__tblr_text_gput:nee { vline }
+ \__tblr_spec_gput:nee { vline }
{ [\int_use:N \c@colnum] / @vline-count } { \l__tblr_vline_count_tl }
\tl_set_eq:NN \l__tblr_vline_num_tl \l__tblr_vline_count_tl
}
@@ -1329,18 +1403,18 @@
\__tblr_get_childs:nx {#1} { \int_use:N \c@rowcount }
\clist_map_inline:Nn \l_tblr_childs_clist
{
- \__tblr_text_gput:nee { vline }
+ \__tblr_spec_gput:nee { vline }
{ [##1][\int_use:N \c@colnum](\l__tblr_vline_num_tl) / @dash }
{ \l__tblr_vline_dash_tl }
\tl_if_empty:NF \l__tblr_vline_wd_tl
{
- \__tblr_text_gput:nee { vline }
+ \__tblr_spec_gput:nee { vline }
{ [##1][\int_use:N \c@colnum](\l__tblr_vline_num_tl) / wd }
{ \l__tblr_vline_wd_tl }
}
\tl_if_empty:NF \l__tblr_vline_fg_tl
{
- \__tblr_text_gput:nee { vline }
+ \__tblr_spec_gput:nee { vline }
{ [##1][\int_use:N \c@colnum](\l__tblr_vline_num_tl) / fg }
{ \l__tblr_vline_fg_tl }
}
@@ -1440,36 +1514,41 @@
\keys_define:nn { tblr-cell-spec }
{
- l .code:n = \__tblr_data_gput:neenn { cell }
- { \int_use:N \c@rownum } { \int_use:N \c@colnum } { halign } {l},
- c .code:n = \__tblr_data_gput:neenn { cell }
- { \int_use:N \c@rownum } { \int_use:N \c@colnum } { halign } {c},
- r .code:n = \__tblr_data_gput:neenn { cell }
- { \int_use:N \c@rownum } { \int_use:N \c@colnum } { halign } {r},
- t .code:n = \__tblr_data_gput:neenn { cell }
- { \int_use:N \c@rownum } { \int_use:N \c@colnum } { valign} {t},
- p .code:n = \__tblr_data_gput:neenn { cell }
- { \int_use:N \c@rownum } { \int_use:N \c@colnum } { valign} {t},
- m .code:n = \__tblr_data_gput:neenn { cell }
- { \int_use:N \c@rownum } { \int_use:N \c@colnum } { valign} {m},
- b .code:n = \__tblr_data_gput:neenn { cell }
- { \int_use:N \c@rownum } { \int_use:N \c@colnum } { valign} {b},
- h .code:n = \__tblr_data_gput:neenn { cell }
- { \int_use:N \c@rownum } { \int_use:N \c@colnum } { valign} {h},
- f .code:n = \__tblr_data_gput:neenn { cell }
- { \int_use:N \c@rownum } { \int_use:N \c@colnum } { valign} {f},
- wd .code:n = \__tblr_data_gput:neene { cell }
- { \int_use:N \c@rownum } { \int_use:N \c@colnum } { width } {#1},
- bg .code:n = \__tblr_data_gput:neene { cell }
- { \int_use:N \c@rownum } { \int_use:N \c@colnum }
- { background } {#1},
- preto .code:n = \__tblr_cell_preto_text:n {#1},
- appto .code:n = \__tblr_cell_appto_text:n {#1},
- fg .code:n = \__tblr_cell_preto_text:n { \color{#1} },
- font .code:n = \__tblr_cell_preto_text:n { #1 \selectfont },
+ halign .code:n = \__tblr_cell_gput:nn { halign } {#1},
+ valign .code:n = \__tblr_cell_gput:nn { valign } {#1},
+ l .meta:n = { halign = l },
+ c .meta:n = { halign = c },
+ r .meta:n = { halign = r },
+ t .meta:n = { valign = t },
+ p .meta:n = { valign = t },
+ m .meta:n = { valign = m },
+ b .meta:n = { valign = b },
+ h .meta:n = { valign = h },
+ f .meta:n = { valign = f },
+ wd .code:n = \__tblr_cell_gput:ne { width } {#1},
+ bg .code:n = \__tblr_cell_gput:ne { background } {#1},
+ preto .code:n = \__tblr_cell_preto_text:n {#1},
+ appto .code:n = \__tblr_cell_appto_text:n {#1},
+ cmd .code:n = \__tblr_cell_process_text:n {#1},
+ fg .code:n = \__tblr_cell_preto_text:n { \color{#1} },
+ font .code:n = \__tblr_cell_gput:nn { font } { #1 \selectfont },
unknown .code:n = \__tblr_cell_unknown_key:V \l_keys_key_str,
}
+\cs_new_protected:Npn \__tblr_cell_gput:nn #1 #2
+ {
+ \__tblr_data_gput:neenn { cell }
+ { \int_use:N \c@rownum } { \int_use:N \c@colnum } {#1} {#2}
+ }
+\cs_generate_variant:Nn \__tblr_cell_gput:nn { ne }
+
+\cs_new_protected:Npn \__tblr_cell_gput:nnnn #1 #2 #3 #4
+ {
+ \__tblr_data_gput:nnnnn { cell } {#1} {#2} {#3} {#4}
+ }
+\cs_generate_variant:Nn \__tblr_cell_gput:nnnn
+ { nenn, ennn, eenn, nene, enne, eene }
+
\tl_new:N \l__tblr_cell_text_tl
\cs_new_protected:Npn \__tblr_cell_preto_text:n #1
@@ -1480,9 +1559,9 @@
\cs_new_protected:Npn \__tblr_cell_preto_text:nnn #1 #2 #3
{
- \tl_set:Nx \l__tblr_cell_text_tl { \__tblr_text_item:nn { text } { [#1][#2] } }
+ \tl_set:Nx \l__tblr_cell_text_tl { \__tblr_spec_item:nn { text } { [#1][#2] } }
\tl_put_left:Nn \l__tblr_cell_text_tl {#3}
- \__tblr_text_gput:nnV { text } { [#1][#2] } \l__tblr_cell_text_tl
+ \__tblr_spec_gput:nnV { text } { [#1][#2] } \l__tblr_cell_text_tl
}
\cs_generate_variant:Nn \__tblr_cell_preto_text:nnn { nen, enn, een }
@@ -1494,12 +1573,29 @@
\cs_new_protected:Npn \__tblr_cell_appto_text:nnn #1 #2 #3
{
- \tl_set:Nx \l__tblr_cell_text_tl { \__tblr_text_item:ne { text } { [#1][#2] } }
+ \tl_set:Nx \l__tblr_cell_text_tl { \__tblr_spec_item:ne { text } { [#1][#2] } }
\tl_put_right:Nn \l__tblr_cell_text_tl {#3}
- \__tblr_text_gput:neV { text } { [#1][#2] } \l__tblr_cell_text_tl
+ \__tblr_spec_gput:neV { text } { [#1][#2] } \l__tblr_cell_text_tl
}
\cs_generate_variant:Nn \__tblr_cell_appto_text:nnn { nen, enn, een }
+\cs_new_protected:Npn \__tblr_cell_process_text:n #1
+ {
+ \__tblr_cell_process_text:een
+ { \int_use:N \c@rownum } { \int_use:N \c@colnum } {#1}
+ }
+
+\cs_new_protected:Npn \__tblr_cell_process_text:nnn #1 #2 #3
+ {
+ \tl_set:Nx \l__tblr_cell_text_tl
+ {
+ { \__tblr_spec_item:nn { text } { [#1][#2] } }
+ }
+ \tl_put_left:Nn \l__tblr_cell_text_tl {#3}
+ \__tblr_spec_gput:nnV { text } { [#1][#2] } \l__tblr_cell_text_tl
+ }
+\cs_generate_variant:Nn \__tblr_cell_process_text:nnn { nen, enn, een }
+
\cs_new_protected:Npn \__tblr_cell_unknown_key:n #1
{
\regex_match:NnTF \c__tblr_is_color_key_regex {#1}
@@ -1520,13 +1616,13 @@
{
\int_compare:nNnT { #1 } > { 1 }
{
- \__tblr_prop_gput:nnn {table} {rowspan} {true}
+ \__tblr_prop_gput:nnn { inner } { rowspan } { true }
\__tblr_data_gput:neenn { cell }
{ \int_use:N \c@rownum } { \int_use:N \c@colnum } { rowspan } {#1}
}
\int_compare:nNnT { #2 } > { 1 }
{
- \__tblr_prop_gput:nnn {table} {colspan} {true}
+ \__tblr_prop_gput:nnn { inner } { colspan } { true }
\__tblr_data_gput:neenn { cell }
{ \int_use:N \c@rownum } { \int_use:N \c@colnum } { colspan } {#2}
}
@@ -1546,12 +1642,12 @@
}
\int_compare:nNnF { \l__tblr_i_tl } = { \c@rownum }
{
- \__tblr_text_gput:nen { hline }
+ \__tblr_spec_gput:nen { hline }
{ [\l__tblr_i_tl][\l__tblr_j_tl] / omit } {true}
}
\int_compare:nNnF { \l__tblr_j_tl } = { \c@colnum }
{
- \__tblr_text_gput:nee { vline }
+ \__tblr_spec_gput:nee { vline }
{ [\l__tblr_i_tl][\l__tblr_j_tl] / omit } {true}
}
}
@@ -1678,53 +1774,59 @@
\keys_define:nn { tblr-column }
{
- l .code:n = \__tblr_set_key_for_every_column_cell:nnn
- { \int_use:N \c@colnum } { halign } {l},
- c .code:n = \__tblr_set_key_for_every_column_cell:nnn
- { \int_use:N \c@colnum } { halign } {c},
- r .code:n = \__tblr_set_key_for_every_column_cell:nnn
- { \int_use:N \c@colnum } { halign } {r},
- t .code:n = \__tblr_set_key_for_every_column_cell:nnn
- { \int_use:N \c@colnum } { valign } {t},
- p .code:n = \__tblr_set_key_for_every_column_cell:nnn
- { \int_use:N \c@colnum } { valign } {t},
- m .code:n = \__tblr_set_key_for_every_column_cell:nnn
- { \int_use:N \c@colnum } { valign } {m},
- b .code:n = \__tblr_set_key_for_every_column_cell:nnn
- { \int_use:N \c@colnum } { valign } {b},
- h .code:n = \__tblr_set_key_for_every_column_cell:nnn
- { \int_use:N \c@colnum } { valign } {h},
- f .code:n = \__tblr_set_key_for_every_column_cell:nnn
- { \int_use:N \c@colnum } { valign } {f},
- bg .code:n = \__tblr_set_key_for_every_column_cell:nnn
- { \int_use:N \c@colnum } { background } {#1},
- fg .code:n = \__tblr_preto_text_for_every_column_cell:n { \color{#1} },
- font .code:n = \__tblr_preto_text_for_every_column_cell:n { #1 \selectfont },
- wd .code:n = \__tblr_data_gput:nene { column }
- { \int_use:N \c@colnum } { width } { \dim_eval:n {#1} },
- co .code:n = \__tblr_data_gput:nene { column }
- { \int_use:N \c@colnum } { coefficient } {#1},
- leftsep .code:n = \__tblr_data_gput:nene { column }
- { \int_use:N \c@colnum } { leftsep } { \dim_eval:n {#1} },
- rightsep .code:n = \__tblr_data_gput:nene { column }
- { \int_use:N \c@colnum } { rightsep } { \dim_eval:n {#1} },
- colsep .meta:n = { leftsep = #1, rightsep = #1},
- leftsep+ .code:n = \__tblr_data_gadd_dimen_value:nene { column }
- { \int_use:N \c@colnum } { leftsep } { \dim_eval:n {#1} },
- rightsep+ .code:n = \__tblr_data_gadd_dimen_value:nene { column }
- { \int_use:N \c@colnum } { rightsep } { \dim_eval:n {#1} },
- colsep+ .meta:n = { leftsep+ = #1, rightsep+ = #1},
- unknown .code:n = \__tblr_column_unknown_key:V \l_keys_key_str,
- }
-
-%% #1: column number; #2: key; #3: value
-\cs_new_protected:Npn \__tblr_set_key_for_every_column_cell:nnn #1 #2 #3
+ halign .code:n = \__tblr_column_gput_cell:nn { halign } {#1},
+ valign .code:n = \__tblr_column_gput_cell:nn { valign } {#1},
+ l .meta:n = { halign = l },
+ c .meta:n = { halign = c },
+ r .meta:n = { halign = r },
+ t .meta:n = { valign = t },
+ p .meta:n = { valign = t },
+ m .meta:n = { valign = m },
+ b .meta:n = { valign = b },
+ h .meta:n = { valign = h },
+ f .meta:n = { valign = f },
+ bg .code:n = \__tblr_column_gput_cell:nn { background } {#1},
+ fg .code:n = \__tblr_preto_text_for_every_column_cell:n { \color{#1} },
+ font .code:n = \__tblr_column_gput_cell:nn { font } { #1 \selectfont },
+ wd .code:n = \__tblr_column_gput:ne { width } { \dim_eval:n {#1} },
+ co .code:n = \__tblr_column_gput:ne { coefficient } {#1},
+ preto .code:n = \__tblr_preto_text_for_every_column_cell:n {#1},
+ appto .code:n = \__tblr_appto_text_for_every_column_cell:n {#1},
+ cmd .code:n = \__tblr_process_text_for_every_column_cell:n {#1},
+ leftsep .code:n = \__tblr_column_gput:ne { leftsep } { \dim_eval:n {#1} },
+ rightsep .code:n = \__tblr_column_gput:ne { rightsep } { \dim_eval:n {#1} },
+ colsep .meta:n = { leftsep = #1, rightsep = #1},
+ leftsep+ .code:n = \__tblr_column_gadd_dimen:ne
+ { leftsep } { \dim_eval:n {#1} },
+ rightsep+ .code:n = \__tblr_column_gadd_dimen:ne
+ { rightsep } { \dim_eval:n {#1} },
+ colsep+ .meta:n = { leftsep+ = #1, rightsep+ = #1},
+ unknown .code:n = \__tblr_column_unknown_key:V \l_keys_key_str,
+ }
+
+%% #1: key; #2: value
+\cs_new_protected:Npn \__tblr_column_gput:nn #1 #2
+ {
+ \__tblr_data_gput:nenn { column } { \int_use:N \c@colnum } {#1} {#2}
+ }
+\cs_generate_variant:Nn \__tblr_column_gput:nn { ne }
+
+\cs_new_protected:Npn \__tblr_column_gadd_dimen:nn #1 #2
+ {
+ \__tblr_data_gadd_dimen_value:nenn { column }
+ { \int_use:N \c@colnum } {#1} {#2}
+ }
+\cs_generate_variant:Nn \__tblr_column_gadd_dimen:nn { ne }
+
+%% #1: key; #2: value
+\cs_new_protected:Npn \__tblr_column_gput_cell:nn #1 #2
{
\int_step_inline:nn { \c@rowcount }
{
- \__tblr_data_gput:neenn { cell } {##1} {#1} {#2} {#3}
+ \__tblr_cell_gput:nenn {##1} { \int_use:N \c@colnum } {#1} {#2}
}
}
+\cs_generate_variant:Nn \__tblr_column_gput_cell:nn { ne }
\cs_new_protected:Npn \__tblr_preto_text_for_every_column_cell:n #1
{
@@ -1742,25 +1844,26 @@
}
}
+\cs_new_protected:Npn \__tblr_process_text_for_every_column_cell:n #1
+ {
+ \int_step_inline:nn { \c@rowcount }
+ {
+ \__tblr_cell_process_text:nen {##1} { \int_use:N \c@colnum } {#1}
+ }
+ }
+
\regex_const:Nn \c__tblr_is_number_key_regex { ^[\+\-]? (\d+|\d*\.\d+)$ }
\cs_new_protected:Npn \__tblr_column_unknown_key:n #1
{
\regex_match:NnTF \c__tblr_is_number_key_regex {#1}
- {
- \__tblr_data_gput:nene { column }
- { \int_use:N \c@colnum } { coefficient } {#1}
- }
+ { \__tblr_column_gput:ne { coefficient } {#1} }
{
\regex_match:NnTF \c__tblr_is_color_key_regex {#1}
- {
- \__tblr_set_key_for_every_column_cell:nnn
- { \int_use:N \c@colnum } { background } {#1}
- }
+ { \__tblr_column_gput_cell:nn { background } {#1} }
{
\tl_set_rescan:Nnn \l__tblr_v_tl {} {#1}
- \__tblr_data_gput:nene { column }
- { \int_use:N \c@colnum } { width } { \dim_eval:n { \l__tblr_v_tl } }
+ \__tblr_column_gput:ne { width } { \dim_eval:n { \l__tblr_v_tl } }
}
}
}
@@ -1830,55 +1933,58 @@
\keys_define:nn { tblr-row }
{
- l .code:n = \__tblr_set_key_for_every_row_cell:nnn
- { \int_use:N \c@rownum } { halign } {l},
- c .code:n = \__tblr_set_key_for_every_row_cell:nnn
- { \int_use:N \c@rownum } { halign } {c},
- r .code:n = \__tblr_set_key_for_every_row_cell:nnn
- { \int_use:N \c@rownum } { halign } {r},
- t .code:n = \__tblr_set_key_for_every_row_cell:nnn
- { \int_use:N \c@rownum } { valign } {t},
- p .code:n = \__tblr_set_key_for_every_row_cell:nnn
- { \int_use:N \c@rownum } { valign } {t},
- m .code:n = \__tblr_set_key_for_every_row_cell:nnn
- { \int_use:N \c@rownum } { valign } {m},
- b .code:n = \__tblr_set_key_for_every_row_cell:nnn
- { \int_use:N \c@rownum } { valign } {b},
- h .code:n = \__tblr_set_key_for_every_row_cell:nnn
- { \int_use:N \c@rownum } { valign } {h},
- f .code:n = \__tblr_set_key_for_every_row_cell:nnn
- { \int_use:N \c@rownum } { valign } {f},
- bg .code:n = \__tblr_set_key_for_every_row_cell:nnn
- { \int_use:N \c@rownum } { background } {#1},
- fg .code:n = \__tblr_preto_text_for_every_row_cell:n { \color{#1} },
- font .code:n = \__tblr_preto_text_for_every_row_cell:n { #1 \selectfont },
- ht .code:n = \__tblr_data_gput:nene { row } { \int_use:N \c@rownum }
- { height } { \dim_eval:n {#1} },
- co .code:n = \__tblr_data_gput:nene { row } { \int_use:N \c@rownum }
- { coefficient } {#1},
- abovesep .code:n = \__tblr_data_gput:nene { row } { \int_use:N \c@rownum }
- { abovesep } { \dim_eval:n {#1} },
- belowsep .code:n = \__tblr_data_gput:nene { row } { \int_use:N \c@rownum }
- { belowsep } { \dim_eval:n {#1} },
- rowsep .meta:n = { abovesep = #1, belowsep = #1},
- abovesep+ .code:n = \__tblr_data_gadd_dimen_value:nene { row }
- { \int_use:N \c@rownum } { abovesep } { \dim_eval:n {#1} },
- belowsep+ .code:n = \__tblr_data_gadd_dimen_value:nene { row }
- { \int_use:N \c@rownum } { belowsep } { \dim_eval:n {#1} },
- rowsep+ .meta:n = { abovesep+ = #1, belowsep+ = #1},
- nobreak .code:n = \__tblr_prop_gput:nxx { row }
- { [\int_eval:n {\c@rownum - 1}] / nobreak } { true },
- unknown .code:n = \__tblr_row_unknown_key:V \l_keys_key_str,
- }
-
-%% #1: row number; #2: key; #3: value
-\cs_new_protected:Npn \__tblr_set_key_for_every_row_cell:nnn #1 #2 #3
+ halign .code:n = \__tblr_row_gput_cell:nn { halign } {#1},
+ valign .code:n = \__tblr_row_gput_cell:nn { valign } {#1},
+ l .meta:n = { halign = l },
+ c .meta:n = { halign = c },
+ r .meta:n = { halign = r },
+ t .meta:n = { valign = t },
+ p .meta:n = { valign = t },
+ m .meta:n = { valign = m },
+ b .meta:n = { valign = b },
+ h .meta:n = { valign = h },
+ f .meta:n = { valign = f },
+ bg .code:n = \__tblr_row_gput_cell:nn { background } {#1},
+ fg .code:n = \__tblr_preto_text_for_every_row_cell:n { \color{#1} },
+ font .code:n = \__tblr_row_gput_cell:nn { font } { #1 \selectfont },
+ ht .code:n = \__tblr_row_gput:ne { height } { \dim_eval:n {#1} },
+ co .code:n = \__tblr_row_gput:ne { coefficient } {#1},
+ preto .code:n = \__tblr_preto_text_for_every_row_cell:n {#1},
+ appto .code:n = \__tblr_appto_text_for_every_row_cell:n {#1},
+ cmd .code:n = \__tblr_process_text_for_every_row_cell:n {#1},
+ abovesep .code:n = \__tblr_row_gput:ne { abovesep } { \dim_eval:n {#1} },
+ belowsep .code:n = \__tblr_row_gput:ne { belowsep } { \dim_eval:n {#1} },
+ rowsep .meta:n = { abovesep = #1, belowsep = #1},
+ 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@rownum - 1}] / nobreak } { true },
+ unknown .code:n = \__tblr_row_unknown_key:V \l_keys_key_str,
+ }
+
+%% #1: key; #2: value
+\cs_new_protected:Npn \__tblr_row_gput:nn #1 #2
+ {
+ \__tblr_data_gput:nenn { row } { \int_use:N \c@rownum } {#1} {#2}
+ }
+\cs_generate_variant:Nn \__tblr_row_gput:nn { ne }
+
+\cs_new_protected:Npn \__tblr_row_gadd_dimen:nn #1 #2
+ {
+ \__tblr_data_gadd_dimen_value:nenn { row } { \int_use:N \c@rownum } {#1} {#2}
+ }
+\cs_generate_variant:Nn \__tblr_row_gadd_dimen:nn { ne }
+
+%% #1: key; #2: value
+\cs_new_protected:Npn \__tblr_row_gput_cell:nn #1 #2
{
\int_step_inline:nn { \c@colcount }
{
- \__tblr_data_gput:neenn { cell } {#1} {##1} {#2} {#3}
+ \__tblr_cell_gput:ennn { \int_use:N \c@rownum } {##1} {#1} {#2}
}
}
+\cs_generate_variant:Nn \__tblr_row_gput_cell:nn { ne }
\cs_new_protected:Npn \__tblr_preto_text_for_every_row_cell:n #1
{
@@ -1896,6 +2002,14 @@
}
}
+\cs_new_protected:Npn \__tblr_process_text_for_every_row_cell:n #1
+ {
+ \int_step_inline:nn { \c@colcount }
+ {
+ \__tblr_cell_process_text:enn { \int_use:N \c@rownum } {##1} {#1}
+ }
+ }
+
\cs_new_protected:Npn \__tblr_row_unknown_key:n #1
{
\regex_match:NnTF \c__tblr_is_number_key_regex {#1}
@@ -1905,14 +2019,10 @@
}
{
\regex_match:NnTF \c__tblr_is_color_key_regex {#1}
+ { \__tblr_row_gput_cell:nn { background } {#1} }
{
- \__tblr_set_key_for_every_row_cell:nnn
- { \int_use:N \c@rownum } { background } {#1}
- }
- {
- \tl_set_rescan:Nnn \l__tblr_v_tl {} {#1}
- \__tblr_data_gput:nene { row } { \int_use:N \c@rownum }
- { height } { \dim_eval:n { \l__tblr_v_tl } }
+ \tl_set_rescan:Nnn \l__tblr_v_tl {} {#1}
+ \__tblr_row_gput:ne { height } { \dim_eval:n { \l__tblr_v_tl } }
}
}
}
@@ -2205,43 +2315,100 @@
}
%%% --------------------------------------------------------
-%% \section{Tabularray Environments}
+%% \section{Set Environments and New Environments}
%%% --------------------------------------------------------
+\tl_new:N \l__tblr_initial_tblr_outer_tl
+\tl_set:Nn \l__tblr_initial_tblr_outer_tl
+ {
+ halign = c, valign = m, headsep = 6pt, footsep = 6pt,
+ presep = 1.5\bigskipamount, postsep = 1.5\bigskipamount,
+ }
+
+%% #1: env name; #2: specifications
+\NewDocumentCommand \SetTblrInner { O{tblr} m }
+ {
+ \tl_put_right:cn { l__tblr_default_ #1 _inner_tl } { , #2 }
+ \ignorespaces
+ }
+\cs_new_eq:NN \SetTblrDefault \SetTblrInner
+
+%% #1: env name; #2: specifications
+\NewDocumentCommand \SetTblrOuter { O{tblr} m }
+ {
+ \tl_put_right:cn { l__tblr_default_ #1 _outer_tl } { , #2 }
+ \ignorespaces
+ }
+
+%% #1: env name
+\NewDocumentCommand \NewTblrEnviron { m }
+ {
+ \tl_new:c { l__tblr_default_ #1 _outer_tl }
+ \tl_set_eq:cN { l__tblr_default_ #1 _outer_tl } \l__tblr_initial_tblr_outer_tl
+ \tl_new:c { l__tblr_default_ #1 _inner_tl }
+ \NewDocumentEnvironment {#1} { O{c} m +b }
+ {
+ \__tblr_environ_code:nnnn {#1} {##1} {##2} {##3}
+ } { }
+ \ignorespaces
+ }
+
+%% Create tblr and longtblr environments
+\NewTblrEnviron { tblr }
+\NewTblrEnviron { longtblr }
+\SetTblrOuter [ longtblr ] { long }
+
\tl_new:N \l__tblr_env_name_tl
\bool_new:N \l__tblr_math_mode_bool
-\NewDocumentEnvironment { tblr } { O{c} m +b }
+%% Main environment code
+\cs_new_protected:Npn \__tblr_environ_code:nnnn #1 #2 #3 #4
{
- \tl_set:Nn \l__tblr_env_name_tl { tblr }
+ \int_gincr:N \g__tblr_table_count_int
+ \tl_set:Nn \l__tblr_env_name_tl {#1}
\mode_if_math:TF
{ \bool_set_true:N \l__tblr_math_mode_bool }
{ \bool_set_false:N \l__tblr_math_mode_bool }
- \buildtblr {#1} {#2} {#3}
- } { }
+ \__tblr_builder:nnn {#2} {#3} {#4}
+ }
%% Read, split and build the table
-
-\cs_new_protected:Npn \buildtblr #1 #2 #3
+\cs_new_protected:Npn \__tblr_builder:nnn #1 #2 #3
{
- \mode_leave_vertical:
\int_gincr:N \g_tblr_level_int
\__tblr_clear_prop_lists:
- \__tblr_clear_text_lists:
+ \__tblr_clear_spec_lists:
\__tblr_enable_table_commands:
- \__tblr_split_table:n { #3 }
+ \LogTblrTracing { step = split ~ table}
+ \__tblr_split_table:n {#3}
\LogTblrTracing { command }
- \bool_if:NT \g__tblr_use_intarray_bool { \__tblr_initial_table_data: }
- \__tblr_initial_table_spec:
- \LogTblrTracing { table }
- \__tblr_parse_table_spec:n { #2 }
+ \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 { option }
+ \bool_if:NT \g__tblr_use_intarray_bool { \__tblr_init_table_data: }
+ \LogTblrTracing { step = init ~ table ~ inner ~ spec}
+ \__tblr_init_table_inner_spec:
+ \LogTblrTracing { inner }
+ \LogTblrTracing { step = parse ~ table ~ inner ~ spec}
+ \__tblr_parse_table_spec:n {#2}
+ \LogTblrTracing { step = execute ~ table ~ commands}
\__tblr_execute_table_commands:
\__tblr_disable_table_commands:
+ \LogTblrTracing { step = calculate ~ cell ~ and ~ line ~ sizes}
+ \__tblr_enable_content_commands:
\__tblr_calc_cell_and_line_sizes:
- \__tblr_build_whole:n { #1 }
+ \LogTblrTracing { step = build ~ the ~ whole ~ table}
+ \__tblr_build_whole:
\int_gdecr:N \g_tblr_level_int
}
+%%% --------------------------------------------------------
+%% \section{Split Table Contents}
+%%% --------------------------------------------------------
+
%% Insert and remove braces for nesting environments inside cells
%% These make line split and cell split workable
%% We need to replace N times for N level nestings
@@ -2348,7 +2515,7 @@
\__tblr_remove_braces:N \l_tmpa_tl
\int_incr:N \c@colnum
\__tblr_extract_table_commands:N \l_tmpa_tl
- \__tblr_text_gput:neV { text } { [#1][\int_use:N \c@colnum] } \l_tmpa_tl
+ \__tblr_spec_gput:neV { text } { [#1][\int_use:N \c@colnum] } \l_tmpa_tl
\__tblr_add_multicolumn_empty_cell:
}
%% Decrease row count by 1 if the last row has only one empty cell text
@@ -2373,7 +2540,7 @@
\int_step_inline:nn { \l__multicolumn_cell_number_int - 1 }
{
\int_incr:N \c@colnum
- \__tblr_text_gput:nen { text }
+ \__tblr_spec_gput:nen { text }
{ [\int_use:N \c@rownum][\int_use:N \c@colnum] } { }
}
}
@@ -2395,7 +2562,7 @@
\tl_clear:N \l__tblr_saved_table_commands_before_cell_text_tl
\tl_clear:N \l__tblr_saved_cell_text_after_table_commands_tl
\int_set:Nn \l__multicolumn_cell_number_int {1}
- \exp_last_unbraced:NV \__tblr_extract_table_commands_next:w #1 \scan_stop:
+ \exp_last_unbraced:NV \__tblr_extract_table_commands_next:w #1 \q_stop
\tl_if_empty:NF \l__tblr_saved_table_commands_before_cell_text_tl
{
\__tblr_prop_gput:nxV { command }
@@ -2420,7 +2587,7 @@
{
\tl_if_single_token:nTF {#1}
{
- \token_if_eq_meaning:NNF #1 \scan_stop:
+ \token_if_eq_meaning:NNF #1 \q_stop
{ \__tblr_save_real_cell_text:w #1 }
}
{ \__tblr_save_real_cell_text:w {#1} }
@@ -2477,22 +2644,22 @@
\cs_new_protected:Npn \__tblr_last_unbraced:Nn #1 #2 { #1 #2 }
%% The outermost set of braces of cell text #1 will be removed
-\cs_new_protected:Npn \__tblr_save_real_cell_text:w #1 \scan_stop:
+\cs_new_protected:Npn \__tblr_save_real_cell_text:w #1 \q_stop
{
\tl_set:Nn \l__tblr_saved_cell_text_after_table_commands_tl {#1}
}
%%% --------------------------------------------------------
-%% \section{Initial Table Specifications}
+%% \section{Initialize Table Inner Specifications}
%%% --------------------------------------------------------
-\prop_gset_from_keyval:Nn \g__tblr_default_tblr_table_prop
+\prop_gset_from_keyval:Nn \g__tblr_initial_table_prop
{
stretch = 1,
rulesep = 2pt,
}
-\prop_gset_from_keyval:Nn \g__tblr_default_tblr_rows_prop
+\prop_gset_from_keyval:Nn \g__tblr_initial_rows_prop
{
abovesep = 2pt,
belowsep = 2pt,
@@ -2503,7 +2670,7 @@
@row-lower = 0pt,
}
-\prop_gset_from_keyval:Nn \g__tblr_default_tblr_columns_prop
+\prop_gset_from_keyval:Nn \g__tblr_initial_columns_prop
{
leftsep = 6pt,
rightsep = 6pt,
@@ -2512,7 +2679,7 @@
@col-width = 0pt,
}
-\prop_gset_from_keyval:Nn \g__tblr_default_tblr_cells_prop
+\prop_gset_from_keyval:Nn \g__tblr_initial_cells_prop
{
halign = l,
valign = t,
@@ -2522,96 +2689,85 @@
omit = 0,
}
-\prop_gset_from_keyval:Nn \g__tblr_default_tblr_hlines_prop
+\prop_gset_from_keyval:Nn \g__tblr_initial_hlines_prop
{
@hline-count = 0,
}
-\prop_gset_from_keyval:Nn \g__tblr_default_tblr_vlines_prop
+\prop_gset_from_keyval:Nn \g__tblr_initial_vlines_prop
{
@vline-count = 0,
}
-\cs_new_protected:Npn \__tblr_initial_table_spec:
+\cs_new_protected:Npn \__tblr_init_table_inner_spec:
{
- \prop_map_inline:cn { g__tblr_default_ \l__tblr_env_name_tl _table_prop }
+ \prop_map_inline:Nn \g__tblr_initial_table_prop
{
- \__tblr_prop_gput:nxn { table } { ##1 } {##2}
+ \__tblr_prop_gput:nxn { inner } { ##1 } {##2}
}
\int_step_variable:nNn { \c@rowcount } \l__tblr_i_tl
{
- \prop_map_inline:cn { g__tblr_default_ \l__tblr_env_name_tl _rows_prop }
+ \prop_map_inline:Nn \g__tblr_initial_rows_prop
{
\__tblr_data_gput:nVnn { row } \l__tblr_i_tl {##1} {##2}
}
- \prop_map_inline:cn { g__tblr_default_ \l__tblr_env_name_tl _hlines_prop }
+ \prop_map_inline:Nn \g__tblr_initial_hlines_prop
{
- \__tblr_text_gput:nen { hline } { [\l__tblr_i_tl] / ##1 } {##2}
+ \__tblr_spec_gput:nen { hline } { [\l__tblr_i_tl] / ##1 } {##2}
}
\int_step_variable:nNn { \c@colcount } \l__tblr_j_tl
{
- \prop_map_inline:cn
- { g__tblr_default_ \l__tblr_env_name_tl _cells_prop }
+ \prop_map_inline:Nn \g__tblr_initial_cells_prop
{
\__tblr_data_gput:neeen { cell }
{ \l__tblr_i_tl } { \l__tblr_j_tl } {##1} {##2}
}
}
}
- \prop_map_inline:cn { g__tblr_default_ \l__tblr_env_name_tl _hlines_prop }
+ \prop_map_inline:Nn \g__tblr_initial_hlines_prop
{
- \__tblr_text_gput:nen { hline }
+ \__tblr_spec_gput:nen { hline }
{ [\int_eval:n { \c@rowcount + 1}] / ##1 } {##2}
}
\int_step_variable:nNn { \c@colcount } \l__tblr_j_tl
{
- \prop_map_inline:cn { g__tblr_default_ \l__tblr_env_name_tl _columns_prop }
+ \prop_map_inline:Nn \g__tblr_initial_columns_prop
{
\__tblr_data_gput:nenn { column } { \l__tblr_j_tl } {##1} {##2}
}
- \prop_map_inline:cn { g__tblr_default_ \l__tblr_env_name_tl _vlines_prop }
+ \prop_map_inline:Nn \g__tblr_initial_vlines_prop
{
- \__tblr_text_gput:nen { vline } { [\l__tblr_j_tl] / ##1 } {##2}
+ \__tblr_spec_gput:nen { vline } { [\l__tblr_j_tl] / ##1 } {##2}
}
}
- \prop_map_inline:cn { g__tblr_default_ \l__tblr_env_name_tl _vlines_prop }
+ \prop_map_inline:Nn \g__tblr_initial_vlines_prop
{
- \__tblr_text_gput:nen { vline }
+ \__tblr_spec_gput:nen { vline }
{ [\int_eval:n { \c@colcount + 1}] / ##1 } {##2}
}
- \keys_set:nv { tblr } { l__tblr_default_ \l__tblr_env_name_tl _tl }
+ \keys_set:nv { tblr } { l__tblr_default_ \l__tblr_env_name_tl _inner_tl }
}
-\tl_new:N \l__tblr_default_tblr_tl
-
-%% #1: env name; #2: options
-\NewDocumentCommand \SetTabularrayDefault { O{tblr} m }
- {
- \tl_put_right:cn { l__tblr_default_ #1 _tl } { , #2 }
- }
-\cs_new_eq:NN \SetTblrDefault \SetTabularrayDefault
-
%%% --------------------------------------------------------
-%% \section{Parse Table Specifications}
+%%> \section{Parse Table Inner Specifications}
%%% --------------------------------------------------------
\clist_new:N \g__tblr_table_known_keys_clist
\clist_gset:Nn \g__tblr_table_known_keys_clist
{
- long, colspec, rowspec, width, hspan, stretch,
+ colspec, rowspec, width, hspan, vspan, stretch,
column, row, cell, vline, hline, columns, rows, cells, vlines, hlines,
leftsep, rightsep, colsep, abovesep, belowsep, rowsep, rulesep,
+ rowhead, rowfoot,
}
-\bool_new:N \l__tblr_long_table_bool
-
\keys_define:nn { tblr }
{
- long .bool_set:N = \l__tblr_long_table_bool,
colspec .code:n = \__tblr_parse_colrow_spec:nn { column } {#1},
rowspec .code:n = \__tblr_parse_colrow_spec:nn { row } {#1},
width .code:n = \__tblr_keys_gput:nx { width } { \dim_eval:n {#1} },
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},
columns .code:n = \__tblr_set_every_column_aux:n {#1},
rows .code:n = \__tblr_set_every_row_aux:n {#1},
@@ -2625,6 +2781,8 @@
belowsep .code:n = \tblr_set_every_row:nn { } { belowsep = #1 },
rowsep .meta:n = { abovesep = #1, belowsep = #1 },
rulesep .code:n = \__tblr_keys_gput:nn { rulesep } {#1},
+ rowhead .code:n = \__tblr_keys_gput:nn { rowhead } {#1},
+ rowfoot .code:n = \__tblr_keys_gput:nn { rowfoot } {#1},
unknown .code:n = \__tblr_table_special_key:Vn \l_keys_key_str {#1},
}
@@ -2658,13 +2816,106 @@
{ \__tblr_parse_colrow_spec:nn { column } {#1} }
}
-\cs_new_protected:Npn \__tblr_keys_gput:nn #1 #2
+\cs_new_protected:Npn \__tblr_keys_gput:nn #1 #2
{
- \__tblr_prop_gput:nnn { table } {#1} {#2}
+ \__tblr_prop_gput:nnn { inner } {#1} {#2}
}
\cs_generate_variant:Nn \__tblr_keys_gput:nn { nx }
%%% --------------------------------------------------------
+%% \section{Initialize and Parse Table Outer Specifications}
+%%% --------------------------------------------------------
+
+%% #1: theme names; #2: template and style commands
+\NewDocumentCommand \NewTblrTheme { m +m }
+ {
+ \tl_set:cn { g__tblr_theme_ #1 _code_tl } {#2}
+ \ignorespaces
+ }
+
+\cs_new_protected:Npn \__tblr_use_theme:n #1
+ {
+ \ignorespaces
+ \tl_use:c { g__tblr_theme_ #1 _code_tl }
+ }
+
+\cs_new_protected:Npn \__tblr_init_table_outer_spec:
+ {
+ \keys_set:nv { tblr-outer } { l__tblr_default_ \l__tblr_env_name_tl _outer_tl }
+ }
+
+\cs_new_protected:Npn \__tblr_parse_table_option:n #1
+ {
+ \keys_set:nn { tblr-outer } {#1}
+ }
+
+\keys_define:nn { tblr-outer }
+ {
+ long .code:n = \__tblr_outer_gput_spec:nn { long } {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 },
+ c .meta:n = { halign = c },
+ r .meta:n = { halign = r },
+ t .meta:n = { valign = t },
+ m .meta:n = { valign = m },
+ b .meta:n = { valign = b },
+ 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},
+ postsep .code:n = \__tblr_outer_gput_spec:nn { postsep } {#1},
+ theme .code:n = \__tblr_use_theme:n {#1},
+ caption .code:n = \__tblr_outer_gput_spec:nn { caption } {#1},
+ entry .code:n = \__tblr_outer_gput_spec:nn { entry } {#1},
+ label .code:n = \__tblr_outer_gput_spec:nn { label } {#1},
+ unknown .code:n = \__tblr_table_option_key:Vn \l_keys_key_str {#1},
+ }
+
+\cs_new_protected:Npn \__tblr_outer_gput_spec:nn #1 #2
+ {
+ \__tblr_spec_gput:nen { outer } {#1} {#2}
+ }
+
+\regex_const:Nn \c__tblr_option_key_name_regex { ^ [A-Za-z\-] + $ }
+
+\msg_new:nnn { tabularray } { unknown-outer-key }
+ { Unknown ~ outer ~ key ~ name ~ #1! }
+
+\cs_new_protected:Npn \__tblr_table_option_key:nn #1 #2
+ {
+ \regex_match:NnTF \c__tblr_option_key_name_regex {#1}
+ { \msg_error:nnn { tabularray } { unknown-outer-key } {#1} }
+ {
+ \regex_extract_once:NnNT \c__tblr_split_key_name_regex {#1} \l_tmpa_seq
+ {
+ \tl_set:Nx \l__tblr_a_tl { \seq_item:Nn \l_tmpa_seq {2} }
+ \tl_set_rescan:Nnx \l__tblr_b_tl {} { \seq_item:Nn \l_tmpa_seq {3} }
+ \tl_set:Nx \l__tblr_c_tl { \tl_head:N \l__tblr_b_tl }
+ \use:c { __tblr_outer_gput_ \l__tblr_a_tl :Vn } \l__tblr_c_tl {#2}
+ }
+ }
+ }
+\cs_generate_variant:Nn \__tblr_table_option_key:nn { Vn }
+
+\cs_new_protected:Npn \__tblr_outer_gput_note:nn #1 #2
+ {
+ \__tblr_prop_gput:nnn { note } {#1} {#2}
+ }
+\cs_generate_variant:Nn \__tblr_outer_gput_note:nn { Vn }
+
+\cs_new_protected:Npn \__tblr_outer_gput_remark:nn #1 #2
+ {
+ \__tblr_prop_gput:nnn { remark } {#1} {#2}
+ }
+\cs_generate_variant:Nn \__tblr_outer_gput_remark:nn { Vn }
+
+\cs_new_protected:Npn \__tblr_outer_gput_more:nn #1 #2
+ {
+ \__tblr_prop_gput:nnn { more } {#1} {#2}
+ }
+\cs_generate_variant:Nn \__tblr_outer_gput_more:nn { Vn }
+
+%%% --------------------------------------------------------
%% \section{Typeset and Calculate Sizes}
%%% --------------------------------------------------------
@@ -2687,7 +2938,7 @@
\cs_new_protected:Npn \__tblr_make_strut_box:
{
- \tl_set:Nx \l__tblr_s_tl { \__tblr_prop_item:ne { table } { stretch } }
+ \tl_set:Nx \l__tblr_s_tl { \__tblr_prop_item:ne { inner } { stretch } }
\hbox_set:Nn \l__tblr_strut_ht_box
{ \vrule height \l__tblr_s_tl \box_ht:N \strutbox width ~ 0pt }
\hbox_set:Nn \l__tblr_strut_dp_box
@@ -2725,11 +2976,11 @@
{
\dim_zero:N \l__tblr_w_dim
\tl_set:Nx \l__tblr_n_tl
- { \__tblr_text_item:ne { vline } { [#2] / @vline-count } }
+ { \__tblr_spec_item:ne { vline } { [#2] / @vline-count } }
\int_compare:nNnT { \l__tblr_n_tl } > {0}
{
\tl_set:Nx \l__tblr_s_tl
- { \__tblr_prop_item:ne { table } { rulesep } }
+ { \__tblr_prop_item:ne { inner } { rulesep } }
\int_step_inline:nn { \l__tblr_n_tl }
{
\vbox_set_to_ht:Nnn \l__tblr_b_box {1pt}
@@ -2738,14 +2989,14 @@
{#1} {#2} {##1} {1pt} {1pt}
}
\tl_set:Nx \l__tblr_w_tl { \dim_eval:n { \box_wd:N \l__tblr_b_box } }
- \__tblr_text_gput_if_larger:nee { vline }
+ \__tblr_spec_gput_if_larger:nee { vline }
{ [#2](##1) / @vline-width } { \l__tblr_w_tl }
\dim_add:Nn \l__tblr_w_dim { \l__tblr_w_tl }
\dim_add:Nn \l__tblr_w_dim { \l__tblr_s_tl }
}
\dim_add:Nn \l__tblr_w_dim { - \l__tblr_s_tl }
}
- \__tblr_text_gput_if_larger:nee { vline }
+ \__tblr_spec_gput_if_larger:nee { vline }
{ [#2]/ @vline-width } { \dim_use:N \l__tblr_w_dim }
}
@@ -2756,10 +3007,10 @@
{
\group_begin:
\tl_set:Nx \l__tblr_w_tl
- { \__tblr_text_item:ne { vline } { [#1][#2](#3) / wd } }
+ { \__tblr_spec_item:ne { vline } { [#1][#2](#3) / wd } }
\tl_if_empty:NF \l__tblr_w_tl { \dim_set:Nn \rulewidth { \l__tblr_w_tl } }
\tl_set:Nx \l__tblr_d_tl
- { \__tblr_text_item:ne { vline } { [#1][#2](#3) / @dash } }
+ { \__tblr_spec_item:ne { vline } { [#1][#2](#3) / @dash } }
\tl_set:Nx \l__tblr_a_tl { \tl_head:N \l__tblr_d_tl }
\tl_set:Nx \l__tblr_b_tl { \tl_tail:N \l__tblr_d_tl }
\exp_args:NV \tl_if_eq:NNTF \l__tblr_a_tl \@tblr@dash
@@ -2783,11 +3034,11 @@
{
\dim_zero:N \l__tblr_h_dim
\tl_set:Nx \l__tblr_n_tl
- { \__tblr_text_item:ne { hline } { [#1] / @hline-count } }
+ { \__tblr_spec_item:ne { hline } { [#1] / @hline-count } }
\int_compare:nNnT { \l__tblr_n_tl } > {0}
{
\tl_set:Nx \l__tblr_s_tl
- { \__tblr_prop_item:ne { table } { rulesep } }
+ { \__tblr_prop_item:ne { inner } { rulesep } }
\int_step_inline:nn { \l__tblr_n_tl }
{
\hbox_set_to_wd:Nnn \l__tblr_b_box {1pt}
@@ -2797,14 +3048,14 @@
\dim_eval:n
{ \box_ht:N \l__tblr_b_box + \box_dp:N \l__tblr_b_box }
}
- \__tblr_text_gput_if_larger:nee { hline }
+ \__tblr_spec_gput_if_larger:nee { hline }
{ [#1](##1) / @hline-height } { \l__tblr_h_tl }
\dim_add:Nn \l__tblr_h_dim { \l__tblr_h_tl }
\dim_add:Nn \l__tblr_h_dim { \l__tblr_s_tl }
}
\dim_add:Nn \l__tblr_h_dim { - \l__tblr_s_tl }
}
- \__tblr_text_gput_if_larger:nee { hline }
+ \__tblr_spec_gput_if_larger:nee { hline }
{ [#1] / @hline-height } { \dim_use:N \l__tblr_h_dim }
}
@@ -2814,10 +3065,10 @@
{
\group_begin:
\tl_set:Nx \l__tblr_w_tl
- { \__tblr_text_item:ne { hline } { [#1][#2](#3) / wd } }
+ { \__tblr_spec_item:ne { hline } { [#1][#2](#3) / wd } }
\tl_if_empty:NF \l__tblr_w_tl { \dim_set:Nn \rulewidth { \l__tblr_w_tl } }
\tl_set:Nx \l__tblr_d_tl
- { \__tblr_text_item:ne { hline } { [#1][#2](#3) / @dash } }
+ { \__tblr_spec_item:ne { hline } { [#1][#2](#3) / @dash } }
\tl_set:Nx \l__tblr_a_tl { \tl_head:N \l__tblr_d_tl }
\tl_set:Nx \l__tblr_b_tl { \tl_tail:N \l__tblr_d_tl }
\exp_args:NV \tl_if_eq:NNTF \l__tblr_a_tl \@tblr@dash
@@ -2893,9 +3144,11 @@
{
\int_incr:N \c@rownum
\int_zero:N \c@colnum
+ \__tblr_update_rowsep_registers:
\tl_set:Nx \l__tblr_h_tl
- { \__tblr_data_item:nen { row } { \int_use:N \c@rownum } { height } }
- \tl_if_empty:NF \l__tblr_h_tl
+ { \__tblr_data_item:nen { row } { \int_use:N \c@rownum } { height } }
+ %% We didn't initialize row heights with -1pt
+ \dim_compare:nNnF { \l__tblr_h_tl } = { 0pt }
{
\__tblr_data_gput:nenV { row } { \int_use:N \c@rownum }
{ @row-height } \l__tblr_h_tl
@@ -2903,6 +3156,7 @@
\int_step_inline:nn { \c@colcount }
{
\int_incr:N \c@colnum
+ \__tblr_update_colsep_registers:
\__tblr_measure_cell_update_sizes:nnNNNN
{ \int_use:N \c@rownum }
{ \int_use:N \c@colnum }
@@ -2912,6 +3166,31 @@
\g__tblr_cell_foot_dim
}
}
+ \int_step_inline:nn { \c@colcount }
+ {
+ \tl_set:Nx \l__tblr_w_tl
+ { \__tblr_data_item:nen { column } {##1} { width } }
+ \dim_compare:nNnF { \l__tblr_w_tl } < { 0pt }
+ {
+ \__tblr_data_gput:nenV { column } {##1} { @col-width } \l__tblr_w_tl
+ }
+ }
+ }
+
+\cs_new_protected:Npn \__tblr_update_rowsep_registers:
+ {
+ \dim_set:Nn \abovesep
+ { \__tblr_data_item:nen { row } { \int_use:N \c@rownum } { abovesep } }
+ \dim_set:Nn \belowsep
+ { \__tblr_data_item:nen { row } { \int_use:N \c@rownum } { belowsep } }
+ }
+
+\cs_new_protected:Npn \__tblr_update_colsep_registers:
+ {
+ \dim_set:Nn \leftsep
+ { \__tblr_data_item:nen { column } { \int_use:N \c@colnum } { leftsep } }
+ \dim_set:Nn \rightsep
+ { \__tblr_data_item:nen { column } { \int_use:N \c@colnum } { rightsep } }
}
%% Measure and update natural dimensions of the row/column/cell
@@ -2945,7 +3224,8 @@
\cs_new_protected:Npn \__tblr_get_cell_text_real:nn #1 #2
{
\group_begin:
- \tl_set:Nx \l__tblr_c_tl { \__tblr_text_item:ne { text } {[#1][#2]} }
+ \tl_set:Nx \l__tblr_c_tl { \__tblr_spec_item:ne { text } {[#1][#2]} }
+ \tl_set:Nx \l__tblr_f_tl { \__tblr_data_item:neen { cell } {#1} {#2} { font } }
\tl_set:Nx \l__tblr_w_tl
{ \__tblr_data_item:neen { cell } {#1} {#2} { width } }
\dim_compare:nNnT { \l__tblr_w_tl } < { 0pt } % cell width unset
@@ -2972,12 +3252,13 @@
\seq_map_variable:NNn \l_tmpa_seq \l_tmpa_tl
{
\__tblr_remove_braces:N \l_tmpa_tl
- \hbox_set:Nn \l_tmpa_box { \l_tmpa_tl }
+ \hbox_set:Nn \l_tmpa_box { \l__tblr_f_tl \l_tmpa_tl }
\tl_set:Nx \l__tblr_w_tl
{ \dim_max:nn { \l__tblr_w_tl } { \box_wd:N \l_tmpa_box } }
}
}
}
+ \tl_put_left:NV \l__tblr_c_tl \l__tblr_f_tl
\__tblr_get_vcell_and_sizes:NN \l__tblr_c_tl \l__tblr_w_tl
\group_end:
}
@@ -3029,16 +3310,13 @@
\group_end:
}
-\cs_new_eq:NN \__tlbr_halign_l: \raggedright
-\cs_new_eq:NN \__tlbr_halign_c: \centering
-\cs_new_eq:NN \__tlbr_halign_r: \raggedleft
-
%% #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
{
\dim_set:Nn \tex_hsize:D { #2 }
\@arrayparboxrestore
- \cs:w __tlbr_halign_ \g__tblr_cell_halign_tl : \cs_end:
+ \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 }
@@ -3238,7 +3516,7 @@
\cs_new_protected:Npn \__tblr_collect_extendable_column_width:
{
- \tl_set:Nx \l_tmpa_tl { \__tblr_prop_item:nn {table} {width} }
+ \tl_set:Nx \l_tmpa_tl { \__tblr_prop_item:nn { inner } { width } }
\tl_if_empty:NTF \l_tmpa_tl
{ \dim_set_eq:NN \l__column_target_dim \linewidth }
{ \dim_set:Nn \l__column_target_dim { \l_tmpa_tl } }
@@ -3271,7 +3549,7 @@
}
{ \dim_sub:Nn \l__column_target_dim { \l__tblr_a_tl } }
\tl_set:Nx \l__tblr_a_tl
- { \__tblr_text_item:ne { vline } { [\l__tblr_j_tl] / @vline-width } }
+ { \__tblr_spec_item:ne { vline } { [\l__tblr_j_tl] / @vline-width } }
\tl_set:Nx \l__tblr_b_tl
{ \__tblr_data_item:nen { column } { \l__tblr_j_tl } { leftsep } }
\tl_set:Nx \l__tblr_c_tl
@@ -3281,7 +3559,7 @@
}
\tl_set:Nx \l__tblr_a_tl
{
- \__tblr_text_item:ne { vline }
+ \__tblr_spec_item:ne { vline }
{ [\int_eval:n {\c@colcount + 1}] / @vline-width }
}
\tl_if_empty:NF \l__tblr_a_tl
@@ -3378,11 +3656,11 @@
\cs_new_protected:Npn \__tblr_adjust_sizes_for_span_cells:
{
- \__tblr_prop_if_in:nnT {table} {colspan}
+ \__tblr_prop_if_in:nnT { inner } { colspan }
{
\__tblr_collect_column_widths_skips:
\str_if_eq:xnTF
- { \__tblr_prop_item:ne {table} {hspan} } {minimal}
+ { \__tblr_prop_item:ne { inner } { hspan } } { minimal }
{
\__tblr_set_span_widths_from_column_widths:
}
@@ -3393,12 +3671,12 @@
\LogTblrTracing { column }
\__tblr_calculate_cell_sizes:
}
- \__tblr_prop_if_in:nnT {table} {rowspan}
+ \__tblr_prop_if_in:nnT { inner } { rowspan }
{
\__tblr_collect_row_heights_skips:
\__tblr_collect_span_heights:
\__tblr_set_row_heights_from_span_heights:
- \LogTblrTracing {row}
+ \LogTblrTracing { row }
}
}
@@ -3421,7 +3699,7 @@
\__tblr_data_item:nen { column }
{ \int_eval:n { \l__tblr_j_tl - 1 } } { rightsep }
+
- \__tblr_text_item:ne { vline }
+ \__tblr_spec_item:ne { vline }
{ [\l__tblr_j_tl] / @vline-width }
+
\__tblr_data_item:nen { column } { \l__tblr_j_tl } { leftsep }
@@ -3453,7 +3731,7 @@
\__tblr_data_item:nen { row }
{ \int_eval:n {\l__tblr_i_tl - 1} } { belowsep }
+
- \__tblr_text_item:ne { hline }
+ \__tblr_spec_item:ne { hline }
{ [\l__tblr_i_tl] / @hline-height }
+
\__tblr_data_item:nen { row } { \l__tblr_i_tl } { abovesep }
@@ -3585,27 +3863,49 @@
%% Compute and set column widths from span widths
\cs_new_protected:Npn \__tblr_set_column_widths_from_span_widths:
{
- \__tblr_calc_item_sizes_from_span_sizes:xNN
- { \int_use:N \c@colcount }
- \l__tblr_col_item_skip_size_prop
- \l__tblr_col_span_size_prop
+ \str_if_eq:xnTF
+ { \__tblr_prop_item:ne { inner } { hspan } }
+ { even }
+ {
+ \__tblr_distribute_span_sizes_even:xNN
+ { \int_use:N \c@colcount }
+ \l__tblr_col_item_skip_size_prop
+ \l__tblr_col_span_size_prop
+ }
+ {
+ \__tblr_distribute_span_sizes_default:xNN
+ { \int_use:N \c@colcount }
+ \l__tblr_col_item_skip_size_prop
+ \l__tblr_col_span_size_prop
+ }
\__tblr_set_all_column_widths:
}
%% Compute and set row heights from span heights
\cs_new_protected:Npn \__tblr_set_row_heights_from_span_heights:
{
- \__tblr_calc_item_sizes_from_span_sizes:xNN
- { \int_use:N \c@rowcount }
- \l__tblr_row_item_skip_size_prop
- \l__tblr_row_span_size_prop
+ \str_if_eq:xnTF
+ { \__tblr_prop_item:ne { inner } { vspan } }
+ { even }
+ {
+ \__tblr_distribute_span_sizes_even:nNN
+ { \int_use:N \c@rowcount }
+ \l__tblr_row_item_skip_size_prop
+ \l__tblr_row_span_size_prop
+ }
+ {
+ \__tblr_distribute_span_sizes_default:xNN
+ { \int_use:N \c@rowcount }
+ \l__tblr_row_item_skip_size_prop
+ \l__tblr_row_span_size_prop
+ }
\__tblr_set_all_row_heights:
}
%% See page 245 in Chapter 22 of TeXbook
%% #1: total number of items
%% #2: prop list with item sizes and skip sizes; #3: prop list with span sizes
-\cs_new_protected:Npn \__tblr_calc_item_sizes_from_span_sizes:nNN #1 #2 #3
+\cs_new_protected:Npn \__tblr_distribute_span_sizes_default:nNN #1 #2 #3
{
\int_step_variable:nNn { #1 } \l__tblr_j_tl
{
@@ -3656,14 +3956,60 @@
}
\__tblr_do_if_tracing:nn { cellspan } { \prop_log:N #2 }
}
-\cs_generate_variant:Nn \__tblr_calc_item_sizes_from_span_sizes:nNN { x }
+\cs_generate_variant:Nn \__tblr_distribute_span_sizes_default:nNN { x }
+
+%% #1: total number of items
+%% #2: prop list with item sizes and skip sizes; #3: prop list with span sizes
+\cs_new_protected:Npn \__tblr_distribute_span_sizes_even:nNN #1 #2 #3
+ {
+ \prop_clear:N \l_tmpa_prop
+ \prop_map_inline:Nn #3
+ {
+ \__tblr_get_span_from_to:w ##1
+ \dim_set:Nn \l_tmpa_dim {##2}
+ \dim_sub:Nn \l_tmpa_dim { \prop_item:Ne #2 { item[\l__tblr_a_tl] } }
+ \int_step_inline:nnn { \l__tblr_a_tl + 1 } { \l__tblr_b_tl }
+ {
+ \dim_sub:Nn \l_tmpa_dim
+ {
+ \prop_item:Ne #2 { skip[####1] } + \prop_item:Nn #2 { item[####1] }
+ }
+ }
+ \__tblr_do_if_tracing:nn { cellspan }
+ {
+ \tl_log:x { \l__tblr_a_tl -> \l__tblr_b_tl : ~ \dim_use:N \l_tmpa_dim }
+ }
+ \dim_compare:nNnT {\l_tmpa_dim} > {0pt}
+ {
+ \tl_set:Nx \l_tmpa_tl
+ { \dim_eval:n { \l_tmpa_dim / (\l__tblr_b_tl - \l__tblr_a_tl + 1) } }
+ \int_step_inline:nnn { \l__tblr_a_tl } { \l__tblr_b_tl }
+ {
+ \__tblr_put_if_larger:NnV \l_tmpa_prop {####1} \l_tmpa_tl
+ }
+ }
+ }
+ \__tblr_do_if_tracing:nn { cellspan } { \prop_log:N \l_tmpa_prop }
+ \prop_map_inline:Nn \l_tmpa_prop
+ {
+ \__tblr_add_dimen_value:Nnn #2 {item[##1]} {##2}
+ }
+ \__tblr_do_if_tracing:nn { cellspan } { \prop_log:N #2 }
+ }
+\cs_generate_variant:Nn \__tblr_distribute_span_sizes_even:nNN { x }
+
+\cs_new_protected:Npn \__tblr_get_span_from_to:w (#1-#2)
+ {
+ \tl_set:Nn \l__tblr_a_tl {#1}
+ \tl_set:Nn \l__tblr_b_tl {#2}
+ }
\cs_new_protected:Npn \__tblr_set_all_column_widths:
{
\int_step_variable:nNn { \c@colcount } \l__tblr_j_tl
{
\__tblr_data_gput:nene { column }
- { \l__tblr_j_tl } { @col-width }
+ { \l__tblr_j_tl } { width }
{ \prop_item:Ne \l__tblr_col_item_skip_size_prop { item[\l__tblr_j_tl] } }
}
}
@@ -3690,12 +4036,6 @@
}
}
-\cs_new_protected:Npn \__tblr_get_span_key_row_col:w [#1][#2]
- {
- \tl_set:Nn \l__tblr_i_tl {#1}
- \tl_set:Nn \l__tblr_j_tl {#2}
- }
-
%% Compute and set span widths from column widths
\cs_new_protected:Npn \__tblr_set_span_widths_from_column_widths:
{
@@ -3738,71 +4078,912 @@
\cs_generate_variant:Nn \__tblr_calc_span_widths:nnN { xxN }
%%% --------------------------------------------------------
-%% \section{Build the Whole Table}
+%%> \section{Header and Footer Styles}
%%% --------------------------------------------------------
-\tl_new:N \__tlbr_vbox_align_tl
-\tl_const:Nn \__tlbr_vbox_t_tl {t}
-\tl_const:Nn \__tlbr_vbox_m_tl {m}
-\tl_const:Nn \__tlbr_vbox_c_tl {c}
-\tl_const:Nn \__tlbr_vbox_b_tl {b}
+\prop_new:N \l__tblr_element_styles_prop
-\box_new:N \l__tblr_table_box
+\cs_new_protected:Npn \__tblr_style_put:nn #1 #2
+ {
+ \prop_put:Nnn \l__tblr_element_styles_prop {#1} {#2}
+ }
+\cs_generate_variant:Nn \__tblr_style_put:nn { nV, ne, en }
-%% #1: table alignment
-\cs_new_protected:Npn \__tblr_build_whole:n #1
+\cs_new:Npn \__tblr_style_item:n #1
+ {
+ \prop_item:Nn \l__tblr_element_styles_prop {#1}
+ }
+
+\cs_new_protected:Npn \__tblr_style_log:
+ {
+ \prop_log:N \l__tblr_element_styles_prop
+ }
+
+\tl_new:N \l__tblr_element_name_tl
+\tl_new:N \l__tblr_element_styles_tl
+
+%% #1: list of element names; #2: element styles
+\NewDocumentCommand \SetTblrStyle { m +m }
+ {
+ \tl_set:Nn \l__tblr_element_styles_tl {#2}
+ \keys_set:nn { tblr-element } {#1}
+ \ignorespaces
+ }
+
+\keys_define:nn { tblr-element }
+ {
+ head .meta:n = { firsthead, middlehead, lasthead },
+ foot .meta:n = { firstfoot, middlefoot, lastfoot },
+ unknown .code:n = \__tblr_set_element_styles:V \l_keys_key_str,
+ }
+
+\cs_new_protected:Npn \__tblr_set_element_styles:n #1
+ {
+ \tl_set:Nn \l__tblr_element_name_tl {#1}
+ \keys_set:nV { tblr-style } \l__tblr_element_styles_tl
+ }
+\cs_generate_variant:Nn \__tblr_set_element_styles:n { V }
+
+\keys_define:nn { tblr-style }
+ {
+ halign .code:n = \__tblr_element_gput_style:nn { halign } {#1},
+ l .meta:n = { halign = l },
+ c .meta:n = { halign = c },
+ r .meta:n = { halign = r },
+ fg .code:n = \__tblr_element_gput_style:nn { fg } {#1},
+ font .code:n = \__tblr_element_gput_style:nn { font } {#1},
+ hang .code:n = \__tblr_element_gput_style:nn { hang } {#1},
+ indent .code:n = \__tblr_element_gput_style:nn { indent } {#1},
+ unknown .code:n = \__tblr_element_unknown_key:Vn \l_keys_key_str {#1},
+ }
+
+\cs_new_protected:Npn \__tblr_element_gput_style:nn #1 #2
+ {
+ \__tblr_style_put:en { \l__tblr_element_name_tl / #1 } {#2}
+ }
+
+\cs_new_protected:Npn \__tblr_element_unknown_key:nn #1 #2
+ {
+ \regex_match:NnTF \c__tblr_is_color_key_regex {#1}
+ { \__tblr_style_put:en { \l__tblr_element_name_tl / fg } {#1} }
+ {
+ %% unknown key name has been changed to string in \l_keys_key_str
+ \tl_set_rescan:Nnn \l__tblr_f_tl {} {#1}
+ \tl_if_head_eq_catcode:VNTF \l__tblr_f_tl \scan_stop:
+ {
+ \__tblr_style_put:en { \l__tblr_element_name_tl / font } \l__tblr_f_tl
+ }
+ {
+ \__tblr_style_put:en { \l__tblr_element_name_tl / #1 } {#2}
+ }
+ }
+ }
+\cs_generate_variant:Nn \__tblr_element_unknown_key:nn { Vn }
+
+%%% --------------------------------------------------------
+%%> \section{Helper Functions for Templates}
+%%% --------------------------------------------------------
+
+\tl_new:N \l__tblr_template_name_tl
+\tl_new:N \l__tblr_template_code_tl
+
+\keys_define:nn { tblr-def-template }
+ {
+ unknown .code:n = \__tblr_def_template:V \l_keys_key_str,
+ }
+
+%% #1: head/foot element; #2: template name; #3: template code
+%% If the template name = default, we enable the template at once
+%% Otherwise, we may enable the template by using \SetTblrTemplate command
+\NewDocumentCommand \DefTblrTemplate { m m +m }
+ {
+ \tl_set:Nn \l__tblr_template_name_tl {#2}
+ \tl_set:Nn \l__tblr_template_code_tl {#3}
+ \keys_set:nn { tblr-def-template } {#1}
+ \ignorespaces
+ }
+
+\cs_new_protected:Npn \__tblr_def_template:n #1
+ {
+ \tl_set_eq:cN { l__tblr_template_ #1 _ \l__tblr_template_name_tl _tl }
+ \l__tblr_template_code_tl
+ }
+\cs_generate_variant:Nn \__tblr_def_template:n { V }
+
+\keys_define:nn { tblr-set-template }
+ {
+ unknown .code:n = \__tblr_set_template:V \l_keys_key_str,
+ }
+
+%% #1: head/foot element; #2: template name
+\NewDocumentCommand \SetTblrTemplate { m m }
+ {
+ \tl_set:Nn \l__tblr_template_name_tl {#2}
+ \keys_set:nn { tblr-set-template } {#1}
+ \ignorespaces
+ }
+
+\cs_new_protected:Npn \__tblr_set_template:n #1
+ {
+ \tl_set_eq:cc { l__tblr_template_ #1 _default_tl }
+ { l__tblr_template_ #1 _ \l__tblr_template_name_tl _tl }
+ }
+\cs_generate_variant:Nn \__tblr_set_template:n { V }
+
+\NewExpandableDocumentCommand \GetTblrStyle { m m }
+ {
+ \__tblr_style_item:n { #1 / #2 }
+ }
+
+\NewDocumentCommand \UseTblrFont { m }
+ {
+ \GetTblrStyle {#1} { font } \selectfont
+ }
+
+\tl_new:N \l__tblr_use_color_tl
+
+\NewDocumentCommand \UseTblrColor { m }
+ {
+ \tl_set:Nx \l__tblr_use_color_tl { \GetTblrStyle {#1} { fg } }
+ \tl_if_empty:NF \l__tblr_use_color_tl { \color { \l__tblr_use_color_tl } }
+ }
+
+%% All halign commands are defined at the beginning of the file
+\NewDocumentCommand \UseTblrAlign { m }
+ {
+ \use:c { __tblr_halign_command_ \GetTblrStyle {#1} { halign } : }
+ }
+
+\tl_new:N \l__tblr_use_hang_tl
+
+\NewDocumentCommand \UseTblrHang { m }
+ {
+ \tl_set:Nx \l__tblr_use_hang_tl { \GetTblrStyle {#1} { hang } }
+ \tl_if_empty:NF \l__tblr_use_hang_tl
+ {
+ \tl_put_left:Nn \l__tblr_use_hang_tl
+ { \hangafter = 1 \relax \hangindent = }
+ \tl_put_right:Nn \l__tblr_use_hang_tl { \relax }
+ \exp_args:NV \everypar \l__tblr_use_hang_tl
+ }
+ }
+
+\tl_new:N \l__tblr_use_indent_tl
+
+\NewDocumentCommand \UseTblrIndent { m }
+ {
+ \tl_set:Nx \l__tblr_use_indent_tl { \GetTblrStyle {#1} { indent } }
+ \tl_if_empty:NF \l__tblr_use_indent_tl
+ { \exp_args:NNV \setlength \parindent \l__tblr_use_indent_tl }
+ }
+
+\AtBeginDocument
+ {
+ \@ifpackageloaded{xcolor}{}{\RenewDocumentCommand \UseTblrColor {m} {}}
+ }
+
+%% #1: head/foot element; #2: template name
+\NewExpandableDocumentCommand \ExpTblrTemplate { m m }
+ {
+ \tl_use:c { l__tblr_template_ #1 _ #2 _tl }
+ }
+
+%% #1: head/foot element; #2: template name
+\NewDocumentCommand \UseTblrTemplate { m m }
+ {
+ \group_begin:
+ \UseTblrFont {#1}
+ \UseTblrColor {#1}
+ \tl_use:c { l__tblr_template_ #1 _ #2 _tl }
+ \group_end:
+ }
+
+\NewDocumentCommand \MapTblrNotes { +m }
+ {
+ \__tblr_prop_map_inline:nn { note }
+ {
+ \tl_set_rescan:Nnn \InsertTblrNoteTag {} {##1}
+ \tl_set:Nn \InsertTblrNoteText {##2}
+ #1
+ }
+ }
+
+\NewDocumentCommand \MapTblrRemarks { +m }
+ {
+ \__tblr_prop_map_inline:nn { remark }
+ {
+ \tl_set_rescan:Nnn \InsertTblrRemarkTag {} {##1}
+ \tl_set:Nn \InsertTblrRemarkText {##2}
+ #1
+ }
+ }
+
+\NewExpandableDocumentCommand \InsertTblrText { m }
+ {
+ \__tblr_spec_item:nn { outer } {#1}
+ }
+
+\NewExpandableDocumentCommand \InsertTblrMore { m }
+ {
+ \__tblr_prop_item:nn { more } {#1}
+ }
+
+%%% --------------------------------------------------------
+%%> \section{Table Continuation Templates}
+%%% --------------------------------------------------------
+
+\DefTblrTemplate { contfoot-text } { normal } { Continued ~ on ~ next ~ page }
+\SetTblrTemplate { contfoot-text } { normal }
+
+\DefTblrTemplate { contfoot } { plain }
+ {
+ \noindent
+ \raggedleft
+ \UseTblrTemplate { contfoot-text } { default }
+ \par
+ }
+\DefTblrTemplate { contfoot } { normal }
+ {
+ %% need to set parindent after alignment
+ \raggedleft
+ \UseTblrAlign { contfoot }
+ \UseTblrIndent { contfoot }
+ \UseTblrHang { contfoot }
+ \leavevmode
+ \UseTblrTemplate { contfoot-text } { default }
+ \par
+ }
+\SetTblrTemplate { contfoot } { normal }
+
+\DefTblrTemplate { conthead-text } { normal } { ( Continued ) }
+\SetTblrTemplate { conthead-text } { normal }
+
+\DefTblrTemplate { conthead } { plain }
+ {
+ \noindent
+ \raggedright
+ \UseTblrTemplate { conthead-text } { default }
+ \par
+ }
+\DefTblrTemplate { conthead } { normal }
+ {
+ %% need to set parindent after alignment
+ \raggedright
+ \UseTblrAlign { conthead }
+ \UseTblrIndent { conthead }
+ \UseTblrHang { conthead }
+ \leavevmode
+ \UseTblrTemplate { conthead-text } { default }
+ \par
+ }
+\SetTblrTemplate { conthead } { normal }
+
+%%% --------------------------------------------------------
+%%> \section{Table Caption Templates}
+%%% --------------------------------------------------------
+
+\tl_new:N \l__tblr_caption_short_tl
+
+\DefTblrTemplate { caption-lot } { normal }
{
- \bool_if:NTF \l__tblr_long_table_bool
- { \__tblr_build_long_table:n {#1} }
- { \__tblr_build_short_table:n {#1} }
+ \tl_set:Nx \l__tblr_caption_short_tl { \InsertTblrText { entry } }
+ \tl_if_empty:NT \l__tblr_caption_short_tl
+ { \tl_set:Nx \l__tblr_caption_short_tl { \InsertTblrText { caption } } }
+ \addcontentsline { lot } { table }
+ { \protect\numberline { \arabic { table } } { \l__tblr_caption_short_tl } }
+ }
+\SetTblrTemplate { caption-lot } { normal }
+
+%% We need to use \hspace and \enskip, but not ~ or \space,
+%% since we want a correct hangindent caption paragraph.
+
+\DefTblrTemplate { caption-tag } { normal } { Table \hspace{0.25em} \thetable }
+\SetTblrTemplate { caption-tag } { normal }
+
+\DefTblrTemplate { caption-sep } { normal } { : \enskip }
+\SetTblrTemplate { caption-sep } { normal }
+
+\DefTblrTemplate { caption-text } { normal } { \InsertTblrText { caption } }
+\SetTblrTemplate { caption-text } { normal }
+
+\box_new:N \l__tblr_caption_box
+\box_new:N \l__tblr_caption_left_box
+
+\DefTblrTemplate { caption } { plain }
+ {
+ \hbox_set:Nn \l__tblr_caption_box
+ {
+ \UseTblrTemplate { caption-tag } { default }
+ \UseTblrTemplate { caption-sep } { default }
+ \UseTblrTemplate { caption-text } { default }
+ }
+ \dim_compare:nNnTF { \box_wd:N \l__tblr_caption_box } > { \hsize }
+ {
+ \noindent
+ \hbox_unpack:N \l__tblr_caption_box
+ \par
+ }
+ {
+ \centering
+ \makebox [\hsize] [c] { \box_use:N \l__tblr_caption_box }
+ \par
+ }
+ }
+\DefTblrTemplate { caption } { normal }
+ {
+ \hbox_set:Nn \l__tblr_caption_box
+ {
+ \UseTblrTemplate { caption-tag } { default }
+ \UseTblrTemplate { caption-sep } { default }
+ \UseTblrTemplate { caption-text } { default }
+ }
+ \dim_compare:nNnTF { \box_wd:N \l__tblr_caption_box } > { \hsize }
+ {
+ \UseTblrAlign { caption }
+ \UseTblrIndent { caption }
+ \hbox_set:Nn \l__tblr_caption_left_box
+ {
+ \UseTblrTemplate { caption-tag } { default }
+ \UseTblrTemplate { caption-sep } { default }
+ }
+ \hangindent = \box_wd:N \l__tblr_caption_left_box
+ \hangafter = 1
+ \UseTblrHang { caption }
+ \leavevmode
+ \hbox_unpack:N \l__tblr_caption_box
+ \par
+ }
+ {
+ \centering
+ \makebox [\hsize] [c] { \box_use:N \l__tblr_caption_box }
+ \par
+ }
+ }
+\SetTblrTemplate { caption } { normal }
+
+\DefTblrTemplate { capcont } { plain }
+ {
+ \hbox_set:Nn \l__tblr_caption_box
+ {
+ \UseTblrTemplate { caption-tag } { default }
+ \UseTblrTemplate { caption-sep } { default }
+ \UseTblrTemplate { caption-text } { default }
+ \space
+ \UseTblrTemplate { conthead-text } { default }
+ }
+ \dim_compare:nNnTF { \box_wd:N \l__tblr_caption_box } > { \hsize }
+ {
+ \noindent
+ \hbox_unpack:N \l__tblr_caption_box
+ \par
+ }
+ {
+ \centering
+ \makebox [\hsize] [c] { \box_use:N \l__tblr_caption_box }
+ \par
+ }
+ }
+\DefTblrTemplate { capcont } { normal }
+ {
+ \hbox_set:Nn \l__tblr_caption_box
+ {
+ \UseTblrTemplate { caption-tag } { default }
+ \UseTblrTemplate { caption-sep } { default }
+ \UseTblrTemplate { caption-text } { default }
+ \space
+ \UseTblrTemplate { conthead-text } { default }
+ }
+ \dim_compare:nNnTF { \box_wd:N \l__tblr_caption_box } > { \hsize }
+ {
+ \UseTblrAlign { capcont }
+ \UseTblrIndent { capcont }
+ \hbox_set:Nn \l__tblr_caption_left_box
+ {
+ \UseTblrTemplate { caption-tag } { default }
+ \UseTblrTemplate { caption-sep } { default }
+ }
+ \hangindent = \box_wd:N \l__tblr_caption_left_box
+ \hangafter = 1
+ \UseTblrHang { capcont }
+ \leavevmode
+ \hbox_unpack:N \l__tblr_caption_box
+ \par
+ }
+ {
+ \centering
+ \makebox [\hsize] [c] { \box_use:N \l__tblr_caption_box }
+ \par
+ }
+ }
+\SetTblrTemplate { capcont} { normal }
+
+%%% --------------------------------------------------------
+%%> \section{Table Notes Templates}
+%%% --------------------------------------------------------
+
+%% By default the targets generated by \hypertarget are too low
+%% Therefore we need to use \Hy@raisedlink command to fix this problem
+%% See https://tex.stackexchange.com/questions/17057
+%% We also use \use:c in case the private command \Hy@raisedlink is removed
+\cs_new_protected:Npn \__tblr_hyper_target:n #1
+ {
+ \cs_if_exist:NT \hypertarget
+ {
+ \use:c { Hy@raisedlink }
+ {
+ \hypertarget
+ { tblr / \int_use:N \g__tblr_table_count_int / \tl_to_str:n {#1} }
+ { }
+ }
+ }
+ }
+\cs_generate_variant:Nn \__tblr_hyper_target:n { V }
+
+\cs_new_protected:Npn \__tblr_hyper_link:nn #1 #2
+ {
+ \cs_if_exist:NTF \hyperlink
+ {
+ \hyperlink
+ { tblr / \int_use:N \g__tblr_table_count_int / \tl_to_str:n {#1} }
+ { #2 }
+ }
+ { #2 }
+ }
+
+\NewDocumentCommand \TblrNote { m }
+ {
+ \__tblr_hyper_link:nn {#1}
+ { \textsuperscript { \sffamily \UseTblrFont { note-tag } #1 } }
+ }
+
+\DefTblrTemplate { note-tag } { normal }
+ {
+ \textsuperscript { \sffamily \UseTblrFont { note-tag } \InsertTblrNoteTag }
+ }
+\SetTblrTemplate { note-tag } { normal }
+
+\DefTblrTemplate { note-target } { normal }
+ {
+ \__tblr_hyper_target:V \InsertTblrNoteTag
+ }
+\SetTblrTemplate { note-target } { normal }
+
+\DefTblrTemplate { note-sep } { normal } { \space }
+\SetTblrTemplate { note-sep } { normal }
+
+\DefTblrTemplate { note-text } { normal } { \InsertTblrNoteText }
+\SetTblrTemplate { note-text } { normal }
+
+\DefTblrTemplate { note } { plain }
+ {
+ \MapTblrNotes
+ {
+ \noindent
+ \UseTblrTemplate { note-tag } { default }
+ \UseTblrTemplate { note-target } { default }
+ \UseTblrTemplate { note-sep } { default }
+ \UseTblrTemplate { note-text } { default }
+ \par
+ }
+ }
+\DefTblrTemplate { note } { normal }
+ {
+ \UseTblrAlign { note }
+ \UseTblrIndent { note }
+ \MapTblrNotes
+ {
+ \hangindent = 0.7em
+ \hangafter = 1
+ \UseTblrHang { note }
+ \leavevmode
+ \hbox_to_wd:nn { \the\hangindent }
+ {
+ \UseTblrTemplate { note-tag } { default }
+ \UseTblrTemplate { note-target } { default }
+ \hfil
+ }
+ \UseTblrTemplate { note-text } { default }
+ \par
+ }
+ }
+\DefTblrTemplate { note } { inline }
+ {
+ \UseTblrAlign { note }
+ \UseTblrIndent { note }
+ \UseTblrHang { note }
+ \leavevmode
+ \MapTblrNotes
+ {
+ \UseTblrTemplate { note-tag } { default }
+ \UseTblrTemplate { note-target } { default }
+ \UseTblrTemplate { note-sep } { default }
+ \UseTblrTemplate { note-text } { default }
+ \quad
+ }
+ \par
+ }
+\SetTblrTemplate { note } { normal }
+
+%%% --------------------------------------------------------
+%%> \section{Table Remarks Templates}
+%%% --------------------------------------------------------
+
+\DefTblrTemplate { remark-tag } { normal }
+ {
+ \itshape \UseTblrFont { remark-tag } \InsertTblrRemarkTag
+ }
+\SetTblrTemplate { remark-tag } { normal }
+
+\DefTblrTemplate { remark-sep } { normal } { : \space }
+\SetTblrTemplate { remark-sep } { normal }
+
+\DefTblrTemplate { remark-text } { normal } { \InsertTblrRemarkText }
+\SetTblrTemplate { remark-text } { normal }
+
+\DefTblrTemplate { remark } { plain }
+ {
+ \MapTblrRemarks
+ {
+ \noindent
+ \UseTblrTemplate { remark-tag } { default }
+ \UseTblrTemplate { remark-sep } { default }
+ \UseTblrTemplate { remark-text } { default }
+ \par
+ }
+ }
+\DefTblrTemplate { remark } { normal }
+ {
+ \UseTblrAlign { remark }
+ \UseTblrIndent { remark }
+ \MapTblrRemarks
+ {
+ \hangindent = 0.7em
+ \hangafter = 1
+ \UseTblrHang { remark }
+ \leavevmode
+ \UseTblrTemplate { remark-tag } { default }
+ \UseTblrTemplate { remark-sep } { default }
+ \UseTblrTemplate { remark-text } { default }
+ \par
+ }
+ }
+\DefTblrTemplate { remark } { inline }
+ {
+ \UseTblrAlign { remark }
+ \UseTblrIndent { remark }
+ \UseTblrHang { remark }
+ \leavevmode
+ \MapTblrRemarks
+ {
+ \UseTblrTemplate { remark-tag } { default }
+ \UseTblrTemplate { remark-sep } { default }
+ \UseTblrTemplate { remark-text } { default }
+ \quad
+ }
+ \par
+ }
+\SetTblrTemplate { remark } { normal }
+
+%%% --------------------------------------------------------
+%%> \section{Header and Footer Templates}
+%%% --------------------------------------------------------
+
+\tl_new:N \g__tblr_template_firsthead_default_tl
+\tl_new:N \g__tblr_template_middlehead_default_tl
+\tl_new:N \g__tblr_template_lasthead_default_tl
+\tl_new:N \g__tblr_template_firstfoot_default_tl
+\tl_new:N \g__tblr_template_middlefoot_default_tl
+\tl_new:N \g__tblr_template_lastfoot_default_tl
+
+\keys_define:nn { tblr-def-template }
+ {
+ head .meta:n = { firsthead, middlehead, lasthead },
+ foot .meta:n = { firstfoot, middlefoot, lastfoot },
+ }
+
+\keys_define:nn { tblr-set-template }
+ {
+ head .meta:n = { firsthead, middlehead, lasthead },
+ foot .meta:n = { firstfoot, middlefoot, lastfoot },
+ }
+
+\DefTblrTemplate { firsthead } { normal }
+ {
+ \UseTblrTemplate { caption } { default }
+ \UseTblrTemplate { caption-lot } { default }
+ }
+
+\DefTblrTemplate { middlehead, lasthead } { normal }
+ {
+ \UseTblrTemplate { capcont } { default }
+ }
+
+\DefTblrTemplate { firstfoot, middlefoot } { normal }
+ {
+ \UseTblrTemplate { contfoot } { default }
+ }
+
+\DefTblrTemplate { lastfoot } { normal }
+ {
+ \UseTblrTemplate { note } { default }
+ \UseTblrTemplate { remark } { default }
+ }
+
+\SetTblrTemplate { head } { normal }
+\SetTblrTemplate { foot } { normal }
+
+%%% --------------------------------------------------------
+%%> \section{Build the Whole Table}
+%%% --------------------------------------------------------
+
+\cs_new:Npn \__tblr_box_height:N #1
+ {
+ \dim_eval:n { \box_ht:N #1 + \box_dp:N #1 }
+ }
+
+\cs_new_protected:Npn \__tblr_build_head_foot:
+ {
+ \__tblr_build_row_head_foot:
+ \__tblr_build_table_head_foot:
+ }
+
+\tl_new:N \l__tblr_row_head_tl
+\tl_new:N \l__tblr_row_foot_tl
+\box_new:N \l__tblr_row_head_box
+\box_new:N \l__tblr_row_foot_box
+\dim_new:N \l__tblr_row_head_foot_dim
+
+\cs_new_protected:Npn \__tblr_build_row_head_foot:
+ {
+ %% \l__tblr_row_head_tl and \l__tblr_row_foot_tl may be empty
+ \tl_set:Nx \l__tblr_row_head_tl { \__tblr_prop_item:ne { inner } { rowhead } }
+ \int_compare:nNnTF { \l__tblr_row_head_tl + 0 } > { 0 }
+ { \__tblr_build_one_table:nn {1} { \l__tblr_row_head_tl } }
+ { \__tblr_build_one_hline:n {1} }
+ \box_set_eq:NN \l__tblr_row_head_box \l__tblr_table_box
+ \tl_set:Nx \l__tblr_row_foot_tl { \__tblr_prop_item:ne { inner } { rowfoot } }
+ \int_compare:nNnTF { \l__tblr_row_foot_tl + 0 } > { 0 }
+ {
+ \__tblr_build_one_table:nn
+ { \c@rowcount - \l__tblr_row_foot_tl + 1 } { \c@rowcount }
+ }
+ { \__tblr_build_one_hline:n { \int_eval:n { \c@rowcount + 1 } } }
+ \box_set_eq:NN \l__tblr_row_foot_box \l__tblr_table_box
+ \dim_set:Nn \l__tblr_row_head_foot_dim
+ {
+ \__tblr_box_height:N \l__tblr_row_head_box
+ + \__tblr_box_height:N \l__tblr_row_foot_box
+ }
+ }
+
+\dim_new:N \tablewidth
+
+\cs_new_protected:Npn \__tblr_get_table_width:
+ {
+ \dim_zero:N \tablewidth
+ \int_step_inline:nn { \c@colcount }
+ {
+ \dim_add:Nn \tablewidth
+ {
+ \__tblr_spec_item:nn { vline } { [##1] / @vline-width }
+ +
+ \__tblr_data_item:nnn { column } {##1} { leftsep }
+ +
+ \__tblr_data_item:nnn { column } {##1} { @col-width }
+ +
+ \__tblr_data_item:nnn { column } {##1} { rightsep }
+ }
+ }
+ \dim_add:Nn \tablewidth
+ {
+ \__tblr_spec_item:ne { vline }
+ { [\int_eval:n { \c@colcount + 1 }] / @vline-width }
+ }
+ }
+
+\box_new:N \l__tblr_table_firsthead_box
+\box_new:N \l__tblr_table_middlehead_box
+\box_new:N \l__tblr_table_lasthead_box
+\box_new:N \l__tblr_table_firstfoot_box
+\box_new:N \l__tblr_table_middlefoot_box
+\box_new:N \l__tblr_table_lastfoot_box
+
+\cs_new_protected:Npn \__tblr_build_table_head_foot:
+ {
+ \__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 }
+ \UseTblrTemplate { firsthead } { default }
+ }
+ \__tblr_build_table_head_aux:Nn
+ \l__tblr_table_middlehead_box { \UseTblrTemplate { middlehead } { default } }
+ \__tblr_build_table_head_aux:Nn
+ \l__tblr_table_lasthead_box { \UseTblrTemplate { lasthead } { default } }
+ \__tblr_build_table_foot_aux:Nn
+ \l__tblr_table_firstfoot_box { \UseTblrTemplate { firstfoot } { default } }
+ \__tblr_build_table_foot_aux:Nn
+ \l__tblr_table_middlefoot_box { \UseTblrTemplate { middlefoot } { default } }
+ \__tblr_build_table_foot_aux:Nn
+ \l__tblr_table_lastfoot_box { \UseTblrTemplate { lastfoot } { default } }
+ }
+
+\cs_new_protected:Npn \__tblr_build_table_head_aux:Nn #1 #2
+ {
+ \vbox_set:Nn #1
+ {
+ \hsize = \tablewidth
+ \parindent = 0pt \relax
+ \vbox:n {#2}
+ \skip_vertical:n { \__tblr_spec_item:nn { outer } { headsep } }
+ }
+ }
+
+\cs_new_protected:Npn \__tblr_build_table_foot_aux:Nn #1 #2
+ {
+ \vbox_set:Nn #1
+ {
+ \hsize = \tablewidth
+ \skip_vertical:n { \__tblr_spec_item:nn { outer } { footsep } }
+ \parindent = 0pt \relax
+ \vbox:n {#2}
+ }
+ }
+
+\cs_new_protected:Npn \__tblr_build_whole:
+ {
+ \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 } } }
}
\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_table_page_int
+\bool_new:N \l__tblr_table_page_break_bool
+%% #1: table alignment
+%% For long table, we need to leave hmode first to get correct \pagetotal
+%% Also remove topskip and presep if we are at the beginning of the page
\cs_new_protected:Npn \__tblr_build_long_table:n #1
{
- %\dim_log:N \pagegoal
- %\dim_log:N \pagetotal
- \dim_set:Nn \l__tblr_remain_height_dim { \pagegoal - \pagetotal }
- \tl_set:Nn \l__tblr_long_from_tl {1}
- \int_step_variable:nNn { \c@rowcount } \l__tblr_i_tl
+ \LogTblrTracing { page }
+ \par
+ \LogTblrTracing { page }
+ \dim_compare:nNnTF { \pagegoal } = { \maxdimen }
+ { \hbox{}\kern-\topskip\nobreak }
+ { \skip_vertical:n { \__tblr_spec_item:nn { outer } { presep } } }
+ \LogTblrTracing { page }
+ \nointerlineskip
+ \mode_leave_vertical:
+ \LogTblrTracing { page }
+ \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@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
{
\dim_set:Nn \l_tmpa_dim
{
- \__tblr_text_item:ne { hline } { [\l__tblr_i_tl] / @hline-height }
- +
\__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 }
}
- \dim_compare:nNnTF
- { \l_tmpa_dim } > { \l__tblr_remain_height_dim }
+ \__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
{
- \tl_log:N \l__tblr_i_tl
- \__tblr_build_page_table:nnx {#1}
- { \l__tblr_long_from_tl } { \int_eval:n { \l__tblr_i_tl - 1 } }
+ \__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_build_page_table:nnx {#1}
+ { \l__tblr_long_from_tl } { \int_eval:n { \l__tblr_i_tl - 1 } }
+ \int_incr:N \l__tblr_table_page_int
+ }
\newpage
\hbox{}\kern-\topskip\nobreak
- \leavevmode
- %\dim_log:N \pagegoal
- %\dim_log:N \pagetotal
+ \noindent
+ \LogTblrTracing { page }
\dim_set:Nn \l__tblr_remain_height_dim
- { \pagegoal - \pagetotal - \l_tmpa_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
}
{
\dim_add:Nn \l__tblr_remain_height_dim { -\l_tmpa_dim }
}
}
- \__tblr_build_page_table:nnn {#1} { \l__tblr_long_from_tl } { \c@rowcount }
+ \int_compare:nNnTF { \l__tblr_table_page_int } = {1}
+ {
+ \box_set_eq:NN \l__tblr_table_head_box \l__tblr_table_firsthead_box
+ \box_set_eq:NN \l__tblr_table_foot_box \l__tblr_table_lastfoot_box
+ }
+ {
+ \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 }
+ \skip_vertical:n { \__tblr_spec_item:nn { outer } { postsep } }
+ \hrule height ~ 0pt
}
+\cs_generate_variant:Nn \__tblr_build_long_table:n { e }
+\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
+\dim_new:N \l__tblr_table_head_body_foot_dim
+
+%% #1: remain dimension; #2: row dimension; #3: break page or not
+\cs_new_protected:Npn \__tblr_check_table_page_break:NNN #1 #2 #3
+ {
+ \int_compare:nNnTF { \l__tblr_table_page_int } = {1}
+ {
+ \dim_set:Nn \l__tblr_table_head_body_foot_dim
+ {
+ \__tblr_box_height:N \l__tblr_table_firsthead_box
+ + #2 + \__tblr_box_height:N \l__tblr_table_firstfoot_box
+ }
+ \box_set_eq:NN \l__tblr_table_head_box \l__tblr_table_firsthead_box
+ \dim_compare:nNnTF
+ { \l__tblr_table_head_body_foot_dim } > {#1}
+ {
+ \bool_set_true:N #3
+ \box_set_eq:NN \l__tblr_table_foot_box \l__tblr_table_firstfoot_box
+ }
+ { \bool_set_false:N #3 }
+ }
+ {
+ \dim_set:Nn \l__tblr_table_head_body_foot_dim
+ {
+ \__tblr_box_height:N \l__tblr_table_middlehead_box
+ + #2 + \__tblr_box_height:N \l__tblr_table_middlefoot_box
+ }
+ \box_set_eq:NN \l__tblr_table_head_box \l__tblr_table_middlehead_box
+ \dim_compare:nNnTF
+ { \l__tblr_table_head_body_foot_dim } > {#1}
+ {
+ \bool_set_true:N #3
+ \box_set_eq:NN \l__tblr_table_foot_box \l__tblr_table_middlefoot_box
+ }
+ { \bool_set_false:N #3 }
+ }
+ }
+
+\box_new:N \l__tblr_table_box
+
+%% #1: table alignment; #2: row from; #3: row to
\cs_new_protected:Npn \__tblr_build_page_table:nnn #1 #2 #3
{
+ \bool_set_false:N \l__tblr_build_first_hline_bool
+ \bool_set_false:N \l__tblr_build_last_hline_bool
\__tblr_build_one_table:nn {#2} {#3}
+ \vbox_set:Nn \l__tblr_table_box
+ {
+ \box_use:N \l__tblr_table_head_box
+ \hrule height ~ 0pt
+ \box_use:N \l__tblr_row_head_box
+ \hrule height ~ 0pt
+ \box_use:N \l__tblr_table_box
+ \hrule height ~ 0pt
+ \box_use:N \l__tblr_row_foot_box
+ \hrule height ~ 0pt
+ \box_use:N \l__tblr_table_foot_box
+ }
\__tblr_halign_whole:Nn \l__tblr_table_box #1
}
\cs_generate_variant:Nn \__tblr_build_page_table:nnn { nnx }
@@ -3818,11 +4999,20 @@
}
}
+%% #1: table alignment
+%% For short table, we need to leave vmode first
\cs_new_protected:Npn \__tblr_build_short_table:n #1
{
+ \mode_leave_vertical:
\__tblr_build_one_table:nn {1} {\c@rowcount}
\__tblr_valign_whole:Nn \l__tblr_table_box #1
}
+\cs_generate_variant:Nn \__tblr_build_short_table:n { e }
+
+\bool_new:N \l__tblr_build_first_hline_bool
+\bool_new:N \l__tblr_build_last_hline_bool
+\bool_set_true:N \l__tblr_build_first_hline_bool
+\bool_set_true:N \l__tblr_build_last_hline_bool
%% #1: row from; #2: row to
\cs_new_protected:Npn \__tblr_build_one_table:nn #1 #2
@@ -3831,29 +5021,47 @@
{
\int_step_variable:nnNn {#1} {#2} \l__tblr_i_tl
{
- \hbox:n { \__tblr_build_hline:V \l__tblr_i_tl }
+ \bool_lazy_or:nnT
+ { \int_compare_p:nNn { \l__tblr_i_tl } > {#1} }
+ { \bool_if_p:N \l__tblr_build_first_hline_bool }
+ { \hbox:n { \__tblr_build_hline:V \l__tblr_i_tl } }
\hrule height ~ 0pt % remove lineskip between hlines and rows
\hbox:n { \__tblr_build_row:N \l__tblr_i_tl }
\hrule height ~ 0pt
}
- \hbox:n { \__tblr_build_hline:n { \int_eval:n {#2 + 1} } }
+ \bool_if:NT \l__tblr_build_last_hline_bool
+ { \hbox:n { \__tblr_build_hline:n { \int_eval:n {#2 + 1} } } }
}
+ \bool_set_true:N \l__tblr_build_first_hline_bool
+ \bool_set_true:N \l__tblr_build_last_hline_bool
+ }
+
+%% #1: hline number
+\cs_new_protected:Npn \__tblr_build_one_hline:n #1
+ {
+ \vbox_set:Nn \l__tblr_table_box { \hbox:n { \__tblr_build_hline:n { #1 } } }
}
+\tl_new:N \__tblr_vbox_align_tl
+\tl_const:Nn \__tblr_vbox_t_tl {t}
+\tl_const:Nn \__tblr_vbox_m_tl {m}
+\tl_const:Nn \__tblr_vbox_c_tl {c}
+\tl_const:Nn \__tblr_vbox_b_tl {b}
+
\cs_new_protected:Npn \__tblr_valign_whole:Nn #1 #2
{
\group_begin:
- \tl_set:Nn \__tlbr_vbox_align_tl {#2}
+ \tl_set:Nn \__tblr_vbox_align_tl {#2}
\dim_set:Nn \l__tblr_t_dim { \box_ht:N #1 + \box_dp:N #1 }
- \tl_case:NnF \__tlbr_vbox_align_tl
+ \tl_case:NnF \__tblr_vbox_align_tl
{
- \__tlbr_vbox_m_tl
+ \__tblr_vbox_m_tl
{ \__tblr_valign_whole_middle:N #1 }
- \__tlbr_vbox_c_tl
+ \__tblr_vbox_c_tl
{ \__tblr_valign_whole_middle:N #1 }
- \__tlbr_vbox_t_tl
+ \__tblr_vbox_t_tl
{ \__tblr_valign_whole_top:N #1 }
- \__tlbr_vbox_b_tl
+ \__tblr_vbox_b_tl
{ \__tblr_valign_whole_bottom:N #1 }
}
{ \__tblr_valign_whole_middle:N #1 }
@@ -3868,10 +5076,10 @@
\cs_new_protected:Npn \__tblr_valign_whole_top:N #1
{
\tl_set:Nx \l__tblr_a_tl
- { \__tblr_text_item:ne { hline } { [1] / @hline-height } }
+ { \__tblr_spec_item:ne { hline } { [1] / @hline-height } }
%% Note that \l__tblr_b_tl may be empty
\tl_set:Nx \l__tblr_b_tl
- { \__tblr_prop_item:ne { table } { baseline } }
+ { \__tblr_prop_item:ne { inner } { baseline } }
\bool_lazy_or:nnTF
{ \dim_compare_p:nNn { \l__tblr_a_tl } = { 0pt } }
{ \int_compare_p:nNn { \l__tblr_b_tl + 0 } = { 1 } }
@@ -3902,12 +5110,12 @@
{
\tl_set:Nx \l__tblr_a_tl
{
- \__tblr_text_item:ne { hline }
+ \__tblr_spec_item:ne { hline }
{ [\int_eval:n {\c@rowcount + 1}] / @hline-height }
}
%% Note that \l__tblr_b_tl may be empty
\tl_set:Nx \l__tblr_b_tl
- { \__tblr_prop_item:ne { table } { baseline } }
+ { \__tblr_prop_item:ne { inner } { baseline } }
\bool_lazy_or:nnTF
{ \dim_compare_p:nNn { \l__tblr_a_tl } = { 0pt } }
{ \int_compare_p:nNn { \l__tblr_b_tl + 0 } = { \c@rowcount } }
@@ -3937,6 +5145,10 @@
\box_use_drop:N #1
}
+%%% --------------------------------------------------------
+%%> \section{Build Table Components}
+%%% --------------------------------------------------------
+
\dim_new:N \l__tblr_col_o_wd_dim
\dim_new:N \l__tblr_col_b_wd_dim
@@ -3952,9 +5164,9 @@
\cs_new_protected:Npn \__tblr_build_hline_segment:nn #1 #2
{
\tl_set:Nx \l__tblr_n_tl
- { \__tblr_text_item:ne { hline } { [#1] / @hline-count } }
+ { \__tblr_spec_item:ne { hline } { [#1] / @hline-count } }
\tl_set:Nx \l__tblr_o_tl
- { \__tblr_text_item:ne { hline } { [#1][#2] / omit } }
+ { \__tblr_spec_item:ne { hline } { [#1][#2] / omit } }
\__tblr_get_col_outer_width_border_width:nNN {#2}
\l__tblr_col_o_wd_dim \l__tblr_col_b_wd_dim
\tl_if_empty:NTF \l__tblr_o_tl
@@ -3975,7 +5187,7 @@
\cs_new_protected:Npn \__tblr_build_hline_segment_real:nn #1 #2
{
\tl_set:Nx \l__tblr_s_tl
- { \__tblr_prop_item:ne { table } { rulesep } }
+ { \__tblr_prop_item:ne { inner } { rulesep } }
\vbox_set:Nn \l__tblr_c_box
{
%% add an empty hbox to support vbox width
@@ -3983,12 +5195,12 @@
\int_step_inline:nn { \l__tblr_n_tl }
{
\tl_set:Nx \l__tblr_h_tl
- { \__tblr_text_item:ne { hline } { [#1](##1) / @hline-height } }
+ { \__tblr_spec_item:ne { hline } { [#1](##1) / @hline-height } }
\hrule height ~ 0pt % remove lineskip
\hbox_set_to_wd:Nnn \l__tblr_b_box { \l__tblr_col_o_wd_dim }
{
\tl_set:Nx \l__tblr_f_tl
- { \__tblr_text_item:ne { hline } { [#1][#2](##1) / fg } }
+ { \__tblr_spec_item:ne { hline } { [#1][#2](##1) / fg } }
\tl_if_empty:NF \l__tblr_f_tl { \color{\l__tblr_f_tl} }
\__tblr_get_hline_segment_child:nnn {#1} {#2} {##1}
}
@@ -4009,10 +5221,10 @@
\cs_new_protected:Npn \__tblr_get_col_outer_width_border_width:nNN #1 #2 #3
{
\dim_set:Nn #3
- { \__tblr_text_item:ne { vline } { [\int_eval:n {#1 + 1}] / @vline-width } }
+ { \__tblr_spec_item:ne { vline } { [\int_eval:n {#1 + 1}] / @vline-width } }
\dim_set:Nn #2
{
- \__tblr_text_item:ne { vline } { [#1] / @vline-width }
+ \__tblr_spec_item:ne { vline } { [#1] / @vline-width }
+
\__tblr_data_item:nen { column } {#1} { leftsep }
+
@@ -4032,6 +5244,8 @@
%% Build current row, #1: row number
\cs_new_protected:Npn \__tblr_build_row:N #1
{
+ \int_set:Nn \c@rownum {#1}
+ \__tblr_update_rowsep_registers:
\__tblr_get_row_inner_height_depth:VNNNN #1
\l__tblr_row_ht_dim \l__tblr_row_dp_dim
\l__tblr_row_abovesep_dim \l__tblr_row_belowsep_dim
@@ -4078,9 +5292,9 @@
\cs_new_protected:Npn \__tblr_build_vline_segment:nn #1 #2
{
\tl_set:Nx \l__tblr_n_tl
- { \__tblr_text_item:ne { vline } { [#2] / @vline-count } }
+ { \__tblr_spec_item:ne { vline } { [#2] / @vline-count } }
\tl_set:Nx \l__tblr_o_tl
- { \__tblr_text_item:ne { vline } { [#1][#2] / omit } }
+ { \__tblr_spec_item:ne { vline } { [#1][#2] / omit } }
\tl_if_empty:NTF \l__tblr_o_tl
{
\int_compare:nNnT { \l__tblr_n_tl } > {0}
@@ -4093,7 +5307,7 @@
\cs_new_protected:Npn \__tblr_build_vline_segment_omit:nn #1 #2
{
\tl_set:Nx \l__tblr_w_tl
- { \__tblr_text_item:ne { vline } { [#2] / @vline-width } }
+ { \__tblr_spec_item:ne { vline } { [#2] / @vline-width } }
\skip_horizontal:N \l__tblr_w_tl
}
@@ -4103,10 +5317,10 @@
\cs_new_protected:Npn \__tblr_build_vline_segment_real:nn #1 #2
{
\tl_set:Nx \l__tblr_s_tl
- { \__tblr_prop_item:ne { table } { rulesep } }
+ { \__tblr_prop_item:ne { inner } { rulesep } }
\tl_set:Nx \l__tblr_b_tl
{
- \__tblr_text_item:ne { hline }
+ \__tblr_spec_item:ne { hline }
{ [\int_eval:n{#1 + 1}](1) / @hline-height }
}
\tl_if_empty:NT \l__tblr_b_tl { \tl_set:Nn \l__tblr_b_tl { 0pt } }
@@ -4115,12 +5329,12 @@
\int_step_inline:nn { \l__tblr_n_tl }
{
\tl_set:Nx \l__tblr_w_tl
- { \__tblr_text_item:ne { vline } { [#2](##1) / @vline-width } }
+ { \__tblr_spec_item:ne { vline } { [#2](##1) / @vline-width } }
\vbox_set_to_ht:Nnn \l__tblr_b_box
{ \dim_eval:n { \l__tblr_row_ht_dim + \l__tblr_row_dp_dim } }
{
\tl_set:Nx \l__tblr_f_tl
- { \__tblr_text_item:ne { vline } { [#1][#2](##1) / fg } }
+ { \__tblr_spec_item:ne { vline } { [#1][#2](##1) / fg } }
\tl_if_empty:NF \l__tblr_f_tl { \color{\l__tblr_f_tl} }
\__tblr_get_vline_segment_child:nnnxx {#1} {#2} {##1}
{ \dim_eval:n { \l__tblr_row_ht_dim } }
@@ -4146,8 +5360,8 @@
\cs_new_protected:Npn \__tblr_build_cell:NN #1 #2
{
- \int_set:Nn \c@rownum {#1}
\int_set:Nn \c@colnum {#2}
+ \__tblr_update_colsep_registers:
\group_begin:
\tl_set:Nx \l__tblr_w_tl
{ \__tblr_data_item:nen { column } {#2} { @col-width } }
@@ -4305,20 +5519,23 @@
%% #1: row number; #2: column number; #3: dimen register for rowsep above.
%% #4: dimen register for total height; #5: dimen register for rowsep below.
%% We can use \l__tblr_row_item_skip_size_prop which was made before
+%% But when vspan=even, there are no itemskip in the prop list.
+%% Therefore we need to calculate them from the sizes of items and skips
\cs_new_protected:Npn \__tblr_get_span_vertical_sizes:NNNNN #1 #2 #3 #4 #5
{
\dim_set:Nn #3
{ \__tblr_data_item:nen { row } {#1} { abovesep } }
\dim_zero:N #4
- \int_step_inline:nnn { #1 } { #1 + \l__tblr_cell_rowspan_tl - 2 }
- {
- \dim_add:Nn #4
- { \prop_item:Ne \l__tblr_row_item_skip_size_prop { itemskip[##1] } }
- }
\dim_add:Nn #4
+ { \prop_item:Ne \l__tblr_row_item_skip_size_prop { item[#1] } }
+ \int_step_inline:nnn { #1 + 1 } { #1 + \l__tblr_cell_rowspan_tl - 1 }
{
- \prop_item:Ne \l__tblr_row_item_skip_size_prop
- { item[\int_eval:n { #1 + \l__tblr_cell_rowspan_tl - 1 }] }
+ \dim_add:Nn #4
+ {
+ \prop_item:Ne \l__tblr_row_item_skip_size_prop { skip[##1] }
+ +
+ \prop_item:Ne \l__tblr_row_item_skip_size_prop { item[##1] }
+ }
}
\dim_set:Nn #5
{
@@ -4331,28 +5548,24 @@
%% #1: row number; #2: column number; #3: dimen register for colsep left.
%% #4: dimen register for total width; #5: dimen register for colsep right.
%% We can use \l__tblr_col_item_skip_size_prop which was made before
-%% But when hspan=minimal, there are no itemskip in the prop list.
+%% But when hspan=even or hspan=minimal, there are no itemskip in the prop list.
%% Therefore we need to calculate them from the sizes of items and skips
\cs_new_protected:Npn \__tblr_get_span_horizontal_sizes:NNNNN #1 #2 #3 #4 #5
{
\dim_set:Nn #3
{ \__tblr_data_item:nen { column } {#2} { leftsep } }
\dim_zero:N #4
- \int_step_inline:nnn { #2 } { #2 + \l__tblr_cell_colspan_tl - 2 }
+ \dim_add:Nn #4
+ { \prop_item:Ne \l__tblr_col_item_skip_size_prop { item[#2] } }
+ \int_step_inline:nnn { #2 + 1 } { #2 + \l__tblr_cell_colspan_tl - 1 }
{
\dim_add:Nn #4
- { \prop_item:Ne \l__tblr_col_item_skip_size_prop { item[##1] } }
- \dim_add:Nn #4
{
- \prop_item:Ne \l__tblr_col_item_skip_size_prop
- { skip[\int_eval:n { ##1 + 1 }] }
+ \prop_item:Ne \l__tblr_col_item_skip_size_prop { skip[##1] }
+ +
+ \prop_item:Ne \l__tblr_col_item_skip_size_prop { item[##1] }
}
}
- \dim_add:Nn #4
- {
- \prop_item:Ne \l__tblr_col_item_skip_size_prop
- { item[\int_eval:n { #2 + \l__tblr_cell_colspan_tl - 1 }] }
- }
\dim_set:Nn #5
{
\__tblr_data_item:nen { column }
@@ -4373,7 +5586,10 @@
\bool_new:N \g__tblr_tracing_text_bool
\bool_new:N \g__tblr_tracing_command_bool
-\bool_new:N \g__tblr_tracing_table_bool
+\bool_new:N \g__tblr_tracing_option_bool
+\bool_new:N \g__tblr_tracing_theme_bool
+\bool_new:N \g__tblr_tracing_outer_bool
+\bool_new:N \g__tblr_tracing_inner_bool
\bool_new:N \g__tblr_tracing_column_bool
\bool_new:N \g__tblr_tracing_row_bool
\bool_new:N \g__tblr_tracing_cell_bool
@@ -4384,6 +5600,10 @@
\bool_new:N \g__tblr_tracing_target_bool
\bool_new:N \g__tblr_tracing_cellspan_bool
\bool_new:N \g__tblr_tracing_intarray_bool
+\bool_new:N \g__tblr_tracing_page_bool
+\bool_new:N \g__tblr_tracing_step_bool
+
+\bool_gset_true:N \g__tblr_tracing_step_bool
\keys_define:nn { tblr-set-tracing }
{
@@ -4391,8 +5611,14 @@
-text .code:n = \bool_gset_false:N \g__tblr_tracing_text_bool,
+command .code:n = \bool_gset_true:N \g__tblr_tracing_command_bool,
-command .code:n = \bool_gset_false:N \g__tblr_tracing_command_bool,
- +table .code:n = \bool_gset_true:N \g__tblr_tracing_table_bool,
- -table .code:n = \bool_gset_false:N \g__tblr_tracing_table_bool,
+ +option .code:n = \bool_gset_true:N \g__tblr_tracing_option_bool,
+ -option .code:n = \bool_gset_false:N \g__tblr_tracing_option_bool,
+ +theme .code:n = \bool_gset_true:N \g__tblr_tracing_theme_bool,
+ -theme .code:n = \bool_gset_false:N \g__tblr_tracing_theme_bool,
+ +outer .code:n = \bool_gset_true:N \g__tblr_tracing_outer_bool,
+ -outer .code:n = \bool_gset_false:N \g__tblr_tracing_outer_bool,
+ +inner .code:n = \bool_gset_true:N \g__tblr_tracing_inner_bool,
+ -inner .code:n = \bool_gset_false:N \g__tblr_tracing_inner_bool,
+column .code:n = \bool_gset_true:N \g__tblr_tracing_column_bool,
-column .code:n = \bool_gset_false:N \g__tblr_tracing_column_bool,
+row .code:n = \bool_gset_true:N \g__tblr_tracing_row_bool,
@@ -4413,6 +5639,10 @@
-cellspan .code:n = \bool_gset_false:N \g__tblr_tracing_cellspan_bool,
+intarray .code:n = \bool_gset_true:N \g__tblr_tracing_intarray_bool,
-intarray .code:n = \bool_gset_false:N \g__tblr_tracing_intarray_bool,
+ +page .code:n = \bool_gset_true:N \g__tblr_tracing_page_bool,
+ -page .code:n = \bool_gset_false:N \g__tblr_tracing_page_bool,
+ +step .code:n = \bool_gset_true:N \g__tblr_tracing_step_bool,
+ -step .code:n = \bool_gset_false:N \g__tblr_tracing_step_bool,
all .code:n = \__tblr_enable_all_tracings:,
none .code:n = \__tblr_disable_all_tracings:,
}
@@ -4421,7 +5651,10 @@
{
\bool_gset_true:N \g__tblr_tracing_text_bool
\bool_gset_true:N \g__tblr_tracing_command_bool
- \bool_gset_true:N \g__tblr_tracing_table_bool
+ \bool_gset_true:N \g__tblr_tracing_option_bool
+ \bool_gset_true:N \g__tblr_tracing_theme_bool
+ \bool_gset_true:N \g__tblr_tracing_outer_bool
+ \bool_gset_true:N \g__tblr_tracing_inner_bool
\bool_gset_true:N \g__tblr_tracing_column_bool
\bool_gset_true:N \g__tblr_tracing_row_bool
\bool_gset_true:N \g__tblr_tracing_cell_bool
@@ -4432,13 +5665,18 @@
\bool_gset_true:N \g__tblr_tracing_target_bool
\bool_gset_true:N \g__tblr_tracing_cellspan_bool
\bool_gset_true:N \g__tblr_tracing_intarray_bool
+ \bool_gset_true:N \g__tblr_tracing_page_bool
+ \bool_gset_true:N \g__tblr_tracing_step_bool
}
\cs_new_protected_nopar:Npn \__tblr_disable_all_tracings:
{
\bool_gset_false:N \g__tblr_tracing_text_bool
\bool_gset_false:N \g__tblr_tracing_command_bool
- \bool_gset_false:N \g__tblr_tracing_table_bool
+ \bool_gset_false:N \g__tblr_tracing_option_bool
+ \bool_gset_false:N \g__tblr_tracing_theme_bool
+ \bool_gset_false:N \g__tblr_tracing_outer_bool
+ \bool_gset_false:N \g__tblr_tracing_inner_bool
\bool_gset_false:N \g__tblr_tracing_column_bool
\bool_gset_false:N \g__tblr_tracing_row_bool
\bool_gset_false:N \g__tblr_tracing_cell_bool
@@ -4449,6 +5687,8 @@
\bool_gset_false:N \g__tblr_tracing_target_bool
\bool_gset_false:N \g__tblr_tracing_cellspan_bool
\bool_gset_false:N \g__tblr_tracing_intarray_bool
+ \bool_gset_false:N \g__tblr_tracing_page_bool
+ \bool_gset_false:N \g__tblr_tracing_step_bool
}
\NewDocumentCommand \LogTabularrayTracing { m }
@@ -4459,6 +5699,7 @@
\keys_define:nn { tblr-log-tracing }
{
+ step .code:n = \__tblr_log_tracing_step:n {#1},
unknown .code:n = \__tblr_log_tracing:N \l_keys_key_str
}
@@ -4470,7 +5711,7 @@
\cs_new_protected:Npn \__tblr_log_tracing_text:
{
- \__tblr_text_log:n { text }
+ \__tblr_spec_log:n { text }
}
\cs_new_protected:Npn \__tblr_log_tracing_command:
@@ -4478,9 +5719,26 @@
\__tblr_prop_log:n { command }
}
-\cs_new_protected:Npn \__tblr_log_tracing_table:
+\cs_new_protected:Npn \__tblr_log_tracing_option:
+ {
+ \__tblr_prop_log:n { note }
+ \__tblr_prop_log:n { remark }
+ \__tblr_prop_log:n { more }
+ }
+
+\cs_new_protected:Npn \__tblr_log_tracing_theme:
+ {
+ \__tblr_style_log:
+ }
+
+\cs_new_protected:Npn \__tblr_log_tracing_outer:
{
- \__tblr_prop_log:n { table }
+ \__tblr_spec_log:n { outer }
+ }
+
+\cs_new_protected:Npn \__tblr_log_tracing_inner:
+ {
+ \__tblr_prop_log:n { inner }
}
\cs_new_protected:Npn \__tblr_log_tracing_column:
@@ -4500,12 +5758,12 @@
\cs_new_protected:Npn \__tblr_log_tracing_vline:
{
- \__tblr_text_log:n { vline }
+ \__tblr_spec_log:n { vline }
}
\cs_new_protected:Npn \__tblr_log_tracing_hline:
{
- \__tblr_text_log:n { hline }
+ \__tblr_spec_log:n { hline }
}
\cs_new_protected:Npn \__tblr_log_tracing_colspec:
@@ -4537,9 +5795,124 @@
\prop_log:N \l__tblr_row_span_to_row_prop
}
+\cs_new_protected:Npn \__tblr_log_tracing_page:
+ {
+ \dim_log:N \pagegoal
+ \dim_log:N \pagetotal
+ }
+
+\cs_new_protected:Npn \__tblr_log_tracing_step:n #1
+ {
+ \bool_if:NT \g__tblr_tracing_step_bool { \tl_log:x {Step :~ #1} }
+ }
+
\cs_new_protected:Npn \__tblr_do_if_tracing:nn #1 #2
{
\bool_if:cT { g__tblr_tracing_ #1 _bool } {#2}
}
+%%% --------------------------------------------------------
+%% \section{Tabularray Libraries}
+%%% --------------------------------------------------------
+
+%% \NewTblrLibrary and \UseTblrLibrary commands
+
+\NewDocumentCommand \NewTblrLibrary { m m }
+ {
+ \cs_new_protected:cpn { __tblr_use_lib_ #1: } {#2}
+ }
+
+\NewDocumentCommand \UseTblrLibrary { m }
+ {
+ \clist_map_inline:nn {#1} { \use:c { __tblr_use_lib_ ##1: } }
+ }
+
+%% Library booktabs and commands \toprule, \midrule, \bottomrule
+
+\NewTblrLibrary { booktabs }
+ {
+ \NewTableCommand \toprule [1] [] { \hline [0.08em, ##1] }
+ \NewTableCommand \midrule [1] [] { \hline [0.05em, ##1] }
+ \NewTableCommand \bottomrule [1] [] { \hline [0.08em, ##1] }
+ \NewTableCommand \cmidrule [2] [] { \cline [0.03em, ##1] { ##2 } }
+ }
+
+%% Library diagbox and command \diagbox
+
+\NewTblrLibrary { diagbox }
+ {
+ \RequirePackage{ diagbox }
+ \cs_set_eq:NN \__tblr_lib_saved_diagbox:w \diagbox
+ \NewContentCommand \diagbox [3] []
+ {
+ \__tblr_lib_diagbox_fix:n
+ {
+ \__tblr_lib_saved_diagbox:w
+ [ leftsep=\leftsep, rightsep=\rightsep, ##1 ]
+ { \__tblr_lib_diagbox_math_or_text:n {##2} }
+ { \__tblr_lib_diagbox_math_or_text:n {##3} }
+ }
+ }
+ \NewContentCommand \diagboxthree [4] []
+ {
+ \__tblr_lib_diagbox_fix:n
+ {
+ \__tblr_lib_saved_diagbox:w
+ [ leftsep=\leftsep, rightsep=\rightsep, ##1 ]
+ { \__tblr_lib_diagbox_math_or_text:n {##2} }
+ { \__tblr_lib_diagbox_math_or_text:n {##3} }
+ { \__tblr_lib_diagbox_math_or_text:n {##4} }
+ }
+ }
+ }
+
+\cs_new_protected:Npn \__tblr_lib_diagbox_math_or_text:n #1
+ {
+ \bool_if:NTF \l__tblr_math_mode_bool {$#1$} {#1}
+ }
+
+\box_new:N \l__tblr_diag_box
+
+\cs_new_protected:Npn \__tblr_lib_diagbox_fix:n #1
+ {
+ \hbox_set:Nn \l__tblr_diag_box {#1}
+ \box_set_ht:Nn \l__tblr_diag_box { \box_ht:N \l__tblr_diag_box - \abovesep }
+ \box_set_dp:Nn \l__tblr_diag_box { \box_dp:N \l__tblr_diag_box - \belowsep }
+ \box_use:N \l__tblr_diag_box
+ }
+
+%% Library siunitx and S columns
+
+\NewTblrLibrary { siunitx }
+ {
+ \RequirePackage { siunitx }
+ \NewColumnType { S } [1] [] { Q[si = {##1}] }
+ \__tblr_data_new_key:nnn { cell } { si } { str }
+ \keys_define:nn { tblr-column }
+ {
+ si .code:n = \__tblr_siunitx_setcolumn:n {##1}
+ }
+ \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 }
+ }
+ \cs_new_protected:Npn \__tblr_siunitx_tablenum:n ##1
+ {
+ \tl_if_head_is_group:nTF {##1}
+ { ##1 }
+ {
+ \group_begin:
+ \tl_set:Nx \l_tmpa_tl
+ {
+ \__tblr_data_item:neen { cell }
+ { \int_use:N \c@rownum } { \int_use:N \c@colnum } { si }
+ }
+ \exp_args:NV \sisetup \l_tmpa_tl
+ \tablenum {##1}
+ \group_end:
+ }
+ }
+ }
+
\ExplSyntaxOff
diff --git a/macros/latex/contrib/tabularray/tabularray.tex b/macros/latex/contrib/tabularray/tabularray.tex
index 5b1912c063..45d486d995 100644
--- a/macros/latex/contrib/tabularray/tabularray.tex
+++ b/macros/latex/contrib/tabularray/tabularray.tex
@@ -6,6 +6,9 @@
\usepackage{codehigh} % https://ctan.org/pkg/codehigh
\usepackage{tabularray}
\usepackage{array,multirow,amsmath}
+\usepackage{chemmacros}
+
+\UseTblrLibrary{booktabs,diagbox,siunitx}
\usepackage{hyperref}
\hypersetup{
@@ -13,17 +16,43 @@
urlcolor=blue3,
linkcolor=red3,
}
+
+\usepackage{tcolorbox}
+\tcbset{sharp corners, boxrule=0.5pt, colback=red9}
+
+\usepackage{float}
+
+\setcounter{tocdepth}{1}
+
+\newcommand*{\K}[1]{\texttt{#1}}
+\newcommand*{\V}[1]{\texttt{#1}}
+
+\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},
+ rowhead = 1,
+}
+
+\newcommand{\mywarning}[1]{%
+ \begin{tcolorbox}
+ The interfaces in this #1 should be seen as
+ \textcolor{red3}{\bfseries experimental}
+ and are likely to change in future releases, if necessary.
+ Don’t use them in important documents.
+ \end{tcolorbox}
+}
+
\renewcommand*{\thefootnote}{*}
-\newcommand*{\myversion}{2021K}
+\newcommand*{\myversion}{2021L}
\newcommand*{\mydate}{Version \myversion\ (\the\year-\mylpad\month-\mylpad\day)\\\myrepo}
\newcommand*{\myrepo}{\url{https://github.com/lvjr/tabularray}}
\newcommand*{\mylpad}[1]{\ifnum#1<10 0\the#1\else\the#1\fi}
-\colorlet{highback}{\ifcase\month\or
- red9\or brown9\or yellow9\or cyan9\or azure9\or blue9\or
- red9\or brown9\or yellow9\or cyan9\or azure9\or blue9\fi
-}
+\colorlet{highback}{\ifodd\month azure9\else blue9\fi}
\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}
@@ -39,11 +68,11 @@
\tableofcontents
-\chapter{From Old to New}
+\chapter{Overview of Features}
\section{Vertical Space}
-After loading \verb!tabularrray! package in the preamble,
+After loading \verb!tabularray! package in the preamble,
we can use \verb!tblr! environments to typeset tabulars and arrays.
The name \verb!tblr! is short for \verb!tabularray! or \verb!top-bottom-left-right!.
The following is our first example:
@@ -74,10 +103,10 @@ The following is our first example:
You may notice that there is extra space above and below the table rows with \verb!tblr! envirenment.
This space makes the table look better.
-If you don't like it, you could use \verb!\SetTblrDefault! command:
+If you don't like it, you could use \verb!\SetTblrInner! command:
\begin{demohigh}
-\SetTblrDefault{rowsep=0pt}
+\SetTblrInner{rowsep=0pt}
\begin{tblr}{lccr}
\hline
Alpha & Beta & Gamma & Delta \\
@@ -191,8 +220,8 @@ will be treated as \verb!h! and \verb!f!, respectively:
\end{demohigh}
Note that you don't need to load \verb!multirow! package first,
-since \verb!tabularrray! doesn't depend on it.
-Furthermore, \verb!tabularray! will always typeset descent multirow cells.
+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,
even though some rows have large height:
@@ -309,7 +338,7 @@ which will help us to locate cells when the tables are rather complex:
\verb!Tabularray! package supports all normal column types, as well as
the extendable \verb!X! column type,
-which first occured in \verb!tabularx! package and was largely improved by \verb!tabu! package:
+which first occurred in \verb!tabularx! package and was largely improved by \verb!tabu! package:
\begin{demohigh}
\begin{tblr}{|X[2,l]|X[3,l]|X[1,r]|X[r]|}
@@ -453,7 +482,7 @@ Hlines and vlines can also have colors:
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:
-\begin{demohigh}
+\begin{codehigh}
\NewTableCommand\toprule{\hline[0.08em]}
\NewTableCommand\midrule{\hline[0.05em]}
\NewTableCommand\bottomrule{\hline[0.08em]}
@@ -466,14 +495,189 @@ The following example demonstrates how to define similar rules as in \verb!bookt
Nu & Xi & Omicron & Pi \\
\bottomrule
\end{tblr}
+\end{codehigh}
+
+\chapter{The Old Interfaces}
+
+With tabularray package, you can still use improved table commands to change the styles of tables.
+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 \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}
+
+\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}
-\chapter{New Interfaces}
+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}.
+
+\begin{spectblr}[
+ caption = {Keys for Hlines and Vlines},
+ label = {key:hvline},
+ remark{Note} = {In most cases, you can omit the underlined key names and write only their values.}
+]{}
+ 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 \\
+\end{spectblr}
+
Options \verb!hlines! and \verb!vlines! are for setting all hlines and vlines, respectively.
With empty value, all hlines/vlines will be solid.
@@ -571,18 +775,69 @@ Options \verb!hline{i}! and \verb!vline{j}! are for setting some hlines and vlin
\end{tblr}
\end{demohigh}
+At last 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}
+\begin{tblr}{
+ vlines, hlines,
+ colspec = {lX[c]X[c]X[c]X[c]},
+ vline{2} = {1}{text=\clap{:}},
+ vline{3} = {1}{text=\clap{\ch{+}}},
+ vline{4} = {1}{text=\clap{\ch{->}}},
+ vline{5} = {1}{text=\clap{\ch{+}}},
+}
+ Equation & \ch{CH4} & \ch{2 O2} & \ch{CO2} & \ch{2 H2O} \\
+ Initial & $n_1$ & $n_2$ & 0 & 0 \\
+ Final & $n_1-x$ & $n_2-2x$ & $x$ & $2x$ \\
+\end{tblr}
+\end{demohigh}
+
+You need to load \verb!chemmacros! package for the \verb!\ch! command.
+
\section{Cells and Spancells}
-Option \verb!cells! is for setting all cells.
+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},
+ remark{Note} = {In most cases, you can omit the underlined key names and write only their values.}
+]{}
+ Key & Description and Values & Initial Value \\
+ \underline{\K{halign}}
+ & horizontal alignment: \V{l} (left), \V{c} (center), or \V{r} (right)
+ & \V{l} \\
+ \underline{\K{valign}}
+ & 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 \\
+\end{spectblr}
+\vspace{-2em}
+\begin{spectblr}[
+ caption = {Keys for Multispan of Cells},
+ label = {key:cellspan},
+]{}
+ Key & Description and Values & Initial Value \\
+ \K{r} & number of rows the cell spans & 1 \\
+ \K{c} & number of columns the cell spans & 1 \\
+\end{spectblr}
+Option \verb!cells! is for setting all cells.
+\nopagebreak
\begin{demohigh}
\begin{tblr}{hlines={white},cells={c,blue7}}
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}
@@ -609,8 +864,67 @@ Option \verb!cell{i}{j}! is for setting some cells.
\section{Rows and Columns}
-Options \verb!rows! and \verb!columns! are for setting all rows and columns, respectively.
+All available keys for rows and columns are described in Table \ref{key:row} and Table \ref{key:column}.
+
+\begin{spectblr}[
+ caption = {Keys for Rows},
+ label = {key:row},
+ remark{Note} = {In most cases, you can omit the underlined key names and write only their values.}
+]{}
+ Key & Description and Values & Initial Value \\
+ \underline{\K{halign}}
+ & horizontal alignment: \V{l} (left), \V{c} (center), or \V{r} (right)
+ & \V{l} \\
+ \underline{\K{valign}}
+ & 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 \\
+ \K{abovesep} & set vertical space above the row & \V{2pt} \\
+ \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{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 \\
+\end{spectblr}
+\vspace{-2em}
+\begin{spectblr}[
+ caption = {Keys for Columns},
+ label = {key:column},
+ remark{Note} = {In most cases, you can omit the underlined key names and write only their values.}
+]{}
+ Key & Description and Values & Initial Value \\
+ \underline{\K{halign}}
+ & horizontal alignment: \V{l} (left), \V{c} (center), or \V{r} (right)
+ & \V{l} \\
+ \underline{\K{valign}}
+ & 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 \\
+ \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{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{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 \\
+\end{spectblr}
+Options \verb!rows! and \verb!columns! are for setting all rows and columns, respectively.
+\nopagebreak
\begin{demohigh}
\begin{tblr}{
hlines,
@@ -642,13 +956,10 @@ Options \verb!row{i}! and \verb!column{j}! are for setting some rows and columns
\end{tblr}
\end{demohigh}
-We can specify foreground colors, background colors and fonts with
-\verb!bg!, \verb!fg! and \verb!font! keys, respectively, for cells/rows/columns.
-In most cases, \verb!bg! key can be omitted, which you can see in the previous examples.
-
+The following example demonstrates the usages of \verb!bg!, \verb!fg! and \verb!font! keys.
+\nopagebreak
\begin{demohigh}
\begin{tblr}{
- colspec = {lcr},
row{odd} = {bg=azure8},
row{1} = {bg=azure3, fg=white, font=\sffamily},
}
@@ -660,21 +971,9 @@ In most cases, \verb!bg! key can be omitted, which you can see in the previous e
\end{tblr}
\end{demohigh}
-\section{Space in Tables}
-
-Options \verb!rowsep! and \verb!colsep! are for setting padding for rows and columns, respectively.
-
-\begin{demohigh}
-\SetTblrDefault{rowsep=2pt,colsep=2pt}
-\begin{tblr}{hlines,vlines}
- Alpha & Beta & Gamma & Delta \\
- Epsilon & Zeta & Eta & Theta \\
- Iota & Kappa & Lambda & Mu \\
-\end{tblr}
-\end{demohigh}
-
-Also \verb!abovesep!, \verb!belowsep!, \verb!leftsep!, \verb!rightsep! options are available:
-
+The following example demonstrates the usages of
+\verb!abovesep!, \verb!belowsep!, \verb!leftsep!, \verb!rightsep! keys.
+\nopagebreak
\begin{demohigh}
\begin{tblr}{
hlines,
@@ -688,7 +987,7 @@ Also \verb!abovesep!, \verb!belowsep!, \verb!leftsep!, \verb!rightsep! options a
\end{tblr}
\end{demohigh}
-And \verb!\\[dimen]! can be replaced by \verb!belowsep+! option:
+The following example shows that we can replace \verb!\\[dimen]! with \verb!belowsep+! key.
\begin{demohigh}
\begin{tblr}{
@@ -700,8 +999,42 @@ And \verb!\\[dimen]! can be replaced by \verb!belowsep+! option:
\end{tblr}
\end{demohigh}
-Also \verb!\doublerulesep! parameter can be replaced by \verb!rulesep! option:
+\section{The Whole Table}
+
+All available keys for the whole table are described in Table \ref{key:table}.
+
+\begin{spectblr}[
+ caption = {Keys for the Whole Table},
+ 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} \\
+ \K{belowsep} & set vertical space below every row & \V{2pt} \\
+ \K{rowsep} & set vertical space above and below every row & \V{2pt} \\
+ \K{leftsep} & set horizontal space to the left of every column & \V{6pt} \\
+ \K{rightsep} & set horizontal space to the right of every column & \V{6pt} \\
+ \K{colsep} & set horizontal space to both sides of every column & \V{6pt} \\
+ \K{hspan} & horizontal span algorithm: \V{default}, \V{even}, or \V{minimal} & \V{default} \\
+ \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}
\begin{tblr}{
colspec={||llll||},rowspec={|QQQ|},rulesep=4pt,
@@ -712,7 +1045,7 @@ Also \verb!\doublerulesep! parameter can be replaced by \verb!rulesep! option:
\end{tblr}
\end{demohigh}
-Also \verb!\arraystretch! parameter can be replaced by \verb!stretch! option:
+The following example shows that we can replace \verb!\arraystretch! parameter with \verb!stretch! key.
\begin{demohigh}
\begin{tblr}{hlines,stretch=1.5}
@@ -722,39 +1055,34 @@ Also \verb!\arraystretch! parameter can be replaced by \verb!stretch! option:
\end{tblr}
\end{demohigh}
-\section{Counters in Tables}
-
-Counters \verb!rownum!, \verb!colnum!, \verb!rowcount!, \verb!colcount! can be used in cell text:
-
+The following example uses \verb!rowsep! and \verb!colsep! keys to set padding for all rows and columns.
+\nopagebreak
\begin{demohigh}
-\begin{tblr}{hlines}
- Cell[\arabic{rownum}][\arabic{colnum}] & Cell[\arabic{rownum}][\arabic{colnum}] &
- Cell[\arabic{rownum}][\arabic{colnum}] & Cell[\arabic{rownum}][\arabic{colnum}] \\
- Cell[\arabic{rownum}][\arabic{colnum}] & Cell[\arabic{rownum}][\arabic{colnum}] &
- Cell[\arabic{rownum}][\arabic{colnum}] & Cell[\arabic{rownum}][\arabic{colnum}] \\
- Row=\arabic{rowcount}, Col=\arabic{colcount} &
- Row=\arabic{rowcount}, Col=\arabic{colcount} &
- Row=\arabic{rowcount}, Col=\arabic{colcount} &
- Row=\arabic{rowcount}, Col=\arabic{colcount} \\
- Cell[\arabic{rownum}][\arabic{colnum}] & Cell[\arabic{rownum}][\arabic{colnum}] &
- Cell[\arabic{rownum}][\arabic{colnum}] & Cell[\arabic{rownum}][\arabic{colnum}] \\
- Cell[\arabic{rownum}][\arabic{colnum}] & Cell[\arabic{rownum}][\arabic{colnum}] &
- Cell[\arabic{rownum}][\arabic{colnum}] & Cell[\arabic{rownum}][\arabic{colnum}] \\
+\SetTblrInner{rowsep=2pt,colsep=2pt}
+\begin{tblr}{hlines,vlines}
+ Alpha & Beta & Gamma & Delta \\
+ Epsilon & Zeta & Eta & Theta \\
+ Iota & Kappa & Lambda & Mu \\
\end{tblr}
\end{demohigh}
-\section{Experimental Interfaces}
+With \verb!hspan=default! or \verb!hspan=even!,
+\verb!tabularray! package will compute column widths from span widths.
+But with \verb!hspan=minimal!, it will compute span widths from column widths.
+The following examples show the results from different \verb!hspan! values.
-Everything described in this section is in \underline{\textcolor{red3}{\textbf{experimental}}} status.
-Don’t use them in important documents, unless you have time
-to update them for the newer versions of \verb!tabularray! package in the future.
-
-By default \verb!tabularray! package will compute column widths from span widths.
-By setting option \verb!hspan=minimal!, it will compute span widths from column widths.
-The following two examples show this difference:
+\begin{demohigh}
+\SetTblrInner{hlines, vlines, hspan=default}
+\begin{tblr}{cell{2}{1}={c=2}{l},cell{3}{1}={c=3}{l},cell{4}{2}={c=2}{l}}
+ 111 111 & 222 222 & 333 333 \\
+ 12 Multi Columns Multi Columns 12 & & 333 \\
+ 13 Multi Columns Multi Columns Multi Columns 13 & & \\
+ 111 & 23 Multi Columns Multi Columns 23 & \\
+\end{tblr}
+\end{demohigh}
\begin{demohigh}
-\SetTblrDefault{hlines,vlines}
+\SetTblrInner{hlines, vlines, hspan=even}
\begin{tblr}{cell{2}{1}={c=2}{l},cell{3}{1}={c=3}{l},cell{4}{2}={c=2}{l}}
111 111 & 222 222 & 333 333 \\
12 Multi Columns Multi Columns 12 & & 333 \\
@@ -764,7 +1092,7 @@ The following two examples show this difference:
\end{demohigh}
\begin{demohigh}
-\SetTblrDefault{hlines,vlines,hspan=minimal}
+\SetTblrInner{hlines, vlines, hspan=minimal}
\begin{tblr}{cell{2}{1}={c=2}{l},cell{3}{1}={c=3}{l},cell{4}{2}={c=2}{l}}
111 111 & 222 222 & 333 333 \\
12 Multi Columns Multi Columns 12 & & 333 \\
@@ -773,13 +1101,763 @@ The following two examples show this difference:
\end{tblr}
\end{demohigh}
+The following examples show the results from different \verb!vspan! values.
+\nopagebreak
+\begin{demohigh}
+\SetTblrInner{hlines, vlines, vspan=default}
+\begin{tblr}{column{2}={3.25cm}, cell{2}{2}={r=3}{l}}
+ Column1 & Column2 \\
+ Row1 & Long text that needs multiple lines.
+ Long text that needs multiple lines.
+ Long text that needs multiple lines. \\
+ Row2 & \\
+ Row3 & \\
+ Row4 & Short text \\
+\end{tblr}
+\end{demohigh}
+
+\begin{demohigh}
+\SetTblrInner{hlines, vlines, vspan=even}
+\begin{tblr}{column{2}={3.25cm}, cell{2}{2}={r=3}{l}}
+ Column1 & Column2 \\
+ Row1 & Long text that needs multiple lines.
+ Long text that needs multiple lines.
+ Long text that needs multiple lines. \\
+ Row2 & \\
+ Row3 & \\
+ Row4 & Short text \\
+\end{tblr}
+\end{demohigh}
+
+\section{Default Specifications}
+
+\verb!Tabularray! package provides \verb!\SetTblrInner! and \verb!\SetTblrOuter! commands
+for you to change the default inner and outer specifications of tables.
+Inner specifications are all specifications written in the mandatory argument of the \verb!tblr! environment,
+while outer specifications are all specifications written in the optional argument of the \verb!tblr! environment.
+At this time, most of the outer specifications are used for long tables (see Chapter \ref{chap:long}).
+
+In the below example, the first line draws all hlines and vlines for all tables created afterwards,
+while the second line makes all tables created afterwards vertically align at bottom.
+
+\begin{codehigh}
+\SetTblrInner{hlines,vlines}
+\SetTblrOuter{valign=b}
+\end{codehigh}
+
+You can define new \verb!tabularray! environments using \verb!\NewTblrEnviron! command:
+
+\begin{demohigh}
+\NewTblrEnviron{mytblr}
+\SetTblrInner[mytblr]{hlines,vlines}
+\SetTblrOuter[mytblr]{valign=b}
+Text \begin{mytblr}{cccc}
+ Alpha & Beta & Gamma & Delta \\
+ Epsilon & Zeta & Eta & Theta \\
+ Iota & Kappa & Lambda & Mu \\
+\end{mytblr} Text
+\end{demohigh}
+
+\section{Counters and Lengths}
+
+Counters \verb!rownum!, \verb!colnum!, \verb!rowcount!, \verb!colcount! can be used in cell text:
+\nopagebreak
+\begin{demohigh}
+\begin{tblr}{hlines}
+ Cell[\arabic{rownum}][\arabic{colnum}] & Cell[\arabic{rownum}][\arabic{colnum}] &
+ Cell[\arabic{rownum}][\arabic{colnum}] & Cell[\arabic{rownum}][\arabic{colnum}] \\
+ Row=\arabic{rowcount}, Col=\arabic{colcount} &
+ Row=\arabic{rowcount}, Col=\arabic{colcount} &
+ Row=\arabic{rowcount}, Col=\arabic{colcount} &
+ Row=\arabic{rowcount}, Col=\arabic{colcount} \\
+ Cell[\arabic{rownum}][\arabic{colnum}] & Cell[\arabic{rownum}][\arabic{colnum}] &
+ Cell[\arabic{rownum}][\arabic{colnum}] & Cell[\arabic{rownum}][\arabic{colnum}] \\
+\end{tblr}
+\end{demohigh}
+
+Also, lengths \verb!\leftsep!, \verb!\rightsep!, \verb!\abovesep!, \verb!\belowsep! can be used in cell text.
+
+\section{Tracing Tabularray}
+
To trace internal data behind \verb!tblr! environment, you can use \verb!\SetTblrTracing! command.
For example, \verb!\SetTblrTracing{all}! will turn on all tracings,
and \verb!\SetTblrTracing{none}! will turn off all tracings.
\verb!\SetTblrTracing{+row,+column}! will only tracing row and column data.
All tracing messages will be written to the log files.
-\chapter{Source Code}
+\chapter{Use Long Tables}
+\label{chap:long}
+
+\mywarning{chapter}
+
+\section{A Simple Example}
+
+In fact, to make a decent long table with header and footer, it is better to separate header/footer as
+\underline{table head/foot} (which includes caption, footnotes, continuation text)
+and \underline{row head/foot} (which includes some rows of the table that should appear in every page).
+By this approach, alternating row colors should work as expected.
+
+\NewTblrTheme{fancy}{
+ \SetTblrStyle{firsthead}{font=\bfseries}
+ \SetTblrStyle{firstfoot}{fg=blue2}
+ \SetTblrStyle{middlefoot}{\itshape}
+ \SetTblrStyle{caption-tag}{red2}
+}
+\begin{longtblr}[
+ theme = fancy,
+ caption = {A Long Long Long Long Long Long Long Table},
+ entry = {Short Caption},
+ label = {tblr:test},
+ note{a} = {It is the first footnote.},
+ note{$\dag$} = {It is the second long long long long long long footnote.},
+ remark{Note} = {Some general note. Some general note. Some general note.},
+ 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,
+}
+\hline
+ \SetRow{purple7} Head & Head & Head \\
+\hline
+ \SetRow{purple7} Head & Head & Head \\
+\hline
+ Alpha & Beta & Gamma \\
+\hline
+ Epsilon & Zeta\TblrNote{a} & Eta \\
+\hline
+ Iota & Kappa\TblrNote{$\dag$} & Lambda \\
+\hline
+ Nu & Xi & Omicron \\
+\hline
+ Rho & Sigma & Tau \\
+\hline
+ Phi & Chi & Psi \\
+\hline
+ Alpha & Beta & Gamma \\
+\hline
+ Epsilon & Zeta & Eta \\
+\hline
+ Iota & Kappa & Lambda \\
+\hline
+ Nu & Xi & Omicron \\
+\hline
+ Rho & Sigma & Tau \\
+\hline
+ Phi & Chi & Psi \\
+\hline
+ Alpha & Beta & Gamma \\
+\hline
+ Epsilon & Zeta & Eta \\
+\hline
+ Iota & Kappa & Lambda \\
+\hline
+ Nu & Xi & Omicron \\
+\hline
+ Rho & Sigma & Tau \\
+\hline
+ Phi & Chi & Psi \\
+\hline
+ Alpha & Beta & Gamma \\
+\hline
+ Epsilon & Zeta & Eta \\
+\hline
+ Iota & Kappa & Lambda \\
+\hline
+ Nu & Xi & Omicron \\
+\hline
+ Rho & Sigma & Tau \\
+\hline
+ Phi & Chi & Psi \\
+\hline
+ Alpha & Beta & Gamma \\
+\hline
+ Epsilon & Zeta & Eta \\
+\hline
+ Iota & Kappa & Lambda \\
+\hline
+ Nu & Xi & Omicron \\
+\hline
+ Rho & Sigma & Tau \\
+\hline
+ Phi & Chi & Psi \\
+\hline
+ Alpha & Beta & Gamma \\
+\hline
+ Epsilon & Zeta & Eta \\
+\hline
+ Iota & Kappa & Lambda \\
+\hline
+ Nu & Xi & Omicron \\
+\hline
+ Rho & Sigma & Tau \\
+\hline
+ Phi & Chi & Psi \\
+\hline
+ Alpha & Beta & Gamma \\
+\hline
+ Epsilon & Zeta & Eta \\
+\hline
+ Iota & Kappa & Lambda \\
+\hline
+ Nu & Xi & Omicron \\
+\hline
+ Rho & Sigma & Tau \\
+\hline
+ Phi & Chi & Psi \\
+\hline
+ Alpha & Beta & Gamma \\
+\hline
+ Epsilon & Zeta & Eta \\
+\hline
+ Iota & Kappa & Lambda \\
+\hline
+ Nu & Xi & Omicron \\
+\hline
+ Rho & Sigma & Tau \\
+\hline
+ Phi & Chi & Psi \\
+\hline
+ Alpha & Beta & Gamma \\
+\hline
+ Epsilon & Zeta & Eta \\
+\hline
+ Iota & Kappa & Lambda \\
+\hline
+ Nu & Xi & Omicron \\
+\hline
+ Rho & Sigma & Tau \\
+\hline
+ Phi & Chi & Psi \\
+\hline
+ Alpha & Beta & Gamma \\
+\hline
+ Epsilon & Zeta & Eta \\
+\hline
+ Iota & Kappa & Lambda \\
+\hline
+ Nu & Xi & Omicron \\
+\hline
+ Rho & Sigma & Tau \\
+\hline
+ Phi & Chi & Psi \\
+\hline
+ Alpha & Beta & Gamma \\
+\hline
+ Epsilon & Zeta & Eta \\
+\hline
+ Iota & Kappa & Lambda \\
+\hline
+ Nu & Xi & Omicron \\
+\hline
+ Rho & Sigma & Tau \\
+\hline
+ Phi & Chi & Psi \\
+\hline
+Alpha & Beta & Gamma \\
+\hline
+ Epsilon & Zeta & Eta \\
+\hline
+ Iota & Kappa & Lambda \\
+\hline
+ Nu & Xi & Omicron \\
+\hline
+ Rho & Sigma & Tau \\
+\hline
+ Phi & Chi & Psi \\
+\hline
+ Alpha & Beta & Gamma\footnote{Hello} \\
+\hline
+ Epsilon & Zeta & Eta \\
+\hline
+ Iota & Kappa & Lambda \\
+\hline
+ Nu & Xi & Omicron \\
+\hline
+ Rho & Sigma & Tau \\
+\hline
+ Phi & Chi & Psi \\
+\hline
+ Alpha & Beta & Gamma \\
+\hline
+ Epsilon & Zeta & Eta \\
+\hline
+ Iota & Kappa & Lambda \\
+\hline
+ Nu & Xi & Omicron \\
+\hline
+ Rho & Sigma & Tau \\
+\hline
+ Phi & Chi & Psi \\
+%\hline
+% Alpha & Beta & Gamma \\
+%\hline
+% Epsilon & Zeta & Eta \\
+%\hline
+% Iota & Kappa & Lambda \\
+%\hline
+% Nu & Xi & Omicron \\
+%\hline
+% Rho & Sigma & Tau \\
+%\hline
+% Phi & Chi & Psi \\
+\hline
+ \SetRow{blue7} Foot & Foot & Foot \\
+\hline
+\end{longtblr}
+
+As you can see in the above example, the appearance of long tables of \verb!tabularray! package
+is similar to that of \verb!threeparttable! and \verb!threeparttablex! packages.
+We support table footnotes, but not page footnotes in \verb!tabularray! package.
+
+\newpage
+
+The source code for the above long table is shown below. It is mainly self-explanatory.
+
+\begin{codehigh}
+\NewTblrTheme{fancy}{
+ \SetTblrStyle{firsthead}{font=\bfseries}
+ \SetTblrStyle{firstfoot}{fg=blue2}
+ \SetTblrStyle{middlefoot}{\itshape}
+ \SetTblrStyle{caption-tag}{red2}
+}
+\begin{longtblr}[
+ theme = fancy,
+ caption = {A Long Long Long Long Long Long Long Table},
+ entry = {Short Caption},
+ label = {tblr:test},
+ note{a} = {It is the first footnote.},
+ note{$\dag$} = {It is the second long long long long long long footnote.},
+ remark{Note} = {Some general note. Some general note. Some general note.},
+ 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,
+}
+\hline
+ \SetRow{purple7} Head & Head & Head \\
+\hline
+ \SetRow{purple7} Head & Head & Head \\
+\hline
+ Alpha & Beta & Gamma \\
+\hline
+ Epsilon & Zeta\TblrNote{a} & Eta \\
+\hline
+ Iota & Kappa\TblrNote{$\dag$} & Lambda \\
+\hline
+ Nu & Xi & Omicron \\
+\hline
+ Rho & Sigma & Tau \\
+\hline
+ Phi & Chi & Psi \\
+\hline
+......
+\hline
+ Alpha & Beta & Gamma \\
+\hline
+ Epsilon & Zeta & Eta \\
+\hline
+ Iota & Kappa & Lambda \\
+\hline
+ Nu & Xi & Omicron \\
+\hline
+ Rho & Sigma & Tau \\
+\hline
+ Phi & Chi & Psi \\
+\hline
+ \SetRow{blue7} Foot & Foot & Foot \\
+\hline
+\end{longtblr}
+\end{codehigh}
+
+As you can see in the above code, we typeset long tables with \verb!longtblr! environemnt.
+And we can totally separate contents and styles of long tables with \verb!tabularray! package.
+
+Row head and row foot consist of some lines of the table and should appear in every page.
+Their options are inner specifications and should be put in the mandatory argument of the \verb!longtblr! environment.
+In the above example, We set \verb!rowhead=2! and \verb!rowfoot=1!.
+
+\begin{spectblr}[
+ caption = {Inner Specifications for Row Heads and Row Foots}
+]{}
+ Key Nama & Key Description & Initial Value \\
+ \V{rowhead} & number of the first rows of the table appear in every page & \V{0} \\
+ \V{rowfoot} & number of the last rows of the table appear in every page & \V{0} \\
+\end{spectblr}
+
+Table head and table foot consist of the caption, continuation text, footnotes and remarks.
+Their options are outer specifications and should be put in the optional argument of the \verb!longtblr! environment.
+
+\begin{spectblr}[
+ caption = {Outer Specifications for Table Heads and Table Foots}
+]{}
+ 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 \\
+\end{spectblr}
+
+\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,
+you can include other templates with \verb!\UseTblrTemplate! and \verb!\ExpTblrTemplate! commands.
+
+\begin{spectblr}[
+ caption = {Templates for Table Heads and Table Foots}
+]{}
+ Template Name & Template Description \\
+ \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)'' \\
+ \V{conthead} & continuation paragraph in the head, normally including \V{conthead-text} template \\
+ \V{caption-tag} & caption tag, normally like ``Table 4.2'' \\
+ \V{caption-sep} & caption separator, normally like ``:\quad'' \\
+ \V{caption-text} & caption text, normally using user provided value \\
+ \V{caption} & including \V{caption-tag} + \V{caption-sep} + \V{caption-text} \\
+ \V{note-tag} & note tag, normally using user provided value \\
+ \V{note-sep} & note separator, normally like ``\enskip'' \\
+ \V{note-text} & note tag, normally using user provided value \\
+ \V{note} & including \V{note-tag} + \V{note-sep} + \V{note-text} \\
+ \V{remark-tag} & remark tag, normally using user provided value \\
+ \V{remark-sep} & remark separator, normally like ``:\enskip'' \\
+ \V{remark-text} & remark text, normally using user provided value\\
+ \V{remark} & including \V{remark-tag} + \V{remark-sep} + \V{remark-text} \\
+ \V{firsthead} & table head on the first page, normally including \V{caption} template \\
+ \V{middlehead} & table head on middle pages, normally including \V{caption} and \V{conthead} templates \\
+ \V{lasthead} & table head on the last page, normally including \V{caption} and \V{conthead} templates \\
+ \V{head} & setting all of \V{firsthead}, \V{middlehead} and \V{lasthead} \\
+ \V{firstfoot} & table foot on the first page, normally including \V{contfoot} template \\
+ \V{middlefoot} & table foot on middle pages, normally including \V{contfoot} template \\
+ \V{lastfoot} & table foot on the last page, normally including \V{note} and \V{remark} templates \\
+ \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.
+
+\subsection{Continuation Templates}
+
+Let us have a look at the code for defining templates of continuation text first:
+
+\begin{codehigh}
+\DefTblrTemplate{contfoot-text}{normal}{Continued on next page}
+\SetTblrTemplate{contfoot-text}{normal}
+\DefTblrTemplate{conthead-text}{normal}{(Continued)}
+\SetTblrTemplate{conthead-text}{normal}
+\end{codehigh}
+
+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!.
+Therefore you had better use another name when defining new templates.
+
+If you use \verb!default! as template name in \verb!\DefTblrTemplate!,
+you define and set it as default at the same time.
+Therefore the above code can be written in another way:
+
+\begin{codehigh}
+\DefTblrTemplate{contfoot-text}{default}{Continued on next page}
+\DefTblrTemplate{conthead-text}{default}{(Continued)}
+\end{codehigh}
+
+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.
+But you can also handle user settings such as horizontal alignment here.
+
+\begin{codehigh}
+\DefTblrTemplate{contfoot}{default}{\UseTblrTemplate{contfoot-text}{default}}
+\DefTblrTemplate{conthead}{default}{\UseTblrTemplate{conthead-text}{default}}
+\end{codehigh}
+
+\subsection{Caption Templates}
+
+Normally a caption consists of three parts, and their templates are defined with the follow code:
+
+\begin{codehigh}
+\DefTblrTemplate{caption-tag}{default}{Table\hspace{0.25em}\thetable}
+\DefTblrTemplate{caption-sep}{default}{:\enskip}
+\DefTblrTemplate{caption-text}{default}{\InsertTblrText{caption}}
+\end{codehigh}
+
+The command \verb!\InsertTblrText{caption}! inserts the value of \verb!caption! key,
+which you could write in the optional argument of \verb!longtblr! environment.
+
+The \verb!caption! template normally includes three sub templates with \verb!\UseTblrTemplate! commands:
+The \verb!caption! template will be used in \verb!firsthead! template.
+
+\begin{codehigh}
+\DefTblrTemplate{caption}{default}{
+ \UseTblrTemplate{caption-tag}{default}
+ \UseTblrTemplate{caption-sep}{default}
+ \UseTblrTemplate{caption-text}{default}
+}
+\end{codehigh}
+
+Furthermore \verb!capcont! template includes \verb!conthead! template as well.
+The \verb!capcont! template will be used in \verb!middlehead! and \verb!lasthead! templates.
+
+\begin{codehigh}
+\DefTblrTemplate{capcont}{default}{
+ \UseTblrTemplate{caption-tag}{default}
+ \UseTblrTemplate{caption-sep}{default}
+ \UseTblrTemplate{caption-text}{default}
+ \UseTblrTemplate{conthead}{default}
+}
+\end{codehigh}
+
+\subsection{Note and Remark Templates}
+
+The templates for table notes can be defined like this:
+
+\begin{codehigh}
+\DefTblrTemplate{note-tag}{default}{\textsuperscript{\InsertTblrNoteTag}}
+\DefTblrTemplate{note-sep}{default}{\space}
+\DefTblrTemplate{note-text}{default}{\InsertTblrNoteText}
+\end{codehigh}
+\begin{codehigh}
+\DefTblrTemplate{note}{default}{
+ \MapTblrNotes{
+ \noindent
+ \UseTblrTemplate{note-tag}{default}
+ \UseTblrTemplate{note-sep}{default}
+ \UseTblrTemplate{note-text}{default}
+ \par
+ }
+}
+\end{codehigh}
+
+The \verb!\MapTblrNotes! command loops for all table notes,
+which are written in the optional argument of \verb!longtblr! environment.
+Inside the loop, you can use \verb!\InsertTblrNoteTag! and \verb!\InsertTblrNoteText!
+commands to insert current note tag and note text, respectively.
+
+The definition of remark templates are similar to note templates.
+\nopagebreak
+\begin{codehigh}
+\DefTblrTemplate{remark-tag}{default}{\InsertTblrRemarkTag}
+\DefTblrTemplate{remark-sep}{default}{:\space}
+\DefTblrTemplate{remark-text}{default}{\InsertTblrRemarkText}
+\end{codehigh}
+\begin{codehigh}
+\DefTblrTemplate{remark}{default}{
+ \MapTblrRemarks{
+ \noindent
+ \UseTblrTemplate{remark-tag}{default}
+ \UseTblrTemplate{remark-sep}{default}
+ \UseTblrTemplate{remark-text}{default}
+ \par
+ }
+}
+\end{codehigh}
+
+\subsection{Head and Foot Templates}
+
+The templates for table heads and foots are defined as including other templates:
+
+\begin{codehigh}
+\DefTblrTemplate{firsthead}{default}{
+ \UseTblrTemplate{caption}{default}
+}
+\DefTblrTemplate{middlehead,lasthead}{default}{
+ \UseTblrTemplate{capcont}{default}
+}
+\DefTblrTemplate{firstfoot,middlefoot}{default}{
+ \UseTblrTemplate{contfoot}{default}
+}
+\DefTblrTemplate{lastfoot}{default}{
+ \UseTblrTemplate{note}{default}
+ \UseTblrTemplate{remark}{default}
+}
+\end{codehigh}
+
+Note that you can define the same template for multiple elements in \verb!\DefTblrTemplate! command.
+
+\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},
+ 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.}
+]{}
+ Key Name & Key Description \\
+ \underline{\K{fg}} & foreground color \\
+ \underline{\K{font}} & font commands \\
+ \underline{\K{halign}} & horizontal alignment: \V{l} (left), \V{c} (center), or \V{r} (right) \\
+ \K{indent} & parindent value \\
+ \K{hang} & hangindent value \\
+\end{spectblr}
+
+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.
+In contrast, \verb!\ExpTblrTemplate{element}{default}! will only include template code.
+
+\section{Define Themes}
+
+You may define your own themes for table heads and foots with \verb!\NewTblrTheme! command.
+a theme consists of some template and style settings. For example:
+\nopagebreak
+\begin{codehigh}
+\NewTblrTheme{fancy}{
+ \DefTblrTemplate{conthead}{default}{[Continued]}
+ \SetTblrStyle{firsthead}{font=\bfseries}
+ \SetTblrStyle{firstfoot}{fg=blue2}
+ \SetTblrStyle{middlefoot}{\itshape}
+ \SetTblrStyle{caption-tag}{red2}
+}
+\end{codehigh}
+
+After defining the theme \verb!fancy!, you can use it
+by writing \verb!theme=fancy! in the optional argument of \verb!longtblr! environment.
+
+\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}}
+
+When you write \verb!\UseTblrLibrary{booktabs}!,
+\verb!tabularray! package will define commands \verb!\toprule!, \verb!\midrule!,
+\verb!\bottomrule! and \verb!\cmidrule! inside \verb!tblr! environment.
+
+\begin{demohigh}
+\begin{tblr}{llll}
+\toprule
+ Alpha & Beta & Gamma & Delta \\
+\midrule
+ Epsilon & Zeta & Eta & Theta \\
+\cmidrule{1-3}
+ Iota & Kappa & Lambda & Mu \\
+\cmidrule{2-4}
+ Nu & Xi & Omicron & Pi \\
+\bottomrule
+\end{tblr}
+\end{demohigh}
+
+At this moment, \verb!trim! options for \verb!\cmidrule! command are not supported.
+But rule colors are possible just like \verb!\hline! and \verb!\cline! commands.
+
+\begin{demohigh}
+\begin{tblr}{llll}
+\toprule[purple3]
+ Alpha & Beta & Gamma & Delta \\
+\midrule[blue3]
+ Epsilon & Zeta & Eta & Theta \\
+\cmidrule[azure3]{1-3}
+ Iota & Kappa & Lambda & Mu \\
+\cmidrule[azure3]{2-4}
+ Nu & Xi & Omicron & Pi \\
+\bottomrule[purple3]
+\end{tblr}
+\end{demohigh}
+
+\section{Library \V{diagbox}}
+
+When writing \verb!\UseTblrLibrary{diagbox}! in the preamble of the document,
+\verb!tabularray! package loads \verb!diagbox! package,
+and you can use \verb!\diagbox! and \verb!\diagboxthree! commands inside \verb!tblr! environment.
+
+\begin{demohigh}
+\begin{tblr}{hlines,vlines}
+ \diagbox{Aa}{Pp} & Beta & Gamma \\
+ Epsilon & Zeta & Eta \\
+ Iota & Kappa & Lambda \\
+\end{tblr}
+\end{demohigh}
+
+\begin{demohigh}
+\begin{tblr}{hlines,vlines}
+ \diagboxthree{Aa}{Pp}{Hh} & Beta & Gamma \\
+ Epsilon & Zeta & Eta \\
+ Iota & Kappa & Lambda \\
+\end{tblr}
+\end{demohigh}
+
+You can also use \verb!\diagbox! and \verb!\diagboxthree! commands in math mode.
+\nopagebreak
+\begin{demohigh}
+$\begin{tblr}{|c|cc|}
+\hline
+ \diagbox{X_1}{X_2} & 0 & 1 \\
+\hline
+ 0 & 0.1 & 0.2 \\
+ 1 & 0.3 & 0.4 \\
+\hline
+\end{tblr}$
+\end{demohigh}
+
+\section{Library \V{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.
+
+\begin{demohigh}
+\begin{tblr}{
+ hlines, vlines,
+ colspec={
+ S[table-format=2.2]
+ S[table-format=2.2]
+ S[table-format=2.2]
+ }
+}
+ {{{Head}}} & {{{Head}}} & {{{Head}}} \\
+ 11 & 11 & 11 \\
+ 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.
+
+\begin{demohigh}
+\begin{tblr}{
+ hlines, vlines,
+ colspec={
+ Q[si={table-format=2.2},blue7]
+ Q[si={table-format=2.2},teal7]
+ Q[si={table-format=2.2},purple7]
+ }
+}
+ {{{Head}}} & {{{Head}}} & {{{Head}}} \\
+ 11 & 11 & 11 \\
+ 2.1 & 2.2 & 2.3 \\
+ 33.11 & 33.22 & 33.33 \\
+\end{tblr}
+\end{demohigh}
+
+\chapter{The Source Code}
%\CodeHigh{lite}
\dochighinput[language=latex/latex3]{tabularray.sty}