diff options
author | Karl Berry <karl@freefriends.org> | 2020-06-08 21:19:40 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-06-08 21:19:40 +0000 |
commit | e9ed0e389f6e19960cd4940c4beed10583f4c32a (patch) | |
tree | d4a5404dd7ac0fc97d61d805b17f3be89f76725f /Master/texmf-dist/source | |
parent | 2453da40125221dbdd1b69cbcca473fab6f1f70d (diff) |
nicematrix (8jun20)
git-svn-id: svn://tug.org/texlive/trunk@55484 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx | 117 |
1 files changed, 42 insertions, 75 deletions
diff --git a/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx b/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx index 7e220667699..e957be5dc92 100644 --- a/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx +++ b/Master/texmf-dist/source/latex/nicematrix/nicematrix.dtx @@ -15,8 +15,8 @@ % % \fi % \iffalse -\def\myfileversion{4.1} -\def\myfiledate{2020/05/27} +\def\myfileversion{4.2} +\def\myfiledate{2020/06/07} % % %<*batchfile> @@ -825,7 +825,7 @@ version 2005/12/01 or later. % h & i & j \\ \hline % \end{NiceTabular} % \end{BVerbatim} -% \begin{NiceTabular}{|C|C|C|}[hvlines, code-before = +% \begin{NiceTabular}{|C|C|C|}[code-before = % \cellcolor{red!15}{3-1,2-2,1-3}] % \hline % a & b & c \\ \hline @@ -851,7 +851,7 @@ version 2005/12/01 or later. % h & i & j \\ \hline % \end{NiceTabular} % \end{BVerbatim} -% \begin{NiceTabular}{|C|C|C|}[hvlines, code-before = +% \begin{NiceTabular}{|C|C|C|}[code-before = % \rectanglecolor{blue!15}{2-2}{3-3}] % \hline % a & b & c \\ \hline @@ -2346,7 +2346,7 @@ version 2005/12/01 or later. % % \bigskip % \begin{minipage}[c]{7.6cm} -% Here is a array composed with the following code: +% Here is an array composed with the following code: % % \medskip % \begin{BVerbatim} @@ -3424,23 +3424,6 @@ version 2005/12/01 or later. % \end{macrocode} % % -% \medskip -% The version of 2020/02/08 of \pkg{expl3} has replaced |\l_keys_key_tl| by -% |\l_keys_key_str|. We have immediately changed in this file. Now, you test the -% existence of |\l_keys_key_str| in order to detect whether the version of LaTeX -% used by the final user is up to date. -% \begin{macrocode} -\msg_new:nnn { nicematrix } { expl3~too~old } - { - Your~version~of~LaTeX~(especially~expl3)~is~too~old.~ - You~can~go~on~but~you~will~probably~have~other~errors~ - if~you~use~the~functionalities~of~nicematrix. - } -\cs_if_exist:NF \l_keys_key_str - { \msg_error:nn { nicematrix } { expl3~too~old } } -% \end{macrocode} -% -% % \bigskip % The command for the treatment of the options of |\usepackage| is at the end of % this package for technical reasons. @@ -3571,8 +3554,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_set_protected:Npn \pgfutil@check@rerun ##1 ##2 { - \str_set:Nx \l_tmpa_str { \tl_range:nnn { ##1 } 1 3 } - \str_if_eq:VnF \l_tmpa_str { nm- } + \str_if_eq:eeF { nm- } { \tl_range:nnn { ##1 } 1 3 } { \@@_old_pgfutil@check@rerun { ##1 } { ##2 } } } } @@ -3646,9 +3628,9 @@ version 2005/12/01 or later. \cs_set:Npn \@@_cline % \end{macrocode} % We have to act in a fully expandable way since there may be |\noalign| (in the -% |\multispan|) to detect. That's why we use |\exp_arg:Ne| and not |\exp_arg:Nx|. +% |\multispan|) to detect. That's why we use |\@@_cline_i:en|. % \begin{macrocode} - { \exp_args:Ne \@@_cline_i:nn \l_@@_first_col_int } + { \@@_cline_i:en \l_@@_first_col_int } % \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 @@ -3670,11 +3652,10 @@ version 2005/12/01 or later. % several |\cline|). % \begin{macrocode} \peek_meaning_remove_ignore_spaces:NTF \cline - { & \exp_args:Ne \@@_cline_i:nn { \@@_succ:n { #3 } } } + { & \@@_cline_i:en { \@@_succ:n { #3 } } } { \everycr { } \cr } } - - +\cs_generate_variant:Nn \@@_cline_i:nn { e n } % \end{macrocode} % % \bigskip @@ -5561,6 +5542,12 @@ version 2005/12/01 or later. % \begin{macrocode} \NewDocumentEnvironment { NiceArrayWithDelims } { m m O { } m ! O { } } { +% \end{macrocode} +% The aim of the following |\bgroup| (the corresponding |\egroup| is, of course, +% at the end of the environment) is to be able to put an exposant to a matrix in +% a mathematical formula. +% \begin{macrocode} + \bgroup \tl_set:Nn \l_@@_left_delim_tl { #1 } \tl_set:Nn \l_@@_right_delim_tl { #2 } \bool_gset_false:N \g_@@_row_of_col_done_bool @@ -6111,7 +6098,7 @@ version 2005/12/01 or later. % \begin{macrocode} \bool_if:NTF \l_@@_max_delimiter_width_bool { \@@_put_box_in_flow_bis:nn { #1 } { #2 } } - \@@_put_box_in_flow: + \@@_put_box_in_flow: } % \end{macrocode} % @@ -6125,6 +6112,7 @@ version 2005/12/01 or later. \skip_horizontal:N \arraycolsep } \@@_after_array: + \egroup } % \end{macrocode} % This is the end of the environment |{NiceArrayWithDelims}|. @@ -6142,7 +6130,7 @@ version 2005/12/01 or later. \box_set_ht:Nn \l_tmpa_box { \box_ht:N \l_tmpa_box + \l_tmpa_dim } \box_set_dp:Nn \l_tmpa_box { \box_dp:N \l_tmpa_box + \l_tmpb_dim } \str_if_eq:VnTF \l_@@_baseline_str { c } - { \box_use_drop:N \l_tmpa_box } + { \box_use_drop:N \l_tmpa_box } \@@_put_box_in_flow_i: } % \end{macrocode} @@ -9002,7 +8990,7 @@ version 2005/12/01 or later. % \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 +% the rules in the array. The package \pkg{nicematrix} uses it even when % \pkg{colortbl} is not loaded. % \begin{macrocode} \CT@arc@ @@ -9010,48 +8998,23 @@ version 2005/12/01 or later. \pgfrememberpicturepositiononpagetrue \pgf@relevantforpicturesizefalse \pgfsetlinewidth \arrayrulewidth -% \end{macrocode} -% First, we compute in |\l_tmpa_dim| the height of the rules we have to draw. -% \begin{macrocode} + \pgfsetrectcap \@@_qpoint:n { row - 1 } \dim_set_eq:NN \l_tmpa_dim \pgf@y - \@@_qpoint:n { row - \@@_succ:n \c@iRow } - \dim_sub:Nn \l_tmpa_dim \pgf@y -% \end{macrocode} -% We translate vertically to take into account the potential ``last row''. -% \begin{macrocode} - \dim_zero:N \l_tmpb_dim - \int_compare:nNnT \l_@@_last_row_int > { -1 } - { - \dim_set_eq:NN \l_tmpb_dim \g_@@_dp_last_row_dim - \dim_add:Nn \l_tmpb_dim \g_@@_ht_last_row_dim -% \end{macrocode} -% We adjust the value of |\l_tmpa_dim| by the width of the horizontal rule just -% before the ``last row''. -% \begin{macrocode} - \@@_qpoint:n { row - \@@_succ:n \c@iRow } - \dim_add:Nn \l_tmpa_dim \pgf@y - \@@_qpoint:n { row - \@@_succ:n \g_@@_row_total_int } - \dim_sub:Nn \l_tmpa_dim \pgf@y - \dim_sub:Nn \l_tmpa_dim \l_tmpb_dim - } - \dim_add:Nn \l_tmpa_dim \arrayrulewidth + \@@_qpoint:n { row - \@@_succ:n \c@iRow } + \dim_set_eq:NN \l_tmpb_dim \pgf@y % \end{macrocode} % -% % Now, we can draw the vertical rules with a loop. % \begin{macrocode} \int_step_inline:nnn { \bool_if:NTF \l_@@_NiceArray_bool 1 2 } { \bool_if:NTF \l_@@_NiceArray_bool { \@@_succ:n \c@jCol } \c@jCol } { - \pgfpathmoveto { \@@_qpoint:n { col - ##1 } } - \pgfpathlineto - { - \pgfpointadd - { \@@_qpoint:n { col - ##1 } } - { \pgfpoint \c_zero_dim { \l_tmpb_dim + \l_tmpa_dim } } - } + \@@_qpoint:n { col - ##1 } + \dim_set_eq:NN \l_tmpc_dim \pgf@x + \pgfpathmoveto { \pgfpoint \l_tmpc_dim \l_tmpa_dim } + \pgfpathlineto { \pgfpoint \l_tmpc_dim \l_tmpb_dim } } \pgfusepathqstroke \endpgfpicture @@ -9059,7 +9022,7 @@ version 2005/12/01 or later. } % \end{macrocode} % -%% +% % \subsection*{The key hvlines} % % @@ -9149,7 +9112,7 @@ version 2005/12/01 or later. } % \end{macrocode} % -% First, the horizontal rules in the interior of the array. +% Now, the horizontal rules in the interior of the array. % \begin{macrocode} \int_step_variable:nnNn 2 \c@iRow \l_tmpa_tl { @@ -9996,7 +9959,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_draw_blocks: { \seq_map_inline:Nn \g_@@_blocks_seq { \@@_Block_iii:nnnnnn ##1 } } -% \end{macrocode} +% \end{macrocode} % % \begin{macrocode} \cs_new_protected:Npn \@@_Block_iii:nnnnnn #1 #2 #3 #4 #5 #6 @@ -10320,8 +10283,7 @@ version 2005/12/01 or later. % If this is really the end of the current environment (of \pkg{nicematrix}), we % put back the command |\end| and its argument in the TeX flow. % \begin{macrocode} - \str_set:NV \l_tmpa_str \@currenvir - \bool_if:NTF { \str_if_eq_p:Vn \l_tmpa_str { #1 } } + \str_if_eq:eeTF \@currenvir { #1 } { \end { #1 } } % \end{macrocode} % It this is not the |\end| we are looking for, we put those tokens in @@ -10520,7 +10482,7 @@ version 2005/12/01 or later. \@@_msg_new:nn { Unknown~option~for~xdots } { As~for~now~there~is~only~three~options~available~here:~'color',~'line-style'~ - and~'shorten'~(and~you~try~to~use~'\l_keys_key_str').~If~you~go~on,~ + and~'shorten'~(and~you~try~to~use~'\l_keys_key_tl').~If~you~go~on,~ this~option~will~be~ignored. } % \end{macrocode} @@ -10641,7 +10603,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { Bad~value~for~letter~for~dotted~lines } { - The~value~of~key~'\tl_use:N\l_keys_key_str'~must~be~of~length~1.\\ + The~value~of~key~'\tl_use:N\l_keys_key_tl'~must~be~of~length~1.\\ If~you~go~on,~it~will~be~ignored. } % \end{macrocode} @@ -10650,7 +10612,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Unknown~key~for~NiceMatrixOptions } { - The~key~'\tl_use:N\l_keys_key_str'~is~unknown~for~the~command~ + The~key~'\tl_use:N\l_keys_key_tl'~is~unknown~for~the~command~ \token_to_str:N \NiceMatrixOptions. \\ If~you~go~on,~it~will~be~ignored. \\ For~a~list~of~the~*principal*~available~keys,~type~H~<return>. @@ -10693,7 +10655,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Unknown~option~for~NiceArray } { - The~option~'\tl_use:N\l_keys_key_str'~is~unknown~for~the~environment~ + The~option~'\tl_use:N\l_keys_key_tl'~is~unknown~for~the~environment~ \{NiceArray\}. \\ If~you~go~on,~it~will~be~ignored. \\ For~a~list~of~the~*principal*~available~options,~type~H~<return>. @@ -10746,7 +10708,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Unknown~option~for~NiceMatrix } { - The~option~'\tl_use:N\l_keys_key_str'~is~unknown~for~the~ + The~option~'\tl_use:N\l_keys_key_tl'~is~unknown~for~the~ \@@_full_name_env:. \\ If~you~go~on,~it~will~be~ignored. \\ For~a~list~of~the~*principal*~available~options,~type~H~<return>. @@ -10798,7 +10760,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Unknown~option~for~NiceTabular } { - The~option~'\tl_use:N\l_keys_key_str'~is~unknown~for~the~environment~ + The~option~'\tl_use:N\l_keys_key_tl'~is~unknown~for~the~environment~ \{NiceTabular\}. \\ If~you~go~on,~it~will~be~ignored. \\ For~a~list~of~the~*principal*~available~options,~type~H~<return>. @@ -11184,6 +11146,11 @@ version 2005/12/01 or later. % The key |hvline| don't draw rules in the blocks (commands |\Block|) and in the % virtual blocks corresponding to the dotted lines. % +% \subsection*{Changes between versions 4.1 and 4.2} +% +% It's now possible to write |\begin{pNiceMatrix}a&b\\c&d\end{pNiceMatrix}^2| +% with the expected result. +% % \PrintIndex % % \tableofcontents |