From 3c36091e77e72aa582c29594048a092b63eae83c Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Wed, 15 Sep 2021 03:01:59 +0000 Subject: CTAN sync 202109150301 --- macros/latex/contrib/mlacls/README.md | 2 +- macros/latex/contrib/mlacls/mla.dtx | 10 +- macros/latex/contrib/mlacls/mla.pdf | Bin 326617 -> 393101 bytes .../latex/contrib/nicematrix/nicematrix-french.pdf | Bin 471024 -> 476252 bytes .../latex/contrib/nicematrix/nicematrix-french.tex | 107 +++- macros/latex/contrib/nicematrix/nicematrix.dtx | 661 ++++++++++++--------- macros/latex/contrib/nicematrix/nicematrix.pdf | Bin 1380062 -> 1387232 bytes macros/latex/contrib/siunitx/CHANGELOG.md | 18 +- macros/latex/contrib/siunitx/siunitx-angle.dtx | 3 + macros/latex/contrib/siunitx/siunitx-code.pdf | Bin 1512430 -> 1513922 bytes macros/latex/contrib/siunitx/siunitx-print.dtx | 101 +++- macros/latex/contrib/siunitx/siunitx.dtx | 6 +- macros/latex/contrib/siunitx/siunitx.pdf | Bin 636993 -> 637245 bytes macros/latex/contrib/siunitx/siunitx.tex | 10 +- 14 files changed, 584 insertions(+), 334 deletions(-) (limited to 'macros/latex') diff --git a/macros/latex/contrib/mlacls/README.md b/macros/latex/contrib/mlacls/README.md index c2b200f8f2..b93d9eebc9 100644 --- a/macros/latex/contrib/mlacls/README.md +++ b/macros/latex/contrib/mlacls/README.md @@ -50,7 +50,7 @@ Once finished, move the output `mla.cls` to your local Authorship & licensing ---------------------- -`mlacls` copyright 2019 Seth Price (ssterling AT firemail DOT cc). +`mlacls` copyright 2019 Seth Price (sprice623 AT aol DOT com). Released under the [LaTeX Project Public License v1.3c](https://www.latex-project.org/lppl/lppl-1-3c/). diff --git a/macros/latex/contrib/mlacls/mla.dtx b/macros/latex/contrib/mlacls/mla.dtx index 2ea31fb52f..807a073ed1 100644 --- a/macros/latex/contrib/mlacls/mla.dtx +++ b/macros/latex/contrib/mlacls/mla.dtx @@ -27,7 +27,7 @@ %\NeedsTeXFormat{LaTeX2e} %\ProvidesClass{mla} %<*mla> - [2020/11/07 v0.9 MLA Paper Class] + [2021/09/14 v1.0 MLA Paper Class] % %<*driver> @@ -416,18 +416,20 @@ % The \Dcls{mla} class options dictate what options are passed to % \Dpkg{biblatex}, hence the \term{if-then} clauses. % +% \changes{v1.0}{2021/09/14}{Fixed bug which caused class to fail +% with \ac{MLA} 8 citations} % \begin{macrocode} \ifMLA@seven - \RequirePackage[style=mla,noremoteinfo=false,showmedium=true, + \RequirePackage[style=mla7,noremoteinfo=false, backend=biber]{biblatex} \fi \ifMLA@eight \RequirePackage[style=mla-new,noremoteinfo=false, - showmedium=false,backend=biber]{biblatex} + backend=biber]{biblatex} \fi \ifMLA@eightalt \RequirePackage[style=mla,noremoteinfo=false, - showmedium=false,backend=biber]{biblatex} + backend=biber]{biblatex} \fi % \end{macrocode} % diff --git a/macros/latex/contrib/mlacls/mla.pdf b/macros/latex/contrib/mlacls/mla.pdf index 89794d68a4..937392ba70 100644 Binary files a/macros/latex/contrib/mlacls/mla.pdf and b/macros/latex/contrib/mlacls/mla.pdf differ diff --git a/macros/latex/contrib/nicematrix/nicematrix-french.pdf b/macros/latex/contrib/nicematrix/nicematrix-french.pdf index 0ae9b00165..fae69c03b0 100644 Binary files a/macros/latex/contrib/nicematrix/nicematrix-french.pdf and b/macros/latex/contrib/nicematrix/nicematrix-french.pdf differ diff --git a/macros/latex/contrib/nicematrix/nicematrix-french.tex b/macros/latex/contrib/nicematrix/nicematrix-french.tex index 52aee27992..28723ff94b 100644 --- a/macros/latex/contrib/nicematrix/nicematrix-french.tex +++ b/macros/latex/contrib/nicematrix/nicematrix-french.tex @@ -865,7 +865,7 @@ clé |standard-cline|). \begin{BVerbatim}[baseline=c,boxwidth=10cm] \setlength{\arrayrulewidth}{2pt} \begin{NiceTabular}{cccc} \hline -A&B&C&D \\ ~emphase#\cline{2-2}@ +A&B&C&D \\ ~emphase#\cline{2}@ A&B&C&D \\ \hline \end{NiceTabular} \end{BVerbatim} @@ -875,13 +875,18 @@ A&B&C&D \\ \hline \begin{NiceTabular}[c]{cccc} \hline A&B&C&D \\ -\cline{2-2} +\cline{2} A&B&C&D \\ \hline \end{NiceTabular} \end{scope} +\medskip +\colorbox{yellow!50}{\textbf{Nouveau 6.2}}\enskip +Dans les environnements de +\pkg{nicematrix}, une instruction |\cline{|\textsl{\texttt{i}}|}| est +équivalente à |\cline{|\textsl{\texttt{i}}|-|\textsl{\texttt{i}}|}|. \subsection{L'épaisseur et la couleur des filets} @@ -1971,7 +1976,11 @@ clé |width|. La valeur initiale de ce paramètre est |\linewidth|. Pour se rapprocher davantage de l'environnement |{tabularx}|, \pkg{nicematrix} propose aussi un environnement |{NiceTabularX}| qui prend en premier argument -(obligatoire) la largeur voulue pour le tableau. +(obligatoire) la largeur voulue pour le tableau.\footnote{Si \pkg{tabularx} est + chargé, on doit obligatoirement utiliser |{NiceTabularX}| pour utiliser les + colonnes `X` (ceci est dû à un problème de conflit de définition des + spécificateurs de colonne `X`).} + Comme avec les extensions \pkg{tabu} et \pkg{tabularray}, le spécificateur |X| accepte entre crochets un argument optionnel qui est une liste de clés. @@ -4406,11 +4415,6 @@ pointillés de \pkg{nicematrix} : \NiceMatrixOptions{letter-for-dotted-lines=;} \end{Verbatim} -\bigskip -L'extension \pkg{nicematrix} n'est pas compatible avec la classe \cls{aastex63}. -Si vous souhaitez utiliser \pkg{nicematrix} with \cls{aastex63}, envoyez-moi un -courrier électronique et j'essaierai de résoudre les incompatibilités. - \bigskip L'extension \pkg{nicematrix} n'est pas compatible avec la classe \cls{ieeeaccess} (car cette classe n'est pas compatible avec PGF/Tikz). @@ -4421,6 +4425,15 @@ L'extension \pkg{nicematrix} n'est pas compatible avec la classe \cls{ieeeaccess \label{tikz-key-examples} +La clé |tikz| de la commande |\Block| n'est disponible que lorsque Tikz est +chargé.\footnote{Par défaut, \pkg{nicematrix} ne charge que \textsc{pgf}, qui + est une sous-couche de Tikz} + +Pour l'exemple suivant, la bibliothèque \tikz{patterns} de Tikz doit aussi être chargée. + +\begin{Verbatim} +\usetikzlibrary{patterns} +\end{Verbatim} \begin{Verbatim} \ttfamily \small @@ -4921,6 +4934,84 @@ Bien sûr, ce tableau ne pourra pas être coupé par un saut de page. \end{NiceMatrix}\] \end{scope} +\bigskip +Dans ce tableau, les instructions |\SubMatrix| sont exécutés après la +composition du tableau et les traits verticaux sont donc tracés sans espacer les +colonnes. + + +\bigskip +\colorbox{yellow!50}{\textbf{Nouveau 6.2}}\enskip En fait, on peut avec la clé +|vlines-in-sub-matrix| choisir un spécificateur dans le préambule du tableau +pour indiquer des filets verticaux qui seront tracés dans les |\SubMatrix| +uniquement (en espaçant les colonnes). + +\medskip +\begin{Verbatim} +\setlength{\extrarowheight}{1mm} +\[\begin{NiceArray} + [ + ~emphase#vlines-in-sub-matrix=I@, + last-col, + code-for-last-col = \scriptstyle \color{blue} + ] + {rrrrIr} +12 & -8 & 7 & 5 & 3 \\ + 3 & -18 & 12 & 1 & 4 \\ +-3 & -46 & 29 &-2 &-15 \\ + 9 & 10 &-5 &4 & 7 \\[1mm] +12 & -8 & 7 &5 & 3 \\ +0 & 64 &-41 & 1 & 19 & L_2 \gets L_1-4L_2 \\ +0 & -192 &123 &-3 &-57 & L_3 \gets L_1+4L_3 \\ +0 & -64 & 41 &-1 &-19 & L_4 \gets 3L_1-4L_4 \\[1mm] +12 & -8 &7 &5 & 3 \\ +0 & 64 &-41 &1 &19 \\ +0 & 0 &0 &0 & 0 & L_3 \gets 3L_2+L_3 \\[1mm] +12 & -8 &7 &5 & 3 \\ +0 & 64 &-41 & 1 & 19 \\ +\CodeAfter + \SubMatrix({1-1}{4-5}) + \SubMatrix({5-1}{8-5}) + \SubMatrix({9-1}{11-5}) + \SubMatrix({12-1}{13-5}) +\end{NiceArray}\] +\end{Verbatim} + + + +\medskip +\begin{scope} +\setlength{\extrarowheight}{1mm} +\[\begin{NiceArray} + [ + vlines-in-sub-matrix=I, + last-col, + code-for-last-col = \scriptstyle \color{blue} + ] + {rrrrIr} +12 & -8 & 7 & 5 & 3 \\ + 3 & -18 & 12 & 1 & 4 \\ +-3 & -46 & 29 &-2 &-15 \\ + 9 & 10 &-5 &4 & 7 \\[1mm] +12 & -8 & 7 &5 & 3 \\ +0 & 64 &-41 & 1 & 19 & L_2 \gets L_1-4L_2 \\ +0 & -192 &123 &-3 &-57 & L_3 \gets L_1+4L_3 \\ +0 & -64 & 41 &-1 &-19 & L_4 \gets 3L_1-4L_4 \\[1mm] +12 & -8 &7 &5 & 3 \\ +0 & 64 &-41 &1 &19 \\ +0 & 0 &0 &0 & 0 & L_3 \gets 3L_2+L_3 \\[1mm] +12 & -8 &7 &5 & 3 \\ +0 & 64 &-41 & 1 & 19 \\ +\CodeAfter + \SubMatrix({1-1}{4-5}) + \SubMatrix({5-1}{8-5}) + \SubMatrix({9-1}{11-5}) + \SubMatrix({12-1}{13-5}) +\end{NiceArray}\] +\end{scope} + + + \subsection{Comment surligner les cases d'une matrice} diff --git a/macros/latex/contrib/nicematrix/nicematrix.dtx b/macros/latex/contrib/nicematrix/nicematrix.dtx index 2f7bfdc597..034b863418 100644 --- a/macros/latex/contrib/nicematrix/nicematrix.dtx +++ b/macros/latex/contrib/nicematrix/nicematrix.dtx @@ -15,8 +15,8 @@ % % \fi % \iffalse -\def\myfileversion{6.1} -\def\myfiledate{2021/08/20} +\def\myfileversion{6.2} +\def\myfiledate{2021/09/09} % % %<*batchfile> @@ -65,7 +65,7 @@ version 2005/12/01 or later. \usepackage{titlesec} \titlespacing*{\section}{0pt}{6.5ex plus 1ex minus .2ex}{4.3ex plus .2ex} \titlespacing*{\subsection}{0pt}{4.5ex plus 1ex minus .2ex}{2ex plus .2ex} -\usepackage[hyperfootnotes=false]{footnotehyper} +\usepackage{footnotehyper} \usepackage{varwidth} \def\LetterAt{@} \parindent 0pt @@ -223,9 +223,7 @@ version 2005/12/01 or later. % \end{tabular} % \end{ttfamily} % -% -% -% +% % % \medskip % The environments |{NiceArray}|, |{NiceTabular}| and |{NiceTabular*}| are % similar to the environments |{array}|, |{tabular}| and |{tabular*}| of the @@ -893,7 +891,7 @@ version 2005/12/01 or later. % \begin{BVerbatim}[baseline=c,boxwidth=10cm] % \setlength{\arrayrulewidth}{2pt} % \begin{NiceTabular}{cccc} \hline -% A&B&C&D \\ ~emphase#\cline{2-2}@ +% A&B&C&D \\ ~emphase#\cline{2}@ % A&B&C&D \\ \hline % \end{NiceTabular} % \end{BVerbatim} @@ -902,12 +900,18 @@ version 2005/12/01 or later. % \begin{NiceTabular}[c]{cccc} % \hline % A&B&C&D \\ -% \cline{2-2} +% \cline{2} % A&B&C&D \\ % \hline % \end{NiceTabular} % \end{scope} % +% \medskip +% \colorbox{yellow!50}{\textbf{New 6.2}} +% +% In the environments of \pkg{nicematrix}, an instruction |\cline{|\textsl{\texttt{i}}|}| +% is equivalent to |\cline{|\textsl{\texttt{i}}|-|\textsl{\texttt{i}}|}|. +% % % \subsection{The thickness and the color of the rules} % @@ -1953,7 +1957,10 @@ version 2005/12/01 or later. % % For sake of similarity with the environment |{tabularx}|, \pkg{nicematrix} % also provides an environment |{NiceTabularX}| with a first mandatory argument -% which is the width of the tabular. +% which is the width of the tabular.\footnote{If \pkg{tabularx} is loaded, one +% must use |{NiceTabularX}| (and not |{NiceTabular}|) in order to use the +% columns `X` (this point comes from a conflict in the definitions of the +% specifier `X`).} % % As with the packages \pkg{tabu} and \pkg{tabularray}, the specifier |X| takes % in an optional argument (between square brackets) which is a list of keys. @@ -4335,11 +4342,6 @@ version 2005/12/01 or later. % \NiceMatrixOptions{letter-for-dotted-lines=;} % \end{Verbatim} % -% \bigskip -% Up to now, the package \pkg{nicematrix} is not compatible with -% \cls{aastex63}. If you want to use \pkg{nicematrix} with \cls{aastex63}, send -% me an email and I will try to solve the incompatibilies. -% % % \bigskip % The package \pkg{nicematrix} is not compatible with the class \cls{ieeeaccess} @@ -4351,6 +4353,17 @@ version 2005/12/01 or later. %\label{tikz-key-examples} % % +% The key |tikz| of the command |\Block| is available only when Tikz is +% loaded.\footnote{By default, \pkg{nicematrix} only loads \textsc{pgf}, which is +% a sub-layer of Tikz.} +% +% For the following example, you need also the Tikz library |patterns| +% +% \begin{Verbatim} +% \usetikzlibrary{patterns} +% \end{Verbatim} +% +% % \begin{Verbatim} % \ttfamily \small % \begin{NiceTabular}{X[m]X[m]X[m]}[hvlines,cell-space-limits=3pt] @@ -4843,6 +4856,83 @@ version 2005/12/01 or later. % \end{NiceMatrix}\] % \end{scope} % +% \bigskip +% In this tabular, the instructions |\SubMatrix| are executed after the +% composition of the tabular and, thus, the vertical rules are drawn without +% adding space between the columns. +% +% +%\bigskip +% \colorbox{yellow!50}{\textbf{New 6.2}}\enskip In fact, it's possible, with the +% key |vlines-in-sub-matrix|, to choice a letter in the preamble of the +% array to specify vertical rules which will be drawn in the |\SubMatrix| only +% (by adding space between the columns). +% +% \medskip +% \begin{Verbatim} +% \setlength{\extrarowheight}{1mm} +% \[\begin{NiceArray} +% [ +% ~emphase#vlines-in-sub-matrix=I@, +% last-col, +% code-for-last-col = \scriptstyle \color{blue} +% ] +% {rrrrIr} +% 12 & -8 & 7 & 5 & 3 \\ +% 3 & -18 & 12 & 1 & 4 \\ +% -3 & -46 & 29 &-2 &-15 \\ +% 9 & 10 &-5 &4 & 7 \\[1mm] +% 12 & -8 & 7 &5 & 3 \\ +% 0 & 64 &-41 & 1 & 19 & L_2 \gets L_1-4L_2 \\ +% 0 & -192 &123 &-3 &-57 & L_3 \gets L_1+4L_3 \\ +% 0 & -64 & 41 &-1 &-19 & L_4 \gets 3L_1-4L_4 \\[1mm] +% 12 & -8 &7 &5 & 3 \\ +% 0 & 64 &-41 &1 &19 \\ +% 0 & 0 &0 &0 & 0 & L_3 \gets 3L_2+L_3 \\[1mm] +% 12 & -8 &7 &5 & 3 \\ +% 0 & 64 &-41 & 1 & 19 \\ +% \CodeAfter +% \SubMatrix({1-1}{4-5}) +% \SubMatrix({5-1}{8-5}) +% \SubMatrix({9-1}{11-5}) +% \SubMatrix({12-1}{13-5}) +% \end{NiceArray}\] +% \end{Verbatim} +% +% +% \medskip +% \begin{scope} +% \setlength{\extrarowheight}{1mm} +% \[\begin{NiceArray} +% [ +% vlines-in-sub-matrix=I, +% last-col, +% code-for-last-col = \scriptstyle \color{blue} +% ] +% {rrrrIr} +% 12 & -8 & 7 & 5 & 3 \\ +% 3 & -18 & 12 & 1 & 4 \\ +% -3 & -46 & 29 &-2 &-15 \\ +% 9 & 10 &-5 &4 & 7 \\[1mm] +% 12 & -8 & 7 &5 & 3 \\ +% 0 & 64 &-41 & 1 & 19 & L_2 \gets L_1-4L_2 \\ +% 0 & -192 &123 &-3 &-57 & L_3 \gets L_1+4L_3 \\ +% 0 & -64 & 41 &-1 &-19 & L_4 \gets 3L_1-4L_4 \\[1mm] +% 12 & -8 &7 &5 & 3 \\ +% 0 & 64 &-41 &1 &19 \\ +% 0 & 0 &0 &0 & 0 & L_3 \gets 3L_2+L_3 \\[1mm] +% 12 & -8 &7 &5 & 3 \\ +% 0 & 64 &-41 & 1 & 19 \\ +% \CodeAfter +% \SubMatrix({1-1}{4-5}) +% \SubMatrix({5-1}{8-5}) +% \SubMatrix({9-1}{11-5}) +% \SubMatrix({12-1}{13-5}) +% \end{NiceArray}\] +% \end{scope} +% +% +% % % % \subsection{How to highlight cells of a matrix} @@ -5210,6 +5300,7 @@ version 2005/12/01 or later. \bool_new:N \c_@@_arydshln_loaded_bool \bool_new:N \c_@@_booktabs_loaded_bool \bool_new:N \c_@@_enumitem_loaded_bool +\bool_new:N \c_@@_tabularx_loaded_bool \bool_new:N \c_@@_tikz_loaded_bool \AtBeginDocument { @@ -5222,6 +5313,9 @@ version 2005/12/01 or later. \@ifpackageloaded { enumitem } { \bool_set_true:N \c_@@_enumitem_loaded_bool } { } + \@ifpackageloaded { tabularx } + { \bool_set_true:N \c_@@_tabularx_loaded_bool } + { } \@ifpackageloaded { tikz } { % \end{macrocode} @@ -5459,10 +5553,19 @@ version 2005/12/01 or later. % \end{macrocode} % The command |\cline_i:nn| has two arguments. The first is the number of the % current column (it \emph{must} be used in that column). The second is a -% standard argument of |\cline| of the form \textsl{i}-\textsl{j}. +% standard argument of |\cline| of the form \textsl{i}-\textsl{j} or the form +% \textsl{i}. % \begin{macrocode} -\cs_set:Npn \@@_cline_i:nn #1 #2 { \@@_cline_i:w #1-#2 \q_stop } -\cs_set:Npn \@@_cline_i:w #1-#2-#3 \q_stop +\cs_set:Npn \@@_cline_i:nn #1 #2 { \@@_cline_i:w #1|#2- \q_stop } +\cs_set:Npn \@@_cline_i:w #1|#2-#3 \q_stop + { + \tl_if_empty:nTF { #3 } + { \@@_cline_iii:w #1|#2-#2 \q_stop } + { \@@_cline_ii:w #1|#2-#3 \q_stop } + } +\cs_set:Npn \@@_cline_ii:w #1|#2-#3-\q_stop + { \@@_cline_iii:w #1|#2-#3 \q_stop } +\cs_set:Npn \@@_cline_iii:w #1|#2-#3 \q_stop { % \end{macrocode} % Now, |#1| is the number of the current column and we have to draw a line from @@ -5934,7 +6037,7 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% The following token list will contain ce code inserted in each cell of the +% The following token list will contain the code inserted in each cell of the % current row (this token list will be cleared at the beginning of each row). % \begin{macrocode} \tl_new:N \g_@@_row_style_tl @@ -6167,6 +6270,18 @@ version 2005/12/01 or later. % \end{macrocode} % % +% \bigskip +% The following flag will be used by (for instance) |\@@_vline_ii:nnnn|. +% When |\l_@@_dotted_bool| is |true|, a dotted line (with our system) will be drawn. +% \begin{macrocode} +\bool_new:N \l_@@_dotted_bool +% \end{macrocode} +% +% \bigskip +% The following dimension will be used to trim the rules drawn in the array. +% \begin{macrocode} +\dim_new:N \l_@@_trim_dim +% \end{macrocode} % % \bigskip % \textbf{Variables for the exterior rows and columns}\par\nobreak @@ -7323,6 +7438,21 @@ version 2005/12/01 or later. } % \end{macrocode} % +% \bigskip +% For unexplained reason, with XeTeX (and not with the other engines), the +% environments of \pkg{nicematrix} were all composed in black and do not take +% into account the color of the encompassing text. As a workaround, you peek the +% color in force at the beginning of the environment and we use it now (in each +% cell of the array). +% \begin{macrocode} + \color { nicematrix } +% \end{macrocode} +% +% +% \begin{macrocode} + \g_@@_row_style_tl +% \end{macrocode} +% % We will call \emph{corners} of the matrix the cases which are at the % intersection of the exterior rows and exterior columns (of course, the four % corners doesn't always exist simultaneously). @@ -7330,7 +7460,6 @@ version 2005/12/01 or later. % The codes |\l_@@_code_for_first_row_tl| and \emph{al} don't apply in the % corners of the matrix. % \begin{macrocode} - \g_@@_row_style_tl \int_compare:nNnTF \c@iRow = 0 { \int_compare:nNnT \c@jCol > 0 @@ -7449,7 +7578,7 @@ version 2005/12/01 or later. \cs_new_protected:Npn \@@_cell_end: { \@@_math_toggle_token: - \hbox_set_end: + \hbox_set_end: % \end{macrocode} % The token list |\g_@@_post_action_cell_tl| is (potentially) set during the % composition of the box |\l_@@_cell_box| and is used now \emph{after} the @@ -7651,42 +7780,21 @@ version 2005/12/01 or later. } % \end{macrocode} % -% -% \bigskip -% We want to use |\array| of \pkg{array}. However, if the class used is -% \cls{revtex4-1} or \cls{revtex4-2}, we have to do some tuning and use the -% command |\@array@array| instead of |\array| because these classes do a -% redefinition of |\array| incompatible with our use of |\array|. -% -% \begin{macrocode} -\cs_new_protected:Npn \@@_revtex_array: - { - \cs_set_eq:NN \@acoll \@arrayacol - \cs_set_eq:NN \@acolr \@arrayacol - \cs_set_eq:NN \@acol \@arrayacol - \cs_set_nopar:Npn \@halignto { } - \@array@array - } -% \end{macrocode} % % \begin{macrocode} \cs_new_protected:Npn \@@_array: { - \bool_if:NTF \c_@@_revtex_bool - \@@_revtex_array: - { - \bool_if:NTF \l_@@_NiceTabular_bool - { \dim_set_eq:NN \col@sep \tabcolsep } - { \dim_set_eq:NN \col@sep \arraycolsep } - \dim_compare:nNnTF \l_@@_tabular_width_dim = \c_zero_dim - { \cs_set_nopar:Npn \@halignto { } } - { \cs_set_nopar:Npx \@halignto { to \dim_use:N \l_@@_tabular_width_dim } } + \bool_if:NTF \l_@@_NiceTabular_bool + { \dim_set_eq:NN \col@sep \tabcolsep } + { \dim_set_eq:NN \col@sep \arraycolsep } + \dim_compare:nNnTF \l_@@_tabular_width_dim = \c_zero_dim + { \cs_set_nopar:Npn \@halignto { } } + { \cs_set_nopar:Npx \@halignto { to \dim_use:N \l_@@_tabular_width_dim } } % \end{macrocode} % It \pkg{colortbl} is loaded, |\@tabarray| has been redefined to incorporate % |\CT@start|. % \begin{macrocode} - \@tabarray - } + \@tabarray % \end{macrocode} % |\l_@@_baseline_tl| may have the value |t|, |c| or |b|. However, if the value % is |b|, we compose the |\array| (of \pkg{array}) with the option |t| and the @@ -7840,7 +7948,14 @@ version 2005/12/01 or later. % % \begin{macrocode} \cs_new_protected:Npn \@@_pre_array_ii: - { + { +% \end{macrocode} +% For unexplained reason, with XeTeX (and not with the other engines), the +% environments of \pkg{nicematrix} were all composed in black and do not take +% into account the color of the encompassing text. As a workaround, you peek the +% color in force at the beginning of the environment and we will it in each cell. +% \begin{macrocode} + \xglobal \colorlet { nicematrix } { . } % \end{macrocode} % The number of letters |X| in the preamble of the array. % \begin{macrocode} @@ -8109,6 +8224,7 @@ version 2005/12/01 or later. % % \bigskip % \begin{macrocode} + \seq_gclear:N \g_@@_cols_vlism_seq \seq_gclear:N \g_@@_submatrix_seq % \end{macrocode} % @@ -8460,7 +8576,25 @@ version 2005/12/01 or later. } % \end{macrocode} % -% +% \begin{macrocode} +\cs_new_protected:Npn \@@_patch_for_revtex: + { + \cs_set_eq:NN \@addamp \@addamp@LaTeX + \cs_set_eq:NN \insert@column \insert@column@array + \cs_set_eq:NN \@classx \@classx@array + \cs_set_eq:NN \@xarraycr \@xarraycr@array + \cs_set_eq:NN \@arraycr \@arraycr@array + \cs_set_eq:NN \@xargarraycr \@xargarraycr@array + \cs_set_eq:NN \array \array@array + \cs_set_eq:NN \@array \@array@array + \cs_set_eq:NN \@tabular \@tabular@array + \cs_set_eq:NN \@mkpream \@mkpream@array + \cs_set_eq:NN \endarray \endarray@array + \cs_set:Npn \@tabarray { \@ifnextchar [ { \@array } { \@array [ c ] } } + \cs_set:Npn \endtabular { \endarray $\egroup} % $ + } +% \end{macrocode} +% % \bigskip % \subsection*{The environment \{NiceArrayWithDelims\}} % @@ -8468,6 +8602,7 @@ version 2005/12/01 or later. \NewDocumentEnvironment { NiceArrayWithDelims } { m m O { } m ! O { } t \CodeBefore } { + \bool_if:NT \c_@@_revtex_bool \@@_patch_for_revtex: % \end{macrocode} % % \begin{macrocode} @@ -9084,6 +9219,12 @@ version 2005/12/01 or later. ] { \@@_patch_preamble_viii:nn #1 } \} { \@@_patch_preamble_viii:nn #1 } X { \@@_patch_preamble_ix:n } +% \end{macrocode} +% When \pkg{tabularx} is loaded, a local redefinition of the specifier `X` is +% done to replace `X` by `\@@_X`. Thus, our column type `X` will be used in the +% `{NiceTabularX}`. +% \begin{macrocode} + \@@_X { \@@_patch_preamble_ix:n } \q_stop { } } { @@ -10134,7 +10275,7 @@ version 2005/12/01 or later. % We need a |{minipage}| because we will insert a LaTeX list for the tabular % notes (that means that a |\vtop{\hsize=...}| is not enough). % \begin{macrocode} - \begin { minipage } [ t ] { \box_wd:N \l_@@_the_array_box } + \begin { minipage } [ t ] { \box_wd:N \l_@@_the_array_box } % \end{macrocode} % The |\hbox| avoids that the |pgfpicture| inside |\@@_draw_blocks| adds a extra % vertical space before the notes. @@ -11007,8 +11148,28 @@ version 2005/12/01 or later. % % \bigskip % \begin{macrocode} +\cs_set_protected:Npn \@@_newcolumntype #1 + { + \cs_if_free:cT { NC @ find @ #1 } + { \NC@list \expandafter { \the \NC@list \NC@do #1 } } + \cs_set:cpn {NC @ find @ #1 } ##1 #1 { \NC@ { ##1 } } + \peek_meaning:NTF [ + { \newcol@ #1 } + { \newcol@ #1 [ 0 ] } + } +% \end{macrocode} +% +% \bigskip +% \begin{macrocode} \NewDocumentEnvironment { NiceTabularX } { m O { } m ! O { } } { +% \end{macrocode} +% The following code prevents the expansion of the `X` columns with the +% definition of that columns in \pkg{tabularx} (this would result in an error in +% |{NiceTabularX}|). +% \begin{macrocode} + \bool_if:NT \c_@@_tabularx_loaded_bool + { \newcolumntype { X } { \@@_X } } \str_gset:Nn \g_@@_name_env_str { NiceTabularX } \dim_zero_new:N \l_@@_width_dim \dim_set:Nn \l_@@_width_dim { #1 } @@ -11151,7 +11312,7 @@ version 2005/12/01 or later. % % If the option |small| is used, the values |\l_@@_radius_dim| and % |\l_@@_inter_dots_dim| (used to draw the dotted lines created by -% |\hdottedline| and |\vdotteline| and also for all the other dotted lines when +% |\hdottedline| and |\vdottedline| and also for all the other dotted lines when % |line-style| is equal to |standard|, which is the initial value) are changed. % \begin{macrocode} \bool_if:NT \l_@@_small_bool @@ -11190,24 +11351,7 @@ version 2005/12/01 or later. \@@_adjust_pos_of_blocks_seq: % \end{macrocode} % -% \bigskip -% The following code is only for efficiency. We determine whether the potential -% horizontal and vertical rules are ``complete'', that is to say drawn in the -% whole array. We are sure that all the rules will be complete when there is no -% block, no virtual block (determined by a command such as |\Cdots|, |\Vdots|, -% etc.) and no corners. In that case, we switch to a shortcut version of -% |\@@_vline_i:nn| and |\@@_hline:nn|. -% \begin{macrocode} - % \bool_lazy_all:nT - % { - % { \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_@@_corners_cells_seq } - % } - % { - % \cs_set_eq:NN \@@_vline_i:nn \@@_vline_i_complete:nn - % \cs_set_eq:NN \@@_hline_i:nn \@@_hline_i_complete:nn - % } +% \begin{macrocode} \tl_if_empty:NF \l_@@_hlines_clist \@@_draw_hlines: \tl_if_empty:NF \l_@@_vlines_clist \@@_draw_vlines: % \end{macrocode} @@ -11757,9 +11901,13 @@ version 2005/12/01 or later. \seq_gput_right:Nx \g_@@_pos_of_xdots_seq { { \int_use:N \l_@@_initial_i_int } - { \int_use:N \l_@@_initial_j_int } +% \end{macrocode} +% Be careful: with |\Iddots|, |\l_@@_final_j_int| is inferior to +% |\l_@@_initial_j_int|. That's why we use |\int_min:nn| and |\int_max:nn|. +% \begin{macrocode} + { \int_min:nn \l_@@_initial_j_int \l_@@_final_j_int } { \int_use:N \l_@@_final_i_int } - { \int_use:N \l_@@_final_j_int } + { \int_max:nn \l_@@_initial_j_int \l_@@_final_j_int } } } % \end{macrocode} @@ -12422,7 +12570,7 @@ version 2005/12/01 or later. \pgf@relevantforpicturesizefalse \tl_if_eq:NNTF \l_@@_xdots_line_style_tl \c_@@_standard_tl \@@_draw_standard_dotted_line: - \@@_draw_non_standard_dotted_line: + \@@_draw_unstandard_dotted_line: } % \end{macrocode} % @@ -12430,10 +12578,10 @@ version 2005/12/01 or later. % We have to do a special construction with |\exp_args:NV| to be able to put in % the list of options in the correct place in the Tikz instruction. % \begin{macrocode} -\cs_new_protected:Npn \@@_draw_non_standard_dotted_line: +\cs_new_protected:Npn \@@_draw_unstandard_dotted_line: { \begin { scope } - \exp_args:No \@@_draw_non_standard_dotted_line:n + \exp_args:No \@@_draw_unstandard_dotted_line:n { \l_@@_xdots_line_style_tl , \l_@@_xdots_color_tl } } % \end{macrocode} @@ -12441,11 +12589,11 @@ version 2005/12/01 or later. % in a list of options (that's why we have put diredtly |\l_@@_xdots_color_tl|). % % \smallskip -% The argument of |\@@_draw_non_standard_dotted_line:n| is, in fact, the list of options. +% The argument of |\@@_draw_unstandard_dotted_line:n| is, in fact, the list of options. % \begin{macrocode} -\cs_new_protected:Npn \@@_draw_non_standard_dotted_line:n #1 +\cs_new_protected:Npn \@@_draw_unstandard_dotted_line:n #1 { - \@@_draw_non_standard_dotted_line:nVV + \@@_draw_unstandard_dotted_line:nVV { #1 } \l_@@_xdots_up_tl \l_@@_xdots_down_tl @@ -12453,7 +12601,7 @@ version 2005/12/01 or later. % \end{macrocode} % % \begin{macrocode} -\cs_new_protected:Npn \@@_draw_non_standard_dotted_line:nnn #1 #2 #3 +\cs_new_protected:Npn \@@_draw_unstandard_dotted_line:nnn #1 #2 #3 { \draw [ @@ -12472,7 +12620,7 @@ version 2005/12/01 or later. ( \l_@@_x_final_dim , \l_@@_y_final_dim ) ; \end { scope } } -\cs_generate_variant:Nn \@@_draw_non_standard_dotted_line:nnn { n V V } +\cs_generate_variant:Nn \@@_draw_unstandard_dotted_line:nnn { n V V } % \end{macrocode} % % \bigskip @@ -13848,7 +13996,7 @@ version 2005/12/01 or later. % \smallskip % The command |\@@_OnlyMainNiceMatrix_i:n| is only a short-cut which is used % twice in the above command. This command must \emph{not} be protected. -% % \begin{macrocode} +% \begin{macrocode} \cs_new_protected:Npn \@@_OnlyMainNiceMatrix_i:n #1 { \int_compare:nNnF \c@iRow = 0 @@ -13864,8 +14012,8 @@ version 2005/12/01 or later. % The following command will be executed in the |internal-code-after|. The rule % will be drawn \emph{before} the column |#1| (that is to say on the left side). % |#2| is the number of consecutive occurrences of \verb+|+. |#3| and |#4| are -% numbers of rows that define the delimitation of the horizontal rule that we -% have to draw. If |#4| is empty, that means that the rule extends until the +% the numbers of rows that define the delimitation of the horizontal rule that +% we have to draw. If |#4| is empty, that means that the rule extends until the % last row. % \begin{macrocode} \cs_new_protected:Npn \@@_vline:nnnn #1 #2 #3 #4 @@ -13974,13 +14122,29 @@ version 2005/12/01 or later. } } % \end{macrocode} -% +% % \bigskip % |#1| is the number of the column; |#2| is the number of vertical rules to % draw (with potentially a color between); |#3| and |#4| are the numbers of the % rows between which the rule has to be drawn. % \begin{macrocode} \cs_new_protected:Npn \@@_vline_ii:nnnn #1 #2 #3 #4 + { + \bool_if:NTF \l_@@_dotted_bool + { \@@_vline_iv:nnn { #1 } { #3 } { #4 } } + { \@@_vline_iii:nnnn { #1 } { #2 } { #3 } { #4 } } + } +% \end{macrocode} +% +% \bigskip +% The following code is for the standard case (the rule which is drawn is a +% solid rule). +% +% |#1| is the number of the column; |#2| is the number of vertical rules to +% draw (with potentially a color between); |#3| and |#4| are the numbers of the +% rows between which the rule has to be drawn. +% \begin{macrocode} +\cs_new_protected:Npn \@@_vline_iii:nnnn #1 #2 #3 #4 { \pgfrememberpicturepositiononpagetrue \pgf@relevantforpicturesizefalse @@ -13993,7 +14157,7 @@ version 2005/12/01 or later. \bool_lazy_all:nT { { \int_compare_p:nNn { #2 } > 1 } - { \cs_if_exist_p:N \CT@drsc@ } % condition added in version 5.18a + { \cs_if_exist_p:N \CT@drsc@ } { ! \tl_if_blank_p:V \CT@drsc@ } } { @@ -14025,16 +14189,29 @@ version 2005/12/01 or later. } % \end{macrocode} % +% % \bigskip -% The following command draws a complete vertical rule in the column |#1| (|#2| -% is the number of consecutive rules specified by the number of \verb+|+ in the -% preamble). This command will be used if there is no block in the array (and -% the key |corners| is not used). +% The following code is for the case of a dotted rule (with our system). +% +% |#1| is the number of the column; |#2| and |#3| are the numbers of the +% rows between which the rule has to be drawn. % \begin{macrocode} -\cs_new_protected:Npn \@@_vline_i_complete:nn #1 #2 - { \@@_vline_ii:nnnn { #1 } { #2 } 1 { \int_use:N \c@iRow } } +\cs_new_protected:Npn \@@_vline_iv:nnn #1 #2 #3 + { + \pgfrememberpicturepositiononpagetrue + \pgf@relevantforpicturesizefalse + \@@_qpoint:n { col - #1 } + \dim_set_eq:NN \l_@@_x_initial_dim \pgf@x + \dim_set_eq:NN \l_@@_x_final_dim \pgf@x + \@@_qpoint:n { row - #2 } + \dim_set_eq:NN \l_@@_y_initial_dim \pgf@y + \@@_qpoint:n { row - \@@_succ:n { #3 } } + \dim_set_eq:NN \l_@@_y_final_dim \pgf@y + \@@_draw_line: + } % \end{macrocode} % +% % \bigskip % The command |\@@_draw_vlines:| draws all the vertical rules excepted in the % blocks, in the virtual blocks (determined by a command such as |\Cdots|) and in @@ -14169,13 +14346,23 @@ version 2005/12/01 or later. } } % \end{macrocode} -% +% +% \bigskip +% \begin{macrocode} +\cs_new_protected:Npn \@@_hline_ii:nnnn #1 #2 #3 #4 + { + \bool_if:NTF \l_@@_dotted_bool + { \@@_hline_iv:nnn { #1 } { #3 } { #4 } } + { \@@_hline_iii:nnnn { #1 } { #2 } { #3 } { #4 } } + } +% \end{macrocode} +% % \bigskip % |#1| is the number of the row; |#2| is the number of horizontal rules to % draw (with potentially a color between); |#3| and |#4| are the number of the % columns between which the rule has to be drawn. % \begin{macrocode} -\cs_new_protected:Npn \@@_hline_ii:nnnn #1 #2 #3 #4 +\cs_new_protected:Npn \@@_hline_iii:nnnn #1 #2 #3 #4 { \pgfrememberpicturepositiononpagetrue \pgf@relevantforpicturesizefalse @@ -14188,7 +14375,7 @@ version 2005/12/01 or later. \bool_lazy_all:nT { { \int_compare_p:nNn { #2 } > 1 } - { \cs_if_exist_p:N \CT@drsc@ } % condition added in version 6.0 + { \cs_if_exist_p:N \CT@drsc@ } { ! \tl_if_blank_p:V \CT@drsc@ } } { @@ -14219,14 +14406,92 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip +% The following code is for the case of a dotted rule (with our system of +% rounded dots). +% The aim is that, by standard the dotted line fits between square brackets +% (|\hline| doesn't). +% +% \smallskip +% \begin{BVerbatim}[baseline=c,boxwidth=10cm] +% \begin{bNiceMatrix} +% 1 & 2 & 3 & 4 \\ +% \hline +% 1 & 2 & 3 & 4 \\ +% \hdottedline +% 1 & 2 & 3 & 4 +% \end{bNiceMatrix} +% \end{BVerbatim} +% $\begin{bNiceMatrix} +% 1 & 2 & 3 & 4 \\ +% \hline +% 1 & 2 & 3 & 4 \\ +% \hdottedline +% 1 & 2 & 3 & 4 +% \end{bNiceMatrix}$ +% +% \smallskip +% But, if the user uses |margin|, the dotted line extends to have the same width +% as a |\hline|. +% +% \smallskip +% \begin{BVerbatim}[baseline=c,boxwidth=10cm] +% \begin{bNiceMatrix}[margin] +% 1 & 2 & 3 & 4 \\ +% \hline +% 1 & 2 & 3 & 4 \\ +% \hdottedline +% 1 & 2 & 3 & 4 +% \end{bNiceMatrix} +% \end{BVerbatim} +% $\begin{bNiceMatrix}[margin] +% 1 & 2 & 3 & 4 \\ +% \hline +% 1 & 2 & 3 & 4 \\ +% \hdottedline +% 1 & 2 & 3 & 4 +% \end{bNiceMatrix}$ +% % \begin{macrocode} -\cs_new_protected:Npn \@@_hline_i_complete:nn #1 #2 - { \@@_hline_ii:nnnn { #1 } { #2 } 1 { \int_use:N \c@jCol } } +\cs_new_protected:Npn \@@_hline_iv:nnn #1 #2 #3 + { + \pgfrememberpicturepositiononpagetrue + \pgf@relevantforpicturesizefalse + \@@_qpoint:n { row - #1 } + \dim_set_eq:NN \l_@@_y_initial_dim \pgf@y + \dim_set_eq:NN \l_@@_y_final_dim \pgf@y + \@@_qpoint:n { col - #2 } + \dim_set_eq:NN \l_@@_x_initial_dim \pgf@x + \int_compare:nNnT { #2 } = 1 + { + \dim_sub:Nn \l_@@_x_initial_dim \l_@@_left_margin_dim + \bool_if:NT \l_@@_NiceArray_bool + { \dim_sub:Nn \l_@@_x_initial_dim \arraycolsep } % \end{macrocode} -% +% For reasons purely aesthetic, we do an adjustment in the case of a rounded +% bracket. The correction by |0.5 \l_@@_inter_dots_dim| is \emph{ad hoc} for a +% better result. +% \begin{macrocode} + \tl_if_eq:NnF \g_@@_left_delim_tl ( + { \dim_add:Nn \l_@@_x_initial_dim { 0.5 \l_@@_inter_dots_dim } } + } + \@@_qpoint:n { col - \@@_succ:n { #3 } } + \dim_set_eq:NN \l_@@_x_final_dim \pgf@x + \int_compare:nNnT { #3 } = \c@jCol + { + \dim_add:Nn \l_@@_x_final_dim \l_@@_right_margin_dim + \bool_if:NT \l_@@_NiceArray_bool + { \dim_add:Nn \l_@@_x_final_dim \arraycolsep } + \tl_if_eq:NnF \g_@@_right_delim_tl ) + { \dim_gsub:Nn \l_@@_x_final_dim { 0.5 \l_@@_inter_dots_dim } } + } + \@@_draw_line: + } +% \end{macrocode} +% +% % \bigskip % The command |\@@_draw_hlines:| draws all the horizontal rules excepted in the -% blocks (even the virtual drawn determined by commands such as |\Cdots| and in +% blocks (even the virtual blocks determined by commands such as |\Cdots| and in % the corners (if the key |corners| is used). % \begin{macrocode} \cs_new_protected:Npn \@@_draw_hlines: @@ -14578,129 +14843,12 @@ version 2005/12/01 or later. % that will actually draw the dotted line. Its argument is the number of the row % \emph{before} which we will draw the row. % \begin{macrocode} -\AtBeginDocument - { -% \end{macrocode} -% We recall that, when externalization is used, |\tikzpicture| and -% |\endtikzpicture| (or |\pgfpicture| and |\endpgfpicture|) must be directly -% ``visible''. That's why we construct now a version of |\@@_hdottedline:n| with -% the right environment (|\begin{pgfpicture}\end{pgfpicture}| or -% |\begin{tikzpiture}...\end{tikzpicture}|). -% \begin{macrocode} - \cs_new_protected:Npx \@@_hdottedline:n #1 - { - \bool_set_true:N \exp_not:N \l_@@_initial_open_bool - \bool_set_true:N \exp_not:N \l_@@_final_open_bool - \c_@@_pgfortikzpicture_tl - \@@_hdottedline_i:n { #1 } - \c_@@_endpgfortikzpicture_tl - } - } -% \end{macrocode} -% -% The following command \emph{must} be protected since it is used in the -% construction of |\@@_hdottedline:n|. -% \begin{macrocode} -\cs_new_protected:Npn \@@_hdottedline_i:n #1 +\cs_new_protected:Npn \@@_hdottedline:n #1 { - \pgfrememberpicturepositiononpagetrue - \@@_qpoint:n { row - #1 } -% \end{macrocode} -% We do a translation par |-\l_@@_radius_dim| because we want the dotted line to -% have exactly the same position as a vertical rule drawn by ``"|"'' -% (considering the rule having a width equal to the diameter of the dots). -% \begin{macrocode} - \dim_set_eq:NN \l_@@_y_initial_dim \pgf@y - \dim_sub:Nn \l_@@_y_initial_dim \l_@@_radius_dim - \dim_set_eq:NN \l_@@_y_final_dim \l_@@_y_initial_dim -% \end{macrocode} -% -% \medskip -% The dotted line will be extended if the user uses |margin| (or |left-margin| -% and |right-margin|). -% -% \smallskip -% The aim is that, by standard the dotted line fits between square brackets -% (|\hline| doesn't). -% -% \smallskip -% \begin{BVerbatim}[baseline=c,boxwidth=10cm] -% \begin{bNiceMatrix} -% 1 & 2 & 3 & 4 \\ -% \hline -% 1 & 2 & 3 & 4 \\ -% \hdottedline -% 1 & 2 & 3 & 4 -% \end{bNiceMatrix} -% \end{BVerbatim} -% $\begin{bNiceMatrix} -% 1 & 2 & 3 & 4 \\ -% \hline -% 1 & 2 & 3 & 4 \\ -% \hdottedline -% 1 & 2 & 3 & 4 -% \end{bNiceMatrix}$ -% -% \smallskip -% But, if the user uses |margin|, the dotted line extends to have the same width -% as a |\hline|. -% -% \smallskip -% \begin{BVerbatim}[baseline=c,boxwidth=10cm] -% \begin{bNiceMatrix}[margin] -% 1 & 2 & 3 & 4 \\ -% \hline -% 1 & 2 & 3 & 4 \\ -% \hdottedline -% 1 & 2 & 3 & 4 -% \end{bNiceMatrix} -% \end{BVerbatim} -% $\begin{bNiceMatrix}[margin] -% 1 & 2 & 3 & 4 \\ -% \hline -% 1 & 2 & 3 & 4 \\ -% \hdottedline -% 1 & 2 & 3 & 4 -% \end{bNiceMatrix}$ -% -% \medskip -% \begin{macrocode} - \@@_qpoint:n { col - 1 } - \dim_set:Nn \l_@@_x_initial_dim - { - \pgf@x + -% \end{macrocode} -% 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 - - \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 - + \l_@@_right_margin_dim - } -% \end{macrocode} -% For reasons purely aesthetic, we do an adjustment in the case of a rounded -% bracket. The correction by |0.5 \l_@@_inter_dots_dim| is \emph{ad hoc} for a -% better result. -% \begin{macrocode} - \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 \g_@@_right_delim_tl ) - { \dim_gsub:Nn \l_@@_x_final_dim { 0.5 \l_@@_inter_dots_dim } } -% \end{macrocode} -% -% \medskip -% Up to now, we have no option to control the style of the lines drawn by -% |\hdottedline| and the specifier ``|:|'' in the preamble. That's why we impose -% the style |standard|. -% \begin{macrocode} - \tl_set_eq:NN \l_@@_xdots_line_style_tl \c_@@_standard_tl - \@@_draw_line: + \group_begin: + \bool_set_true:N \l_@@_dotted_bool + \@@_hline:nnnn { #1 } { 1 } { 1 } { \int_use:N \c@jCol } + \group_end: } % \end{macrocode} % @@ -14713,66 +14861,13 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_vdottedline:n #1 { - \bool_set_true:N \l_@@_initial_open_bool - \bool_set_true:N \l_@@_final_open_bool -% \end{macrocode} -% We recall that, when externalization is used, |\tikzpicture| and -% |\endtikzpicture| (or |\pgfpicture| and |\endpgfpicture|) must be directly -% ``visible''. -% \begin{macrocode} - \bool_if:NTF \c_@@_tikz_loaded_bool - { - \tikzpicture - \@@_vdottedline_i:n { #1 } - \endtikzpicture - } - { - \pgfpicture - \@@_vdottedline_i:n { #1 } - \endpgfpicture - } - } -% \end{macrocode} -% -% \medskip -% \begin{macrocode} -\cs_new_protected:Npn \@@_vdottedline_i:n #1 - { -% \end{macrocode} -% The command |\CT@arc@| is a command of \pkg{colortbl} which sets the color of -% the rules in the array. The package \pkg{nicematrix} uses it even if \pkg{colortbl} is not -% loaded. -% \begin{macrocode} - \CT@arc@ - \pgfrememberpicturepositiononpagetrue - \@@_qpoint:n { col - \int_eval:n { #1 + 1 } } -% \end{macrocode} -% We do a translation par |-\l_@@_radius_dim| because we want the dotted line to -% have exactly the same position as a vertical rule drawn by ``"|"'' -% (considering the rule having a width equal to the diameter of the dots). -% \begin{macrocode} - \dim_set:Nn \l_@@_x_initial_dim { \pgf@x - \l_@@_radius_dim } - \dim_set:Nn \l_@@_x_final_dim { \pgf@x - \l_@@_radius_dim } - \@@_qpoint:n { row - 1 } -% \end{macrocode} -% We arbitrary decrease the height of the dotted line by a quantity equal to -% |\l_@@_inter_dots_dim| in order to improve the visual impact. -% \begin{macrocode} - \dim_set:Nn \l_@@_y_initial_dim { \pgf@y - 0.5 \l_@@_inter_dots_dim } - \@@_qpoint:n { row - \@@_succ:n \c@iRow } - \dim_set:Nn \l_@@_y_final_dim { \pgf@y + 0.5 \l_@@_inter_dots_dim } -% \end{macrocode} -% Up to now, we have no option to control the style of the lines drawn by -% |\hdottedline| and the specifier ``|:|'' in the preamble. That's why we impose -% the style |standard|. -% \begin{macrocode} - \tl_set_eq:NN \l_@@_xdots_line_style_tl \c_@@_standard_tl - \@@_draw_line: + \group_begin: + \bool_set_true:N \l_@@_dotted_bool + \@@_vline:nnnn { \int_eval:n { #1 + 1 } } { 1 } { 1 } { \int_use:N \c@iRow } + \group_end: } % \end{macrocode} % -% -% % \bigskip % \subsection*{The environment \{NiceMatrixBlock\}} % @@ -15233,7 +15328,7 @@ version 2005/12/01 or later. % |<| and |>|. It's mandatory to use an expandable command. % % \begin{macrocode} -\NewExpandableDocumentCommand \@@_Block: { O { } m D < > { } m } +\NewExpandableDocumentCommand \@@_Block: { O { } m D < > { } +m } { % \end{macrocode} % If the first mandatory argument of the command (which is the size of the block @@ -15399,7 +15494,7 @@ version 2005/12/01 or later. \int_compare:nNnT { #1 } = 1 \g_@@_row_style_tl \group_begin: \cs_set:Npn \arraystretch { 1 } - \dim_set_eq:NN \extrarowheight \c_zero_dim + \dim_zero:N \extrarowheight #4 % \end{macrocode} % If the box is rotated (the key |\rotate| may be in the previous |#4|), the @@ -15419,7 +15514,7 @@ version 2005/12/01 or later. % When the block is mono-column in a column with a fixed width (eg |p{3cm}|). % \begin{macrocode} { - \begin { minipage } [ l_@@_vpos_of_block_tl ] + \begin { minipage } [ \l_@@_vpos_of_block_tl ] { \l_@@_col_width_dim } \str_case:Vn \l_@@_hpos_block_str { @@ -15539,7 +15634,7 @@ version 2005/12/01 or later. { \group_begin: \cs_set:Npn \arraystretch { 1 } - \dim_set_eq:NN \extrarowheight \c_zero_dim + \dim_zero:N \extrarowheight #4 % \end{macrocode} % If the box is rotated (the key |\rotate| may be in the previous |#4|), the @@ -15563,7 +15658,7 @@ version 2005/12/01 or later. { \group_begin: \cs_set:Npn \arraystretch { 1 } - \dim_set_eq:NN \extrarowheight \c_zero_dim + \dim_zero:N \extrarowheight #4 \bool_if:NT \g_@@_rotate_bool { \str_set:Nn \l_@@_hpos_block_str c } @@ -16949,7 +17044,7 @@ version 2005/12/01 or later. \l_@@_y_initial_dim - \l_@@_y_final_dim + \l_@@_submatrix_extra_height_dim - \arrayrulewidth } - \dim_set_eq:NN \nulldelimiterspace \c_zero_dim + \dim_zero:N \nulldelimiterspace % \end{macrocode} % % \bigskip diff --git a/macros/latex/contrib/nicematrix/nicematrix.pdf b/macros/latex/contrib/nicematrix/nicematrix.pdf index 026c149a49..eddc836218 100644 Binary files a/macros/latex/contrib/nicematrix/nicematrix.pdf and b/macros/latex/contrib/nicematrix/nicematrix.pdf differ diff --git a/macros/latex/contrib/siunitx/CHANGELOG.md b/macros/latex/contrib/siunitx/CHANGELOG.md index 614260e845..f12b69375b 100644 --- a/macros/latex/contrib/siunitx/CHANGELOG.md +++ b/macros/latex/contrib/siunitx/CHANGELOG.md @@ -7,6 +7,21 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to ## [Unreleased] +## [v3.0.30] + +### Changed +- Delay selection of math mode to better support `tex4ht` (issue + [#530](https://github.com/josephwright/siunitx/issues/530)) + +### Fixed +- Ensure that units contain `\text` are correctly formatted when printing + in math mode (issue + [#542](https://github.com/josephwright/siunitx/issues/542)) +- Use `\ExplLoaderFileDate` to test for `expl3` version (issue + [#544](https://github.com/josephwright/siunitx/issues/544)) +- Apply number processing options to angles (issue + [#546](https://github.com/josephwright/siunitx/issues/546)) + ## [v3.0.29] ### Fixed @@ -1564,7 +1579,8 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to ### Added - First public testing release (as `si`) -[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.0.29...HEAD +[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.0.30...HEAD +[v3.0.30]: https://github.com/josephwright/siunitx/compare/v3.0.29...v3.0.30 [v3.0.29]: https://github.com/josephwright/siunitx/compare/v3.0.28...v3.0.29 [v3.0.28]: https://github.com/josephwright/siunitx/compare/v3.0.27...v3.0.28 [v3.0.27]: https://github.com/josephwright/siunitx/compare/v3.0.26...v3.0.27 diff --git a/macros/latex/contrib/siunitx/siunitx-angle.dtx b/macros/latex/contrib/siunitx/siunitx-angle.dtx index a3d4608067..9d9a2ac753 100644 --- a/macros/latex/contrib/siunitx/siunitx-angle.dtx +++ b/macros/latex/contrib/siunitx/siunitx-angle.dtx @@ -248,6 +248,7 @@ { \exp_args:Ne \@@_arc_convert:n { \fp_eval:n {#1} } } { \siunitx_number_parse:nN {#1} \l_@@_degrees_tl + \siunitx_number_process:NN \l_@@_degrees_tl \l_@@_degrees_tl \tl_set:Nx \l_@@_degrees_tl { \siunitx_number_output:NN \l_@@_degrees_tl \q_nil } \@@_arc_print:VVV @@ -349,6 +350,8 @@ { \tl_if_empty:cF { l_@@_ ##1 _tl } { + \exp_args:Ncc \siunitx_number_process:NN + { l_@@_ ##1 _tl } { l_@@_ ##1 _tl } \tl_set:cx { l_@@_ ##1 _tl } { \exp_args:Nc \siunitx_number_output:NN diff --git a/macros/latex/contrib/siunitx/siunitx-code.pdf b/macros/latex/contrib/siunitx/siunitx-code.pdf index e674520e65..9a8ebfd7c0 100644 Binary files a/macros/latex/contrib/siunitx/siunitx-code.pdf and b/macros/latex/contrib/siunitx/siunitx-code.pdf differ diff --git a/macros/latex/contrib/siunitx/siunitx-print.dtx b/macros/latex/contrib/siunitx/siunitx-print.dtx index 5b14aa123b..05ba3d64ea 100644 --- a/macros/latex/contrib/siunitx/siunitx-print.dtx +++ b/macros/latex/contrib/siunitx/siunitx-print.dtx @@ -303,10 +303,15 @@ % % \subsection{Initial set up} % -% The printing routines depend on \pkg{amstext} for text mode working. +% \begin{macro}{\@@_ams_text:n} +% The printing routines depend on \pkg{amstext} for text mode working. +% We also save the definition of \cs{text} here to use it internally, as the +% nature of the \emph{document} command may need to vary. % \begin{macrocode} \RequirePackage { amstext } +\cs_new_eq:NN \@@_ams_text:n \text % \end{macrocode} +% \end{macro} % % Color support is always required. % \begin{macrocode} @@ -511,6 +516,12 @@ % \end{macrocode} % \end{variable} % +% \begin{variable}{\l_@@_math_html_tl} +% \begin{macrocode} +\tl_new:N \l_@@_math_html_tl +% \end{macrocode} +% \end{variable} +% % \begin{macro}{\siunitx_print_math:n} % \begin{macro}[EXP]{\@@_extract_series:Nw} % \begin{macro}[EXP]{\@@_convert_series:n, \@@_convert_series:v} @@ -519,15 +530,20 @@ % { % \@@_math_auxi:n, % \@@_math_auxii:n, +% } +% \begin{macro}{\@@_math_replace:Nn} +% \begin{macro} +% { % \@@_math_auxiii:n, % \@@_math_auxiv:n, % \@@_math_auxv:n % } -% \begin{macro}{\@@_math_aux:N} -% \begin{macro}{\@@_math_aux:w} -% \begin{macro}{\@@_math_aux:Nn, \@@_math_aux:cn} +% \begin{macro}{\@@_math_auxvi:Nn} +% \begin{macro}{\@@_math_auxvii:N} +% \begin{macro}{\@@_math_auxviii:w} +% \begin{macro}{\@@_math_auxix:Nn} % \begin{macro}{\@@_math_sub:n, \@@_math_super:n, \@@_math_script:n} -% \begin{macro}{\@@_math_text:n} +% \begin{macro}{\@@_math_ensure:n} % The first step in setting in math mode is to check on the math version. % The starting point is the question of whether text series needs to % propagate to math mode: if so, check on the mapping, otherwise check on @@ -603,7 +619,25 @@ % commands have different |\long| status. % \begin{macrocode} \cs_new_protected:Npn \@@_math_auxii:n #1 - { \ensuremath { \@@_math_auxiii:n {#1} } } + { + \group_begin: + \cs_set_protected:Npn \text ##1 + { + \cs_set_eq:NN \text \@@_ams_text:n + \siunitx_print_text:n {##1} + } + \tl_set:Nn \l_@@_tmp_tl {#1} + \exp_after:wN \@@_math_replace:Nn + \l_@@_math_html_tl + \q_recursion_tail { } \q_recursion_stop + \exp_args:NV \@@_math_auxiii:n \l_@@_tmp_tl + \group_end: + } +\cs_new_protected:Npn \@@_math_replace:Nn #1#2 + { + \quark_if_recursion_tail_stop:N #1 + \tl_replace_all:Nnn \l_@@_tmp_tl {#1} {#2} + } \cs_new_protected:Npn \@@_math_auxiii:n #1 { \bool_if:NTF \l_@@_math_family_bool @@ -611,8 +645,8 @@ \str_case_e:nnF { \f@family } { { \rmdefault } { \@@_math_auxv:n } - { \sfdefault } { \@@_math_aux:Nn \mathsf } - { \ttdefault } { \@@_math_aux:Nn \mathtt } + { \sfdefault } { \@@_math_auxix:Nn \mathsf } + { \ttdefault } { \@@_math_auxix:Nn \mathtt } } { \@@_math_auxiv:n } } @@ -630,7 +664,7 @@ { \bool_if:NTF \l_@@_math_font_bool { - \@@_math_aux:N + \@@_math_auxvii:N \mathbf \mathit \mathsf \mathtt \q_recursion_tail \q_recursion_stop } @@ -642,28 +676,30 @@ \bool_lazy_or:nnTF { \int_compare_p:nNn \fam = { -1 } } { \int_compare_p:nNn \fam = \symoperators } - { \use:n } - { \mathrm } + { \@@_math_ensure:n } + { \@@_math_auxvi:Nn \mathrm } {#1} } -\cs_new_protected:Npn \@@_math_aux:N #1 +\cs_new_protected:Npn \@@_math_auxvi:Nn #1#2 + { \@@_math_ensure:n { #1 {#2} } } +\cs_new_protected:Npn \@@_math_auxvii:N #1 { - \quark_if_recursion_tail_stop_do:Nn #1 { \use:n } - \exp_after:wN \exp_after:wN \exp_after:wN \@@_math_aux:w + \quark_if_recursion_tail_stop_do:Nn #1 { \@@_math_auxv:n } + \exp_after:wN \exp_after:wN \exp_after:wN \@@_math_auxviii:w \cs:w \cs_to_str:N #1 \c_space_tl \cs_end: \use@mathgroup ? { -2 } \q_stop #1 } -\cs_new_protected:Npn \@@_math_aux:w #1 \use@mathgroup #2#3 #4 \q_stop #5 +\cs_new_protected:Npn \@@_math_auxviii:w #1 \use@mathgroup #2#3 #4 \q_stop #5 { \int_compare:nNnTF \fam = {#3} - { \use_i_delimit_by_q_recursion_stop:nw { \@@_math_aux:Nn #5 } } - { \@@_math_aux:N } + { \use_i_delimit_by_q_recursion_stop:nw { \@@_math_auxix:Nn #5 } } + { \@@_math_auxvii:N } } % \end{macrocode} % Search-and-replace fun: deal with any font commands in the argument and % also inside sub/superscripts. % \begin{macrocode} -\cs_new_protected:Npx \@@_math_aux:Nn #1#2 +\cs_new_protected:Npx \@@_math_auxix:Nn #1#2 { \group_begin: \tl_set:Nn \exp_not:N \l_@@_tmp_tl {#2} @@ -674,10 +710,10 @@ \tl_replace_all:Nnn \exp_not:N \l_@@_tmp_tl { ^ } { \exp_not:N \@@_math_super:n } - #1 { \exp_not:N \tl_use:N \exp_not:N \l_@@_tmp_tl } + \exp_not:N \exp_args:NNV \@@_math_auxvi:Nn + #1 \exp_not:N \l_@@_tmp_tl \group_end: } -\cs_generate_variant:Nn \@@_math_aux:Nn { c } \cs_new_protected:Npx \@@_math_sub:n #1 { \char_generate:nn { `\_ } { 8 } @@ -693,23 +729,23 @@ \tl_use:N \l_@@_tmp_tl \group_end: } +\cs_new_protected:Npn \@@_math_ensure:n #1 + { + \tl_if_blank:nF {#1} + { + \mode_if_math:TF + {#1} + { $ #1 $ } + } + } % \end{macrocode} % For \pkg{tex4ht}, we need to have category code $12$ |^| tokens in math -% mode. We handle that by intercepting at the first auxiliary that makes -% sense. +% mode. % \begin{macrocode} \AtBeginDocument { \@ifpackageloaded { tex4ht } - { - \cs_set_protected:Npn \@@_math_auxii:n #1 - { - \tl_set:Nn \l_@@_tmp_tl {#1} - \exp_args:NNnx \tl_replace_all:Nnn \l_@@_tmp_tl - { ^ } { \token_to_str:N ^ } - \ensuremath { \exp_args:NV \@@_math_auxiii:n \l_@@_tmp_tl } - } - } + { \tl_set:Nx \l_@@_math_html_tl { ^ { \token_to_str:N ^ } } } { } } % \end{macrocode} @@ -723,6 +759,9 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}{\siunitx_print_text:n} % \begin{macro}{\@@_text_replace:n} diff --git a/macros/latex/contrib/siunitx/siunitx.dtx b/macros/latex/contrib/siunitx/siunitx.dtx index 1269e5ff90..45534b9996 100644 --- a/macros/latex/contrib/siunitx/siunitx.dtx +++ b/macros/latex/contrib/siunitx/siunitx.dtx @@ -97,7 +97,7 @@ % Load only the essential support (\pkg{expl3}) \enquote{up-front}, and % only if required. % \begin{macrocode} -\@ifundefined{ExplFileDate} +\@ifundefined{ExplLoaderFileDate} {\RequirePackage{expl3}} {} % \end{macrocode} @@ -106,7 +106,7 @@ % We use \cs{ExplFileDate} as \cs{@ifpackagelater} doesn't work for pre-loaded % \pkg{expl3} in the absence of the package. % \begin{macrocode} -\@ifl@t@r\ExplFileDate{2020-01-09} +\@ifl@t@r\ExplLoaderFileDate{2020-01-09} {} {% \PackageError{siunitx}{Support package expl3 too old} @@ -121,7 +121,7 @@ % % Identify the package and give the over all version information. % \begin{macrocode} -\ProvidesExplPackage {siunitx} {2021-09-06} {3.0.29} +\ProvidesExplPackage {siunitx} {2021-09-14} {3.0.30} {A comprehensive (SI) units package} % \end{macrocode} % diff --git a/macros/latex/contrib/siunitx/siunitx.pdf b/macros/latex/contrib/siunitx/siunitx.pdf index 6f9ceb00c1..171b0a74b5 100644 Binary files a/macros/latex/contrib/siunitx/siunitx.pdf and b/macros/latex/contrib/siunitx/siunitx.pdf differ diff --git a/macros/latex/contrib/siunitx/siunitx.tex b/macros/latex/contrib/siunitx/siunitx.tex index 95cad5ca88..b05cd68fc9 100644 --- a/macros/latex/contrib/siunitx/siunitx.tex +++ b/macros/latex/contrib/siunitx/siunitx.tex @@ -297,8 +297,12 @@ Simple lists and ranges of numbers can be handled. \qtyrange{0.13}{0.67}{\milli\metre} \end{LaTeXdemo} -By default, all text is typeset in the current upright math font. This can be -changed by setting the appropriate options. +A wide range of options are available to control the behavior of the package. +For example, with the standard settings all text is typeset in the current +upright math font. This can be adjusted to use text mode, follow various +aspects of the surrounding formatting, \foreign{etc}. Similarly, the standard +settings are based around an English-speaking locale, but can be adjusted +to follow the traditions of other areas. \section{Using the \pkg{siunitx} package} @@ -1490,7 +1494,7 @@ of figures), before rounding the main value to follow. \num{0.12345(23)} \\ \num{0.12345(234)} \end{LaTeXdemo} -Rounding my \enquote{extend} a short number to more digits (or figures): this +Rounding may \enquote{extend} a short number to more digits (or figures): this is controlled by the switch \opt{round-pad}, which is \opt{true} as standard. \begin{LaTeXdemo} \sisetup{round-mode = figures, round-precision = 4}% -- cgit v1.2.3