summaryrefslogtreecommitdiff
path: root/macros/latex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-03-11 03:00:51 +0000
committerNorbert Preining <norbert@preining.info>2021-03-11 03:00:51 +0000
commit8379a45cf223651b1c06ebf5c680db900d83c6a5 (patch)
tree38feea3589200f62c13997bfe3954ce9359e83cb /macros/latex
parentf808c98da8e34907b93b8b1c2ef473539b88c504 (diff)
CTAN sync 202103110300
Diffstat (limited to 'macros/latex')
-rw-r--r--macros/latex/contrib/easybook/doc/appendix.tex (renamed from macros/latex/contrib/easybook/doc/pages/appendix.tex)0
-rw-r--r--macros/latex/contrib/easybook/doc/chapter1.tex (renamed from macros/latex/contrib/easybook/doc/pages/chapter1.tex)0
-rw-r--r--macros/latex/contrib/easybook/doc/chapter2.tex (renamed from macros/latex/contrib/easybook/doc/pages/chapter2.tex)4
-rw-r--r--macros/latex/contrib/easybook/doc/chapter3.tex (renamed from macros/latex/contrib/easybook/doc/pages/chapter3.tex)0
-rw-r--r--macros/latex/contrib/easybook/doc/easybook-demo.pdfbin290244 -> 290263 bytes
-rw-r--r--macros/latex/contrib/easybook/doc/easybook-demo.tex10
-rw-r--r--macros/latex/contrib/easybook/doc/easybook.pdfbin234909 -> 234637 bytes
-rw-r--r--macros/latex/contrib/easybook/doc/easybook.tex22
-rw-r--r--macros/latex/contrib/easybook/doc/refs.bib (renamed from macros/latex/contrib/easybook/doc/ref/refs.bib)0
-rw-r--r--macros/latex/contrib/easybook/easybook.cls77
-rw-r--r--macros/latex/contrib/mindflow/README.md15
-rw-r--r--macros/latex/contrib/mindflow/mindflow.dtx206
-rw-r--r--macros/latex/contrib/mindflow/mindflow.ins54
-rw-r--r--macros/latex/contrib/mindflow/mindflow.pdfbin0 -> 123615 bytes
-rw-r--r--macros/latex/contrib/newverbs/README2
-rw-r--r--macros/latex/contrib/newverbs/newverbs.dtx27
-rw-r--r--macros/latex/contrib/newverbs/newverbs.pdfbin221177 -> 221688 bytes
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix-french.pdfbin420606 -> 424997 bytes
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix-french.tex652
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix.dtx1810
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix.pdfbin1133328 -> 1166775 bytes
21 files changed, 1935 insertions, 944 deletions
diff --git a/macros/latex/contrib/easybook/doc/pages/appendix.tex b/macros/latex/contrib/easybook/doc/appendix.tex
index e05362d02d..e05362d02d 100644
--- a/macros/latex/contrib/easybook/doc/pages/appendix.tex
+++ b/macros/latex/contrib/easybook/doc/appendix.tex
diff --git a/macros/latex/contrib/easybook/doc/pages/chapter1.tex b/macros/latex/contrib/easybook/doc/chapter1.tex
index fa4dfb8869..fa4dfb8869 100644
--- a/macros/latex/contrib/easybook/doc/pages/chapter1.tex
+++ b/macros/latex/contrib/easybook/doc/chapter1.tex
diff --git a/macros/latex/contrib/easybook/doc/pages/chapter2.tex b/macros/latex/contrib/easybook/doc/chapter2.tex
index 01bfdf7dc2..4cf3e8113c 100644
--- a/macros/latex/contrib/easybook/doc/pages/chapter2.tex
+++ b/macros/latex/contrib/easybook/doc/chapter2.tex
@@ -26,9 +26,9 @@
\index{d@定理!s@Stokes formula}
Let $\Gamma$ be a piecewise smooth directed closed curve, $\Sigma$ is a piecewise smooth directed surface bounded by $\Gamma$, the side of $\Gamma$ and the positive direction of $\Sigma$ According to the right-hand rule, if the function $P(x,y,z)$, $Q(x,y,z)$, $R(x,y,z)$ has a first-order continuous deviation on the curve $\Sigma$ Derivative, then
\begin{multline}
- \iint_\Sigma\left(\frac{\partial R}{\partial y} - \frac{\partial Q}{\partial z}\right)\mathrm{d}y\mathrm{d}z + \left(\frac{\partial P}{\partial z} - \frac{\partial R}{\partial x}\right)\mathrm{d}z\mathrm{d}x + \left(\frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y}\right)\mathrm{d}x\mathrm{d}y
+ \iint_\Sigma\left(\frac{\partial R}{\partial y} - \frac{\partial Q}{\partial z}\right)\mathrm{d}y\mathrm{d}z + \left(\frac{\partial P}{\partial z} - \frac{\partial R}{\partial x}\right)\mathrm{d}z\mathrm{d}x
\\
- = \oint_\Gamma P\mathrm{d}x + Q\mathrm{d}y + R\mathrm{d}z
+ + \left(\frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y}\right)\mathrm{d}x\mathrm{d}y = \oint_\Gamma P\mathrm{d}x + Q\mathrm{d}y + R\mathrm{d}z
\end{multline}
The Stokes formula is an extension of the basic calculus formula in the case of surface integration. It is also an extension of the Green formula. This formula gives the second type of surface integral on the surface block and the second type of curve on the boundary curve Link between points.
\end{definition}
diff --git a/macros/latex/contrib/easybook/doc/pages/chapter3.tex b/macros/latex/contrib/easybook/doc/chapter3.tex
index 3d0a88bb1f..3d0a88bb1f 100644
--- a/macros/latex/contrib/easybook/doc/pages/chapter3.tex
+++ b/macros/latex/contrib/easybook/doc/chapter3.tex
diff --git a/macros/latex/contrib/easybook/doc/easybook-demo.pdf b/macros/latex/contrib/easybook/doc/easybook-demo.pdf
index ae62d0c279..22cc5d8266 100644
--- a/macros/latex/contrib/easybook/doc/easybook-demo.pdf
+++ b/macros/latex/contrib/easybook/doc/easybook-demo.pdf
Binary files differ
diff --git a/macros/latex/contrib/easybook/doc/easybook-demo.tex b/macros/latex/contrib/easybook/doc/easybook-demo.tex
index e33a779991..697baf76b9 100644
--- a/macros/latex/contrib/easybook/doc/easybook-demo.tex
+++ b/macros/latex/contrib/easybook/doc/easybook-demo.tex
@@ -98,7 +98,7 @@
\github~\url{https://github.com/texl3/easybook} \\
\edge~\url{https://latexstudio.net}
}
-\date{2021/03/09\hskip\ccwd\relax v1.23l}
+\date{2021/03/10\hskip\ccwd\relax v1.23m}
\frontmatter[roman]
\maketitle
@@ -106,10 +106,10 @@
\mainmatter*
\part{使用示例}
-\include{pages/chapter1}
-\include{pages/chapter2}
-\include{pages/chapter3}
-\include{pages/appendix}
+\include{chapter1}
+\include{chapter2}
+\include{chapter3}
+\include{appendix}
\backmatter
\printbibliography
diff --git a/macros/latex/contrib/easybook/doc/easybook.pdf b/macros/latex/contrib/easybook/doc/easybook.pdf
index ca56aed0fa..9809242c07 100644
--- a/macros/latex/contrib/easybook/doc/easybook.pdf
+++ b/macros/latex/contrib/easybook/doc/easybook.pdf
Binary files differ
diff --git a/macros/latex/contrib/easybook/doc/easybook.tex b/macros/latex/contrib/easybook/doc/easybook.tex
index 0ed2640a8e..2db86a5b56 100644
--- a/macros/latex/contrib/easybook/doc/easybook.tex
+++ b/macros/latex/contrib/easybook/doc/easybook.tex
@@ -3,7 +3,7 @@
\title{\sffamily easybook书籍文档类}
\author{瞿毅}
-\date{2021/03/09\hskip\ccwd\relax v1.23l\thanks{\url{https://gitee.com/texl3/easybook}}}
+\date{2021/03/10\hskip\ccwd\relax v1.23m\thanks{\url{https://gitee.com/texl3/easybook}}}
\begin{document}
\maketitle
@@ -98,7 +98,7 @@
\tn{frontmatter}\oarg{编号格式|(Roman)}
\tn{printindex}\oarg{索引名}
\end{syntax}
-\changes{v1.23l}{2021/02/20}{重新定义文档结构划分命令。}
+\changes{v1.23m}{2021/02/20}{重新定义文档结构划分命令。}
\tn{frontmatter} 为前言区命令,章标题不编号,页码可设置为例如 \opt{roman}、\opt{Alph} 等格式,带有星号的命令 \tn{frontmatter*} 不使用 \tn{cleardoublepage}。\tn{mainmatter} 为主文区命令,章标题正常编号且页码为从1开始计数的阿拉伯数字,\tn{mainmatter*} 命令不使用 \tn{cleardoublepage}。\tn{backmatter} 为后记区命令,页码格式与编号保持不变,章标题不编号。\tn{listoffigures} 命令输出图片目录,\tn{listoftables} 命令输出表格目录,\tn{listoflistings} 命令输出代码目录。
\end{function}
@@ -132,8 +132,8 @@
uppercase = <(true)|false>
\end{syntax}
\changes{v1.10}{2021/01/08}{更改颜色实现方式与选项名。}
-\changes{v1.23l}{2021/02/02}{noto风格的数学字体独立出来,可自定义设置。}
-\changes{v1.23l}{2021/02/09}{增加控制页面横线粗细的选项。}
+\changes{v1.23m}{2021/02/02}{noto风格的数学字体独立出来,可自定义设置。}
+\changes{v1.23m}{2021/02/09}{增加控制页面横线粗细的选项。}
\opt{style} 选项控制文章的风格。
\end{function}
@@ -190,7 +190,7 @@
footnote = <(1)>
\end{syntax}
\changes{v1.21}{2021/01/12}{增加脚注线间的距离选项。}
-\changes{v1.23l}{2021/02/09}{取消使用 \pkg{zhlineskip} 宏包设置数学间距。}
+\changes{v1.23m}{2021/02/09}{取消使用 \pkg{zhlineskip} 宏包设置数学间距。}
行距因子用于设置各种行距倍数,只能是浮点数,不能带有长度单位。\tn{ctexset} 原有的行距选项\opt{linespread}失效。各行距既可在导言区全局设置也可正文中设置对后面生效,行距的意义为
\end{function}
@@ -212,7 +212,7 @@
marginpart = <\tn{rmfamily}\tn{footnotesize}>
\end{syntax}
\changes{v1.10}{2021/01/08}{加入自定义非正文字体选项。}
-\changes{v1.23l}{2021/02/08}{修复使用 \tn{zihao} 命令设置字体失效的问题。}
+\changes{v1.23m}{2021/02/08}{修复使用 \tn{zihao} 命令设置字体失效的问题。}
\end{function}
\begin{optdesc}
@@ -229,18 +229,18 @@
backend = <(bibtex)|biblatex>
bib-style = <(numerical)|authoryear|其它格式>
cite-style = <标注风格>
- bibfile = <ref/refs.bib>
+ bibfile = <refs.bib>
\tn{printbibliography}\oarg{选项列表}
\end{syntax}
\changes{v1.21}{2021/01/11}{增加 \opt{bibset} 选项,可以使用 \hologo{BibTeX} 或 \hologo{biber} 编译参考文献。}
-\changes{v1.23l}{2021/02/23}{使用 \opt{bibset} 选项时可设置标注风格。}
+\changes{v1.23m}{2021/02/23}{使用 \opt{bibset} 选项时可设置标注风格。}
\end{function}
\begin{optdesc}
\item[backend] 参考文献处理后端,默认用传统的 \hologo{BibTeX} 处理参考文献。
\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[bibfile] 参考文献的数据文件,使用 \hologo{biber} 处理时要带有 \opt{bib} 后缀,默认为一个在 \opt{ref} 文件夹中以 \opt{refs.bib} 命名的文件。
+ \item[bibfile] 参考文献的数据文件,使用 \hologo{biber} 处理时要带有 \opt{bib} 后缀,默认为一个以 \opt{refs.bib} 命名的文件。
\item[\tn{printbibliography}] 两种方式\textbf{均使用}此命令打印参考文献,其中可选项仅在 \hologo{biber} 处理时有效。
\end{optdesc}
@@ -317,7 +317,7 @@
\end{syntax}
\changes{v1.21}{2021/01/11}{修复单面文档时页眉横线消失的问题。}
\changes{v1.21}{2021/01/13}{增加配置页眉页脚的选项。}
-\changes{v1.23l}{2021/03/08}{优化页眉页脚设置,增加 \opt{chap-mark} 和 \opt{sec-mark} 选项。}
+\changes{v1.23m}{2021/03/08}{优化页眉页脚设置,增加 \opt{chap-mark} 和 \opt{sec-mark} 选项。}
\opt{hdrset} 设置的命令由 \pkg{fancyhdr} 宏包提供支持,命令 \tn{easyhead} 和 \tn{easyfoot} 的含义与 \tn{fancyhead} 和 \tn{fancyfoot} 相同,它们用于 \opt{head-foot} 选项中,设置的是一个名为 \opt{fancy} 的页面风格。\pkg{fancyhdr} 将页眉页脚分成了左中右和奇数页(odd)、偶数页(even)共12个部分,可选参数中E、O代表偶数、奇数,L、C、R代表左、中、右部分。单面打印时,含有偶数的选项无效。
\begin{ctexexam}
\ctexset
@@ -438,7 +438,7 @@
\tn{item} <习题内容>
\tn{end}\marg{exercise}
\end{syntax}
-\changes{v1.23l}{2021/02/08}{增加准确的习题盒子标题目录锚点。}
+\changes{v1.23m}{2021/02/08}{增加准确的习题盒子标题目录锚点。}
习题环境 \opt{exercise} 的标题紧接上一节编号并加入目录与页眉,当使用星号环境时不进行编号。三个可选参数中颜色为自定义或 \pkg{xcolor} 包含的颜色名称,正文编号格式与小节 \ref{sort list} 排序列表相同,标题名默认为摘要,参数只能\textbf{从右往左}省略。
\begin{ctexexam}
\begin{exercise}[LightYellow][1.][习题]
diff --git a/macros/latex/contrib/easybook/doc/ref/refs.bib b/macros/latex/contrib/easybook/doc/refs.bib
index 01b14bd82c..01b14bd82c 100644
--- a/macros/latex/contrib/easybook/doc/ref/refs.bib
+++ b/macros/latex/contrib/easybook/doc/refs.bib
diff --git a/macros/latex/contrib/easybook/easybook.cls b/macros/latex/contrib/easybook/easybook.cls
index a502518987..055b403aed 100644
--- a/macros/latex/contrib/easybook/easybook.cls
+++ b/macros/latex/contrib/easybook/easybook.cls
@@ -9,7 +9,7 @@
%% https://creativecommons.org/licenses/by/4.0/legalcode
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{l3keys2e}
-\ProvidesExplClass{easybook}{2021/03/09}{1.23l}{}
+\ProvidesExplClass{easybook}{2021/03/10}{1.23m}{}
\cs_generate_variant:Nn \keys_define:nn {nx}
\cs_generate_variant:Nn \int_to_arabic:n {v}
@@ -425,25 +425,25 @@
part/rule .tl_set:N = \l__toc_part_rule_tl,
part/rule .initial:n = \tocrule{}[\bfseries],
- chapter/format .tl_set:N = \l__toc_chap_format_tl,
+ chapter/format .tl_set:N = \l__toc_chapter_format_tl,
chapter/format .initial:n = \addvspace{1pc}\sffamily\large,
- chapter/indent .tl_set:N = \l__toc_chap_indent_tl,
+ chapter/indent .tl_set:N = \l__toc_chapter_indent_tl,
chapter/indent .initial:n = 0\ccwd,
- chapter/rule .tl_set:N = \l__toc_chap_rule_tl,
+ chapter/rule .tl_set:N = \l__toc_chapter_rule_tl,
chapter/rule .initial:n = \tocrule{$\cdot$}[\bfseries],
- section/format .tl_set:N = \l__toc_sec_format_tl,
+ section/format .tl_set:N = \l__toc_section_format_tl,
section/format .initial:n = \addvspace{0.35pc},
- section/indent .tl_set:N = \l__toc_sec_indent_tl,
+ section/indent .tl_set:N = \l__toc_section_indent_tl,
section/indent .initial:n = 1.5\ccwd,
- section/rule .tl_set:N = \l__toc_sec_rule_tl,
+ section/rule .tl_set:N = \l__toc_section_rule_tl,
section/rule .initial:n = \tocrule{$\cdot$},
- subsection/format .tl_set:N = \l__toc_subsec_format_tl,
+ subsection/format .tl_set:N = \l__toc_subsection_format_tl,
subsection/format .initial:n = \addvspace{0.35pc},
- subsection/indent .tl_set:N = \l__toc_subsec_indent_tl,
+ subsection/indent .tl_set:N = \l__toc_subsection_indent_tl,
subsection/indent .initial:n = 3.8\ccwd,
- subsection/rule .tl_set:N = \l__toc_subsec_rule_tl,
+ subsection/rule .tl_set:N = \l__toc_subsection_rule_tl,
subsection/rule .initial:n = \tocrule{$\cdot$},
lists/format .tl_set:N = \l__toc_lists_format_tl,
@@ -466,35 +466,24 @@
\normalsize\normalfont
\titlerule*[#1]{\scalebox{#2}{#3}}#4\contentspage
}
-\titlecontents{part}
- [\l__toc_part_indent_tl]
- {\l__toc_part_format_tl}{}{}
- {\l__toc_part_rule_tl}
-\titlecontents{chapter}
- [\l__toc_chap_indent_tl]
- {\l__toc_chap_format_tl}{}{}
- {\l__toc_chap_rule_tl}
-\titlecontents{section}
- [\l__toc_sec_indent_tl]
- {\l__toc_sec_format_tl}{}{}
- {\l__toc_sec_rule_tl}
-\titlecontents{subsection}
- [\l__toc_subsec_indent_tl]
- {\l__toc_subsec_format_tl}{}{}
- {\l__toc_subsec_rule_tl}
-\titlecontents{figure}
- [\l__toc_lists_indent_tl]
- {\l__toc_lists_format_tl}{}{}
- {\l__toc_lists_rule_tl}
-\titlecontents{table}
- [\l__toc_lists_indent_tl]
- {\l__toc_lists_format_tl}{}{}
- {\l__toc_lists_rule_tl}
+\cs_new_protected:Npn \__titlecontents_set:nn #1#2
+ {
+ \titlecontents{#1}
+ [\use:c {l__toc_#2_indent_tl}]
+ {\use:c {l__toc_#2_format_tl}}{}{}
+ {\use:c {l__toc_#2_rule_tl}}
+ }
\contentsuse{lstlisting}{lol}
-\titlecontents{lstlisting}
- [\l__toc_lists_indent_tl]
- {\l__toc_lists_format_tl}{}{}
- {\l__toc_lists_rule_tl}
+\clist_map_inline:nn
+ {
+ {part}{part},
+ {chapter}{chapter},
+ {section}{section},
+ {subsection}{subsection},
+ {figure}{lists},
+ {table}{lists},
+ {lstlisting}{lists}
+ }{\__titlecontents_set:nn #1}
\ctex_patch_cmd:Nnn \caption@@@addcontentsline
{\addcontentsline{#1}{#2}{\protect\numberline{#3}{#4}}}
{\addcontentsline{#1}{#2}{#3\hspace{\ccwd}#4}}
@@ -763,7 +752,7 @@
\skip_set:Nn \plitemsep{.75ex plus .1ex}
\skip_set:Nn \plparsep{0ex}
-\cs_new_protected:Npn \__thmname_set:n #1#2
+\cs_new_protected:Npn \__thmname_set:nn #1#2
{\tl_const:cn {c__name_#1_tl}{#2}}
\bool_if:NTF \l__lang_chinese_bool
{
@@ -777,7 +766,7 @@
{example}{例},
{remark}{注},
{exercise}{练习}
- }{\__thmname_set:n #1}
+ }{\__thmname_set:nn #1}
}{
\clist_map_inline:nn
{
@@ -789,7 +778,7 @@
{example}{Example},
{remark}{Remark},
{exercise}{Exercise}
- }{\__thmname_set:n #1}
+ }{\__thmname_set:nn #1}
}
\bool_new:N \l__thmbox_bool
@@ -1070,7 +1059,7 @@
cite-style .code:n =
{\tl_set:Nn \l__bib_citestyle_tl{#1}},
bibfile .tl_set:N = \l__bib_file_tl,
- bibfile .initial:n = ref/refs.bib
+ bibfile .initial:n = refs.bib
}
\cs_new_protected:Npn \__bibtex_set:
@@ -1274,7 +1263,7 @@
{skyblue, 0000ff,004986,eb6877},
{crimson, dc143c,00c1c9,afcd20}
}
- \__linkcolor_set:n,
+ \__linkcolor_set:n
linkcolor .default:n = fresh,
linkcolor .initial:n = fresh,
@@ -1295,7 +1284,7 @@
{energy, f39800,00a0e9,893895},
{cyberpunk, 601986,eb6877,a4005b}
}
- \__themecolor_set:n,
+ \__themecolor_set:n
color .initial:n = none
}
diff --git a/macros/latex/contrib/mindflow/README.md b/macros/latex/contrib/mindflow/README.md
new file mode 100644
index 0000000000..1a62ed0956
--- /dev/null
+++ b/macros/latex/contrib/mindflow/README.md
@@ -0,0 +1,15 @@
+# The mindflow package
+
+This package provides an environment that is separated from the main text and
+has its own line numbers, for writing ideas or annotations.
+
+# License
+
+This file may be distributed and/or modified under the conditions of the LaTeX
+Project Public License, either version 1.3 of this license or (at your option)
+any later version. The latest version of this license is in:
+
+ http://www.latex-project.org/lppl.txt
+
+and version 1.3 or later is part of all distributions of LaTeX version
+2005/12/01 or later.
diff --git a/macros/latex/contrib/mindflow/mindflow.dtx b/macros/latex/contrib/mindflow/mindflow.dtx
new file mode 100644
index 0000000000..6f193ab5df
--- /dev/null
+++ b/macros/latex/contrib/mindflow/mindflow.dtx
@@ -0,0 +1,206 @@
+% \iffalse meta-comment
+%
+% Copyright (C) 2021 by Jinwen XU
+% -------------------------------
+%
+% This file may be distributed and/or modified under the conditions of the LaTeX
+% Project Public License, either version 1.3 of this license or (at your option)
+% any later version. The latest version of this license is in:
+%
+% http://www.latex-project.org/lppl.txt
+%
+% and version 1.3 or later is part of all distributions of LaTeX version
+% 2005/12/01 or later.
+%
+% \fi
+%
+% \iffalse
+%<*driver>
+\ProvidesFile{mindflow.dtx}
+%</driver>
+%<package>\NeedsTeXFormat{LaTeX2e}
+%<package>\ProvidesPackage{mindflow}
+%<*package>
+ [2021/03/09 Mindflow environment]
+%</package>
+%
+%<*driver>
+\documentclass{article}
+\usepackage{doc}
+\usepackage[a4paper,margin=1.8in]{geometry}
+\usepackage{titling}
+\setlength{\droptitle}{-.5in}
+\usepackage[linenumber,rightmarker]{mindflow}
+\usepackage{enumitem}
+\setlist{noitemsep}
+\usepackage{newpxtext}
+\usepackage{parskip}
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+\begin{document}
+ \DocInput{mindflow.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \CheckSum{0}
+%
+% \GetFileInfo{mindflow.dtx}
+%
+%
+% \title{The {\normalfont\textsf{mindflow}} package}
+% \author{\scshape Jinwen Xu}
+% \date{\filedate}
+%
+% \maketitle
+%
+% \section{Introduction}
+%
+% The \textsf{mindflow} package provides you a way to write your ideas,
+% annotations or writing plans. For example (with option
+% \verb|linenumber| and \verb|rightmarker|):
+% \begin{mindflow}
+% What to write next:
+% \begin{itemize}
+% \item usage;
+% \item some internal macros;
+% \item the complete code.
+% \end{itemize}
+% \end{mindflow}
+%
+% \section{Usage}
+%
+% Simply load the package with \verb|\usepackage{mindflow}|. By default
+% it has no line numbers or markers. You can use the following options:
+%
+% \begin{tabular}{ll}
+% \verb|linenumber| & Enable line numbers\\
+% \verb|leftmarker| & Enable left marker, by default it is a ``\verb|*|''\\
+% \verb|rightmarker| & Enable right marker, by default it is a ``\verb|*|''\\
+% \verb|off| & Hide all the \verb|mindflow| environments
+% \end{tabular}
+%
+% \DescribeEnv{mindflow}
+% Then you can use the mindflow environment as
+% \begin{verbatim}
+% \begin{mindflow}
+% ...
+% \end{mindflow}
+% \end{verbatim}
+%
+% \section{Some technical details}
+%
+% \DescribeMacro{\mindflowFont}
+% \DescribeMacro{\mindflowNumFont}
+% The font for texts and line numbers within the \verb|mindflow|
+% environments can be specified by redefining \verb|\mindflowFont| and
+% \verb|\mindflowNumFont|. By default they are defined as:
+% \begin{verbatim}
+% \newcommand{\mindflowFont}{\normalfont\footnotesize}
+% \newcommand{\mindflowNumFont}{\normalfont\scriptsize\ttfamily}
+% \end{verbatim}
+% \DescribeMacro{\mindflowLeft}
+% \DescribeMacro{\mindflowRight}
+% The left and right marker can be changed by redefining
+% \verb|\mindflowLeft| and \verb|\mindflowRight|. Both have the default
+% value as ``\verb|*|''.
+%
+% And finally, the color of \verb|mindflow| environments is called
+% \verb|mindflow|. By default, it is the current text color with opacity
+% 30\%.
+%
+% \StopEventually{}
+%
+% \section{Implementation}
+% Below is the complete source code of this package.
+%
+% \begin{macrocode}
+\RequirePackage{kvoptions}
+\SetupKeyvalOptions{%
+ family = @mindflow,
+ prefix = @mindflow@
+}
+\DeclareBoolOption[false]{off} % Turn off mindflow
+\DeclareBoolOption[false]{leftmarker} % Left marker
+\DeclareBoolOption[false]{rightmarker} % Right marker
+\DeclareBoolOption[false]{linenumber} % Line numbers
+
+\ProcessKeyvalOptions*\relax
+
+%%================================
+%% Initialization
+%%================================
+\newcommand{\mindflowFont}{\normalfont\footnotesize}
+\newcommand{\mindflowNumFont}{\normalfont\scriptsize\ttfamily}
+
+\RequirePackage{lineno}
+\RequirePackage{xcolor}
+
+\colorlet{mfSavedColor}{.}
+\colorlet{mindflow}{mfSavedColor!30}
+
+\newcommand{\mindflowLeft}{%
+ \if@mindflow@leftmarker%
+ {*}%
+ \fi%
+}
+\newcommand{\mindflowRight}{%
+ \if@mindflow@rightmarker%
+ {*}%
+ \fi%
+}
+
+%%================================
+%% The mindflow environment
+%%================================
+\newif\ifLNturnsON
+
+\newcommand*{\mfSepLine}{%
+ \parskip=0pt
+ \LNturnsONfalse%
+ \ifLineNumbers\LNturnsONtrue\fi\nolinenumbers%
+ \par\noindent\nopagebreak%
+ \makebox[\linewidth]{\rule{\paperwidth}{0.4pt}}%
+ \nopagebreak\par%
+ \ifLNturnsON\linenumbers\fi%
+}
+
+\newcounter{recordLN}
+\newcounter{mfLN}
+\setcounter{mfLN}{1}
+
+\if@mindflow@off
+ \RequirePackage{verbatim}
+ \let\mindflow=\comment
+ \let\endmindflow=\endcomment
+\else
+ \newenvironment{mindflow}
+ {%
+ \setcounter{recordLN}{\value{linenumber}}
+ \setcounter{linenumber}{\value{mfLN}}
+ \LNturnsONfalse%
+ \ifLineNumbers\LNturnsONtrue\fi\nolinenumbers%
+ \mindflowFont\color{mindflow}%
+ \mfSepLine%
+ \linenumbers%
+ \renewcommand\makeLineNumber{%
+ \hss\color{mindflow!25}%
+ \if@mindflow@linenumber%
+ \mindflowNumFont\LineNumber~%
+ \fi%
+ \mindflowLeft\hspace{1em}\rlap{\hskip\textwidth\hspace{1em}\mindflowRight}%
+ }%
+ }
+ {%
+ \par%
+ \vspace{-.5\baselineskip}\mfSepLine%
+ \ifLNturnsON\linenumbers\fi%
+ \setcounter{mfLN}{\value{linenumber}}
+ \setcounter{linenumber}{\value{recordLN}}
+ }
+\fi
+% \end{macrocode}
+%
+% \Finale
+\endinput
diff --git a/macros/latex/contrib/mindflow/mindflow.ins b/macros/latex/contrib/mindflow/mindflow.ins
new file mode 100644
index 0000000000..fdc7beb6d7
--- /dev/null
+++ b/macros/latex/contrib/mindflow/mindflow.ins
@@ -0,0 +1,54 @@
+%%
+%% Copyright (C) 2021 by Jinwen XU
+%%
+%% This file may be distributed and/or modified under the conditions of
+%% the LaTeX Project Public License, either version 1.3 of this license
+%% or (at your option) any later version. The latest version of this
+%% license is in:
+%%
+%% http://www.latex-project.org/lppl.txt
+%%
+%% and version 1.3 or later is part of all distributions of LaTeX version
+%% 2005/12/01 or later.
+%%
+
+\input docstrip.tex
+\keepsilent
+\askforoverwritefalse
+
+\usedir{tex/latex/mindflow}
+
+\preamble
+
+Copyright (C) 2021 by Jinwen XU
+
+This file may be distributed and/or modified under the conditions of
+the LaTeX Project Public License, either version 1.3 of this license
+or (at your option) any later version. The latest version of this
+license is in:
+
+ http://www.latex-project.org/lppl.txt
+
+and version 1.3 or later is part of all distributions of LaTeX version
+2005/12/01 or later.
+
+\endpreamble
+
+\generate{\file{mindflow.sty}{\from{mindflow.dtx}{package}}}
+
+\obeyspaces
+\Msg{*************************************************************}
+\Msg{* *}
+\Msg{* To finish the installation you have to move the following *}
+\Msg{* file into a directory searched by TeX: *}
+\Msg{* *}
+\Msg{* mindflow.sty *}
+\Msg{* *}
+\Msg{* To produce the documentation run the file mindflow.dtx *}
+\Msg{* through LaTeX. *}
+\Msg{* *}
+\Msg{* Happy TeXing! *}
+\Msg{* *}
+\Msg{*************************************************************}
+
+\endbatchfile
diff --git a/macros/latex/contrib/mindflow/mindflow.pdf b/macros/latex/contrib/mindflow/mindflow.pdf
new file mode 100644
index 0000000000..4489a85570
--- /dev/null
+++ b/macros/latex/contrib/mindflow/mindflow.pdf
Binary files differ
diff --git a/macros/latex/contrib/newverbs/README b/macros/latex/contrib/newverbs/README
index 09968f8584..8d6c410c79 100644
--- a/macros/latex/contrib/newverbs/README
+++ b/macros/latex/contrib/newverbs/README
@@ -1,6 +1,6 @@
The 'newverbs' LaTeX package
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Copyright (c) 2010-2020 by Martin Scharrer <martin@scharrer-online.de>
+Copyright (c) 2010-2021 by Martin Scharrer <martin@scharrer-online.de>
Code repository: https://sourceforge.net/projects/newfloat/
This package allows the definition of \verb variants which add TeX code before
diff --git a/macros/latex/contrib/newverbs/newverbs.dtx b/macros/latex/contrib/newverbs/newverbs.dtx
index efc74a3981..8c22b0229d 100644
--- a/macros/latex/contrib/newverbs/newverbs.dtx
+++ b/macros/latex/contrib/newverbs/newverbs.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%<=*COPYRIGHT>
-%% Copyright (C) 2012-2020 by Martin Scharrer <martin@scharrer-online.de>
+%% Copyright (C) 2012-2021 by Martin Scharrer <martin@scharrer-online.de>
%% --------------------------------------------------------------------
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -23,10 +23,10 @@
%<*driver>
\ProvidesFile{newverbs.dtx}[%
%<=*DATE>
- 2010/09/02
+ 2021/01/06
%<=/DATE>
%<=*VERSION>
- v1.5
+ v1.6
%<=/VERSION>
newverbs DTX file]
\documentclass{ydoc}
@@ -70,6 +70,7 @@
% \changes{v1.3}{2011/07/24}{Added macros to collect verbatim arguments.}
% \changes{v1.4}{2019/09/09}{Added several suggested changes.}
% \changes{v1.5}{2020/09/02}{Added support for mathmode.}
+% \changes{v1.6}{2021/01/06}{Changed \cs{Verbdef} to define robust commands.}
%
% \DoNotIndex{\newcommand,\newenvironment,\providecommand}
%
@@ -88,13 +89,15 @@
%
% \subsection{Defining new variants of \cs{verb}}
%
-% \DescribeMacro\newverbcommand {<\textbackslash macro>}{<code before>}{<code after>}
-% \DescribeMacro\renewverbcommand {<\textbackslash macro>}{<code before>}{<code after>}
-% \DescribeMacro\provideverbcommand {<\textbackslash macro>}{<code before>}{<code after>}
-% This macros allow the definition of \cs{verb} variants. The verbatim content is processed using \cs{verb}, but the
-% variants can add \TeX\ code before and after it.
-% The three definition macros use |\newcommand*|, |\renewcommand*| and |\providecommand*| internally to define \meta{macro}, respectively.
-% Afterwards \meta{macro} can be used like \cs{verb}. The star version of \meta{macro} will use \cs{verb}|*|.
+% \DescribeMacro\newverbcommand {<\textbackslash macro>}[<\textbackslash verbmacro>]{<code before>}{<code after>}
+% \DescribeMacro\renewverbcommand {<\textbackslash macro>}[<\textbackslash verbmacro>]{<code before>}{<code after>}
+% \DescribeMacro\provideverbcommand {<\textbackslash macro>}[<\textbackslash verbmacro>]{<code before>}{<code after>}
+% This macros allow the definition of \cs{verb} variants.
+% The verbatim content is first processed using \meta{\textbackslash verbmacro} which defaults to \cs{verb}, then the
+% given \TeX\ code is added before and afterwards.
+% The three definition macros use |\newcommand*|, |\renewcommand*| and |\providecommand*| internally to define \meta{\textbackslash macro}, respectively.
+% Afterwards \meta{\textbackslash macro} can be used like \cs{verb}.
+% The star version of \meta{\textbackslash macro} will use \meta{\textbackslash verbmacro}|*| (default: \cs{verb}|*|).
%
% See the implementation of \cs{qverb} in section~\ref{sec:impl} for an example.
%
@@ -288,7 +291,7 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\new@verbcommand}[5]{underlying definition macro}{verb macro to be used}{macro to define}{code before}{code after}
+% \begin{macro}{\new@verbcommand}[5]{underlying definition macro}{macro to define}{verb macro to be used}{code before}{code after}
% The trailing code is inserted by patching \cs{verb@egroup} which is called by \cs{verb}
% after the verbatim content.
% \begin{macrocode}
@@ -760,7 +763,7 @@
% \begin{macro}{\@Verbdef}[2]{<star or empty>}{<macro to be defined>}
% \begin{macrocode}
\def\@Verbdef#1#2{%
- \Collectverb#1{\def#2}%
+ \Collectverb#1{\DeclareRobustCommand#2}%
}
% \end{macrocode}
% \end{macro}
diff --git a/macros/latex/contrib/newverbs/newverbs.pdf b/macros/latex/contrib/newverbs/newverbs.pdf
index 6d914fab80..2e8c79c684 100644
--- a/macros/latex/contrib/newverbs/newverbs.pdf
+++ b/macros/latex/contrib/newverbs/newverbs.pdf
Binary files differ
diff --git a/macros/latex/contrib/nicematrix/nicematrix-french.pdf b/macros/latex/contrib/nicematrix/nicematrix-french.pdf
index 7c58a0449c..21154fbe67 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 75a1954df9..9ae1a3a8ab 100644
--- a/macros/latex/contrib/nicematrix/nicematrix-french.tex
+++ b/macros/latex/contrib/nicematrix/nicematrix-french.tex
@@ -232,8 +232,8 @@ l'extension \pkg{nicematrix} propose deux clés |cell-space-top-limit| et
|cell-space-bottom-limit| qui sont similaires aux deux paramètres
|\cellspacetoplimit| et |\cellspacebottomlimit| proposés par \pkg{cellspace}.
-\colorbox{yellow!30}{Nouveau 5.9}\enskip Il existe aussi une clé
-|cell-space-limits| pour régler simultanément les deux paramètres.
+Il existe aussi une clé |cell-space-limits| pour régler simultanément les deux
+paramètres.
La valeur initiale de ces paramètres est $0$~pt pour que les environnements de
\pkg{nicematrix} aient par défaut le même comportement que ceux de \pkg{array}
@@ -409,7 +409,7 @@ Dans les environnements de \pkg{nicematrix}, on peut utiliser la commande
|\Block| pour placer un élément au centre d'un rectangle de cases fusionnées.
La commande |\Block| doit être utilisée dans la case supérieure gauche du bloc
-avec deux arguments.
+avec deux arguments obligatoires.
\begin{itemize}
\item Le premier argument est la taille de ce bloc avec la syntaxe $i$-$j$ où
@@ -500,10 +500,34 @@ $\begin{bNiceArray}{ccc|c}[margin]
\end{bNiceArray}$
+
+\interitem
+La commande |\Block| accepte en fait en premier argument optionnel (entre
+crochets) une liste de couples clé-valeur. Les clés sont les suivantes :
+\begin{itemize}
+\item les clés |l|, |c| et |r| réglent le positionnement horizontal comme dit
+précédemment ;
+\item la clé |fill| prend en argument une couleur et remplit le bloc avec cette
+couleur ;
+\item la clé |draw| prend en argument une couleur et trace le cadre avec cette
+couleur (la valeur par défaut de cette clé est la couleur courante des filets du
+tableau) ;
+\item la clé |color| prend en argument une couleur et l'applique au contenu et
+trace également le cadre avec cette couleur.
+\item la clé |line-width| fixe la largeur des filets servant pour le cadre (n'a
+d'intérêt que si |draw| est utilisée) ;
+\item \colorbox{yellow!50}{\textbf{Nouveau 5.12}}\enskip la clé
+|rounded-corners| impose des coins arrondis (pour le cadre dessiné par |draw| et
+le fond dessiné par |fill|) avec un rayon égal à la valeur de cette clé (la
+valeur par défaut est 4~pt\footnote{Cette valeur par défaut est la valeur
+ initiale des \emph{rounded corners} de Tikz.}).
+\end{itemize}
+
+
\interitem
\textbf{On doit remarquer que, par défaut, les blocs ne créent pas d'espace}. Il
n'y a exception que pour les blocs mono-rangée et les blocs mono-colonne comme
-expliqué juste après.
+expliqué plus loin.
\medskip
@@ -512,10 +536,11 @@ construction |wc{...}| de \pkg{array}).
\medskip
\begin{BVerbatim}
-\begin{NiceTabular}~emphase#{cwc{2cm}wc{3cm}c}@
+\begin{NiceTabular}{cwc{2cm}wc{3cm}c}
rose & tulipe & marguerite & dahlia \\
violette
-& \Block[draw=red,fill=red!15]{2-2}{\LARGE De très jolies fleurs} & & souci \\
+& ~emphase#\Block[draw=red,fill=red!15,rounded-corners]{2-2}{\LARGE De très jolies fleurs}@
+ & & souci \\
pervenche & & & lys \\
arum & iris & jacinthe & muguet
\end{NiceTabular}
@@ -526,20 +551,13 @@ arum & iris & jacinthe & muguet
\begin{center}
\begin{NiceTabular}{cwc{2cm}wc{3cm}c}
rose & tulipe & marguerite & dahlia \\
-violette & \Block[draw=red,fill=red!15]{2-2}{\LARGE De très jolies fleurs} & & souci \\
+violette & \Block[draw=red,fill=red!15,rounded-corners]{2-2}
+ {\LARGE De très jolies fleurs} & & souci \\
pervenche & & & lys \\
arum & iris & jacinthe & muguet
\end{NiceTabular}
\end{center}
-\medskip
-Comme on le voit sur cet exemple, on peut fixer la couleur de fond avec la clé
-|fill| et la couleur du cadre avec la clé |draw|\footnote{Si la clé |draw| est
- utilisée sans valeur, c'est la couleur par défaut des filets de tableaux qui
- est utilisée.}. On peut aussi fixer l'épaisseur du trait avec la clé
-|line-width|.
-
-
\subsection{Les blocs mono-colonne}
@@ -616,7 +634,8 @@ bloc sur plusieurs lignes.
la consigne générale donnée dans le préambule pour cette colonne.
\item On peut tracer un cadre autour du bloc avec la clé |draw| de la commande
-|\Block|.\footnote{Pour colorier le fond d'une case, il n'y a pas besoin
+|\Block| ou colorier le fond avec des bords arrondis avec les clés |fill| et
+|rounded-corners|.\footnote{Pour colorier simplement le fond d'une case, il n'y a pas besoin
d'utiliser un bloc mono-case : on peut utiliser la commande |\cellcolor| si la
clé |colortbl-like| est utilisée : voir p.~\pageref{colortbl-like}.}
\end{itemize}
@@ -885,11 +904,11 @@ p.~\pageref{OnlyMainNiceMatrix}.
\subsection{Les clés hlines et vlines}
La clé |hlines| demande un tracé de tous les filets horizontaux et la clé
-|vlines| demande un tracé de tous les filets verticaux (sauf dans les blocs et
-dans les blocs virtuels déterminés par des lignes en pointillés). En fait, dans les
-environnements avec délimiteurs (comme |{pNiceMatrix}| ou |{bNiceArray}|), les
-filets extérieurs ne sont pas tracés (ce qui est le comportement certainement
-attendu).
+|vlines| demande un tracé de tous les filets verticaux (sauf dans les blocs,
+créés par |\Block| et dans les blocs virtuels déterminés par des lignes en
+pointillés : |\Cdots|, |\Vdots|, etc.). En fait, dans les environnements avec
+délimiteurs (comme |{pNiceMatrix}| ou |{bNiceArray}|), les filets extérieurs ne
+sont pas tracés (ce qui est le comportement certainement attendu).
\medskip
@@ -1143,16 +1162,33 @@ inconvénients.
\subsection{Les outils de nicematrix dans le code-before}
-L'extension \pkg{nicematrix} proposent des outils (indépendants de
-\pkg{colortbl}) pour tracer d'abord les rectangles colorés, puis le contenu des
-cases et les filets. Cette manière de faire est plus dans l'esprit du «modèle du
-peintre» des formats PostScript et \textsc{pdf} et convient donc mieux aux
-lecteurs de \textsc{pdf}. L'inconvénient est qu'elle nécessite plusieurs
-compilations successives.
+L'extension \pkg{nicematrix} propose des outils (indépendants de \pkg{colortbl})
+pour tracer d'abord les rectangles colorés, puis le contenu des cases et les
+filets. Cette manière de faire est plus dans l'esprit du «modèle du peintre» des
+formats PostScript et \textsc{pdf} et convient donc mieux aux lecteurs de
+\textsc{pdf}. L'inconvénient est qu'elle nécessite plusieurs compilations
+successives.
\medskip
L'extension \pkg{nicematrix} fournit une clé |code-before| pour du code qui sera
-exécuté avant le tracé du tableau. De nouvelles commandes y sont disponibles :
+exécuté avant le tracé du tableau.
+
+\smallskip
+\colorbox{yellow!50}{\textbf{Nouveau 5.12}}\enskip Une syntaxe alternative est
+proposée : on peut placer le contenu de ce |code-before| entre les mots-clés
+|\CodeBefore| et |\Body| juste au début de l'environnement.
+
+\begin{Verbatim}
+\begin{pNiceArray}{~textsl#preamble@}
+~emphase#\CodeBefore@
+~textsl#instructions du code-before@
+~emphase#\Body@
+~textsl#contenu de l'environnement@
+\end{pNiceArray}
+\end{Verbatim}
+
+\smallskip
+De nouvelles commandes sont disponibles dans ce |\CodeBefore| :
|\cellcolor|, |\rectanglecolor|, |\rowcolor|, |\columncolor|, |\rowcolors| et
|\chessboardcolors|.\footnote{On pourra remarquer que, dans le
\verb|code-before|, des nœuds PGF/Tikz correspondant à la position des filets
@@ -1176,14 +1212,20 @@ format $i$-$j$ où $i$ est le numéro de ligne et $j$ le numéro de colonne.
\begin{scope}
\hfuzz=10cm
\begin{BVerbatim}[boxwidth=10cm,baseline=c]
-\begin{NiceTabular}{|c|c|c|}[code-before = ~emphase#\cellcolor{red!15}{3-1,2-2,1-3}@]
+\begin{NiceTabular}{|c|c|c|}
+\CodeBefore
+ ~emphase#\cellcolor{red!15}{3-1,2-2,1-3}@
+\Body
\hline
a & b & c \\ \hline
e & f & g \\ \hline
h & i & j \\ \hline
\end{NiceTabular}
\end{BVerbatim}
-\begin{NiceTabular}{|c|c|c|}[code-before = \cellcolor{red!15}{3-1,2-2,1-3}]
+\begin{NiceTabular}{|c|c|c|}
+\CodeBefore
+ \cellcolor{red!15}{3-1,2-2,1-3}
+\Body
\hline
a & b & c \\ \hline
e & f & g \\ \hline
@@ -1201,14 +1243,20 @@ et la case en bas à droite du rectangle.
\begin{scope}
\hfuzz=10cm
\begin{BVerbatim}[boxwidth=10cm,baseline=c]
-\begin{NiceTabular}{|c|c|c|}[code-before = ~emphase#\rectanglecolor{blue!15}{2-2}{3-3}@]
+\begin{NiceTabular}{|c|c|c|}
+\CodeBefore
+ ~emphase#\rectanglecolor{blue!15}{2-2}{3-3}@
+\Body
\hline
a & b & c \\ \hline
e & f & g \\ \hline
h & i & j \\ \hline
\end{NiceTabular}
\end{BVerbatim}
-\begin{NiceTabular}{|c|c|c|}[code-before = \rectanglecolor{blue!15}{2-2}{3-3}]
+\begin{NiceTabular}{|c|c|c|}
+\CodeBefore
+ \rectanglecolor{blue!15}{2-2}{3-3}
+\Body
\hline
a & b & c \\ \hline
e & f & g \\ \hline
@@ -1230,7 +1278,10 @@ partir de la rangée~$a$).
\begin{scope}
\hfuzz=10cm
\begin{BVerbatim}[boxwidth=9cm,baseline=c]
-$\begin{NiceArray}{lll}[hvlines, ~emphase#code-before = \rowcolor{red!15}{1,3-5,8-}@]
+$\begin{NiceArray}{lll}[hvlines]
+\CodeBefore
+ ~emphase#\rowcolor{red!15}{1,3-5,8-}@
+\Body
a_1 & b_1 & c_1 \\
a_2 & b_2 & c_2 \\
a_3 & b_3 & c_3 \\
@@ -1244,8 +1295,10 @@ a_{10} & b_{10} & c_{10} \\
\end{NiceArray}$
\end{BVerbatim}
%
-$\begin{NiceArray}{lll}%
-[baseline=4,hvlines, code-before = \rowcolor{red!15}{1,3-5,8-}]
+$\begin{NiceArray}{lll}[baseline=4,hvlines]
+\CodeBefore
+ \rowcolor{red!15}{1,3-5,8-}
+\Body
a_1 & b_1 & c_1 \\
a_2 & b_2 & c_2 \\
a_3 & b_3 & c_3 \\
@@ -1281,7 +1334,7 @@ l'intervalle constitué de toutes les rangées du tableau à partir de la rangé
\bigskip
-La commande |\rowcolors| accepte une liste de paires clé-valeur comme argument
+La commande |\rowcolors| accepte une liste de couples clé-valeur comme argument
optionnel en dernière position (l'argument optionel en première position
correspond à l'espace colorimétrique). Les clés disponibles sont |cols|,
|restart| et |respect-blocks|.
@@ -1306,8 +1359,10 @@ tableau pour englober les blocs (créés par la commande |\Block| : cf.~p.~\page
\begin{scope}
\hfuzz=10cm
\begin{BVerbatim}[baseline=c,boxwidth=9cm]
-\begin{NiceTabular}{clr}%
- [hvlines,code-before = ~emphase#{\rowcolors{2}{blue!10}{}[cols=2-3,restart]}@]
+\begin{NiceTabular}{clr}[hvlines]
+\CodeBefore
+ ~emphase#{\rowcolors{2}{blue!10}{}[cols=2-3,restart]}@
+\Body
\Block{1-*}{Résultats} \\
\Block{2-1}{A}& Pierre & 12 \\
& Jacques & 8 \\
@@ -1317,8 +1372,10 @@ tableau pour englober les blocs (créés par la commande |\Block| : cf.~p.~\page
& Estelle & 15
\end{NiceTabular}
\end{BVerbatim}
-\begin{NiceTabular}{clr}[hvlines,
- code-before = {\rowcolors{2}{blue!10}{}[cols=2-3,restart]},baseline=2]
+\begin{NiceTabular}{clr}[hvlines,baseline=2]
+\CodeBefore
+ \rowcolors{2}{blue!10}{}[cols=2-3,restart]
+\Body
\Block{1-*}{Résultats} \\
\Block{2-1}{A}& Pierre & 12 \\
& Jacques & 8 \\
@@ -1335,8 +1392,10 @@ tableau pour englober les blocs (créés par la commande |\Block| : cf.~p.~\page
\begin{scope}
\hfuzz=10cm
\begin{BVerbatim}[baseline=c,boxwidth=11cm]
-\begin{NiceTabular}{lr}[hvlines,code-before =
-~emphase#\rowcolors{1}{blue!10}{}[respect-blocks]@]
+\begin{NiceTabular}{lr}[hvlines]
+\CodeBefore
+ ~emphase#\rowcolors{1}{blue!10}{}[respect-blocks]@
+\Body
\Block{2-1}{Pierre} & 12 \\
& 13 \\
Jacques & 8 \\
@@ -1349,8 +1408,10 @@ Henri & 14 \\
& 19
\end{NiceTabular}
\end{BVerbatim}
-\begin{NiceTabular}{lr}[hvlines,code-before =
-\rowcolors{1}{blue!10}{}[respect-blocks],baseline=c]
+\begin{NiceTabular}{lr}[hvlines,baseline=c]
+\CodeBefore
+ \rowcolors{1}{blue!10}{}[respect-blocks]
+\Body
\Block{2-1}{Pierre} & 12 \\
& 13 \\
Jacques & 8 \\
@@ -1376,14 +1437,19 @@ couleurs et colorie les cases en quinconces avec les deux couleurs.
\begin{scope}
\hfuzz=10cm
\begin{BVerbatim}[baseline=c,boxwidth=9cm]
-$\begin{pNiceMatrix}[r,margin, ~emphase#code-before=\chessboardcolors{red!15}{blue!15}@]
+$\begin{pNiceMatrix}[r,margin]
+\CodeBefore
+ ~emphase#code-before=\chessboardcolors{red!15}{blue!15}@
+\Body
1 & -1 & 1 \\
-1 & 1 & -1 \\
1 & -1 & 1
\end{pNiceMatrix}$
\end{BVerbatim}
-$\begin{pNiceMatrix}%
-[baseline=1, r, margin, code-before = \chessboardcolors{red!15}{blue!15}]
+$\begin{pNiceMatrix}[baseline=1, r, margin]
+\CodeBefore
+ \chessboardcolors{red!15}{blue!15}
+\Body
1 & -1 & 1 \\
-1 & 1 & -1 \\
1 & -1 & 1
@@ -1404,8 +1470,11 @@ l'extension \pkg{booktabs} n'est pas chargée par \pkg{nicematrix}.
\begin{scope}
\hfuzz=10cm
\begin{BVerbatim}[baseline=c,boxwidth=8.5cm]
-\begin{NiceTabular}{lSSSS}%
-[code-before = \rowcolor{red!15}{1-2} \rowcolors{3}{blue!15}{}]
+\begin{NiceTabular}{lSSSS}
+\CodeBefore
+ \rowcolor{red!15}{1-2}
+ \rowcolors{3}{blue!15}{}
+\Body
~emphase#\toprule@
\Block{2-1}{Produit} &
\Block{1-3}{dimensions (cm)} & & &
@@ -1421,8 +1490,11 @@ spécial & 12 & 12 & 0.5 & 70 \\
~emphase#\bottomrule@
\end{NiceTabular}
\end{BVerbatim}
-\begin{NiceTabular}[c]{lSSSS}%
-[code-before = \rowcolor{red!15}{1-2} \rowcolors{3}{blue!15}{}]
+\begin{NiceTabular}[c]{lSSSS}
+\CodeBefore
+ \rowcolor{red!15}{1-2}
+ \rowcolors{3}{blue!15}{}
+\Body
\toprule
\Block{2-1}{Produit} &
\Block{1-3}{dimensions (cm)} & & &
@@ -2062,7 +2134,7 @@ C[a_1,a_1] & \Cdots & C[a_1,a_n]
& ~emphase#\Hdotsfor{1}@ & \Vdots & \Ddots & \Vdots \\
C[a_n,a_1] & \Cdots & C[a_n,a_n]
& & C[a_n,a_1^{(p)}] & \Cdots & C[a_n,a_n^{(p)}] \\
-\rule{0pt}{15mm} & ~emphase#\Vdotsfor{1}@ & & \Ddots & & ~emphase#\Vdotsfor{1}@ \\
+\rule{0pt}{15mm}\NotEmpty & ~emphase#\Vdotsfor{1}@ & & \Ddots & & ~emphase#\Vdotsfor{1}@ \\
C[a_1^{(p)},a_1] & \Cdots & C[a_1^{(p)},a_n]
& & C[a_1^{(p)},a_1^{(p)}] & \Cdots & C[a_1^{(p)},a_n^{(p)}] \\
\Vdots & \Ddots & \Vdots
@@ -2077,7 +2149,7 @@ C[a_n^{(p)},a_1] & \Cdots & C[a_n^{(p)},a_n]
C[a_1,a_1] & \Cdots & C[a_1,a_n] & \hspace*{20mm} & C[a_1,a_1^{(p)}] & \Cdots & C[a_1,a_n^{(p)}] \\
\Vdots & \Ddots & \Vdots & \Hdotsfor{1} & \Vdots & \Ddots & \Vdots \\
C[a_n,a_1] & \Cdots & C[a_n,a_n] & & C[a_n,a_1^{(p)}] & \Cdots & C[a_n,a_n^{(p)}] \\
-\rule{0pt}{15mm} & \Vdotsfor{1} & & \Ddots & & \Vdotsfor{1} \\
+\rule{0pt}{15mm}\NotEmpty & \Vdotsfor{1} & & \Ddots & & \Vdotsfor{1} \\
C[a_1^{(p)},a_1] & \Cdots & C[a_1^{(p)},a_n] & & C[a_1^{(p)},a_1^{(p)}] & \Cdots & C[a_1^{(p)},a_n^{(p)}] \\
\Vdots & \Ddots & \Vdots & \Hdotsfor{1} & \Vdots & \Ddots & \Vdots \\
C[a_n^{(p)},a_1] & \Cdots & C[a_n^{(p)},a_n] & & C[a_n^{(p)},a_1^{(p)}] & \Cdots & C[a_n^{(p)},a_n^{(p)}]
@@ -2359,7 +2431,7 @@ p.~\pageref{customization}).
\label{sub-matrix}
-\colorbox{yellow!50}{\textbf{Nouveau 5.10}}\enskip
+\colorbox{yellow!30}{Nouveau 5.10}\enskip
La commande |\SubMatrix| permet de positionner des délimiteurs sur une partie du
tableau, partie qui est considérée comme une sous-matrice. La commande
|\SubMatrix| prend cinq arguments :
@@ -2373,7 +2445,11 @@ la syntaxe $i$|-|$j$ où $i$ est le numéro de rangée et $j$ le numéro de colo
\item le troisième argument est le coin inférieur droit avec la même syntaxe ;
\item la quatrième argument est le délimiteur droit ;
\item le cinquième argument, optionnel, entre crochets, est une liste de couples
-clé-valeur.
+clé-valeur.\footnote{Il n'y a pas d'argument optionnel entre crochets en première
+position car un crochet ouvrant juste après \verb|\SubMatrix| doit pouvoir être
+interprété comme le premier argument (obligatoire) de \verb|\SubMatrix|: ce
+crochet est alors le délimiteur gauche de la sous-matrice (ex. :
+\verb|\SubMatrix[{2-2}{4-7}]|).}
\end{itemize}
On remarquera que la commande |\SubMatrix| trace les délimiteurs après la
@@ -2392,8 +2468,8 @@ colonne avec |@{\hspace{1.5em}}| dans le préambule du tableau.
\dfrac{1}{4} & \dfrac{1}{2} & \dfrac{1}{4} & y \\
1 & 2 & 3 & z
\CodeAfter
-~emphase#\SubMatrix({1-1}{3-3})+
-~emphase#\SubMatrix({1-4}{3-4})+
+ ~emphase#\SubMatrix({1-1}{3-3})+
+ ~emphase#\SubMatrix({1-4}{3-4})+
\end{NiceArray}\]
\end{BVerbatim}
\end{scope}
@@ -2402,8 +2478,8 @@ $\begin{NiceArray}{ccc@{\hspace{1.5em}}c}[cell-space-limits=2pt,margin]
\dfrac{1}{4} & \dfrac{1}{2} & \dfrac{1}{4} & y \\
1 & 2 & 3 & z
\CodeAfter
-\SubMatrix({1-1}{3-3})
-\SubMatrix({1-4}{3-4})
+ \SubMatrix({1-1}{3-3})
+ \SubMatrix({1-4}{3-4})
\end{NiceArray}$
\bigskip
@@ -2429,6 +2505,21 @@ environnements de \pkg{nicematrix} ou comme option de |\CodeAfter| avec le
préfixe |sub-matrix|, c'est-à-dire qu'elles sont alors nommées
|sub-matrix/left-xshift|, |sub-matrix/right-xshift|, |sub-matrix/xshift|, etc.
+\medskip
+\colorbox{yellow!50}{\textbf{Nouveau 5.12}}\enskip Il y a aussi les clés
+suivantes, qui ne sont accessibles que pour une commande |\SubMatrix|
+individuelle :
+%
+\begin{itemize}
+\item |vlines| contient une liste de numéros de filets verticaux à tracer dans
+la sous-matrice (si cette clé est utilisée sans valeur, tous les filets
+verticaux sont tracés) ;
+\item |hlines| est similaire à |vlines| mais pour les filets horizontaux ;
+\item |hvlines|, qui s'utilise sans valeur, trace tous les filets dans la sous-matrice.
+\end{itemize}
+On remarquera que tous ces filets sont dessinés après la construction du tableau
+principal : les colonnes et les rangées ne sont pas écartées.
+
\bigskip
\begin{scope}
\hfuzz=12cm
@@ -2440,9 +2531,9 @@ $\begin{NiceArray}{cc@{\hspace{5mm}}l}[cell-space-limits=2pt]
a & b & \frac12a+\frac14b \\
c & d & \frac12c+\frac14d \\
\CodeAfter
-\SubMatrix({1-3}{2-3})
-\SubMatrix({3-1}{4-2})
-\SubMatrix({3-3}{4-3})
+ \SubMatrix({1-3}{2-3})
+ \SubMatrix({3-1}{4-2})
+ \SubMatrix({3-3}{4-3})
\end{NiceArray}$
\end{BVerbatim}
\end{scope}
@@ -2452,9 +2543,9 @@ $\begin{NiceArray}{cc@{\hspace{5mm}}l}[cell-space-limits=2pt]
a & b & \frac12a+\frac14b \\
c & d & \frac12c+\frac14d \\
\CodeAfter
-\SubMatrix({1-3}{2-3})
-\SubMatrix({3-1}{4-2})
-\SubMatrix({3-3}{4-3})
+ \SubMatrix({1-3}{2-3})
+ \SubMatrix({3-1}{4-2})
+ \SubMatrix({3-3}{4-3})
\end{NiceArray}$
\medskip
@@ -2471,9 +2562,9 @@ $\begin{NiceArray}{cc@{\hspace{5mm}}l}[cell-space-limits=2pt]
a & b & \frac12a+\frac14b \\
c & d & \frac12c+\frac14d \\
\CodeAfter
-\SubMatrix({1-3}{2-3})[~emphase#slim!]
-\SubMatrix({3-1}{4-2})
-\SubMatrix({3-3}{4-3})
+ \SubMatrix({1-3}{2-3})[~emphase#slim!]
+ \SubMatrix({3-1}{4-2})
+ \SubMatrix({3-3}{4-3})
\end{NiceArray}$
\end{BVerbatim}
\end{scope}
@@ -2484,9 +2575,9 @@ $\begin{NiceArray}{cc@{\hspace{5mm}}l}[cell-space-limits=2pt]
a & b & \frac12a+\frac14b \\
c & d & \frac12c+\frac14d \\
\CodeAfter
-\SubMatrix({1-3}{2-3})[slim]
-\SubMatrix({3-1}{4-2})
-\SubMatrix({3-3}{4-3})
+ \SubMatrix({1-3}{2-3})[slim]
+ \SubMatrix({3-1}{4-2})
+ \SubMatrix({3-3}{4-3})
\end{NiceArray}$
@@ -3488,7 +3579,7 @@ noix & noisette & brugnon
\label{noeuds-i}
-\colorbox{yellow!50}{\textbf{Nouveau 5.11}}\enskip L'extension \pkg{nicematrix}
+\colorbox{yellow!30}{Nouveau 5.11}\enskip L'extension \pkg{nicematrix}
crée un nœud PGF-Tikz nommé simplement $i$ (précédé du préfixe habituel) à
l'intersection du filet horizontal de numéro $i$ et du filet vertical de
numéro~$j$ (ou plutôt la position potentielle de ces filets car ils ne sont
@@ -3521,13 +3612,10 @@ horizontal~$i$ et du filet vertical~$j$ avec la syntaxe |(|$i$\verb+-|+$j$|)|.
\medskip
\begin{Verbatim}
-\[\begin{NiceMatrix}[
- code-before =
- {
-~emphase# \tikz \draw [fill = red!15] @
-~emphase# (7-|4) -- (8-|4) -- (8-|5) -- (9-|5) -- (9-|6) |- cycle ; @
- }
-]
+\begin{NiceMatrix}
+\CodeBefore
+~emphase#\tikz \draw [fill=red!15] (7-|4) |- (8-|5) |- (9-|6) |- cycle ;@
+\Body
1 \\
1 & 1 \\
1 & 2 & 1 \\
@@ -3537,16 +3625,13 @@ horizontal~$i$ et du filet vertical~$j$ avec la syntaxe |(|$i$\verb+-|+$j$|)|.
1 & 6 & 15 & 20 & 15 & 6 & 1 \\
1 & 7 & 21 & 35 & 35 & 21 & 7 & 1 \\
1 & 8 & 28 & 56 & 70 & 56 & 28 & 8 & 1
-\end{NiceMatrix}\]
+\end{NiceMatrix}
\end{Verbatim}
%
-\[\begin{NiceMatrix}[
- code-before =
- {
- \tikz \draw [fill = red!15]
- (7-|4) -- (8-|4) -- (8-|5) -- (9-|5) -- (9-|6) |- cycle ;
- }
-]
+\[\begin{NiceMatrix}
+\CodeBefore
+\tikz \draw [fill=red!15] (7-|4) |- (8-|5) |- (9-|6) |- cycle ;
+\Body
1 \\
1 & 1 \\
1 & 2 & 1 \\
@@ -3563,7 +3648,7 @@ horizontal~$i$ et du filet vertical~$j$ avec la syntaxe |(|$i$\verb+-|+$j$|)|.
\label{node-sub-matrix}
-\colorbox{yellow!50}{\textbf{Nouveau 5.10}}\enskip
+\colorbox{yellow!30}{Nouveau 5.10}\enskip
La commande |\SubMatrix| disponible dans le |\CodeAfter| a été présentée
p.~\pageref{sub-matrix}.
@@ -3636,10 +3721,8 @@ bibliothèque Tikz \pkg{patterns} : |\usetikzlibrary{patterns}|).
\ExplSyntaxOn
\cs_new_protected:Nn \__pantigny_hatch:nnn
{
- \begin { tikzpicture }
- \fill [ pattern = north~west~lines , pattern~color = #3 ]
- ( #1 -| #2) rectangle ( \int_eval:n { #1 + 1 } -| \int_eval:n { #2 + 1 } ) ;
- \end { tikzpicture }
+ \tikz \fill [ pattern = north~west~lines , pattern~color = #3 ]
+ ( #1 -| #2) rectangle ( \int_eval:n { #1 + 1 } -| \int_eval:n { #2 + 1 } ) ;
}
\NewDocumentCommand \hatchcell { ! O { black } }
@@ -3654,10 +3737,8 @@ bibliothèque Tikz \pkg{patterns} : |\usetikzlibrary{patterns}|).
\ExplSyntaxOn
\cs_new_protected:Nn \__pantigny_hatch:nnn
{
- \begin { tikzpicture }
- \fill [ pattern = north~west~lines , pattern~color = #3 ]
- ( #1 -| #2 ) rectangle ( \int_eval:n { #1 + 1 } -| \int_eval:n { #2 + 1 } ) ;
- \end { tikzpicture }
+ \tikz \fill [ pattern = north~west~lines , pattern~color = #3 ]
+ ( #1 -| #2 ) rectangle ( \int_eval:n { #1 + 1 } -| \int_eval:n { #2 + 1 } ) ;
}
\NewDocumentCommand \hatchcell { ! O { black } }
@@ -4150,96 +4231,224 @@ $\begin{pNiceMatrix}[first-row,first-col]
-\subsection{Largeur des colonnes}
+\subsection{Empilements de matrices}
+
+On a souvent besoin de présetner des matrices empilées les unes au-dessus des
+autres (par exemple pour la résolutiond de systèmes linéaires).
+
\medskip
-Dans l'exemple suivant, nous utilisons |{NiceMatrixBlock}| avec l'option
-|auto-columns-width| parce que nous voulons la même largeur (automatique) pour
-toutes les colonnes.
+Pour avoir les colonnes alignées les unes sous les autres, on peut imposer une
+largeur commune à toutes les colonnes, ce que l'on fait dans l'exemple suivant
+avec l'environnement |{NiceMatrixBlock}| et l'option |auto-columns-width|.
-\bigskip
-\begin{BVerbatim}
+\begin{Verbatim}[formatcom=\small\color{gray}]
~emphase#\begin{NiceMatrixBlock}[auto-columns-width]@
\NiceMatrixOptions
- { last-col,code-for-last-col = \color{blue}\scriptstyle,light-syntax}
+ {
+ light-syntax,
+ last-col, code-for-last-col = \color{blue} \scriptstyle,
+ }
\setlength{\extrarowheight}{1mm}
-$\begin{pNiceArray}{cccc:c}
- 1 1 1 1 1 { } ;
- 2 4 8 16 9 ;
- 3 9 27 81 36 ;
- 4 16 64 256 100
+
+$\begin{pNiceArray}{rrrr|r}
+12 -8 7 5 3 {} ;
+ 3 -18 12 1 4 ;
+-3 -46 29 -2 -15 ;
+ 9 10 -5 4 7
\end{pNiceArray}$
-\medskip
-$\begin{pNiceArray}{cccc:c}
- 1 1 1 1 1 ;
- 0 2 6 14 7 { L_2 \gets -2 L_1 + L_2 } ;
- 0 6 24 78 33 { L_3 \gets -3 L_1 + L_3 } ;
- 0 12 60 252 96 { L_4 \gets -4 L_1 + L_4 }
+
+\smallskip
+$\begin{pNiceArray}{rrrr|r}
+12 -8 7 5 3 ;
+0 64 -41 1 19 { L_2 \gets L_1-4L_2 } ;
+0 -192 123 -3 -57 { L_3 \gets L_1+4L_3 } ;
+0 -64 41 -1 -19 { L_4 \gets 3L_1-4L_4 } ;
\end{pNiceArray}$
-...
+
+\smallskip
+$\begin{pNiceArray}{rrrr|r}
+12 -8 7 5 3 ;
+0 64 -41 1 19 ;
+0 0 0 0 0 { L_3 \gets 3 L_2 + L_3 }
+\end{pNiceArray}$
+
+\smallskip
+$\begin{pNiceArray}{rrrr|r}
+12 -8 7 5 3 {} ;
+0 64 -41 1 19 ;
+\end{pNiceArray}$
+
~emphase#\end{NiceMatrixBlock}@
-\end{BVerbatim}
+\end{Verbatim}
\bigskip
-
-\begin{multicols}{2}
\begin{NiceMatrixBlock}[auto-columns-width]
-\NiceMatrixOptions{last-col,code-for-last-col = \color{blue}\scriptstyle,light-syntax}
+\NiceMatrixOptions
+ {
+ light-syntax,
+ last-col, code-for-last-col = \color{blue} \scriptstyle ,
+ }
\setlength{\extrarowheight}{1mm}
-\enskip $\begin{pNiceArray}{cccc:c}
-1 1 1 1 1 { } ;
-2 4 8 16 9 ;
-3 9 27 81 36 ;
-4 16 64 256 100
+\quad $\begin{pNiceArray}{rrrr|r}
+12 -8 7 5 3 {} ;
+ 3 -18 12 1 4 ;
+-3 -46 29 -2 -15 ;
+ 9 10 -5 4 7
\end{pNiceArray}$
-\medskip
-
-\enskip $\begin{pNiceArray}{cccc:c}
-1 1 1 1 1 ;
-0 2 6 14 7 { L_2 \gets -2 L_1 + L_2 } ;
-0 6 24 78 33 { L_3 \gets -3 L_1 + L_3 } ;
-0 12 60 252 96 { L_4 \gets -4 L_1 + L_4 }
+\smallskip
+\quad $\begin{pNiceArray}{rrrr|r}
+12 -8 7 5 3 ;
+0 64 -41 1 19 { L_2 \gets L_1-4L_2 } ;
+0 -192 123 -3 -57 { L_3 \gets L_1+4L_3 } ;
+0 -64 41 -1 -19 { L_4 \gets 3L_1-4L_4 } ;
\end{pNiceArray}$
-\medskip
+\smallskip
+\quad $\begin{pNiceArray}{rrrr|r}
+12 -8 7 5 3 ;
+0 64 -41 1 19 ;
+0 0 0 0 0 { L_3 \gets 3 L_2 + L_3 }
+\end{pNiceArray}$
-\enskip $\begin{pNiceArray}{cccc:c}
-1 1 1 1 1 ;
-0 1 3 7 \frac72 { L_2 \gets \frac12 L_2 } ;
-0 3 12 39 \frac{33}2 { L_3 \gets \frac12 L_3 } ;
-0 1 5 21 8 { L_4 \gets \frac1{12} L_4 }
+\smallskip
+\quad $\begin{pNiceArray}{rrrr|r}
+12 -8 7 5 3 {} ;
+0 64 -41 1 19 ;
\end{pNiceArray}$
+\end{NiceMatrixBlock}
+
+\bigskip
+On constate que la dernière matrice n'est pas parfaitement alignée avec les
+précédentes. C'est que les parenthèses, en LaTeX, n'ont pas toutes la même
+largeur suivant leur taille.
\medskip
+\colorbox{yellow!50}{\textbf{Nouveau 5.12}}\enskip Pour résoudre ce problème, on
+peut demander que les délimiteurs soient composés avec leur largeur maximale
+grâce à la clé booléenne |delimiters/max-width|.
+
+\begin{Verbatim}[formatcom=\small\color{gray}]
+~emphase#\begin{NiceMatrixBlock}[auto-columns-width]@
+\NiceMatrixOptions
+ {
+ ~emphase#delimiters/max-width@,
+ light-syntax,
+ last-col, code-for-last-col = \color{blue}\scriptstyle,
+ }
+\setlength{\extrarowheight}{1mm}
-\enskip $\begin{pNiceArray}{cccc:c}
-1 1 1 1 1 ;
-0 1 3 7 \frac72 ;
-0 0 3 18 6 { L_3 \gets -3 L_2 + L_3 } ;
-0 0 -2 -14 -\frac92 { L_4 \gets L_2 - L_4 }
+$\begin{pNiceArray}{rrrr|r}
+12 -8 7 5 3 {} ;
+ 3 -18 12 1 4 ;
+-3 -46 29 -2 -15 ;
+ 9 10 -5 4 7
\end{pNiceArray}$
-\medskip
+...
+~emphase#\end{NiceMatrixBlock}@
+\end{Verbatim}
-\enskip $\begin{pNiceArray}{cccc:c}
-1 1 1 1 1 ;
-0 1 3 7 \frac72 ;
-0 0 1 6 2 { L_3 \gets \frac13 L_3 } ;
-0 0 -2 -14 -\frac92
+\bigskip
+\begin{NiceMatrixBlock}[auto-columns-width]
+\NiceMatrixOptions
+ {
+ delimiters/max-width,
+ light-syntax,
+ last-col, code-for-last-col = \color{blue}\scriptstyle,
+ }
+\setlength{\extrarowheight}{1mm}
+
+\quad $\begin{pNiceArray}{rrrr|r}
+12 -8 7 5 3 {} ;
+ 3 -18 12 1 4 ;
+-3 -46 29 -2 -15 ;
+ 9 10 -5 4 7
\end{pNiceArray}$
-\medskip
+\smallskip
+\quad $\begin{pNiceArray}{rrrr|r}
+12 -8 7 5 3 ;
+0 64 -41 1 19 { L_2 \gets L_1-4L_2 } ;
+0 -192 123 -3 -57 { L_3 \gets L_1+4L_3 } ;
+0 -64 41 -1 -19 { L_4 \gets 3L_1-4L_4 } ;
+\end{pNiceArray}$
-\enskip $\begin{pNiceArray}{cccc:c}
-1 1 1 1 1 ;
-0 1 3 7 \frac72 ;
-0 0 1 6 2 ;
-0 0 0 -2 -\frac12 { L_4 \gets L_3 + L_4 }
+\smallskip
+\quad $\begin{pNiceArray}{rrrr|r}
+12 -8 7 5 3 ;
+0 64 -41 1 19 ;
+0 0 0 0 0 { L_3 \gets 3 L_2 + L_3 }
\end{pNiceArray}$
+
+\smallskip
+\quad $\begin{pNiceArray}{rrrr|r}
+12 -8 7 5 3 {} ;
+0 64 -41 1 19 ;
+\end{pNiceArray}$
+
\end{NiceMatrixBlock}
-\end{multicols}
+
+
+\interitem
+Si on souhaite un alignement des colonnes des différentes matrices sans imposer
+la même largeur à toutes les colonnes, on peut utiliser un grand tableau unique
+et placer les parenthèses avec des commandes |\SubMatrix| dans le |\CodeAfter|.
+Bien sûr, ce tableau ne pourra pas être coupé par un saut de page.
+
+\medskip
+\begin{Verbatim}
+\setlength{\extrarowheight}{1mm}
+\[\begin{NiceMatrix}%
+ [ r, last-col=6, code-for-last-col = \scriptstyle \color{blue} ]
+12 & -8 & 7 & 5 & 3 \\
+ 3 & -18 & 12 & 1 & 4 \\
+-3 & -46 & 29 &-2 &-15 \\
+ 9 & 10 &-5 &4 & 7 \\[1mm]
+12 & -8 & 7 &5 & 3 \\
+0 & 64 &-41 & 1 & 19 & L_2 \gets L_1-4L_2 \\
+0 & -192 &123 &-3 &-57 & L_3 \gets L_1+4L_3 \\
+0 & -64 & 41 &-1 &-19 & L_4 \gets 3L_1-4L_4 \\[1mm]
+12 & -8 &7 &5 & 3 \\
+0 & 64 &-41 &1 &19 \\
+0 & 0 &0 &0 & 0 & L_3 \gets 3L_2+L_3 \\[1mm]
+12 & -8 &7 &5 & 3 \\
+0 & 64 &-41 & 1 & 19 \\
+~emphase#\CodeAfter@
+~emphase# \SubMatrix({1-1}{4-5})[vlines=4]@
+~emphase# \SubMatrix({5-1}{8-5})[vlines=4]@
+~emphase# \SubMatrix({9-1}{11-5})[vlines=4]@
+~emphase# \SubMatrix({12-1}{13-5})[vlines=4]@
+\end{NiceMatrix}\]
+\end{Verbatim}
+
+\medskip
+\begin{scope}
+\setlength{\extrarowheight}{1mm}
+\[\begin{NiceMatrix}%
+ [ r, last-col=6, code-for-last-col = \scriptstyle \color{blue} ]
+12 & -8 & 7 & 5 & 3 \\
+ 3 & -18 & 12 & 1 & 4 \\
+-3 & -46 & 29 &-2 &-15 \\
+ 9 & 10 &-5 &4 & 7 \\[1mm]
+12 & -8 & 7 &5 & 3 \\
+0 & 64 &-41 & 1 & 19 & L_2 \gets L_1-4L_2 \\
+0 & -192 &123 &-3 &-57 & L_3 \gets L_1+4L_3 \\
+0 & -64 & 41 &-1 &-19 & L_4 \gets 3L_1-4L_4 \\[1mm]
+12 & -8 &7 &5 & 3 \\
+0 & 64 &-41 &1 &19 \\
+0 & 0 &0 &0 & 0 & L_3 \gets 3L_2+L_3 \\[1mm]
+12 & -8 &7 &5 & 3 \\
+0 & 64 &-41 & 1 & 19 \\
+\CodeAfter
+ \SubMatrix({1-1}{4-5})[vlines=4]
+ \SubMatrix({5-1}{8-5})[vlines=4]
+ \SubMatrix({9-1}{11-5})[vlines=4]
+ \SubMatrix({12-1}{13-5})[vlines=4]
+\end{NiceMatrix}\]
+\end{scope}
\subsection{Comment surligner les cases d'une matrice}
@@ -4280,7 +4489,7 @@ matrice.\footnote{Pour la commande |\cline|, voir la remarque
\vspace{1cm}
Il est possible de colorier une rangée avec |\rowcolor| dans le |code-before|
-(ou avec |\rowcolor| dans la première case de la rangée si on utilise la clé
+(ou avec |\rowcolor| dans une case de la rangée si on utilise la clé
|colortbl-like| − même si \pkg{colortbl} n'est pas chargé).
@@ -4491,112 +4700,43 @@ a & a & a & L_3 \\
-\subsection{Utilisation directe des nœuds Tikz}
-
-Dans l'exemple suivant, on souhaite illustrer le produit mathématique de deux matrices.
-
-\medskip
-L'utilisation de |{NiceMatrixBlock}| avec l'option |auto-columns-width| va
-permettre que toutes les colonnes aient la même largeur ce qui permettra un
-alignement des deux matrices superposées.
-\begin{Verbatim}
-\begin{NiceMatrixBlock}[auto-columns-width]
-\end{Verbatim}
-
-\begin{Verbatim}
-\NiceMatrixOptions{nullify-dots}
-\end{Verbatim}
+\subsection{Utilisation de \textbackslash SubMatrix dans le code-before}
-Les trois matrices vont être disposées les unes par rapport aux autres grâce à un tableau de LaTeX.
-\begin{Verbatim}
-$\begin{array}{cc}
-&
-\end{Verbatim}
+Dans l'exemple suivant, on illustre le produit mathématique de deux matrices.
-La matrice $B$ a une «première rangée» (pour $C_j$) d'où l'option |first-row|.
-\begin{Verbatim}
-\begin{bNiceArray}{c>{\strut}cccc}[name=B,first-row]
- & & ~emphase#C_j@ \\
-b_{11} & \Cdots & b_{1j} & \Cdots & b_{1n} \\
-\Vdots & & \Vdots & & \Vdots \\
- & & b_{kj} \\
- & & \Vdots \\
- b_{n1} & \Cdots & b_{nj} & \Cdots & b_{nn}
-\end{bNiceArray} \\ \\
-\end{Verbatim}
+L'ensemble de la figure est un environnement |{NiceArray}| et les trois paires
+de parenthèses ont été rajoutées avec |\SubMatrix| dans le |code-before|.
-La matrice $A$ a une «première colonne» (pour $L_i$) d'où l'option |first-col|.
-\begin{Verbatim}
-\begin{bNiceArray}{cc>{\strut}ccc}[name=A,first-col]
+Ceux qui sont intéressés par le code correspondant le trouveront dans le fichier
+source de ce document.
+%
+%
+%
+\[\begin{NiceArray}{*{6}{c}@{\hspace{6mm}}*{5}{c}}[nullify-dots]
+\CodeBefore
+ \SubMatrix({2-7}{6-11})
+ \SubMatrix({7-2}{11-6})
+ \SubMatrix({7-7}{11-11})
+\Body
+ & & & & & & & & \color{blue}\scriptstyle C_j \\
+ & & & & & & b_{11} & \Cdots & b_{1j} & \Cdots & b_{1n} \\
+ & & & & & & \Vdots & & \Vdots & & \Vdots \\
+ & & & & & & & & b_{kj} \\
+ & & & & & & & & \Vdots \\
+ & & & & & & b_{n1} & \Cdots & b_{nj} & \Cdots & b_{nn} \\[3mm]
& a_{11} & \Cdots & & & a_{1n} \\
+ & \Vdots & & & & \Vdots & & & \Vdots \\
+\color{blue}\scriptstyle L_i
+ & a_{i1} & \Cdots & a_{ik} & \Cdots & a_{in} & \Cdots & & c_{ij} \\
& \Vdots & & & & \Vdots \\
-~emphase#L_i@ & a_{i1} & \Cdots & a_{ik} & \Cdots & a_{in} \\
- & \Vdots & & & & \Vdots \\
- & a_{n1} & \Cdots & & & a_{nn}
-\end{bNiceArray}
-&
-\end{Verbatim}
-
-Dans la matrice produit, on remarquera que les lignes en pointillés sont «semi-ouvertes».
-\begin{Verbatim}
-\begin{bNiceArray}{cc>{\strut}ccc}
- & & & & \\
- & & \Vdots \\
-\Cdots & & c_{ij} \\
-\\
-\\
-\end{bNiceArray}
-\end{array}$
-
-\end{NiceMatrixBlock}
-\end{Verbatim}
-
-\begin{Verbatim}
-\begin{tikzpicture}[remember picture, overlay]
- \node [highlight = (A-3-1) (A-3-5) ] {} ;
- \node [highlight = (B-1-3) (B-5-3) ] {} ;
- \draw [color = gray] (A-3-3) to [bend left] (B-3-3) ;
-\end{tikzpicture}
-\end{Verbatim}
-
-
-
-\begin{NiceMatrixBlock}[auto-columns-width]
-\NiceMatrixOptions{nullify-dots}
-$\begin{array}{cc}
-&
-\begin{bNiceArray}{c>{\strut}cccc}[name=B,first-row]
- & & C_j \\
-b_{11} & \Cdots & b_{1j} & \Cdots & b_{1n} \\
-\Vdots & & \Vdots & & \Vdots \\
- & & b_{kj} \\
- & & \Vdots \\
- b_{n1} & \Cdots & b_{nj} & \Cdots & b_{nn}
-\end{bNiceArray} \\ \\
-\begin{bNiceArray}{cc>{\strut}ccc}[name=A,first-col]
- & a_{11} & \Cdots & & & a_{1n} \\
- & \Vdots & & & & \Vdots \\
-L_i & a_{i1} & \Cdots & a_{ik} & \Cdots & a_{in} \\
- & \Vdots & & & & \Vdots \\
- & a_{n1} & \Cdots & & & a_{nn} \\
-\end{bNiceArray}
-&
-\begin{bNiceArray}{cc>{\strut}ccc}
- & & & & \\
- & & \Vdots \\
-\Cdots & & c_{ij} \\
-\\
-\\
-\end{bNiceArray}
-\end{array}$
-
-\end{NiceMatrixBlock}
-
-\begin{tikzpicture}[remember picture, overlay]
- \node [highlight = (A-3-1) (A-3-5) ] {} ;
- \node [highlight = (B-1-3) (B-5-3) ] {} ;
- \draw [color = gray] (A-3-3) to [bend left] (B-3-3) ;
+ & a_{n1} & \Cdots & & & a_{nn} \\
+\CodeAfter
+\begin{tikzpicture}
+\node [highlight = (9-2) (9-6)] { } ;
+\node [highlight = (2-9) (6-9)] { } ;
+\draw [gray,shorten > = 1mm, shorten < = 1mm] (9-4.north) to [bend left] (4-9.west) ;
\end{tikzpicture}
+\end{NiceArray}\]
diff --git a/macros/latex/contrib/nicematrix/nicematrix.dtx b/macros/latex/contrib/nicematrix/nicematrix.dtx
index 24732c133c..a84069b7c8 100644
--- a/macros/latex/contrib/nicematrix/nicematrix.dtx
+++ b/macros/latex/contrib/nicematrix/nicematrix.dtx
@@ -15,8 +15,8 @@
%
% \fi
% \iffalse
-\def\myfileversion{5.11}
-\def\myfiledate{2021/02/22}
+\def\myfileversion{5.12}
+\def\myfiledate{2021/03/10}
%
%
%<*batchfile>
@@ -279,8 +279,7 @@ version 2005/12/01 or later.
% |cell-space-bottom-limit| similar to the parameters |\cellspacetoplimit| and
% |\cellspacebottomlimit| of \pkg{cellspace}.
%
-% \colorbox{yellow!30}{New 5.9}\enskip There is also a key |cell-space-limits|
-% to set both parameters at once.
+% There is also a key |cell-space-limits| to set both parameters at once.
%
% The initial value of these parameters is $0$~pt in order to have for the
% environments of \pkg{nicematrix} the same behaviour as those of \pkg{array}
@@ -546,7 +545,29 @@ version 2005/12/01 or later.
% 0 & \Cdots& 0 & 0
% \end{bNiceArray}$
%
-%
+% \interitem
+% In fact, the command |\Block| accepts as first optional argument (between
+% square brackets) a list of couples key-value. The available keys are as
+% follows:
+% \begin{itemize}
+% \item the keys |l|, |c| and |r| are used to fix the horizontal position of the
+% content of the block, as explained previously;
+% \item the key |fill| takes in as value a color and fills the block with that
+% color;
+% \item the key |draw| takes in as value a color and strokes the frame of the
+% block with that color (the default value of that key is the current color of
+% the rules of the array);
+% \item the key |color| takes in as value a color and apply that color the
+% content of the block but draws also the frame of the block with that color;
+% \item the key |line-width| is the width (thickness) of the frame (this key
+% should be used only when the key |draw| is in force);
+% \item \colorbox{yellow!50}{\textbf{New 5.12}}\enskip the key |rounded-corners|
+% requires rounded corners (for the frame drawn by |draw| and the shape drawn by
+% |fill|) with a radius equal to the value of that key (the default value is
+% 4~pt\footnote{This value is the initial value of the \emph{rounded corners} of
+% Tikz.}).
+% \end{itemize}
+%
% \interitem
% {\bfseries One must remark that, by default, the commands |\Blocks| don't create space}.
% There is exception only for the blocks mono-row and the blocks mono-column as
@@ -556,35 +577,29 @@ version 2005/12/01 or later.
% In the following example, we have had to enlarge by hand the columns 2 and 3
% (with the construction |wc{...}| of \pkg{array}).
%
-% \medskip
+% \bigskip
% \begin{BVerbatim}
-% \begin{NiceTabular}~emphase#{cwc{2cm}wc{3cm}c}@
+% \begin{NiceTabular}{cwc{2cm}wc{3cm}c}
% rose & tulipe & marguerite & dahlia \\
% violette
-% & \Block[draw=red,fill=red!15]{2-2}{\LARGE De très jolies fleurs} & & souci \\
+% & ~emphase#\Block[draw=red,fill=red!15,rounded-corners]{2-2}{\LARGE De très jolies fleurs}@
+% & & souci \\
% pervenche & & & lys \\
% arum & iris & jacinthe & muguet
% \end{NiceTabular}
% \end{BVerbatim}
%
-%
% \medskip
% \begin{center}
% \begin{NiceTabular}{cwc{2cm}wc{3cm}c}
% rose & tulipe & marguerite & dahlia \\
-% violette &
-% \Block[draw=red,fill=red!15]{2-2}{\LARGE De très jolies fleurs} & & souci \\
+% violette & \Block[draw=red,fill=red!15,rounded-corners]{2-2}
+% {\LARGE De très jolies fleurs} & & souci \\
% pervenche & & & lys \\
% arum & iris & jacinthe & muguet
% \end{NiceTabular}
% \end{center}
%
-% As we can see on this example, it's possible to fill the block by using the
-% key |fill| and to draw the frame with the key |draw|\footnote{If the key
-% |draw| is used without value, the default color the rules of the tabulars is
-% used}. It's also possible to change the width (thickness) of that rules with
-% the key |line-width|.
-%
% \subsection{The mono-column blocks}
%
% The mono-column blocks have a special behaviour.
@@ -655,9 +670,11 @@ version 2005/12/01 or later.
% derogation of the type of column given in the preamble of the array.
%
% \item It's possible do draw a frame around the cell with the key |draw| of the
-% command |\Block|.\footnote{If one wishes to color the background of a unique
-% celle, there is no point using the command |\Block|: it's possible to use the
-% command |\cellcolor| (when the key |colortbl-like| is used).}
+% command |\Block| and to fill the background with rounded corners with the keys
+% |fill| and |rounded-corners|.\footnote{If one simply wishes to color the
+% background of a unique celle, there is no point using the command |\Block|:
+% it's possible to use the command |\cellcolor| (when the key |colortbl-like| is
+% used).}
% \end{itemize}
%
% \bigskip
@@ -908,10 +925,10 @@ version 2005/12/01 or later.
% \subsection{The keys hlines and vlines}
%
% The key |hlines| draws all the horizontal rules and the key |vlines| draws all
-% the vertical rules excepted in the blocks (and the virtual blocks determined
-% by dotted lines). In fact, in the environments with delimiters (as
-% |{pNiceMatrix}| or |{bNiceArray}|) the exteriors rules are not drawn (as
-% expected).
+% the vertical rules excepted in the blocks, created by |\Block| and the virtual
+% blocks determined by dotted lines: |\Cdots|, |\Vdots|, etc.. In fact, in the
+% environments with delimiters (as |{pNiceMatrix}| or |{bNiceArray}|) the
+% exteriors rules are not drawn (as expected).
%
% \medskip
% \begin{BVerbatim}[baseline=c,boxwidth=10.6cm]
@@ -1164,11 +1181,27 @@ version 2005/12/01 or later.
%
% \medskip
% The extension \pkg{nicematrix} provides a key |code-before| for some code that
-% will be executed before the drawing of the tabular. In this |code-before|, new
-% commands are available: |\cellcolor|, |\rectanglecolor|, |\rowcolor|,
-% |\columncolor|, |\rowcolors| and |\chessboardcolors|.\footnote{Remark that, in
-% the \verb|code-before|, some PGF/Tikz nodes corresponding to the position to
-% the potential rules are available: cf.~p.~\pageref{nodes-i}.}
+% will be executed before the drawing of the tabular.
+%
+% \medskip
+% \colorbox{yellow!50}{\textbf{New 5.12}}\enskip An alternative syntax is
+% provided: it's possible to put the content of that |code-before| between the
+% keywords |\CodeBefore| and |\Body| at the beginning of the environment.
+%
+% \begin{Verbatim}
+% \begin{pNiceArray}{~textsl#preamble@}
+% ~emphase#\CodeBefore@
+% ~textsl#instructions of the code-before@
+% ~emphase#\Body@
+% ~textsl#contents of the environnement@
+% \end{pNiceArray}
+% \end{Verbatim}
+%
+% New commands are available in that |\CodeBefore|: |\cellcolor|,
+% |\rectanglecolor|, |\rowcolor|, |\columncolor|, |\rowcolors| and
+% |\chessboardcolors|.\footnote{Remark that, in the \verb|code-before|, some
+% PGF/Tikz nodes corresponding to the position to the potential rules are
+% available: cf.~p.~\pageref{nodes-i}.}
% \label{code-before}
%
% \medskip
@@ -1189,16 +1222,20 @@ version 2005/12/01 or later.
% \begin{scope}
% \hfuzz=10cm
% \begin{BVerbatim}[boxwidth=10cm,baseline=c]
-% \begin{NiceTabular}{|c|c|c|}[code-before =
-% ~emphase#\cellcolor{red!15}{3-1,2-2,1-3}@]
+% \begin{NiceTabular}{|c|c|c|}
+% \CodeBefore
+% ~emphase#\cellcolor{red!15}{3-1,2-2,1-3}@
+% \Body
% \hline
% a & b & c \\ \hline
% e & f & g \\ \hline
% h & i & j \\ \hline
% \end{NiceTabular}
% \end{BVerbatim}
-% \begin{NiceTabular}{|c|c|c|}[code-before =
-% \cellcolor{red!15}{3-1,2-2,1-3}]
+% \begin{NiceTabular}{|c|c|c|}
+% \CodeBefore
+% \cellcolor{red!15}{3-1,2-2,1-3}
+% \Body
% \hline
% a & b & c \\ \hline
% e & f & g \\ \hline
@@ -1215,16 +1252,20 @@ version 2005/12/01 or later.
% \begin{scope}
% \hfuzz=10cm
% \begin{BVerbatim}[boxwidth=10cm,baseline=c]
-% \begin{NiceTabular}{|c|c|c|}[code-before =
-% ~emphase#\rectanglecolor{blue!15}{2-2}{3-3}@]
+% \begin{NiceTabular}{|c|c|c|}
+% \CodeBefore
+% ~emphase#\rectanglecolor{blue!15}{2-2}{3-3}@
+% \Body
% \hline
% a & b & c \\ \hline
% e & f & g \\ \hline
% h & i & j \\ \hline
% \end{NiceTabular}
% \end{BVerbatim}
-% \begin{NiceTabular}{|c|c|c|}[code-before =
-% \rectanglecolor{blue!15}{2-2}{3-3}]
+% \begin{NiceTabular}{|c|c|c|}
+% \CodeBefore
+% \rectanglecolor{blue!15}{2-2}{3-3}
+% \Body
% \hline
% a & b & c \\ \hline
% e & f & g \\ \hline
@@ -1244,7 +1285,10 @@ version 2005/12/01 or later.
% \begin{scope}
% \hfuzz = 10cm
% \begin{BVerbatim}[boxwidth=9cm,baseline=c]
-% $\begin{NiceArray}{lll}[hvlines, ~emphase#code-before = \rowcolor{red!15}{1,3-5,8-}@]
+% $\begin{NiceArray}{lll}[hvlines]
+% \CodeBefore
+% ~emphase#code-before = \rowcolor{red!15}{1,3-5,8-}@
+% \Body
% a_1 & b_1 & c_1 \\
% a_2 & b_2 & c_2 \\
% a_3 & b_3 & c_3 \\
@@ -1257,7 +1301,10 @@ version 2005/12/01 or later.
% a_{10} & b_{10} & c_{10} \\
% \end{NiceArray}$
% \end{BVerbatim}
-% $\begin{NiceArray}{lll}[baseline=4,hvlines, code-before = \rowcolor{red!15}{1,3-5,8-}]
+% $\begin{NiceArray}{lll}[baseline=4,hvlines]
+% \CodeBefore
+% \rowcolor{red!15}{1,3-5,8-}
+% \Body
% a_1 & b_1 & c_1 \\
% a_2 & b_2 & c_2 \\
% a_3 & b_3 & c_3 \\
@@ -1314,9 +1361,11 @@ version 2005/12/01 or later.
% \begin{scope}
% \hfuzz=10cm
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
-% \begin{NiceTabular}{clr}
-% [hvlines,code-before = ~emphase#{\rowcolors{2}{blue!10}{}[cols=2-3,restart]}@]
-% \Block{1-}{Results} \\
+% \begin{NiceTabular}{clr}[hvlines]
+% \CodeBefore
+% ~emphase#\rowcolors{2}{blue!10}{}[cols=2-3,restart]@
+% \Body
+% \Block{1-*}{Results} \\
% John & 12 \\
% Stephen & 8 \\
% Sarah & 18 \\
@@ -1325,9 +1374,11 @@ version 2005/12/01 or later.
% Madison & 15
% \end{NiceTabular}
% \end{BVerbatim}
-% \begin{NiceTabular}{clr}[hvlines,code-before =
-% {\rowcolors{2}{blue!10}{}[cols=2-3,restart]},baseline=2]
-% \Block{1-}{Results} \\
+% \begin{NiceTabular}{clr}[hvlines,baseline=2]
+% \CodeBefore
+% \rowcolors{2}{blue!10}{}[cols=2-3,restart]
+% \Body
+% \Block{1-*}{Results} \\
% \Block{2-1}{A}& John & 12 \\
% & Stephen & 8 \\
% \Block{4-1}{B}& Sarah & 18 \\
@@ -1341,8 +1392,10 @@ version 2005/12/01 or later.
% \begin{scope}
% \hfuzz=10cm
% \begin{BVerbatim}[baseline=c,boxwidth=10cm]
-% \begin{NiceTabular}{lr}[hvlines,code-before =
-% ~emphase#\rowcolors{1}{blue!10}{}[respect-blocks]@]
+% \begin{NiceTabular}{lr}[hvlines]
+% \CodeBefore
+% ~emphase#\rowcolors{1}{blue!10}{}[respect-blocks]@
+% \Body
% \Block{2-1}{John} & 12 \\
% & 13 \\
% Steph & 8 \\
@@ -1355,8 +1408,10 @@ version 2005/12/01 or later.
% & 19
% \end{NiceTabular}
% \end{BVerbatim}
-% \begin{NiceTabular}{lr}[hvlines,code-before =
-% \rowcolors{1}{blue!10}{}[respect-blocks],baseline=c]
+% \begin{NiceTabular}{lr}[hvlines,baseline=c]
+% \CodeBefore
+% \rowcolors{1}{blue!10}{}[respect-blocks]
+% \Body
% \Block{2-1}{John} & 12 \\
% & 13 \\
% Steph & 8 \\
@@ -1379,13 +1434,19 @@ version 2005/12/01 or later.
% \begin{scope}
% \hfuzz=10cm
% \begin{BVerbatim}[baseline=c,boxwidth=9cm]
-% $\begin{pNiceMatrix}[r,margin, ~emphase#code-before=\chessboardcolors{red!15}{blue!15}@]
+% $\begin{pNiceMatrix}[r,margin]
+% \CodeBefore
+% ~emphase#code-before=\chessboardcolors{red!15}{blue!15}@
+% \Body
% 1 & -1 & 1 \\
% -1 & 1 & -1 \\
% 1 & -1 & 1
% \end{pNiceMatrix}$
% \end{BVerbatim}
-% $\begin{pNiceMatrix}[r,baseline=1, margin, code-before = \chessboardcolors{red!15}{blue!15}]
+% $\begin{pNiceMatrix}[r,baseline=1, margin]
+% \CodeBefore
+% \chessboardcolors{red!15}{blue!15}
+% \Body
% 1 & -1 & 1 \\
% -1 & 1 & -1 \\
% 1 & -1 & 1
@@ -1407,8 +1468,11 @@ version 2005/12/01 or later.
% \begin{scope}
% \hfuzz=10cm
% \begin{BVerbatim}[baseline=c,boxwidth=8.5cm]
-% \begin{NiceTabular}[c]{lSSSS}%
-% [code-before = \rowcolor{red!15}{1-2} \rowcolors{3}{blue!15}{}]
+% \begin{NiceTabular}[c]{lSSSS}
+% \CodeBefore
+% \rowcolor{red!15}{1-2}
+% \rowcolors{3}{blue!15}{}
+% \Body
% ~emphase#\toprule@
% \Block{2-1}{Product} &
% \Block{1-3}{dimensions (cm)} & & &
@@ -1424,8 +1488,11 @@ version 2005/12/01 or later.
% ~emphase#\bottomrule@
% \end{NiceTabular}
% \end{BVerbatim}
-% \begin{NiceTabular}[c]{lSSSS}[code-before = \rowcolor{red!15}{1-2}
-% \rowcolors{3}{blue!15}{}]
+% \begin{NiceTabular}[c]{lSSSS}
+% \CodeBefore
+% \rowcolor{red!15}{1-2}
+% \rowcolors{3}{blue!15}{}
+% \Body
% \toprule
% \Block{2-1}{Product} &
% \Block{1-3}{dimensions (cm)} & & &
@@ -1645,7 +1712,6 @@ version 2005/12/01 or later.
% for the potential ``first column''.
%
% \begin{Verbatim}
-% $\begin{pNiceMatrix}[~emphase#first-row,last-row,first-col,last-col@]
% $\begin{pNiceMatrix}[~emphase#first-row,last-row,first-col,last-col@,nullify-dots]
% & C_1 & \Cdots & & C_4 & \\
% L_1 & a_{11} & a_{12} & a_{13} & a_{14} & L_1 \\
@@ -1654,7 +1720,6 @@ version 2005/12/01 or later.
% L_4 & a_{41} & a_{42} & a_{43} & a_{44} & L_4 \\
% & C_1 & \Cdots & & C_4 &
% \end{pNiceMatrix}$
-% \end{pNiceMatrix}$
% \end{Verbatim}
%
% \[\begin{pNiceMatrix}[first-row,last-row,first-col,last-col,nullify-dots]
@@ -2053,7 +2118,7 @@ version 2005/12/01 or later.
% & ~emphase#\Hdotsfor{1}@ & \Vdots & \Ddots & \Vdots \\
% C[a_n,a_1] & \Cdots & C[a_n,a_n]
% & & C[a_n,a_1^{(p)}] & \Cdots & C[a_n,a_n^{(p)}] \\
-% \rule{0pt}{15mm} & ~emphase#\Vdotsfor{1}@ & & \Ddots & & ~emphase#\Vdotsfor{1}@ \\
+% \rule{0pt}{15mm}\NotEmpty & ~emphase#\Vdotsfor{1}@ & & \Ddots & & ~emphase#\Vdotsfor{1}@ \\
% C[a_1^{(p)},a_1] & \Cdots & C[a_1^{(p)},a_n]
% & & C[a_1^{(p)},a_1^{(p)}] & \Cdots & C[a_1^{(p)},a_n^{(p)}] \\
% \Vdots & \Ddots & \Vdots
@@ -2068,7 +2133,7 @@ version 2005/12/01 or later.
% C[a_1,a_1] & \Cdots & C[a_1,a_n] & \hspace*{20mm} & C[a_1,a_1^{(p)}] & \Cdots & C[a_1,a_n^{(p)}] \\
% \Vdots & \Ddots & \Vdots & \Hdotsfor{1} & \Vdots & \Ddots & \Vdots \\
% C[a_n,a_1] & \Cdots & C[a_n,a_n] & & C[a_n,a_1^{(p)}] & \Cdots & C[a_n,a_n^{(p)}] \\
-% \rule{0pt}{15mm} & \Vdotsfor{1} & & \Ddots & & \Vdotsfor{1} \\
+% \rule{0pt}{15mm}\NotEmpty & \Vdotsfor{1} & & \Ddots & & \Vdotsfor{1} \\
% C[a_1^{(p)},a_1] & \Cdots & C[a_1^{(p)},a_n] & & C[a_1^{(p)},a_1^{(p)}] & \Cdots & C[a_1^{(p)},a_n^{(p)}] \\
% \Vdots & \Ddots & \Vdots & \Hdotsfor{1} & \Vdots & \Ddots & \Vdots \\
% C[a_n^{(p)},a_1] & \Cdots & C[a_n^{(p)},a_n] & & C[a_n^{(p)},a_1^{(p)}] & \Cdots & C[a_n^{(p)},a_n^{(p)}]
@@ -2340,7 +2405,7 @@ version 2005/12/01 or later.
%
% \label{sub-matrix}
%
-% \colorbox{yellow!50}{\textbf{New 5.10}}\enskip
+% \colorbox{yellow!30}{New 5.10}\enskip
% The command |\SubMatrix| provides a way to put delimiters on a portion
% of the array considered as a submatrix. The command |\SubMatrix| takes in five
% arguments:
@@ -2352,7 +2417,12 @@ version 2005/12/01 or later.
% syntax $i$|-|$j$ where $i$ the number of row and $j$ the number of column;
% \item the third argument is the lower-right corner with the same syntax;
% \item the fourth argument is the right delimiter;
-% \item the last argument, which is optional, is a list of key-value pairs.
+% \item the last argument, which is optional, is a list of key-value
+% pairs.\footnote{There is no optional argument between square brackets in first
+% position because a square bracket just after |\SubMatrix| must be interpreted
+% as the first (mandatory) argument of the command |\SubMatrix|: that bracket is
+% the left delimiter of the sub-matrix to construct (eg.:
+% |\SubMatrix[{2-2}{4-7}]|).}
% \end{itemize}
%
% One should remark that the command |\SubMatrix| draws the delimiters after the
@@ -2371,8 +2441,8 @@ version 2005/12/01 or later.
% \dfrac{1}{4} & \dfrac{1}{2} & \dfrac{1}{4} & y \\
% 1 & 2 & 3 & z
% \CodeAfter
-% ~emphase#\SubMatrix({1-1}{3-3})+
-% ~emphase#\SubMatrix({1-4}{3-4})+
+% ~emphase#\SubMatrix({1-1}{3-3})+
+% ~emphase#\SubMatrix({1-4}{3-4})+
% \end{NiceArray}\]
% \end{BVerbatim}
% \end{scope}
@@ -2381,8 +2451,8 @@ version 2005/12/01 or later.
% \dfrac{1}{4} & \dfrac{1}{2} & \dfrac{1}{4} & y \\
% 1 & 2 & 3 & z
% \CodeAfter
-% \SubMatrix({1-1}{3-3})
-% \SubMatrix({1-4}{3-4})
+% \SubMatrix({1-1}{3-3})
+% \SubMatrix({1-4}{3-4})
% \end{NiceArray}$
%
% \bigskip
@@ -2394,7 +2464,7 @@ version 2005/12/01 or later.
% (height |\ht| + depth |\dp|);
% \item |delimiters/color| fixes the color of the delimiters (also
% available in |\NiceMatrixOptions|, in the environments with delimiters and as
-% option of the command |\CodeAfter|);
+% option of the keyword |\CodeAfter|);
% \item |slim| is a boolean key: when that key is in force, the horizontal
% position of the delimiters is computed by using only the contents of the cells
% of the submatrix whereas, in the general case, the position is computed by
@@ -2407,6 +2477,24 @@ version 2005/12/01 or later.
% the prefix |sub-matrix| which means that their names are therefore
% |sub-matrix/left-xshift|, |sub-matrix/right-xshift|, |sub-matrix/xshift|, etc.
%
+% \bigskip
+% \medskip
+% \colorbox{yellow!50}{\textbf{New 5.12}}\enskip There is also the following
+% keys, which are available only for an individual command |\SubMatrix|:
+%
+% \begin{itemize}
+% \item |vlines| contents a list of numbers of vertical rules that will be drawn in
+% the sub-matrix (if this key is used without value, all the vertical rules of
+% the sub-matrix are drawn);
+%
+% \item |hlines| is similar to |vlines| but for the horizontal rules;
+%
+% \item |hvlines|, which must be used without value, draws all the vertical and
+% horizontal rules.
+% \end{itemize}
+% One should remark that these keys add their rules after the construction of
+% the main matrix: no space is added between the rows and the columns of the
+% array for theses rules.
%
% \bigskip
% \begin{scope}
@@ -2419,9 +2507,9 @@ version 2005/12/01 or later.
% a & b & \frac12a+\frac14b \\
% c & d & \frac12c+\frac14d \\
% \CodeAfter
-% \SubMatrix({1-3}{2-3})
-% \SubMatrix({3-1}{4-2})
-% \SubMatrix({3-3}{4-3})
+% \SubMatrix({1-3}{2-3})
+% \SubMatrix({3-1}{4-2})
+% \SubMatrix({3-3}{4-3})
% \end{NiceArray}$
% \end{BVerbatim}
% \end{scope}
@@ -2431,9 +2519,9 @@ version 2005/12/01 or later.
% a & b & \frac12a+\frac14b \\
% c & d & \frac12c+\frac14d \\
% \CodeAfter
-% \SubMatrix({1-3}{2-3})
-% \SubMatrix({3-1}{4-2})
-% \SubMatrix({3-3}{4-3})
+% \SubMatrix({1-3}{2-3})
+% \SubMatrix({3-1}{4-2})
+% \SubMatrix({3-3}{4-3})
% \end{NiceArray}$
%
% \medskip
@@ -2450,9 +2538,9 @@ version 2005/12/01 or later.
% a & b & \frac12a+\frac14b \\
% c & d & \frac12c+\frac14d \\
% \CodeAfter
-% \SubMatrix({1-3}{2-3})[~emphase#slim!]
-% \SubMatrix({3-1}{4-2})
-% \SubMatrix({3-3}{4-3})
+% \SubMatrix({1-3}{2-3})[~emphase#slim!]
+% \SubMatrix({3-1}{4-2})
+% \SubMatrix({3-3}{4-3})
% \end{NiceArray}$
% \end{BVerbatim}
% \end{scope}
@@ -2462,15 +2550,15 @@ version 2005/12/01 or later.
% a & b & \frac12a+\frac14b \\
% c & d & \frac12c+\frac14d \\
% \CodeAfter
-% \SubMatrix({1-3}{2-3})[slim]
-% \SubMatrix({3-1}{4-2})
-% \SubMatrix({3-3}{4-3})
+% \SubMatrix({1-3}{2-3})[slim]
+% \SubMatrix({3-1}{4-2})
+% \SubMatrix({3-3}{4-3})
% \end{NiceArray}$
%
%
% \bigskip
% There is also a key |name| which gives a name to the submatrix created by
-% |\SubMatrix|. That name is used to created PGF/Tikz nodes: cf
+% |\SubMatrix|. That name is used to create PGF/Tikz nodes: cf
% p.~\pageref{node-sub-matrix}.
%
% \section{The notes in the tabulars}
@@ -3196,7 +3284,7 @@ version 2005/12/01 or later.
% 4 & 5 & 6 \\
% 7 & 8 & 9
% \CodeAfter
-% \tikz \draw ~emphase#(2-2)@ circle (2mm) ;
+% \tikz \draw ~emphase#(2-2)@ circle (2mm) ;
% \end{pNiceMatrix}$
% \end{BVerbatim}
% $\begin{pNiceMatrix}
@@ -3204,7 +3292,7 @@ version 2005/12/01 or later.
% 4 & 5 & 6 \\
% 7 & 8 & 9
% \CodeAfter
-% \tikz \draw (2-2) circle (2mm) ;
+% \tikz \draw (2-2) circle (2mm) ;
% \end{pNiceMatrix}$
%
%
@@ -3444,7 +3532,7 @@ version 2005/12/01 or later.
% \subsection{The nodes which indicate the position of the rules}
%
% \label{nodes-i}
-% \colorbox{yellow!50}{\textbf{New 5.11}}\enskip The package \pkg{nicematrix}
+% \colorbox{yellow!30}{New 5.11}\enskip The package \pkg{nicematrix}
% creates a PGF/Tikz node merely called $i$ (with the classical prefix) at the
% intersection of the horizontal rule of number~$i$ and the vertical rule of
% number~$j$ (more specifically the potential position of those rules because
@@ -3456,32 +3544,30 @@ version 2005/12/01 or later.
% arum & iris & violette \\
% muguet & dahlia & souci
% \CodeAfter
-% \tiny
-% \begin{tikzpicture}
-% \foreach \i in {1,2,3,4}
-% {
-% \fill [red] (\i) circle (0.5mm) ;
-% \node [red,above right] at (\i) {\i} ;
-% }
-% \end{tikzpicture}
+% \tiny
+% \begin{tikzpicture}
+% \foreach \i in {1,2,3,4}
+% {
+% \fill [red] (\i) circle (0.5mm) ;
+% \node [red,above right] at (\i) {\i} ;
+% }
+% \end{tikzpicture}
% \end{NiceTabular}
% \end{center}
%
% \bigskip
% If we use Tikz (we remind that \pkg{nicematrix} does not load Tikz by default,
% by only \textsc{pgf}, which is a sub-layer of Tikz), we can access, in the
-% |\CodeAfter| but also in the |code-before|) to the intersection of the horizontal
-% rule~$i$ and the vertical rule~$j$ with the syntax |(|$i$\verb+-|+$j$|)|.
+% |\CodeAfter| but also in the |code-before|, to the intersection of the
+% (potential) horizontal rule~$i$ and the (potential) vertical rule~$j$ with the
+% syntax |(|$i$\verb+-|+$j$|)|.
%
% \medskip
% \begin{Verbatim}
-% \[\begin{NiceMatrix}[
-% code-before =
-% {
-% ~emphase# \tikz \draw [fill = red!15] @
-% ~emphase# (7-|4) -- (8-|4) -- (8-|5) -- (9-|5) -- (9-|6) |- cycle ; @
-% }
-% ]
+% \begin{NiceMatrix}
+% \CodeBefore
+% ~emphase#\tikz \draw [fill=red!15] (7-|4) |- (8-|5) |- (9-|6) |- cycle ;@
+% \Body
% 1 \\
% 1 & 1 \\
% 1 & 2 & 1 \\
@@ -3491,15 +3577,13 @@ version 2005/12/01 or later.
% 1 & 6 & 15 & 20 & 15 & 6 & 1 \\
% 1 & 7 & 21 & 35 & 35 & 21 & 7 & 1 \\
% 1 & 8 & 28 & 56 & 70 & 56 & 28 & 8 & 1
-% \end{NiceMatrix}\]
+% \end{NiceMatrix}
% \end{Verbatim}
-% \[\begin{NiceMatrix}[
-% code-before =
-% {
-% \tikz \draw [fill = red!15]
-% (7-|4) -- (8-|4) -- (8-|5) -- (9-|5) -- (9-|6) |- cycle ;
-% }
-% ]
+% %
+% \[\begin{NiceMatrix}
+% \CodeBefore
+% \tikz \draw [fill=red!15] (7-|4) |- (8-|5) |- (9-|6) |- cycle ;
+% \Body
% 1 \\
% 1 & 1 \\
% 1 & 2 & 1 \\
@@ -3515,7 +3599,7 @@ version 2005/12/01 or later.
%
% \label{node-sub-matrix}
%
-% \colorbox{yellow!50}{\textbf{New 5.10}}\enskip
+% \colorbox{yellow!30}{New 5.10}\enskip
% The command |\SubMatrix| available in the |\CodeAfter| has been described
% p.~\pageref{sub-matrix}.
%
@@ -3540,14 +3624,14 @@ version 2005/12/01 or later.
% 3462 & 38458 & 34 & 294 \\
% 34 & 7 & 78 & 309 \\
% \CodeAfter
-% \SubMatrix\{{2-2}{3-3}\}[name=A]
-% \begin{tikzpicture}
-% [every node/.style = {blend mode = multiply,
-% inner sep = 0 pt}]
-% \node [fit = (A),fill = red!15] {} ;
-% \node [fit = (A-left),fill = blue!15] {} ;
-% \node [fit = (A-right),fill = blue!15] {} ;
-% \end{tikzpicture}
+% \SubMatrix\{{2-2}{3-3}\}[name=A]
+% \begin{tikzpicture}
+% [every node/.style = {blend mode = multiply,
+% inner sep = 0 pt}]
+% \node [fit = (A),fill = red!15] {} ;
+% \node [fit = (A-left),fill = blue!15] {} ;
+% \node [fit = (A-right),fill = blue!15] {} ;
+% \end{tikzpicture}
% \end{pNiceMatrix}\]
%
% \section{API for the developpers}
@@ -3588,10 +3672,8 @@ version 2005/12/01 or later.
%\ExplSyntaxOn
% \cs_new_protected:Nn \__pantigny_hatch:nnn
% {
-% \begin { tikzpicture }
-% \fill [ pattern = north~west~lines , pattern~color = #3 ]
-% ( #1 -| #2) rectangle ( \int_eval:n { #1 + 1 } -| \int_eval:n { #2 + 1 } ) ;
-% \end { tikzpicture }
+% \tikz \fill [ pattern = north~west~lines , pattern~color = #3 ]
+% ( #1 -| #2) rectangle ( \int_eval:n { #1 + 1 } -| \int_eval:n { #2 + 1 } ) ;
% }
%
% \NewDocumentCommand \hatchcell { ! O { black } }
@@ -3607,10 +3689,8 @@ version 2005/12/01 or later.
% \ExplSyntaxOn
% \cs_new_protected:Nn \__pantigny_hatch:nnn
% {
-% \begin { tikzpicture }
-% \fill [ pattern = north~west~lines , pattern~color = #3 ]
-% ( #1 -| #2 ) rectangle ( \int_eval:n { #1 + 1 } -| \int_eval:n { #2 + 1 } ) ;
-% \end { tikzpicture }
+% \tikz \fill [ pattern = north~west~lines , pattern~color = #3 ]
+% ( #1 -| #2 ) rectangle ( \int_eval:n { #1 + 1 } -| \int_eval:n { #2 + 1 } ) ;
% }
%
% \NewDocumentCommand \hatchcell { ! O { black } }
@@ -4085,97 +4165,223 @@ version 2005/12/01 or later.
% \end{pNiceMatrix}\]
% \end{scope}
%
-% \subsection{Width of the columns}
-%
+%
+% \subsection{Stacks of matrices}
+%
+% We often need to compose mathematical matrices on top on each other (for
+% example for the resolution of linear systems).
%
% \medskip
-% In the following example, we use |{NiceMatrixBlock}| with the option
-% |auto-columns-width| because we want the same automatic width for all the
-% columns of the matrices.
+% In order to have the columns aligned one above the other, it's possible to
+% fix a width for all the columns. That's what is done in the following example
+% with the environment |{NiceMatrixBlock}| and its option |auto-columns-width|.
%
-% \bigskip
-% \begin{BVerbatim}
+% \begin{Verbatim}[formatcom=\small\color{gray}]
% ~emphase#\begin{NiceMatrixBlock}[auto-columns-width]@
% \NiceMatrixOptions
-% { last-col,code-for-last-col = \color{blue}\scriptstyle,light-syntax}
+% {
+% light-syntax,
+% last-col, code-for-last-col = \color{blue} \scriptstyle,
+% }
% \setlength{\extrarowheight}{1mm}
-% $\begin{pNiceArray}{cccc:c}
-% 1 1 1 1 1 {} ;
-% 2 4 8 16 9 ;
-% 3 9 27 81 36 ;
-% 4 16 64 256 100
+%
+% $\begin{pNiceArray}{rrrr|r}
+% 12 -8 7 5 3 {} ;
+% 3 -18 12 1 4 ;
+% -3 -46 29 -2 -15 ;
+% 9 10 -5 4 7
% \end{pNiceArray}$
-% \medskip
-% $\begin{pNiceArray}{cccc:c}
-% 1 1 1 1 1 ;
-% 0 2 6 14 7 { L_2 \gets -2 L_1 + L_2 } ;
-% 0 6 24 78 33 { L_3 \gets -3 L_1 + L_3 } ;
-% 0 12 60 252 96 { L_4 \gets -4 L_1 + L_4 }
+%
+% \smallskip
+% $\begin{pNiceArray}{rrrr|r}
+% 12 -8 7 5 3 ;
+% 0 64 -41 1 19 { L_2 \gets L_1-4L_2 } ;
+% 0 -192 123 -3 -57 { L_3 \gets L_1+4L_3 } ;
+% 0 -64 41 -1 -19 { L_4 \gets 3L_1-4L_4 } ;
% \end{pNiceArray}$
-% ...
+%
+% \smallskip
+% $\begin{pNiceArray}{rrrr|r}
+% 12 -8 7 5 3 ;
+% 0 64 -41 1 19 ;
+% 0 0 0 0 0 { L_3 \gets 3 L_2 + L_3 }
+% \end{pNiceArray}$
+%
+% \smallskip
+% $\begin{pNiceArray}{rrrr|r}
+% 12 -8 7 5 3 {} ;
+% 0 64 -41 1 19 ;
+% \end{pNiceArray}$
+%
% ~emphase#\end{NiceMatrixBlock}@
-% \end{BVerbatim}
+% \end{Verbatim}
%
% \bigskip
-%
-% \begin{multicols}{2}
% \begin{NiceMatrixBlock}[auto-columns-width]
-% \NiceMatrixOptions{last-col,code-for-last-col = \color{blue}\scriptstyle,light-syntax}
+% \NiceMatrixOptions
+% {
+% light-syntax,
+% last-col, code-for-last-col = \color{blue} \scriptstyle ,
+% }
% \setlength{\extrarowheight}{1mm}
%
-% \enskip $\begin{pNiceArray}{cccc:c}
-% 1 1 1 1 1 {} ;
-% 2 4 8 16 9 ;
-% 3 9 27 81 36 ;
-% 4 16 64 256 100
+% \quad $\begin{pNiceArray}{rrrr|r}
+% 12 -8 7 5 3 {} ;
+% 3 -18 12 1 4 ;
+% -3 -46 29 -2 -15 ;
+% 9 10 -5 4 7
% \end{pNiceArray}$
%
-% \medskip
-%
-% \enskip $\begin{pNiceArray}{cccc:c}
-% 1 1 1 1 1 ;
-% 0 2 6 14 7 { L_2 \gets -2 L_1 + L_2 } ;
-% 0 6 24 78 33 { L_3 \gets -3 L_1 + L_3 } ;
-% 0 12 60 252 96 { L_4 \gets -4 L_1 + L_4 }
+% \smallskip
+% \quad $\begin{pNiceArray}{rrrr|r}
+% 12 -8 7 5 3 ;
+% 0 64 -41 1 19 { L_2 \gets L_1-4L_2 } ;
+% 0 -192 123 -3 -57 { L_3 \gets L_1+4L_3 } ;
+% 0 -64 41 -1 -19 { L_4 \gets 3L_1-4L_4 } ;
% \end{pNiceArray}$
%
-% \medskip
+% \smallskip
+% \quad $\begin{pNiceArray}{rrrr|r}
+% 12 -8 7 5 3 ;
+% 0 64 -41 1 19 ;
+% 0 0 0 0 0 { L_3 \gets 3 L_2 + L_3 }
+% \end{pNiceArray}$
%
-% \enskip $\begin{pNiceArray}{cccc:c}
-% 1 1 1 1 1 ;
-% 0 1 3 7 \frac72 { L_2 \gets \frac12 L_2 } ;
-% 0 3 12 39 \frac{33}2 { L_3 \gets \frac12 L_3 } ;
-% 0 1 5 21 8 { L_4 \gets \frac1{12} L_4 }
+% \smallskip
+% \quad $\begin{pNiceArray}{rrrr|r}
+% 12 -8 7 5 3 {} ;
+% 0 64 -41 1 19 ;
% \end{pNiceArray}$
+% \end{NiceMatrixBlock}
+%
+% \bigskip
+% However, one can see that the last matrix is not perfectly aligned with the
+% other. That's why, in LaTeX, the parenthesis have not exactly the same width
+% (smaller parenthesis are a bit slimer).
%
% \medskip
+% \colorbox{yellow!50}{\textbf{New 5.12}}\enskip In order the solve that
+% problem, it's possible to require the delimiters to be composed with the
+% maximal width, thanks to the boolean key |delimiters/max-width|.
%
-% \enskip $\begin{pNiceArray}{cccc:c}
-% 1 1 1 1 1 ;
-% 0 1 3 7 \frac72 ;
-% 0 0 3 18 6 { L_3 \gets -3 L_2 + L_3 } ;
-% 0 0 -2 -14 -\frac92 { L_4 \gets L_2 - L_4 }
+% \begin{Verbatim}[formatcom=\small\color{gray}]
+% ~emphase#\begin{NiceMatrixBlock}[auto-columns-width]@
+% \NiceMatrixOptions
+% {
+% ~emphase#delimiters/max-width@,
+% light-syntax,
+% last-col, code-for-last-col = \color{blue}\scriptstyle,
+% }
+% \setlength{\extrarowheight}{1mm}
+%
+% $\begin{pNiceArray}{rrrr|r}
+% 12 -8 7 5 3 {} ;
+% 3 -18 12 1 4 ;
+% -3 -46 29 -2 -15 ;
+% 9 10 -5 4 7
% \end{pNiceArray}$
%
-% \medskip
+% ...
+% ~emphase#\end{NiceMatrixBlock}@
+% \end{Verbatim}
%
-% \enskip $\begin{pNiceArray}{cccc:c}
-% 1 1 1 1 1 ;
-% 0 1 3 7 \frac72 ;
-% 0 0 1 6 2 { L_3 \gets \frac13 L_3 } ;
-% 0 0 -2 -14 -\frac92
+% \bigskip
+% \begin{NiceMatrixBlock}[auto-columns-width]
+% \NiceMatrixOptions
+% {
+% delimiters/max-width,
+% light-syntax,
+% last-col, code-for-last-col = \color{blue}\scriptstyle,
+% }
+% \setlength{\extrarowheight}{1mm}
+%
+% \quad $\begin{pNiceArray}{rrrr|r}
+% 12 -8 7 5 3 {} ;
+% 3 -18 12 1 4 ;
+% -3 -46 29 -2 -15 ;
+% 9 10 -5 4 7
% \end{pNiceArray}$
%
-% \medskip
+% \smallskip
+% \quad $\begin{pNiceArray}{rrrr|r}
+% 12 -8 7 5 3 ;
+% 0 64 -41 1 19 { L_2 \gets L_1-4L_2 } ;
+% 0 -192 123 -3 -57 { L_3 \gets L_1+4L_3 } ;
+% 0 -64 41 -1 -19 { L_4 \gets 3L_1-4L_4 } ;
+% \end{pNiceArray}$
%
-% \enskip $\begin{pNiceArray}{cccc:c}
-% 1 1 1 1 1 ;
-% 0 1 3 7 \frac72 ;
-% 0 0 1 6 2 ;
-% 0 0 0 -2 -\frac12 { L_4 \gets L_3 + L_4 }
+% \smallskip
+% \quad $\begin{pNiceArray}{rrrr|r}
+% 12 -8 7 5 3 ;
+% 0 64 -41 1 19 ;
+% 0 0 0 0 0 { L_3 \gets 3 L_2 + L_3 }
+% \end{pNiceArray}$
+%
+% \smallskip
+% \quad $\begin{pNiceArray}{rrrr|r}
+% 12 -8 7 5 3 {} ;
+% 0 64 -41 1 19 ;
% \end{pNiceArray}$
+%
% \end{NiceMatrixBlock}
-% \end{multicols}
+%
+%
+% \interitem
+% If you wish an alignment of the different matrices without the same width
+% for all the columns, you can construct a unique array and place the
+% parenthesis with commands |\SubMatrix| in the |\CodeAfter|. Of course, that
+% array can't be broken by a page break.
+%
+% \medskip
+% \begin{Verbatim}
+% \setlength{\extrarowheight}{1mm}
+% \[\begin{NiceMatrix}[ r, last-col=6, code-for-last-col = \scriptstyle \color{blue} ]
+% 12 & -8 & 7 & 5 & 3 \\
+% 3 & -18 & 12 & 1 & 4 \\
+% -3 & -46 & 29 &-2 &-15 \\
+% 9 & 10 &-5 &4 & 7 \\[1mm]
+% 12 & -8 & 7 &5 & 3 \\
+% 0 & 64 &-41 & 1 & 19 & L_2 \gets L_1-4L_2 \\
+% 0 & -192 &123 &-3 &-57 & L_3 \gets L_1+4L_3 \\
+% 0 & -64 & 41 &-1 &-19 & L_4 \gets 3L_1-4L_4 \\[1mm]
+% 12 & -8 &7 &5 & 3 \\
+% 0 & 64 &-41 &1 &19 \\
+% 0 & 0 &0 &0 & 0 & L_3 \gets 3L_2+L_3 \\[1mm]
+% 12 & -8 &7 &5 & 3 \\
+% 0 & 64 &-41 & 1 & 19 \\
+% ~emphase#\CodeAfter@
+% ~emphase# \SubMatrix({1-1}{4-5})[vlines=4]@
+% ~emphase# \SubMatrix({5-1}{8-5})[vlines=4]@
+% ~emphase# \SubMatrix({9-1}{11-5})[vlines=4]@
+% ~emphase# \SubMatrix({12-1}{13-5})[vlines=4]@
+% \end{NiceMatrix}\]
+% \end{Verbatim}
+%
+% \medskip
+% \begin{scope}
+% \setlength{\extrarowheight}{1mm}
+% \[\begin{NiceMatrix}[ r, last-col=6, code-for-last-col = \scriptstyle \color{blue} ]
+% 12 & -8 & 7 & 5 & 3 \\
+% 3 & -18 & 12 & 1 & 4 \\
+% -3 & -46 & 29 &-2 &-15 \\
+% 9 & 10 &-5 &4 & 7 \\[1mm]
+% 12 & -8 & 7 &5 & 3 \\
+% 0 & 64 &-41 & 1 & 19 & L_2 \gets L_1-4L_2 \\
+% 0 & -192 &123 &-3 &-57 & L_3 \gets L_1+4L_3 \\
+% 0 & -64 & 41 &-1 &-19 & L_4 \gets 3L_1-4L_4 \\[1mm]
+% 12 & -8 &7 &5 & 3 \\
+% 0 & 64 &-41 &1 &19 \\
+% 0 & 0 &0 &0 & 0 & L_3 \gets 3L_2+L_3 \\[1mm]
+% 12 & -8 &7 &5 & 3 \\
+% 0 & 64 &-41 & 1 & 19 \\
+% \CodeAfter
+% \SubMatrix({1-1}{4-5})[vlines=4]
+% \SubMatrix({5-1}{8-5})[vlines=4]
+% \SubMatrix({9-1}{11-5})[vlines=4]
+% \SubMatrix({12-1}{13-5})[vlines=4]
+% \end{NiceMatrix}\]
+% \end{scope}
+%
%
%
% \subsection{How to highlight cells of a matrix}
@@ -4320,7 +4526,7 @@ version 2005/12/01 or later.
% & & & 0 \\
% 0 & \Cdots& 0 & 0
% \CodeAfter
-% \tikz \node [highlight = (1-1-block-medium)] {} ;
+% \tikz \node [highlight = (1-1-block-medium)] {} ;
% \end{pNiceMatrix}$
%
%
@@ -4424,117 +4630,42 @@ version 2005/12/01 or later.
% \end{pNiceArray}\]
%
%
-% \subsection{Direct use of the Tikz nodes}
+% \subsection{Utilisation of \textbackslash SubMatrix in the code-before}
%
% In the following example, we illustrate the mathematical product of two
% matrices.
%
-% \medskip
-% The use of |{NiceMatrixBlock}| with the option |auto-columns-width|
-% gives the same width for all the columns and, therefore, a perfect alignment
-% of the two superposed matrices.
-% \begin{Verbatim}
-% \begin{NiceMatrixBlock}[auto-columns-width]
-% \end{Verbatim}
-%
-% \begin{Verbatim}
-% \NiceMatrixOptions{nullify-dots}
-% \end{Verbatim}
-%
-% The three matrices will be displayed using an environment |{array}| (an
-% environment |{tabular}| may also be possible).
-% \begin{Verbatim}
-% $\begin{array}{cc}
-% &
-% \end{Verbatim}
-%
-% The matrix $B$ has a ``first row'' (for $C_j$) and that's why we use the key
-% |first-row|.
-% \begin{Verbatim}
-% \begin{bNiceArray}{c>{\strut}cccc}[name=B,first-row]
-% & & C_j \\
-% b_{11} & \Cdots & b_{1j} & \Cdots & b_{1n} \\
-% \Vdots & & \Vdots & & \Vdots \\
-% & & b_{kj} \\
-% & & \Vdots \\
-% b_{n1} & \Cdots & b_{nj} & \Cdots & b_{nn}
-% \end{bNiceArray} \\ \\
-% \end{Verbatim}
-%
-% The matrix $A$ has a ``first column'' (for $L_i$) and that's why we use the
-% key |first-col|.
-% \begin{Verbatim}
-% \begin{bNiceArray}{cc>{\strut}ccc}[name=A,first-col]
+% The whole figure is an environment |{NiceArray}| and the three pairs of
+% parenthesis have been added with |\SubMatrix| in the |code-before|.
+%
+% You will find the LaTeX code of that figure in the source file of this
+% document.
+%
+% \[\begin{NiceArray}{*{6}{c}@{\hspace{6mm}}*{5}{c}}[nullify-dots]
+% \CodeBefore
+% \SubMatrix({2-7}{6-11})
+% \SubMatrix({7-2}{11-6})
+% \SubMatrix({7-7}{11-11})
+% \Body
+% & & & & & & & & \color{blue}\scriptstyle C_j \\
+% & & & & & & b_{11} & \Cdots & b_{1j} & \Cdots & b_{1n} \\
+% & & & & & & \Vdots & & \Vdots & & \Vdots \\
+% & & & & & & & & b_{kj} \\
+% & & & & & & & & \Vdots \\
+% & & & & & & b_{n1} & \Cdots & b_{nj} & \Cdots & b_{nn} \\[3mm]
% & a_{11} & \Cdots & & & a_{1n} \\
+% & \Vdots & & & & \Vdots & & & \Vdots \\
+% \color{blue}\scriptstyle L_i
+% & a_{i1} & \Cdots & a_{ik} & \Cdots & a_{in} & \Cdots & & c_{ij} \\
% & \Vdots & & & & \Vdots \\
-% L_i & a_{i1} & \Cdots & a_{ik} & \Cdots & a_{in} \\
-% & \Vdots & & & & \Vdots \\
-% & a_{n1} & \Cdots & & & a_{nn}
-% \end{bNiceArray}
-% &
-% \end{Verbatim}
-%
-% In the matrix product, the two dotted lines have an open extremity.
-% \begin{Verbatim}
-% \begin{bNiceArray}{cc>{\strut}ccc}
-% & & & & \\
-% & & \Vdots \\
-% \Cdots & & c_{ij} \\
-% \\
-% \\
-% \end{bNiceArray}
-% \end{array}$
-%
-% \end{NiceMatrixBlock}
-% \end{Verbatim}
-%
-% \begin{Verbatim}
-% \begin{tikzpicture}[remember picture, overlay]
-% \node [highlight = (A-3-1) (A-3-5) ] {} ;
-% \node [highlight = (B-1-3) (B-5-3) ] {} ;
-% \draw [color = gray] (A-3-3) to [bend left] (B-3-3) ;
-% \end{tikzpicture}
-% \end{Verbatim}
-%
-%
-% \begin{NiceMatrixBlock}[auto-columns-width]
-% \NiceMatrixOptions{nullify-dots}
-% $\begin{array}{cc}
-% &
-% \begin{bNiceArray}{c>{\strut}cccc}[name=B,first-row]
-% & & C_j \\
-% b_{11} & \Cdots & b_{1j} & \Cdots & b_{1n} \\
-% \Vdots & & \Vdots & & \Vdots \\
-% & & b_{kj} \\
-% & & \Vdots \\
-% b_{n1} & \Cdots & b_{nj} & \Cdots & b_{nn}
-% \end{bNiceArray} \\ \\
-% \begin{bNiceArray}{cc>{\strut}ccc}[name=A,first-col]
-% & a_{11} & \Cdots & & & a_{1n} \\
-% & \Vdots & & & & \Vdots \\
-% L_i & a_{i1} & \Cdots & a_{ik} & \Cdots & a_{in} \\
-% & \Vdots & & & & \Vdots \\
-% & a_{n1} & \Cdots & & & a_{nn} \\
-% \end{bNiceArray}
-% &
-% \begin{bNiceArray}{cc>{\strut}ccc}
-% & & & & \\
-% & & \Vdots \\
-% \Cdots & & c_{ij} \\
-% \\
-% \\
-% \end{bNiceArray}
-% \end{array}$
-%
-% \end{NiceMatrixBlock}
-%
-% \begin{tikzpicture}[remember picture, overlay]
-% \node [highlight = (A-3-1) (A-3-5) ] {} ;
-% \node [highlight = (B-1-3) (B-5-3) ] {} ;
-% \draw [color = gray] (A-3-3) to [bend left] (B-3-3) ;
-% \end{tikzpicture}
-%
-%
+% & a_{n1} & \Cdots & & & a_{nn} \\
+% \CodeAfter
+% \begin{tikzpicture}
+% \node [highlight = (9-2) (9-6)] { } ;
+% \node [highlight = (2-9) (6-9)] { } ;
+% \draw [gray,shorten > = 1mm, shorten < = 1mm] (9-4.north) to [bend left] (4-9.west) ;
+% \end{tikzpicture}
+% \end{NiceArray}\]
%
%\section{Implementation}
%
@@ -4897,7 +5028,11 @@ version 2005/12/01 or later.
% \end{macrocode}
%
%
-%
+% \bigskip
+% \begin{macrocode}
+\cs_set_eq:NN \@@_old_pgfpointanchor \pgfpointanchor
+% \end{macrocode}
+%
% \bigskip
% \textbf{The column S of siunitx}\par\nobreak
%
@@ -5271,6 +5406,13 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
+% For the key |code| of the command |\SubMatrix| (itself in the main
+% |\CodeAfter|), we will use the following token list.
+% \begin{macrocode}
+\tl_new:N \l_@@_code_tl
+% \end{macrocode}
+%
+% \bigskip
% The following token list has a function similar to
% |\g_nicematrix_code_after_tl| but it is used internally by \pkg{nicematrix}.
% In fact, we have to distinguish between |\g_nicematrix_code_after_tl| and
@@ -5335,8 +5477,9 @@ version 2005/12/01 or later.
% |\g_@@_code_before_|\textsl{i}|_tl| (where \textsl{i} is the number of the
% environment) and, at the beginning of the environment, it will be put in
% |\l_@@_code_before_tl|.
-% \item The final user can explicitely add material in |\l_@@_code_before_tl| by
-% using the key |code-before|.
+% \item The final user can explicitly add material in |\l_@@_code_before_tl| by
+% using the key |code-before| or the keyword |\CodeBefore| (with the keyword
+% |\Body|).
% \end{itemize}
% \begin{macrocode}
\tl_new:N \l_@@_code_before_tl
@@ -5432,8 +5575,29 @@ version 2005/12/01 or later.
\seq_new:N \g_@@_submatrix_names_seq
% \end{macrocode}
%
+% \medskip
+% The following counters will be used when searching the extremities of a dotted
+% line (we need these counters because of the potential ``open'' lines in the
+% |\SubMatrix|---the |\SubMatrix| in the |code-before|).
+% \begin{macrocode}
+\int_new:N \l_@@_row_min_int
+\int_new:N \l_@@_row_max_int
+\int_new:N \l_@@_col_min_int
+\int_new:N \l_@@_col_max_int
+% \end{macrocode}
%
% \medskip
+% The following sequence will be used when the command |\SubMatrix| is used in
+% the |code-before| (and not in the |\CodeAfter|). It will contain the position of
+% all the sub-matrices specified in the |code-before|. Each sub-matrix is
+% represented by an ``object'' of the forme |{|$i$|}{|$j$|}{|$k$|}{|$l$|}|
+% where $i$ and $j$ are the number of row and column of the upper-left cell and
+% $k$ and $l$ the number of row and column of the lower-right cell.
+% \begin{macrocode}
+\seq_new:N \g_@@_submatrix_seq
+% \end{macrocode}
+%
+% \medskip
% We are able to determine the number of columns specified in the preamble (for
% the environments with explicit preamble, of course and without the potential
% exterior columns).
@@ -5442,11 +5606,12 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \medskip
-% The following token lists correspond to the keys |fill| and |draw| of
-% a command |\Block|.
+% The following parameters correspond to the keys |fill|, |draw| and
+% |rounded-corners| of the command |\Block|.
% \begin{macrocode}
\tl_new:N \l_@@_fill_tl
\tl_new:N \l_@@_draw_tl
+\dim_new:N \l_@@_rounded_corners_dim
% \end{macrocode}
%
% \medskip
@@ -5492,8 +5657,8 @@ version 2005/12/01 or later.
\dim_new:N \l_@@_submatrix_extra_height_dim
\dim_new:N \l_@@_submatrix_left_xshift_dim
\dim_new:N \l_@@_submatrix_right_xshift_dim
-\clist_new:N \l_@@_submatrix_hlines_clist
-\clist_new:N \l_@@_submatrix_vlines_clist
+\clist_new:N \l_@@_hlines_clist
+\clist_new:N \l_@@_vlines_clist
% \end{macrocode}
%
%
@@ -5586,7 +5751,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\bool_new:N \g_@@_last_col_found_bool
% \end{macrocode}
-% This boolean is set to |false| at the end of |\@@_pre_array:|.
+% This boolean is set to |false| at the end of |\@@_pre_array_ii:|.
% \end{itemize}
%
% \bigskip
@@ -5957,21 +6122,6 @@ version 2005/12/01 or later.
\bool_set_true:N \l_@@_parallelize_diags_bool
% \end{macrocode}
%
-% \bigskip
-% If the flag |\l_@@_vlines_bool| is raised, horizontal space will be reserved
-% in the the preamble of the array (for the vertical rules) and, after the
-% construction of the array, the vertical rules will be drawn.
-% \begin{macrocode}
-\bool_new:N \l_@@_vlines_bool
-% \end{macrocode}
-%
-% \bigskip
-% If the flag |\l_@@_hlines_bool| is raised, vertical space will be reserved
-% between the rows of the array (for the horizontal rules) and, after the
-% construction of the array, the vertical rules will be drawn.
-% \begin{macrocode}
-\bool_new:N \l_@@_hlines_bool
-% \end{macrocode}
%
% \bigskip
% The flag |\l_@@_except_corners_bool| will be raised when the key
@@ -6076,11 +6226,11 @@ version 2005/12/01 or later.
% |{NiceMatrixBlock}|). However, even if we use the same type of delimiters, the
% width of the delimiters may be different from an array to another because the
% width of the delimiter is fonction of its size. That's why we create an option
-% called |max-delimiter-width| which will give to the delimiters the width of
+% called |delimiters/max-width| which will give to the delimiters the width of
% a delimiter (of the same type) of big size. The following boolean corresponds
% to this option.
% \begin{macrocode}
-\bool_new:N \l_@@_max_delimiter_width_bool
+\bool_new:N \l_@@_delimiters_max_width_bool
% \end{macrocode}
%
% \bigskip
@@ -6153,9 +6303,8 @@ version 2005/12/01 or later.
cell-space-top-limit = #1 ,
cell-space-bottom-limit = #1 ,
} ,
- cell-spaces-limits .value_required:n = true ,
+ cell-space-limits .value_required:n = true ,
xdots .code:n = \keys_set:nn { NiceMatrix / xdots } { #1 } ,
- max-delimiter-width .bool_set:N = \l_@@_max_delimiter_width_bool ,
light-syntax .bool_set:N = \l_@@_light_syntax_bool ,
light-syntax .default:n = true ,
end-of-row .tl_set:N = \l_@@_end_of_row_tl ,
@@ -6172,8 +6321,10 @@ version 2005/12/01 or later.
code-for-first-row .value_required:n = true ,
code-for-last-row .tl_set:N = \l_@@_code_for_last_row_tl ,
code-for-last-row .value_required:n = true ,
- hlines .bool_set:N = \l_@@_hlines_bool ,
- vlines .bool_set:N = \l_@@_vlines_bool ,
+ hlines .clist_set:N = \l_@@_hlines_clist ,
+ vlines .clist_set:N = \l_@@_vlines_clist ,
+ hlines .default:n = all ,
+ vlines .default:n = all ,
vlines-in-sub-matrix .code:n =
{
\tl_if_single_token:nTF { #1 }
@@ -6183,8 +6334,8 @@ version 2005/12/01 or later.
vlines-in-sub-matrix .value_required:n = true ,
hvlines .code:n =
{
- \bool_set_true:N \l_@@_vlines_bool
- \bool_set_true:N \l_@@_hlines_bool
+ \clist_set:Nn \l_@@_vlines_clist { all }
+ \clist_set:Nn \l_@@_hlines_clist { all }
} ,
parallelize-diags .bool_set:N = \l_@@_parallelize_diags_bool ,
% \end{macrocode}
@@ -6221,13 +6372,14 @@ version 2005/12/01 or later.
% \begin{macrocode}
\keys_define:nn { NiceMatrix / Env }
{
+ delimiters/max-width .bool_set:N = \l_@@_delimiters_max_width_bool ,
except-corners .clist_set:N = \l_@@_except_corners_clist ,
except-corners .default:n = { NW , SW , NE , SE } ,
hvlines-except-corners .code:n =
{
\clist_set:Nn \l_@@_except_corners_clist { #1 }
- \bool_set_true:N \l_@@_vlines_bool
- \bool_set_true:N \l_@@_hlines_bool
+ \clist_set:Nn \l_@@_vlines_clist { all }
+ \clist_set:Nn \l_@@_hlines_clist { all }
} ,
hvlines-except-corners .default:n = { NW , SW , NE , SE } ,
code-before .code:n =
@@ -6385,6 +6537,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\keys_define:nn { NiceMatrix / NiceMatrixOptions }
{
+ delimiters / max-width .bool_set:N = \l_@@_delimiters_max_width_bool ,
delimiters / color .tl_set:N = \l_@@_delimiters_color_tl ,
delimiters / color .value_required:n = true ,
delimiters-color .tl_set:N = \l_@@_delimiters_color_tl ,
@@ -6539,6 +6692,8 @@ version 2005/12/01 or later.
delimiters-color .value_required:n = true ,
delimiters / color .tl_set:N = \l_@@_delimiters_color_tl ,
delimiters / color .value_required:n = true ,
+ r .code:n = \@@_error:n { r~or~l~with~preamble } ,
+ l .code:n = \@@_error:n { r~or~l~with~preamble } ,
unknown .code:n = \@@_error:n { Unknown~option~for~NiceArray }
}
% \end{macrocode}
@@ -6555,6 +6710,8 @@ version 2005/12/01 or later.
first-row .code:n = \int_zero:N \l_@@_first_row_int ,
small .bool_set:N = \l_@@_small_bool ,
small .value_forbidden:n = true ,
+ r .code:n = \@@_error:n { r~or~l~with~preamble } ,
+ l .code:n = \@@_error:n { r~or~l~with~preamble } ,
unknown .code:n = \@@_error:n { Unknown~option~for~NiceMatrix }
}
% \end{macrocode}
@@ -6575,6 +6732,8 @@ version 2005/12/01 or later.
last-col .code:n = \tl_if_empty:nF {#1}
{ \@@_error:n { last-col~non~empty~for~NiceArray } }
\int_zero:N \l_@@_last_col_int ,
+ r .code:n = \@@_error:n { r~or~l~with~preamble } ,
+ l .code:n = \@@_error:n { r~or~l~with~preamble } ,
unknown .code:n = \@@_error:n { Unknown~option~for~NiceTabular }
}
% \end{macrocode}
@@ -6999,24 +7158,33 @@ version 2005/12/01 or later.
% We don't draw the rules of the key |hlines| (or |hvlines|) but we reserve the
% vertical space for theses rules.
% \begin{macrocode}
- \bool_if:NT \l_@@_hlines_bool
+ \tl_if_empty:NF \l_@@_hlines_clist
{
+ \tl_if_eq:NnF \l_@@_hlines_clist { all }
+ {
+ \exp_args:NNx
+ \clist_if_in:NnT
+ \l_@@_hlines_clist
+ { \@@_succ:n \c@iRow }
+ }
+ {
% \end{macrocode}
% The counter |\c@iRow| has the value $-1$ only if there is a ``first
% row'' and that we are before that ``first row'', i.e. just before the
% beginning of the array.
% \begin{macrocode}
- \int_compare:nNnT \c@iRow > { -1 }
- {
- \int_compare:nNnF \c@iRow = \l_@@_last_row_int
+ \int_compare:nNnT \c@iRow > { -1 }
+ {
+ \int_compare:nNnF \c@iRow = \l_@@_last_row_int
% \end{macrocode}
% The command |\CT@arc@| is a command of \pkg{colortbl} which sets the color of
% the rules in the array. The package \pkg{nicematrix} uses it even if
% \pkg{colortbl} is not loaded. We use a TeX group in order to limit the scope
% of |\CT@arc@|.
% \begin{macrocode}
- { \hrule height \arrayrulewidth width \c_zero_dim }
- }
+ { \hrule height \arrayrulewidth width \c_zero_dim }
+ }
+ }
}
}
}
@@ -7064,12 +7232,12 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% The following code |\@@_pre_array:| is used in |{NiceArrayWithDelims}|. It
+% The following code |\@@_pre_array_ii:| is used in |{NiceArrayWithDelims}|. It
% exists as a standalone macro only for legibility.
% \label{prearray}
%
% \begin{macrocode}
-\cs_new_protected:Npn \@@_pre_array:
+\cs_new_protected:Npn \@@_pre_array_ii:
{
% \end{macrocode}
% If \pkg{booktabs} is loaded, we have to patch the macro |\@BTnormal| which is
@@ -7260,124 +7428,8 @@ version 2005/12/01 or later.
\tl_gclear_new:N \g_nicematrix_code_before_tl
}
% \end{macrocode}
-% This is the end of |\@@_pre_array:|.
-%
-%
-% \bigskip
-% \subsection*{The environment \{NiceArrayWithDelims\}}
-%
-% \begin{macrocode}
-\NewDocumentEnvironment { NiceArrayWithDelims } { m m O { } m ! O { } }
- {
- \@@_provide_pgfsyspdfmark:
- \bool_if:NT \c_@@_footnote_bool \savenotes
-% \end{macrocode}
-% The aim of the following |\bgroup| (the corresponding |\egroup| is, of course,
-% at the end of the environment) is to be able to put an exposant to a matrix in
-% a mathematical formula.
-% \begin{macrocode}
- \bgroup
-% \end{macrocode}
-%
-% \bigskip
-% \begin{macrocode}
- \tl_set:Nn \l_@@_left_delim_tl { #1 }
- \tl_set:Nn \l_@@_right_delim_tl { #2 }
- \tl_gset:Nn \g_@@_preamble_tl { #4 }
-% \end{macrocode}
-%
-%
-% \bigskip
-%
-% \begin{macrocode}
- \int_gzero:N \g_@@_block_box_int
- \dim_zero:N \g_@@_width_last_col_dim
- \dim_zero:N \g_@@_width_first_col_dim
- \bool_gset_false:N \g_@@_row_of_col_done_bool
- \str_if_empty:NT \g_@@_name_env_str
- { \str_gset:Nn \g_@@_name_env_str { NiceArrayWithDelims } }
- \@@_adapt_S_column:
- \bool_if:NTF \l_@@_NiceTabular_bool
- \mode_leave_vertical:
- \@@_test_if_math_mode:
- \bool_if:NT \l_@@_in_env_bool { \@@_fatal:n { Yet~in~env } }
- \bool_set_true:N \l_@@_in_env_bool
-% \end{macrocode}
-% The command |\CT@arc@| contains the instruction of color for the rules of the
-% array\footnote{e.g. |\color[rgb]{0.5,0.5,0}|}. This command is used by |\CT@arc@| but
-% we use it also for compatibility with \pkg{colortbl}. But we want also to be
-% able to use color for the rules of the array when \pkg{colortbl} is \emph{not}
-% loaded. That's why we do the following instruction which is in the patch of
-% the beginning of arrays done by \pkg{colortbl}. Of course, we restore the
-% value of |\CT@arc@| at the end of our environment.
-% \begin{macrocode}
- \cs_gset_eq:NN \@@_old_CT@arc@ \CT@arc@
-% \end{macrocode}
-%
-% We deactivate Tikz externalization because we will use \textsc{pgf} pictures
-% with the options |overlay| and |remember picture| (or equivalent forms). We
-% deactivate with |\tikzexternaldisable| and not with
-% |\tikzset{external/export=false}| which is \emph{not} equivalent.
-% \begin{macrocode}
- \cs_if_exist:NT \tikz@library@external@loaded
- {
- \tikzexternaldisable
- \cs_if_exist:NT \ifstandalone
- { \tikzset { external / optimize = false } }
- }
-% \end{macrocode}
-%
-% We increment the counter |\g_@@_env_int| which counts the environments
-% of the package.
-% \begin{macrocode}
- \int_gincr:N \g_@@_env_int
- \bool_if:NF \l_@@_block_auto_columns_width_bool
- { \dim_gzero_new:N \g_@@_max_cell_width_dim }
-% \end{macrocode}
-%
-%
-% The sequence |\g_@@_blocks_seq| will contain the carateristics of the blocks
-% (specified by |\Block|) of the array. The sequence |\g_@@_pos_of_blocks_seq|
-% will contain only the position of the blocks. Of course, this is redundant but
-% it's for efficiency.
-% \begin{macrocode}
- \seq_gclear:N \g_@@_blocks_seq
- \seq_gclear:N \g_@@_pos_of_blocks_seq
-% \end{macrocode}
-% In fact, the sequence |\g_@@_pos_of_blocks_seq| will also contain the
-% positions of the cells with a |\diagbox|.
+% This is the end of |\@@_pre_array_ii:|.
%
-% \begin{macrocode}
- \seq_gclear:N \g_@@_pos_of_stroken_blocks_seq
- \seq_gclear:N \g_@@_pos_of_xdots_seq
-% \end{macrocode}
-%
-% \begin{macrocode}
- \tl_if_exist:cT { g_@@_code_before_ \int_use:N \g_@@_env_int _ tl }
- {
- \bool_set_true:N \l_@@_code_before_bool
- \exp_args:NNv \tl_put_right:Nn \l_@@_code_before_tl
- { g_@@_code_before_ \int_use:N \g_@@_env_int _ tl }
- }
-% \end{macrocode}
-%
-% The set of keys is not exactly the same for |{NiceArray}| and for the variants
-% of |{NiceArray}| (|{pNiceArray}|, |{bNiceArray}|, etc.) because, for
-% |{NiceArray}|, we have the options |t|, |c|, |b| and |baseline|.
-% \begin{macrocode}
- \bool_if:NTF \l_@@_NiceArray_bool
- { \keys_set:nn { NiceMatrix / NiceArray } }
- { \keys_set:nn { NiceMatrix / pNiceArray } }
- { #3 , #5 }
-% \end{macrocode}
-%
-% \bigskip
-% \begin{macrocode}
- \tl_if_empty:NF \l_@@_rules_color_tl
- { \exp_after:wN \@@_set_CT@arc@: \l_@@_rules_color_tl \q_stop }
-% \end{macrocode}
-%
-%
% \bigskip
% If the key |code-before| is used, we have to create the |col| nodes and the
% |row| nodes before the creation of the array. First, we have to test whether
@@ -7385,6 +7437,9 @@ version 2005/12/01 or later.
% this case, a command |\@@_size_|{\slshape\ttfamily nb_of_env}|:| has been
% created.
% \begin{macrocode}
+\cs_new_protected:Npn \@@_pre_array:
+ {
+ \seq_gclear:N \g_@@_submatrix_seq
\bool_if:NT \l_@@_code_before_bool
{
\seq_if_exist:cT { @@_size_ \int_use:N \g_@@_env_int _ seq }
@@ -7448,7 +7503,7 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \medskip
-% Now, yet another settings before the executation of the |code-before|.
+% Now, yet other settings before the execution of the |code-before|.
% \begin{macrocode}
\group_begin:
\bool_if:NT \c_@@_tikz_loaded_bool
@@ -7461,17 +7516,30 @@ version 2005/12/01 or later.
}
\cs_set_eq:NN \cellcolor \@@_cellcolor
\cs_set_eq:NN \rectanglecolor \@@_rectanglecolor
+ \cs_set_eq:NN \roundedrectanglecolor \@@_roundedrectanglecolor
\cs_set_eq:NN \rowcolor \@@_rowcolor
\cs_set_eq:NN \rowcolors \@@_rowcolors
\cs_set_eq:NN \columncolor \@@_columncolor
\cs_set_eq:NN \chessboardcolors \@@_chessboardcolors
+ \cs_set_eq:NN \SubMatrix \@@_SubMatrix_in_code_before
% \end{macrocode}
% We compose the |code-before| in math mode in order to nullify the spaces put
% by the user between instructions in the |code-before|.
% \begin{macrocode}
\bool_if:NT \l_@@_NiceTabular_bool \c_math_toggle_token
\seq_clear_new:N \l_@@_colors_seq
- \l_@@_code_before_tl
+% \end{macrocode}
+% Here is the |\CodeBefore|. As of now, the keys that may be provided to the
+% keyword |\CodeBefore| are the same as keys that may be provided to
+% |\CodeAfter|, hence the |\@@_CodeAfter_keys:|.
+% \begin{macrocode}
+ \exp_last_unbraced:NV \@@_CodeAfter_keys: \l_@@_code_before_tl
+% \end{macrocode}
+% Now, all the cells which are specified to be colored by instructions in the
+% |\CodeBefore| will actually be colored. It's a two-stages mechanism because we
+% want to draw all the cells with the same color at the same time to absolutely
+% avoid thin white lines in some \textsc{pdf} viewers.
+% \begin{macrocode}
\@@_actually_color:
\bool_if:NT \l_@@_NiceTabular_bool \c_math_toggle_token
\group_end:
@@ -7547,9 +7615,9 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \interitem
-% The code in |\@@_pre_array:| is used only by |{NiceArrayWithDelims}|.
+% The code in |\@@_pre_array_ii:| is used only by |{NiceArrayWithDelims}|.
% \begin{macrocode}
- \@@_pre_array:
+ \@@_pre_array_ii:
% \end{macrocode}
%
% \medskip
@@ -7617,6 +7685,150 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
+% \bigskip
+% The following command |\@@_pre_array_i:w| will be used when the keyword
+% |\CodeBefore| is present at the beginning of the environment.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_pre_array_i:w #1 \Body
+ {
+ \tl_put_right:Nn \l_@@_code_before_tl { #1 }
+ \bool_set_true:N \l_@@_code_before_bool
+% \end{macrocode}
+% We go on with |\@@_pre_array:| which will (among other) execute the
+% |\CodeBefore| (specified in the key |code-before| or after the keyword
+% |\CodeBefore|). By definition, the |\CodeBefore| must be executed before the
+% body of the array...
+% \begin{macrocode}
+ \@@_pre_array:
+ }
+% \end{macrocode}
+%
+% \bigskip
+% \subsection*{The environment \{NiceArrayWithDelims\}}
+%
+% \begin{macrocode}
+\NewDocumentEnvironment { NiceArrayWithDelims }
+ { m m O { } m ! O { } t \CodeBefore }
+ {
+ \@@_provide_pgfsyspdfmark:
+ \bool_if:NT \c_@@_footnote_bool \savenotes
+% \end{macrocode}
+% The aim of the following |\bgroup| (the corresponding |\egroup| is, of course,
+% at the end of the environment) is to be able to put an exposant to a matrix in
+% a mathematical formula.
+% \begin{macrocode}
+ \bgroup
+% \end{macrocode}
+%
+% \bigskip
+% \begin{macrocode}
+ \tl_set:Nn \l_@@_left_delim_tl { #1 }
+ \tl_set:Nn \l_@@_right_delim_tl { #2 }
+ \tl_gset:Nn \g_@@_preamble_tl { #4 }
+% \end{macrocode}
+%
+%
+% \bigskip
+%
+% \begin{macrocode}
+ \int_gzero:N \g_@@_block_box_int
+ \dim_zero:N \g_@@_width_last_col_dim
+ \dim_zero:N \g_@@_width_first_col_dim
+ \bool_gset_false:N \g_@@_row_of_col_done_bool
+ \str_if_empty:NT \g_@@_name_env_str
+ { \str_gset:Nn \g_@@_name_env_str { NiceArrayWithDelims } }
+ \@@_adapt_S_column:
+ \bool_if:NTF \l_@@_NiceTabular_bool
+ \mode_leave_vertical:
+ \@@_test_if_math_mode:
+ \bool_if:NT \l_@@_in_env_bool { \@@_fatal:n { Yet~in~env } }
+ \bool_set_true:N \l_@@_in_env_bool
+% \end{macrocode}
+% The command |\CT@arc@| contains the instruction of color for the rules of the
+% array\footnote{e.g. |\color[rgb]{0.5,0.5,0}|}. This command is used by |\CT@arc@| but
+% we use it also for compatibility with \pkg{colortbl}. But we want also to be
+% able to use color for the rules of the array when \pkg{colortbl} is \emph{not}
+% loaded. That's why we do the following instruction which is in the patch of
+% the beginning of arrays done by \pkg{colortbl}. Of course, we restore the
+% value of |\CT@arc@| at the end of our environment.
+% \begin{macrocode}
+ \cs_gset_eq:NN \@@_old_CT@arc@ \CT@arc@
+% \end{macrocode}
+%
+% We deactivate Tikz externalization because we will use \textsc{pgf} pictures
+% with the options |overlay| and |remember picture| (or equivalent forms). We
+% deactivate with |\tikzexternaldisable| and not with
+% |\tikzset{external/export=false}| which is \emph{not} equivalent.
+% \begin{macrocode}
+ \cs_if_exist:NT \tikz@library@external@loaded
+ {
+ \tikzexternaldisable
+ \cs_if_exist:NT \ifstandalone
+ { \tikzset { external / optimize = false } }
+ }
+% \end{macrocode}
+%
+% We increment the counter |\g_@@_env_int| which counts the environments
+% of the package.
+% \begin{macrocode}
+ \int_gincr:N \g_@@_env_int
+ \bool_if:NF \l_@@_block_auto_columns_width_bool
+ { \dim_gzero_new:N \g_@@_max_cell_width_dim }
+% \end{macrocode}
+%
+%
+% The sequence |\g_@@_blocks_seq| will contain the carateristics of the blocks
+% (specified by |\Block|) of the array. The sequence |\g_@@_pos_of_blocks_seq|
+% will contain only the position of the blocks. Of course, this is redundant but
+% it's for efficiency.
+% \begin{macrocode}
+ \seq_gclear:N \g_@@_blocks_seq
+ \seq_gclear:N \g_@@_pos_of_blocks_seq
+% \end{macrocode}
+% In fact, the sequence |\g_@@_pos_of_blocks_seq| will also contain the
+% positions of the cells with a |\diagbox|.
+%
+% \begin{macrocode}
+ \seq_gclear:N \g_@@_pos_of_stroken_blocks_seq
+ \seq_gclear:N \g_@@_pos_of_xdots_seq
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \tl_if_exist:cT { g_@@_code_before_ \int_use:N \g_@@_env_int _ tl }
+ {
+ \bool_set_true:N \l_@@_code_before_bool
+ \exp_args:NNv \tl_put_right:Nn \l_@@_code_before_tl
+ { g_@@_code_before_ \int_use:N \g_@@_env_int _ tl }
+ }
+% \end{macrocode}
+%
+% The set of keys is not exactly the same for |{NiceArray}| and for the variants
+% of |{NiceArray}| (|{pNiceArray}|, |{bNiceArray}|, etc.) because, for
+% |{NiceArray}|, we have the options |t|, |c|, |b| and |baseline|.
+% \begin{macrocode}
+ \bool_if:NTF \l_@@_NiceArray_bool
+ { \keys_set:nn { NiceMatrix / NiceArray } }
+ { \keys_set:nn { NiceMatrix / pNiceArray } }
+ { #3 , #5 }
+% \end{macrocode}
+%
+% \bigskip
+% \begin{macrocode}
+ \tl_if_empty:NF \l_@@_rules_color_tl
+ { \exp_after:wN \@@_set_CT@arc@: \l_@@_rules_color_tl \q_stop }
+% \bigskip
+% \end{macrocode}
+% The argument |#6| is the last argument of |{NiceArrayWithDelims}|. With that
+% argument of type ``|t \CodeBefore|'', we test whether there is the keyword
+% |\CodeBefore| at the beginning of the environment. If that keyword is present,
+% we have now to extract all the content between that keyword |\CodeBefore| and
+% the (other) keyword |\Body|. It's the job that will do the command
+% |\@@_pre_array_i:w|. After that job, the command |\@@_pre_array_i:w| will go
+% on with |\@@_pre_array:|.
+% \begin{macrocode}
+ \IfBooleanTF { #6 } \@@_pre_array_i:w \@@_pre_array:
+ }
+% \end{macrocode}
%
% \begin{macrocode}
{
@@ -7761,6 +7973,13 @@ version 2005/12/01 or later.
% \begin{macrocode}
\skip_vertical:N -\l_tmpb_dim
}
+% \end{macrocode}
+% Curiously, we have to put again the following specification of color.
+% Otherwise, with XeLaTeX (and not with the other engines), the closing
+% delimiter is not colored.
+% \begin{macrocode}
+ \tl_if_empty:NF \l_@@_delimiters_color_tl
+ { \color { \l_@@_delimiters_color_tl } }
\exp_after:wN \right \l_@@_right_delim_tl
\c_math_toggle_token
}
@@ -7769,9 +7988,9 @@ version 2005/12/01 or later.
%
% \smallskip
% We will put the box in the TeX flow. However, we have a small work to do
-% when the option |max-delimiter-width| is used.
+% when the option |delimiters/max-width| is used.
% \begin{macrocode}
- \bool_if:NTF \l_@@_max_delimiter_width_bool
+ \bool_if:NTF \l_@@_delimiters_max_width_bool
{ \@@_put_box_in_flow_bis:nn { #1 } { #2 } }
\@@_put_box_in_flow:
}
@@ -7877,12 +8096,19 @@ version 2005/12/01 or later.
% counter |\c@jCol|.
% \begin{macrocode}
\int_gzero_new:N \c@jCol
- \bool_if:NTF \l_@@_vlines_bool
+ \tl_gclear:N \g_@@_preamble_tl
+ \tl_if_eq:NnTF \l_@@_vlines_clist { all }
{
\tl_gset:Nn \g_@@_preamble_tl
{ ! { \skip_horizontal:N \arrayrulewidth } }
}
- { \tl_gclear:N \g_@@_preamble_tl }
+ {
+ \clist_if_in:NnT \l_@@_vlines_clist 1
+ {
+ \tl_gset:Nn \g_@@_preamble_tl
+ { ! { \skip_horizontal:N \arrayrulewidth } }
+ }
+ }
% \end{macrocode}
% The sequence |\g_@@_cols_vlsim_seq| will contain the numbers of the columns
% where you will to have to draw vertical lines in the potential sub-matrices
@@ -7925,7 +8151,7 @@ version 2005/12/01 or later.
{
\l_@@_NiceArray_bool
{ \bool_not_p:n \l_@@_NiceTabular_bool }
- { \bool_not_p:n \l_@@_vlines_bool }
+ { \tl_if_empty_p:N \l_@@_vlines_clist }
{ \bool_not_p:n \l_@@_exterior_arraycolsep_bool }
}
{ \tl_gput_left:Nn \g_@@_preamble_tl { @ { } } }
@@ -7937,7 +8163,7 @@ version 2005/12/01 or later.
{
\l_@@_NiceArray_bool
{ \bool_not_p:n \l_@@_NiceTabular_bool }
- { \bool_not_p:n \l_@@_vlines_bool }
+ { \tl_if_empty_p:N \l_@@_vlines_clist }
{ \bool_not_p:n \l_@@_exterior_arraycolsep_bool }
}
{ \tl_gput_right:Nn \g_@@_preamble_tl { @ { } } }
@@ -8242,11 +8468,19 @@ version 2005/12/01 or later.
\str_if_eq:nnTF { #1 } { < }
\@@_patch_preamble_ix:n
{
- \bool_if:NT \l_@@_vlines_bool
+ \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_preamble:n { #1 }
}
}
@@ -8506,7 +8740,7 @@ version 2005/12/01 or later.
%
% \bigskip
% The command |\@@_put_box_in_flow_bis:| is used when the option
-% |max-delimiter-width| is used because, in this case, we have to adjust the
+% |delimiters/max-width| is used because, in this case, we have to adjust the
% widths of the delimiters. The arguments |#1| and |#2| are the delimiters
% specified by the user.
% \begin{macrocode}
@@ -9380,17 +9614,16 @@ version 2005/12/01 or later.
\cs_set_eq:NN \@@_vline_i:nn \@@_vline_i_complete:nn
\cs_set_eq:NN \@@_hline_i:nn \@@_hline_i_complete:nn
}
- \bool_if:NT \l_@@_hlines_bool \@@_draw_hlines:
- \bool_if:NT \l_@@_vlines_bool \@@_draw_vlines:
+ \tl_if_empty:NF \l_@@_hlines_clist \@@_draw_hlines:
+ \tl_if_empty:NF \l_@@_vlines_clist \@@_draw_vlines:
% \end{macrocode}
%
% \begin{macrocode}
- \g_@@_internal_code_after_tl
- \tl_gclear:N \g_@@_internal_code_after_tl
+ \cs_set_eq:NN \SubMatrix \@@_SubMatrix
% \end{macrocode}
%
% \bigskip
-% Now, the |\CodeAfter|.
+% Now, the internal |code-after| and then, the |\CodeAfter|.
% \begin{macrocode}
\bool_if:NT \c_@@_tikz_loaded_bool
{
@@ -9405,7 +9638,8 @@ version 2005/12/01 or later.
}
}
\cs_set_eq:NN \line \@@_line
- \cs_set_eq:NN \SubMatrix \@@_SubMatrix
+ \g_@@_internal_code_after_tl
+ \tl_gclear:N \g_@@_internal_code_after_tl
% \end{macrocode}
% When |light-syntax| is used, we insert systematically a |\CodeAfter| in the
% flow. Thus, it's possible to have two instructions |\CodeAfter| and the second
@@ -9654,23 +9888,23 @@ version 2005/12/01 or later.
% We test if we are still in the matrix.
% \begin{macrocode}
\bool_set_false:N \l_@@_final_open_bool
- \int_compare:nNnTF \l_@@_final_i_int > \c@iRow
+ \int_compare:nNnTF \l_@@_final_i_int > \l_@@_row_max_int
{
\int_compare:nNnTF { #3 } = 1
{ \bool_set_true:N \l_@@_final_open_bool }
{
- \int_compare:nNnT \l_@@_final_j_int > \c@jCol
+ \int_compare:nNnT \l_@@_final_j_int > \l_@@_col_max_int
{ \bool_set_true:N \l_@@_final_open_bool }
}
}
{
- \int_compare:nNnTF \l_@@_final_j_int < 1
+ \int_compare:nNnTF \l_@@_final_j_int < \l_@@_col_min_int
{
\int_compare:nNnT { #4 } = { -1 }
{ \bool_set_true:N \l_@@_final_open_bool }
}
{
- \int_compare:nNnT \l_@@_final_j_int > \c@jCol
+ \int_compare:nNnT \l_@@_final_j_int > \l_@@_col_max_int
{
\int_compare:nNnT { #4 } = 1
{ \bool_set_true:N \l_@@_final_open_bool }
@@ -9722,7 +9956,7 @@ version 2005/12/01 or later.
% a dotted line have to be marked as ``dotted'' because we don't want
% intersections between dotted lines. We recall that the research of the
% extremities of the lines are all done in the same TeX group (the group of the
-% environnement), even though, when the extremities are found, each line is
+% environment), even though, when the extremities are found, each line is
% drawn in a TeX group that we will open for the options of the line.
% \begin{macrocode}
{
@@ -9749,23 +9983,23 @@ version 2005/12/01 or later.
\int_sub:Nn \l_@@_initial_i_int { #3 }
\int_sub:Nn \l_@@_initial_j_int { #4 }
\bool_set_false:N \l_@@_initial_open_bool
- \int_compare:nNnTF \l_@@_initial_i_int < 1
+ \int_compare:nNnTF \l_@@_initial_i_int < \l_@@_row_min_int
{
\int_compare:nNnTF { #3 } = 1
{ \bool_set_true:N \l_@@_initial_open_bool }
{
- \int_compare:nNnT \l_@@_initial_j_int = 0
+ \int_compare:nNnT \l_@@_initial_j_int = { \l_@@_col_min_int -1 }
{ \bool_set_true:N \l_@@_initial_open_bool }
}
}
{
- \int_compare:nNnTF \l_@@_initial_j_int < 1
+ \int_compare:nNnTF \l_@@_initial_j_int < \l_@@_col_min_int
{
\int_compare:nNnT { #4 } = 1
{ \bool_set_true:N \l_@@_initial_open_bool }
}
{
- \int_compare:nNnT \l_@@_initial_j_int > \c@jCol
+ \int_compare:nNnT \l_@@_initial_j_int > \l_@@_col_max_int
{
\int_compare:nNnT { #4 } = { -1 }
{ \bool_set_true:N \l_@@_initial_open_bool }
@@ -9827,6 +10061,51 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \medskip
+% The following commmand (\emph{when it will be written}) will set the four
+% counters |\l_@@_row_min_int|, |\l_@@_row_max_int|, |\l_@@_col_min_int| and
+% |\l_@@_col_max_int| to the intersections of the sub-matrices which contains
+% the cell of row |#1| and column |#2|.
+% As of now, it's only the whole array (excepted exterior row and columns).
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_adjust_to_submatrix:nn #1 #2
+ {
+ \int_set:Nn \l_@@_row_min_int 1
+ \int_set:Nn \l_@@_col_min_int 1
+ \int_set_eq:NN \l_@@_row_max_int \c@iRow
+ \int_set_eq:NN \l_@@_col_max_int \c@jCol
+% \end{macrocode}
+% We do a loop over all the submatrices specified in the |code-before|. We have
+% stored the position of all those submatrices in |\g_@@_submatrix_seq|.
+% \begin{macrocode}
+ \seq_map_inline:Nn \g_@@_submatrix_seq
+ { \@@_adjust_to_submatrix:nnnnnn { #1 } { #2 } ##1 }
+ }
+% \end{macrocode}
+%
+% \medskip
+% |#1| and |#2| are the numbers of row and columns of the cell where the command
+% of dotted line (ex.: |\Vdots|) has been issued. |#3|, |#4|, |#5| and |#6| are
+% the specification (in $i$ and $j$) of the submatrix where are analysing.
+% \begin{macrocode}
+\cs_set_protected:Npn \@@_adjust_to_submatrix:nnnnnn #1 #2 #3 #4 #5 #6
+ {
+ \bool_if:nT
+ {
+ \int_compare_p:n { #3 <= #1 }
+ && \int_compare_p:n { #1 <= #5 }
+ && \int_compare_p:n { #4 <= #2 }
+ && \int_compare_p:n { #2 <= #6 }
+ }
+ {
+ \int_set:Nn \l_@@_row_min_int { \int_max:nn \l_@@_row_min_int { #3 } }
+ \int_set:Nn \l_@@_col_min_int { \int_max:nn \l_@@_col_min_int { #4 } }
+ \int_set:Nn \l_@@_row_max_int { \int_min:nn \l_@@_row_max_int { #5 } }
+ \int_set:Nn \l_@@_col_max_int { \int_min:nn \l_@@_col_max_int { #6 } }
+ }
+ }
+% \end{macrocode}
+%
+% \medskip
% \begin{macrocode}
\cs_new_protected:Npn \@@_set_initial_coords:
{
@@ -9862,12 +10141,74 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_open_x_initial_dim:
+ {
+ \dim_set_eq:NN \l_@@_x_initial_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_@@_initial_j_int }
+ {
+ \pgfpointanchor
+ { \@@_env: - ##1 - \int_use:N \l_@@_initial_j_int }
+ { west }
+ \dim_set:Nn \l_@@_x_initial_dim
+ { \dim_min:nn \l_@@_x_initial_dim \pgf@x }
+ }
+ }
+% \end{macrocode}
+% If, in fact, all the cells of the columns are empty (no PGF/Tikz nodes in
+% those cells).
+% \begin{macrocode}
+ \dim_compare:nNnT \l_@@_x_initial_dim = \c_max_dim
+ {
+ \@@_qpoint:n { col - \int_use:N \l_@@_initial_j_int }
+ \dim_set_eq:NN \l_@@_x_initial_dim \pgf@x
+ \dim_add:Nn \l_@@_x_initial_dim \col@sep
+ }
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_open_x_final_dim:
+ {
+ \dim_set:Nn \l_@@_x_final_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_@@_final_j_int }
+ {
+ \pgfpointanchor
+ { \@@_env: - ##1 - \int_use:N \l_@@_final_j_int }
+ { east }
+ \dim_set:Nn \l_@@_x_final_dim
+ { \dim_max:nn \l_@@_x_final_dim \pgf@x }
+ }
+ }
+% \end{macrocode}
+% If, in fact, all the cells of the columns are empty (no PGF/Tikz nodes in
+% those cells).
+% \begin{macrocode}
+ \dim_compare:nNnT \l_@@_x_final_dim = { - \c_max_dim }
+ {
+ \@@_qpoint:n { col - \@@_succ:n \l_@@_final_j_int }
+ \dim_set_eq:NN \l_@@_x_final_dim \pgf@x
+ \dim_sub:Nn \l_@@_x_final_dim \col@sep
+ }
+ }
+% \end{macrocode}
+%
+%
+%
% \interitem
% The first and the second arguments are the coordinates of the cell where the
% command has been issued. The third argument is the list of the options.
% \begin{macrocode}
\cs_new_protected:Npn \@@_draw_Ldots:nnn #1 #2 #3
{
+ \@@_adjust_to_submatrix:nn { #1 } { #2 }
\cs_if_free:cT { @@ _ dotted _ #1 - #2 }
{
\@@_find_extremities_of_line:nnnn { #1 } { #2 } 0 1
@@ -9914,18 +10255,14 @@ version 2005/12/01 or later.
{
\bool_if:NTF \l_@@_initial_open_bool
{
- \@@_qpoint:n { col - \int_use:N \l_@@_initial_j_int }
- \dim_set_eq:NN \l_@@_x_initial_dim \pgf@x
- \dim_add:Nn \l_@@_x_initial_dim \col@sep
+ \@@_open_x_initial_dim:
\@@_qpoint:n { row - \int_use:N \l_@@_initial_i_int - base }
\dim_set_eq:NN \l_@@_y_initial_dim \pgf@y
}
{ \@@_set_initial_coords_from_anchor:n { base~east } }
\bool_if:NTF \l_@@_final_open_bool
{
- \@@_qpoint:n { col - \@@_succ:n \l_@@_final_j_int }
- \dim_set_eq:NN \l_@@_x_final_dim \pgf@x
- \dim_sub:Nn \l_@@_x_final_dim \col@sep
+ \@@_open_x_final_dim:
\@@_qpoint:n { row - \int_use:N \l_@@_final_i_int - base }
\dim_set_eq:NN \l_@@_y_final_dim \pgf@y
}
@@ -9947,6 +10284,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\cs_new_protected:Npn \@@_draw_Cdots:nnn #1 #2 #3
{
+ \@@_adjust_to_submatrix:nn { #1 } { #2 }
\cs_if_free:cT { @@ _ dotted _ #1 - #2 }
{
\@@_find_extremities_of_line:nnnn { #1 } { #2 } 0 1
@@ -9975,6 +10313,7 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
+%
% \medskip
% The command |\@@_actually_draw_Cdots:| has the following implicit arguments:
% \begin{itemize}
@@ -9990,18 +10329,10 @@ version 2005/12/01 or later.
\cs_new_protected:Npn \@@_actually_draw_Cdots:
{
\bool_if:NTF \l_@@_initial_open_bool
- {
- \@@_qpoint:n { col - \int_use:N \l_@@_initial_j_int }
- \dim_set_eq:NN \l_@@_x_initial_dim \pgf@x
- \dim_add:Nn \l_@@_x_initial_dim \col@sep
- }
+ { \@@_open_x_initial_dim: }
{ \@@_set_initial_coords_from_anchor:n { mid~east } }
\bool_if:NTF \l_@@_final_open_bool
- {
- \@@_qpoint:n { col - \@@_succ:n \l_@@_final_j_int }
- \dim_set_eq:NN \l_@@_x_final_dim \pgf@x
- \dim_sub:Nn \l_@@_x_final_dim \col@sep
- }
+ { \@@_open_x_final_dim: }
{ \@@_set_final_coords_from_anchor:n { mid~west } }
\bool_lazy_and:nnTF
\l_@@_initial_open_bool
@@ -10023,12 +10354,55 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_open_y_initial_dim:
+ {
+ \@@_qpoint:n { row - \int_use:N \l_@@_initial_i_int - base }
+ \dim_set:Nn \l_@@_y_initial_dim
+ { \pgf@y + ( \box_ht:N \strutbox + \extrarowheight ) * \arraystretch }
+ \int_step_inline:nnn \l_@@_first_col_int \g_@@_col_total_int
+ {
+ \cs_if_exist:cT
+ { pgf @ sh @ ns @ \@@_env: - \int_use:N \l_@@_initial_i_int - ##1 }
+ {
+ \pgfpointanchor
+ { \@@_env: - \int_use:N \l_@@_initial_i_int - ##1 }
+ { north }
+ \dim_set:Nn \l_@@_y_initial_dim
+ { \dim_max:nn \l_@@_y_initial_dim \pgf@y }
+ }
+ }
+ }
+% \end{macrocode}
%
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_open_y_final_dim:
+ {
+ \@@_qpoint:n { row - \int_use:N \l_@@_final_i_int - base }
+ \dim_set:Nn \l_@@_y_final_dim
+ { \pgf@y - ( \box_dp:N \strutbox ) * \arraystretch }
+ \int_step_inline:nnn \l_@@_first_col_int \g_@@_col_total_int
+ {
+ \cs_if_exist:cT
+ { pgf @ sh @ ns @ \@@_env: - \int_use:N \l_@@_final_i_int - ##1 }
+ {
+ \pgfpointanchor
+ { \@@_env: - \int_use:N \l_@@_final_i_int - ##1 }
+ { south }
+ \dim_set:Nn \l_@@_y_final_dim
+ { \dim_min:nn \l_@@_y_final_dim \pgf@y }
+ }
+ }
+ }
+% \end{macrocode}
+%
% The first and the second arguments are the coordinates of the cell where the
% command has been issued. The third argument is the list of the options.
% \begin{macrocode}
\cs_new_protected:Npn \@@_draw_Vdots:nnn #1 #2 #3
{
+ \@@_adjust_to_submatrix:nn { #1 } { #2 }
\cs_if_free:cT { @@ _ dotted _ #1 - #2 }
{
\@@_find_extremities_of_line:nnnn { #1 } { #2 } 1 0
@@ -10073,6 +10447,9 @@ version 2005/12/01 or later.
% be considered as if.
% \begin{macrocode}
\bool_set_false:N \l_tmpa_bool
+% \end{macrocode}
+% First the case when the line is closed on both ends.
+% \begin{macrocode}
\bool_lazy_or:nnF \l_@@_initial_open_bool \l_@@_final_open_bool
{
\@@_set_initial_coords_from_anchor:n { south~west }
@@ -10085,16 +10462,10 @@ version 2005/12/01 or later.
% considered as if.
% \begin{macrocode}
\bool_if:NTF \l_@@_initial_open_bool
- {
- \@@_qpoint:n { row - \int_use:N \l_@@_initial_i_int }
- \dim_set_eq:NN \l_@@_y_initial_dim \pgf@y
- }
+ \@@_open_y_initial_dim:
{ \@@_set_initial_coords_from_anchor:n { south } }
\bool_if:NTF \l_@@_final_open_bool
- {
- \@@_qpoint:n { row - \@@_succ:n \l_@@_final_i_int }
- \dim_set_eq:NN \l_@@_y_final_dim \pgf@y
- }
+ \@@_open_y_final_dim:
{ \@@_set_final_coords_from_anchor:n { north } }
\bool_if:NTF \l_@@_initial_open_bool
{
@@ -10130,8 +10501,7 @@ version 2005/12/01 or later.
{
% \end{macrocode}
% Now the case where both extremities are closed. The first conditional tests
-% whether the column is of type |c| (|C| of |{NiceArray}|) or may be considered
-% as if.
+% whether the column is of type |c| or may be considered as if.
% \begin{macrocode}
\dim_compare:nNnF \l_@@_x_initial_dim = \l_@@_x_final_dim
{
@@ -10158,6 +10528,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\cs_new_protected:Npn \@@_draw_Ddots:nnn #1 #2 #3
{
+ \@@_adjust_to_submatrix:nn { #1 } { #2 }
\cs_if_free:cT { @@ _ dotted _ #1 - #2 }
{
\@@_find_extremities_of_line:nnnn { #1 } { #2 } 1 1
@@ -10191,17 +10562,17 @@ version 2005/12/01 or later.
{
\bool_if:NTF \l_@@_initial_open_bool
{
- \@@_qpoint:n { row - \int_use:N \l_@@_initial_i_int }
- \dim_set_eq:NN \l_@@_y_initial_dim \pgf@y
- \@@_qpoint:n { col - \int_use:N \l_@@_initial_j_int }
- \dim_set_eq:NN \l_@@_x_initial_dim \pgf@x
+ \@@_open_y_initial_dim:
+ % \@@_qpoint:n { col - \int_use:N \l_@@_initial_j_int }
+ % \dim_set_eq:NN \l_@@_x_initial_dim \pgf@x
+ \@@_open_x_initial_dim:
}
{ \@@_set_initial_coords_from_anchor:n { south~east } }
\bool_if:NTF \l_@@_final_open_bool
{
- \@@_qpoint:n { row - \@@_succ:n \l_@@_final_i_int }
- \dim_set_eq:NN \l_@@_y_final_dim \pgf@y
- \@@_qpoint:n { col - \@@_succ:n \l_@@_final_j_int }
+ % \@@_open_y_final_dim:
+ % \@@_qpoint:n { col - \@@_succ:n \l_@@_final_j_int }
+ \@@_open_x_final_dim:
\dim_set_eq:NN \l_@@_x_final_dim \pgf@x
}
{ \@@_set_final_coords_from_anchor:n { north~west } }
@@ -10255,6 +10626,7 @@ version 2005/12/01 or later.
% \begin{macrocode}
\cs_new_protected:Npn \@@_draw_Iddots:nnn #1 #2 #3
{
+ \@@_adjust_to_submatrix:nn { #1 } { #2 }
\cs_if_free:cT { @@ _ dotted _ #1 - #2 }
{
\@@_find_extremities_of_line:nnnn { #1 } { #2 } 1 { -1 }
@@ -10288,18 +10660,22 @@ version 2005/12/01 or later.
{
\bool_if:NTF \l_@@_initial_open_bool
{
- \@@_qpoint:n { row - \int_use:N \l_@@_initial_i_int }
- \dim_set_eq:NN \l_@@_y_initial_dim \pgf@y
- \@@_qpoint:n { col - \@@_succ:n \l_@@_initial_j_int }
- \dim_set_eq:NN \l_@@_x_initial_dim \pgf@x
+ % \@@_qpoint:n { row - \int_use:N \l_@@_initial_i_int }
+ % \dim_set_eq:NN \l_@@_y_initial_dim \pgf@y
+ \@@_open_y_initial_dim:
+ % \@@_qpoint:n { col - \@@_succ:n \l_@@_initial_j_int }
+ % \dim_set_eq:NN \l_@@_x_initial_dim \pgf@x
+ \@@_open_x_initial_dim:
}
{ \@@_set_initial_coords_from_anchor:n { south~west } }
\bool_if:NTF \l_@@_final_open_bool
{
- \@@_qpoint:n { row - \@@_succ:n \l_@@_final_i_int }
- \dim_set_eq:NN \l_@@_y_final_dim \pgf@y
- \@@_qpoint:n { col - \int_use:N \l_@@_final_j_int }
- \dim_set_eq:NN \l_@@_x_final_dim \pgf@x
+ % \@@_qpoint:n { row - \@@_succ:n \l_@@_final_i_int }
+ % \dim_set_eq:NN \l_@@_y_final_dim \pgf@y
+ \@@_open_y_final_dim:
+ % \@@_qpoint:n { col - \int_use:N \l_@@_final_j_int }
+ % \dim_set_eq:NN \l_@@_x_final_dim \pgf@x
+ \@@_open_x_final_dim:
}
{ \@@_set_final_coords_from_anchor:n { north~east } }
\bool_if:NT \l_@@_parallelize_diags_bool
@@ -10404,8 +10780,8 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \bigskip
-% The command |\@@_draw_standard_dotted_line:| draws the line with our system of points
-% (which gives a dotted line with real round points).
+% The command |\@@_draw_standard_dotted_line:| draws the line with our system of dots
+% (which gives a dotted line with real round dots).
% \begin{macrocode}
\cs_new_protected:Npn \@@_draw_standard_dotted_line:
{
@@ -10494,7 +10870,7 @@ version 2005/12/01 or later.
\cs_new_protected:Npn \@@_draw_standard_dotted_line_i:
{
% \end{macrocode}
-% The integer |\l_tmpa_int| is the number of dots of the dotted line.
+% The number of dots will be |\l_tmpa_int + 1|.
% \begin{macrocode}
\bool_if:NTF \l_@@_initial_open_bool
{
@@ -10532,6 +10908,8 @@ version 2005/12/01 or later.
}
}
% \end{macrocode}
+%
+% \medskip
% The dimensions |\l_tmpa_dim| and |\l_tmpb_dim| are the coordinates of the
% vector between two dots in the dotted line.
% \begin{macrocode}
@@ -10860,7 +11238,7 @@ version 2005/12/01 or later.
\AtBeginDocument
{
\tl_set:Nn \l_@@_argspec_tl { O { } m O { } E { _ ^ } { { } { } } }
- \tl_set_rescan:Nno \l_@@_argspec_tl { } \l_@@_argspec_tl
+ \tl_set_rescan:Nno \l_@@_argspec_tl { } \l_@@_argspec_tl
% \end{macrocode}
% We don't put |!| before the last optionnal argument for homogeneity with
% |\Cdots|, etc. which have only one optional argument.
@@ -11177,7 +11555,7 @@ version 2005/12/01 or later.
%
% We want to avoid the thin white lines that are shown in some \textsc{pdf}
% viewers (eg: with the engine MuPDF used by SumatraPDF). That's why we try to
-% draw rectangles of the same color in the same instruction |\pgfusepathqfill|
+% draw rectangles of the same color in the same instruction |\pgfusepath { fill }|
% (and they will be in the same instruction |fill|---coded |f|--- in the
% resulting \textsc{pdf}).
%
@@ -11246,7 +11624,7 @@ version 2005/12/01 or later.
{
\color ##2
\use:c { l_@@_color _ ##1 _tl }
- \pgfusepathqfill
+ \pgfusepath { fill }
}
\endpgfpicture
}
@@ -11282,7 +11660,7 @@ version 2005/12/01 or later.
\tl_set:Nn \l_@@_cols_tl { - }
% \end{macrocode}
% The command |\@@_cartesian_path:| takes in two implicit arguments:
-% |\l_@@_cols_tl| and |\l_@@_row_tl|.
+% |\l_@@_cols_tl| and |\l_@@_rows_tl|.
% \begin{macrocode}
\@@_cartesian_path:
}
@@ -11309,7 +11687,7 @@ version 2005/12/01 or later.
\tl_set:Nn \l_@@_cols_tl { #1 }
% \end{macrocode}
% The command |\@@_cartesian_path:| takes in two implicit arguments:
-% |\l_@@_cols_tl| and |\l_@@_row_tl|.
+% |\l_@@_cols_tl| and |\l_@@_rows_tl|.
% \begin{macrocode}
\@@_cartesian_path:
}
@@ -11325,14 +11703,29 @@ version 2005/12/01 or later.
{
\@@_add_to_colors_seq:xn
{ \tl_if_blank:nF { #1 } { [ #1 ] } { #2 } }
- { \@@_rectanglecolor:nn { #3 } { #4 } }
+ { \@@_rectanglecolor:nnn { #3 } { #4 } { 0 pt }}
}
}
% \end{macrocode}
%
% \bigskip
+% The last argument is the radius of the corners of the rectangle.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_rectanglecolor:nn #1 #2
+\NewDocumentCommand \@@_roundedrectanglecolor { O { } m m m m }
+ {
+ \tl_if_blank:nF { #2 }
+ {
+ \@@_add_to_colors_seq:xn
+ { \tl_if_blank:nF { #1 } { [ #1 ] } { #2 } }
+ { \@@_rectanglecolor:nnn { #3 } { #4 } { #5 } }
+ }
+ }
+% \end{macrocode}
+%
+% \bigskip
+% The last argument is the radius of the corners of the rectangle.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_rectanglecolor:nnn #1 #2 #3
{
\@@_cut_on_hyphen:w #1 \q_stop
\tl_clear_new:N \l_tmpc_tl
@@ -11343,10 +11736,10 @@ version 2005/12/01 or later.
\tl_set:Nx \l_@@_rows_tl { \l_tmpc_tl - \l_tmpa_tl }
\tl_set:Nx \l_@@_cols_tl { \l_tmpd_tl - \l_tmpb_tl }
% \end{macrocode}
-% The command |\@@_cartesian_path:| takes in two implicit arguments:
-% |\l_@@_cols_tl| and |\l_@@_row_tl|.
+% The command |\@@_cartesian_path:n| takes in two implicit arguments:
+% |\l_@@_cols_tl| and |\l_@@_rows_tl|.
% \begin{macrocode}
- \@@_cartesian_path:
+ \@@_cartesian_path:n { #3 }
}
% \end{macrocode}
%
@@ -11488,10 +11881,10 @@ version 2005/12/01 or later.
{ #3 }
% \end{macrocode}
% The command |\@@_cartesian_path:| takes in two implicit arguments:
-% |\l_@@_cols_tl| and |\l_@@_row_tl|.
+% |\l_@@_cols_tl| and |\l_@@_rows_tl|.
% \begin{macrocode}
\@@_cartesian_path:
- \pgfusepathqfill
+ \pgfusepath { fill }
}
\bool_set_false:N \l_tmpa_bool
}
@@ -11507,7 +11900,7 @@ version 2005/12/01 or later.
% |\l_@@_cols_tl| and |\l_@@_row_tl|.
% \begin{macrocode}
\@@_cartesian_path:
- \pgfusepathqfill
+ \pgfusepath { fill }
}
\bool_set_true:N \l_tmpa_bool
}
@@ -11559,14 +11952,17 @@ version 2005/12/01 or later.
% \end{macrocode}
%
%
-%
+% \begin{macrocode}
+\cs_new:Npn \@@_cartesian_path: { \@@_cartesian_path:n { 0 pt } }
+% \end{macrocode}
+%
% \bigskip
% The following command uses two implicit arguments : |\l_@@_rows_tl| and
% |\l_@@_cols_tl| which are specifications for a set of rows and a set of
% columns. It creates a path but does \emph{not} fill it. It must be filled by
-% another command after.
+% another command after. The argument is the radius of the corners.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_cartesian_path:
+\cs_new_protected:Npn \@@_cartesian_path:n #1
{
% \end{macrocode}
% We begin the loop over the columns.
@@ -11582,6 +11978,13 @@ version 2005/12/01 or later.
{ \tl_set:Nx \l_tmpb_tl { \int_use:N \c@jCol } }
\int_compare:nNnT \l_tmpb_tl > \c@jCol
{ \tl_set:Nx \l_tmpb_tl { \int_use:N \c@jCol } }
+% \end{macrocode}
+% If we decide to provide the commands |\cellcolor|, |\rectanglecolor|,
+% |\rowcolor|, |\columncolor|, |\rowcolors| and |\chessboardcolors| available in
+% the |code-before| of a |\SubMatrix|, we will have to modify the following
+% line, by adding a kind of offset. We will have also some other rows below in
+% the same command |\@@_cartesian_path:|.
+% \begin{macrocode}
\@@_qpoint:n { col - \l_tmpa_tl }
\int_compare:nNnTF \l_@@_first_col_int = \l_tmpa_tl
{ \dim_set:Nn \l_tmpc_dim { \pgf@x - 0.5 \arrayrulewidth } }
@@ -11589,7 +11992,7 @@ version 2005/12/01 or later.
\@@_qpoint:n { col - \@@_succ:n \l_tmpb_tl }
\dim_set:Nn \l_tmpa_dim { \pgf@x + 0.5 \arrayrulewidth }
% \end{macrocode}
-% We begin the loop over the rows
+% We begin the loop over the rows.
% \begin{macrocode}
\clist_map_inline:Nn \l_@@_rows_tl
{
@@ -11609,6 +12012,7 @@ version 2005/12/01 or later.
\dim_set:Nn \l_tmpb_dim { \pgf@y + 0.5 \arrayrulewidth }
\@@_qpoint:n { row - \l_tmpa_tl }
\dim_set:Nn \l_tmpd_dim { \pgf@y + 0.5 \arrayrulewidth }
+ \pgfsetcornersarced { \pgfpoint { #1 } { #1 } }
\pgfpathrectanglecorners
{ \pgfpoint \l_tmpc_dim \l_tmpd_dim }
{ \pgfpoint \l_tmpa_dim \l_tmpb_dim }
@@ -11625,7 +12029,15 @@ version 2005/12/01 or later.
\NewDocumentCommand \@@_cellcolor_tabular { O { } m }
{
\tl_gput_right:Nx \g_nicematrix_code_before_tl
- { \cellcolor [ #1 ] { #2 } { \int_use:N \c@iRow - \int_use:N \c@jCol } }
+ {
+% \end{macrocode}
+% We must not expand the color (|#2|) because the color may contain the token
+% |!| which may be activated by some packages (ex.: \pkg{babel} with the option
+% |french| on latex and pdflatex).
+% \begin{macrocode}
+ \cellcolor [ #1 ] { \exp_not:n { #2 } }
+ { \int_use:N \c@iRow - \int_use:N \c@jCol }
+ }
}
% \end{macrocode}
%
@@ -11637,7 +12049,7 @@ version 2005/12/01 or later.
{
\tl_gput_right:Nx \g_nicematrix_code_before_tl
{
- \exp_not:N \rectanglecolor [ #1 ] { #2 }
+ \exp_not:N \rectanglecolor [ #1 ] { \exp_not:n { #2 } }
{ \int_use:N \c@iRow - \int_use:N \c@jCol }
{ \int_use:N \c@iRow - \exp_not:n { \int_use:N \c@jCol } }
}
@@ -11655,7 +12067,10 @@ version 2005/12/01 or later.
% columns drawn before the specifications of color for the rows (and the cells).
% \begin{macrocode}
\tl_gput_left:Nx \g_nicematrix_code_before_tl
- { \exp_not:N \columncolor [ #1 ] { #2 } { \int_use:N \c@jCol } }
+ {
+ \exp_not:N \columncolor [ #1 ]
+ { \exp_not:n { #2 } } { \int_use:N \c@jCol }
+ }
}
}
% \end{macrocode}
@@ -11858,7 +12273,7 @@ version 2005/12/01 or later.
\pgfpathrectanglecorners
{ \pgfpoint \l_tmpb_dim \l_tmpa_dim }
{ \pgfpoint \l_tmpd_dim \l_tmpc_dim }
- \pgfusepathqfill
+ \pgfusepath { fill }
\group_end:
}
\pgfpathmoveto { \pgfpoint \l_tmpb_dim \l_tmpa_dim }
@@ -11897,7 +12312,11 @@ version 2005/12/01 or later.
\int_step_inline:nnn
{ \bool_if:NTF \l_@@_NiceArray_bool 1 2 }
{ \bool_if:NTF \l_@@_NiceArray_bool { \@@_succ:n \c@jCol } \c@jCol }
- { \@@_vline:nn { ##1 } 1 }
+ {
+ \tl_if_eq:NnF \l_@@_vlines_clist { all }
+ { \clist_if_in:NnT \l_@@_vlines_clist { ##1 } }
+ { \@@_vline:nn { ##1 } 1 }
+ }
}
% \end{macrocode}
%
@@ -12067,7 +12486,11 @@ version 2005/12/01 or later.
\int_step_inline:nnn
{ \bool_if:NTF \l_@@_NiceArray_bool 1 2 }
{ \bool_if:NTF \l_@@_NiceArray_bool { \@@_succ:n \c@iRow } \c@iRow }
- { \@@_hline:nn { ##1 } 1 }
+ {
+ \tl_if_eq:NnF \l_@@_hlines_clist { all }
+ { \clist_if_in:NnT \l_@@_hlines_clist { ##1 } }
+ { \@@_hline:nn { ##1 } 1 }
+ }
}
% \end{macrocode}
%
@@ -13016,12 +13439,8 @@ version 2005/12/01 or later.
r .value_forbidden:n = true ,
c .code:n = \tl_set:Nn \l_@@_pos_of_block_tl c ,
c .value_forbidden:n = true ,
-% \end{macrocode}
-% The two following lines will be uncommented when we will give to the key
-% |color| its new definition.
-% \begin{macrocode}
- % color .tl_set:N = \l_@@_color_tl ,
- % color .value_required:n = true ,
+ color .tl_set:N = \l_@@_color_tl ,
+ color .value_required:n = true ,
}
% \end{macrocode}
%
@@ -13068,7 +13487,8 @@ version 2005/12/01 or later.
% argument of |\Block| (which is of the syntax $i$|-|$j$). However, the user is
% allowed to omit $i$ or $j$ (or both). We detect that situation by replacing a
% missing value by 100 (it's a convention: when the block will actually be drawn
-% these values will be detected and interpreted as \emph{maximal possible value}).
+% these values will be detected and interpreted as \emph{maximal possible
+% value} according to the actual size of the array).
% \begin{macrocode}
\bool_lazy_or:nnTF
{ \tl_if_blank_p:n { #1 } }
@@ -13096,7 +13516,6 @@ version 2005/12/01 or later.
% \begin{macrocode}
\keys_set_known:nn { NiceMatrix / Block / FirstPass } { #3 }
% \end{macrocode}
-%
%
% \begin{macrocode}
\tl_set:Nx \l_tmpa_tl
@@ -13332,15 +13751,9 @@ version 2005/12/01 or later.
fill .value_required:n = true ,
draw .tl_set:N = \l_@@_draw_tl ,
draw .default:n = default ,
-% \end{macrocode}
-% The following definition for the key |color| will be deleted when we will give
-% to the key |color| of the command |\Block| its new definition. It will be
-% replaced by the line which is commented.
-% \begin{macrocode}
- color .code:n =
- \@@_fatal:n { Key~color~for~Block }
- \tl_set:Nn \l_@@_fill_tl { #1 } ,
- % color .code:n = \color { #1 } \tl_set:Nn \l_@@_draw_tl { #1 } ,
+ rounded-corners .dim_set:N = \l_@@_rounded_corners_dim ,
+ rounded-corners .default:n = 4 pt ,
+ color .code:n = \color { #1 } \tl_set:Nn \l_@@_draw_tl { #1 } ,
color .value_required:n = true ,
line-width .dim_set:N = \l_@@_line_width_dim ,
line-width .value_required:n = true ,
@@ -13453,10 +13866,11 @@ version 2005/12/01 or later.
{
\tl_gput_right:Nx \g_nicematrix_code_before_tl
{
- \exp_not:N \rectanglecolor
+ \exp_not:N \roundedrectanglecolor
{ \exp_not:V \l_@@_fill_tl }
{ #1 - #2 }
{ \int_use:N \l_@@_last_row_int - \int_use:N \l_@@_last_col_int }
+ { \dim_use:N \l_@@_rounded_corners_dim }
}
}
% \end{macrocode}
@@ -13479,7 +13893,7 @@ version 2005/12/01 or later.
%
% \medskip
% \begin{macrocode}
- \hbox_set:Nn \l_@@_cell_box { #6 }
+ \hbox_set:Nn \l_@@_cell_box { \set@color #6 }
\bool_if:NT \g_@@_rotate_bool \@@_rotate_cell_box:
% \end{macrocode}
%
@@ -13738,7 +14152,7 @@ version 2005/12/01 or later.
%
% % \bigskip
% The first argument of |\@@_stroke_block:nnn| is a list of options for the
-% rectangle that you will stoke. The second argument is the upper-left cell of
+% rectangle that you will stroke. The second argument is the upper-left cell of
% the block (with, as usual, the syntex $i$|-|$j$) and the third is the last
% cell of the block (with the same syntax).
% \begin{macrocode}
@@ -13759,8 +14173,14 @@ version 2005/12/01 or later.
% \begin{macrocode}
\str_if_eq:VnTF \l_@@_draw_tl { default }
{ \CT@arc@ }
- { \pgfsetstrokecolor { \l_@@_draw_tl } }
+ { \exp_args:NV \pgfsetstrokecolor \l_@@_draw_tl }
}
+ \pgfsetcornersarced
+ {
+ \pgfpoint
+ { \dim_use:N \l_@@_rounded_corners_dim }
+ { \dim_use:N \l_@@_rounded_corners_dim }
+ }
\@@_cut_on_hyphen:w #2 \q_stop
\bool_lazy_and:nnT
{ \int_compare_p:n { \l_tmpa_tl <= \c@iRow } }
@@ -13783,7 +14203,10 @@ version 2005/12/01 or later.
{ \pgfpoint \l_tmpc_dim \l_tmpb_dim }
{ \pgfpoint \l_tmpd_dim \l_tmpa_dim }
\pgfsetlinewidth { 1.1 \l_@@_line_width_dim }
- \pgfusepathqstroke
+% \end{macrocode}
+% We can't use |\pgfusepathqtroke| because of the key |rounded-corners|.
+% \begin{macrocode}
+ \pgfusepath { stroke }
}
\endpgfpicture
\group_end:
@@ -13798,10 +14221,12 @@ version 2005/12/01 or later.
% We will uncomment the following line when we will give to the key |color| of
% the command |\Block| its new definition.
% \begin{macrocode}
- % color .tl_set:N = \l_@@_draw_tl ,
+ color .tl_set:N = \l_@@_draw_tl ,
draw .tl_set:N = \l_@@_draw_tl ,
draw .default:n = default ,
line-width .dim_set:N = \l_@@_line_width_dim ,
+ rounded-corners .dim_set:N = \l_@@_rounded_corners_dim ,
+ rounded-corners .default:n = 4 pt
}
% \end{macrocode}
%
@@ -14228,10 +14653,12 @@ version 2005/12/01 or later.
% \begin{macrocode}
\keys_define:nn { NiceMatrix / SubMatrix }
{
- hlines .clist_set:N = \l_@@_submatrix_hlines_clist ,
+ hlines .clist_set:N = \l_@@_hlines_clist ,
hlines .default:n = all ,
- vlines .clist_set:N = \l_@@_submatrix_vlines_clist ,
+ vlines .clist_set:N = \l_@@_vlines_clist ,
vlines .default:n = all ,
+ hvlines .meta:n = { hlines, vlines } ,
+ hvlines .value_forbidden:n = true ,
name .code:n =
\tl_if_empty:nTF { #1 }
{ \@@_error:n { Invalid~name~format } }
@@ -14249,14 +14676,33 @@ version 2005/12/01 or later.
} ,
rules .code:n = \keys_set:nn { NiceMatrix / rules } { #1 } ,
rules .value_required:n = true ,
+ code .tl_set:N = \l_@@_code_tl ,
+ code .value_required:n = true ,
name .value_required:n = true ,
unknown .code:n = \@@_error:n { Unknown~key~for~SubMatrix }
}
% \end{macrocode}
%
% \bigskip
-% In the |code-after|, the following command |\@@_SubMatrix| will be linked to
-% |\SubMatrix|.
+% \begin{macrocode}
+\NewDocumentCommand \@@_SubMatrix_in_code_before { m m m m ! O { } }
+ {
+ \@@_cut_on_hyphen:w #3 \q_stop
+ \tl_clear_new:N \l_tmpc_tl
+ \tl_clear_new:N \l_tmpd_tl
+ \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl
+ \tl_set_eq:NN \l_tmpd_tl \l_tmpb_tl
+ \@@_cut_on_hyphen:w #2 \q_stop
+ \seq_gput_right:Nx \g_@@_submatrix_seq
+ { { \l_tmpa_tl } { \l_tmpb_tl } { \l_tmpc_tl } { \l_tmpd_tl } }
+ \tl_gput_right:Nn \g_@@_internal_code_after_tl
+ { \SubMatrix { #1 } { #2 } { #3 } { #4 } [ #5 ] }
+ }
+% \end{macrocode}
+%
+% \bigskip
+% In the internal |code-after| and in the |\CodeAfter| the following command
+% |\@@_SubMatrix| will be linked to |\SubMatrix|.
% \begin{itemize}
% \item |#1| is the left delimiter;
% \item |#2| is the upper-left cell of the matrix with the format $i$-$j$;
@@ -14265,26 +14711,35 @@ version 2005/12/01 or later.
% \item |#5| is the list of options of the command.
% \end{itemize}
% \begin{macrocode}
-\NewDocumentCommand \@@_SubMatrix { m m m m ! O { } }
+\NewDocumentCommand \@@_SubMatrix { m m m m O { } }
{
\group_begin:
% \end{macrocode}
+% The four following token lists correspond to the position of the |\SubMatrix|.
+% \begin{macrocode}
+ \tl_clear_new:N \l_@@_first_i_tl
+ \tl_clear_new:N \l_@@_first_j_tl
+ \tl_clear_new:N \l_@@_last_i_tl
+ \tl_clear_new:N \l_@@_last_j_tl
+% \end{macrocode}
% The command |\@@_cut_on_hyphen:w| cuts on the hyphen an argument of the form
% $i$-$j$. The value of $i$ is stored in |\l_tmpa_tl| and the value of $j$ is
% stored in |\l_tmpb_tl|.
% \begin{macrocode}
- \@@_cut_on_hyphen:w #3 \q_stop
- \tl_clear_new:N \l_tmpc_tl
- \tl_clear_new:N \l_tmpd_tl
- \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl
- \tl_set_eq:NN \l_tmpd_tl \l_tmpb_tl
\@@_cut_on_hyphen:w #2 \q_stop
+ \tl_set_eq:NN \l_@@_first_i_tl \l_tmpa_tl
+ \tl_set_eq:NN \l_@@_first_j_tl \l_tmpb_tl
+ \@@_cut_on_hyphen:w #3 \q_stop
+ \tl_set_eq:NN \l_@@_last_i_tl \l_tmpa_tl
+ \tl_set_eq:NN \l_@@_last_j_tl \l_tmpb_tl
\bool_lazy_or:nnTF
- { \int_compare_p:nNn \l_tmpc_tl > \g_@@_row_total_int }
- { \int_compare_p:nNn \l_tmpd_tl > \g_@@_col_total_int }
+ { \int_compare_p:nNn \l_@@_last_i_tl > \g_@@_row_total_int }
+ { \int_compare_p:nNn \l_@@_last_j_tl > \g_@@_col_total_int }
{ \@@_error:n { SubMatrix~too~large } }
{
\str_clear_new:N \l_@@_submatrix_name_str
+ \clist_clear:N \l_@@_hlines_clist
+ \clist_clear:N \l_@@_vlines_clist
\keys_set:nn { NiceMatrix / SubMatrix } { #5 }
\pgfpicture
\pgfrememberpicturepositiononpagetrue
@@ -14296,43 +14751,43 @@ version 2005/12/01 or later.
% The last value of |\int_step_inline:nnn| is provided by currifycation.
% \begin{macrocode}
\bool_if:NTF \l_@@_submatrix_slim_bool
- { \int_step_inline:nnn \l_tmpa_tl \l_tmpc_tl }
+ { \int_step_inline:nnn \l_@@_first_i_tl \l_@@_last_i_tl }
{ \int_step_inline:nnn \l_@@_first_row_int \g_@@_row_total_int }
{
\cs_if_exist:cT
- { pgf @ sh @ ns @ \@@_env: - ##1 - \l_tmpb_tl }
+ { pgf @ sh @ ns @ \@@_env: - ##1 - \l_@@_first_j_tl }
{
- \pgfpointanchor { \@@_env: - ##1 - \l_tmpb_tl } { west }
+ \pgfpointanchor { \@@_env: - ##1 - \l_@@_first_j_tl } { west }
\dim_set:Nn \l_@@_x_initial_dim
{ \dim_min:nn \l_@@_x_initial_dim \pgf@x }
}
\cs_if_exist:cT
- { pgf @ sh @ ns @ \@@_env: - ##1 - \l_tmpd_tl }
+ { pgf @ sh @ ns @ \@@_env: - ##1 - \l_@@_last_j_tl }
{
- \pgfpointanchor { \@@_env: - ##1 - \l_tmpd_tl } { east }
+ \pgfpointanchor { \@@_env: - ##1 - \l_@@_last_j_tl } { east }
\dim_set:Nn \l_@@_x_final_dim
{ \dim_max:nn \l_@@_x_final_dim \pgf@x }
}
}
- \@@_qpoint:n { row - \l_tmpa_tl - base }
+ \@@_qpoint:n { row - \l_@@_first_i_tl - base }
\dim_set:Nn \l_@@_y_initial_dim
{ \pgf@y + ( \box_ht:N \strutbox + \extrarowheight ) * \arraystretch }
- \@@_qpoint:n { row - \l_tmpc_tl - base }
+ \@@_qpoint:n { row - \l_@@_last_i_tl - base }
\dim_set:Nn \l_@@_y_final_dim
{ \pgf@y - ( \box_dp:N \strutbox ) * \arraystretch }
\int_step_inline:nnn \l_@@_first_col_int \g_@@_col_total_int
{
\cs_if_exist:cT
- { pgf @ sh @ ns @ \@@_env: - \l_tmpa_tl - ##1 }
+ { pgf @ sh @ ns @ \@@_env: - \l_@@_first_i_tl - ##1 }
{
- \pgfpointanchor { \@@_env: - \l_tmpa_tl - ##1 } { north }
+ \pgfpointanchor { \@@_env: - \l_@@_first_i_tl - ##1 } { north }
\dim_set:Nn \l_@@_y_initial_dim
{ \dim_max:nn \l_@@_y_initial_dim \pgf@y }
}
\cs_if_exist:cT
- { pgf @ sh @ ns @ \@@_env: - \l_tmpc_tl - ##1 }
+ { pgf @ sh @ ns @ \@@_env: - \l_@@_last_i_tl - ##1 }
{
- \pgfpointanchor { \@@_env: - \l_tmpc_tl - ##1 } { south }
+ \pgfpointanchor { \@@_env: - \l_@@_last_i_tl - ##1 } { south }
\dim_set:Nn \l_@@_y_final_dim
{ \dim_min:nn \l_@@_y_final_dim \pgf@y }
}
@@ -14360,9 +14815,10 @@ version 2005/12/01 or later.
% \begin{macrocode}
\seq_map_inline:Nn \g_@@_cols_vlism_seq
{
- \int_compare:nNnT \l_tmpb_tl < { ##1 }
+ \int_compare:nNnT \l_@@_first_j_tl < { ##1 }
{
- \int_compare:nNnT { ##1 } < { \int_eval:n { \l_tmpd_tl + 1 } }
+ \int_compare:nNnT
+ { ##1 } < { \int_eval:n { \l_@@_last_j_tl + 1 } }
{
% \end{macrocode}
% First, we extract the value of the abscissa of the rule we have to draw.
@@ -14381,15 +14837,17 @@ version 2005/12/01 or later.
% The last argument of |\int_step_inline:nn| or |\clist_map_inline:Nn| is given
% by curryfication.
% \begin{macrocode}
- \tl_if_eq:NnTF \l_@@_submatrix_vlines_clist { all }
- { \int_step_inline:nn { \l_tmpd_tl - \l_tmpb_tl } }
- { \clist_map_inline:Nn \l_@@_submatrix_vlines_clist }
+ \tl_if_eq:NnTF \l_@@_vlines_clist { all }
+ { \int_step_inline:nn { \l_@@_last_j_tl - \l_@@_first_j_tl } }
+ { \clist_map_inline:Nn \l_@@_vlines_clist }
{
\bool_lazy_and:nnTF
{ \int_compare_p:nNn { ##1 } > 0 }
- { \int_compare_p:nNn { ##1 } < { \l_tmpd_tl - \l_tmpb_tl + 1 } }
+ {
+ \int_compare_p:nNn
+ { ##1 } < { \l_@@_last_j_tl - \l_@@_first_j_tl + 1 } }
{
- \@@_qpoint:n { col - \int_eval:n { ##1 + \l_tmpb_tl } }
+ \@@_qpoint:n { col - \int_eval:n { ##1 + \l_@@_first_j_tl } }
\pgfpathmoveto { \pgfpoint \pgf@x \l_@@_y_initial_dim }
\pgfpathlineto { \pgfpoint \pgf@x \l_@@_y_final_dim }
\pgfusepathqstroke
@@ -14404,15 +14862,17 @@ version 2005/12/01 or later.
% The last argument of |\int_step_inline:nn| or |\clist_map_inline:Nn| is given
% by curryfication.
% \begin{macrocode}
- \tl_if_eq:NnTF \l_@@_submatrix_hlines_clist { all }
- { \int_step_inline:nn { \l_tmpc_tl - \l_tmpa_tl } }
- { \clist_map_inline:Nn \l_@@_submatrix_hlines_clist }
+ \tl_if_eq:NnTF \l_@@_hlines_clist { all }
+ { \int_step_inline:nn { \l_@@_last_i_tl - \l_@@_first_i_tl } }
+ { \clist_map_inline:Nn \l_@@_hlines_clist }
{
\bool_lazy_and:nnTF
{ \int_compare_p:nNn { ##1 } > 0 }
- { \int_compare_p:nNn { ##1 } < { \l_tmpc_tl - \l_tmpa_tl + 1 } }
+ {
+ \int_compare_p:nNn
+ { ##1 } < { \l_@@_last_i_tl - \l_@@_first_i_tl + 1 } }
{
- \@@_qpoint:n { row - \int_eval:n { ##1 + \l_tmpa_tl } }
+ \@@_qpoint:n { row - \int_eval:n { ##1 + \l_@@_first_i_tl } }
% \end{macrocode}
% We use a group to protect |\l_tmpa_dim| and |\l_tmpb_dim|.
% \begin{macrocode}
@@ -14495,11 +14955,121 @@ version 2005/12/01 or later.
\@@_node_right:nn #4 { \@@_env: - \l_@@_submatrix_name_str - right }
}
\endpgfpicture
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \cs_set_eq:NN \pgfpointanchor \@@_pgfpointanchor:n
+ \flag_clear_new:n { nicematrix }
+ \l_@@_code_tl
}
\group_end:
}
% \end{macrocode}
+% The group was a group for the whole |\SubMatrix|.
+%
+% \bigskip
+% In the key |code| of the command |\SubMatrix| there may be Tikz instructions.
+% We want that, in these instructions, the $i$ and $j$ in specifications of
+% nodes of the forms $i$|-|$j$, |row-|$i$, |col-|$j$ and $i$\verb+-|+$j$ refer
+% to the number of row and columm \emph{relative} of the current |\SubMatrix|.
+% That's why we will patch (locally in the |\SubMatrix|) the command
+% |\pgfpointanchor|.
+% \begin{macrocode}
+\cs_set_eq:NN \@@_old_pgfpointanchor \pgfpointanchor
+% \end{macrocode}
+%
+% \bigskip
+% The following command will be linked to |\pgfpointanchor| just before the
+% execution of the option |code| of the command |\SubMatrix|. In this command,
+% we catch the argument |#1| of |\pgfpointanchor| and we apply to it the command
+% |\@@_pgfpointanchor_i:nn| before passing it to the original |\pgfpointanchor|.
+% We have to act in an expandable way because the command |\pgfpointanchor| is
+% used in names of Tikz nodes which are computed in an expandable way.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_pgfpointanchor:n #1
+ {
+ \use:e
+ { \exp_not:N \@@_old_pgfpointanchor { \@@_pgfpointanchor_i:nn #1 } }
+ }
+% \end{macrocode}
+%
+% \bigskip
+% In fact, the argument of |\pgfpointanchor| is always of the form
+% |\a_command { name_of_node }| where ``|name_of_node|'' is the name of the Tikz
+% node without the potential prefix and suffix. That's why we catch two
+% arguments and work only on the second by trying (first) to extract an hyphen |-|.
+% \begin{macrocode}
+\cs_new:Npn \@@_pgfpointanchor_i:nn #1 #2
+ { #1 { \@@_pgfpointanchor_ii:w #2 - \q_stop } }
+% \end{macrocode}
%
+% \bigskip
+% Since |\seq_if_in:NnTF| and |\clist_if_in:NnTF| are not expandable, we will
+% use the following token list and |\str_case:nVTF| to test whether we have an
+% integer or not.
+% \begin{macrocode}
+\tl_const:Nn \c_@@_integers_alist_tl
+ {
+ { 1 } { } { 2 } { } { 3 } { } { 4 } { } { 5 } { }
+ { 6 } { } { 7 } { } { 8 } { } { 9 } { } { 10 } { }
+ { 11 } { } { 12 } { } { 13 } { } { 14 } { } { 15 } { }
+ { 16 } { } { 17 } { } { 18 } { } { 19 } { } { 20 } { }
+ }
+% \end{macrocode}
+%
+% \bigskip
+% \begin{macrocode}
+\cs_new:Npn \@@_pgfpointanchor_ii:w #1-#2\q_stop
+ {
+% \end{macrocode}
+% If there is no hyphen, that means that the node is of the form of a single
+% number (ex.: |5| or |11|). In that case, we are in an analysis which result
+% from a specification of node of the form $i$\verb+-|+$j$. In that case, the
+% $i$ of the number of row arrives first (and alone) in a |\pgfpointanchor| and,
+% the, the $j$ arrives (alone) in the following |\pgfpointanchor|. In order to
+% know whether we have a number of row of a number of column, we keep track of
+% the number of such treatments by the expandable flag called |nicematrix|.
+% \begin{macrocode}
+ \tl_if_empty:nTF { #2 }
+ {
+ \str_case:nVTF { #1 } \c_@@_integers_alist_tl
+ {
+ \flag_raise:n { nicematrix }
+ \int_if_even:nTF { \flag_height:n { nicematrix } }
+ { \int_eval:n { #1 + \l_@@_first_i_tl - 1 } }
+ { \int_eval:n { #1 + \l_@@_first_j_tl - 1 } }
+ }
+ { #1 }
+ }
+% \end{macrocode}
+% If there is an hyphen, we have to see whether we have a node of the form
+% $i$|-|$j$, |row-|$i$ or |col-|$j$.
+% \begin{macrocode}
+ { \@@_pgfpointanchor_iii:w { #1 } #2 }
+ }
+% \end{macrocode}
+%
+% \bigskip
+% There was an hyphen in the name of the node and that's why we have to retrieve
+% the extra hyphen we have put (cf. |\@@_pgfpointanchor_i:nn|).
+% \begin{macrocode}
+\cs_new:Npn \@@_pgfpointanchor_iii:w #1 #2 -
+ {
+ \str_case:nnF { #1 }
+ {
+ { row } { row - \int_eval:n { #2 + \l_@@_first_i_tl - 1 } }
+ { col } { col - \int_eval:n { #2 + \l_@@_first_j_tl - 1 } }
+ }
+% \end{macrocode}
+% Now the case of a node of the form $i$|-|$j$.
+% \begin{macrocode}
+ {
+ \int_eval:n { #1 + \l_@@_first_i_tl - 1 }
+ - \int_eval:n { #2 + \l_@@_first_j_tl - 1 }
+ }
+ }
+% \end{macrocode}
+%
% \medskip
% The command |\@@_node_left:nn| puts the left delimiter with the correct size.
% The argument |#1| is the delimiter to put. The argument |#2| is the name we
@@ -14868,15 +15438,6 @@ version 2005/12/01 or later.
}
% \end{macrocode}
%
-% \begin{macrocode}
-\@@_msg_new:nn { Key~color~for~Block }
- {
- The~key~'color'~for~the~command~\token_to_str:N \Block\
- is~deprecated:~you~should~use~'fill'~instead.\\
- This~error~is~fatal.
-
- }
-% \end{macrocode}
%
% \begin{macrocode}
\@@_msg_new:nn { ampersand~in~light-syntax }
@@ -14988,6 +15549,16 @@ version 2005/12/01 or later.
\seq_use:Nnnn \g_@@_submatrix_names_seq { ~and~ } { ,~ } { ~and~ }.
}
% \end{macrocode}
+%
+% \begin{macrocode}
+\@@_msg_new:nn { r~or~l~with~preamble }
+ {
+ You~can't~use~the~key~'\l_keys_key_str'~in~your~\@@_full_name_env:.~
+ You~must~specify~the~alignment~of~your~columns~with~the~preamble~of~
+ your~\@@_full_name_env:.\\
+ If~you~go~on,~this~key~will~be~ignored.
+ }
+% \end{macrocode}
%
% \begin{macrocode}
\@@_msg_new:nn { Hdotsfor~in~col~0 }
@@ -15131,8 +15702,8 @@ version 2005/12/01 or later.
For~a~list~of~the~available~keys,~type~H~<return>.
}
{
- The~available~keys~are~(in~alphabetic~order):~-,~c,~draw,~fill,~l,~
- line-width~and~r.
+ The~available~keys~are~(in~alphabetic~order):~c,~draw,~fill,~l,~
+ line-width,~rounded-corners~and~r.
}
% \end{macrocode}
%
@@ -15167,12 +15738,13 @@ version 2005/12/01 or later.
'delimiters/color',~
'extra-height',~
'hlines',~
+ 'hvlines',~
'left-xshift',~
'name',~
'right-xshift',~
'rules'~(with~the~subkeys~'color'~and~'width'),~
'slim',~
- 'vlines'~and~'xshift'~(which~set~both~'left-xshift'~
+ 'vlines'~and~'xshift'~(which~sets~both~'left-xshift'~
and~'right-xshift').\\
}
% \end{macrocode}
@@ -15862,9 +16434,21 @@ version 2005/12/01 or later.
% \subsection*{Changes between versions 5.10 and 5.11}
%
% It's now possible, in the |code-before| and in the |\CodeAfter|, to use the
-% syntax \verb+|(i-|j)+ for the Tikz node at the intersection of the (potential)
+% syntax \verb+(i-|j)+ for the Tikz node at the intersection of the (potential)
% horizontal rule number~$i$ and the (potential) vertical rule number~$j$.
%
+% % \subsection*{Changes between versions 5.11 and 5.12}
+%
+% Keywords |\CodeBefore| and |\Body| (alternative syntax to the key
+% |code-before|).
+%
+% New key |delimiters/max-width|.
+%
+% New keys |hlines|, |vlines| and |hvlines| for the command |\SubMatrix| in the
+% |\CodeAfter|.
+%
+% New key |rounded-corners| for the command |\Block|.
+%
% \PrintIndex
%
% \tableofcontents
diff --git a/macros/latex/contrib/nicematrix/nicematrix.pdf b/macros/latex/contrib/nicematrix/nicematrix.pdf
index a8e3ae524e..18b9e7af32 100644
--- a/macros/latex/contrib/nicematrix/nicematrix.pdf
+++ b/macros/latex/contrib/nicematrix/nicematrix.pdf
Binary files differ