diff options
author | Norbert Preining <norbert@preining.info> | 2021-04-26 03:00:32 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2021-04-26 03:00:32 +0000 |
commit | 03117c94362b2fed2fd4aabe50f3106fbf1e0a70 (patch) | |
tree | e9c379ff69ea790a0059725aebd5048e8d773e45 /macros/latex | |
parent | 31672400f6cb00d38c0e707da2640589b6d5c523 (diff) |
CTAN sync 202104260300
Diffstat (limited to 'macros/latex')
-rw-r--r-- | macros/latex/contrib/easybook/doc/easybook-demo.pdf | bin | 268473 -> 268704 bytes | |||
-rw-r--r-- | macros/latex/contrib/easybook/doc/easybook-demo.tex | 2 | ||||
-rw-r--r-- | macros/latex/contrib/easybook/doc/easybook.pdf | bin | 462158 -> 465175 bytes | |||
-rw-r--r-- | macros/latex/contrib/easybook/easybook.dtx | 233 | ||||
-rw-r--r-- | macros/latex/contrib/nicematrix/nicematrix-french.pdf | bin | 455133 -> 462451 bytes | |||
-rw-r--r-- | macros/latex/contrib/nicematrix/nicematrix-french.tex | 202 | ||||
-rw-r--r-- | macros/latex/contrib/nicematrix/nicematrix.dtx | 1201 | ||||
-rw-r--r-- | macros/latex/contrib/nicematrix/nicematrix.pdf | bin | 1212783 -> 1235344 bytes |
8 files changed, 1013 insertions, 625 deletions
diff --git a/macros/latex/contrib/easybook/doc/easybook-demo.pdf b/macros/latex/contrib/easybook/doc/easybook-demo.pdf Binary files differindex 5a65caeff2..bcfab49697 100644 --- a/macros/latex/contrib/easybook/doc/easybook-demo.pdf +++ b/macros/latex/contrib/easybook/doc/easybook-demo.pdf diff --git a/macros/latex/contrib/easybook/doc/easybook-demo.tex b/macros/latex/contrib/easybook/doc/easybook-demo.tex index 72944586bf..3d9bd6212f 100644 --- a/macros/latex/contrib/easybook/doc/easybook-demo.tex +++ b/macros/latex/contrib/easybook/doc/easybook-demo.tex @@ -106,7 +106,7 @@ \url{https://latexstudio.net} \\ \url{https://gitee.com/texl3/easybook}\thanks{Gitee为项目的主要发布地址。} } -\date{2021/04/23\hskip\ccwd\relax v1.24s} +\date{2021/04/25\hskip\ccwd\relax v1.24t} \frontmatter[roman] \maketitle diff --git a/macros/latex/contrib/easybook/doc/easybook.pdf b/macros/latex/contrib/easybook/doc/easybook.pdf Binary files differindex 03d5910ac8..bd22407ff2 100644 --- a/macros/latex/contrib/easybook/doc/easybook.pdf +++ b/macros/latex/contrib/easybook/doc/easybook.pdf diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx index fe0a1e01be..dd209df137 100644 --- a/macros/latex/contrib/easybook/easybook.dtx +++ b/macros/latex/contrib/easybook/easybook.dtx @@ -8,7 +8,8 @@ % https://creativecommons.org/licenses/by/4.0/legalcode %<*driver> \def\nameofplainTeX{plain} -\ifx\fmtname\nameofplainTeX\else +\ifx\fmtname\nameofplainTeX +\else \expandafter\begingroup \fi %<*install> @@ -55,7 +56,7 @@ The latest version of this license is in % % \title{\sffamily easybook 书籍文档类} % \author{瞿毅} -% \date{2021/04/23\hskip\ccwd\relax v1.24s\thanks{\url{https://gitee.com/texl3/easybook}}} +% \date{2021/04/25\hskip\ccwd\relax v1.24t\thanks{\url{https://gitee.com/texl3/easybook}}} % \maketitle % \begin{abstract} % \cls{easybook} 是基于 \cls{ctexbook} 书籍文档类创建以极简为风格的模板,可以看作对 \cls{ctexbook} 的进一步包装。虽然\CTeX 文档类提供了较好的中文支持,但想实现个性化功能一般需要在其基础上载入更多宏包来定制。\cls{easybook} 考虑了一些细节并载入一些常用宏包实现一般的排版需求,它适用于排版中英文书籍或笔记,甚至可稍加调整成为学位论文模板。 @@ -182,7 +183,7 @@ The latest version of this license is in % \end{syntax} % \opt{multoc} 与 \opt{style/multoc} 选项具有相同的效果,但是具有优先性且可单独设置不同目录是否双栏排版。已经预置了中英文的目录标题,可以使用 \opt{title} 选项更改目录标题的名称。\opt{book} 选项使目录标题按照 \opt{chapter} 级别输出,\opt{article} 选项使目录标题按照 \opt{article} 级别输出,默认为 \opt{chapter} 级别。 % \changes{v1.23}{2021/03/15}{为几个目录增加键值列表的选项,可设置标题输出级别以及是否加入主目录。} -% \changes{v1.24s}{2021/04/04}{目录命令的可选参数增加标题键值。} +% \changes{v1.24t}{2021/04/04}{目录命令的可选参数增加标题键值。} % \end{function} % % \section{接口选项} @@ -265,7 +266,7 @@ The latest version of this license is in % \ding{229} 以上选项路径为 \opt{link/...} \\ % \opt{link} 将超链接选项(包括以上选项)交给 \pkg{hyperref} 处理,除了一些关于 pdf 书签的选项可能会失效,其它由键值选项命令 \tn{hypersetup} 支持的多数选项可用。 % \changes{v1.10}{2021/01/08}{修复了 \opt{linktopage} 选项关闭时目录中标题编号无超链接的问题。} -% \changes{v1.24s}{2021/04/05}{增加 \pkg{hyperref} 超链接选项完整的支持。} +% \changes{v1.24t}{2021/04/05}{增加 \pkg{hyperref} 超链接选项完整的支持。} % \end{function} % % \begin{optdesc} @@ -344,7 +345,7 @@ The latest version of this license is in % \ding{229} 以上选项路径为 \opt{bibset/...} % \changes{v1.21}{2021/01/11}{增加 \opt{bibset} 选项,可以使用 \hologo{BibTeX} 或 \hologo{biber} 编译参考文献。} % \changes{v1.23}{2021/02/23}{使用 \opt{bibset} 选项时可设置标注风格。} -% \changes{v1.24s}{2021/04/09}{可以不载入参考文献包手动配置参考文献格式。} +% \changes{v1.24t}{2021/04/09}{可以不载入参考文献包手动配置参考文献格式。} % \end{function} % % \begin{optdesc} @@ -396,7 +397,7 @@ The latest version of this license is in % \end{function} % % \begin{optdesc} -% \item[thmbox] 开启几个预置定理环境盒子的边框,需载入 \pkg{tcolorbox} 宏包才生效。 +% \item[thmbox] 开启定理环境盒子的边框,需载入 \pkg{tcolorbox} 宏包才生效。 % \item[within] 定理编号跟随的计数器,默认跟随章的编号,也可以跟随其它定理环境的编号,当计数器增加时定理编号会从零开始,空置时不跟随其它计数器。 % \item[headpunct] 定理标题末尾后的标记,在换行符或第一段内容的间隔之前。 % \item[bodyfont] 定理内容部分的字体。 @@ -408,32 +409,42 @@ The latest version of this license is in % \item[spacepost] 定理标题后与第一段内容的间隔。 % \end{optdesc} % -% \begin{function}[added = 2021-01-12,updated = 2021-03-13]{\newtheorem, \declaretheoremstyle} +% \begin{function}[added = 2021-01-12,updated = 2021-04-25]{\newtheorem,\EbNewtheorem,\declaretheoremstyle} % \begin{syntax} % \tn{newtheorem}\oarg{键值列表}\marg{定理环境名} +% \tn{EbNewtheorem}\marg{定理环境名}\oarg{英文标题}\marg{中文标题}\parg{盒子样式|(tc-theorem)}\oarg{键值列表} % \tn{declaretheoremstyle}\oarg{键值列表}\marg{定理样式名} % \end{syntax} % 文档类已预置8个定理环境,环境名及对应的定理标题名见小节 \ref{subsec:theorem},如果需要新的定理标题名或定理样式可使用这两个命令。 % \changes{v1.23}{2021/03/12}{重新定义了新定理环境命令 \tn{newtheorem}。} +% \changes{v1.24t}{2021/04/25}{增加定义定理环境命令 \tn{EbNewtheorem}。} % \end{function} % % \begin{optdesc} % \item[\tn{newtheorem}] 定义新的定理类环境,可选参数与 \pkg{thmtools} 宏包定理命令 \tn{declaretheorem} 的参数一致。常用的选项如下 -% \begin{description} -% \item[name] 定理的标题。默认值是环境的名称,并且首字母大写(英文标题)。 -% \item[numbered] 值为 \opt{no}、\opt{yes} 或 \opt{unless unique}。定理将被编号,而不是编号,或者只有在文档中多次出现时才被编号。 -% \item[numberlike] 定理将使用此计数器进行编号,通常这是另一个定理环境的名称。 -% \item[style] 用 \tn{declaretheoremstyle} 定义的定理样式的名称,定理将使用这种样式的设置。 -% \end{description} +% \begin{description} +% \item[name] 定理的标题。默认值是环境的名称,并且首字母大写(英文标题)。 +% \item[numbered] 值为 \opt{no}、\opt{yes} 或 \opt{unless unique}。定理将被编号,而不是编号,或者只有在文档中多次出现时才被编号。 +% \item[numberlike] 定理将使用此计数器进行编号,通常这是另一个定理环境的名称。 +% \item[style] 用 \tn{declaretheoremstyle} 定义的定理样式的名称,定理将使用这种样式的设置。 +% \end{description} +% \item[\tn{EbNewtheorem}] \tn{EbNewtheorem} 是更便捷的定理命令,它定义一个新的定理环境,键值列表支持的选项与 \tn{newtheorem} 相同,但它们的区别有 +% \begin{itemize} +% \item 中英文模式下标题不同,英文标题为可选项,默认为首字母大写的环境名。 +% \item 自动定义交叉引用的格式,引用标签前缀为定理名称。 +% \item 定理盒子选项 \opt{thmbox} 仍然生效,盒子样式选项是用于设置定理盒子样式的名称,它需要 \pkg{tcolorbox} 的 \tn{tcbset} 接口命令设定,默认为 \opt{tc-theorem}。 +% \item 默认使用 \opt{easy-theorem} 定理样式,可在最后一个选项使用 \opt{style} 更改样式。 +% \end{itemize} % \item[\tn{declaretheoremstyle}] 定义新的定理样式,可选参数中除了包括上述定理样式选项,还包括 \tn{newtheorem} 的选项。 % \end{optdesc} % % \subsubsection{新的定理样式} -% 定理由 \pkg{thmtools} 设置,预置定理的样式为 \opt{easy-thm-sty},上述定理样式选项将对这个定理样式生效。如果使用这个样式而只是增加新的定理名称,可以这样 +% 定理由 \pkg{thmtools} 设置,预置定理的样式为 \opt{easy-theorem},上述定理样式选项将对这个定理样式生效。如果使用这个样式而只是增加新的定理名称,可以这样 % \begin{ctexexam} -% \newtheorem[style = easy-thm-sty,name = 定理名]{定理环境名} +% \EbNewtheorem{定理环境名}{中文标题}[style = other theorem] +% \newtheorem[style = easy-theorem,name = 定理名]{定理环境名} % \end{ctexexam} -% 若要给定理环境增加边框,可以如下进行设置 +% \tn{newtheorem} 定义的定理环境需要手动增加盒子边框,可以如下进行设置 % \begin{ctexexam} % \tcolorboxenvironment{定理环境名}{tc-theorem} % \end{ctexexam} @@ -490,7 +501,7 @@ The latest version of this license is in % \changes{v1.21}{2021/01/13}{增加配置页眉页脚的选项。} % \changes{v1.23}{2021/03/08}{优化页眉页脚设置,增加 \opt{chap-mark} 和 \opt{sec-mark} 标志选项。} % \changes{v1.23}{2021/03/14}{可以手动绘制页眉、页脚和脚注的横线。} -% \changes{v1.24s}{2021/04/09}{增加 \opt{subsec-mark} 标志选项,仅在 \opt{article} 模式生效。} +% \changes{v1.24t}{2021/04/09}{增加 \opt{subsec-mark} 标志选项,仅在 \opt{article} 模式生效。} % \end{function} % % \begin{function}[added = 2021-01-13,updated = 2021-03-14]{\easyhead,\easyfoot} @@ -529,7 +540,7 @@ The latest version of this license is in % % \opt{format} 是目录中标题的格式,可以设置字体和加入垂直间距等,垂直间距最好使用无间距重合的 \tn{addvspace} 命令。\opt{indent} 是目录中标题在页面左侧的缩进距离,应该有长度单位。\opt{rule} 选项中一般应当使用 \tn{tocrule} 命令,将会在接下来介绍。\opt{numsep} 是有编号的标题在目录中编号与标题的间距。 % \changes{v1.21}{2021/01/13}{增加配置目录样式的选项。} -% \changes{v1.24s}{2021/04/20}{增加目录中编号与标题的间距选项 \opt{numsep}。} +% \changes{v1.24t}{2021/04/20}{增加目录中编号与标题的间距选项 \opt{numsep}。} % \end{function} % % \begin{function}[added = 2021-01-13,updated = 2021-04-20]{\tocrule,\EbNumberline} @@ -568,22 +579,22 @@ The latest version of this license is in % indent-all = <目录标题左边缩进> % \end{syntax} % \ding{229} 以上选项路径为 \opt{tocset/lists/...} 或 \opt{tocset/...} -% \changes{v1.24s}{2021/04/05}{可以设置图、表和代码目录的标签。} -% \changes{v1.24s}{2021/04/06}{增加目录引导线右边对齐方式。} -% \changes{v1.24s}{2021/04/19}{给目录增加 \opt{hang} 样式选项。} +% \changes{v1.24t}{2021/04/05}{可以设置图、表和代码目录的标签。} +% \changes{v1.24t}{2021/04/06}{增加目录引导线右边对齐方式。} +% \changes{v1.24t}{2021/04/19}{给目录增加 \opt{hang} 样式选项。} % \end{function} % % \begin{optdesc} % \item[lolskip] \opt{lolskip} 是代码目录中章之间的代码标题的距离,与\CTeX 的表格目录和图片目录中章之间的标题距离选项 \opt{lotskip} 和 \opt{lofskip} 类似,它们的值均默认0.8 pc,在 \opt{article} 模式中此选项失效。 % \item[belowoffset] \opt{belowoffset} 选项为主目录标题 \tn{contentsname} 后的间距补偿,一般为负值,用于抵消 \opt{format} 中设置的垂直间距。\opt{lists} 中的 \opt{belowoffset} 与之意义类似,但是一般为正值,可以在 \opt{article} 模式中使用。建议 \opt{lists/lolskip(0.8pc) + lists/format/addvspace(0.2pc) + lists/belowoffset(0pc) = belowoffset(-1pc)}。 % \item[tocline] 目录标签整体使用 \opt{tocline} 设置,在图表标签的参数中\#1代表编号,代码标签中则是 \tn{thelstlisting} 代表编号,标签中还可包含标签名称,默认标签名称与图、表和代码环境的标题名称一致。下面举个设置标签的例子 -% \begin{ctexexam} -% \tocset -% { -% tocline-fig = 图#1\hspace{\ccwd} -% tocline-lst = 代码\thelstlisting\hspace{\ccwd} -% } -% \end{ctexexam} +% \begin{ctexexam} +% \tocset +% { +% tocline-fig = 图#1\hspace{\ccwd} +% tocline-lst = 代码\thelstlisting\hspace{\ccwd} +% } +% \end{ctexexam} % \item[line-align] \opt{line-align} 选项可以使目录引导线右边对齐并与页码保持一定间隙,否则会与页码连接。 % \item[hang] \opt{hang} 选项使目录标题为悬挂缩进形式,缩进距离为编号及其与标题间距的长度,但此时目录编号会失去超链接。 % \item[numsep-all] 统一设置所有有编号的标题在目录中编号与标题的间距。 @@ -610,7 +621,7 @@ The latest version of this license is in % \tn{end}\marg{环境名} % \end{syntax} % \pkg{enumitem} 宏包为系统预置的列表环境 \env{enumerate}、\env{itemize}和 \env{description} 提供了更灵活的标签以及间距的控制,可使用 \tn{setlist} 命令设置原有的三种列表格式,也可以直接使用可选参数的键值列表,具体选项见 \pkg{enumitem} 宏包文档。已为三种列表预置了三个级别的格式可相互嵌套,默认标签与 \cls{book} 文档类相同,若自定义标签可例如 -% \changes{v1.24s}{2021/04/08}{重新优化列表环境的配置。} +% \changes{v1.24t}{2021/04/08}{重新优化列表环境的配置。} % \end{function} % % \begin{ctexexam} @@ -651,7 +662,7 @@ The latest version of this license is in % \ <定理内容> % \tn{end}\marg{环境名} % \end{syntax} -% 这些是已预置的定理环境,定理环境除了注和证明跟随章编号并可带有边框,盒子边框可使用 \opt{thmset/thmbox = false} 关闭,证明末尾会自动添加证明结束符。环境名对应的定理标题名如下 +% 这些是已预置的定理环境,它们的盒子边框可使用 \opt{thmset/thmbox = false} 关闭,其中注与证明环境不编号,证明末尾会自动添加证明结束符,声明新的定理环境见小节 \ref{subsec:theorem of style}。环境名对应的定理标题名如下 % \begin{center} % \begin{tabular}{*{8}{c}} % \toprule @@ -729,7 +740,7 @@ The latest version of this license is in % \tn{end}\marg{ebparbox} % \end{syntax} % 环境 \env{ebparbox} 与 \env{easybox} 类似,同样带有三个可选参数。当使用星号参数时盒子左边带有一条竖线,\meta{颜色名} 选项可以自定义竖线颜色,使用不带有星号的环境则盒子带有竖线颜色的浅色背景。\meta{段落标题} 选项可以设置标题,默认无标题。 -% \changes{v1.24s}{2021/04/19}{优化盒子环境的选项,增加可带有标题的扁平盒子 \env{ebparbox}。} +% \changes{v1.24t}{2021/04/19}{优化盒子环境的选项,增加可带有标题的扁平盒子 \env{ebparbox}。} % \end{function} % % \subsubsection{行内盒子} @@ -751,7 +762,7 @@ The latest version of this license is in % \ <行间代码> % \tn{end}\marg{lstlisting} % \end{syntax} -% 加载 \pkg{listings} 宏包以对代码格式进行高度定制,代码样式可使用 \tn{lstset} 命令设置。\opt{lstlistlistingname} 和 \opt{lstlistingname} 分别是代码目录名与代码环境标题名,与\CTeX 使用手册中标题汉化一节用法相同,可使用 \tn{ctexset} 直接定义。 +% 加载 \pkg{listings} 宏包以对代码格式进行高度定制,代码样式可使用 \tn{lstset} 命令设置,预置的代码样式名为 \opt{easy-listings}。\opt{lstlistlistingname} 和 \opt{lstlistingname} 分别是代码目录名与代码环境标题名,与\CTeX 使用手册中标题汉化一节用法相同,可使用 \tn{ctexset} 直接定义。 % \end{function} % % \subsection{物理量} @@ -788,7 +799,7 @@ The latest version of this license is in % \tn{labelformat}\marg{计数器}\marg{标签引用格式} % \end{syntax} % 使用 \tn{ref} 命令进行引用将会自动检测环境并添加相应的前缀,\tn{labelformat} 可以设置标签引用格式,第二个参数中\#1代表 \tn{the}\meta{计数器},可以设置引用序号的前缀和后缀。 -% \changes{v1.24s}{2021/04/11}{取消载入 \pkg{cleveref} 宏包来交叉引用。} +% \changes{v1.24t}{2021/04/11}{取消载入 \pkg{cleveref} 宏包来交叉引用。} % \end{function} % % \subsubsection{索引} @@ -898,7 +909,7 @@ The latest version of this license is in %<*class> \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e,etoolbox} -\ProvidesExplClass{easybook}{2021/04/23}{1.24s}{beta} +\ProvidesExplClass{easybook}{2021/04/25}{1.24t}{beta} \cs_generate_variant:Nn \__ctex_define:nn {nx} \cs_generate_variant:Nn \int_to_arabic:n {v} @@ -1550,30 +1561,27 @@ The latest version of this license is in figure = \eb@labelname@lof, table = \eb@labelname@lot } -\ctex_at_end_preamble:n +\cs_gset:Npn \caption@@@addcontentsline#1#2#3#4 { - \cs_gset:Npn \caption@@@addcontentsline#1#2#3#4 + \addcontentsline{#1}{#2} { - \addcontentsline{#1}{#2} - { - \ifodd\eb@titletoc@hang@fix - \protect\numberline - \fi - {\prop_item:Nn \l__eb_label_name_prop{#2}{#3}}{#4} - } + \ifodd\eb@titletoc@hang@fix + \protect\numberline + \fi + {\prop_item:Nn \l__eb_label_name_prop{#2}{#3}}{#4} } - \ctex_patch_cmd:Nnn \lst@MakeCaption + } +\ctex_patch_cmd:Nnn \lst@MakeCaption + { + \addcontentsline{lol}{lstlisting} + {\protect\numberline{\thelstlisting}\lst@@caption} + }{ + \addcontentsline{lol}{lstlisting} { - \addcontentsline{lol}{lstlisting} - {\protect\numberline{\thelstlisting}\lst@@caption} - }{ - \addcontentsline{lol}{lstlisting} - { - \ifodd\eb@titletoc@hang@fix - \protect\numberline - \fi - {\eb@labelname@lol}\lst@@caption - } + \ifodd\eb@titletoc@hang@fix + \protect\numberline + \fi + {\eb@labelname@lol}\lst@@caption } } @@ -1958,17 +1966,25 @@ The latest version of this license is in {\tl_const:cn {c__eb_name_#1_tl}{#3}} {\tl_const:cn {c__eb_name_#1_tl}{#2}} } -\clist_map_inline:nn +\NewDocumentCommand{\EbNewtheorem} + {mO{\text_titlecase_first:n {#1}}mD(){tc-theorem}O{}} { - {proposition}{Proposition}{性质}, - {definition}{Definition}{定义}, - {corollary}{Corollary}{推论}, - {exercise}{Exercise}{练习}, - {theorem}{Theorem}{定理}, - {example}{Example}{例}, - {remark}{Remark}{注}, - {lemma}{Lemma}{引理} - }{\__eb_thmname_set:nnn #1} + \ctex_at_end_preamble:n + { + \__eb_thmname_set:nnn {#1}{#2}{#3} + \exp_args:No \declaretheorem@i + { + name = \use:c {c__eb_name_#1_tl}, + style = easy-theorem,#5 + }{#1}[] + \bool_if:NT \l__eb_thmbox_bool + { + \@ifpackageloaded{tcolorbox} + {\tcolorboxenvironment{#1}{#4}}{} + } + \labelformat{#1}{\use:c {c__eb_name_#1_tl}~##1} + } + } \bool_new:N \l__eb_thmbox_bool \tl_new:N \l__eb_thm_numberwith_tl @@ -2021,32 +2037,23 @@ The latest version of this license is in headformat = \NAME\space\NUMBER\NOTE ] } -\ctex_at_end_preamble:n +\__eb_at_end_preamble:n { - \exp_args:NNc \exp_after:wN - \declaretheoremstyle{c__eb_thmtools_keyval_tl}{easy-thm-sty} + \exp_last_unbraced:No + \declaretheoremstyle\c__eb_thmtools_keyval_tl{easy-theorem} + \__eb_thmname_set:nnn {exercise}{Exercise}{练习} + \cs_undefine:N \proof \clist_map_inline:nn { - example,definition,theorem, - proposition,lemma,corollary - }{ - \declaretheorem[ - style = easy-thm-sty, - name = \use:c {c__eb_name_#1_tl} - ]{#1} - } - \cs_undefine:N \proof - \declaretheorem[ - style = easy-thm-sty, - name = \c__eb_name_remark_tl, - numbered = no - ]{remark} - \declaretheorem[ - style = easy-thm-sty, - name = \proofname, - numbered = no, - qed = \qedsymbol - ]{proof} + {lemma}{引理}, + {example}{例}, + {theorem}{定理}, + {corollary}{推论}, + {definition}{定义}, + {proposition}{性质}, + {remark}{注}[numbered = no], + {{proof}{证明}[numbered = no,qed = \qedsymbol]} + }{\EbNewtheorem#1} } \ctex_at_end_package:nn {tasks} @@ -2085,7 +2092,10 @@ The latest version of this license is in \cs_new_protected:Npn \l__eb_math_restore:n #1 { \AtBeginEnvironment{#1} - {\linespread{\fp_use:N \l__eb_spread_math_fp}\selectfont\ignorespaces} + { + \linespread{\fp_use:N \l__eb_spread_math_fp} + \selectfont\ignorespaces + } } \clist_map_inline:nn { @@ -2200,7 +2210,7 @@ The latest version of this license is in {frame~hidden,boxrule = 0pt,toptitle = 8pt,top = 0pt}, IfValueT = {#3}{title = #3}, colback = #2,colbacktitle = #2, - opacityback = 0.1,opacitybacktitle = 0.1, + opacityback = 0.12,opacitybacktitle = 0.12, coltitle = black,colframe = black, left = 6pt,right = 6pt,bottom = 8pt,middle= 8pt, bottomtitle = 8pt, @@ -2221,7 +2231,7 @@ The latest version of this license is in top = 0pt,bottom = 0pt,toptitle = 0pt }{ colback = #2,colbacktitle = #2, - opacityback = 0.1,opacitybacktitle = 0.1, + opacityback = 0.12,opacitybacktitle = 0.12, IfValueTF = {#3}{title = #3,top = 0pt}{top = 8pt}, bottom = 8pt,toptitle = 8pt }, @@ -2244,21 +2254,6 @@ The latest version of this license is in colback = #1,opacityback = 0.12,colframe = #1,#3 }{#2} } -\ctex_at_end_preamble:n - { - \bool_if:NT \l__eb_thmbox_bool - { - \@ifpackageloaded{tcolorbox} - { - \tcolorboxenvironment{theorem}{tc-theorem} - \tcolorboxenvironment{definition}{tc-theorem} - \tcolorboxenvironment{lemma}{tc-theorem} - \tcolorboxenvironment{corollary}{tc-theorem} - \tcolorboxenvironment{proposition}{tc-theorem} - \tcolorboxenvironment{example}{tc-theorem} - }{} - } - } \bool_set_true:N \l__eb_backend_bibtex_bool \tl_new:N \l__eb_bib_style_tl @@ -2390,20 +2385,22 @@ The latest version of this license is in \__eb_patch_cmd:Nnn \@footnotetext {\reset@font} { - \def\baselinestretch{\fp_use:N \l__eb_spread_footnote_fp} + \linespread{\fp_use:N \l__eb_spread_footnote_fp} + \selectfont\ignorespaces \l__eb_font_footnote_tl } \__eb_patch_cmd:Nnn \@mpfootnotetext {\reset@font} { - \def\baselinestretch{\fp_use:N \l__eb_spread_footnote_fp} + \linespread{\fp_use:N \l__eb_spread_footnote_fp} + \selectfont\ignorespaces \l__eb_font_footnote_tl } \__eb_patch_cmd:Nnn \@makefnmark {\normalfont}{\l__eb_font_footnote_tl} \cs_gset:Npn \thempfootnote{\int_to_alph:n {\c@mpfootnote}} -\lstdefinestyle{easy-lst-sty} +\lstdefinestyle{easy-listings} { language = [LaTeX]TeX, texcsstyle = @@ -2448,7 +2445,7 @@ The latest version of this license is in } \lstset { - style = easy-lst-sty, + style = easy-listings, breaklines = true, resetmargins = true, % numbers = left, @@ -2577,6 +2574,8 @@ The latest version of this license is in \exp_args:NV \hypersetup\l__eb_hyperref_clist \labelformat{part}{\CTEXthepart} \labelformat{chapter}{\CTEXthechapter} + \labelformat{figure}{\figurename~#1} + \labelformat{table}{\tablename~#1} \tl_if_eq:NnTF \l__ctex_scheme_tl{chinese} { \keys_set_known:nn {ctex} @@ -2593,16 +2592,8 @@ The latest version of this license is in \labelformat{align}{式(#1)} \labelformat{multline}{式(#1)} \labelformat{gather}{式(#1)} - \labelformat{figure}{图#1} - \labelformat{table}{表#1} \labelformat{section}{节#1} \labelformat{subsection}{小节#1} - \labelformat{theorem}{定理#1} - \labelformat{definition}{定义#1} - \labelformat{lemma}{引理#1} - \labelformat{corollary}{推论#1} - \labelformat{proposition}{性质#1} - \labelformat{example}{例#1} }{ \keys_set_known:nn {ctex} { @@ -2614,16 +2605,8 @@ The latest version of this license is in \labelformat{align}{Equation~(#1)} \labelformat{multline}{Equation~(#1)} \labelformat{gather}{Equation~(#1)} - \labelformat{figure}{Figure~#1} - \labelformat{table}{Table~#1} \labelformat{section}{Section~#1} \labelformat{subsection}{Subsection~#1} - \labelformat{theorem}{Theorem~#1} - \labelformat{definition}{Definition~#1} - \labelformat{lemma}{Lemma~#1} - \labelformat{corollary}{Corollary~#1} - \labelformat{proposition}{Proposition~#1} - \labelformat{example}{Example~#1} } } diff --git a/macros/latex/contrib/nicematrix/nicematrix-french.pdf b/macros/latex/contrib/nicematrix/nicematrix-french.pdf Binary files differindex 98af2c5843..f5af6a6a75 100644 --- a/macros/latex/contrib/nicematrix/nicematrix-french.pdf +++ b/macros/latex/contrib/nicematrix/nicematrix-french.pdf diff --git a/macros/latex/contrib/nicematrix/nicematrix-french.tex b/macros/latex/contrib/nicematrix/nicematrix-french.tex index d92e274140..9d33132192 100644 --- a/macros/latex/contrib/nicematrix/nicematrix-french.tex +++ b/macros/latex/contrib/nicematrix/nicematrix-french.tex @@ -114,7 +114,7 @@ spécial & 12 & 12 & 0.5 & 70 \\ L'extension \pkg{nicematrix} est entièrement contenue dans le fichier |nicematrix.sty|. Ce fichier peut être placé dans le répertoire courant ou dans une arborescence |texmf|. Le mieux reste néanmoins d'installer \pkg{nicematrix} -avec une distribution TeX comme MiKTeX ou TeXlive. +avec une distribution TeX comme MiKTeX, TeXlive ou MacTeX. \bigskip \emph{Remarque} : Si vous utilisez un service LaTeX via Internet (ex. : @@ -413,7 +413,8 @@ $A=\begin{pNiceArray}{cc|cc}[baseline=line-3] 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. +|\Block| pour placer un élément au centre d'un rectangle de cases +fusionnées.\footnote{Les espaces situés après une commande \verb|\Block| sont supprimés.} La commande |\Block| doit être utilisée dans la case supérieure gauche du bloc avec deux arguments obligatoires. @@ -530,6 +531,8 @@ cette clé (la valeur par défaut est 4~pt\footnote{Cette valeur par défaut est \item la clé |borders| permet de ne tracer que certaines des bordures du bloc : cette clé prend comme valeur une liste d'éléments parmi les suivants : |left|, |right|, |top| et |bottom| ; +\item \colorbox{yellow!50}{\bfseries Nouveau 5.15}\enskip la clé |hvlines| trace +tous les filets horizontaux et verticaux dans le bloc ; \item \colorbox{yellow!50}{\bfseries Nouveau 5.14}\enskip les clés |t| et |b| réglent la ligne de base qui sera donnée au bloc quand celui-ci est constitué de plusieurs lignes (séparées par la commande |\\|). @@ -551,7 +554,8 @@ construction |wc{...}| de \pkg{array}). \begin{NiceTabular}{cwc{2cm}wc{3cm}c} rose & tulipe & marguerite & dahlia \\ violette -& ~emphase#\Block[draw=red,fill=red!15,rounded-corners]{2-2}{\LARGE De très jolies fleurs}@ +& ~emphase#\Block[draw=red,fill=[RGB]{204,204,255},rounded-corners]{2-2}@ + ~emphase#{\LARGE De très jolies fleurs}@ & & souci \\ pervenche & & & lys \\ arum & iris & jacinthe & muguet @@ -563,7 +567,7 @@ arum & iris & jacinthe & muguet \begin{center} \begin{NiceTabular}{cwc{2cm}wc{3cm}c} rose & tulipe & marguerite & dahlia \\ -violette & \Block[draw=red,fill=red!15,rounded-corners]{2-2} +violette & \Block[draw=red,fill=[RGB]{204,204,255},rounded-corners]{2-2} {\LARGE De très jolies fleurs} & & souci \\ pervenche & & & lys \\ arum & iris & jacinthe & muguet @@ -871,8 +875,9 @@ A&B&C&D \\ \subsection{L'épaisseur et la couleur des filets} Les environnements de \pkg{nicematrix} proposent une clé |rules/width| pour -fixer la largeur (en fait l'épaisseur) des filets dans l'environnement. En fait, -cette clé ne fait que fixer la valeur du paramètre dimensionnel |\arrayrulewidth|. +fixer la largeur (on devrait plutôt dire l'épaisseur) des filets dans +l'environnement. En fait, cette clé ne fait que fixer la valeur du paramètre +dimensionnel |\arrayrulewidth|. \smallskip On sait que \pkg{colortbl} propose la commande |\arrayrulecolor| pour spécifier @@ -883,7 +888,8 @@ Avec \pkg{nicematrix}, il est possible de spécifier une couleur même si \pkg{colortbl} n'est pas chargé. Par souci de compatibilité, la commande est nommée également |\arrayrulecolor|. Les environnements de \pkg{nicematrix} proposent également une clé |rules/color| qui permet de fixer cette couleur pour -l'environnement en question. +l'environnement en question. Cette clé fixe localement la couleur des filets +(alors que la commande |\arrayrulecolor| agit globalement). \medskip \begin{scope} @@ -1105,10 +1111,11 @@ doivent être séparés par des virgules). & & & & &1 \end{NiceTabular} + \bigskip -$\triangleright$ Le concept de coins est aussi utilisé par la commande -|\arraycolor| dans le |\CodeBefore| qui accepte en option une clé -|except-corners|: cf.~p.~\pageref{arraycolor}. +$\triangleright$ Les coins sont également pris en compte par les outils de +coloriage dans le |\CodeBefore|. Ces outils ne colorient pas les cases qui sont +dans les coins (cf.~p.~\pageref{color-in-code-before}). \subsection{La commande \textbackslash diagbox} @@ -1252,12 +1259,16 @@ inconvénients. \subsection{Les outils de nicematrix dans le \textbackslash CodeBefore} +\label{color-in-code-before} + 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. +successives.\footnote{Si vous utilisez Overleaf, Overleaf effectue + automatiquement le nombre de + compilations nécessaire.} \medskip L'extension \pkg{nicematrix} fournit une clé |code-before| pour du code qui sera @@ -1291,6 +1302,12 @@ première position) qui est le modèle colorimétrique pour la spécification de couleurs. \medskip +\colorbox{yellow!50}{\textbf{Nouveau 5.15}}\enskip Ces commandes ne colorient +pas les cases qui se trouvent dans les «coins» si la clé |corners| a été +utilisée. La description de cette clé a été faite p.~\pageref{corners}. + + +\medskip \begin{itemize} \item La commande |\cellcolor| tient son nom de la commande |\cellcolor| de \pkg{colortbl}. @@ -1355,6 +1372,44 @@ h & i & j \\ \hline \end{scope} +\bigskip +\item La commande |\arraycolor| prend en argument obligatoire une couleur et +colorie tout le tableau (sauf les éventuelles rangées et colonnes extérieures: +cf.~p.~\pageref{exterior}) avec cette couleur. Ce n'est qu'un cas particulier de +la commande |\rectanglecolor|. + +\bigskip +\item \label{chessboardcolors}% +La commande |\chessboardcolors| prend en arguments obligatoires deux +couleurs et colorie les cases en quinconces avec les deux couleurs. + +\medskip +\begin{scope} +\hfuzz=10cm +\begin{BVerbatim}[baseline=c,boxwidth=9cm] +$\begin{pNiceMatrix}[r,margin] +\CodeBefore + ~emphase#\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] +\CodeBefore + \chessboardcolors{red!15}{blue!15} +\Body +1 & -1 & 1 \\ +-1 & 1 & -1 \\ +1 & -1 & 1 +\end{pNiceMatrix}$ +\end{scope} + +\medskip +On a utilisé la clé |r| qui impose que toutes les colonnes soient alignées à +droite (cf. p.~\pageref{key-R}). + \bigskip \item La commande |\rowcolor| doit son nom à la commande |\rowcolor| de @@ -1451,7 +1506,7 @@ tableau pour englober les blocs (créés par la commande |\Block| : cf.~p.~\page \begin{BVerbatim}[baseline=c,boxwidth=9cm] \begin{NiceTabular}{clr}[hvlines] \CodeBefore - ~emphase#\rowcolors{2}{blue!10}{}[cols=2-3,restart]@ + ~emphase#\rowcolors[gray]{2}{0.8}{}[cols=2-3,restart]@ \Body \Block{1-*}{Résultats} \\ \Block{2-1}{A}& Pierre & 12 \\ @@ -1464,7 +1519,7 @@ tableau pour englober les blocs (créés par la commande |\Block| : cf.~p.~\page \end{BVerbatim} \begin{NiceTabular}{clr}[hvlines,baseline=2] \CodeBefore - \rowcolors{2}{blue!10}{}[cols=2-3,restart] + \rowcolors[gray]{2}{0.8}{}[cols=2-3,restart] \Body \Block{1-*}{Résultats} \\ \Block{2-1}{A}& Pierre & 12 \\ @@ -1519,77 +1574,50 @@ Henri & 14 \\ \bigskip -\item \label{chessboardcolors}% -La commande |\chessboardcolors| prend en arguments obligatoires deux -couleurs et colorie les cases en quinconces avec les deux couleurs. +On rappelle que toutes les commandes de coloriage que l'on vient de décrire ne +colorient pas les cases qui sont dans les «coins». Dans l'exemple suivant, on +utilise la clé |corners| pour demander de considérer le coin \emph{north east} (NE). \medskip \begin{scope} -\hfuzz=10cm -\begin{BVerbatim}[baseline=c,boxwidth=9cm] -$\begin{pNiceMatrix}[r,margin] -\CodeBefore - ~emphase#\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] -\CodeBefore - \chessboardcolors{red!15}{blue!15} -\Body -1 & -1 & 1 \\ --1 & 1 & -1 \\ -1 & -1 & 1 -\end{pNiceMatrix}$ -\end{scope} - -\medskip -On a utilisé la clé |r| qui impose que toutes les colonnes soient alignées à -droite (cf. p.~\pageref{key-R}). - -\item La commande |\arraycolor| prend en argument obligatoire une couleur et -colorie tout le tableau (sauf les éventuelles rangées et colonnes extérieures: -cf.~p.~\pageref{exterior}) avec cette couleur. Elle est surtout intéressante du -fait de la clé |except-corners| qu'elle accepte entre crochets en troisième -argument (optionnel). La définition des coins a été donnée p.~\pageref{corners} -quand on a présenté la clé~|corners|. - -\label{arraycolor} - -\medskip -\begin{BVerbatim}[boxwidth=10cm,baseline=c] -\begin{NiceTabular}{*{6}{c}}[cell-space-top-limit=3pt] +\hfuzz=11cm +\begin{BVerbatim}[boxwidth=9cm,baseline=c] +\begin{NiceTabular}{cccccc}[~emphase#corners=NE@,margin,hvlines,first-row,first-col] \CodeBefore - ~emphase#\arraycolor{blue!10}[except-corners=NE]@ + ~emphase#\rowcolors{1}{blue!15}{}@ \Body -1\\ -1&1\\ -1&2&1\\ -1&3&3&1\\ -1&4&6&4&1\\ -1&5&10&10&5&1 + & 0 & 1 & 2 & 3 & 4 & 5 & 6 \\ +0 & 1 \\ +1 & 1 & 1 \\ +2 & 1 & 2 & 1 \\ +3 & 1 & 3 & 3 & 1 \\ +4 & 1 & 4 & 6 & 4 & 1 \\ +5 & 1 & 5 & 10 & 10 & 5 & 1 \\ +6 & 1 & 6 & 15 & 20 & 15 & 6 & 1 \\ \end{NiceTabular} \end{BVerbatim} -\begin{NiceTabular}{*{6}{c}}[cell-space-top-limit=3pt] +\begin{NiceTabular}{ccccccc}[corners=NE,margin,hvlines,first-row,first-col] \CodeBefore - \arraycolor{blue!10}[except-corners=NE] + \rowcolors{1}{blue!15}{} \Body -1\\ -1&1\\ -1&2&1\\ -1&3&3&1\\ -1&4&6&4&1\\ -1&5&10&10&5&1 + & 0 & 1 & 2 & 3 & 4 & 5 & 6 \\ +0 & 1 \\ +1 & 1 & 1 \\ +2 & 1 & 2 & 1 \\ +3 & 1 & 3 & 3 & 1 \\ +4 & 1 & 4 & 6 & 4 & 1 \\ +5 & 1 & 5 & 10 & 10 & 5 & 1 \\ +6 & 1 & 6 & 15 & 20 & 15 & 6 & 1 \\ \end{NiceTabular} +\end{scope} + \end{itemize} + \bigskip On remarquera que ces commandes sont compatibles avec les commandes de \pkg{booktabs} (|\toprule|, |\midrule|, |\bottomrule|, etc). Néanmoins, -l'extension \pkg{booktabs} n'est pas chargée par \pkg{nicematrix}. +l'extension \pkg{booktabs} n'est \emph{pas} chargée par \pkg{nicematrix}. \medskip \begin{scope} @@ -2346,7 +2374,7 @@ mathématique avec |\scriptstyle|. \begin{BVerbatim}[baseline=c,boxwidth=10cm] $\begin{bNiceMatrix} 1 & \hspace*{1cm} & 0 \\[8mm] - & ~emphase#\Ddots^{n \text{ fois}}@ & \\ + & ~emphase#\Ddots^{n \text{ fois}}@ & \\ 0 & & 1 \end{bNiceMatrix}$ \end{BVerbatim} @@ -2724,6 +2752,35 @@ Il existe aussi une clé |name| qui permet de donner un nom à une sous-matrice créée par une commande |\SubMatrix|. Ce nom est utilisé pour créer des nœuds PGF/Tikz : voir p.~\pageref{node-sub-matrix}. +\bigskip +\colorbox{yellow!50}{\textbf{Nouveau 5.15}}\enskip +Il est également possible de spécifier des délimiteurs\footnote{Les délimiteurs + en question sont \verb|(|, \verb|[| et \verb|\{| et les fermants correspondants. + On peut bien sûr aussi mettre des \verb+|+ et des \verb+||+ dans le + préambule.} en les plaçant dans le préambule de l'environnement (pour les +environnements à préambule : |{NiceArray}|, |{pNiceArray}|, etc.). Cette syntaxe +est inspirée de l'extension \pkg{blkarray}. + +Dans le cas de deux délimiteurs successifs (nécessairement un fermant suivi d'un +ouvrant pour une autre sous-matrice) un espace égal à |\enskip| est inséré +automatiquement. + +\medskip +\begin{BVerbatim} +$\begin{pNiceArray}{~emphase#(c)(c)(c)@} +a_{11} & a_{12} & a_{13} \\ +a_{21} & \displaystyle \int_0^1\dfrac{1}{x^2+1}\,dx & a_{23} \\ +a_{31} & a_{32} & a_{33} +\end{pNiceArray}$ +\end{BVerbatim} + +\[\begin{pNiceArray}{(c)(c)(c)} +a_{11} & a_{12} & a_{13} \\ +a_{21} & \displaystyle \int_0^1\dfrac{1}{x^2+1}\,dx & a_{23} \\ +a_{31} & a_{32} & a_{33} +\end{pNiceArray}\] + + \section{Les notes dans les tableaux} @@ -4480,7 +4537,7 @@ $\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}$ +\end{pNiceArray}$\par\nobreak \smallskip \quad $\begin{pNiceArray}{rrrr|r} @@ -4918,9 +4975,10 @@ source commenté et un historique des versions. Les versions successives du fichier |nicematrix.sty| fournies par TeXLive sont disponibles sur le serveur \textsc{svn} de TeXLive : +\smallskip { \small -\url{https:www.tug.org/svn/texlive/trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty} +\nolinkurl{www.tug.org/svn/texlive/trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty} } \end{document} diff --git a/macros/latex/contrib/nicematrix/nicematrix.dtx b/macros/latex/contrib/nicematrix/nicematrix.dtx index fb4ebed732..1b475cebad 100644 --- a/macros/latex/contrib/nicematrix/nicematrix.dtx +++ b/macros/latex/contrib/nicematrix/nicematrix.dtx @@ -15,8 +15,8 @@ % % \fi % \iffalse -\def\myfileversion{5.14} -\def\myfiledate{2021/04/08} +\def\myfileversion{5.15} +\def\myfiledate{2021/04/25} % % %<*batchfile> @@ -159,7 +159,7 @@ version 2005/12/01 or later. % The package \pkg{nicematrix} is entirely contained in the file % |nicematrix.sty|. This file may be put in the current directory or in a % |texmf| tree. However, the best is to install \pkg{nicematrix} with a TeX -% distribution as MiKTeX or TeXlive. +% distribution as MiKTeX, TeXlive or MacTeX. % % \bigskip % \emph{Remark}: If you use LaTeX via Internet with, for example, Overleaf, you @@ -457,7 +457,7 @@ version 2005/12/01 or later. % % In the environments of \pkg{nicematrix}, it's possible to use the command % |\Block| in order to place an element in the center of a rectangle of merged -% cells of the array. +% cells of the array.\footnote{The spaces after a command \verb|\Block| are deleted.} % % The command |\Block| must be used in the upper leftmost cell of the array with % two arguments. @@ -575,6 +575,8 @@ version 2005/12/01 or later. % \item the key |borders| provides the ability to draw only some borders of the % blocks; the value of that key is a (comma-separated) list of elements covered % by |left|, |right|, |top| and |bottom|; +% \item \colorbox{yellow!50}{\bfseries New 5.15}\enskip the keys |hvlines| draws +% all the vertical and horizontal rules in the block; % \item \colorbox{yellow!50}{\bfseries New 5.14}\enskip the keys |t| and |b| fix % the base line that will be given to the block when it has a multi-line content % (the lines are separated by |\\|). @@ -594,7 +596,8 @@ version 2005/12/01 or later. % \begin{NiceTabular}{cwc{2cm}wc{3cm}c} % rose & tulipe & marguerite & dahlia \\ % violette -% & ~emphase#\Block[draw=red,fill=red!15,rounded-corners]{2-2}{\LARGE De très jolies fleurs}@ +% & ~emphase#\Block[draw=red,fill=[RGB]{204,204,255},rounded-corners]{2-2}@ +% ~emphase#{\LARGE De très jolies fleurs}@ % & & souci \\ % pervenche & & & lys \\ % arum & iris & jacinthe & muguet @@ -605,7 +608,7 @@ version 2005/12/01 or later. % \begin{center} % \begin{NiceTabular}{cwc{2cm}wc{3cm}c} % rose & tulipe & marguerite & dahlia \\ -% violette & \Block[draw=red,fill=red!15,rounded-corners]{2-2} +% violette & \Block[draw=red,fill=[RGB]{204,204,255},rounded-corners]{2-2} % {\LARGE De très jolies fleurs} & & souci \\ % pervenche & & & lys \\ % arum & iris & jacinthe & muguet @@ -907,7 +910,8 @@ version 2005/12/01 or later. % when \pkg{colortbl} is not loaded. For sake of compatibility, the command is % also named |\arrayrulecolor|. The environments of \pkg{nicematrix} also % provide a key |rules/color| to fix the color of the rules in the current -% environment. +% environment. This key sets the value locally (whereas |\arrayrulecolor| acts +% globally). % % \medskip % \begin{scope} @@ -1120,10 +1124,11 @@ version 2005/12/01 or later. % & & & & &1 % \end{NiceTabular} % -% \bigskip -% $\triangleright$ The concept of corner is also used by the command -% |\arraycolor| in the |\CodeBefore| which takes in as option a key -% |except-corners|: cf.~p.~\pageref{arraycolor}. +% +% \medskip +% $\triangleright$ The corners are also taken into account by the tools provided +% by \pkg{nicematrix} to color cells, rows and columns. These tools don't color +% the cells which are in the corners (cf.~p.~\pageref{color-in-code-before}). % % \subsection{The command \textbackslash diagbox} % @@ -1258,11 +1263,15 @@ version 2005/12/01 or later. % % \subsection{The tools of nicematrix in the \textbackslash CodeBefore} % +% \label{color-in-code-before} +% % The package \pkg{nicematrix} provides some tools (independent of -% \pkg{colortbl}) to draw the colored panels first, and, then, the content -% of the cells and the rules. This strategy is more conform to the ``painting +% \pkg{colortbl}) to draw the colored panels first, and, then, the content of +% the cells and the rules. This strategy is more conform to the ``painting % model'' of the formats PostScript and \textsc{pdf} and is more suitable for -% the \textsc{pdf} viewers. However, it requires several compilations. +% the \textsc{pdf} viewers. However, it requires several +% compilations.\footnote{If you use Overleaf, Overleaf will do automatically the +% right number of compilations.} % % \medskip % The extension \pkg{nicematrix} provides a key |code-before| for some code that @@ -1292,7 +1301,13 @@ version 2005/12/01 or later. % % \medskip % All these commands accept an optional argument (between square brackets and -% in first position) which is the color model for the specification of the colors. +% in first position) which is the color model for the specification of the +% colors. +% +% \medskip +% \colorbox{yellow!50}{\textbf{New 5.15}}\enskip These commands don't color the +% cells which are in the ``corners'' if the key |corners| is used. This key has +% been described p.~\pageref{corners}. % % \medskip % \begin{itemize} @@ -1359,6 +1374,43 @@ version 2005/12/01 or later. % \end{NiceTabular} % \end{scope} % +% \bigskip +% \item The command |\arraycolor| takes in as mandatory argument a color and +% color the whole tabular with that color (excepted the potential exterior rows +% and columns: cf.~p.~\pageref{exterior}). It's only a particular case of +% |\rectanglecolor|. +% +% +% \bigskip +% \item The command |\chessboardcolors| takes in as mandatory arguments two colors +% and it colors the cells of the tabular in quincunx with these colors. +% +% \medskip +% \begin{scope} +% \hfuzz=10cm +% \begin{BVerbatim}[baseline=c,boxwidth=9cm] +% $\begin{pNiceMatrix}[r,margin] +% \CodeBefore +% ~emphase#\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] +% \CodeBefore +% \chessboardcolors{red!15}{blue!15} +% \Body +% 1 & -1 & 1 \\ +% -1 & 1 & -1 \\ +% 1 & -1 & 1 +% \end{pNiceMatrix}$ +% \end{scope} +% +% \medskip +% We have used the key |r| which aligns all the columns rightwards (cf. +% p.~\pageref{key-R}). % % % \bigskip @@ -1425,7 +1477,6 @@ version 2005/12/01 or later. % (an interval of the form $i$|-| describes in fact the interval of all the rows % of the tabular, beginning with the row~$i$). % -% % % \bigskip % The last argument of |\rowcolors| is an optional list of pairs key-value (the @@ -1449,7 +1500,7 @@ version 2005/12/01 or later. % \begin{BVerbatim}[baseline=c,boxwidth=10cm] % \begin{NiceTabular}{clr}[hvlines] % \CodeBefore -% ~emphase#\rowcolors{2}{blue!10}{}[cols=2-3,restart]@ +% ~emphase#\rowcolors[gray]{2}{0.8}{}[cols=2-3,restart]@ % \Body % \Block{1-*}{Results} \\ % John & 12 \\ @@ -1462,7 +1513,7 @@ version 2005/12/01 or later. % \end{BVerbatim} % \begin{NiceTabular}{clr}[hvlines,baseline=2] % \CodeBefore -% \rowcolors{2}{blue!10}{}[cols=2-3,restart] +% \rowcolors[gray]{2}{0.8}{}[cols=2-3,restart] % \Body % \Block{1-*}{Results} \\ % \Block{2-1}{A}& John & 12 \\ @@ -1511,82 +1562,53 @@ version 2005/12/01 or later. % \end{NiceTabular} % \end{scope} % -% -% \bigskip -% \item The command |\chessboardcolors| takes in as mandatory arguments two colors -% and it colors the cells of the tabular in quincunx with these colors. % % \medskip -% \begin{scope} -% \hfuzz=10cm -% \begin{BVerbatim}[baseline=c,boxwidth=9cm] -% $\begin{pNiceMatrix}[r,margin] -% \CodeBefore -% ~emphase#\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] -% \CodeBefore -% \chessboardcolors{red!15}{blue!15} -% \Body -% 1 & -1 & 1 \\ -% -1 & 1 & -1 \\ -% 1 & -1 & 1 -% \end{pNiceMatrix}$ -% \end{scope} -% -% \medskip -% We have used the key |r| which aligns all the columns rightwards (cf. -% p.~\pageref{key-R}). +% We recall that all the color commands we have described don't color the cells +% which are in the ``corners''. In the following example, we use the key +% |corners| to require the determination of the corner \emph{north east} (NE). % % -% \item The command |\arraycolor| takes in as mandatory argument a color and -% color the whole tabular with that color (excepted the potential exterior rows -% and columns: cf.~p.~\pageref{exterior}). This command is useful thanks to its -% key |except-corners| (in the third argument, which is a optional argument -% between square brackets). The definition of these ``corners'' has been given -% p.~\pageref{corners} when we have presented the key |corners|. -% -% \label{arraycolor} -% -% -% \medskip -% \begin{BVerbatim}[boxwidth=10cm,baseline=c] -% \begin{NiceTabular}{*{6}{c}}[cell-space-top-limit=3pt] +%\medskip +% \begin{scope} +% \hfuzz=11cm +% \begin{BVerbatim}[boxwidth=9cm,baseline=c] +% \begin{NiceTabular}{cccccc}[~emphase#corners=NE@,margin,hvlines,first-row,first-col] % \CodeBefore -% ~emphase#\arraycolor{blue!10}[except-corners=NE]@ +% ~emphase#\rowcolors{1}{blue!15}{}@ % \Body -% 1\\ -% 1&1\\ -% 1&2&1\\ -% 1&3&3&1\\ -% 1&4&6&4&1\\ -% 1&5&10&10&5&1 +% & 0 & 1 & 2 & 3 & 4 & 5 & 6 \\ +% 0 & 1 \\ +% 1 & 1 & 1 \\ +% 2 & 1 & 2 & 1 \\ +% 3 & 1 & 3 & 3 & 1 \\ +% 4 & 1 & 4 & 6 & 4 & 1 \\ +% 5 & 1 & 5 & 10 & 10 & 5 & 1 \\ +% 6 & 1 & 6 & 15 & 20 & 15 & 6 & 1 \\ % \end{NiceTabular} % \end{BVerbatim} -% \begin{NiceTabular}{*{6}{c}}[cell-space-top-limit=3pt] +% \begin{NiceTabular}{ccccccc}[corners=NE,margin,hvlines,first-row,first-col] % \CodeBefore -% \arraycolor{blue!10}[except-corners=NE] +% \rowcolors{1}{blue!15}{} % \Body -% 1\\ -% 1&1\\ -% 1&2&1\\ -% 1&3&3&1\\ -% 1&4&6&4&1\\ -% 1&5&10&10&5&1 +% & 0 & 1 & 2 & 3 & 4 & 5 & 6 \\ +% 0 & 1 \\ +% 1 & 1 & 1 \\ +% 2 & 1 & 2 & 1 \\ +% 3 & 1 & 3 & 3 & 1 \\ +% 4 & 1 & 4 & 6 & 4 & 1 \\ +% 5 & 1 & 5 & 10 & 10 & 5 & 1 \\ +% 6 & 1 & 6 & 15 & 20 & 15 & 6 & 1 \\ % \end{NiceTabular} -% \end{itemize} +% \end{scope} % +% \end{itemize} % % % \bigskip -% One should remark that these commands are compatible with the commands of -% \pkg{booktabs} (|\toprule|, |\midrule|, |\bottomrule|, etc). However, -% \pkg{booktabs} is not loaded by \pkg{nicematrix}. +% One should remark that all the previous commands are compatible with the +% commands of \pkg{booktabs} (|\toprule|, |\midrule|, |\bottomrule|, etc). +% However, \pkg{booktabs} is not loaded by \pkg{nicematrix}. % % \medskip % \begin{scope} @@ -2697,6 +2719,35 @@ version 2005/12/01 or later. % |\SubMatrix|. That name is used to create PGF/Tikz nodes: cf % p.~\pageref{node-sub-matrix}. % +% +% \bigskip +% \colorbox{yellow!50}{\textbf{New 5.15}}\enskip +% It's also possible to specify some delimiters\footnote{Those delimiters are +% \verb|(|, \verb|[|, |\{| and the closing ones. Of course, it's also +% possible to put \verb+|+ and \verb+||+ in the preamble of the environement.} +% by placing them in the preamble of the environment (for the environments with +% a preamble: |{NiceArray}|, |{pNiceArray}|, etc.). This syntax is inspired by +% the extension \pkg{blkarray}. +% +% When there are two successive delimiters (necessarily a closing one following by +% an opening one for another submatrix), a space equal to |\enskip| is +% automatically inserted. +% +% \medskip +% \begin{BVerbatim} +% $\begin{pNiceArray}{~emphase#(c)(c)(c)@} +% a_{11} & a_{12} & a_{13} \\ +% a_{21} & \displaystyle \int_0^1\dfrac{1}{x^2+1}\,dx & a_{23} \\ +% a_{31} & a_{32} & a_{33} +% \end{pNiceArray}$ +% \end{BVerbatim} +% +% \[\begin{pNiceArray}{(c)(c)(c)} +% a_{11} & a_{12} & a_{13} \\ +% a_{21} & \displaystyle \int_0^1\dfrac{1}{x^2+1}\,dx & a_{23} \\ +% a_{31} & a_{32} & a_{33} +% \end{pNiceArray}\] +% % \section{The notes in the tabulars} % % \label{s:notes} @@ -3299,8 +3350,7 @@ version 2005/12/01 or later. % % For the environements with delimiters (|{pNiceArray}|, |{pNiceMatrix}|, etc.), % it's possible to change the color of the delimiters with the key -% |delimiters/color|.\footnote{\verb|delimiters-color| is a synonymous -% (deprecated) for |delimiters/color|.} +% |delimiters/color|. % % \medskip % \begin{BVerbatim}[boxwidth=12cm,baseline=c] @@ -4410,7 +4460,7 @@ version 2005/12/01 or later. % 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}$ +% \end{pNiceArray}$\par\nobreak % % \smallskip % \quad $\begin{pNiceArray}{rrrr|r} @@ -4420,8 +4470,8 @@ version 2005/12/01 or later. % \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 +% However, one can see that the last matrix is not perfectly aligned with +% others. That's why, in LaTeX, the parenthesis have not exactly the same width % (smaller parenthesis are a bit slimer). % % \medskip @@ -4480,7 +4530,7 @@ version 2005/12/01 or later. % 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}$ +% \end{pNiceArray}$\par\nobreak % % \smallskip % \quad $\begin{pNiceArray}{rrrr|r} @@ -5469,10 +5519,12 @@ version 2005/12/01 or later. % % \bigskip % If the user uses |{NiceArray}| or |{NiceTabular}| the flag -% |\l_@@_NiceArray_bool| will be raised. +% |\g_@@_NiceArray_bool| will be raised. % \begin{macrocode} -\bool_new:N \l_@@_NiceArray_bool +\bool_new:N \g_@@_NiceArray_bool % \end{macrocode} +% In fact, if there is delimiters in the preamble of |{NiceArray}| (eg: +% |[cccc]|), this boolean will be set to false. % % \bigskip % If the user uses |{NiceTabular}| or |{NiceTabular*}|, we will raise the @@ -5731,7 +5783,14 @@ version 2005/12/01 or later. \seq_new:N \g_@@_pos_of_stroken_blocks_seq % \end{macrocode} % -% +% \medskip +% If the user has used the key |corners| (or the key |hvlines-except-corners|), +% all the cells which are in an (empty) corner will be stored in the following +% sequence. +% \begin{macrocode} +\seq_new:N \l_@@_corners_cells_seq +% \end{macrocode} +% % \medskip % The list of the names of the potential |\SubMatrix| in the |\CodeAfter| of an % environment. Unfortunately, that list has to be global (we have to use it @@ -5779,6 +5838,9 @@ version 2005/12/01 or later. \clist_new:N \l_@@_borders_clist \dim_new:N \l_@@_rounded_corners_dim % \end{macrocode} +% The last parameter has no direct link with the [empty] corners of the array +% (which are computed and taken into account by \pkg{nicematrix} when the key +% |corners| is used). % % \medskip % The following token list correspond to the key |color| of the command @@ -5816,6 +5878,14 @@ version 2005/12/01 or later. \bool_new:N \l_@@_draw_first_bool % \end{macrocode} % +% +% \medskip +% The following flag corresponds to the key |hvlines| of the command |\Block|. +% \begin{macrocode} +\bool_new:N \l_@@_hvlines_block_bool +% \end{macrocode} +% +% % \medskip % The blocks which use the key |-| will store their content in a box. These % boxes are numbered with the following counter. @@ -6051,7 +6121,7 @@ version 2005/12/01 or later. % \begin{macrocode} \NewDocumentCommand \tabularnote { m } { - \bool_if:nTF { ! \l_@@_NiceArray_bool && \l_@@_in_env_bool } + \bool_if:nTF { ! \g_@@_NiceArray_bool && \l_@@_in_env_bool } { \@@_error:n { tabularnote~forbidden } } { % \end{macrocode} @@ -6295,13 +6365,14 @@ version 2005/12/01 or later. \bool_set_true:N \l_@@_parallelize_diags_bool % \end{macrocode} % -% % \bigskip -% The following parameter correspond to the key |corners|. +% The following parameter correspond to the key |corners|. The elements of that +% |clist| must be in |NW|, |SW|, |NE| and |SE|. % \begin{macrocode} \clist_new:N \l_@@_corners_clist % \end{macrocode} % +% \bigskip % \begin{macrocode} \dim_new:N \l_@@_notes_above_space_dim \AtBeginDocument { \dim_set:Nn \l_@@_notes_above_space_dim { 1 mm } } @@ -6713,7 +6784,9 @@ version 2005/12/01 or later. 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 , + delimiters-color .code:n = + \tl_set:Nn \l_@@_delimiters_color_tl { #1 } + \@@_error:n { delimiters-color deleted } , delimiters-color .value_required:n = true , last-col .code:n = \tl_if_empty:nF { #1 } { \@@_error:n { last-col~non~empty~for~NiceMatrixOptions } } @@ -6829,7 +6902,9 @@ version 2005/12/01 or later. small .value_forbidden:n = true , delimiters / color .tl_set:N = \l_@@_delimiters_color_tl , delimiters / color .value_required:n = true , - delimiters-color .tl_set:N = \l_@@_delimiters_color_tl , + delimiters-color .code:n = + \tl_set:Nn \l_@@_delimiters_color_tl { #1 } + \@@_error:n { delimiters-color deleted } , delimiters-color .value_required:n = true , unknown .code:n = \@@_error:n { Unknown~option~for~NiceMatrix } } @@ -6861,8 +6936,9 @@ version 2005/12/01 or later. notes / bottomrule .default:n = true , tabularnote .tl_set:N = \l_@@_tabularnote_tl , tabularnote .value_required:n = true , - delimiters-color .tl_set:N = \l_@@_delimiters_color_tl , - delimiters-color .value_required:n = true , + delimiters-color .code:n = + \tl_set:Nn \l_@@_delimiters_color_tl { #1 } + \@@_error:n { delimiters-color deleted } , 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 } , @@ -7615,6 +7691,21 @@ version 2005/12/01 or later. \seq_gclear:N \g_@@_submatrix_seq \bool_if:NT \l_@@_code_before_bool { +% \end{macrocode} +% The list of the cells which are in the (empty) corners is stored in the |aux| +% file because we have to know it before the execution of the |\CodeBefore| (the +% commands which color the cells, row and columns won't color the cells which +% are in the corners). +% \begin{macrocode} + \seq_if_exist:cT + { c_@@_corners_cells_ \int_use:N \g_@@_env_int _ seq } + { + \seq_set_eq:Nc \l_@@_corners_cells_seq + { c_@@_corners_cells_ \int_use:N \g_@@_env_int _ seq } + } +% \end{macrocode} +% Now, we have to reconstruct the |row| nodes and the |col| nodes. +% \begin{macrocode} \seq_if_exist:cT { @@_size_ \int_use:N \g_@@_env_int _ seq } { % \end{macrocode} @@ -7795,26 +7886,6 @@ version 2005/12/01 or later. \@@_pre_array_ii: % \end{macrocode} % -% \medskip -% We compute the width of both delimiters. -% \begin{macrocode} - \dim_zero_new:N \l_@@_left_delim_dim - \dim_zero_new:N \l_@@_right_delim_dim - \bool_if:NTF \l_@@_NiceArray_bool - { - \dim_gset:Nn \l_@@_left_delim_dim { 2 \arraycolsep } - \dim_gset:Nn \l_@@_right_delim_dim { 2 \arraycolsep } - } - { -% \end{macrocode} -% The command |\bBigg@| is a command of \pkg{amsmath}. -% \begin{macrocode} - \hbox_set:Nn \l_tmpa_box { $ \bBigg@ 5 \l_@@_left_delim_tl $ } - \dim_set:Nn \l_@@_left_delim_dim { \box_wd:N \l_tmpa_box } - \hbox_set:Nn \l_tmpa_box { $ \bBigg@ 5 \l_@@_right_delim_tl $ } - \dim_set:Nn \l_@@_right_delim_dim { \box_wd:N \l_tmpa_box } - } -% \end{macrocode} % % \medskip % The array will be composed in a box (named |\l_@@_the_array_box|) because we @@ -7840,6 +7911,29 @@ version 2005/12/01 or later. % % Now, the preamble is constructed in |\g_@@_preamble_tl| % +% \medskip +% We compute the width of both delimiters. We remember that, when the +% environment |{NiceArray}| is used, it's possible to specify the delimiters in +% the preamble (eg |[ccc]|). +% \begin{macrocode} + \dim_zero_new:N \l_@@_left_delim_dim + \dim_zero_new:N \l_@@_right_delim_dim + \bool_if:NTF \g_@@_NiceArray_bool + { + \dim_gset:Nn \l_@@_left_delim_dim { 2 \arraycolsep } + \dim_gset:Nn \l_@@_right_delim_dim { 2 \arraycolsep } + } + { +% \end{macrocode} +% The command |\bBigg@| is a command of \pkg{amsmath}. +% \begin{macrocode} + \hbox_set:Nn \l_tmpa_box { $ \bBigg@ 5 \g_@@_left_delim_tl $ } + \dim_set:Nn \l_@@_left_delim_dim { \box_wd:N \l_tmpa_box } + \hbox_set:Nn \l_tmpa_box { $ \bBigg@ 5 \g_@@_right_delim_tl $ } + \dim_set:Nn \l_@@_right_delim_dim { \box_wd:N \l_tmpa_box } + } +% \end{macrocode} +% % % % \bigskip @@ -7898,8 +7992,8 @@ version 2005/12/01 or later. % % \bigskip % \begin{macrocode} - \tl_set:Nn \l_@@_left_delim_tl { #1 } - \tl_set:Nn \l_@@_right_delim_tl { #2 } + \tl_gset:Nn \g_@@_left_delim_tl { #1 } + \tl_gset:Nn \g_@@_right_delim_tl { #2 } \tl_gset:Nn \g_@@_preamble_tl { #4 } % \end{macrocode} % @@ -7982,7 +8076,7 @@ version 2005/12/01 or later. % 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 + \bool_if:NTF \g_@@_NiceArray_bool { \keys_set:nn { NiceMatrix / NiceArray } } { \keys_set:nn { NiceMatrix / pNiceArray } } { #3 , #5 } @@ -8073,14 +8167,14 @@ version 2005/12/01 or later. } % \end{macrocode} % -% The construction of the real box is different when |\l_@@_NiceArray_bool| is +% The construction of the real box is different when |\g_@@_NiceArray_bool| is % true (|{NiceArray}| or |{NiceTabular}|) and in the other environments because, % in |{NiceArray}| or |{NiceTabular}|, we have no delimiter to put (but we have % tabular notes to put). We begin with this case. % % Remark that, in all cases, |@@_use_arraybox_with_notes_c:| is used. % \begin{macrocode} - \bool_if:NTF \l_@@_NiceArray_bool + \bool_if:NTF \g_@@_NiceArray_bool { \str_case:VnF \l_@@_baseline_tl { @@ -8125,7 +8219,7 @@ version 2005/12/01 or later. \c_math_toggle_token \tl_if_empty:NF \l_@@_delimiters_color_tl { \color { \l_@@_delimiters_color_tl } } - \exp_after:wN \left \l_@@_left_delim_tl + \exp_after:wN \left \g_@@_left_delim_tl \vcenter { % \end{macrocode} @@ -8156,7 +8250,7 @@ version 2005/12/01 or later. % \begin{macrocode} \tl_if_empty:NF \l_@@_delimiters_color_tl { \color { \l_@@_delimiters_color_tl } } - \exp_after:wN \right \l_@@_right_delim_tl + \exp_after:wN \right \g_@@_right_delim_tl \c_math_toggle_token } % \end{macrocode} @@ -8167,7 +8261,10 @@ version 2005/12/01 or later. % when the option |delimiters/max-width| is used. % \begin{macrocode} \bool_if:NTF \l_@@_delimiters_max_width_bool - { \@@_put_box_in_flow_bis:nn { #1 } { #2 } } + { + \@@_put_box_in_flow_bis:nn + \g_@@_left_delim_tl \g_@@_right_delim_tl + } \@@_put_box_in_flow: } % \end{macrocode} @@ -8208,7 +8305,7 @@ version 2005/12/01 or later. % The transformation of the preamble is an operation in several steps. % % \bigskip -% The preamble given by the final use is in |\g_@@_preamble_tl| and the modified +% The preamble given by the final user is in |\g_@@_preamble_tl| and the modified % version will be stored in |\g_@@_preamble_tl| also. % % \begin{macrocode} @@ -8297,10 +8394,18 @@ version 2005/12/01 or later. % \begin{macrocode} \int_zero:N \l_tmpa_int % \end{macrocode} +% We will raise |\l_tmpa_bool| if we are in |{NiceArray}| and that the first +% letter of the preamble is a opening delimiter (|[|, |(| of |\{|). In that +% case, the environment |{NiceArray}| will be transformed to an environment of +% the form |{xNiceArray}| after the construction of the preamble. +% \begin{macrocode} + \bool_set_false:N \l_tmpa_bool +% \end{macrocode} % Now, we actually patch the preamble (and it is constructed in % |\g_@@_preamble_tl|). % \begin{macrocode} \exp_after:wN \@@_patch_preamble:n \the \@temptokena \q_stop + \bool_if:NT \l_tmpa_bool { \bool_gset_false:N \g_@@_NiceArray_bool } \int_gset_eq:NN \g_@@_static_num_of_col_int \c@jCol } % \end{macrocode} @@ -8325,7 +8430,7 @@ version 2005/12/01 or later. { \bool_lazy_all:nT { - \l_@@_NiceArray_bool + \g_@@_NiceArray_bool { \bool_not_p:n \l_@@_NiceTabular_bool } { \tl_if_empty_p:N \l_@@_vlines_clist } { \bool_not_p:n \l_@@_exterior_arraycolsep_bool } @@ -8337,7 +8442,7 @@ version 2005/12/01 or later. { \bool_lazy_all:nT { - \l_@@_NiceArray_bool + \g_@@_NiceArray_bool { \bool_not_p:n \l_@@_NiceTabular_bool } { \tl_if_empty_p:N \l_@@_vlines_clist } { \bool_not_p:n \l_@@_exterior_arraycolsep_bool } @@ -8386,9 +8491,9 @@ version 2005/12/01 or later. ( { \@@_patch_preamble_vii:n #1 } [ { \@@_patch_preamble_vii:n #1 } \{ { \@@_patch_preamble_vii:n #1 } - ) { \@@_patch_preamble_viii:n #1 } - ] { \@@_patch_preamble_viii:n #1 } - \} { \@@_patch_preamble_viii:n #1 } + ) { \@@_patch_preamble_viii:nn #1 } + ] { \@@_patch_preamble_viii:nn #1 } + \} { \@@_patch_preamble_viii:nn #1 } C { \@@_error:nn { old~column~type } #1 } L { \@@_error:nn { old~column~type } #1 } R { \@@_error:nn { old~column~type } #1 } @@ -8503,14 +8608,14 @@ version 2005/12/01 or later. { > { \@@_Cell: - \begin { minipage } [ #1 ] { #3 } + \begin { minipage } [ #1 ] { \dim_eval:n { #3 } } \mode_leave_vertical: \arraybackslash - \vrule height \box_ht:N \@arstrutbox depth 0 pt width 0 pt % v. 5.11 + \vrule height \box_ht:N \@arstrutbox depth 0 pt width 0 pt } c < { - \vrule height 0 pt depth \box_dp:N \@arstrutbox width 0 pt % v. 5.11 + \vrule height 0 pt depth \box_dp:N \@arstrutbox width 0 pt \end { minipage } \@@_end_Cell: } @@ -8568,54 +8673,104 @@ version 2005/12/01 or later. } % \end{macrocode} % +% % \medskip % For |(|, |[| and |\{|. % \begin{macrocode} \cs_new_protected:Npn \@@_patch_preamble_vii:n #1 { - \bool_if:NT \l_@@_small_bool - { \@@_fatal:n { Delimiter~with~small } } + \bool_if:NT \l_@@_small_bool + { \@@_fatal:n { Delimiter~with~small } } % \end{macrocode} -% If we are before the column 1, we reserve space for the left delimiter. +% If we are before the column 1 and not in |{NiceArray}|, we reserve space for +% the left delimiter. % \begin{macrocode} - \int_compare:nNnT \c@jCol = \c_zero_int - { \tl_gput_right:Nx \g_@@_preamble_tl { ! { \enskip } } } - \tl_gput_right:Nx \g_@@_internal_code_after_tl - { \@@_delimiter:nnn #1 { \@@_succ:n \c@jCol } \c_true_bool } - \@@_patch_preamble:n - } + \int_compare:nNnTF \c@jCol = \c_zero_int + { + \bool_if:NTF \g_@@_NiceArray_bool + { % \end{macrocode} -% -% \bigskip -% For |)|, |]| and |\}|. +% In that case, in fact, the firt letter of the preamble must be considered as +% the left delimiter of the array. % \begin{macrocode} -\cs_new_protected:Npn \@@_patch_preamble_viii:n #1 - { - \bool_if:NT \l_@@_small_bool - { \@@_fatal:n { Delimiter~with~small } } - \tl_gput_right:Nx \g_@@_internal_code_after_tl - { \@@_delimiter:nnn #1 { \int_use:N \c@jCol } \c_false_bool } + \tl_gset:Nn \g_@@_left_delim_tl { #1 } + \tl_gset:Nn \g_@@_right_delim_tl { . } % \end{macrocode} -% After this closing delimiter, we have to test whether there is a opening -% delimiter (we consider that there can't be a second closing delimiter) in -% order to add an horizontal space (equal to 0.5 em). +% We raise the boolean |\l_tmpa_bool|, which means that the environment +% |{NiceArray}| will be transformed to |{xNiceArray}|. % \begin{macrocode} - \@@_patch_preamble_viii_i:n + \bool_set_true:N \l_tmpa_bool + \@@_patch_preamble:n + } + { + \tl_gput_right:Nn \g_@@_preamble_tl { ! { \enskip } } + \tl_gput_right:Nx \g_@@_internal_code_after_tl + { \@@_delimiter:nnn #1 { \@@_succ:n \c@jCol } \c_true_bool } + \@@_patch_preamble_vii_i:n + } + } + { + \tl_gput_right:Nx \g_@@_internal_code_after_tl + { \@@_delimiter:nnn #1 { \@@_succ:n \c@jCol } \c_true_bool } + \@@_patch_preamble_vii_i:n + } } % \end{macrocode} % +% \bigskip % \begin{macrocode} -\cs_new_protected:Npn \@@_patch_preamble_viii_i:n #1 +\cs_new_protected:Npn \@@_patch_preamble_vii_i:n #1 { - \bool_lazy_any:nT + \tl_if_in:nnTF { ( [ \{ ) ] \} } { #1 } { - { \str_if_eq_p:nn { #1 } ( } - { \str_if_eq_p:nn { #1 } [ } - { \str_if_eq_p:nn { #1 } \{ } - { \str_if_eq_p:nn { #1 } \q_stop } + \@@_error:nn { delimiter~after~opening } { #1 } + \@@_patch_preamble:n + } + { \@@_patch_preamble:n #1 } + } +% \end{macrocode} +% +% \bigskip +% For |)|, |]| and |\}|. We have two arguments for the following command because +% we directly read the following letter in the preamble (we have to see whether +% we have a opening delimiter following and we also have to see whether we are +% at the end of the preamble because, in that case, our letter must be +% considered as the right delimiter of the environment). +% \begin{macrocode} +\cs_new_protected:Npn \@@_patch_preamble_viii:nn #1 #2 + { + \bool_if:NT \l_@@_small_bool + { \@@_fatal:n { Delimiter~with~small } } + \tl_if_in:nnTF { ) ] \} } { #2 } + { + \tl_gput_right:Nx \g_@@_internal_code_after_tl + { \@@_delimiter:nnn #1 { \int_use:N \c@jCol } \c_false_bool } + \@@_error:nn { double~closing~delimiter } { #2 } + \@@_patch_preamble:n + } + { + \tl_if_eq:nnTF { \q_stop } { #2 } + { + \bool_if:NTF \g_@@_NiceArray_bool + { + \tl_gset:Nn \g_@@_right_delim_tl { #1 } + \bool_set_true:N \l_tmpa_bool + } + { + \tl_gput_right:Nn \g_@@_preamble_tl { ! { \enskip } } + \tl_gput_right:Nx \g_@@_internal_code_after_tl + { \@@_delimiter:nnn #1 { \int_use:N \c@jCol } \c_false_bool } + \@@_patch_preamble:n #2 + } + } + { + \tl_if_in:nnT { ( [ \{ } { #2 } + { \tl_gput_right:Nn \g_@@_preamble_tl { ! { \enskip } } } + \tl_gput_right:Nx \g_@@_internal_code_after_tl + { \@@_delimiter:nnn #1 { \int_use:N \c@jCol } \c_false_bool } + \@@_patch_preamble:n #2 + } } - { \tl_gput_right:Nn \g_@@_preamble_tl { ! { \enskip } } } - \@@_patch_preamble:n #1 } % \end{macrocode} % @@ -9447,19 +9602,19 @@ version 2005/12/01 or later. % % \interitem % The environment |{NiceArray}| is constructed upon the environment -% |{NiceArrayWithDelims}| but, in fact, there is a flag |\l_@@_NiceArray_bool|. +% |{NiceArrayWithDelims}| but, in fact, there is a flag |\g_@@_NiceArray_bool|. % In |{NiceArrayWithDelims}|, some special code will be executed if this flag is % raised. % \begin{macrocode} \NewDocumentEnvironment { NiceArray } { } { - \bool_set_true:N \l_@@_NiceArray_bool + \bool_gset_true:N \g_@@_NiceArray_bool \str_if_empty:NT \g_@@_name_env_str { \str_gset:Nn \g_@@_name_env_str { NiceArray } } % \end{macrocode} % We put . and . for the delimiters but, in fact, that doesn't matter because % these arguments won't be used in |{NiceArrayWithDelims}| (because the flag -% |\l_@@_NiceArray_bool| is raised). +% |\g_@@_NiceArray_bool| is raised). % \begin{macrocode} \NiceArrayWithDelims . . } @@ -9676,14 +9831,13 @@ version 2005/12/01 or later. } % \end{macrocode} % We write also the potential content of |\g_@@_pos_of_blocks_seq| (it will be -% useful if the commands |\rowcolors| is used with the key |respect-blocks|. +% useful if the command |\rowcolors| is used with the key |respect-blocks|). % \begin{macrocode} \seq_gset_from_clist:cn { c_@@_pos_of_blocks_ \int_use:N \g_@@_env_int _ seq } { \seq_use:Nnnn \g_@@_pos_of_blocks_seq , , , } - } - \iow_now:Nn \@mainaux \ExplSyntaxOff - } + } + } % \end{macrocode} % % \medskip @@ -9755,16 +9909,16 @@ version 2005/12/01 or later. % % \bigskip % The following computes the ``corners'' (made up of empty cells) but if there -% is no corner to compute, it will do nothing. The corners are computed -% in |\l_@@_empty_corner_cells_seq| which will contain all the empty cells (and -% not in a block) considered in the corners of the array. +% is no corner to compute, it won't do anything. The corners are computed +% in |\l_@@_corners_cells_seq| which will contain all the cells which are empty +% (and not in a block) considered in the corners of the array. % \begin{macrocode} \@@_compute_corners: % \end{macrocode} % % \bigskip % The sequence |\g_@@_pos_of_blocks_seq| must be ``adjusted'' (for the case -% where the user have written something like |\Block{1-}|). +% where the user have written something like |\Block{1-*}|). % \begin{macrocode} \@@_adjust_pos_of_blocks_seq: % \end{macrocode} @@ -9781,7 +9935,7 @@ version 2005/12/01 or later. { { \seq_if_empty_p:N \g_@@_pos_of_blocks_seq } { \seq_if_empty_p:N \g_@@_pos_of_xdots_seq } - { \seq_if_empty_p:N \l_@@_empty_corner_cells_seq } + { \seq_if_empty_p:N \l_@@_corners_cells_seq } } { \cs_set_eq:NN \@@_vline_i:nn \@@_vline_i_complete:nn @@ -9868,6 +10022,7 @@ version 2005/12/01 or later. % % \medskip % \begin{macrocode} + \bool_gset_false:N \g_@@_NiceArray_bool \str_gclear:N \g_@@_name_env_str \@@_restore_iRow_jCol: % \end{macrocode} @@ -11478,7 +11633,7 @@ version 2005/12/01 or later. % \end{macrocode} % For the column, it's a bit more complicated. % \begin{macrocode} - \int_compare:nNnTF #2 = 1 + \int_compare:nNnTF { #2 } = 1 { \int_set:Nn \l_@@_initial_j_int 1 \bool_set_true:N \l_@@_initial_open_bool @@ -11909,7 +12064,7 @@ version 2005/12/01 or later. { \@@_add_to_colors_seq:xn { \tl_if_blank:nF { #1 } { [ #1 ] } { #2 } } - { \@@_rectanglecolor:nnn { #3 } { #4 } { 0 pt }} + { \@@_rectanglecolor:nnn { #3 } { #4 } { 0 pt } } } } % \end{macrocode} @@ -11980,10 +12135,7 @@ version 2005/12/01 or later. % \bigskip % \begin{macrocode} \keys_define:nn { NiceMatrix / arraycolor } - { - except-corners .clist_set:N = \l_tmpa_clist , - except-corners .default:n = { NW , SW , NE , SE } - } + { except-corners .code:n = \@@_error:n { key except-corners } } % \end{macrocode} % % \bigskip @@ -11996,69 +12148,13 @@ version 2005/12/01 or later. \NewDocumentCommand \@@_arraycolor { O { } m O { } } { \keys_set:nn { NiceMatrix / arraycolor } { #3 } -% \end{macrocode} -% If the key |except-corners| is not used, it's easy: we only have a rectangle -% fo fill. -% \begin{macrocode} - \clist_if_empty:NTF \l_tmpa_clist - { - \@@_rectanglecolor [ #1 ] { #2 } - { 1 - 1 } { \int_use:N \c@iRow - \int_use:N \c@jCol } - } -% \end{macrocode} -% The interesting case is when the key |except-corners| is used. In that case, -% we can't fill now the tabular because we don't know the list of the cells -% of the corners. That's why we postpone the treatment in the |\CodeAfter|. -% \begin{macrocode} - { - \tl_gput_left:Nx \g_@@_internal_code_after_tl - { - \@@_arraycolor_code_after:nnn - { #1 } - { \exp_not:n { #2 } } - { \l_tmpa_clist } - } - } + \@@_rectanglecolor [ #1 ] { #2 } + { 1 - 1 } + { \int_use:N \c@iRow - \int_use:N \c@jCol } } % \end{macrocode} % % \bigskip -% The following command will be used in the |\CodeAfter|. |#1| is the color -% model, |#2| the color and |#3| the value of the key |except-corners| (a -% sublist of |{NW,NE,SW,SE}|). -% \begin{macrocode} -\cs_new_protected:Npn \@@_arraycolor_code_after:nnn #1 #2 #3 - { - \group_begin: -% \end{macrocode} -% First, we compute the corners. -% \begin{macrocode} - \clist_set:Nn \l_@@_corners_clist { #3 } - \@@_compute_corners: -% \end{macrocode} -% Now, for each cell of the array (excepted the potential exterior rows and -% columns) we check whether we have to fill that cell. When we have to fill the -% cell, we do the job by writing an instruction in the |\CodeBefore| (in fact, -% the ``|\CodeBefore|'' which will be written on the |aux| file for the next -% run). -% \begin{macrocode} - \int_step_inline:nn \c@iRow - { - \int_step_inline:nn \c@jCol - { - \seq_if_in:NnF \l_@@_empty_corner_cells_seq { ##1 - ####1 } - { - \tl_gput_left:Nx \g_nicematrix_code_before_tl - { \@@_cellcolor [ #1 ] { \exp_not:n { #2 } } { ##1 - ####1 } } - } - } - } - \group_end: - } -% \end{macrocode} -% -% -% \bigskip % \begin{macrocode} \keys_define:nn { NiceMatrix / rowcolors } { @@ -12237,19 +12333,26 @@ 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 +% 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. The argument is the radius of the corners. +% another command after. The argument is the radius of the corners. We define +% below a command |\@@_cartesian_path:| which corresponds to a value $0$~pt for +% the radius of the corners. +% +% This command is in particular used in |\@@_rectanglecolor:nnn| (used in +% |\@@_rectanglecolor|, itself used in |\@@_cellcolor|). % \begin{macrocode} \cs_new_protected:Npn \@@_cartesian_path:n #1 { + \bool_lazy_and:nnT + { ! \seq_if_empty_p:N \l_@@_corners_cells_seq } + { \dim_compare_p:nNn { #1 } = \c_zero_dim } + { + \@@_expand_clist:NN \l_@@_cols_tl \c@jCol + \@@_expand_clist:NN \l_@@_rows_tl \c@iRow + } % \end{macrocode} % We begin the loop over the columns. % \begin{macrocode} @@ -12270,11 +12373,14 @@ version 2005/12/01 or later. \int_compare:nNnT \l_tmpb_tl > \c@jCol { \tl_set:Nx \l_tmpb_tl { \int_use:N \c@jCol } } % \end{macrocode} +% |\l_tmpc_tl| will contain the number of column. +% \begin{macrocode} + \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl +% \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:|. +% |\rowcolor|, |\columncolor|, |\rowcolors| and |\chessboardcolors| 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 lines to modify. % \begin{macrocode} \@@_qpoint:n { col - \l_tmpa_tl } \int_compare:nNnTF \l_@@_first_col_int = \l_tmpa_tl @@ -12299,36 +12405,83 @@ version 2005/12/01 or later. % \end{macrocode} % Now, the numbers of both rows are in |\l_tmpa_tl| and |\l_tmpb_tl|. % \begin{macrocode} - \@@_qpoint:n { row - \@@_succ:n \l_tmpb_tl } - \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 } + \seq_if_in:NxF \l_@@_corners_cells_seq + { \l_tmpa_tl - \l_tmpc_tl } + { + \@@_qpoint:n { row - \@@_succ:n \l_tmpb_tl } + \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 } + } } } } % \end{macrocode} % +% \bigskip +% The following command corresponds to a radius of the corners equal to $0$~pt. +% This command is used by the commands |\@@_rowcolors|, |\@@_columncolor| and +% |\@@_rowcolor:n| (used in |\@@_rowcolor|). +% \begin{macrocode} +\cs_new_protected:Npn \@@_cartesian_path: { \@@_cartesian_path:n { 0 pt } } +% \end{macrocode} +% % % \bigskip +% The following command will be used only with |\l_@@_cols_tl| and |\c@jCol| (first +% case) or with |\l_@@_rows_tl| and |\c@iRow| (second case). For instance, with +% |\l_@@_cols_tl| equal to |2,4-6,8-*| and |\c@jCol| equal to |10|, the clist +% |\l_@@_cols_tl| will be replaced by |2,4,5,6,8,9,10|. +% \begin{macrocode} +\cs_new_protected:Npn \@@_expand_clist:NN #1 #2 + { + \clist_set_eq:NN \l_tmpa_clist #1 + \clist_clear:N #1 + \clist_map_inline:Nn \l_tmpa_clist + { + \tl_set:Nn \l_tmpa_tl { ##1 } + \tl_if_in:NnTF \l_tmpa_tl { - } + { \@@_cut_on_hyphen:w ##1 \q_stop } + { \@@_cut_on_hyphen:w ##1 - ##1 \q_stop } + \bool_lazy_or:nnT + { \tl_if_blank_p:V \l_tmpa_tl } + { \str_if_eq_p:Vn \l_tmpa_tl { * } } + { \tl_set:Nn \l_tmpa_tl { 1 } } + \bool_lazy_or:nnT + { \tl_if_blank_p:V \l_tmpb_tl } + { \str_if_eq_p:Vn \l_tmpb_tl { * } } + { \tl_set:Nx \l_tmpb_tl { \int_use:N #2 } } + \int_compare:nNnT \l_tmpb_tl > #2 + { \tl_set:Nx \l_tmpb_tl { \int_use:N #2 } } + \int_step_inline:nnn \l_tmpa_tl \l_tmpb_tl + { \clist_put_right:Nn #1 { ####1 } } + } + } +% \end{macrocode} +% +% \bigskip % When the user uses the key |colortbl-like|, the following command will % be linked to |\cellcolor| in the tabular. % \begin{macrocode} \NewDocumentCommand \@@_cellcolor_tabular { O { } m } { - \tl_gput_right:Nx \g_nicematrix_code_before_tl - { + \peek_remove_spaces:n + { + \tl_gput_right:Nx \g_nicematrix_code_before_tl + { % \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 } - } + \cellcolor [ #1 ] { \exp_not:n { #2 } } + { \int_use:N \c@iRow - \int_use:N \c@jCol } + } + } } % \end{macrocode} % @@ -12338,11 +12491,14 @@ version 2005/12/01 or later. % \begin{macrocode} \NewDocumentCommand \@@_rowcolor_tabular { O { } m } { - \tl_gput_right:Nx \g_nicematrix_code_before_tl - { - \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 } } + \peek_remove_spaces:n + { + \tl_gput_right:Nx \g_nicematrix_code_before_tl + { + \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 } } + } } } % \end{macrocode} @@ -12522,20 +12678,20 @@ version 2005/12/01 or later. \int_compare:nNnTF \l_tmpb_tl = { \@@_succ:n \c@jCol } { \seq_if_in:NxT - \l_@@_empty_corner_cells_seq + \l_@@_corners_cells_seq { \l_tmpa_tl - \@@_pred:n \l_tmpb_tl } { \bool_set_false:N \g_tmpa_bool } } { \seq_if_in:NxT - \l_@@_empty_corner_cells_seq + \l_@@_corners_cells_seq { \l_tmpa_tl - \l_tmpb_tl } { \int_compare:nNnTF \l_tmpb_tl = 1 { \bool_set_false:N \g_tmpa_bool } { \seq_if_in:NxT - \l_@@_empty_corner_cells_seq + \l_@@_corners_cells_seq { \l_tmpa_tl - \@@_pred:n \l_tmpb_tl } { \bool_set_false:N \g_tmpa_bool } } @@ -12609,8 +12765,8 @@ version 2005/12/01 or later. \cs_new_protected:Npn \@@_draw_vlines: { \int_step_inline:nnn - { \bool_if:NTF \l_@@_NiceArray_bool 1 2 } - { \bool_if:NTF \l_@@_NiceArray_bool { \@@_succ:n \c@jCol } \c@jCol } + { \bool_if:NTF \g_@@_NiceArray_bool 1 2 } + { \bool_if:NTF \g_@@_NiceArray_bool { \@@_succ:n \c@jCol } \c@jCol } { \tl_if_eq:NnF \l_@@_vlines_clist { all } { \clist_if_in:NnT \l_@@_vlines_clist { ##1 } } @@ -12702,20 +12858,20 @@ version 2005/12/01 or later. \int_compare:nNnTF \l_tmpa_tl = { \@@_succ:n \c@iRow } { \seq_if_in:NxT - \l_@@_empty_corner_cells_seq + \l_@@_corners_cells_seq { \@@_pred:n \l_tmpa_tl - \l_tmpb_tl } { \bool_set_false:N \g_tmpa_bool } } { \seq_if_in:NxT - \l_@@_empty_corner_cells_seq + \l_@@_corners_cells_seq { \l_tmpa_tl - \l_tmpb_tl } { \int_compare:nNnTF \l_tmpa_tl = 1 { \bool_set_false:N \g_tmpa_bool } { \seq_if_in:NxT - \l_@@_empty_corner_cells_seq + \l_@@_corners_cells_seq { \@@_pred:n \l_tmpa_tl - \l_tmpb_tl } { \bool_set_false:N \g_tmpa_bool } } @@ -12783,8 +12939,8 @@ version 2005/12/01 or later. \cs_new_protected:Npn \@@_draw_hlines: { \int_step_inline:nnn - { \bool_if:NTF \l_@@_NiceArray_bool 1 2 } - { \bool_if:NTF \l_@@_NiceArray_bool { \@@_succ:n \c@iRow } \c@iRow } + { \bool_if:NTF \g_@@_NiceArray_bool 1 2 } + { \bool_if:NTF \g_@@_NiceArray_bool { \@@_succ:n \c@iRow } \c@iRow } { \tl_if_eq:NnF \l_@@_hlines_clist { all } { \clist_if_in:NnT \l_@@_hlines_clist { ##1 } } @@ -12906,10 +13062,10 @@ version 2005/12/01 or later. \cs_new_protected:Npn \@@_compute_corners: { % \end{macrocode} -% The sequence |\l_@@_empty_corner_cells_seq| will be the sequence of all the +% The sequence |\l_@@_corners_cells_seq| will be the sequence of all the % empty cells (and not in a block) considered in the corners of the array. % \begin{macrocode} - \seq_clear_new:N \l_@@_empty_corner_cells_seq + \seq_clear_new:N \l_@@_corners_cells_seq \clist_map_inline:Nn \l_@@_corners_clist { \str_case:nnF { ##1 } @@ -12925,6 +13081,27 @@ version 2005/12/01 or later. } { \@@_error:nn { bad~corner } { ##1 } } } +% \end{macrocode} +% Even if the user has used the key |corners| (or the key +% |hvlines-except-corners|), the list of cells in the corners may be empty. +% \begin{macrocode} + \seq_if_empty:NF \l_@@_corners_cells_seq + { +% \end{macrocode} +% You write on the |aux| file the list of the cells which are in the (empty) +% corners because you need that information in the |\CodeBefore| since the +% commands which color the |rows|, |columns| and |cells| must not color the +% cells in the corners. +% \begin{macrocode} + \iow_now:Nn \@mainaux \ExplSyntaxOn + \iow_now:Nx \@mainaux + { + \seq_gset_from_clist:cn + { c_@@_corners_cells_ \int_use:N \g_@@_env_int _ seq } + { \seq_use:Nnnn \l_@@_corners_cells_seq , , , } + } + \iow_now:Nn \@mainaux \ExplSyntaxOff + } } % \end{macrocode} % @@ -12932,7 +13109,7 @@ version 2005/12/01 or later. % \bigskip % ``Computing a corner'' is determining all the empty cells (which are not in a % block) that belong to that corner. These cells will be added to the sequence -% |\l_@@_empty_corner_cells_seq|. +% |\l_@@_corners_cells_seq|. % % \medskip % The six arguments of |\@@_compute_a_corner:nnnnnn| are as follow: @@ -13020,7 +13197,7 @@ version 2005/12/01 or later. { \int_set:Nn \l_@@_last_empty_column_int { ####1 } \seq_put_right:Nn - \l_@@_empty_corner_cells_seq + \l_@@_corners_cells_seq { ##1 - ####1 } } } @@ -13200,14 +13377,14 @@ version 2005/12/01 or later. % We do a reduction by |\arraycolsep| for the environments with delimiters (and % not for the other). % \begin{macrocode} - \bool_if:NTF \l_@@_NiceArray_bool \c_zero_dim \arraycolsep + \bool_if:NTF \g_@@_NiceArray_bool \c_zero_dim \arraycolsep - \l_@@_left_margin_dim } \@@_qpoint:n { col - \@@_succ:n \c@jCol } \dim_set:Nn \l_@@_x_final_dim { \pgf@x - - \bool_if:NTF \l_@@_NiceArray_bool \c_zero_dim \arraycolsep + \bool_if:NTF \g_@@_NiceArray_bool \c_zero_dim \arraycolsep + \l_@@_right_margin_dim } % \end{macrocode} @@ -13215,9 +13392,9 @@ version 2005/12/01 or later. % bracket. The correction by |0.5 \l_@@_inter_dots_dim| is \emph{ad hoc} for a % better result. % \begin{macrocode} - \tl_if_eq:NnF \l_@@_left_delim_tl ( + \tl_if_eq:NnF \g_@@_left_delim_tl ( { \dim_gadd:Nn \l_@@_x_initial_dim { 0.5 \l_@@_inter_dots_dim } } - \tl_if_eq:NnF \l_@@_right_delim_tl ) + \tl_if_eq:NnF \g_@@_right_delim_tl ) { \dim_gsub:Nn \l_@@_x_final_dim { 0.5 \l_@@_inter_dots_dim } } % \end{macrocode} % @@ -13763,8 +13940,13 @@ version 2005/12/01 or later. % with the syntax $i$|-|$j$) has not be provided by the user, you use |1-1| % (that is to say a block of only one cell). % \begin{macrocode} - \tl_if_blank:nTF { #2 } { \@@_Block_i 1-1 \q_stop } { \@@_Block_i #2 \q_stop } - { #1 } { #3 } { #4 } + \peek_remove_spaces:n + { + \tl_if_blank:nTF { #2 } + { \@@_Block_i 1-1 \q_stop } + { \@@_Block_i #2 \q_stop } + { #1 } { #3 } { #4 } + } } % \end{macrocode} % @@ -14078,6 +14260,8 @@ version 2005/12/01 or later. color .value_required:n = true , borders .clist_set:N = \l_@@_borders_clist , borders .value_required:n = true , + hvlines .bool_set:N = \l_@@_hvlines_block_bool , + hvlines .default:n = true , line-width .dim_set:N = \l_@@_line_width_dim , line-width .value_required:n = true , l .code:n = \tl_set:Nn \l_@@_hpos_of_block_tl l , @@ -14186,6 +14370,19 @@ version 2005/12/01 or later. % \end{macrocode} % % \begin{macrocode} + \bool_if:NT \l_@@_hvlines_block_bool + { + \tl_gput_right:Nx \g_nicematrix_code_after_tl + { + \@@_hvlines_block:nnn + { \exp_not:n { #5 } } + { #1 - #2 } + { \int_use:N \l_@@_last_row_int - \int_use:N \l_@@_last_col_int } + } + } +% \end{macrocode} +% +% \begin{macrocode} \clist_if_empty:NF \l_@@_borders_clist { \tl_gput_right:Nx \g_nicematrix_code_after_tl @@ -14201,10 +14398,17 @@ version 2005/12/01 or later. % \begin{macrocode} \tl_if_empty:NF \l_@@_fill_tl { +% \end{macrocode} +% The command |\@@_extract_brackets| will extract the potential specification of +% color space at the beginning of |\l_@@_fill_tl| and store it in |\l_tmpa_tl| +% and store the color itself in |\l_tmpb_tl|. +% \begin{macrocode} + \exp_last_unbraced:NV \@@_extract_brackets \l_@@_fill_tl \q_stop \tl_gput_right:Nx \g_nicematrix_code_before_tl { \exp_not:N \roundedrectanglecolor - { \exp_not:V \l_@@_fill_tl } + [ \l_tmpa_tl ] + { \exp_not:V \l_tmpb_tl } { #1 - #2 } { \int_use:N \l_@@_last_row_int - \int_use:N \l_@@_last_col_int } { \dim_use:N \l_@@_rounded_corners_dim } @@ -14486,7 +14690,17 @@ version 2005/12/01 or later. } % \end{macrocode} % -% +% \bigskip +% \begin{macrocode} +\NewDocumentCommand \@@_extract_brackets { O { } } + { + \tl_set:Nn \l_tmpa_tl { #1 } + \@@_store_in_tmpb_tl + } +\cs_new_protected:Npn \@@_store_in_tmpb_tl #1 \q_stop + { \tl_set:Nn \l_tmpb_tl { #1 } } +% \end{macrocode} +% % % \bigskip % The first argument of |\@@_stroke_block:nnn| is a list of options for the % rectangle that you will stroke. The second argument is the upper-left cell of @@ -14563,6 +14777,60 @@ version 2005/12/01 or later. } % \end{macrocode} % + +% \bigskip +% The first argument of |\@@_hvlines_block:nnn| is a list of options for the +% rules that wewill draw. The second argument is the upper-left cell of the +% block (with, as usual, the syntax $i$|-|$j$) and the third is the last cell of +% the block (with the same syntax). +% \begin{macrocode} +\cs_new_protected:Npn \@@_hvlines_block:nnn #1 #2 #3 + { + \dim_set_eq:NN \l_@@_line_width_dim \arrayrulewidth + \keys_set_known:nn { NiceMatrix / BlockBorders } { #1 } + \@@_cut_on_hyphen:w #2 \q_stop + \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl + \tl_set_eq:NN \l_tmpd_tl \l_tmpb_tl + \@@_cut_on_hyphen:w #3 \q_stop + \tl_set:Nx \l_tmpa_tl { \int_eval:n { \l_tmpa_tl + 1 } } + \tl_set:Nx \l_tmpb_tl { \int_eval:n { \l_tmpb_tl + 1 } } + \pgfpicture + \pgfrememberpicturepositiononpagetrue + \pgf@relevantforpicturesizefalse + \CT@arc@ + \pgfsetlinewidth { 1.1 \l_@@_line_width_dim } +% \end{macrocode} +% First, the vertical rules. +% \begin{macrocode} + \@@_qpoint:n { row - \l_tmpa_tl } + \dim_set_eq:NN \l_tmpa_dim \pgf@y + \@@_qpoint:n { row - \l_tmpc_tl } + \dim_set_eq:NN \l_tmpb_dim \pgf@y + \int_step_inline:nnn \l_tmpd_tl \l_tmpb_tl + { + \@@_qpoint:n { col - ##1 } + \pgfpathmoveto { \pgfpoint \pgf@x \l_tmpa_dim } + \pgfpathlineto { \pgfpoint \pgf@x \l_tmpb_dim } + \pgfusepathqstroke + } +% \end{macrocode} +% Now, the horizontal rules. +% \begin{macrocode} + \@@_qpoint:n { col - \l_tmpb_tl } + \dim_set:Nn \l_tmpa_dim { \pgf@x + 0.5 \arrayrulewidth } + \@@_qpoint:n { col - \l_tmpd_tl } + \dim_set:Nn \l_tmpb_dim { \pgf@x - 0.5 \arrayrulewidth } + \int_step_inline:nnn \l_tmpc_tl \l_tmpa_tl + { + \@@_qpoint:n { row - ##1 } + \pgfpathmoveto { \pgfpoint \l_tmpa_dim \pgf@y } + \pgfpathlineto { \pgfpoint \l_tmpb_dim \pgf@y } + \pgfusepathqstroke + } + \endpgfpicture + } +% \end{macrocode} +% % \bigskip % The first argument of |\@@_stroke_borders_block:nnn| is a list of options for % the borders that you will stroke. The second argument is the upper-left cell @@ -14749,10 +15017,9 @@ version 2005/12/01 or later. % \begin{macrocode} \NewDocumentCommand \AutoNiceMatrix { O { } m O { } m ! O { } } { - \group_begin: - \bool_set_true:N \l_@@_NiceArray_bool - \AutoNiceMatrixWithDelims . . { #2 } { #4 } [ #1 , #3 , #5 ] - \group_end: + \bool_gset_true:N \g_@@_NiceArray_bool + \AutoNiceMatrixWithDelims . . { #2 } { #4 } [ #1 , #3 , #5 ] + \bool_gset_false: \g_@@_NiceArray_bool } % \end{macrocode} % @@ -14957,10 +15224,10 @@ version 2005/12/01 or later. % A delimiter in the preamble of the array will write an instruction % |\@@_delimiter:nnn| in the |\g_@@_internal_code_after_tl| (and also % potentially add instructions in the preamble provided to |\array| in order to -% add spaces between columns). +% add space between columns). % % \smallskip -% The first argument is the type of delimiter (|(|, |[|, |\{|, |)|, |]| ou +% The first argument is the type of delimiter (|(|, |[|, |\{|, |)|, |]| or % |\}|). The second argument is the number of colummn. The third argument is a % boolean equal to |\c_true_bool| (resp. |\c_false_true|) when the delimiter % must be put on the left (resp. right) side. @@ -15183,7 +15450,7 @@ 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_@@_first_i_tl \l_@@_last_i_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 @@ -15201,67 +15468,85 @@ version 2005/12/01 or later. { \dim_max:nn \l_@@_x_final_dim \pgf@x } } } - \@@_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_@@_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 + \dim_compare:nNnTF \l_@@_x_initial_dim = \c_max_dim + { \@@_error:nn { impossible~delimiter } { left } } { - \cs_if_exist:cT - { pgf @ sh @ ns @ \@@_env: - \l_@@_first_i_tl - ##1 } - { - \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_@@_last_i_tl - ##1 } - { - \pgfpointanchor { \@@_env: - \l_@@_last_i_tl - ##1 } { south } - \dim_set:Nn \l_@@_y_final_dim - { \dim_min:nn \l_@@_y_final_dim \pgf@y } - } + \dim_compare:nNnTF \l_@@_x_final_dim = { - \c_max_dim } + { \@@_error:nn { impossible~delimiter } { right } } + { \@@_sub_matrix_i:nn { #1 } { #4 } } } - \dim_set:Nn \l_tmpa_dim - { - \l_@@_y_initial_dim - \l_@@_y_final_dim + - \l_@@_submatrix_extra_height_dim - \arrayrulewidth + \endpgfpicture + } + \group_end: + } +% \end{macrocode} +% +% \bigskip +% |#1| is the left delimiter dans |#2| is the right one. +% \begin{macrocode} +\cs_new_protected:Npn \@@_sub_matrix_i:nn #1 #2 + { + \@@_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_@@_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_@@_first_i_tl - ##1 } + { + \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_@@_last_i_tl - ##1 } + { + \pgfpointanchor { \@@_env: - \l_@@_last_i_tl - ##1 } { south } + \dim_set:Nn \l_@@_y_final_dim + { \dim_min:nn \l_@@_y_final_dim \pgf@y } } - \dim_set_eq:NN \nulldelimiterspace \c_zero_dim + } + \dim_set:Nn \l_tmpa_dim + { + \l_@@_y_initial_dim - \l_@@_y_final_dim + + \l_@@_submatrix_extra_height_dim - \arrayrulewidth + } + \dim_set_eq:NN \nulldelimiterspace \c_zero_dim % \end{macrocode} % % \bigskip % We will draw the rules in the |\SubMatrix|. % \begin{macrocode} - \group_begin: - \pgfsetlinewidth { 1.1 \arrayrulewidth } - \tl_if_empty:NF \l_@@_rules_color_tl - { \exp_after:wN \@@_set_CT@arc@: \l_@@_rules_color_tl \q_stop } - \CT@arc@ + \group_begin: + \pgfsetlinewidth { 1.1 \arrayrulewidth } + \tl_if_empty:NF \l_@@_rules_color_tl + { \exp_after:wN \@@_set_CT@arc@: \l_@@_rules_color_tl \q_stop } + \CT@arc@ % \end{macrocode} % Now, we draw the potential vertical rules specified in the preamble of the % environments with the letter fixed with the key |vlines-in-sub-matrix|. The % list of the columns where there is such rule to draw is in |\g_@@_cols_vlism_seq|. % \begin{macrocode} - \seq_map_inline:Nn \g_@@_cols_vlism_seq - { - \int_compare:nNnT \l_@@_first_j_tl < { ##1 } - { - \int_compare:nNnT - { ##1 } < { \int_eval:n { \l_@@_last_j_tl + 1 } } - { + \seq_map_inline:Nn \g_@@_cols_vlism_seq + { + \int_compare:nNnT \l_@@_first_j_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. % \begin{macrocode} - \@@_qpoint:n { col - ##1 } - \pgfpathmoveto { \pgfpoint \pgf@x \l_@@_y_initial_dim } - \pgfpathlineto { \pgfpoint \pgf@x \l_@@_y_final_dim } - \pgfusepathqstroke - } + \@@_qpoint:n { col - ##1 } + \pgfpathmoveto { \pgfpoint \pgf@x \l_@@_y_initial_dim } + \pgfpathlineto { \pgfpoint \pgf@x \l_@@_y_final_dim } + \pgfusepathqstroke } } + } % \end{macrocode} % % \medskip @@ -15269,23 +15554,23 @@ 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_@@_last_j_tl - \l_@@_first_j_tl } } - { \clist_map_inline:Nn \l_@@_submatrix_vlines_clist } + \tl_if_eq:NnTF \l_@@_submatrix_vlines_clist { all } + { \int_step_inline:nn { \l_@@_last_j_tl - \l_@@_first_j_tl } } + { \clist_map_inline:Nn \l_@@_submatrix_vlines_clist } + { + \bool_lazy_and:nnTF + { \int_compare_p:nNn { ##1 } > 0 } + { + \int_compare_p:nNn + { ##1 } < { \l_@@_last_j_tl - \l_@@_first_j_tl + 1 } } { - \bool_lazy_and:nnTF - { \int_compare_p:nNn { ##1 } > 0 } - { - \int_compare_p:nNn - { ##1 } < { \l_@@_last_j_tl - \l_@@_first_j_tl + 1 } } - { - \@@_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 - } - { \@@_error:nnn { Wrong~line~in~SubMatrix } { vertical } { ##1 } } + \@@_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 } + { \@@_error:nnn { Wrong~line~in~SubMatrix } { vertical } { ##1 } } + } % \end{macrocode} % % \medskip @@ -15294,50 +15579,50 @@ 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_@@_last_i_tl - \l_@@_first_i_tl } } - { \clist_map_inline:Nn \l_@@_submatrix_hlines_clist } + \tl_if_eq:NnTF \l_@@_submatrix_hlines_clist { all } + { \int_step_inline:nn { \l_@@_last_i_tl - \l_@@_first_i_tl } } + { \clist_map_inline:Nn \l_@@_submatrix_hlines_clist } + { + \bool_lazy_and:nnTF + { \int_compare_p:nNn { ##1 } > 0 } + { + \int_compare_p:nNn + { ##1 } < { \l_@@_last_i_tl - \l_@@_first_i_tl + 1 } } { - \bool_lazy_and:nnTF - { \int_compare_p:nNn { ##1 } > 0 } - { - \int_compare_p:nNn - { ##1 } < { \l_@@_last_i_tl - \l_@@_first_i_tl + 1 } } - { - \@@_qpoint:n { row - \int_eval:n { ##1 + \l_@@_first_i_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} - \group_begin: + \group_begin: % \end{macrocode} % We compute in |\l_tmpa_dim| the $x$-value of the left end of the rule. % \begin{macrocode} - \dim_set:Nn \l_tmpa_dim - { \l_@@_x_initial_dim - \l_@@_submatrix_left_xshift_dim } - \str_case:nn { #1 } - { - ( { \dim_sub:Nn \l_tmpa_dim { 0.9 mm } } - [ { \dim_sub:Nn \l_tmpa_dim { 0.2 mm } } - \{ { \dim_sub:Nn \l_tmpa_dim { 0.9 mm } } - } - \pgfpathmoveto { \pgfpoint \l_tmpa_dim \pgf@y } + \dim_set:Nn \l_tmpa_dim + { \l_@@_x_initial_dim - \l_@@_submatrix_left_xshift_dim } + \str_case:nn { #1 } + { + ( { \dim_sub:Nn \l_tmpa_dim { 0.9 mm } } + [ { \dim_sub:Nn \l_tmpa_dim { 0.2 mm } } + \{ { \dim_sub:Nn \l_tmpa_dim { 0.9 mm } } + } + \pgfpathmoveto { \pgfpoint \l_tmpa_dim \pgf@y } % \end{macrocode} % We compute in |\l_tmpb_dim| the $x$-value of the right end of the rule. % \begin{macrocode} - \dim_set:Nn \l_tmpb_dim - { \l_@@_x_final_dim + \l_@@_submatrix_right_xshift_dim } - \str_case:nn { #4 } - { - ) { \dim_add:Nn \l_tmpb_dim { 0.9 mm } } - ] { \dim_add:Nn \l_tmpb_dim { 0.2 mm } } - \} { \dim_add:Nn \l_tmpb_dim { 0.9 mm } } - } - \pgfpathlineto { \pgfpoint \l_tmpb_dim \pgf@y } - \pgfusepathqstroke - \group_end: + \dim_set:Nn \l_tmpb_dim + { \l_@@_x_final_dim + \l_@@_submatrix_right_xshift_dim } + \str_case:nn { #2 } + { + ) { \dim_add:Nn \l_tmpb_dim { 0.9 mm } } + ] { \dim_add:Nn \l_tmpb_dim { 0.2 mm } } + \} { \dim_add:Nn \l_tmpb_dim { 0.9 mm } } } - { \@@_error:nnn { Wrong~line~in~SubMatrix } { horizontal } { ##1 } } + \pgfpathlineto { \pgfpoint \l_tmpb_dim \pgf@y } + \pgfusepathqstroke + \group_end: } + { \@@_error:nnn { Wrong~line~in~SubMatrix } { horizontal } { ##1 } } + } % \end{macrocode} % % \medskip @@ -15345,13 +15630,13 @@ version 2005/12/01 or later. % node with that name for the submatrix (this node does not encompass the % delimiters that we will put after). % \begin{macrocode} - \str_if_empty:NF \l_@@_submatrix_name_str - { - \@@_pgf_rect_node:nnnnn \l_@@_submatrix_name_str - \l_@@_x_initial_dim \l_@@_y_initial_dim - \l_@@_x_final_dim \l_@@_y_final_dim - } - \group_end: + \str_if_empty:NF \l_@@_submatrix_name_str + { + \@@_pgf_rect_node:nnnnn \l_@@_submatrix_name_str + \l_@@_x_initial_dim \l_@@_y_initial_dim + \l_@@_x_final_dim \l_@@_y_final_dim + } + \group_end: % \end{macrocode} % The group was for |\CT@arc@| (the color of the rules). % @@ -15359,45 +15644,41 @@ version 2005/12/01 or later. % Now, we deal with the left delimiter. Of course, the environment % |{pgfscope}| is for the |\pgftransformshift|. % \begin{macrocode} - \begin { pgfscope } - \pgftransformshift - { - \pgfpoint - { \l_@@_x_initial_dim - \l_@@_submatrix_left_xshift_dim } - { ( \l_@@_y_initial_dim + \l_@@_y_final_dim ) / 2 } - } - \str_if_empty:NTF \l_@@_submatrix_name_str - { \@@_node_left:nn #1 { } } - { \@@_node_left:nn #1 { \@@_env: - \l_@@_submatrix_name_str - left } } - \end { pgfscope } + \begin { pgfscope } + \pgftransformshift + { + \pgfpoint + { \l_@@_x_initial_dim - \l_@@_submatrix_left_xshift_dim } + { ( \l_@@_y_initial_dim + \l_@@_y_final_dim ) / 2 } + } + \str_if_empty:NTF \l_@@_submatrix_name_str + { \@@_node_left:nn #1 { } } + { \@@_node_left:nn #1 { \@@_env: - \l_@@_submatrix_name_str - left } } + \end { pgfscope } % \end{macrocode} % % \medskip % Now, we deal with the right delimiter. % \begin{macrocode} - \pgftransformshift - { - \pgfpoint - { \l_@@_x_final_dim + \l_@@_submatrix_right_xshift_dim } - { ( \l_@@_y_initial_dim + \l_@@_y_final_dim ) / 2 } - } - \str_if_empty:NTF \l_@@_submatrix_name_str - { \@@_node_right:nn #4 { } } - { - \@@_node_right:nn #4 { \@@_env: - \l_@@_submatrix_name_str - right } - } - \endpgfpicture + \pgftransformshift + { + \pgfpoint + { \l_@@_x_final_dim + \l_@@_submatrix_right_xshift_dim } + { ( \l_@@_y_initial_dim + \l_@@_y_final_dim ) / 2 } + } + \str_if_empty:NTF \l_@@_submatrix_name_str + { \@@_node_right:nn #2 { } } + { + \@@_node_right:nn #2 { \@@_env: - \l_@@_submatrix_name_str - right } + } % \end{macrocode} % % \begin{macrocode} - \cs_set_eq:NN \pgfpointanchor \@@_pgfpointanchor:n - \flag_clear_new:n { nicematrix } - \l_@@_code_tl - } - \group_end: + \cs_set_eq:NN \pgfpointanchor \@@_pgfpointanchor:n + \flag_clear_new:n { nicematrix } + \l_@@_code_tl } % \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. @@ -15613,6 +15894,8 @@ version 2005/12/01 or later. } % \end{macrocode} % +% \medskip +% Maybe we will completely delete the key 'transparent' in a future version. % \begin{macrocode} \@@_msg_new:nn { Key~transparent } { @@ -15713,6 +15996,31 @@ version 2005/12/01 or later. % \bigskip % \subsection*{Error messages of the package} % +% +% The following message will be deleted when we will delete the key +% |except-corners| for the command |\arraycolor|. +% \begin{macrocode} +\@@_msg_new:nn { key except-corners } + { + The~key~'except-corners'~has~been~deleted~for~the~command~\token_to_str:N + \arraycolor\ in~the~\token_to_str:N \CodeBefore.~You~should~instead~use~ + the~key~'corners'~in~your~\@@_full_name_env:.\\ + If~you~go~on,~this~key~will~be~ignored. + } +% \end{macrocode} +% +% +% \medskip +% The following message will be deleted when we will delete the key +% |delimiters-color| (and keep only the key |delimiters/color|). +% \begin{macrocode} +\@@_msg_new:nn { delimiters-color deleted } + { + The~key~'delimiters-color'~has~been~renamed~'delimiters/color'.\\ + ~However,~you~can~go~on~for~this~time. + } +% \end{macrocode} +% % \begin{macrocode} \seq_new:N \c_@@_types_of_matrix_seq \seq_set_from_clist:Nn \c_@@_types_of_matrix_seq @@ -15843,6 +16151,21 @@ version 2005/12/01 or later. } % \end{macrocode} % +% \begin{macrocode} +\@@_msg_new:nn { double~closing~delimiter } + { + You~can't~put~a~second~closing~delimiter~"#1"~just~after~a~first~closing~ + delimiter.~This~delimiter~will~be~ignored. + } +% \end{macrocode} +% +% \begin{macrocode} +\@@_msg_new:nn { delimiter~after~opening } + { + You~can't~put~a~second~delimiter~"#1"~just~after~a~first~opening~ + delimiter.~This~delimiter~will~be~ignored. + } +% \end{macrocode} % % \begin{macrocode} \@@_msg_new:nn { bad~option~for~line-style } @@ -15943,6 +16266,18 @@ version 2005/12/01 or later. number~is~not~valid.~If~you~go~on,~it~will~be~ignored. } % \end{macrocode} +% +% \begin{macrocode} +\@@_msg_new:nn { impossible~delimiter } + { + It's~impossible~to~draw~the~#1~delimiter~of~your~ + \token_to_str:N \SubMatrix\ because~all~the~cells~are~empty~ + in~that~column. + \bool_if:NT \l_@@_submatrix_slim_bool + { ~Maybe~you~should~try~without~the~key~'slim'. } \\ + If~you~go~on,~this~\token_to_str:N \SubMatrix\ will~be~ignored. + } +% \end{macrocode} % % \begin{macrocode} \@@_msg_new:nn { empty~environment } @@ -16154,8 +16489,8 @@ version 2005/12/01 or later. For~a~list~of~the~available~keys,~type~H~<return>. } { - The~available~keys~are~(in~alphabetic~order):~borders,~c,~draw,~fill,~l,~ - line-width,~rounded-corners~and~r. + The~available~keys~are~(in~alphabetic~order):~b,~borders,~c,~draw,~fill,~ + hvlines,~l,~line-width,~rounded-corners,~r~and~t. } % \end{macrocode} % @@ -16468,9 +16803,10 @@ version 2005/12/01 or later. % The successive versions of the file |nicematrix.sty| provided by TeXLive are available on the % \textsc{svn} server of TeXLive: % +% \smallskip % { % \small -% \url{https:www.tug.org/svn/texlive/trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty} +% \nolinkurl{https:www.tug.org/svn/texlive/trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty} % } % % @@ -16918,12 +17254,23 @@ version 2005/12/01 or later. % % \subsection*{Changes between versions 5.13 and 5.14} % -% Nodes of the forme |(1.5)|, |(2.5)|, |(3.5)|, etc. +% Nodes of the form |(1.5)|, |(2.5)|, |(3.5)|, etc. % % Keys |t| and |b| for the command |\Block|. % % Key |corners|. % +% \subsection*{Changes between versions 5.14 and 5.15} +% +% Key |hvlines| for the command |\Block|. +% +% The commands provided by \pkg{nicematrix} to color cells, rows and columns +% don't color the cells which are in the ``corners'' (when the key |corner| is +% used). +% +% It's now possible to specify delimiters for submatrices in the preamble of an +% environment. +% % \PrintIndex % % \tableofcontents diff --git a/macros/latex/contrib/nicematrix/nicematrix.pdf b/macros/latex/contrib/nicematrix/nicematrix.pdf Binary files differindex c228e67e67..b710425395 100644 --- a/macros/latex/contrib/nicematrix/nicematrix.pdf +++ b/macros/latex/contrib/nicematrix/nicematrix.pdf |