From a90336c3069c198b41b7b6eb76e3389610ad5eb7 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Wed, 14 Feb 2024 03:01:19 +0000 Subject: CTAN sync 202402140301 --- .../latex/contrib/nicematrix/nicematrix-code.dtx | 47 +- .../latex/contrib/nicematrix/nicematrix-code.pdf | Bin 968305 -> 2326087 bytes .../latex/contrib/nicematrix/nicematrix-french.pdf | Bin 597386 -> 911886 bytes .../latex/contrib/nicematrix/nicematrix-french.tex | 1215 +++++++++++--------- macros/latex/contrib/nicematrix/nicematrix.pdf | Bin 612085 -> 941616 bytes macros/latex/contrib/nicematrix/nicematrix.tex | 1147 +++++++++--------- 6 files changed, 1288 insertions(+), 1121 deletions(-) (limited to 'macros/latex/contrib/nicematrix') diff --git a/macros/latex/contrib/nicematrix/nicematrix-code.dtx b/macros/latex/contrib/nicematrix/nicematrix-code.dtx index 73cf741334..6503a47298 100644 --- a/macros/latex/contrib/nicematrix/nicematrix-code.dtx +++ b/macros/latex/contrib/nicematrix/nicematrix-code.dtx @@ -17,8 +17,8 @@ % % \fi % \iffalse -\def\myfileversion{6.26d} -\def\myfiledate{2024/01/25} +\def\myfileversion{6.27} +\def\myfiledate{2024/02/13} % % %<*batchfile> @@ -50,8 +50,8 @@ version 2005/12/01 or later. %<*driver> \documentclass[dvipsnames]{l3doc}% dvipsnames is for xcolor (loaded by Tikz) \VerbatimFootnotes -\usepackage{xltxtra} -\usepackage[xetex]{geometry} + +\usepackage[luatex]{geometry} \geometry{left=2.8cm,right=2.8cm,top=2.5cm,bottom=2.5cm,papersize={21cm,29.7cm}} \usepackage{tikz} @@ -61,7 +61,7 @@ version 2005/12/01 or later. \NewDocumentEnvironment {scope} {} {} {} \def\interitem{\vspace{7mm plus 2 mm minus 3mm}} -\fvset{commandchars=\~\#\@,formatcom=\color{gray}} +\fvset{formatcom=\color{gray}} \usepackage{upquote} @@ -2232,9 +2232,12 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip -% The boolean |\l_@@_light_syntax_bool| corresponds to the option |light-syntax|. +% The boolean |\l_@@_light_syntax_bool| corresponds to the option |light-syntax| +% and the boolean |\l_@@_light_syntax_expanded_bool| correspond to the the +% option |light-syntax-expanded|. % \begin{macrocode} \bool_new:N \l_@@_light_syntax_bool +\bool_new:N \l_@@_light_syntax_expanded_bool % \end{macrocode} % % \bigskip @@ -2499,8 +2502,14 @@ version 2005/12/01 or later. } , cell-space-limits .value_required:n = true , xdots .code:n = \keys_set:nn { NiceMatrix / xdots } { #1 } , - light-syntax .bool_set:N = \l_@@_light_syntax_bool , - light-syntax .default:n = true , + light-syntax .code:n = + \bool_set_true:N \l_@@_light_syntax_bool + \bool_set_false:N \l_@@_light_syntax_expanded_bool , + light-syntax .value_forbidden:n = true , + light-syntax-expanded .code:n = + \bool_set_true:N \l_@@_light_syntax_bool + \bool_set_true:N \l_@@_light_syntax_expanded_bool , + light-syntax-expanded .value_forbidden:n = true , end-of-row .tl_set:N = \l_@@_end_of_row_tl , end-of-row .value_required:n = true , first-col .code:n = \int_zero:N \l_@@_first_col_int , @@ -3759,7 +3768,7 @@ version 2005/12/01 or later. \cs_set_eq:NN \Hdotsfor \@@_Hdotsfor: \cs_set_eq:NN \Vdotsfor \@@_Vdotsfor: \cs_set_eq:NN \Block \@@_Block: - \cs_set_eq:NN \rotate \@@_rotate: + \cs_set_eq:NN \rotate \@@_rotate: \cs_set_eq:NN \OnlyMainNiceMatrix \@@_OnlyMainNiceMatrix:n \cs_set_eq:NN \dotfill \@@_dotfill: \cs_set_eq:NN \CodeAfter \@@_CodeAfter: @@ -6740,7 +6749,10 @@ version 2005/12/01 or later. % We rescan the character of end of line in order to have the correct catcode. % \begin{macrocode} \tl_set_rescan:Nno \l_@@_end_of_row_tl { } \l_@@_end_of_row_tl - \seq_set_split:NVn \l_@@_rows_seq \l_@@_end_of_row_tl { #1 } + \bool_if:NTF \l_@@_light_syntax_expanded_bool + \seq_set_split:Nee + \seq_set_split:NVn + \l_@@_rows_seq \l_@@_end_of_row_tl { #1 } % \end{macrocode} % We delete the last row if it is empty. % \begin{macrocode} @@ -9941,7 +9953,7 @@ version 2005/12/01 or later. % |#1| is the first row \emph{after} the scope of the instructions in |#2| % \begin{macrocode} \cs_new:Npn \@@_if_row_less_than:nn #1 #2 - { \int_compare:nNnT \c@iRow < { #1 } { #2 } } + { \int_compare:nNnT { \c@iRow } < { #1 } { #2 } } % \end{macrocode} % % \bigskip @@ -9958,7 +9970,11 @@ version 2005/12/01 or later. \exp_not:N \@@_if_row_less_than:nn { \int_eval:n { \c@iRow + \l_@@_key_nb_rows_int } } - { \exp_not:n { #1 } } +% \end{macrocode} +% The |\scan_stop:| is mandatory (for ex. for the case where |\rotate| is used +% in the argument of |\RowStyle|). +% \begin{macrocode} + { \exp_not:n { #1 } \scan_stop: } } } \cs_generate_variant:Nn \@@_put_in_row_style:n { e } @@ -9987,7 +10003,6 @@ version 2005/12/01 or later. nb-rows .value_required:n = true , rowcolor .tl_set:N = \l_tmpa_tl , rowcolor .value_required:n = true , - rowcolor .initial:n = , unknown .code:n = \@@_error:n { Unknown~key~for~RowStyle } } % \end{macrocode} @@ -9998,7 +10013,7 @@ version 2005/12/01 or later. \NewDocumentCommand \@@_RowStyle:n { O { } m } { \group_begin: - \tl_clear:N \l_tmpa_tl % value of \rowcolor + \tl_clear:N \l_tmpa_tl \tl_clear:N \l_@@_color_tl \int_set_eq:NN \l_@@_key_nb_rows_int \c_one_int \dim_zero:N \l_tmpa_dim @@ -17060,6 +17075,7 @@ version 2005/12/01 or later. last-row,~ left-margin,~ light-syntax,~ + light-syntax-expanded,~ matrix/columns-type,~ no-cell-nodes,~ notes~(several~subkeys),~ @@ -17119,6 +17135,7 @@ version 2005/12/01 or later. last-row,~ left-margin,~ light-syntax,~ + light-syntax-expanded,~ name,~ no-cell-nodes,~ nullify-dots,~ @@ -17184,6 +17201,7 @@ version 2005/12/01 or later. last-row,~ left-margin,~ light-syntax,~ + light-syntax-expanded,~ name,~ no-cell-nodes,~ nullify-dots,~ @@ -17247,6 +17265,7 @@ version 2005/12/01 or later. last-row,~ left-margin,~ light-syntax,~ + light-syntax-expanded,~ name,~ no-cell-nodes,~ notes~(several~subkeys),~ diff --git a/macros/latex/contrib/nicematrix/nicematrix-code.pdf b/macros/latex/contrib/nicematrix/nicematrix-code.pdf index b31eaa65ba..94a1050280 100644 Binary files a/macros/latex/contrib/nicematrix/nicematrix-code.pdf and b/macros/latex/contrib/nicematrix/nicematrix-code.pdf differ diff --git a/macros/latex/contrib/nicematrix/nicematrix-french.pdf b/macros/latex/contrib/nicematrix/nicematrix-french.pdf index 4797714502..c5b00a3a49 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 149fc5dd33..e6026723d3 100644 --- a/macros/latex/contrib/nicematrix/nicematrix-french.tex +++ b/macros/latex/contrib/nicematrix/nicematrix-french.tex @@ -1,7 +1,6 @@ % -*- coding: utf-8 ; -*- -% Ce fichier doit être compilé avec xelatex uniquement. +% Ce fichier doit être compilé avec lualatex uniquement. \documentclass[dvipsnames]{article}% dvipsnames is for xcolor (loaded by TikZ, loaded by nicematrix) -\usepackage{xltxtra} \usepackage[french]{babel} \frenchsetup{og = « , fg = »} @@ -27,16 +26,14 @@ \MakeShortVerb{\|} \usepackage{fancyvrb} -\fvset{commandchars=\~\#\@,formatcom=\color{gray}} +\fvset{formatcom=\color{gray}} \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} -\def\LetterAt{@} \def\interitem{\vspace{7mm plus 2 mm minus 3mm}} -\def\emphase{\bgroup\color{RoyalPurple}\let\next=} \usepackage{footnote} \usepackage{booktabs} @@ -65,6 +62,40 @@ \usepackage{makeidx} \makeindex +\def\emphase{\bgroup\color{RoyalPurple}\let\next=} + +\usepackage{piton} +\PitonOptions{language = minimal, detected-commands = {emph,textsl}, splittable = 4} +\SetPitonStyle{ Number = , Comment = } + +\ExplSyntaxOn + +\dim_new:N \l__pantigny_width_dim + +\keys_define:nn { pantigny } + { width .dim_set:N = \l__pantigny_width_dim } + +\NewPitonEnvironment { Code } { O { } } + { + \char_set_catcode_other:N | + \cs_set_eq:NN \emph \emphase + \dim_zero:N \l__pantigny_width_dim + \keys_set:nn { pantigny } { #1 } + \color{gray} + \dim_compare:nNnT \l__pantigny_width_dim > \c_zero_dim + { + \PitonOptions { width = \l__pantigny_width_dim } + \begin{minipage}[c]{\l__pantigny_width_dim} + } + } + { \dim_compare:nNnT \l__pantigny_width_dim > \c_zero_dim + { \end{minipage} } + } + + +\ExplSyntaxOff + + \NewDocumentCommand{\indexcommand}{m}{\index{#1@\texttt{\textbackslash #1}}} \NewDocumentCommand{\indexenv}{m}{\index{#1@\texttt{\{#1\}}}} @@ -152,7 +183,7 @@ votre projet pour bénéficier de la dernière version de Cette extension peut être utilisée avec |xelatex|, |lualatex| et |pdflatex| mais aussi avec le cheminement classique |latex|-|dvips|-|ps2pdf| (ou Adobe Distiller). \textsl{Néanmoins, le fichier nicematrix-french.tex de la présente - documentation ne peut être compilé qu'avec XeLaTeX.} + documentation ne peut être compilé qu'avec LuaLaTeX.} \medskip Cette extension nécessite et charge les extensions \pkg{l3keys2e}, \pkg{array}, @@ -269,15 +300,15 @@ LaTeX sont trop proches l'une de l'autre. On en donne ci-dessous un exemple classique. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=9cm] +\begin{Code}[width=9cm] $\begin{pmatrix} -\frac12 & -\frac12 \\ -\frac13 & \frac14 \\ +\frac{1}{2} & -\frac{1}{2} \\ +\frac{1}{3} & \frac{1}{4} \\ \end{pmatrix}$ -\end{BVerbatim} +\end{Code} $\begin{pmatrix} -\frac12 & -\frac12 \\ -\frac13 & \frac14 \\ +\frac{1}{2} & -\frac{1}{2} \\ +\frac{1}{3} & \frac{1}{4} \\ \end{pmatrix}$ \medskip @@ -298,21 +329,23 @@ conseille de régler leurs valeurs avec la commande n'est pas utilisable avec ces colonnes.} \medskip -\begin{Verbatim} -\NiceMatrixOptions{~emphase#cell-space-limits = 1pt@} -\end{Verbatim} +\begin{Code} +\NiceMatrixOptions{\emph{cell-space-limits = 1pt}} +\end{Code} + +\medskip -\begin{BVerbatim}[baseline=c,boxwidth=9cm] +\begin{Code}[width=9cm] $\begin{pNiceMatrix} -\frac12 & -\frac12 \\ -\frac13 & \frac14 \\ +\frac{1}{2} & -\frac{1}{2} \\ +\frac{1}{3} & \frac{1}{4} \\ \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} \begin{scope} \NiceMatrixOptions{ cell-space-limits = 1pt } $\begin{pNiceMatrix} -\frac12 & -\frac12 \\ -\frac13 & \frac14 \\ +\frac{1}{2} & -\frac{1}{2} \\ +\frac{1}{3} & \frac{1}{4} \\ \end{pNiceMatrix}$ \end{scope} @@ -332,13 +365,13 @@ indique le numéro de rangée dont la ligne de base servira de ligne de base pou le tableau. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=9cm] -$A = \begin{pNiceMatrix}[~emphase#baseline=2@] +\begin{Code}[width=9cm] +$A = \begin{pNiceMatrix}[\emph{baseline=2}] \frac{1}{\sqrt{1+p^2}} & p & 1-p \\ 1 & 1 & 1 \\ 1 & p & 1+p \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} $A = \begin{pNiceMatrix}[baseline=2] \frac{1}{\sqrt{1+p^2}} & p & 1-p \\ 1 & 1 & 1 \\ @@ -360,19 +393,19 @@ rangée (avec |{tabular}| ou |{array}| de \pkg{array}, il faut utiliser |\firsthline|). \smallskip -\begin{BVerbatim}[baseline=c,boxwidth=9cm] +\begin{Code}[width=9cm] \begin{enumerate} \item un item \smallskip \item \renewcommand{\arraystretch}{1.2} -$\begin{NiceArray}~emphase#[t]@{lcccccc} +$\begin{NiceArray}\emph{[t]}{lcccccc} \hline n & 0 & 1 & 2 & 3 & 4 & 5 \\ u_n & 1 & 2 & 4 & 8 & 16 & 32 \hline \end{NiceArray}$ \end{enumerate} -\end{BVerbatim} +\end{Code} % \begin{minipage}{5cm} \begin{enumerate} @@ -395,20 +428,20 @@ Il est également possible d'utiliser les outils de \pkg{booktabs}: |\toprule|, \pkg{booktabs}.\par\nobreak \smallskip -\begin{BVerbatim}[baseline=c,boxwidth=9cm] +\begin{Code}[width=9cm] \begin{enumerate} \item an item \smallskip \item $\begin{NiceArray}[t]{lcccccc} -~emphase#\toprule@ +\emph{\toprule} n & 0 & 1 & 2 & 3 & 4 & 5 \\ -~emphase#\midrule@ +\emph{\midrule} u_n & 1 & 2 & 4 & 8 & 16 & 32 -~emphase#\bottomrule@ +\emph{\bottomrule} \end{NiceArray}$ \end{enumerate} -\end{BVerbatim} +\end{Code} \begin{minipage}{5cm} \begin{enumerate} \item an item @@ -432,20 +465,20 @@ horizontal (tracé par |\hline|). On doit pour cela donner la valeur horizontal. \smallskip -\begin{Verbatim} +\begin{Code} \NiceMatrixOptions{cell-space-limits=1pt} -\end{Verbatim} +\end{Code} \smallskip -\begin{BVerbatim}[baseline=c,boxwidth=9cm] -$A=\begin{pNiceArray}{cc|cc}~emphase#[baseline=line-3]@ +\begin{Code}[width=9cm] +$A=\begin{pNiceArray}{cc|cc}\emph{[baseline=line-3]} \dfrac{1}{A} & \dfrac{1}{B} & 0 & 0 \\ \dfrac{1}{C} & \dfrac{1}{D} & 0 & 0 \\ \hline 0 & 0 & A & B \\ 0 & 0 & D & D \\ \end{pNiceArray}$ -\end{BVerbatim} +\end{Code} \begin{scope} \NiceMatrixOptions{cell-space-limits=1pt} \raisebox{-5mm}{$A=\begin{pNiceArray}{cc|cc}[baseline=line-3] @@ -493,15 +526,15 @@ tandis que, dans les autres environnements, il est composé en mode mathématiqu Voici un exemple d'utilisation de la commande |\Block| dans une matrice mathématique. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10.6cm] +\begin{Code}[width=10.6cm] $\begin{bNiceArray}{cw{c}{1cm}c|c}[margin] -~emphase#\Block{3-3}{A}@ & & & 0 \\ +\emph{\Block{3-3}{A}} & & & 0 \\ & & & \Vdots \\ & & & 0 \\ \hline 0 & \Cdots& 0 & 0 \end{bNiceArray}$ -\end{BVerbatim} +\end{Code} $\begin{bNiceArray}{cw{c}{1cm}c|c}[margin] \Block{3-3}{A} & & & 0 \\ & & & \Vdots \\ @@ -510,6 +543,8 @@ $\begin{bNiceArray}{cw{c}{1cm}c|c}[margin] 0 & \Cdots& 0 & 0 \end{bNiceArray}$ + + \medskip On peut souhaiter agrandir la taille du «$A$» placé dans le bloc de l'exemple précédent. Comme il est composé en mode mathématique, on ne peut pas directement @@ -522,15 +557,15 @@ LaTeX qui sera inséré \emph{avant} le début du mode mathématique.\footnote{C \pkg{nicematrix} (cf. partie~\ref{rotate}, p.~\pageref{rotate}).} \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10.6cm] +\begin{Code}[width=10.6cm] $\begin{bNiceArray}{cw{c}{1cm}c|c}[margin] -\Block{3-3}~emphase#<\LARGE>@{A} & & & 0 \\ +\Block{3-3}\emph{<\LARGE>{A}} & & & 0 \\ & & & \Vdots \\ & & & 0 \\ \hline 0 & \Cdots& 0 & 0 \end{bNiceArray}$ -\end{BVerbatim} +\end{Code} $\begin{bNiceArray}{cw{c}{1cm}c|c}[margin] \Block{3-3}<\LARGE>{A} & & & 0 \\ & & & \Vdots \\ @@ -654,17 +689,17 @@ Dans l'exemple suivant, on a dû élargir à la main les colonnes 2 et 3 (avec l construction |w{c}{...}| de \pkg{array}). \medskip -\begin{BVerbatim} +\begin{Code} \begin{NiceTabular}{cw{c}{2cm}w{c}{3cm}c} rose & tulipe & marguerite & dahlia \\ violette -& ~emphase#\Block[draw=red,fill=[RGB]{204,204,255},rounded-corners]{2-2}@ - ~emphase#{\LARGE De très jolies fleurs}@ +& \emph{\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 \end{NiceTabular} -\end{BVerbatim} +\end{Code} \medskip @@ -704,8 +739,8 @@ blocs mono-colonne de cette colonne (ce comportement est assez naturel). \medskip \begin{scope} \hfuzz=10cm -\begin{BVerbatim}[baseline=c,boxwidth=12cm] -\begin{NiceTabular}{~LetterAt{}>{\color{blue}}lr~LetterAt{}} \hline +\begin{Code}[width=12cm] +\begin{NiceTabular}{@{}>{\color{blue}}lr@{}} \hline \Block{2-1}{Pierre} & 12 \\ & 13 \\ \hline Jacques & 8 \\ \hline @@ -717,7 +752,7 @@ Henri & 14 \\ \hline \Block{2-1}{Estelle} & 15 \\ & 19 \\ \hline \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{@{}>{\color{blue}}lr@{}} \hline \Block{2-1}{Pierre} & 12 \\ & 13 \\ \hline @@ -769,17 +804,17 @@ la consigne générale donnée dans le préambule pour cette colonne (cf.~\ref{h \end{itemize} \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] \begin{NiceTabular}{cc} \toprule Écrivain -& ~emphase#\Block[l]{}{année de\\ naissance}@ \\ +& \emph{\Block[l]{}{année de\\ naissance}} \\ \midrule Hugo & 1802 \\ Balzac & 1799 \\ \bottomrule \end{NiceTabular} -\end{BVerbatim} +\end{Code} % \begin{NiceTabular}{cc} \toprule @@ -805,15 +840,15 @@ La commande |\Block| admet les clés |l|, |c| et |r| pour la position horizontal du contenu du bloc (calé à gauche, centré ou bien calé à droite). \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10.6cm] +\begin{Code}[width=10.6cm] $\begin{bNiceArray}{cw{c}{1cm}c|c}[margin] -\Block~emphase#[r]@{3-3}<\LARGE>{A} & & & 0 \\ +\Block\emph{[r]}{3-3}<\LARGE>{A} & & & 0 \\ & & & \Vdots \\ & & & 0 \\ \hline 0 & \Cdots& 0 & 0 \end{bNiceArray}$ -\end{BVerbatim} +\end{Code} $\begin{bNiceArray}{cw{c}{1cm}c|c}[margin] \Block[r]{3-3}<\LARGE>{A} & & & 0 \\ & & & \Vdots \\ @@ -831,11 +866,10 @@ préambule (ce n'est pas le cas avec |\multicolumn|). \medskip \begin{center} -\fvset{commandchars=\~\#\+} -\begin{BVerbatim} -\begin{NiceTabular}{@{}c!{\qquad}ccc~emphase#!{\qquad}+ccc@{}} +\begin{Code} +\begin{NiceTabular}{@{}c!{\qquad}ccc\emph{!{\qquad}}ccc@{}} \toprule -Rang & ~emphase#\Block{1-3}{Premier groupe}+ & & & \Block{1-3}{Deuxième groupe} \\ +Rang & \emph{\Block{1-3}{Premier groupe}} & & & \Block{1-3}{Deuxième groupe} \\ & 1A & 1B & 1C & 2A & 2B & 2C \\ \midrule 1 & 0.657 & 0.913 & 0.733 & 0.830 & 0.387 & 0.893\\ @@ -844,7 +878,7 @@ Rang & ~emphase#\Block{1-3}{Premier groupe}+ & & & \Block{1-3}{Deuxième groupe} 4 & 0.161 & 0.708 & 0.386 & 0.257 & 0.074 & 0.336\\ \bottomrule \end{NiceTabular} -\end{BVerbatim} +\end{Code} \end{center} \medskip @@ -871,11 +905,10 @@ il faut utiliser les clés |L|, |R| et |C| de la commande |\Block|. Voici le même exemple avec la clé |C| pour le premier bloc. \begin{center} -\fvset{commandchars=\~\#\+} -\begin{BVerbatim} -\begin{NiceTabular}{@{}c!{\qquad}ccc~emphase#!{\qquad}+ccc@{}} +\begin{Code} +\begin{NiceTabular}{@{}c!{\qquad}ccc\emph{!{\qquad}}ccc@{}} \toprule -Rang & ~emphase#\Block[C]{1-3}{Premier groupe}+ & & & \Block{1-3}{Deuxième groupe} \\ +Rang & \emph{\Block[C]{1-3}{Premier groupe}} & & & \Block{1-3}{Deuxième groupe} \\ & 1A & 1B & 1C & 2A & 2B & 2C \\ \midrule 1 & 0.657 & 0.913 & 0.733 & 0.830 & 0.387 & 0.893\\ @@ -884,7 +917,7 @@ Rang & ~emphase#\Block[C]{1-3}{Premier groupe}+ & & & \Block{1-3}{Deuxième grou 4 & 0.161 & 0.708 & 0.386 & 0.257 & 0.074 & 0.336\\ \bottomrule \end{NiceTabular} -\end{BVerbatim} +\end{Code} \end{center} \medskip @@ -943,22 +976,22 @@ les blocs mono-rangée). \begin{scope} \NiceMatrixOptions{rules/color=[gray]{0.75}, hvlines} -\begin{BVerbatim} +\begin{Code} \NiceMatrixOptions{rules/color=[gray]{0.75}, hvlines} -\end{BVerbatim} +\end{Code} \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] \begin{NiceTabular}{ccc} -\Block[fill=red!10,~emphase#t@,l]{4-2}{two\\lines} +\Block[fill=red!10,\emph{t},l]{4-2}{two\\lines} & & \Huge Un\\ & & deux \\ & & trois \\ & & \Huge quatre \\ text & text \\ \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{ccc} \Block[fill=red!10,t,l]{4-2}{two\\lines} & & \Huge Un\\ @@ -970,16 +1003,16 @@ text & text \\ \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] \begin{NiceTabular}{ccc} -\Block[fill=red!10,~emphase#b@,r]{4-2}{two\\lines} +\Block[fill=red!10,\emph{b},r]{4-2}{two\\lines} & & \Huge Un\\ & & deux \\ & & trois \\ & & \Huge quatre \\ text & text \\ \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{ccc} \Block[fill=red!10,b,r]{4-2}{two\\lines} & & \Huge Un\\ @@ -990,16 +1023,16 @@ text & text \\ \end{NiceTabular} \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] \begin{NiceTabular}{ccc} -\Block[fill=red!10,~emphase#T@,l]{4-2}{two\\lines} +\Block[fill=red!10,\emph{T},l]{4-2}{two\\lines} & & \Huge Un\\ & & deux \\ & & trois \\ & & \Huge quatre \\ text & text \\ \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{ccc} \Block[fill=red!10,T,l]{4-2}{two\\lines} & & \Huge Un\\ @@ -1011,16 +1044,16 @@ text & text \\ \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] \begin{NiceTabular}{ccc} -\Block[fill=red!10,~emphase#B@,r]{4-2}{two\\lines} +\Block[fill=red!10,\emph{B},r]{4-2}{two\\lines} & & \Huge Un\\ & & deux \\ & & trois \\ & & \Huge quatre \\ text & text \\ \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{ccc} \Block[fill=red!10,B,r]{4-2}{two\\lines} & & \Huge Un\\ @@ -1055,13 +1088,13 @@ de ligne incomplète ou de double filet horizontal spécifié par |\hline\hline| (il n'y a pas besoin d'utiliser l'extension \pkg{hhline}). \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] \begin{NiceTabular}{|c|c|} \hline -Premier & Deuxième \\ ~emphase#\hline\hline@ +Premier & Deuxième \\ \emph{\hline\hline} Paul \\ \hline Marie & Pauline \\ \hline \end{NiceTabular} -\end{BVerbatim} +\end{Code} % \begin{NiceTabular}{|c|c|}[c] \hline Premier & Deuxième \\ \hline\hline @@ -1086,13 +1119,13 @@ Si vous utilisez \pkg{booktabs} (qui fournit |\toprule|, |\midrule|, filets tracés par \pkg{nicematrix} sont compatibles avec \pkg{booktabs}. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10.5cm] -$\begin{NiceArray}{~emphase#|cccc|@} \toprule +\begin{Code}[width=10.5cm] +$\begin{NiceArray}{\emph{|cccc|}} \toprule a & b & c & d \\ \midrule 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ \bottomrule \end{NiceArray}$ -\end{BVerbatim} +\end{Code} % $\begin{NiceArray}{|cccc|} \toprule @@ -1130,13 +1163,13 @@ Pour des raisons historiques, il n'en est pas de même pour la commande |\cline| comme on peut le voir avec l'exemple suivant. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] \setlength{\arrayrulewidth}{2pt} \begin{tabular}{cccc} \hline -A&B&C&D \\ ~emphase#\cline{2-2}@ +A&B&C&D \\ \emph{\cline{2-2}} A&B&C&D \\ \hline \end{tabular} -\end{BVerbatim} +\end{Code} % \begin{scope} \setlength{\arrayrulewidth}{2pt} @@ -1156,13 +1189,13 @@ est néanmoins possible de revenir au comportement par défaut de |\cline| avec clé |standard-cline|). \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] \setlength{\arrayrulewidth}{2pt} \begin{NiceTabular}{cccc} \hline -A&B&C&D \\ ~emphase#\cline{2}@ +A&B&C&D \\ \emph{\cline{2}} A&B&C&D \\ \hline \end{NiceTabular} -\end{BVerbatim} +\end{Code} % \begin{scope} \setlength{\arrayrulewidth}{2pt} @@ -1209,15 +1242,15 @@ globalement !). Elle est à privilégier. \medskip \begin{scope} \hfuzz=10cm -\begin{BVerbatim}[baseline=c,boxwidth=9.5cm] -\begin{NiceTabular}{|ccc|}[~emphase#rules/color=[gray]{0.9},rules/width=1pt@] +\begin{Code}[width=9.5cm] +\begin{NiceTabular}{|ccc|}[\emph{rules/color=[gray]{0.9},rules/width=1pt}] \hline rose & tulipe & lys \\ arum & iris & violette \\ muguet & dahlia & souci \\ \hline \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{|ccc|}[rules/color=[gray]{0.9},rules/width=1pt] \hline rose & tulipe & lys \\ @@ -1284,15 +1317,15 @@ De même que la commande |\Hline|, le specificateur «\verb+|+» admet entre cro des options qui caractérisent le filet à tracer. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] -\begin{NiceTabular}{|c~emphase#|[color=blue]@c|} +\begin{Code}[width=10cm] +\begin{NiceTabular}{|c|\emph{[color=blue]}c|} \Hline a & b \\ -~emphase#\Hline[color=red]@ +\emph{\Hline[color=red]} c & d \\ \Hline \end{NiceTabular} -\end{BVerbatim} +\end{Code} % \begin{NiceTabular}{|c|[color=blue]c|} \Hline @@ -1322,13 +1355,13 @@ En fait, pour les environnements avec délimiteurs (comme |{pNiceMatrix}| ou le comportement certainement attendu). \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10.6cm] -$\begin{pNiceMatrix}[~emphase#vlines@,rules/width=0.2pt] +\begin{Code}[width=10.6cm] +$\begin{pNiceMatrix}[\emph{vlines},rules/width=0.2pt] 1 & 2 & 3 & 4 & 5 & 6 \\ 1 & 2 & 3 & 4 & 5 & 6 \\ 1 & 2 & 3 & 4 & 5 & 6 \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{pNiceMatrix}[vlines,rules/width=0.2pt] 1 & 2 & 3 & 4 & 5 & 6 \\ 1 & 2 & 3 & 4 & 5 & 6 \\ @@ -1347,14 +1380,14 @@ La clé |hvlines|, qui ne prend pas de valeur, est la conjonction des clés |hlines| et |vlines|. \smallskip -\begin{Verbatim} -\begin{NiceTabular}{cccc}[~emphase#hvlines@,rules/color=blue,rules/width=1pt] +\begin{Code} +\begin{NiceTabular}{cccc}[\emph{hvlines},rules/color=blue,rules/width=1pt] rose & tulipe & marguerite & dahlia \\ violette & \Block[draw=red]{2-2}{\LARGE fleurs} & & souci \\ pervenche & & & lys \\ arum & iris & jacinthe & muguet \end{NiceTabular} -\end{Verbatim} +\end{Code} % \begin{center} \begin{NiceTabular}{cccc}[hvlines,rules/color=blue,rules/width=1pt] @@ -1435,9 +1468,9 @@ les coins vides et ces coins sont alors pris en compte par les outils de tracés de filets (les filets ne seront pas tracés dans ces coins vides). \medskip -\begin{BVerbatim}[boxwidth=11cm,baseline=c] +\begin{Code}[width=11cm] \NiceMatrixOptions{cell-space-top-limit=3pt} -\begin{NiceTabular}{*{6}{c}}[~emphase#corners@,hvlines] +\begin{NiceTabular}{*{6}{c}}[\emph{corners},hvlines] & & & & A \\ & & A & A & A \\ & & & A \\ @@ -1448,7 +1481,7 @@ A & A & A & A & A & A \\ & \Block{2-2}{B} & & A \\ & & & A \\ \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{*{6}{c}}[corners,hvlines,cell-space-top-limit=3pt] & & & & A \\ & & A & A & A \\ @@ -1467,9 +1500,9 @@ prendre en considération (les coins sont notés |NW|, |SW|, |NE| et |SE| et doivent être séparés par des virgules). \medskip -\begin{BVerbatim}[boxwidth=11cm,baseline=c] +\begin{Code}[width=11cm] \NiceMatrixOptions{cell-space-top-limit=3pt} -\begin{NiceTabular}{*{6}{c}}[~emphase#corners=NE@,hvlines] +\begin{NiceTabular}{*{6}{c}}[\emph{corners=NE},hvlines] 1\\ 1&1\\ 1&2&1\\ @@ -1477,7 +1510,7 @@ doivent être séparés par des virgules). 1&4&6&4&1\\ & & & & &1 \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{*{6}{c}}% [c,corners=NE,hvlines,cell-space-top-limit=3pt] 1\\ @@ -1506,15 +1539,15 @@ elle est utilisée dans une case, de couper cette case selon une diagonale descendante. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] $\begin{NiceArray}{*{5}{c}}[hvlines] -~emphase#\diagbox{x}{y}@ & e & a & b & c \\ +\emph{\diagbox{x}{y}} & e & a & b & c \\ e & e & a & b & c \\ a & a & e & c & b \\ b & b & c & e & a \\ c & c & b & a & e \end{NiceArray}$ -\end{BVerbatim} +\end{Code} $\begin{NiceArray}{*{5}{c}}[hvlines] \diagbox{x}{y} & e & a & b & c \\ e & e & a & b & c \\ @@ -1599,8 +1632,8 @@ avec une couleur spécifique (et ces filets respecteront les blocs et les coins comme les autres filets de \pkg{nicematrix}). \medskip -\begin{Verbatim} -\begin{NiceTabular}{lcIcIc}~emphase#[custom-line = {letter=I, color=blue}]@ +\begin{Code} +\begin{NiceTabular}{lcIcIc}\emph{[custom-line = {letter=I, color=blue}]} \hline & \Block{1-3}{dimensions} \\ & L & l & h \\ @@ -1610,7 +1643,7 @@ Produit B & 1 & 3 & 4 \\ Produit C & 5 & 4 & 1 \\ \hline \end{NiceTabular} -\end{Verbatim} +\end{Code} \begin{center} @@ -1647,14 +1680,14 @@ calculée à partir des caractéristiques fournies par la clé |tikz|). \bigskip Voici ce que l'on obtient avec la clé |dotted| de TikZ. -\begin{Verbatim} +\begin{Code} \NiceMatrixOptions { custom-line = { letter = I , - ~emphase#tikz = dotted @ , - ~emphase#total-width = \pgflinewidth@ + \emph{tikz = dotted , + total-width = \pgflinewidth} } } @@ -1663,7 +1696,7 @@ un & deux & trois \\ quatre & cinq & six \\ sept & huit & neuf \end{NiceTabular} -\end{Verbatim} +\end{Code} \begin{center} \NiceMatrixOptions @@ -1707,8 +1740,8 @@ pointillés.\footnote{Néanmoins, l'utilisateur peut écraser ces définitions d (par exemple pour les remplacer par des lignes en tiretés).} \smallskip -\begin{BVerbatim} -% ~textsl#présent dans nicematrix.sty@ +\begin{Code} +% présent dans nicematrix.sty \NiceMatrixOptions { custom-line = @@ -1719,22 +1752,22 @@ pointillés.\footnote{Néanmoins, l'utilisateur peut écraser ces définitions d dotted } } -\end{BVerbatim} +\end{Code} \bigskip Il est donc possible d'utiliser les commandes |\hdottedline| et |\cdottedline| pour tracer des filets horizontaux en pointillés. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=9.5cm] +\begin{Code}[width=9.5cm] \begin{pNiceMatrix} 1 & 2 & 3 & 4 & 5 \\ -~emphase#\hdottedline@ +\emph{\hdottedline} 6 & 7 & 8 & 9 & 10 \\ -~emphase#\cdottedline{1,4-5}@ +\emph{\cdottedline{1,4-5}} 11 & 12 & 13 & 14 & 15 \end{pNiceMatrix} -\end{BVerbatim} +\end{Code} $\begin{pNiceMatrix} 1 & 2 & 3 & 4 & 5 \\ \hdottedline @@ -1750,13 +1783,13 @@ Dans les environnements avec un préambule explicite (comme |{NiceTabular}|, pointillés avec le spécificateur «|:|». \medskip -\begin{BVerbatim}[baseline=c,boxwidth=9.5cm] -\begin{pNiceArray}{cccc~emphase#:@c} +\begin{Code}[width=9.5cm] +\begin{pNiceArray}{cccc\emph{:}c} 1 & 2 & 3 & 4 & 5 \\ 6 & 7 & 8 & 9 & 10 \\ 11 & 12 & 13 & 14 & 15 \end{pNiceArray} -\end{BVerbatim} +\end{Code} $\begin{pNiceArray}{cccc:c} 1 & 2 & 3 & 4 & 5 \\ 6 & 7 & 8 & 9 & 10 \\ @@ -1836,14 +1869,15 @@ exécuté avant le tracé du tableau. Une syntaxe alternative est proposée : on peut placer le contenu de ce |code-before| entre les mots-clés |\CodeBefore| et |\Body| juste au début de l'environnement. -\begin{Verbatim} -\begin{pNiceArray}{~textsl#preamble@} -~emphase#\CodeBefore [~textsl#options@]@ - ~textsl#instructions du code-before@ -~emphase#\Body@ - ~textsl#contenu de l'environnement@ +\smallskip +\begin{Code} +\begin{pNiceArray}{\textsl{preamble}} +\emph{\CodeBefore [\textsl{options}]} + \textsl{instructions du code-before} +\emph{\Body} + \textsl{contenu de l’environnement} \end{pNiceArray} -\end{Verbatim} +\end{Code} \smallskip L'argument optionnel entre crochets est une liste de couples \textsl{clé=valeur} @@ -1918,16 +1952,16 @@ colonne avec la syntaxe~-$j$. \medskip \begin{scope} \hfuzz=10cm -\begin{BVerbatim}[boxwidth=10cm,baseline=c] +\begin{Code}[width=10cm] \begin{NiceTabular}{ccc}[hvlines] \CodeBefore - ~emphase#\cellcolor[HTML]{FFFF88}{3-1,2-2,-3}@ + \emph{\cellcolor[HTML]{FFFF88}{3-1,2-2,-3}} \Body a & b & c \\ e & f & g \\ h & i & j \\ \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{ccc}[hvlines] \CodeBefore \cellcolor[HTML]{FFFF88}{3-1,2-2,-3} @@ -1947,16 +1981,16 @@ la case en haut à gauche et la case en bas à droite du rectangle. \medskip \begin{scope} \hfuzz=10cm -\begin{BVerbatim}[boxwidth=10cm,baseline=c] +\begin{Code}[width=10cm] \begin{NiceTabular}{ccc}[hvlines] \CodeBefore - ~emphase#\rectanglecolor{blue!15}{2-2}{3-3}@ + \emph{\rectanglecolor{blue!15}{2-2}{3-3}} \Body a & b & c \\ e & f & g \\ h & i & j \\ \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{ccc}[hvlines] \CodeBefore \rectanglecolor{blue!15}{2-2}{3-3} @@ -1983,16 +2017,16 @@ couleurs. \medskip \begin{scope} \hfuzz=10cm -\begin{BVerbatim}[baseline=c,boxwidth=9cm] +\begin{Code}[width=9cm] $\begin{pNiceMatrix}[r,margin] \CodeBefore - ~emphase#\chessboardcolors{red!15}{blue!15}@ + \emph{\chessboardcolors{red!15}{blue!15}} \Body 1 & -1 & 1 \\ -1 & 1 & -1 \\ 1 & -1 & 1 \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{pNiceMatrix}[baseline=1, r, margin] \CodeBefore \chessboardcolors{red!15}{blue!15} @@ -2019,10 +2053,10 @@ toutes les rangées à partir de la rangée~$a$). \begin{scope} \hfuzz=10cm -\begin{BVerbatim}[boxwidth=9cm,baseline=c] +\begin{Code}[width=9cm] $\begin{NiceArray}{lll}[hvlines] \CodeBefore - ~emphase#\rowcolor{red!15}{1,3-5,8-}@ + \emph{\rowcolor{red!15}{1,3-5,8-}} \Body a_1 & b_1 & c_1 \\ a_2 & b_2 & c_2 \\ @@ -2035,7 +2069,7 @@ a_8 & b_8 & c_8 \\ a_9 & b_9 & c_9 \\ a_{10} & b_{10} & c_{10} \\ \end{NiceArray}$ -\end{BVerbatim} +\end{Code} % $\begin{NiceArray}{lll}[baseline=4,hvlines] \CodeBefore @@ -2102,10 +2136,10 @@ tableau pour englober les blocs (créés par la commande |\Block| : cf.~p.~\page \medskip \begin{scope} \hfuzz=10cm -\begin{BVerbatim}[baseline=c,boxwidth=9cm] +\begin{Code}[width=9cm] \begin{NiceTabular}{clr}[hvlines] \CodeBefore - ~emphase#\rowcolors[gray]{2}{0.8}{}[cols=2-3,restart]@ + \emph{\rowcolors[gray]{2}{0.8}{}[cols=2-3,restart]} \Body \Block{1-*}{Résultats} \\ \Block{2-1}{A}& Pierre & 12 \\ @@ -2115,7 +2149,7 @@ tableau pour englober les blocs (créés par la commande |\Block| : cf.~p.~\page & Henri & 14 \\ & Estelle & 15 \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{clr}[hvlines,baseline=2] \CodeBefore \rowcolors[gray]{2}{0.8}{}[cols=2-3,restart] @@ -2135,10 +2169,10 @@ tableau pour englober les blocs (créés par la commande |\Block| : cf.~p.~\page \begin{scope} \hfuzz=10cm -\begin{BVerbatim}[baseline=c,boxwidth=11cm] +\begin{Code}[width=11cm] \begin{NiceTabular}{lr}[hvlines] \CodeBefore - ~emphase#\rowcolors{1}{blue!10}{}[respect-blocks]@ + \emph{\rowcolors{1}{blue!10}{}[respect-blocks]} \Body \Block{2-1}{Pierre} & 12 \\ & 13 \\ @@ -2151,7 +2185,7 @@ Henri & 14 \\ \Block{2-1}{Estelle} & 15 \\ & 19 \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{lr}[hvlines,baseline=c] \CodeBefore \rowcolors{1}{blue!10}{}[respect-blocks] @@ -2177,10 +2211,10 @@ qui est une liste de couleurs séparées par des virgules. Dans cette liste, le symbole |=| représente une couleur identique à la précédente. \smallskip -\begin{BVerbatim}[boxwidth=10cm,baseline=c] +\begin{Code}[width=10cm] \begin{NiceTabular}{c} \CodeBefore - ~emphase#\rowlistcolors{1}{red!15,blue!15,green!15}@ + \emph{\rowlistcolors{1}{red!15,blue!15,green!15}} \Body Mathilde \\ Pierre \\ @@ -2190,7 +2224,7 @@ Jacques \\ Antoine \\ Stéphanie \\ \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{c} \CodeBefore \rowlistcolors{1}{red!15,blue!15,green!15} @@ -2217,12 +2251,12 @@ avec |\resetcolorseries|\footnote{Pour l'initialisation, on a \index{resetcolorseries@\texttt{\textbackslash resetcolorseries} (commande de \pkg{xcolor})} \smallskip -\begin{BVerbatim}[boxwidth=12cm,baseline=c] +\begin{Code}[width=12cm] \begin{NiceTabular}{c} \CodeBefore - ~emphase#\definecolorseries{BlueWhite}{rgb}{last}{blue}{white}@ - ~emphase#\resetcolorseries{\value{iRow}}{BlueWhite}@ - ~emphase#\rowlistcolors{1}{BlueWhite!!+}@ + \emph{\definecolorseries{BlueWhite}{rgb}{last}{blue}{white} + \resetcolorseries{\value{iRow}}{BlueWhite} + \rowlistcolors{1}{BlueWhite!!+}} \Body Mathilde \\ Pierre \\ @@ -2232,7 +2266,7 @@ Jacques \\ Antoine \\ Stéphanie \\ \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{c} \CodeBefore \definecolorseries{BlueWhite}{rgb}{last}{blue}{white} @@ -2260,10 +2294,10 @@ utilise la clé |corners| pour demander de considérer le coin \emph{north east} \index{corners (clé d'un environnement)|textit} \begin{scope} \hfuzz=11cm -\begin{BVerbatim}[boxwidth=9cm,baseline=c] -\begin{NiceTabular}{cccccc}[~emphase#corners=NE@,margin,hvlines,first-row,first-col] +\begin{Code}[width=9cm] +\begin{NiceTabular}{cccccc}[\emph{corners=NE},margin,hvlines,first-row,first-col] \CodeBefore - ~emphase#\rowlistcolors{1}{blue!15, }@ + \emph{\rowlistcolors{1}{blue!15, }} \Body & 0 & 1 & 2 & 3 & 4 & 5 & 6 \\ 0 & 1 \\ @@ -2274,7 +2308,7 @@ utilise la clé |corners| pour demander de considérer le coin \emph{north east} 5 & 1 & 5 & 10 & 10 & 5 & 1 \\ 6 & 1 & 6 & 15 & 20 & 15 & 6 & 1 \\ \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{ccccccc}[corners=NE,margin,hvlines,first-row,first-col] \CodeBefore \rowlistcolors{1}{blue!15, } @@ -2307,11 +2341,11 @@ Dans l'exemple suivant, on demande explicitement le coloriage de la colonne~$0$ \medskip \begin{scope} \hfuzz=11cm -\begin{BVerbatim}[boxwidth=9cm,baseline=c] -\begin{NiceTabular}{cccccc}[~emphase#corners=NE@,margin,hvlines,first-row,first-col] +\begin{Code}[width=9cm] +\begin{NiceTabular}{cccccc}[\emph{corners=NE},margin,hvlines,first-row,first-col] \CodeBefore \rowlistcolors{1}{blue!15, } - ~emphase#\columncolor{red!15}{0}@ + \emph{\columncolor{red!15}{0}} \Body & 0 & 1 & 2 & 3 & 4 & 5 & 6 \\ 0 & 1 \\ @@ -2322,7 +2356,7 @@ Dans l'exemple suivant, on demande explicitement le coloriage de la colonne~$0$ 5 & 1 & 5 & 10 & 10 & 5 & 1 \\ 6 & 1 & 6 & 15 & 20 & 15 & 6 & 1 \\ \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{ccccccc}[corners=NE,margin,hvlines,first-row,first-col] \CodeBefore \rowlistcolors{1}{blue!15, } @@ -2349,27 +2383,27 @@ l'extension \pkg{booktabs} n'est \emph{pas} chargée par \pkg{nicematrix}. \index{rotate@\texttt{\textbackslash rotate}|textit} \begin{scope} \hfuzz=10cm -\begin{BVerbatim}[baseline=c,boxwidth=8.5cm] +\begin{Code}[width=8.5cm] \begin{NiceTabular}{lSSSS} \CodeBefore \rowcolor{red!15}{1-2} \rowcolors{3}{blue!15}{} \Body -~emphase#\toprule@ +\emph{\toprule} \Block{2-1}{Produit} & \Block{1-3}{dimensions (cm)} & & & \Block{2-1}{\rotate Prix} \\ -~emphase#\cmidrule(rl){2-4}@ +\emph{\cmidrule(rl){2-4}} & L & l & h \\ -~emphase#\midrule@ +\emph{\midrule} petit & 3 & 5.5 & 1 & 30 \\ moyen & 5.5 & 8 & 1.5 & 50.5 \\ premium & 8.5 & 10.5 & 2 & 80 \\ extra & 8.5 & 10 & 1.5 & 85.5 \\ spécial & 12 & 12 & 0.5 & 70 \\ -~emphase#\bottomrule@ +\emph{\bottomrule} \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}[c]{lSSSS} \CodeBefore \rowcolor{red!15}{1-2} @@ -2440,11 +2474,11 @@ Ces commandes sont compatibles avec les commandes pour les \emph{overlays} de Beamer (comme |\only|, etc.) \medskip -\begin{Verbatim} -\NewDocumentCommand { \Blue } { } {~emphase#\columncolor{blue!15}@} +\begin{Code} +\NewDocumentCommand { \Blue } { } {\emph{\columncolor{blue!15}}} \begin{NiceTabular}[color-inside]{>{\Blue}c>{\Blue}cc} \toprule -~emphase#\rowcolor{red!15}@ +\emph{\rowcolor{red!15}} Nom & Prénom & Année de naissance \\ \midrule Achard & Jacques & 5 juin 1962 \\ @@ -2453,7 +2487,7 @@ Vanesse & Stéphanie & 30 octobre 1994 \\ Dupont & Chantal & 15 janvier 1998 \\ \bottomrule \end{NiceTabular} -\end{Verbatim} +\end{Code} \begin{center} @@ -2483,19 +2517,19 @@ En particulier, on peut engager un coloriage des rangées avec |\rowlistcolors{...}| et l'arrêter par un |\rowlistcolors{}| avec argument vide. \bigskip -\begin{BVerbatim}[boxwidth=10cm,baseline=c] +\begin{Code}[width=10cm] \begin{NiceTabular}{c}[hvlines,color-inside] un \\ deux \\ -~emphase#\rowlistcolors{red!15}@ +\emph{\rowlistcolors{red!15}} trois \\ quatre \\ cinq \\ -~emphase#\rowlistcolors{}@ +\emph{\rowlistcolors{}} six \\ sept \\ \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{c}[hvlines,color-inside] un \\ deux \\ @@ -2563,16 +2597,16 @@ soient en mode texte ou bien en mode mathématique. \end{itemize} \medskip -\begin{BVerbatim}[boxwidth=12cm,baseline=c] +\begin{Code}[width=12cm] \begin{NiceTabular}{cccc} \hline -~emphase#\RowStyle[cell-space-limits=3pt]{\rotate}@ +\emph{\RowStyle[cell-space-limits=3pt]{\rotate}} premier & deuxième & troisième & quatrième \\ -~emphase#\RowStyle[nb-rows=2,color=white,rowcolor=blue!50]{\sffamily}@ +\emph{\RowStyle[nb-rows=2,color=white,rowcolor=blue!50]{\sffamily}} 1 & 2 & 3 & 4 \\ I & II & III & IV \end{NiceTabular} -\end{BVerbatim} +\end{Code} \index{rotate@\texttt{\textbackslash rotate}|textit} \begin{NiceTabular}{cccc} \hline @@ -2598,13 +2632,13 @@ Dans les environnements avec un préambule explicite (comme |{NiceTabular}|, lettres classiques |w|, |W|, |p|, |b| et |m| de l'extension \pkg{array}. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=9cm] -\begin{NiceTabular}{~emphase#W{c}{2cm}@cc}[hvlines] +\begin{Code}[width=9cm] +\begin{NiceTabular}{\emph{W{c}{2cm}}cc}[hvlines] Paris & New York & Madrid \\ Berlin & London & Roma \\ Rio & Tokyo & Oslo \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{W{c}{2cm}cc}[hvlines] Paris & New York & Madrid \\ Berlin & London & Roma \\ @@ -2620,13 +2654,13 @@ colonnes extérieures: cf. p.~\pageref{exterior}) directement avec l'option |columns-width|. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] -$\begin{pNiceMatrix}[~emphase#columns-width = 1cm@] +\begin{Code}[width=10cm] +$\begin{pNiceMatrix}[\emph{columns-width = 1cm}] 1 & 12 & -123 \\ 12 & 0 & 0 \\ 4 & 1 & 2 \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{pNiceMatrix}[columns-width = 1cm] 1 & 12 & -123 \\ 12 & 0 & 0 \\ @@ -2647,13 +2681,13 @@ case la plus large du tableau.\footnote{Le résultat est atteint dès la premiè un message demandant une deuxième compilation apparaîtra).}\par\nobreak \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] -$\begin{pNiceMatrix}[~emphase#columns-width = auto@] +\begin{Code}[width=10cm] +$\begin{pNiceMatrix}[\emph{columns-width = auto}] 1 & 12 & -123 \\ 12 & 0 & 0 \\ 4 & 1 & 2 \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{pNiceMatrix}[columns-width = auto] 1 & 12 & -123 \\ 12 & 0 & 0 \\ @@ -2666,8 +2700,8 @@ colonnes de tous les tableaux dans une certaine portion de document avec la commande |\NiceMatrixOptions|.\par\nobreak \medskip -\begin{BVerbatim}[baseline=c,boxwidth=8.5cm] -~emphase#\NiceMatrixOptions{columns-width=10mm}@ +\begin{Code}[width=8.5cm] +\emph{\NiceMatrixOptions{columns-width=10mm}} $\begin{pNiceMatrix} a & b \\ c & d \end{pNiceMatrix} @@ -2675,7 +2709,7 @@ a & b \\ c & d \begin{pNiceMatrix} 1 & 1245 \\ 345 & 2 \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} \begin{scope} \NiceMatrixOptions{columns-width=10mm} $\begin{pNiceMatrix} @@ -2704,8 +2738,8 @@ la commande |\Block| présentée précédemment dans ce document (cf.~p.~\pageref{Block}). \medskip -\begin{BVerbatim}[baseline=c,boxwidth=8.5cm] -~emphase#\begin{NiceMatrixBlock}[auto-columns-width]@ +\begin{Code}[width=8.5cm] +\emph{\begin{NiceMatrixBlock}[auto-columns-width]} $\begin{array}{c} \begin{bNiceMatrix} 9 & 17 \\ -2 & 5 @@ -2714,8 +2748,8 @@ $\begin{array}{c} 1 & 1245345 \\ 345 & 2 \end{bNiceMatrix} \end{array}$ -~emphase#\end{NiceMatrixBlock}@ -\end{BVerbatim} +\emph{\end{NiceMatrixBlock}} +\end{Code} \begin{NiceMatrixBlock}[auto-columns-width] $\begin{array}{c} \begin{bNiceMatrix} @@ -2767,13 +2801,13 @@ suivi de |\arraybackslash|). et |b|). La valeur par défaut est |t|. \end{itemize} -\begin{Verbatim} -\begin{NiceTabular}~emphase#[width=9cm]{X[2,l]X[l]}@[hvlines] +\begin{Code} +\begin{NiceTabular}\emph{[width=9cm]{X[2,l]X[l]}}[hvlines] Un texte relativement long qui tient sur plusieurs lignes. & Un texte relativement long qui tient sur plusieurs lignes. \\ Un texte plus court. & Un texte plus court. \end{NiceTabular} -\end{Verbatim} +\end{Code} \begin{center} @@ -2800,15 +2834,15 @@ largeur d'une boîte |{varwidth}| est la largeur naturelle de son contenu. Cela est illustré avec les exemples suivants : \medskip -\begin{BVerbatim}[baseline=c,boxwidth=6cm] +\begin{Code}[width=6cm] \fbox{% -\begin{~emphase#varwidth@}{8cm} +\begin{\emph{varwidth}}{8cm} \begin{itemize} \item premier item \item deuxième item \end{itemize} -\end{~emphase#varwidth@}} -\end{BVerbatim} +\end{\emph{varwidth}}} +\end{Code} \fbox{\begin{varwidth}{8cm} \begin{itemize} \item premier item @@ -2817,15 +2851,15 @@ Cela est illustré avec les exemples suivants : \end{varwidth}} \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=6cm] +\begin{Code}[width=6cm] \fbox{% -\begin{~emphase#minipage@}{8cm} +\begin{\emph{minipage}}{8cm} \begin{itemize} \item premier item \item deuxième item \end{itemize} -\end{~emphase#minipage@}} -\end{BVerbatim} +\end{\emph{minipage}}} +\end{Code} \fbox{\begin{minipage}{8cm} \begin{itemize} \item premier item @@ -2844,13 +2878,13 @@ Lorsque l'extension \pkg{varwidth} est chargée, ces colonnes |V| de \pkg{varwidth} sont prises en charge par \pkg{nicematrix}. \medskip -\begin{Verbatim} -\begin{NiceTabular}[corners=NW,hvlines]{~emphase#V{3cm}V{3cm}V{3cm}@} +\begin{Code} +\begin{NiceTabular}[corners=NW,hvlines]{\emph{V{3cm}V{3cm}V{3cm}}} & un texte & un très très très très long texte \\ un très très très très long texte \\ un très très très très long texte \end{NiceTabular} -\end{Verbatim} +\end{Code} \medskip \begin{center} @@ -2897,8 +2931,8 @@ colonnes «extérieures» grâce aux options |first-row|, |last-row|, |first-col Si elle est présente, la «première rangée» (extérieure) est numérotée par $0$ (et non $1$). Il en est de même pour la «première colonne». -\begin{Verbatim} -$\begin{pNiceMatrix}[~emphase#first-row,last-row,first-col,last-col@,nullify-dots] +\begin{Code} +$\begin{pNiceMatrix}[\emph{first-row,last-row,first-col,last-col},nullify-dots] & C_1 & \Cdots & & C_4 & \\ L_1 & a_{11} & a_{12} & a_{13} & a_{14} & L_1 \\ \Vdots & a_{21} & a_{22} & a_{23} & a_{24} & \Vdots \\ @@ -2906,7 +2940,7 @@ L_1 & a_{11} & a_{12} & a_{13} & a_{14} & L_1 \\ L_4 & a_{41} & a_{42} & a_{43} & a_{44} & L_4 \\ & C_1 & \Cdots & & C_4 & \end{pNiceMatrix}$ -\end{Verbatim} +\end{Code} % \[\begin{pNiceMatrix}[first-row,last-row,first-col,last-col,nullify-dots] & C_1 & \Cdots & & C_4 & \\ @@ -2970,11 +3004,11 @@ On peut contrôler l'apparence de ces rangées et colonnes avec les options |code-for-last-col|. Ces options sont des listes de tokens qui seront insérées au début de chaque case de la rangée ou de la colonne considérée. -\begin{Verbatim} -\NiceMatrixOptions{~emphase#code-for-first-row@ = \color{red}, - ~emphase#code-for-first-col@ = \color{blue}, - ~emphase#code-for-last-row@ = \color{green}, - ~emphase#code-for-last-col@ = \color{magenta}} +\begin{Code} +\NiceMatrixOptions{\emph{code-for-first-row} = \color{red}, + \emph{code-for-first-col} = \color{blue}, + \emph{code-for-last-row} = \color{green}, + \emph{code-for-last-col} = \color{magenta}} $\begin{pNiceArray}{cc|cc}[first-row,last-row=5,first-col,last-col,nullify-dots] & C_1 & \Cdots & & C_4 & \\ L_1 & a_{11} & a_{12} & a_{13} & a_{14} & L_1 \\ @@ -2984,7 +3018,7 @@ L_1 & a_{11} & a_{12} & a_{13} & a_{14} & L_1 \\ L_4 & a_{41} & a_{42} & a_{43} & a_{44} & L_4 \\ & C_1 & \Cdots & & C_4 & \end{pNiceArray}$ -\end{Verbatim} +\end{Code} % \begin{scope} \NiceMatrixOptions{code-for-first-row = \color{red}, @@ -3066,15 +3100,15 @@ avec l'option~|color|.\footnote{Il est aussi possible de changer la couleur de p.~\pageref{customization}. }\par\nobreak \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] \begin{bNiceMatrix} a_1 & \Cdots & & & a_1 \\ \Vdots & a_2 & \Cdots & & a_2 \\ - & \Vdots & \Ddots[color=red] \\ + & \Vdots & \emph{\Ddots[color=red]} \\ \\ a_1 & a_2 & & & a_n \end{bNiceMatrix} -\end{BVerbatim} +\end{Code} $\begin{bNiceMatrix} a_1 & \Cdots & & & a_1 \\ \Vdots & a_2 & \Cdots & & a_2 \\ @@ -3088,13 +3122,13 @@ a_1 & a_2 & & & a_n codage suivant :\par\nobreak \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] \begin{bNiceMatrix} 0 & \Cdots & 0 \\ \Vdots & & \Vdots \\ 0 & \Cdots & 0 \end{bNiceMatrix} -\end{BVerbatim} +\end{Code} $\begin{bNiceMatrix} 0 & \Cdots & 0 \\ \Vdots & & \Vdots \\ @@ -3108,14 +3142,14 @@ colonne. Il est possible d'utiliser la même méthode avec \pkg{nicematrix} :\par\nobreak \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] \begin{bNiceMatrix} 0 & \Cdots & \Cdots & 0 \\ \Vdots & & & \Vdots \\ \Vdots & & & \Vdots \\ 0 & \Cdots & \Cdots & 0 \end{bNiceMatrix} -\end{BVerbatim} +\end{Code} $\begin{bNiceMatrix} 0 & \Cdots & \Cdots & 0 \\ \Vdots & & & \Vdots \\ @@ -3132,14 +3166,14 @@ En fait, dans cet exemple, il aurait été possible de tracer la même matrice p rapidement avec le codage suivant (parmi d'autres) :\par\nobreak \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] \begin{bNiceMatrix} 0 & \Cdots & & 0 \\ \Vdots & & & \\ & & & \Vdots \\ 0 & & \Cdots & 0 \end{bNiceMatrix} -\end{BVerbatim} +\end{Code} $\begin{bNiceMatrix} 0 & \Cdots & & 0 \\ \Vdots & & & \\ @@ -3164,13 +3198,13 @@ commande~|\Hspace| qui est une variante de |\hspace| transparente pour la construction des lignes en pointillés de \pkg{nicematrix}.\par\nobreak \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] \begin{bNiceMatrix} -0 & \Cdots & ~emphase#\Hspace*{1cm}@ & 0 \\ -\Vdots & & & \Vdots \\~emphase#[1cm]@ +0 & \Cdots & \emph{\Hspace*{1cm}} & 0 \\ +\Vdots & & & \Vdots \\\emph{[1cm]} 0 & \Cdots & & 0 \end{bNiceMatrix} -\end{BVerbatim} +\end{Code} $\begin{bNiceMatrix} 0 & \Cdots & \Hspace*{1cm} & 0 \\ \Vdots & & & \Vdots \\[1cm] @@ -3185,12 +3219,12 @@ Considérons la matrice suivante qui a été composée classiquement avec l'environnement |{pmatrix}| de \pkg{amsmath}.\par\nobreak \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] $A = \begin{pmatrix} h & i & j & k & l & m \\ x & & & & & x \end{pmatrix}$ -\end{BVerbatim} +\end{Code} $A = \begin{pmatrix} h & i & j & k & l & m \\ x & & & & & x @@ -3202,12 +3236,12 @@ Si nous ajoutons des instructions |\ldots| dans la seconde rangée, la géométr de la matrice est modifiée.\par\nobreak \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] $B = \begin{pmatrix} h & i & j & k & l & m \\ x & \ldots & \ldots & \ldots & \ldots & x \end{pmatrix}$ -\end{BVerbatim} +\end{Code} $B = \begin{pmatrix} h & i & j & k & l & m \\ x & \ldots & \ldots & \ldots & \ldots & x @@ -3219,12 +3253,12 @@ Par défaut, avec \pkg{nicematrix}, si nous remplaçons |{pmatrix}| par changée.\par\nobreak \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] $C = \begin{pNiceMatrix} h & i & j & k & l & m \\ x & \Ldots & \Ldots & \Ldots & \Ldots & x \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} $C = \begin{pNiceMatrix} h & i & j & k & l & m \\ x & \Ldots & \Ldots & \Ldots & \Ldots & x @@ -3237,12 +3271,12 @@ seconde rangée. C'est possible en utilisant l'option |nullify-dots| (et une seule instruction |\Ldots| suffit).\par\nobreak \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] -$D = \begin{pNiceMatrix}[~emphase#nullify-dots@] +\begin{Code}[width=10cm] +$D = \begin{pNiceMatrix}[\emph{nullify-dots}] h & i & j & k & l & m \\ x & \Ldots & & & & x \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} $D = \begin{pNiceMatrix}[nullify-dots] h & i & j & k & l & m \\ x & \Ldots & & & & x @@ -3273,14 +3307,14 @@ Comme avec les autres commandes de \pkg{nicematrix} (comme |\Cdots|, |\Ldots|, contenu des cases de part et d'autre. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=7cm] +\begin{Code}[width=7cm] $\begin{pNiceMatrix} 1 & 2 & 3 & 4 & 5 \\ -1 & ~emphase#\Hdotsfor{3}@ & 5 \\ +1 & \emph{\Hdotsfor{3}} & 5 \\ 1 & 2 & 3 & 4 & 5 \\ 1 & 2 & 3 & 4 & 5 \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{pNiceMatrix} 1 & 2 & 3 & 4 & 5 \\ 1 & \Hdotsfor{3} & 5 \\ @@ -3293,14 +3327,14 @@ Néanmoins, si ces cases sont vides, la ligne en pointillés s'étend seulement dans les cases spécifiées par l'argument de |\Hdotsfor| (par conception). \medskip -\begin{BVerbatim}[baseline=c,boxwidth=7cm] +\begin{Code}[width=7cm] $\begin{pNiceMatrix} 1 & 2 & 3 & 4 & 5 \\ - & ~emphase#\Hdotsfor{3}@ \\ + & \emph{\Hdotsfor{3}} \\ 1 & 2 & 3 & 4 & 5 \\ 1 & 2 & 3 & 4 & 5 \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{pNiceMatrix} 1 & 2 & 3 & 4 & 5 \\ & \Hdotsfor{3} \\ @@ -3325,23 +3359,27 @@ L'extension \pkg{nicematrix} propose aussi une commande |\Vdotsfor| similaire à \medskip L'exemple suivant utilise à la fois |\Hdotsfor| et |\Vdotsfor|: -\begin{Verbatim}[formatcom=\small\color{gray}] +\smallskip +\begin{scope} +\small +\begin{Code} \begin{bNiceMatrix} C[a_1,a_1] & \Cdots & C[a_1,a_n] & \hspace*{20mm} & C[a_1,a_1^{(p)}] & \Cdots & C[a_1,a_n^{(p)}] \\ \Vdots & \Ddots & \Vdots - & ~emphase#\Hdotsfor{1}@ & \Vdots & \Ddots & \Vdots \\ + & \emph{\Hdotsfor{1}} & \Vdots & \Ddots & \Vdots \\ C[a_n,a_1] & \Cdots & C[a_n,a_n] & & C[a_n,a_1^{(p)}] & \Cdots & C[a_n,a_n^{(p)}] \\ -\rule{0pt}{15mm}\NotEmpty & ~emphase#\Vdotsfor{1}@ & & \Ddots & & ~emphase#\Vdotsfor{1}@ \\ +\rule{0pt}{15mm}\NotEmpty & \emph{\Vdotsfor{1}} & & \Ddots & & \emph{\Vdotsfor{1}} \\ C[a_1^{(p)},a_1] & \Cdots & C[a_1^{(p)},a_n] & & C[a_1^{(p)},a_1^{(p)}] & \Cdots & C[a_1^{(p)},a_n^{(p)}] \\ \Vdots & \Ddots & \Vdots - & ~emphase#\Hdotsfor{1}@ & \Vdots & \Ddots & \Vdots \\ + & \emph{\Hdotsfor{1}} & \Vdots & \Ddots & \Vdots \\ C[a_n^{(p)},a_1] & \Cdots & C[a_n^{(p)},a_n] & & C[a_n^{(p)},a_1^{(p)}] & \Cdots & C[a_n^{(p)},a_n^{(p)}] \end{bNiceMatrix} -\end{Verbatim} +\end{Code} +\end{scope} \[\begin{bNiceMatrix} @@ -3395,15 +3433,15 @@ le résultat fourni par \pkg{nicematrix}.\par\nobreak \medskip \begin{scope} \NiceMatrixOptions{renew-dots,renew-matrix} -\begin{BVerbatim}[baseline=c,boxwidth=10cm] -~emphase#\NiceMatrixOptions{renew-dots,renew-matrix}@ +\begin{Code}[width=10cm] +\emph{\NiceMatrixOptions{renew-dots,renew-matrix}} \begin{pmatrix} 1 & \cdots & \cdots & 1 \\ 0 & \ddots & & \vdots \\ \vdots & \ddots & \ddots & \vdots \\ 0 & \cdots & 0 & 1 \end{pmatrix} -\end{BVerbatim} +\end{Code} $\begin{pmatrix} 1 & \cdots & \cdots & 1 \\ 0 & \ddots & & \vdots \\ @@ -3429,17 +3467,17 @@ en fait composé sur un fond blanc qui est superposé sur la ligne en pointillé (voir un exemple p.~\pageref{ex:colon}). \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] $\begin{bNiceMatrix} -1 & \hspace*{1cm} & 0 \\[8mm] - & ~emphase#\Ddots^{n \text{ fois}}@ & \\ -0 & & 1 +1 & \hspace*{1cm} & 0 \\[8mm] + & \emph{\Ddots^{n \text{ fois}}} & \\ +0 & & 1 \end{bNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{bNiceMatrix} -1 & \hspace*{1cm} & 0 \\[8mm] +1 & \hspace*{1cm} & 0 \\[8mm] & \Ddots^{n \text{ fois}} & \\ -0 & & 1 +0 & & 1 \end{bNiceMatrix}$ @@ -3448,17 +3486,17 @@ $\begin{bNiceMatrix} Avec la clé |xdots/horizontal-labels|, les labels restent horizontaux.\par\nobreak \smallskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] -$\begin{bNiceMatrix}[xdots/horizontal-labels] -1 & \hspace*{1cm} & 0 \\[8mm] - & ~emphase#\Ddots^{n \text{ fois}}@ & \\ -0 & & 1 +\begin{Code}[width=10cm] +$\begin{bNiceMatrix}[\emph{xdots/horizontal-labels}] +1 & \hspace*{1cm} & 0 \\[8mm] + & \emph{\Ddots^{n \text{ fois}}} & \\ +0 & & 1 \end{bNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{bNiceMatrix}[xdots/horizontal-labels] -1 & \hspace*{1cm} & 0 \\[8mm] +1 & \hspace*{1cm} & 0 \\[8mm] & \Ddots^{n \text{ fois}} & \\ -0 & & 1 +0 & & 1 \end{bNiceMatrix}$ @@ -3552,9 +3590,9 @@ ronds avec TikZ :\newline \small \url{https://tex.stackexchange.com/questions/52848/tikz-line-with-large-dots}} -\begin{BVerbatim}[baseline=c,boxwidth=9cm] +\begin{Code}[width=9cm] \tikz \draw [dotted] (0,0) -- (5,0) ; -\end{BVerbatim} +\end{Code} \tikz \draw [dotted] (0,0) -- (5,0) ; \medskip @@ -3575,8 +3613,8 @@ d'options TikZ applicables à un chemin (à l'exception de «|color|», Voici par exemple une matrice tridiagonale avec le style |loosely dotted| :\par\nobreak \medskip -\begin{BVerbatim}[baseline=c] -$\begin{pNiceMatrix}[nullify-dots,~emphase#xdots/line-style=loosely dotted@] +\begin{Code} +$\begin{pNiceMatrix}[nullify-dots,\emph{xdots/line-style=loosely dotted}] a & b & 0 & & \Cdots & 0 \\ b & a & b & \Ddots & & \Vdots \\ 0 & b & a & \Ddots & & \\ @@ -3584,7 +3622,7 @@ b & a & b & \Ddots & & \Vdots \\ \Vdots & & & & & b \\ 0 & \Cdots & & 0 & b & a \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} \[\begin{pNiceMatrix}[nullify-dots,xdots/line-style=loosely dotted] @@ -3609,14 +3647,14 @@ créés par |custom-line| ne sont pas tracés dans les blocs).\footnote{En revan (cf.~p.~\pageref{line-in-code-after}) ne crée pas de bloc.} \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10.6cm] -$\begin{bNiceMatrix}[margin,~emphase#hvlines@] +\begin{Code}[width=10.6cm] +$\begin{bNiceMatrix}[margin,\emph{hvlines}] \Block{3-3}<\LARGE>{A} & & & 0 \\ & \hspace*{1cm} & & \Vdots \\ & & & 0 \\ 0 & \Cdots& 0 & 0 \end{bNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{bNiceMatrix}[margin,hvlines] \Block{3-3}<\LARGE>{A} & & & 0 \\ & \hspace*{1cm} & & \Vdots \\ @@ -3652,13 +3690,13 @@ Tous les délimiteurs extensibles de LaTeX peuvent être utilisés. Voici un exemple qui utilise |\lgroup| et |\rgroup|. \medskip -\begin{BVerbatim} -$\begin{NiceArray}{~emphase#\left\lgroup@ ccc~emphase#\right\rgroup@ l} +\begin{Code} +$\begin{NiceArray}{\emph{\left\lgroup} ccc\emph{\right\rgroup} l} 1 & 2 & 3 & 4 & 1 & 6 & 7 & 8 & 9 & \scriptstyle L_3 \gets L_3 + L_1 + L_2 \end{NiceArray}$ -\end{BVerbatim} +\end{Code} \[\begin{NiceArray}{\left\lgroup ccc\right\rgroup l} 1 & 2 & 3 & \\ @@ -3672,11 +3710,36 @@ Pour cet exemple, on aurait aussi pu utiliser |{NiceArrayWithDelims}| et la clé |last-col| (cf. p.~\pageref{exterior}). \bigskip -Il y a un cas particulier : pour les délimiteurs |(|, |[| et |\{| (et les -délimiteurs fermants correspondants), les préfixes |\left| et |\right| sont -facultatifs.\footnote{Pour les délimiteurs \texttt{[} et \texttt{]}, - les préfixes restent obligatoires en cas de conflit de notation avec des - crochets d'options de certains descripteurs de colonnes.} +Il y a un cas particulier : pour les délimiteurs |(|, |[| et |\{|\footnote{ Pour + les accolades, la protection par la contre-oblique est obligatoire (c'est + pourquoi on a écrit |\{|).}, et les délimiteurs fermants correspondants, les +préfixes |\left| et |\right| sont facultatifs.\footnote{Pour les délimiteurs + \texttt{[} et \texttt{]}, les préfixes restent obligatoires en cas de conflit + de notation avec des crochets d'options de certains descripteurs de + colonnes.} + + +\bigskip +Voici un exemple avec un délimiteur |\{| à gauche dans un |{NiceTabular}| (on +remarquera la compatibilité avec la clé |t|). + +\smallskip +\begin{Code} +On définit $f$ par\quad +\begin{NiceTabular}[t]{\{ll} +$f(x) = 0$ & si $x$ est négatif \\ +$f(x) = 1-e^x$ & si $x$ est positif +\end{NiceTabular} +\end{Code} + +\smallskip +\begin{center} +On définit $f$ par\quad +\begin{NiceTabular}[t]{\{ll} +$f(x) = 0$ & si $x$ est négatif \\ +$f(x) = 1-e^x$ & si $x$ est positif +\end{NiceTabular} +\end{center} \bigskip Dans le cas de deux délimiteurs successifs (nécessairement un fermant suivi d'un @@ -3684,13 +3747,13 @@ ouvrant pour une autre sous-matrice) un espace égal à |\enskip| est inséré automatiquement. \medskip -\begin{BVerbatim} -$\begin{pNiceArray}{~emphase#(c)(c)(c)@} +\begin{Code} +$\begin{pNiceArray}{\emph{(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} +\end{Code} \[\begin{pNiceArray}{(c)(c)(c)} a_{11} & a_{12} & a_{13} \\ @@ -3761,16 +3824,16 @@ Cette commande peut par exemple être utilisée pour tracer une ligne entre deux cases adjacentes. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=11cm] +\begin{Code}[width=11cm] \NiceMatrixOptions{xdots/shorten = 0.6 em} \begin{pNiceMatrix} I & 0 & \Cdots &0 \\ 0 & I & \Ddots &\Vdots\\ \Vdots &\Ddots & I &0 \\ 0 &\Cdots & 0 &I -~emphase#\CodeAfter \line{2-2}{3-3}@ +\emph{\CodeAfter \line{2-2}{3-3}} \end{pNiceMatrix} -\end{BVerbatim} +\end{Code} \begin{scope} \NiceMatrixOptions{xdots/shorten = 0.6 em} $\begin{pNiceMatrix} @@ -3788,15 +3851,15 @@ autres lignes diagonales (par défaut, les lignes tracées par |\Ddots| sont «parallélisées» : cf.~p.~\pageref{parallelization}). \medskip -\begin{BVerbatim} +\begin{Code} \begin{bNiceMatrix} 1 & \Cdots & & 1 & 2 & \Cdots & 2 \\ 0 & \Ddots & & \Vdots & \Vdots & \hspace*{2.5cm} & \Vdots \\ \Vdots & \Ddots & & & & & \\ 0 & \Cdots & 0 & 1 & 2 & \Cdots & 2 -~emphase#\CodeAfter \line[shorten=6pt]{1-5}{4-7}@ +\emph{\CodeAfter \line[shorten=6pt]{1-5}{4-7}} \end{bNiceMatrix} -\end{BVerbatim} +\end{Code} \[\begin{bNiceMatrix} 1 & \Cdots & & 1 & 2 & \Cdots & 2 \\ 0 & \Ddots & & \Vdots & \Vdots & \hspace*{2.5cm} & \Vdots \\ @@ -3843,17 +3906,16 @@ colonne avec |@{\hspace{1.5em}}| dans le préambule du tableau. \medskip \begin{scope} \hfuzz=15cm -\fvset{commandchars=\~\#\+}% -\begin{BVerbatim}[boxwidth=11cm,baseline=c] -\[\begin{NiceArray}{ccc~emphase#@{\hspace{1.5em}}+c}[cell-space-limits=2pt,~emphase#margin+] +\begin{Code}[width=11cm] +\[\begin{NiceArray}{ccc\emph{@{\hspace{1.5em}}}c}[cell-space-limits=2pt,\emph{margin}] 1 & 1 & 1 & x \\ \dfrac{1}{4} & \dfrac{1}{2} & \dfrac{1}{4} & y \\ 1 & 2 & 3 & z \CodeAfter - ~emphase#\SubMatrix({1-1}{3-3})+ - ~emphase#\SubMatrix({1-4}{3-4})+ + \emph{\SubMatrix({1-1}{3-3}) + \SubMatrix({1-4}{3-4})} \end{NiceArray}\] -\end{BVerbatim} +\end{Code} \end{scope} $\begin{NiceArray}{ccc@{\hspace{1.5em}}c}[cell-space-limits=2pt,margin] 1 & 1 & 1 & x \\ @@ -3873,13 +3935,13 @@ avec la construction suivante. \medskip \begin{scope} \hfuzz=15cm -\begin{BVerbatim}[boxwidth=11cm,baseline=c] -$\begin{NiceArray}{~emphase#(ccc)(c)@}[cell-space-limits=2pt] +\begin{Code}[width=11cm] +$\begin{NiceArray}{\emph{(ccc)(c)}}[cell-space-limits=2pt] 1 & 1 & 1 & x \\ \dfrac{1}{4} & \dfrac{1}{2} & \dfrac{1}{4} & y \\ 1 & 2 & 3 & z \end{NiceArray}$ -\end{BVerbatim} +\end{Code} \end{scope} $\begin{NiceArray}{(ccc)(c)}[cell-space-limits=2pt] 1 & 1 & 1 & x \\ @@ -3897,15 +3959,15 @@ exposant et en indice. \medskip \begin{scope} \hfuzz=15cm -\begin{BVerbatim}[boxwidth=11cm,baseline=c] +\begin{Code}[width=11cm] $\begin{bNiceMatrix}[right-margin=1em] 1 & 1 & 1 \\ 1 & a & b \\ 1 & c & d \CodeAfter - ~emphase#\SubMatrix[{2-2}{3-3}]^{T}@ + \emph{\SubMatrix[{2-2}{3-3}]^{T}} \end{bNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{bNiceMatrix}[right-margin=1em] 1 & 1 & 1 \\ 1 & a & b \\ @@ -3964,19 +4026,18 @@ préfixe |sub-matrix|, c'est-à-dire qu'elles sont alors nommées \medskip \begin{scope} \hfuzz=12cm -\fvset{commandchars=\~\#\!}% -\begin{BVerbatim}[baseline=c,boxwidth=11cm] +\begin{Code}[width=11cm] $\begin{NiceArray}{cc@{\hspace{5mm}}l}[cell-space-limits=2pt] - & & \frac12 \\ - & & \frac14 \\[1mm] -a & b & \frac12a+\frac14b \\ -c & d & \frac12c+\frac14d \\ + & & \frac{1}{2} \\ + & & \frac{1}{4} \\[1mm] +a & b & \frac{1}{2}a+\frac{1}{4}b \\ +c & d & \frac{1}{2}c+\frac{1}{4}d \\ \CodeAfter \SubMatrix({1-3}{2-3}) \SubMatrix({3-1}{4-2}) \SubMatrix({3-3}{4-3}) \end{NiceArray}$ -\end{BVerbatim} +\end{Code} \end{scope} $\begin{NiceArray}{cc@{\hspace{5mm}}l}[cell-space-limits=2pt] & & \frac12 \\ @@ -3995,19 +4056,18 @@ Voici le même exemple avec la clé |slim| pour l'une des sous-matrices. \medskip \begin{scope} \hfuzz=12cm -\fvset{commandchars=\~\#\!}% -\begin{BVerbatim}[baseline=c,boxwidth=11cm] +\begin{Code}[width=11cm] $\begin{NiceArray}{cc@{\hspace{5mm}}l}[cell-space-limits=2pt] - & & \frac12 \\ - & & \frac14 \\[1mm] -a & b & \frac12a+\frac14b \\ -c & d & \frac12c+\frac14d \\ + & & \frac{1}{2} \\ + & & \frac{1}{4} \\[1mm] +a & b & \frac{1}{2}a+\frac{1}{4}b \\ +c & d & \frac{1}{2}c+\frac{1}{4}d \\ \CodeAfter - \SubMatrix({1-3}{2-3})[~emphase#slim!] + \SubMatrix({1-3}{2-3})[\emph{slim}] \SubMatrix({3-1}{4-2}) \SubMatrix({3-3}{4-3}) \end{NiceArray}$ -\end{BVerbatim} +\end{Code} \end{scope} % $\begin{NiceArray}{cc@{\hspace{5mm}}l}[cell-space-limits=2pt] @@ -4044,17 +4104,17 @@ En dépit de son nom, la commande |\SubMatrix| peut également être utilisée d |\toprule| de l'extension \pkg{booktabs}). \smallskip -\begin{BVerbatim}[baseline=c] -\begin{NiceTabular}{~LetterAt{}ll~LetterAt{}} +\begin{Code}[width=8cm] +\begin{NiceTabular}{@{}ll@{}} \toprule Part A & the first part \\ \Block{2-1}{Part B} & a first sub-part \\ & a second sub-part \\ \bottomrule \CodeAfter - ~emphase#\SubMatrix{\{}{2-2}{3-2}{.}@ + \emph{\emph{\SubMatrix{\{}{2-2}{3-2}{.}}} \end{NiceTabular} -\end{BVerbatim} +\end{Code} \hspace{2cm} \begin{NiceTabular}{@{}ll@{}} \toprule @@ -4069,7 +4129,7 @@ Part A & the first part \\ \vspace{1cm} \emph{Attention} : La fonctionnalité suivante est fragile et ne fonctionne pas -avec le cheminement |latex|--|dvips|--|ps2pdf|.\par\nobreak +avec |latex|--|dvips|--|ps2pdf|.\par\nobreak La clé |code| de la commande |\SubMatrix| permet d'insérer du code après la création de la matrice. Elle a surtout pour vocation d'être utilisée pour @@ -4081,8 +4141,7 @@ dans cette clé, les nœuds de la forme \verb+i-|j+ sont interprétés avec \medskip \begin{scope} -\fvset{commandchars=\~\#\!}% -\begin{Verbatim} +\begin{Code} $\begin{NiceArray}{ccc@{}w{c}{5mm}@{}ccc} & & && -1 & 1 & 2 \\ & & && 0 & 3 & 4 \\ @@ -4091,12 +4150,12 @@ $\begin{NiceArray}{ccc@{}w{c}{5mm}@{}ccc} 0 & 4 & 5 && 0 & 12 & 41 \\ 0 & 0 & 6 && 0 & 0 & 30 \CodeAfter - ~emphase#\NewDocumentCommand{\MyDraw}{}{\tikz \draw [blue] (2-|1) -| (3-|2) -| (4-|3) ;}! - \SubMatrix({1-5}{3-7})[~emphase#code = \MyDraw!] - \SubMatrix({4-1}{6-3})[~emphase#code = \MyDraw!] - \SubMatrix({4-5}{6-7})[~emphase#code = \MyDraw!] + \emph{\NewDocumentCommand{\MyDraw}{}{\tikz \draw [blue] (2-|1) -| (3-|2) -| (4-|3) ;}} + \SubMatrix({1-5}{3-7})[\emph{code = \MyDraw}] + \SubMatrix({4-1}{6-3})[\emph{code = \MyDraw}] + \SubMatrix({4-5}{6-7})[\emph{code = \MyDraw}] \end{NiceArray}$ -\end{Verbatim} +\end{Code} \end{scope} @@ -4144,15 +4203,15 @@ numéro de rangée et $j$ le numéro de colonne ; \end{itemize} \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=9cm] +\begin{Code}[width=9cm] \begin{pNiceMatrix} 1 & 2 & 3 & 4 & 5 & 6 \\ 11 & 12 & 13 & 14 & 15 & 16 \\ \CodeAfter - ~emphase#\OverBrace{1-1}{2-3}{A}@ - ~emphase#\OverBrace{1-4}{2-6}{B}@ + \emph{\OverBrace{1-1}{2-3}{A} + \OverBrace{1-4}{2-6}{B}} \end{pNiceMatrix} -\end{BVerbatim} +\end{Code} $\begin{pNiceMatrix} 1 & 2 & 3 & 4 & 5 & 6 \\ 11 & 12 & 13 & 14 & 15 & 16 \\ @@ -4192,15 +4251,15 @@ c'est la position du filet vertical éventuel qui est utilisée (de même pour \end{itemize} \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=9cm] +\begin{Code}[width=9cm] \begin{pNiceMatrix} 1 & 2 & 3 & 4 & 5 & 6 \\ 11 & 12 & 13 & 14 & 15 & 16 \\ \CodeAfter - \OverBrace~emphase#[shorten,yshift=3pt]@{1-1}{2-3}{A} - \OverBrace~emphase#[shorten,yshift=3pt]@{1-4}{2-6}{B} + \OverBrace\emph{[shorten,yshift=3pt]}{1-1}{2-3}{A} + \OverBrace\emph{[shorten,yshift=3pt]}{1-4}{2-6}{B} \end{pNiceMatrix} -\end{BVerbatim} +\end{Code} $\begin{pNiceMatrix} 1 & 2 & 3 & 4 & 5 & 6 \\ 11 & 12 & 13 & 14 & 15 & 16 \\ @@ -4224,7 +4283,7 @@ exécute avec TikZ le chemin rectangulaire qui correspond à chaque case du tabl avec comme paramètres TikZ l'argument de |\TikzEveryCell|. Cet argument doit être une liste de couples \textsl{clé=valeur} applicables à un chemin TikZ. En fait, cette commande s'applique à chaque case du tableau, exceptées -celles situées dans les rangées et colonnes extérieures (cf.~p.~\pageref{exterior})o et celles situées dans +celles situées dans les rangées et colonnes extérieures (cf.~p.~\pageref{exterior}) et celles situées dans les coins vides (quand la clé |corners| est utilisée: cf.~p.~\pageref{corners}). Elle s'applique en fait à chaque bloc (sauf ceux qui ont la clé |transparent|) et ne s'applique pas aux cases situées dans ces blocs. @@ -4241,7 +4300,7 @@ l'argument de |\TikzEveryCell|. \medskip \begingroup \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=9cm] +\begin{Code}[width=9cm] \renewcommand{\arraystretch}{1.3} \begin{NiceTabular}{ccc}[corners] @@ -4250,9 +4309,9 @@ l'argument de |\TikzEveryCell|. & cell 1 1 & cell 1 2 \\ & cell 2 1 & cell 2 2 \CodeAfter - ~emphase#\TikzEveryCell{offset=1pt,draw}@ + \emph{\TikzEveryCell{offset=1pt,draw}} \end{NiceTabular} -\end{BVerbatim} +\end{Code} \renewcommand{\arraystretch}{1.3} \begin{NiceTabular}{ccc}[corners] & \Block{1-2}{columns} \\ @@ -4363,8 +4422,6 @@ l'extension \pkg{xcolor} et elle n'est pas parfaitement compatible avec \subsection{Les notes de tableaux} \index{nota@\textbf{Notes dans les tableaux}|(} - - \label{tabularnote} \index{tabularnote@\texttt{\textbackslash tabularnote}} @@ -4381,23 +4438,20 @@ En fait, cette commande n'est disponible que si l'extension \pkg{enumitem} a ét chargée (avant ou après \pkg{nicematrix}). Les notes sont en effet composées en fin de tableau selon un type de liste défini par l'extension \pkg{enumitem}. -\begin{scope} -\fvset{commandchars=\~\#\!} -\begin{Verbatim} +\begin{Code} \begin{NiceTabular}{@{}llr@{}} \toprule \RowStyle{\bfseries} Nom & Prénom & Date de naissance \\ \midrule -Achard~emphase#\tabularnote{La famille Achard est une très ancienne famille du Poitou.}! +Achard\emph{\tabularnote{La famille Achard est une très ancienne famille du Poitou.}} & Jacques & 5 juin 1962 \\ -Lefebvre~emphase#\tabularnote{Le patronyme Lefebvre est une altération de Lefébure.}! +Lefebvre\emph{\tabularnote{Le patronyme Lefebvre est une altération de Lefébure.}} & Mathilde & 23 mai 1988 \\ Vanesse & Stéphanie & 30 octobre 1994 \\ Dupont & Chantal & 15 janvier 1998 \\ \bottomrule \end{NiceTabular} -\end{Verbatim} -\end{scope} +\end{Code} \begin{center} \begin{NiceTabular}{@{}llr@{}} @@ -4475,35 +4529,37 @@ Voir sur la table \ref{t:tabularnote}, p.~\pageref{t:tabularnote}, certaines de remarques illustrées. Cette table a été composée avec le code suivant (l'extension \pkg{caption} a été chargée dans ce document). -\begin{center} -\fvset{commandchars=\~\#\!} -\begin{Verbatim}[formatcom=\small\color{gray}] -\begin{table} +\bigskip +\begin{scope} +\small +\begin{Code} +\begin{table}[hbt] \centering \NiceMatrixOptions{caption-above} \begin{NiceTabular}{@{}llc@{}}% [ caption = Un tableau dont la légende a été rentrée avec la clé \texttt{caption}% - ~emphase#\tabularnote[$\star$]{On peut mettre une note dans la légende.}! , - label = t:tabularnote , + \emph{\tabularnote[$\star$]{On peut mettre une note dans la légende.}} , + label = t:tabularnote, tabularnote = Un peu de texte avant les notes. , notes/bottomrule ] \toprule -Nom & Prénom & Durée de vie \\ +Nom & Prénom & Durée de vie \\ \midrule -Barrère & Bertrand & 86\\ -Nightingale~emphase#\tabularnote{Souvent considérée comme la première! - ~emphase#infirmière.}\tabularnote{Surnommée «la Dame à la Lampe».}! -& Florence~emphase#\tabularnote{Cette note est commune à deux appels de notes.}! & 90 \\ -Schœlcher & Victor & 89~emphase#\tabularnote{L'appel de note déborde à droite.}!\\ -Touchet & Marie~emphase#\tabularnote{Cette note est commune à deux appels de notes.}! & 89 \\ -Wallis & John & 87 \\ +Barrère & Bertrand & 86\\ +Nightingale\emph{\tabularnote{Souvent considérée comme la première infirmière.}% + \tabularnote{Surnommée «la Dame à la Lampe».}} + & Florence\emph{\tabularnote{Cette note est commune à deux appels de notes.}} & 90 \\ +Schœlcher & Victor & 89\emph{\tabularnote{L’appel de note déborde à droite.}} \\ +Touchet & Marie\emph{\tabularnote{Cette note est commune à deux appels de notes.}} & 89 \\ +Wallis & John & 87 \\ \bottomrule \end{NiceTabular} \end{table} -\end{Verbatim} -\end{center} +\end{Code} +\end{scope} + \begin{table}[hbt] \centering @@ -4523,7 +4579,7 @@ Barrère & Bertrand & 86\\ Nightingale\tabularnote{Souvent considérée comme la première infirmière.}\tabularnote{Surnommée «la Dame à la Lampe».} & Florence\tabularnote{Cette note est commune à deux appels de notes.} & 90 \\ -Schœlcher & Victor & 89\tabularnote{L'appel de note déborde à droite.}\\ +Schœlcher & Victor & 89\tabularnote{L’appel de note déborde à droite.}\\ Touchet & Marie\tabularnote{Cette note est commune à deux appels de notes.} & 89 \\ Wallis & John & 87 \\ \bottomrule @@ -4564,10 +4620,11 @@ Pour la commodité, il est aussi possible de fixer ces clés dans paires \textsl{clé=valeur} où le nom des clés n'a plus à être préfixé par |notes|: \begin{center} -\begin{BVerbatim}[formatcom = \small \color{gray}] +\small +\begin{Code} \NiceMatrixOptions { - notes = + \emph{notes} = { bottomrule , style = ... , @@ -4580,7 +4637,7 @@ paires \textsl{clé=valeur} où le nom des clés n'a plus à être préfixé par } } } -\end{BVerbatim} +\end{Code} \end{center} @@ -4626,9 +4683,9 @@ Valeur initiale : |\textsuperscript{#1}| Pour la composition du français, il est de tradition de mettre un petit espace avant l'appel de note. On peut faire ce réglage de la manière suivante : -\begin{Verbatim} -\NiceMatrixOptions{notes/label-in-tabular = \,\textsuperscript{~#1}} -\end{Verbatim} +\begin{Code} +\NiceMatrixOptions{notes/label-in-tabular = \,\textsuperscript{#1}} +\end{Code} \item La clé |notes/label-in-list| est une commande dont l'argument est @@ -4641,9 +4698,11 @@ Valeur initiale : |\textsuperscript{#1}| Pour la composition du français, on ne compose pas les labels des notes en lettres supérieures dans la liste des notes. On pourra donc prendre le réglage suivant : -\begin{Verbatim} -\NiceMatrixOptions{notes/label-in-list = ~#1.\nobreak\hspace{0.25em}} -\end{Verbatim} + +\begin{Code} +\NiceMatrixOptions{notes/label-in-list = #1.\nobreak\hspace{0.25em}} +\end{Code} + La commande |\nobreak| est pour le cas où l'option |para| est utilisée. @@ -4710,13 +4769,14 @@ Pour un exemple de personnalisation des notes de tableau, voir p.~\pageref{ex:no Si vous souhaitez utiliser les environnements |{NiceTabular}|, |{NiceTabular*}| ou |{NiceTabularX}| dans un environnement |{threeparttable}| de l'extension éponyme, vous devez patcher l'environnement |{threeparttable}| avec le code -suivant (avec une version de LaTeX postérieure à 2020/10/01). -\begin{Verbatim}[commandchars=\~\#\!] +suivant. + +\begin{Code} \makeatletter \AddToHook{env/threeparttable/begin} {\TPT@hookin{NiceTabular}\TPT@hookin{NiceTabular*}\TPT@hookin{NiceTabularX}} \makeatother -\end{Verbatim} +\end{Code} Néanmoins, les fonctionnalités proposées par \pkg{nicematrix} rendent peu utile l'utilisation de \pkg{threeparttable} en conjonction avec \pkg{nicematrix} (voir @@ -4758,8 +4818,8 @@ Cette clé est disponible dans tous les environnements et commandes de |\NiceMatrixOptions|. \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=9.5cm] -\begin{NiceTabular}{ccc}[hvlines,~emphase#rounded-corners@] +\begin{Code}[width=9.5cm] +\begin{NiceTabular}{ccc}[hvlines,\emph{rounded-corners}] \CodeBefore \rowcolor{red!15}{1} \Body @@ -4767,7 +4827,7 @@ Cette clé est disponible dans tous les environnements et commandes de Arvy & Jacques & Dentiste \\ Jalon & Amandine & Dentiste \\ \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{ccc}[hvlines,rounded-corners] \CodeBefore \rowcolor{red!15}{1} @@ -4793,14 +4853,14 @@ semi-transparent pour estomper le tableau (attention : certains lecteurs de \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10.6cm] +\begin{Code}[width=10.6cm] \begin{NiceTabular}{ccc}[hvlines,cell-space-limits=3pt] \Block{2-2}{} & & test \\ & & blabla \\ & some text & nothing -~emphase#\CodeAfter \ShowCellNames@ +\emph{\CodeAfter \ShowCellNames} \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{ccc}[hvlines,cell-space-limits=3pt] \Block{2-2}{} & & test \\ & & blabla \\ @@ -4820,15 +4880,15 @@ de type |S| de \pkg{siunitx} dans les environnements de \pkg{nicematrix}. L'impl aucune macro privée de \pkg{siunitx}. \medskip -\begin{BVerbatim}[baseline = c, boxwidth = 10.6cm] -$\begin{pNiceArray}{~emphase#S@cW{c}{1cm}c}[nullify-dots,first-row] +\begin{Code}[width = 10.6cm] +$\begin{pNiceArray}{\emph{S}cW{c}{1cm}c}[nullify-dots,first-row] {C_1} & \Cdots & & C_n \\ 2.3 & 0 & \Cdots & 0 \\ 12.4 & \Vdots & & \Vdots \\ 1.45 \\ 7.2 & 0 & \Cdots & 0 \end{pNiceArray}$ -\end{BVerbatim} +\end{Code} $\begin{pNiceArray}{ScW{c}{1cm}c}[nullify-dots,first-row] {C_1} & \Cdots & & C_n \\ 2.3 & 0 & \Cdots & 0 \\ @@ -4856,12 +4916,12 @@ que la commande |\pAutoNiceMatrix| et ses variantes, acceptent la clé Les clés |l| et |r| sont des raccourcis pour |columns-type=l| et |columns-type=r|. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] -$\begin{bNiceMatrix}[r] +\begin{Code}[width=10cm] +$\begin{bNiceMatrix}\emph{[r]} \cos x & - \sin x \\ \sin x & \cos x \end{bNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{bNiceMatrix}[r] \cos x & - \sin x \\ \sin x & \cos x @@ -4886,9 +4946,9 @@ Dans l'exemple suivant, on l'utilise dans le |code-for-first-row|.\footnote{On \medskip -\begin{BVerbatim}[baseline=c,boxwidth=12cm] +\begin{Code}[width=12cm] \NiceMatrixOptions - {code-for-first-row = \scriptstyle ~emphase#\rotate@ \text{image de }, + {code-for-first-row = \scriptstyle \emph{\rotate} \text{image de }, code-for-last-col = \scriptstyle } $A = \begin{pNiceMatrix}[first-row,last-col=4] e_1 & e_2 & e_3 \\ @@ -4896,7 +4956,7 @@ e_1 & e_2 & e_3 \\ 4 & 5 & 6 & e_2 \\ 7 & 8 & 9 & e_3 \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} \begin{varwidth}{10cm} \NiceMatrixOptions {code-for-first-row = \scriptstyle\rotate \text{image de }, @@ -4920,9 +4980,9 @@ Si la commande |\rotate| est utilisée dans la «dernière rangée» (extérieur matrice), les éléments qui subissent cette rotation sont alignés vers le haut. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=12cm] +\begin{Code}[width=12cm] \NiceMatrixOptions - {code-for-last-row = \scriptstyle ~emphase#\rotate@ , + {code-for-last-row = \scriptstyle \emph{\rotate} , code-for-last-col = \scriptstyle } $A = \begin{pNiceMatrix}[last-row,last-col=4] 1 & 2 & 3 & e_1 \\ @@ -4930,7 +4990,7 @@ $A = \begin{pNiceMatrix}[last-row,last-col=4] 7 & 8 & 9 & e_3 \\ \text{image de } e_1 & e_2 & e_3 \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} \begin{varwidth}{10cm} \NiceMatrixOptions {code-for-last-row = \scriptstyle\rotate , @@ -4970,8 +5030,8 @@ de l'\pkg{amsmath} (et les environnements |{psmallmatrix}|, |{bsmallmatrix}|, etc. de \pkg{mathtools}). \medskip -\begin{Verbatim} -$\begin{bNiceArray}{cccc|c}[~emphase#small@, +\begin{Code} +$\begin{bNiceArray}{cccc|c}[\emph{small}, last-col, code-for-last-col = \scriptscriptstyle, columns-width = 3mm ] @@ -4979,7 +5039,7 @@ $\begin{bNiceArray}{cccc|c}[~emphase#small@, 0 & 3 & 2 & 1 & 2 & L_2 \gets 2 L_1 - L_2 \\ 0 & 1 & 1 & 2 & 3 & L_3 \gets L_1 + L_3 \end{bNiceArray}$ -\end{Verbatim} +\end{Code} % \[\begin{bNiceArray}{cccc|c}[small, last-col, code-for-last-col = \scriptscriptstyle, columns-width=3mm] 1 & -2 & 3 & 4 & 5 \\ @@ -5031,18 +5091,18 @@ Dans le |\CodeBefore| (cf. p. \pageref{code-before}) et dans le |\CodeAfter| (hors potentielles colonnes extérieures). \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10.6cm] +\begin{Code}[width=10.6cm] $\begin{pNiceMatrix}% [first-row, first-col, - code-for-first-row = \mathbf{~emphase#\alph{jCol}@} , - code-for-first-col = \mathbf{~emphase#\arabic{iRow}@} ] + code-for-first-row = \mathbf{\emph{\alph{jCol}}} , + code-for-first-col = \mathbf{\emph{\arabic{iRow}}} ] & & & & \\ & 1 & 2 & 3 & 4 \\ & 5 & 6 & 7 & 8 \\ & 9 & 10 & 11 & 12 \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{pNiceMatrix}[first-row, first-col, code-for-first-row = \mathbf{\alph{jCol}} , @@ -5078,9 +5138,9 @@ simplement des tokens qui seront insérés dans chaque case de la matrice). \medskip -\begin{Verbatim} -$C = ~emphase#\pAutoNiceMatrix@{3-3}{C_{\arabic{iRow},\arabic{jCol}}}$ -\end{Verbatim} +\begin{Code} +$C = \emph{\pAutoNiceMatrix}{3-3}{C_{\arabic{iRow},\arabic{jCol}}}$ +\end{Code} \[C = \pAutoNiceMatrix{3-3}{C_{\arabic{iRow},\arabic{jCol}}}\] @@ -5100,13 +5160,13 @@ sont considérés comme un tout. \medskip \begin{scope} -\begin{BVerbatim}[baseline=c,boxwidth=10cm] -$\begin{bNiceMatrix}[~emphase#light-syntax@,first-row,first-col] +\begin{Code}[width=10cm] +$\begin{bNiceMatrix}[\emph{light-syntax},first-row,first-col] {} a b ; a 2\cos a {\cos a + \cos b} ; b \cos a+\cos b { 2 \cos b } \end{bNiceMatrix}$ -\end{BVerbatim} +\end{Code} \end{scope} % $\begin{bNiceMatrix}[light-syntax,first-row,first-col] @@ -5131,6 +5191,14 @@ dans les cases du tableau.\footnote{La raison en est que lorsque l'option |light après.} +\medskip +\colorbox{yellow!50}{\textbf{Nouveau 6.27}}\enskip La clé +|light-syntax-expanded| a le même comportement que la clé |light-syntax| mais +avec cette différence que le corps de l'environnement est complètement développé +(au sens de TeX) avant découpe en lignes (mais après l'extraction de l'éventuel +|\CodeAfter|). + + \subsection{Couleur des délimiteurs} \index{delimiters!---/color pour un environnement} @@ -5142,12 +5210,12 @@ etc.), il est possible de changer la couleur des délimiteurs avec la clé |delimiters/color|. \medskip -\begin{BVerbatim}[boxwidth=12cm,baseline=c] -$\begin{bNiceMatrix}[delimiters/color=red] +\begin{Code}[width=12cm] +$\begin{bNiceMatrix}[\emph{delimiters/color=red}] 1 & 2 \\ 3 & 4 \end{bNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{bNiceMatrix}[delimiters/color=red] 1 & 2 \\ 3 & 4 @@ -5162,7 +5230,6 @@ préambule des environnements à préambule (cf.~p.~\pageref{delimiters-in-pream \subsection{L'environnement \{NiceArrayWithDelims\}} \label{NiceArrayWithDelims} - \index{NiceArrayWithDelims@\texttt{\{NiceArrayWithDelims\}}} En fait, l'environnement |{pNiceArray}| et ses variantes sont fondés sur un @@ -5173,14 +5240,14 @@ d'utiliser |{NiceArrayWithDelims}| si on a besoin de délimiteurs atypiques ou asymétriques. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=11cm] -$\begin{~emphase#NiceArrayWithDelims@} +\begin{Code}[width=11cm] +$\begin{\emph{NiceArrayWithDelims}} {\downarrow}{\uparrow}{ccc}[margin] 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 -\end{~emphase#NiceArrayWithDelims@}$ -\end{BVerbatim} +\end{\emph{NiceArrayWithDelims}}$ +\end{Code} % $\begin{NiceArrayWithDelims} {\downarrow}{\uparrow}{ccc}[margin] @@ -5205,7 +5272,8 @@ Pour un exemple d'utilisation, voir \url{tex.stackexchange.com/questions/488566} \section{Utilisation de TikZ avec nicematrix} -\label{name}\label{PGF-nodes} +\label{name} +\label{PGF-nodes} \index{tikza@TikZ (utilisation avec \pkg{nicematrix})} \index{noeud@\textbf{Nœuds PGF/Tikz}|(} @@ -5265,15 +5333,15 @@ avec \textsc{pgf} mais l'utilisateur final préférera sans doute utiliser TikZ on suppose que TikZ a été chargé par l'utilisateur. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=11cm] -$\begin{pNiceMatrix}[name=~emphase#ma-matrice@] +\begin{Code}[width=11cm] +$\begin{pNiceMatrix}[name = \emph{ma-matrice}] 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{pNiceMatrix}$ \tikz[remember picture,overlay] - \draw ~emphase#(ma-matrice-2-2)@ circle (2mm) ; -\end{BVerbatim} + \draw \emph{(ma-matrice-2-2)} circle (2mm) ; +\end{Code} $\begin{pNiceMatrix}[name=ma-matrice] 1 & 2 & 3 \\ 4 & 5 & 6 \\ @@ -5293,15 +5361,15 @@ préciser l'environnement qui est évidemment l'environnement courant. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=11cm] +\begin{Code}[width=11cm] $\begin{pNiceMatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \CodeAfter -\tikz \draw ~emphase#(2-2)@ circle (2mm) ; +\tikz \draw \emph{(2-2)} circle (2mm) ; \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{pNiceMatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ @@ -5342,16 +5410,16 @@ sont tracés en utilisant un style PGF spécifique. Ce style est nommé |nicematrix/cell-node| et sa définition dans le fichier source |nicematrix.sty| est la suivante : -\begin{Verbatim} +\begin{Code} \pgfset { - ~emphase#nicematrix / cell-node@ /.style = + \emph{nicematrix / cell-node} /.style = { inner sep = 0 pt , minimum width = 0 pt } } -\end{Verbatim} +\end{Code} L'utilisateur peut modifier ce style en changeant les valeurs des clés |text/rotate|, |inner xsep|, |inner ysep|, |inner sep|, |outer xsep|, |outer ysep|, |outer sep|, @@ -5386,7 +5454,7 @@ cas des colonnes de type |p|, |m| ou |b| dans lesquelles les nœuds ont toujours une largeur égale à la largeur de la colonne. Dans l'exemple suivant, la commande |\lipsum| est fournie par l'extension éponyme. -\begin{Verbatim} +\begin{Code} \begin{NiceTabular}{V{10cm}} \bfseries \large Titre \\ @@ -5394,7 +5462,7 @@ Titre \\ \CodeAfter \tikz \draw [rounded corners] (1-1) -| (last-|2) -- (last-|1) |- (1-1) ; \end{NiceTabular} -\end{Verbatim} +\end{Code} \begin{center} \begin{NiceTabular}{V{10cm}} @@ -5558,14 +5626,14 @@ et ne correspondent donc pas nécessairement aux cases délimitées par des file Voici un tableau qui a été composé de la manière suivante : \medskip -\begin{BVerbatim} +\begin{Code} \large \begin{NiceTabular}{wl{2cm}ll}[hvlines] fraise & amande & abricot \\ prune & pêche & poire \\[1ex] noix & noisette & brugnon \end{NiceTabular} -\end{BVerbatim} +\end{Code} \end{minipage} \hspace{1cm} \begin{scope} @@ -5640,8 +5708,7 @@ du tableau proprement dit). Voici un exemple d'utilisation de ces nœuds dans le |\CodeAfter|. \begin{center} -\fvset{commandchars=\~\#\+} -\begin{Verbatim} +\begin{Code} \begin{NiceArray}{c@{\;}c@{\;}c@{\;}c@{\;}c}[create-medium-nodes] u_1 &-& u_0 &=& r \\ u_2 &-& u_1 &=& r \\ @@ -5659,7 +5726,7 @@ Voici un exemple d'utilisation de ces nœuds dans le |\CodeAfter|. (4-1.north west) -- (5-3.south east) (5-1.north west) -- (6-3.south east) ; \end{NiceArray} -\end{Verbatim} +\end{Code} \end{center} % \[\begin{NiceArray}{c@{\;}c@{\;}c@{\;}c@{\;}c}[create-medium-nodes] @@ -5721,10 +5788,10 @@ horizontal~$i$ et du filet vertical~$j$ avec la syntaxe |(|$i$\verb+-|+$j$|)|. \medskip -\begin{Verbatim} +\begin{Code} \begin{NiceMatrix} \CodeBefore -~emphase#\tikz \draw [fill=red!15] (7-|4) |- (8-|5) |- (9-|6) |- cycle ;@ +\emph{\tikz \draw [fill=red!15] (7-|4) |- (8-|5) |- (9-|6) |- cycle ;} \Body 1 \\ 1 & 1 \\ @@ -5736,7 +5803,7 @@ horizontal~$i$ et du filet vertical~$j$ avec la syntaxe |(|$i$\verb+-|+$j$|)|. 1 & 7 & 21 & 35 & 35 & 21 & 7 & 1 \\ 1 & 8 & 28 & 56 & 70 & 56 & 28 & 8 & 1 \end{NiceMatrix} -\end{Verbatim} +\end{Code} % \[\begin{NiceMatrix} \CodeBefore @@ -5758,15 +5825,15 @@ Les nœuds de la forme $i$|.5| peuvent être utilisés par exemple pour barrer u ligne (si on a chargé TikZ). \smallskip -\begin{BVerbatim}[boxwidth=11cm,baseline=c] +\begin{Code}[width=11cm] $\begin{pNiceArray}{ccc|c} 2 & 1 & 3 & 0 \\ 3 & 3 & 1 & 0 \\ 3 & 3 & 1 & 0 \CodeAfter - \tikz \draw [red] (~emphase#3.5@-|1) -- (~emphase#3.5@-|last) ; + \tikz \draw [red] (\emph{3.5}-|1) -- (\emph{3.5}-|last) ; \end{pNiceArray}$ -\end{BVerbatim} +\end{Code} $\begin{pNiceArray}{ccc|c} 2 & 1 & 3 & 0 \\ 3 & 3 & 1 & 0 \\ @@ -5865,7 +5932,7 @@ utilise explicitement la variable publique |\g_nicematrix_code_before_tl|. \begin{scope} \fvset{commandchars=\§\¤\μ} -\begin{Verbatim} +\begin{Code} \ExplSyntaxOn \cs_new_protected:Nn \__pantigny_crossbox:nnn { @@ -5876,7 +5943,7 @@ utilise explicitement la variable publique |\g_nicematrix_code_before_tl|. \NewDocumentCommand \crossbox { ! O { } } { - \tl_gput_right:Nx §emphase¤\g_nicematrix_code_before_tlμ + \tl_gput_right:Nx \emph{\g_nicematrix_code_before_tl} { \__pantigny_crossbox:nnn { \arabic { iRow } } @@ -5885,7 +5952,7 @@ utilise explicitement la variable publique |\g_nicematrix_code_before_tl|. } } \ExplSyntaxOff -\end{Verbatim} +\end{Code} \end{scope} @@ -5914,16 +5981,16 @@ utilise explicitement la variable publique |\g_nicematrix_code_before_tl|. Voici un exemple d'utilisation : \medskip -\begin{BVerbatim}[baseline=c,boxwidth=9cm] +\begin{Code}[width=9cm] \begin{NiceTabular}{ccc}[hvlines] \CodeBefore \arraycolor{gray!10} \Body merlan & requin & cabillaud \\ -baleine & ~emphase#\crossbox[red]@ & morue \\ +baleine & \emph{\crossbox[red]} & morue \\ mante & raie & poule \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{ccc}[hvlines] \CodeBefore \arraycolor{gray!10} @@ -5964,14 +6031,14 @@ Dans les exemples suivants, la première instruction |\Ddots| est marquée en co \begin{scope} \begin{minipage}{9.5cm} Exemple avec parallélisation (comportement par défaut): -\begin{Verbatim} +\begin{Code} $A = \begin{pNiceMatrix} 1 & \Cdots & & 1 \\ -a+b & ~emphase#\Ddots@~ & & \Vdots \\ +a+b & \emph{\Ddots} & & \Vdots \\ \Vdots & \Ddots & & \\ a+b & \Cdots & a+b & 1 \end{pNiceMatrix}$ -\end{Verbatim} +\end{Code} \end{minipage} $A = \begin{pNiceMatrix} 1 & \Cdots & & 1 \\ @@ -5983,14 +6050,14 @@ a+b & \Cdots & a+b & 1 \medskip \NiceMatrixOptions{parallelize-diags=true}% \begin{minipage}{9.5cm} -\begin{Verbatim} +\begin{Code} $A = \begin{pNiceMatrix} 1 & \Cdots & & 1 \\ a+b & & & \Vdots \\ -\Vdots & ~emphase#\Ddots@~ & \Ddots & \\ +\Vdots & \emph{\Ddots} & \Ddots & \\ a+b & \Cdots & a+b & 1 \end{pNiceMatrix}$ -\end{Verbatim} +\end{Code} \end{minipage} $A = \begin{pNiceMatrix} 1 & \Cdots & & 1 \\ @@ -6113,11 +6180,11 @@ Pour pouvoir utiliser \pkg{nicematrix} avec la classe \cls{aastex631} (de l'\emph{American Astronomical Society}), on doit ajouter dans le préambule du fichier les lignes suivantes : -\begin{Verbatim} +\begin{Code} \BeforeBegin{NiceTabular}{\let\begin\BeginEnvironment\let\end\EndEnvironment} \BeforeBegin{NiceArray}{\let\begin\BeginEnvironment} \BeforeBegin{NiceMatrix}{\let\begin\BeginEnvironment} -\end{Verbatim} +\end{Code} \medskip Pour pouvoir utiliser \pkg{nicematrix} avec la classe \cls{sn-jnl} (de @@ -6133,7 +6200,7 @@ Mais il semble que ce ne soit plus nécessaire avec les versions récentes de \medskip L'extension \pkg{nicematrix} n'est pas parfaitement compatible avec les classes -et extensions de \LuaTeX-ja: la détection des coins vides (cf. +et extensions de LuaTeX-ja: la détection des coins vides (cf. p.~\pageref{corners}) risque d'être erronée dans certaines circonstances. \medskip @@ -6168,21 +6235,21 @@ Pour l'exemple suivant, la bibliothèque \pkg{patterns} de TikZ doit aussi être \usetikzlibrary{patterns} \end{Verbatim} -\begin{Verbatim} +\begin{Code} \ttfamily \small \begin{NiceTabular}{X[m]X[m]X[m]}[hvlines,cell-space-limits=3pt,rounded-corners] - \Block[~emphase#tikz={pattern=grid,pattern color=lightgray}@]{} + \Block[\emph{tikz={pattern=grid,pattern color=lightgray}}]{} {pattern = grid,\\ pattern color = lightgray} -& \Block[~emphase#tikz={pattern = north west lines,pattern color=blue}@]{} +& \Block[\emph{tikz={pattern = north west lines,pattern color=blue}}]{} {pattern = north west lines,\\ pattern color = blue} -& \Block[~emphase#tikz={outer color = red!50, inner color=white }@]{2-1} +& \Block[\emph{tikz={outer color = red!50, inner color=white }}]{2-1} {outer color = red!50,\\ inner color = white} \\ - \Block[~emphase#tikz={pattern = sixpointed stars, pattern color = blue!15}@]{} + \Block[\emph{tikz={pattern = sixpointed stars, pattern color = blue!15}}]{} {pattern = sixpointed stars,\\ pattern color = blue!15} -& \Block[~emphase#tikz={left color = blue!50}@]{} +& \Block[\emph{tikz={left color = blue!50}}]{} {left color = blue!50} \\ \end{NiceTabular} -\end{Verbatim} +\end{Code} \begin{center} \ttfamily \small @@ -6214,16 +6281,16 @@ tableau. On remarquera que l'on utilise la clé |transparent| de la commande \texttt{\textbackslash CodeBefore}|textit} -\begin{Verbatim} +\begin{Code} \begin{NiceTabular}{ccc}[hvlines] \CodeBefore \columncolor[RGB]{169,208,142}{2} \Body un & deux & trois \\ -\Block[~emphase#transparent, tikz={pattern = north west lines, pattern color = gray}@]{1-*}{} +\Block[\emph{transparent, tikz={pattern = north west lines, pattern color = gray}}]{1-*}{} quatre & cinq & six \\ sept & huit & neuf -\end{Verbatim} +\end{Code} \begin{center} \begin{NiceTabular}{ccc}[hvlines] @@ -6248,7 +6315,7 @@ tous les filets sauf ceux sur les bords (qui sont, bien entendu, ajoutés par \pkg{tcolorbox}). \medskip -\begin{BVerbatim} +\begin{Code} \tcbset { colframe = blue!50!black , @@ -6271,7 +6338,7 @@ tous les filets sauf ceux sur les bords (qui sont, bien entendu, ajoutés par ] { \renewcommand{\arraystretch}{1.2}% <-- the % is mandatory here - \begin{NiceTabular}{rcl}[~emphase#hvlines-except-borders@,rules/color=blue!50!black] + \begin{NiceTabular}{rcl}[\emph{hvlines-except-borders},rules/color=blue!50!black] \CodeBefore \rowcolor{red!15}{1} \Body @@ -6280,7 +6347,7 @@ tous les filets sauf ceux sur les bords (qui sont, bien entendu, ajoutés par Upper & Middle & Lower \end{NiceTabular} } -\end{BVerbatim} +\end{Code} \index{hvlines-except-borders|textit} @@ -6333,7 +6400,6 @@ tous les filets sauf ceux sur les bords (qui sont, bien entendu, ajoutés par \index{style (sous-clé de «notes»)|textit} \index{enumitem-keys (sous-clé de «notes»)|textit} \index{enumitem@\pkg{enumitem} (extension requise pour utiliser\newline \texttt{\textbackslash tabularnote})|textit} - \label{ex:notes} Les outils de \pkg{nicematrix} pour les notes dans les tableaux ont été @@ -6347,13 +6413,16 @@ avec |\tabularnote|) avec des astérisques.\footnote{Bien entendu, il faut qu'il On commence par écrire une commande |\stars| similaire aux commandes classiques |\arabic|, |\alph|, |\Alph|, etc. mais qui produit un nombre d'astérisques égal à son argument.\footnote{Ou plutôt : à la valeur de son argument.} -\begin{Verbatim} + +\medskip +\begin{Code} \ExplSyntaxOn -\NewDocumentCommand ~emphase#\stars@ { m } - { \prg_replicate:nn { \value { ~#1 } } { $ \star $ } } +\NewDocumentCommand { \emph{\stars} } { m } + { \prg_replicate:nn { \value { #1 } } { $ \star $ } } \ExplSyntaxOff -\end{Verbatim} -% +\end{Code} + +\medskip Bien entendu, on change le style des notes avec la clé |notes/style|. Mais, il serait bon aussi de changer certains paramètres du type de liste (au sens de \pkg{enumitem}) utilisé pour composer les notes après le tableau. On demande de @@ -6364,20 +6433,22 @@ est le compteur LaTeX utilisé par |\tabularnote| et il est donc égal à la fin nombre total de notes dans le tableau). On utilise alors la clé |widest*| de \pkg{enumitem} pour demander une largeur de label correspondante : |widest*=\value{tabularnote}|. -\begin{Verbatim} + +\smallskip +\begin{Code} \NiceMatrixOptions { notes = { - ~emphase#style = \stars{~#1} , @ - ~emphase#enumitem-keys = @ - ~emphase# { @ - ~emphase# widest* = \value{tabularnote} ,@ - ~emphase# align = right @ - ~emphase# } @ + \emph{style = \stars{#1} , + enumitem-keys = + { + widest* = \value{tabularnote} , + align = right + } } } } -\end{Verbatim} +\end{Code} @@ -6398,21 +6469,21 @@ nombre total de notes dans le tableau). On utilise alors la clé |widest*| de } } \ExplSyntaxOff -\fvset{commandchars=\~\#\!} -\begin{Verbatim} + +\begin{Code} \begin{NiceTabular}{@{}llr@{}} \toprule \RowStyle{\bfseries} Nom & Prénom & Date de naissance \\ \midrule -Achard~emphase#\tabularnote{La famille Achard est une très ancienne famille du Poitou.}! +Achard\emph{\tabularnote{La famille Achard est une très ancienne famille du Poitou.}} & Jacques & 5 juin 1962 \\ -Lefèbvre~emphase#\tabularnote{Le patronyme Lefebvre est une altération de Lefébure.}! +Lefèbvre\emph{\tabularnote{Le patronyme Lefebvre est une altération de Lefébure.}} & Mathilde & 23 mai 1988 \\ Vanesse & Stéphanie & 30 octobre 1994 \\ Dupont & Chantal & 15 janvier 1998 \\ \bottomrule \end{NiceTabular} -\end{Verbatim} +\end{Code} \begin{center} \begin{NiceTabular}{@{}llr@{}} @@ -6441,7 +6512,7 @@ Dupont & Chantal & 15 janvier 1998 \\ Un exemple pour le résultant de deux polynômes : \par\nobreak \medskip -\begin{BVerbatim} +\begin{Code} \setlength{\extrarowheight}{1mm} \begin{vNiceArray}{cccc:ccc}[columns-width=6mm] a_0 & && &b_0 & & \\ @@ -6452,7 +6523,7 @@ a_p & &&a_0 & & &b_1 \\ & &&\Vdots & &\Ddots& \\ & &&a_p & & &b_q \end{vNiceArray} -\end{BVerbatim} +\end{Code} \index{Ddots@\texttt{\textbackslash Ddots}|textit} @@ -6510,7 +6581,9 @@ pointillées (TikZ doit être chargé). \index{line-style (clé pour les lignes pointillées)|textit} -\begin{Verbatim}[formatcom=\small\color{gray}] +\begin{scope} +\small +\begin{Verbatim} \NiceMatrixOptions{code-for-first-row = \scriptstyle,code-for-first-col = \scriptstyle } \setcounter{MaxMatrixCols}{12} \newcommand{\blue}{\color{blue}} @@ -6529,6 +6602,7 @@ pointillées (TikZ doit être chargé). & & & \blue \overset{\uparrow}{i} & & & & \blue \overset{\uparrow}{j} \\ \end{pNiceMatrix}\] \end{Verbatim} +\end{scope} \index{code-for-first-row|textit} \index{code-for-last-col|textit} @@ -6631,19 +6705,19 @@ Dans l'exemple suivant, on utilise des commandes |\Block| pour tracer des filets en tiretés. Cet exemple nécessite que TikZ soit chargé (par |\usepackage{tikz}|). -\begin{Verbatim} +\begin{Code} \begin{pNiceMatrix} -~emphase#\Block[borders={bottom,right,tikz=dashed}]{2-2}{}@ +\emph{\Block[borders={bottom,right,tikz=dashed}]{2-2}{}} 1 & 2 & 0 & 0 & 0 & 0 \\ 4 & 5 & 0 & 0 & 0 & 0 \\ -0 & 0 & ~emphase#\Block[borders={bottom,top,right,left,tikz=dashed}]{2-2}{}@ +0 & 0 & \emph{\Block[borders={bottom,top,right,left,tikz=dashed}]{2-2}{}} 7 & 1 & 0 & 0 \\ 0 & 0 & -1 & 2 & 0 & 0 \\ -0 & 0 & 0 & 0 & ~emphase#\Block[borders={left,top,tikz=dashed}]{2-2}{}@ +0 & 0 & 0 & 0 & \emph{\Block[borders={left,top,tikz=dashed}]{2-2}{}} 3 & 4 \\ 0 & 0 & 0 & 0 & 1 & 4 \end{pNiceMatrix} -\end{Verbatim} +\end{Code} \[\begin{pNiceMatrix} @@ -6673,8 +6747,12 @@ avec l'environnement |{NiceMatrixBlock}| et l'option |auto-columns-width|. \index{NiceMatrixBlock@\texttt{\{NiceMatrixBlock\}}|textit} -\begin{Verbatim}[formatcom=\small\color{gray}] -~emphase#\begin{NiceMatrixBlock}[auto-columns-width]@ +\bigskip + +\begin{scope} +\small +\begin{Code} +\emph{\begin{NiceMatrixBlock}[auto-columns-width]} \NiceMatrixOptions { light-syntax, @@ -6684,6 +6762,7 @@ avec l'environnement |{NiceMatrixBlock}| et l'option |auto-columns-width|. no-cell-nodes } \setlength{\extrarowheight}{1mm} +\end{NiceMatrixBlock} \quad $\begin{pNiceMatrix} 12 -8 7 5 3 {} ; @@ -6712,8 +6791,9 @@ avec l'environnement |{NiceMatrixBlock}| et l'option |auto-columns-width|. 12 -8 7 5 3 {} ; 0 64 -41 1 19 ; \end{pNiceMatrix}$ -~emphase#\end{NiceMatrixBlock}@ -\end{Verbatim} +\emph{\end{NiceMatrixBlock}} +\end{Code} +\end{scope} \medskip \index{auto-columns-width!(clé de \texttt{\{NiceMatrixBlock\}})|textit} @@ -6768,12 +6848,15 @@ largeur suivant leur taille. Pour résoudre ce problème, on peut demander que les délimiteurs soient composés avec leur largeur maximale grâce à la clé booléenne |delimiters/max-width|. +\medskip -\begin{Verbatim}[formatcom=\small\color{gray}] -~emphase#\begin{NiceMatrixBlock}[auto-columns-width]@ +\begin{scope} +\small +\begin{Code} +\emph{\begin{NiceMatrixBlock}[auto-columns-width]} \NiceMatrixOptions { - ~emphase#delimiters/max-width@, + \emph{delimiters/max-width}, light-syntax, last-col, code-for-last-col = \color{blue}\scriptstyle, vlines = 5 , @@ -6789,8 +6872,9 @@ avec leur largeur maximale grâce à la clé booléenne |delimiters/max-width|. 9 10 -5 4 7 \end{pNiceMatrix}$ ... -~emphase#\end{NiceMatrixBlock}@ -\end{Verbatim} +\emph{\end{NiceMatrixBlock}} +\end{Code} +\end{scope} \medskip \begin{NiceMatrixBlock}[auto-columns-width] @@ -6845,7 +6929,7 @@ Bien sûr, ce tableau ne pourra pas être coupé par un saut de page. \index{SubMatrix@\texttt{\textbackslash SubMatrix} (commande du \texttt{\textbackslash CodeAfter}\newline et du \texttt{\textbackslash CodeBefore})|textit} -\begin{Verbatim} +\begin{Code} \setlength{\extrarowheight}{1mm} \[\begin{NiceMatrix}% [ r, last-col=6, code-for-last-col = \scriptstyle \color{blue} ] @@ -6862,13 +6946,13 @@ Bien sûr, ce tableau ne pourra pas être coupé par un saut de page. 0 & 0 &0 &0 & 0 & L_3 \gets 3L_2+L_3 \\[1mm] 12 & -8 &7 &5 & 3 \\ 0 & 64 &-41 & 1 & 19 \\ -~emphase#\CodeAfter [sub-matrix/vlines=4]@ -~emphase# \SubMatrix({1-1}{4-5})@ -~emphase# \SubMatrix({5-1}{8-5})@ -~emphase# \SubMatrix({9-1}{11-5})@ -~emphase# \SubMatrix({12-1}{13-5})@ +\emph{\CodeAfter [sub-matrix/vlines=4] + \SubMatrix({1-1}{4-5}) + \SubMatrix({5-1}{8-5}) + \SubMatrix({9-1}{11-5}) + \SubMatrix({12-1}{13-5})} \end{NiceMatrix}\] -\end{Verbatim} +\end{Code} \medskip \begin{scope} @@ -6908,11 +6992,11 @@ 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} +\begin{Code} \setlength{\extrarowheight}{1mm} \[\begin{NiceArray} [ - ~emphase#vlines-in-sub-matrix=I@, + \emph{vlines-in-sub-matrix=I}, last-col, code-for-last-col = \scriptstyle \color{blue} ] @@ -6936,7 +7020,7 @@ tracés dans les |\SubMatrix| uniquement (en espaçant les colonnes). \SubMatrix({9-1}{11-5}) \SubMatrix({12-1}{13-5}) \end{NiceArray}\] -\end{Verbatim} +\end{Code} @@ -6987,14 +7071,14 @@ la commande |\Block| est laissé vide, le bloc est considéré comme mono-case.} \label{exemple-CodeAfter} -\begin{Verbatim} +\begin{Code} $\begin{pNiceArray}{>{\strut}cccc}[margin,rules/color=blue] -~emphase#\Block[draw]{}{a_{11}}@ & a_{12} & a_{13} & a_{14} \\ -a_{21} & \Block[draw]{}{a_{22}} & a_{23} & a_{24} \\ -a_{31} & a_{32} & \Block[draw]{}{a_{33}} & a_{34} \\ -a_{41} & a_{42} & a_{43} & \Block[draw]{}{a_{44}} \\ +\emph{\Block[draw]{}{a_{11}}} & a_{12} & a_{13} & a_{14} \\ +a_{21} & \emph{\Block[draw]{}{a_{22}}} & a_{23} & a_{24} \\ +a_{31} & a_{32} & \emph{\Block[draw]{}{a_{33}}} & a_{34} \\ +a_{41} & a_{42} & a_{43} & \emph{\Block[draw]{}{a_{44}}} \\ \end{pNiceArray}$ -\end{Verbatim} +\end{Code} % \[\begin{pNiceArray}{>{\strut}cccc}[margin,rules/color=blue] \Block[draw]{}{a_{11}} & a_{12} & a_{13} & a_{14} \\ @@ -7020,14 +7104,14 @@ Il est possible de colorier une rangée avec |\rowcolor| dans le |\CodeBefore| \index{color-inside|textit} \index{rowcolor@\texttt{\textbackslash rowcolor}!commande en tableau|textit} -\begin{Verbatim} +\begin{Code} \begin{pNiceArray}{>{\strut}cccc}[margin, extra-margin=2pt,color-inside] - ~emphase#\rowcolor{red!15}@A_{11} & A_{12} & A_{13} & A_{14} \\ - A_{21} & ~emphase#\rowcolor{red!15}@A_{22} & A_{23} & A_{24} \\ - A_{31} & A_{32} & ~emphase#\rowcolor{red!15}@A_{33} & A_{34} \\ - A_{41} & A_{42} & A_{43} & ~emphase#\rowcolor{red!15}@A_{44} + \emph{\rowcolor{red!15}}A_{11} & A_{12} & A_{13} & A_{14} \\ + A_{21} & \emph{\rowcolor{red!15}}A_{22} & A_{23} & A_{24} \\ + A_{31} & A_{32} & \emph{\rowcolor{red!15}}A_{33} & A_{34} \\ + A_{41} & A_{42} & A_{43} & \emph{\rowcolor{red!15}}A_{44} \end{pNiceArray} -\end{Verbatim} +\end{Code} @@ -7069,22 +7153,22 @@ faut utiliser la clé |create-cell-nodes| du |\CodeBefore| pour demander leur cr \medskip \index{highlight (style TikZ défini dans\newline un exemple)|textit} -\begin{Verbatim} +\begin{Code} \tikzset{highlight/.style={rectangle, fill=red!15, rounded corners = 0.5 mm, inner sep=1pt, - fit=~#1}} + fit=#1}} $\begin{bNiceMatrix} -~emphase#\CodeBefore [create-cell-nodes] @ -~emphase# \tikz \node [highlight = (2-1) (2-3)] {} ; @ -~emphase# \Body @ +\emph{\CodeBefore [create-cell-nodes] + \tikz \node [highlight = (2-1) (2-3)] {} ; +\Body } 0 & \Cdots & 0 \\ 1 & \Cdots & 1 \\ 0 & \Cdots & 0 \\ \end{bNiceMatrix}$ -\end{Verbatim} +\end{Code} \index{create-cell-nodes (clé de \texttt{\textbackslash CodeBefore})|textit} \index{CodeBefore@\texttt{\textbackslash CodeBefore}...\texttt{\textbackslash Body}|textit} @@ -7105,20 +7189,20 @@ $\begin{bNiceMatrix} On considère maintenant la matrice suivante. Si on veut surligner chaque rangée de la matrice, on peut utiliser la technique précédente trois fois. -\begin{Verbatim} +\begin{Code} \[\begin{pNiceArray}{ccc}[last-col, margin = 2pt] \CodeBefore [create-cell-nodes] \begin{tikzpicture} -~emphase# \node [highlight = (1-1) (1-3)] {} ;@ -~emphase# \node [highlight = (2-1) (2-3)] {} ;@ -~emphase# \node [highlight = (3-1) (3-3)] {} ;@ + \emph{\node [highlight = (1-1) (1-3)] {} ; + \node [highlight = (2-1) (2-3)] {} ; + \node [highlight = (3-1) (3-3)] {} ;} \end{tikzpicture} \Body a & a + b & a + b + c & L_1 \\ a & a & a + b & L_2 \\ a & a & a & L_3 \end{pNiceArray}\] -\end{Verbatim} +\end{Code} \[\begin{pNiceArray}{ccc}[last-col, margin = 2pt] \CodeBefore [create-cell-nodes] @@ -7140,10 +7224,10 @@ moyens» au lieu des «nœuds normaux». \index{create-medium-nodes|textit} \index{create-cell-nodes (clé de \texttt{\textbackslash CodeBefore})|textit} -\begin{Verbatim} +\begin{Code} \[\begin{pNiceArray}{ccc}[last-col, margin = 2pt, create-medium-nodes] \CodeBefore [create-cell-nodes] - \begin{tikzpicture} ~emphase#[name suffix = -medium]@ + \begin{tikzpicture} \emph{[name suffix = -medium]} \node [highlight = (1-1) (1-3)] {} ; \node [highlight = (2-1) (2-3)] {} ; \node [highlight = (3-1) (3-3)] {} ; @@ -7153,7 +7237,7 @@ a & a + b & a + b + c & L_1 \\ a & a & a + b & L_2 \\ a & a & a & L_3 \end{pNiceArray}\] -\end{Verbatim} +\end{Code} \[\begin{pNiceArray}{ccc}[last-col, margin = 2pt, create-medium-nodes] @@ -7232,8 +7316,10 @@ de parenthèses ont été rajoutées avec |\SubMatrix| dans le |\CodeBefore|. fit=~#1}} \end{Verbatim} -\begin{Verbatim}[formatcom = \small\color{gray}] -\[\begin{NiceArray}{*{6}{c}~LetterAt{\hspace{6mm}}*{5}{c}}[nullify-dots] +\begin{scope} +\small +\begin{Code} +\[\begin{NiceArray}{*{6}{c}@{\hspace{6mm}}*{5}{c}}[nullify-dots] \CodeBefore [create-cell-nodes] \SubMatrix({2-7}{6-last}) \SubMatrix({7-2}{last-6}) @@ -7258,7 +7344,8 @@ de parenthèses ont été rajoutées avec |\SubMatrix| dans le |\CodeBefore|. \CodeAfter \tikz \draw [gray,shorten > = 1mm, shorten < = 1mm] (9-4.north) to [bend left] (4-9.west) ; \end{NiceArray}\] -\end{Verbatim} +\end{Code} +\end{scope} \subsection{Un tableau triangulaire} @@ -7276,16 +7363,16 @@ tourner tout le tableau avec la commande |\adjustbox| de l'extension éponyme, qui doit donc être chargée préalablement). \medskip -\begin{Verbatim} +\begin{Code} \pgfset { - ~emphase#nicematrix/cell-node@/.append style = + \emph{nicematrix/cell-node}/.append style = { text/rotate = 45, minimum size = 6 mm } } \setlength{\tabcolsep}{0pt} -~emphase#\adjustbox@{rotate = -45, set depth = 6mm + 1.414 \arrayrulewidth} +\emph{\adjustbox}{rotate = -45, set depth = 6mm + 1.414 \arrayrulewidth} {\begin{NiceTabular} [ hvlines, corners=SE, baseline = line-9 ] { cccccccc } \CodeBefore \chessboardcolors{red!15}{blue!15} @@ -7299,7 +7386,7 @@ qui doit donc être chargée préalablement). 1 & 7 \\ 1 \end{NiceTabular}} -\end{Verbatim} +\end{Code} \begin{center} diff --git a/macros/latex/contrib/nicematrix/nicematrix.pdf b/macros/latex/contrib/nicematrix/nicematrix.pdf index 6f728aa977..abfd168487 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/nicematrix/nicematrix.tex b/macros/latex/contrib/nicematrix/nicematrix.tex index 74f6c7ae15..6f18a9c5e6 100644 --- a/macros/latex/contrib/nicematrix/nicematrix.tex +++ b/macros/latex/contrib/nicematrix/nicematrix.tex @@ -1,7 +1,6 @@ % -*- coding: utf-8 ; -*- This file should be compiled with XeLaTeX only \documentclass[dvipsnames]{article}% dvipsnames is for xcolor (loaded by TikZ, - % loaded by nicematrix) ℤ -\usepackage{xltxtra} + % loaded by nicematrix) \usepackage{geometry} \geometry{left=2.8cm,right=2.8cm,top=2.5cm,bottom=2.5cm,papersize={21cm,29.7cm}} @@ -24,13 +23,12 @@ \MakeShortVerb{\|} \usepackage{fancyvrb} -\fvset{commandchars=\~\#\@,formatcom=\color{gray}} +\fvset{formatcom=\color{gray}} \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} -\def\LetterAt{@} \def\interitem{\vspace{7mm plus 2 mm minus 3mm}} \def\emphase{\bgroup\color{RoyalPurple}\let\next=} @@ -62,6 +60,39 @@ \usepackage{makeidx} \makeindex + +\usepackage{piton} +\PitonOptions{language = minimal, detected-commands = {emph,textsl}, splittable = 4} +\SetPitonStyle{ Number = , Comment = } + +\ExplSyntaxOn + +\dim_new:N \l__pantigny_width_dim + +\keys_define:nn { pantigny } + { width .dim_set:N = \l__pantigny_width_dim } + +\NewPitonEnvironment { Code } { O { } } + { + \char_set_catcode_other:N | + \cs_set_eq:NN \emph \emphase + \dim_zero:N \l__pantigny_width_dim + \keys_set:nn { pantigny } { #1 } + \color{gray} + \dim_compare:nNnT \l__pantigny_width_dim > \c_zero_dim + { + \PitonOptions { width = \l__pantigny_width_dim } + \begin{minipage}[c]{\l__pantigny_width_dim} + } + } + { \dim_compare:nNnT \l__pantigny_width_dim > \c_zero_dim + { \end{minipage} } + } + + +\ExplSyntaxOff + + \NewDocumentCommand{\indexcommand}{m}{\index{#1@\texttt{\textbackslash #1}}} \NewDocumentCommand{\indexenv}{m}{\index{#1@\texttt{\{#1\}}}} @@ -242,12 +273,12 @@ It's well known that some rows of the arrays created by default with LaTeX are, by default, too close to each other. Here is a classical example. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=9cm] +\begin{Code}[width=9cm] $\begin{pmatrix} \frac{1}{2} & -\frac{1}{2} \\ \frac{1}{3} & \frac{1}{4} \\ \end{pmatrix}$ -\end{BVerbatim} +\end{Code} $\begin{pmatrix} \frac{1}{2} & -\frac{1}{2} \\ \frac{1}{3} & \frac{1}{4} \\ @@ -271,16 +302,16 @@ remark that these parameters apply also to the columns of type |S| of columns of type~|S|.} \medskip -\begin{Verbatim} -\NiceMatrixOptions{~emphase#cell-space-limits = 1pt@} -\end{Verbatim} +\begin{Code} +\NiceMatrixOptions{\emph{cell-space-limits = 1pt}} +\end{Code} -\begin{BVerbatim}[baseline=c,boxwidth=9cm] +\begin{Code}[width=9cm] $\begin{pNiceMatrix} \frac12 & -\frac12 \\ \frac13 & \frac14 \\ \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} \begin{scope} \NiceMatrixOptions{cell-space-limits = 1pt} $\begin{pNiceMatrix} @@ -305,13 +336,13 @@ position of the arrays. This option takes in as value an integer which is the number of the row on which the array will be aligned. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=9cm] -$A = \begin{pNiceMatrix}[~emphase#baseline=2@] +\begin{Code}[width=9cm] +$A = \begin{pNiceMatrix}[\emph{baseline=2}] \frac{1}{\sqrt{1+p^2}} & p & 1-p \\ 1 & 1 & 1 \\ 1 & p & 1+p \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} $A = \begin{pNiceMatrix}[baseline=2] \frac{1}{\sqrt{1+p^2}} & p & 1-p \\ 1 & 1 & 1 \\ @@ -334,19 +365,19 @@ baseline with the baseline of the first row (with |{tabular}| or |{array}| of \pkg{array}, one must use |\firsthline|). \medskip -\begin{BVerbatim}[baseline=c,boxwidth=9cm] +\begin{Code}[width=9cm] \begin{enumerate} \item an item \smallskip \item \renewcommand{\arraystretch}{1.2} -$\begin{NiceArray}~emphase#[t]@{lcccccc} +$\begin{NiceArray}\emph{[t]}{lcccccc} \hline n & 0 & 1 & 2 & 3 & 4 & 5 \\ u_n & 1 & 2 & 4 & 8 & 16 & 32 \hline \end{NiceArray}$ \end{enumerate} -\end{BVerbatim} +\end{Code} \begin{minipage}{5cm} \begin{enumerate} \item an item @@ -368,20 +399,20 @@ by \pkg{nicematrix}.}: |\toprule|, |\bottomrule|, |\midrule|, etc.\par\nobreak \smallskip -\begin{BVerbatim}[baseline=c,boxwidth=9cm] +\begin{Code}[width=9cm] \begin{enumerate} \item an item \smallskip \item $\begin{NiceArray}[t]{lcccccc} -~emphase#\toprule@ +\emph{\toprule} n & 0 & 1 & 2 & 3 & 4 & 5 \\ -~emphase#\midrule@ +\emph{\midrule} u_n & 1 & 2 & 4 & 8 & 16 & 32 -~emphase#\bottomrule@ +\emph{\bottomrule} \end{NiceArray}$ \end{enumerate} -\end{BVerbatim} +\end{Code} \begin{minipage}{5cm} \begin{enumerate} \item an item @@ -409,15 +440,15 @@ horizontal rule. \end{Verbatim} \smallskip -\begin{BVerbatim}[baseline=c,boxwidth=9cm] -$A=\begin{pNiceArray}{cc|cc}~emphase#[baseline=line-3]@ +\begin{Code}[width=9cm] +$A=\begin{pNiceArray}{cc|cc}\emph{[baseline=line-3]} \dfrac{1}{A} & \dfrac{1}{B} & 0 & 0 \\ \dfrac{1}{C} & \dfrac{1}{D} & 0 & 0 \\ \hline 0 & 0 & A & B \\ 0 & 0 & D & D \\ \end{pNiceArray}$ -\end{BVerbatim} +\end{Code} \begin{scope} \NiceMatrixOptions{cell-space-limits=1pt} \raisebox{-5mm}{$A=\begin{pNiceArray}{cc|cc}[baseline=line-3] @@ -466,15 +497,15 @@ text mode whereas, in the other environments, it is composed in math mode. Here is an example of utilisation of the command |\Block| in mathematical matrices. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10.6cm] +\begin{Code}[width=10.6cm] $\begin{bNiceArray}{cw{c}{1cm}c|c}[margin] -~emphase#\Block{3-3}{A}@ & & & 0 \\ +\emph{\Block{3-3}{A}} & & & 0 \\ & & & \Vdots \\ & & & 0 \\ \hline 0 & \Cdots& 0 & 0 \end{bNiceArray}$ -\end{BVerbatim} +\end{Code} $\begin{bNiceArray}{cw{c}{1cm}c|c}[margin] \Block{3-3}{A} & & & 0 \\ & & & \Vdots \\ @@ -496,15 +527,15 @@ the command |\rotate| provided by \pkg{nicematrix} (cf. part~\ref{rotate}, p.~\pageref{rotate}).} \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10.6cm] +\begin{Code}[width=10.6cm] $\begin{bNiceArray}{cw{c}{1cm}c|c}[margin] -\Block{3-3}~emphase#<\Large>@{A} & & & 0 \\ +\Block{3-3}\emph{<\Large>}{A} & & & 0 \\ 0 & & & \Vdots \\ & & & 0 \\ \hline 0 & \Cdots& 0 & 0 \end{bNiceArray}$ -\end{BVerbatim} +\end{Code} \begin{scope} $\begin{bNiceArray}{cw{c}{1cm}c|c}[margin] \Block{3-3}<\Large>{A} & & & 0 \\ @@ -628,17 +659,16 @@ In the following example, we have had to enlarge by hand the columns 2 and 3 (with the construction |w{c}{...}| of \pkg{array}). \bigskip -\begin{BVerbatim} +\begin{Code} \begin{NiceTabular}{cw{c}{2cm}w{c}{3cm}c} rose & tulip & daisy & dahlia \\ -violet -& ~emphase#\Block[draw=red,fill=[RGB]{204,204,255},rounded-corners]{2-2}@ - ~emphase#{\LARGE Some beautiful flowers}@ +violet & \emph{\Block[draw=red,fill=[RGB]{204,204,255},rounded-corners]{2-2} + {\LARGE Some beautiful flowers}} & & marigold \\ & & marigold \\ iris & & & lis \\ arum & periwinkle & forget-me-not & hyacinth \end{NiceTabular} -\end{BVerbatim} +\end{Code} \medskip \begin{center} @@ -677,8 +707,8 @@ mono-column blocks of that column (this behaviour is probably expected). \bigskip \begin{scope} \hfuzz=10cm -\begin{BVerbatim}[baseline=c,boxwidth=12cm] -\begin{NiceTabular}{~LetterAt{}>{\bfseries}lr~LetterAt{}} \hline +\begin{Code}[width=12cm] +\begin{NiceTabular}{@{}>{\bfseries}lr@{}} \hline \Block{2-1}{John} & 12 \\ & 13 \\ \hline Steph & 8 \\ \hline @@ -690,7 +720,7 @@ Henry & 14 \\ \hline \Block{2-1}{Madison} & 15 \\ & 19 \\ \hline \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{@{}>{\bfseries}lr@{}}[baseline=c] \hline \Block{2-1}{John} & 12 \\ & 13 \\ \hline @@ -739,16 +769,16 @@ used).} \end{itemize} \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] \begin{NiceTabular}{cc} \toprule -Writer & ~emphase#\Block[l]{}{year\\ of birth}@ \\ +Writer & \emph{\Block[l]{}{year\\ of birth}} \\ \midrule Hugo & 1802 \\ Balzac & 1799 \\ \bottomrule \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{cc} \toprule Writer & \Block[l]{}{year\\ of birth} \\ @@ -774,15 +804,15 @@ The command |\Block| accepts the keys |l|, |c| and |r| for the horizontal position of its content. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10.6cm] +\begin{Code}[width=10.6cm] $\begin{bNiceArray}{cw{c}{1cm}c|c}[margin] -\Block~emphase#[r]@{3-3}<\LARGE>{A} & & & 0 \\ +\Block\emph{[r]}{3-3}<\LARGE>{A} & & & 0 \\ & & & \Vdots \\ & & & 0 \\ \hline 0 & \Cdots& 0 & 0 \end{bNiceArray}$ -\end{BVerbatim} +\end{Code} $\begin{bNiceArray}{cw{c}{1cm}c|c}[margin] \Block[r]{3-3}<\LARGE>{A} & & & 0 \\ & & & \Vdots \\ @@ -802,11 +832,10 @@ is not the behaviour of |\multicolumn|). \medskip \begin{center} -\fvset{commandchars=\~\#\+} -\begin{BVerbatim} -\begin{NiceTabular}{@{}c!{\qquad}ccc~emphase#!{\qquad}+ccc@{}} +\begin{Code} +\begin{NiceTabular}{@{}c!{\qquad}ccc\emph{!{\qquad}}ccc@{}} \toprule -Rank & ~emphase#\Block{1-3}{First group}+ & & & \Block{1-3}{Second group} \\ +Rank & \emph{\Block{1-3}{First group}} & & & \Block{1-3}{Second group} \\ & 1A & 1B & 1C & 2A & 2B & 2C \\ \midrule 1 & 0.657 & 0.913 & 0.733 & 0.830 & 0.387 & 0.893\\ @@ -815,7 +844,7 @@ Rank & ~emphase#\Block{1-3}{First group}+ & & & \Block{1-3}{Second group} \\ 4 & 0.161 & 0.708 & 0.386 & 0.257 & 0.074 & 0.336\\ \bottomrule \end{NiceTabular} -\end{BVerbatim} +\end{Code} \end{center} \bigskip @@ -844,11 +873,10 @@ Here is the same example with the key |C| for the first block. \medskip \begin{center} -\fvset{commandchars=\~\#\+} -\begin{BVerbatim} -\begin{NiceTabular}{@{}c!{\qquad}ccc~emphase#!{\qquad}+ccc@{}} +\begin{Code} +\begin{NiceTabular}{@{}c!{\qquad}ccc\emph{!{\qquad}}ccc@{}} \toprule -Rank & ~emphase#\Block[C]{1-3}{First group}+ & & & \Block{1-3}{Second group} \\ +Rank & \emph{\Block[C]{1-3}{First group}} & & & \Block{1-3}{Second group} \\ & 1A & 1B & 1C & 2A & 2B & 2C \\ \midrule 1 & 0.657 & 0.913 & 0.733 & 0.830 & 0.387 & 0.893\\ @@ -857,7 +885,7 @@ Rank & ~emphase#\Block[C]{1-3}{First group}+ & & & \Block{1-3}{Second group} \\ 4 & 0.161 & 0.708 & 0.386 & 0.257 & 0.074 & 0.336\\ \bottomrule \end{NiceTabular} -\end{BVerbatim} +\end{Code} \end{center} \bigskip @@ -919,16 +947,16 @@ When no key is given, the key |v-center| applies (except in the mono-row blocks) \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] \begin{NiceTabular}{ccc} -\Block[fill=red!10,~emphase#t@,l]{4-2}{two\\lines} +\Block[fill=red!10,\emph{t},l]{4-2}{two\\lines} & & \Huge Un\\ & & deux \\ & & trois \\ & & \Huge quatre \\ text & text \\ \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{ccc} \Block[fill=red!10,t,l]{4-2}{two\\lines} & & \Huge Un\\ @@ -940,16 +968,16 @@ text & text \\ \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] \begin{NiceTabular}{ccc} -\Block[fill=red!10,~emphase#b@,r]{4-2}{two\\lines} +\Block[fill=red!10,\emph{b},r]{4-2}{two\\lines} & & \Huge Un\\ & & deux \\ & & trois \\ & & \Huge quatre \\ text & text \\ \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{ccc} \Block[fill=red!10,b,r]{4-2}{two\\lines} & & \Huge Un\\ @@ -960,16 +988,16 @@ text & text \\ \end{NiceTabular} \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] \begin{NiceTabular}{ccc} -\Block[fill=red!10,~emphase#T@,l]{4-2}{two\\lines} +\Block[fill=red!10,\emph{T},l]{4-2}{two\\lines} & & \Huge Un\\ & & deux \\ & & trois \\ & & \Huge quatre \\ text & text \\ \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{ccc} \Block[fill=red!10,T,l]{4-2}{two\\lines} & & \Huge Un\\ @@ -981,16 +1009,16 @@ text & text \\ \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] \begin{NiceTabular}{ccc} -\Block[fill=red!10,~emphase#B@,r]{4-2}{two\\lines} +\Block[fill=red!10,\emph{B},r]{4-2}{two\\lines} & & \Huge Un\\ & & deux \\ & & trois \\ & & \Huge quatre \\ text & text \\ \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{ccc} \Block[fill=red!10,B,r]{4-2}{two\\lines} & & \Huge Un\\ @@ -1027,13 +1055,13 @@ incomplete row or by a double horizontal rule specified by |\hline\hline| (there is no need to use the package~\pkg{hhline}). \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] \begin{NiceTabular}{|c|c|} \hline -First & Second \\ ~emphase#\hline\hline@ +First & Second \\ \emph{\hline\hline} Peter \\ \hline Mary & George\\ \hline \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{|c|c|}[c] \hline First & Second \\ \hline\hline Peter \\ \hline @@ -1055,13 +1083,13 @@ not in the spirit of \pkg{booktabs}), you should notice that the vertical rules drawn by \pkg{nicematrix} are compatible with \pkg{booktabs}. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10.5cm] -$\begin{NiceArray}{~emphase#|cccc|@} \toprule +\begin{Code}[width=10.5cm] +$\begin{NiceArray}{\emph{|cccc|}} \toprule a & b & c & d \\ \midrule 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ \bottomrule \end{NiceArray}$ -\end{BVerbatim} +\end{Code} $\begin{NiceArray}{|cccc|} \toprule a & b & c & d \\ @@ -1095,13 +1123,13 @@ For historical reasons, this is not the case with the command |\cline|, as shown by the following example. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] \setlength{\arrayrulewidth}{2pt} \begin{tabular}{cccc} \hline -A&B&C&D \\ ~emphase#\cline{2-2}@ +A&B&C&D \\ \emph{\cline{2-2}} A&B&C&D \\ \hline \end{tabular} -\end{BVerbatim} +\end{Code} \begin{scope} \setlength{\arrayrulewidth}{2pt} \begin{tabular}[c]{cccc} @@ -1119,21 +1147,19 @@ In the environments of \pkg{nicematrix}, this situation is corrected (it's still possible to go to the standard behaviour of |\cline| with the key |standard-cline|). \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] \setlength{\arrayrulewidth}{2pt} \begin{NiceTabular}{cccc} \hline -A&B&C&D \\ ~emphase#\cline{2}@ +A&B&C&D \\ \emph{\cline{2}} A&B&C&D \\ \hline \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{scope} \setlength{\arrayrulewidth}{2pt} \begin{NiceTabular}[c]{cccc} \hline -A&B&C&D \\ -\cline{2} -A&B&C&D \\ -\hline +A&B&C&D \\ \cline{2} +A&B&C&D \\ \hline \end{NiceTabular} \end{scope} @@ -1170,15 +1196,15 @@ environment, to fix the color of the rules. This key sets the value locally \medskip \begin{scope} \hfuzz=10cm -\begin{BVerbatim}[baseline=c,boxwidth=9.5cm] -\begin{NiceTabular}{|ccc|}[~emphase#rules/color=[gray]{0.9},rules/width=1pt@] +\begin{Code}[width=9.5cm] +\begin{NiceTabular}{|ccc|}[\emph{rules/color=[gray]{0.9},rules/width=1pt}] \hline rose & tulipe & lys \\ arum & iris & violette \\ muguet & dahlia & souci \\ \hline \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{|ccc|}[rules/color=[gray]{0.9},rules/width=1pt] \hline rose & tulipe & lys \\ @@ -1241,15 +1267,15 @@ As well as the command |\Hline|, the specifier ``\verb+|+'' supports an optional argument between square brackets for the characteristics of the rule. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] -\begin{NiceTabular}{|c~emphase#|[color=blue]@c|} +\begin{Code}[width=10cm] +\begin{NiceTabular}{|c\emph{|[color=blue]}c|} \Hline a & b \\ -~emphase#\Hline[color=red]@ +\emph{\Hline[color=red]} c & d \\ \Hline \end{NiceTabular} -\end{BVerbatim} +\end{Code} % \begin{NiceTabular}{|c|[color=blue]c|} \Hline @@ -1278,13 +1304,13 @@ In fact, for the environments with delimiters (such as |{pNiceMatrix}| or certainly the expected behaviour). \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10.6cm] -$\begin{pNiceMatrix}[~emphase#vlines@,rules/width=0.2pt] +\begin{Code}[width=10.6cm] +$\begin{pNiceMatrix}[\emph{vlines},rules/width=0.2pt] 1 & 2 & 3 & 4 & 5 & 6 \\ 1 & 2 & 3 & 4 & 5 & 6 \\ 1 & 2 & 3 & 4 & 5 & 6 \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{pNiceMatrix}[vlines,rules/width=0.2pt] 1 & 2 & 3 & 4 & 5 & 6 \\ 1 & 2 & 3 & 4 & 5 & 6 \\ @@ -1304,15 +1330,15 @@ $\begin{pNiceMatrix}[vlines,rules/width=0.2pt] The key |hvlines| (no value) is the conjonction of the keys |hlines| and |vlines|. \smallskip -\begin{Verbatim} +\begin{Code} \setlength{\arrayrulewidth}{1pt} -\begin{NiceTabular}{cccc}[~emphase#hvlines@,rules/color=blue] +\begin{NiceTabular}{cccc}[\emph{hvlines},rules/color=blue] rose & tulipe & marguerite & dahlia \\ violette & \Block[draw=red]{2-2}{\LARGE fleurs} & & souci \\ pervenche & & & lys \\ arum & iris & jacinthe & muguet \end{NiceTabular} -\end{Verbatim} +\end{Code} \begin{center} \setlength{\arrayrulewidth}{1pt} @@ -1391,9 +1417,9 @@ into account by the tools for drawing the rules (the rules won't be drawn in the corners). \bigskip -\begin{BVerbatim}[boxwidth=11cm,baseline=c] +\begin{Code}[width=11cm] \NiceMatrixOptions{cell-space-top-limit=3pt} -\begin{NiceTabular}{*{6}{c}}[~emphase#corners@,hvlines] +\begin{NiceTabular}{*{6}{c}}[\emph{corners},hvlines] & & & & A \\ & & A & A & A \\ & & & A \\ @@ -1404,7 +1430,7 @@ A & A & A & A & A & A \\ & \Block{2-2}{B} & & A \\ & & & A \\ \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{*{6}{c}}[corners,hvlines,cell-space-top-limit=3pt] & & & & A \\ & & A & A & A \\ @@ -1423,9 +1449,9 @@ It's also possible to provide to the key |corners| a (comma-separated) list of corners (designed by |NW|, |SW|, |NE| and |SE|). \medskip -\begin{BVerbatim}[boxwidth=11cm,baseline=c] +\begin{Code}[width=11cm] \NiceMatrixOptions{cell-space-top-limit=3pt} -\begin{NiceTabular}{*{6}{c}}[~emphase#corners=NE@,hvlines] +\begin{NiceTabular}{*{6}{c}}[\emph{corners=NE},hvlines] 1\\ 1&1\\ 1&2&1\\ @@ -1433,7 +1459,7 @@ corners (designed by |NW|, |SW|, |NE| and |SE|). 1&4&6&4&1\\ & & & & &1 \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{*{6}{c}}[c,corners=NE,hvlines,cell-space-top-limit=3pt] 1\\ 1&1\\ @@ -1459,15 +1485,15 @@ The command |\diagbox| (inspired by the package \pkg{diagbox}), allows, when it is used in a cell, to slash that cell diagonally downwards. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] $\begin{NiceArray}{*{5}{c}}[hvlines] -~emphase#\diagbox{x}{y}@ & e & a & b & c \\ +\emph{\diagbox{x}{y}} & e & a & b & c \\ e & e & a & b & c \\ a & a & e & c & b \\ b & b & c & e & a \\ c & c & b & a & e \end{NiceArray}$ -\end{BVerbatim} +\end{Code} $\begin{NiceArray}{*{5}{c}}[hvlines] \diagbox{x}{y} & e & a & b & c \\ e & e & a & b & c \\ @@ -1551,8 +1577,8 @@ letters to draw rules with a specific color (and those rules will respect the blocks and corners as do all the rules of \pkg{nicematrix}). \medskip -\begin{Verbatim} -\begin{NiceTabular}{lcIcIc}~emphase#[custom-line = {letter=I, color=blue}]@ +\begin{Code} +\begin{NiceTabular}{lcIcIc}\emph{[custom-line = {letter=I, color=blue}]} \hline & \Block{1-3}{dimensions} \\ & L & l & h \\ @@ -1562,7 +1588,7 @@ Product B & 1 & 3 & 4 \\ Product C & 5 & 4 & 1 \\ \hline \end{NiceTabular} -\end{Verbatim} +\end{Code} \begin{center} @@ -1602,14 +1628,14 @@ rule specified in |tikz|). \bigskip Here is an example with the key |dotted| of TikZ. -\begin{BVerbatim}[boxwidth=9cm,baseline=c] +\begin{Code}[width=9cm] \NiceMatrixOptions { custom-line = { letter = I , - ~emphase#tikz = dotted@ , - ~emphase#total-width = \pgflinewidth@ + \emph{tikz = dotted , + total-width = \pgflinewidth} } } @@ -1618,7 +1644,7 @@ one & two & three \\ four & five & six \\ seven & eight & nine \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{scope} \NiceMatrixOptions { @@ -1657,33 +1683,33 @@ rules.\footnote{However, it's possible to overwrite those definitions with a |custom-line| (in order, for example, to switch to dashed lines).} \smallskip -\begin{BVerbatim} +\begin{Code} -\NiceMatrixOptions % ~textsl#present in nicematrix.sty@ +\NiceMatrixOptions % \textsl{present in nicematrix.sty} { custom-line = { letter = : , command = hdottedline , ccommand = cdottedline , - ~emphase#dotted@ + \emph{dotted} } } -\end{BVerbatim} +\end{Code} Thus, it's possible to use the commands |\hdottedline| and |\cdottedline |to draw horizontal dotted rules. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=9.5cm] +\begin{Code}[width=9.5cm] \begin{pNiceMatrix} 1 & 2 & 3 & 4 & 5 \\ -~emphase#\hdottedline@ +\emph{\hdottedline} 6 & 7 & 8 & 9 & 10 \\ -~emphase#\cdottedline{1,4-5}@ +\emph{\cdottedline{1,4-5}} 11 & 12 & 13 & 14 & 15 \end{pNiceMatrix} -\end{BVerbatim} +\end{Code} $\begin{pNiceMatrix} 1 & 2 & 3 & 4 & 5 \\ \hdottedline @@ -1699,13 +1725,13 @@ In the environments with an explicit preamble (like |{NiceTabular}|, specifier ``|:|''. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=9.5cm] -\left(\begin{NiceArray}{cccc~emphase#:@c} +\begin{Code}[width=9.5cm] +$\left(\begin{NiceArray}{cccc\emph{:}c} 1 & 2 & 3 & 4 & 5 \\ 6 & 7 & 8 & 9 & 10 \\ 11 & 12 & 13 & 14 & 15 \end{NiceArray}\right) -\end{BVerbatim} +\end{Code} $\left(\begin{NiceArray}{cccc:c} 1 & 2 & 3 & 4 & 5 \\ 6 & 7 & 8 & 9 & 10 \\ @@ -1781,14 +1807,14 @@ An alternative syntax is provided: it's possible to put the content of that |code-before| between the keywords |\CodeBefore| and |\Body| at the beginning of the environment. -\begin{Verbatim} -\begin{pNiceArray}{~textsl#preamble@} -~emphase#\CodeBefore [~textsl#options@]@ - ~textsl#instructions of the code-before@ -~emphase#\Body@ - ~textsl#contents of the environment@ +\begin{Code} +\begin{pNiceArray}{\textsl{preamble}} +\emph{\CodeBefore [\textsl{options}]} + \textsl{instructions of the code-before} +\emph{\Body} + \textsl{contents of the environment} \end{pNiceArray} -\end{Verbatim} +\end{Code} \smallskip The optional argument between square brackets is a list of \textsl{key=value} @@ -1807,7 +1833,7 @@ cf.~p.~\pageref{nodes-i}.} \index{cellcolor@\texttt{\textbackslash cellcolor}!command of \texttt{\textbackslash CodeBefore}} -\index{rectanglecolor@\texttt{\textbackslash rectanglecolor} (command of +\index{rectanglecolor@\texttt{\textbackslash rectanglecolor} (in \texttt{\textbackslash CodeBefore})} \index{rowcolor@\texttt{\textbackslash rowcolor}!command of \texttt{\textbackslash CodeBefore}} \index{columncolor@\texttt{\textbackslash columncolor}!command of @@ -1864,16 +1890,16 @@ syntax -$j$). \medskip \begin{scope} \hfuzz=10cm -\begin{BVerbatim}[boxwidth=10cm,baseline=c] +\begin{Code}[width=10cm] \begin{NiceTabular}{ccc}[hvlines] \CodeBefore - ~emphase#\cellcolor[HTML]{FFFF88}{3-1,2-2,-3}@ + \emph{\cellcolor[HTML]{FFFF88}{3-1,2-2,-3}} \Body a & b & c \\ e & f & g \\ h & i & j \\ \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{ccc}[hvlines] \CodeBefore \cellcolor[HTML]{FFFF88}{3-1,2-2,-3} @@ -1892,16 +1918,16 @@ of the rectangle and the third is the lower-right cell of the rectangle. \medskip \begin{scope} \hfuzz=10cm -\begin{BVerbatim}[boxwidth=10cm,baseline=c] +\begin{Code}[width=10cm] \begin{NiceTabular}{ccc}[hvlines] \CodeBefore - ~emphase#\rectanglecolor{blue!15}{2-2}{3-3}@ + \emph{\rectanglecolor{blue!15}{2-2}{3-3}} \Body a & b & c \\ e & f & g \\ h & i & j \\ \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{ccc}[hvlines] \CodeBefore \rectanglecolor{blue!15}{2-2}{3-3} @@ -1927,16 +1953,16 @@ quincunx with these colors. \medskip \begin{scope} \hfuzz=10cm -\begin{BVerbatim}[baseline=c,boxwidth=9cm] +\begin{Code}[width=9cm] $\begin{pNiceMatrix}[r,margin] \CodeBefore - ~emphase#\chessboardcolors{red!15}{blue!15}@ + \emph{\chessboardcolors{red!15}{blue!15}} \Body 1 & -1 & 1 \\ -1 & 1 & -1 \\ 1 & -1 & 1 \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{pNiceMatrix}[r,baseline=1, margin] \CodeBefore \chessboardcolors{red!15}{blue!15} @@ -1962,10 +1988,10 @@ from the row $a$ until the end). \medskip \begin{scope} \hfuzz = 10cm -\begin{BVerbatim}[boxwidth=9cm,baseline=c] +\begin{Code}[width=9cm] $\begin{NiceArray}{lll}[hvlines] \CodeBefore - ~emphase#\rowcolor{red!15}{1,3-5,8-}@ + \emph{\rowcolor{red!15}{1,3-5,8-}} \Body a_1 & b_1 & c_1 \\ a_2 & b_2 & c_2 \\ @@ -1978,7 +2004,7 @@ a_8 & b_8 & c_8 \\ a_9 & b_9 & c_9 \\ a_{10} & b_{10} & c_{10} \\ \end{NiceArray}$ -\end{BVerbatim} +\end{Code} $\begin{NiceArray}{lll}[baseline=4,hvlines] \CodeBefore \rowcolor{red!15}{1,3-5,8-} @@ -2042,10 +2068,10 @@ several rows if they have to incorporate blocks (created with the command \medskip \begin{scope} \hfuzz=10cm -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] \begin{NiceTabular}{clr}[hvlines] \CodeBefore - ~emphase#\rowcolors[gray]{2}{0.8}{}[cols=2-3,restart]@ + \emph{\rowcolors[gray]{2}{0.8}{}[cols=2-3,restart]} \Body \Block{1-*}{Results} \\ John & 12 \\ @@ -2055,7 +2081,7 @@ Ashley & 20 \\ Henry & 14 \\ Madison & 15 \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{clr}[hvlines,baseline=2] \CodeBefore \rowcolors[gray]{2}{0.8}{}[cols=2-3,restart] @@ -2073,10 +2099,10 @@ Madison & 15 \vspace{1cm} \begin{scope} \hfuzz=10cm -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] \begin{NiceTabular}{lr}[hvlines] \CodeBefore - ~emphase#\rowcolors{1}{blue!10}{}[respect-blocks]@ + \emph{\rowcolors{1}{blue!10}{}[respect-blocks]} \Body \Block{2-1}{John} & 12 \\ & 13 \\ @@ -2089,7 +2115,7 @@ Henry & 14 \\ \Block{2-1}{Madison} & 15 \\ & 19 \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{lr}[hvlines,baseline=c] \CodeBefore \rowcolors{1}{blue!10}{}[respect-blocks] @@ -2118,10 +2144,10 @@ command takes in an argument which is a (comma-separated) list of colors. In that list, the symbol |=| represent a color identical to the previous one. \smallskip -\begin{BVerbatim}[boxwidth=10cm,baseline=c] +\begin{Code}[width=10cm] \begin{NiceTabular}{c} \CodeBefore - ~emphase#\rowlistcolors{1}{red!15,blue!15,green!15}@ + \emph{\rowlistcolors{1}{red!15,blue!15,green!15}} \Body Peter \\ James \\ @@ -2131,7 +2157,7 @@ Claudius \\ Jane \\ Alexandra \\ \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{c} \CodeBefore \rowlistcolors{1}{red!15,blue!15,green!15} @@ -2158,12 +2184,12 @@ of the colors to the size of the tabular.}). \index{resetcolorseries@\texttt{\textbackslash resetcolorseries} (command of \pkg{xcolor})} \smallskip -\begin{BVerbatim}[boxwidth=12.5cm,baseline=c] +\begin{Code}[width=12.5cm] \begin{NiceTabular}{c} \CodeBefore - ~emphase#\definecolorseries{BlueWhite}{rgb}{last}{blue}{white}@ - ~emphase#\resetcolorseries{\value{iRow}}{BlueWhite}@ - ~emphase#\rowlistcolors{1}{BlueWhite!!+}@ + \emph{\definecolorseries{BlueWhite}{rgb}{last}{blue}{white} + \resetcolorseries[\value{iRow}]{BlueWhite} + \rowlistcolors{1}{BlueWhite!!+}} \Body Peter \\ James \\ @@ -2173,7 +2199,7 @@ Claudius \\ Jane \\ Alexandra \\ \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{c} \CodeBefore \definecolorseries{BlueWhite}{rgb}{last}{blue}{white} @@ -2199,10 +2225,10 @@ which are in the ``corners''. In the following example, we use the key \index{corners (key of an environment)|textit} \begin{scope} \hfuzz=11cm -\begin{BVerbatim}[boxwidth=9cm,baseline=c] -\begin{NiceTabular}{cccccc}[~emphase#corners=NE@,margin,hvlines,first-row,first-col] +\begin{Code}[width=9cm] +\begin{NiceTabular}{ccccccc}[\emph{corners=NE},margin,hvlines,first-row,first-col] \CodeBefore - ~emphase#\rowlistcolors{1}{blue!15, }@ + \emph{\rowlistcolors{1}{blue!15, }} \Body & 0 & 1 & 2 & 3 & 4 & 5 & 6 \\ 0 & 1 \\ @@ -2213,7 +2239,7 @@ which are in the ``corners''. In the following example, we use the key 5 & 1 & 5 & 10 & 10 & 5 & 1 \\ 6 & 1 & 6 & 15 & 20 & 15 & 6 & 1 \\ \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{ccccccc}[corners=NE,margin,hvlines,first-row,first-col] \CodeBefore \rowlistcolors{1}{blue!15, } @@ -2246,11 +2272,11 @@ In the following example, we require a color in the column~$0$ (which is the \medskip \begin{scope} \hfuzz=11cm -\begin{BVerbatim}[boxwidth=9cm,baseline=c] -\begin{NiceTabular}{cccccc}[~emphase#corners=NE@,margin,hvlines,first-row,first-col] +\begin{Code}[width=9cm] +\begin{NiceTabular}{ccccccc}[\emph{corners=NE},margin,hvlines,first-row,first-col] \CodeBefore \rowlistcolors{1}{blue!15, } - ~emphase#\columncolor{red!15}{0}@ + \emph{\columncolor{red!15}{0}} \Body & 0 & 1 & 2 & 3 & 4 & 5 & 6 \\ 0 & 1 \\ @@ -2261,7 +2287,7 @@ In the following example, we require a color in the column~$0$ (which is the 5 & 1 & 5 & 10 & 10 & 5 & 1 \\ 6 & 1 & 6 & 15 & 20 & 15 & 6 & 1 \\ \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{ccccccc}[corners=NE,margin,hvlines,first-row,first-col] \CodeBefore \rowlistcolors{1}{blue!15, } @@ -2288,27 +2314,27 @@ However, \pkg{booktabs} is \emph{not} loaded by \pkg{nicematrix}. \index{rotate@\texttt{\textbackslash rotate}|textit} \begin{scope} \hfuzz=10cm -\begin{BVerbatim}[baseline=c,boxwidth=8.5cm] +\begin{Code}[width=8.5cm] \begin{NiceTabular}[c]{lSSSS} \CodeBefore \rowcolor{red!15}{1-2} \rowcolors{3}{blue!15}{} \Body -~emphase#\toprule@ -\Block{2-1}{Product} & +\emph{\toprule} +\Block{2-1}{Product} & \Block{1-3}{dimensions (cm)} & & & \Block{2-1}{\rotate Price} \\ -~emphase#\cmidrule(rl){2-4}@ +\emph{\cmidrule(rl){2-4}} & L & l & h \\ -~emphase#\midrule@ +\emph{\midrule} small & 3 & 5.5 & 1 & 30 \\ standard & 5.5 & 8 & 1.5 & 50.5 \\ premium & 8.5 & 10.5 & 2 & 80 \\ extra & 8.5 & 10 & 1.5 & 85.5 \\ special & 12 & 12 & 0.5 & 70 \\ -~emphase#\bottomrule@ +\emph{\bottomrule} \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}[c]{lSSSS} \CodeBefore \rowcolor{red!15}{1-2} @@ -2376,20 +2402,20 @@ These commands are compatible with the commands for the overlays of Beamer (|\only|, etc.) \smallskip -\begin{Verbatim} -\NewDocumentCommand { \Blue } { } { ~emphase#\columncolor{blue!15}@ } +\begin{Code} +\NewDocumentCommand { \Blue } { } { \emph{\columncolor{blue!15}} } \begin{NiceTabular}[color-inside]{>{\Blue}c>{\Blue}cc} \toprule -~emphase#\rowcolor{red!15}@ +\emph{\rowcolor{red!15}} Last name & First name & Birth day \\ \midrule -Achard & Jacques & 5 juin 1962 \\ +Achard & Jacques & 5 juin 1962 \\ Lefebvre & Mathilde & 23 mai 1988 \\ Vanesse & Stephany & 30 octobre 1994 \\ Dupont & Chantal & 15 janvier 1998 \\ \bottomrule \end{NiceTabular} -\end{Verbatim} +\end{Code} \begin{center} @@ -2418,19 +2444,19 @@ coloring the rows with |\rowlistcolors{...}| and stop coloring by a command |\rowlistcolors| with an empty argument. \bigskip -\begin{BVerbatim}[boxwidth=10cm,baseline=c] +\begin{Code}[width=10cm] \begin{NiceTabular}{c}[hvlines,color-inside] one \\ two \\ -~emphase#\rowlistcolors{red!15}@ +\emph{\rowlistcolors{red!15}} three \\ four \\ five \\ -~emphase#\rowlistcolors{}@ +\emph{\rowlistcolors{}} six \\ seven \\ \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{c}[hvlines,color-inside] one \\ two \\ @@ -2495,16 +2521,16 @@ math and text mode. \end{itemize} \medskip -\begin{BVerbatim}[boxwidth=12cm,baseline=c] +\begin{Code}[width=12cm] \begin{NiceTabular}{cccc} \hline -~emphase#\RowStyle[cell-space-limits=3pt]{\rotate}@ +\emph{\RowStyle[cell-space-limits=3pt]{\rotate}} first & second & third & fourth \\ -~emphase#\RowStyle[nb-rows=2,rowcolor=blue!50,color=white]{\sffamily}@ +\emph{\RowStyle[nb-rows=2,rowcolor=blue!50,color=white]{\sffamily}} 1 & 2 & 3 & 4 \\ I & II & III & IV \end{NiceTabular} -\end{BVerbatim} +\end{Code} \index{rotate@\texttt{\textbackslash rotate}|textit} \begin{NiceTabular}{cccc} \hline @@ -2530,13 +2556,13 @@ In the environments with an explicit preamble (like |{NiceTabular}|, the standard letters |w|, |W|, |p|, |b| and |m| of the package \pkg{array}. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=9cm] -\begin{NiceTabular}{~emphase#W{c}{2cm}@cc}[hvlines] +\begin{Code}[width=9cm] +\begin{NiceTabular}{\emph{W{c}{2cm}}cc}[hvlines] Paris & New York & Madrid \\ Berlin & London & Roma \\ Rio & Tokyo & Oslo \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{W{c}{2cm}cc}[hvlines] Paris & New York & Madrid \\ Berlin & London & Roma \\ @@ -2551,13 +2577,13 @@ width of all the columns (except the potential exterior columns: cf. p.~\pageref with the key |columns-width|. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] -$\begin{pNiceMatrix}[~emphase#columns-width = 1cm@] +\begin{Code}[width=10cm] +$\begin{pNiceMatrix}[\emph{columns-width = 1cm}] 1 & 12 & -123 \\ 12 & 0 & 0 \\ 4 & 1 & 2 \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{pNiceMatrix}[columns-width = 1cm] 1 & 12 & -123 \\ 12 & 0 & 0 \\ @@ -2578,13 +2604,13 @@ will have written informations in the |aux| file and a message requiring a second compilation will appear).}\par\nobreak \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] -$\begin{pNiceMatrix}[~emphase#columns-width = auto@] +\begin{Code}[width=10cm] +$\begin{pNiceMatrix}[\emph{columns-width = auto}] 1 & 12 & -123 \\ 12 & 0 & 0 \\ 4 & 1 & 2 \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{pNiceMatrix}[columns-width = auto] 1 & 12 & -123 \\ 12 & 0 & 0 \\ @@ -2597,8 +2623,8 @@ the arrays of a current scope with the command |\NiceMatrixOptions|.\par\nobreak \medskip -\begin{BVerbatim}[baseline=c,boxwidth=8.5cm] -~emphase#\NiceMatrixOptions{columns-width=10mm}@ +\begin{Code}[width=8.5cm] +\emph{\NiceMatrixOptions{columns-width=10mm}} $\begin{pNiceMatrix} a & b \\ c & d \end{pNiceMatrix} @@ -2606,7 +2632,7 @@ a & b \\ c & d \begin{pNiceMatrix} 1 & 1245 \\ 345 & 2 \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} \begin{scope} \NiceMatrixOptions{columns-width=10mm} $\begin{pNiceMatrix} @@ -2633,8 +2659,8 @@ The environment |{NiceMatrixBlock}| has no direct link with the command |\Block| presented previously in this document (cf.~p.~\pageref{Block}). \medskip -\begin{BVerbatim}[baseline=c,boxwidth=8.5cm] -~emphase#\begin{NiceMatrixBlock}[auto-columns-width]@ +\begin{Code}[width=8.5cm] +\emph{\begin{NiceMatrixBlock}[auto-columns-width]} $\begin{array}{c} \begin{bNiceMatrix} 9 & 17 \\ -2 & 5 @@ -2643,8 +2669,8 @@ $\begin{array}{c} 1 & 1245345 \\ 345 & 2 \end{bNiceMatrix} \end{array}$ -~emphase#\end{NiceMatrixBlock}@ -\end{BVerbatim} +\emph{\end{NiceMatrixBlock}} +\end{Code} \begin{NiceMatrixBlock}[auto-columns-width] $\begin{array}{c} \begin{bNiceMatrix} @@ -2694,13 +2720,13 @@ letters |l|, |c| and |r| (which insert respectively |\raggedright|, |p|, |m| and |b|). The default value is |t|. \end{itemize} -\begin{Verbatim} -\begin{NiceTabular}~emphase#[width=9cm]{X[2,l]X[l]}@[hvlines] +\begin{Code} +\emph{\begin{NiceTabular}[width=9cm]{X[2,l]X[l]}[hvlines]} a rather long text which fits on several lines & a rather long text which fits on several lines \\ a shorter text & a shorter text \end{NiceTabular} -\end{Verbatim} +\end{Code} \begin{center} \begin{NiceTabular}[width=9cm]{X[2,l]X[l]}[hvlines] @@ -2729,15 +2755,15 @@ contents. That point is illustrated on the following examples. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=6cm] +\begin{Code}[width=6cm] \fbox{% -\begin{~emphase#varwidth@}{8cm} +\begin{\emph{varwidth}}{8cm} \begin{itemize} \item first item \item second item \end{itemize} -\end{~emphase#varwidth@}} -\end{BVerbatim} +\end{\emph{varwidth}}} +\end{Code} \fbox{\begin{varwidth}{8cm} \begin{itemize} \item first item @@ -2746,15 +2772,15 @@ That point is illustrated on the following examples. \end{varwidth}} \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=6cm] +\begin{Code}[width=6cm] \fbox{% -\begin{~emphase#minipage@}{8cm} +\begin{\emph{minipage}}{8cm} \begin{itemize} \item first item \item second item \end{itemize} -\end{~emphase#minipage@}} -\end{BVerbatim} +\end{\emph{minipage}}} +\end{Code} \fbox{\begin{minipage}{8cm} \begin{itemize} \item first item @@ -2773,13 +2799,13 @@ When the package \pkg{varwidth} is loaded, the columns |V| of \pkg{varwidth} are supported by \pkg{nicematrix}. \medskip -\begin{Verbatim} -\begin{NiceTabular}[corners=NW,hvlines]{~emphase#V{3cm}V{3cm}V{3cm}@} +\begin{Code} +\begin{NiceTabular}[corners=NW,hvlines]{\emph{V{3cm}V{3cm}V{3cm}}} & some text & some very very very long text \\ some very very very long text \\ some very very very long text \end{NiceTabular} -\end{Verbatim} +\end{Code} \medskip \begin{center} @@ -2827,8 +2853,8 @@ matrices. A potential ``first row'' (exterior) has the number $0$ (and not $1$). Idem for the potential ``first column''. -\begin{Verbatim} -$\begin{pNiceMatrix}[~emphase#first-row,last-row,first-col,last-col@,nullify-dots] +\begin{Code} +$\begin{pNiceMatrix}[\emph{first-row,last-row,first-col,last-col},nullify-dots] & C_1 & \Cdots & & C_4 & \\ L_1 & a_{11} & a_{12} & a_{13} & a_{14} & L_1 \\ \Vdots & a_{21} & a_{22} & a_{23} & a_{24} & \Vdots \\ @@ -2836,7 +2862,7 @@ L_1 & a_{11} & a_{12} & a_{13} & a_{14} & L_1 \\ L_4 & a_{41} & a_{42} & a_{43} & a_{44} & L_4 \\ & C_1 & \Cdots & & C_4 & \end{pNiceMatrix}$ -\end{Verbatim} +\end{Code} \[\begin{pNiceMatrix}[first-row,last-row,first-col,last-col,nullify-dots] & C_1 & \Cdots & & C_4 & \\ @@ -2896,21 +2922,23 @@ It's possible to control the appearance of these rows and columns with options each cell of the corresponding row or column. -\begin{Verbatim} -\NiceMatrixOptions{~emphase#code-for-first-row@ = \color{red}, - ~emphase#code-for-first-col@ = \color{blue}, - ~emphase#code-for-last-row@ = \color{green}, - ~emphase#code-for-last-col@ = \color{magenta}} -$\begin{pNiceArray}{cc|cc}[first-row,last-row=5,first-col,last-col,nullify-dots] - & C_1 & \Cdots & & C_4 & \\ +\begin{Code} +\NiceMatrixOptions{\emph{code-for-first-row = \color{red}, + code-for-first-col = \color{blue}, + code-for-last-row = \color{green}, + code-for-last-col = \color{magenta}}} +\begin{displaymath} +\begin{pNiceArray}{cc|cc}[first-row,last-row=5,first-col,last-col,nullify-dots] + & C_1 & \multicolumn1c{\Cdots} & & C_4 & \\ L_1 & a_{11} & a_{12} & a_{13} & a_{14} & L_1 \\ \Vdots & a_{21} & a_{22} & a_{23} & a_{24} & \Vdots \\ \hline & a_{31} & a_{32} & a_{33} & a_{34} & \\ L_4 & a_{41} & a_{42} & a_{43} & a_{44} & L_4 \\ - & C_1 & \Cdots & & C_4 & -\end{pNiceArray}$ -\end{Verbatim} + & C_1 & \multicolumn1c{\Cdots} & & C_4 & +\end{pNiceArray} +\end{displaymath} +\end{Code} \begin{scope} \NiceMatrixOptions{code-for-first-row = \color{red}, @@ -2991,7 +3019,7 @@ remind that it works for |\Cdots|, |\Ldots|, |\Vdots|, etc.): cf. p. \pageref{customisation}.}\par\nobreak \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] \begin{bNiceMatrix} a_1 & \Cdots & & & a_1 \\ \Vdots & a_2 & \Cdots & & a_2 \\ @@ -2999,7 +3027,7 @@ a_1 & \Cdots & & & a_1 \\ \\ a_1 & a_2 & & & a_n \end{bNiceMatrix} -\end{BVerbatim} +\end{Code} $\begin{bNiceMatrix} a_1 & \Cdots & & & a_1 \\ \Vdots & a_2 & \Cdots & & a_2 \\ @@ -3013,13 +3041,13 @@ In order to represent the null matrix, one can use the following codage:\par\nobreak \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] \begin{bNiceMatrix} 0 & \Cdots & 0 \\ \Vdots & & \Vdots \\ 0 & \Cdots & 0 \end{bNiceMatrix} -\end{BVerbatim} +\end{Code} $\begin{bNiceMatrix} 0 & \Cdots & 0 \\ \Vdots & & \Vdots \\ @@ -3032,14 +3060,14 @@ LaTeX add a new row and a new column. It's possible to use the same method with \pkg{nicematrix}:\par\nobreak \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] \begin{bNiceMatrix} 0 & \Cdots & \Cdots & 0 \\ \Vdots & & & \Vdots \\ \Vdots & & & \Vdots \\ 0 & \Cdots & \Cdots & 0 \end{bNiceMatrix} -\end{BVerbatim} +\end{Code} $\begin{bNiceMatrix} 0 & \Cdots & \Cdots & 0 \\ \Vdots & & & \Vdots \\ @@ -3056,14 +3084,14 @@ In fact, in this example, it would be possible to draw the same matrix more easily with the following code:\par\nobreak \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] \begin{bNiceMatrix} 0 & \Cdots & & 0 \\ \Vdots & & & \\ & & & \Vdots \\ 0 & & \Cdots & 0 \end{bNiceMatrix} -\end{BVerbatim} +\end{Code} $\begin{bNiceMatrix} 0 & \Cdots & & 0 \\ \Vdots & & & \\ @@ -3088,13 +3116,13 @@ command~|\Hspace| which is a variant of |\hspace| transparent for the dotted lines of \pkg{nicematrix}.\par\nobreak \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] -\begin{bNiceMatrix} -0 & \Cdots & ~emphase#\Hspace*{1cm}@ & 0 \\ -\Vdots & & & \Vdots \\~emphase#[1cm]@ +\begin{Code}[width=10cm] +$\begin{bNiceMatrix} +0 & \Cdots & \emph{\Hspace*{1cm}} & 0 \\ +\Vdots & & & \Vdots \\[1cm] 0 & \Cdots & & 0 -\end{bNiceMatrix} -\end{BVerbatim} +\end{bNiceMatrix}$ +\end{Code} $\begin{bNiceMatrix} 0 & \Cdots & \Hspace*{1cm} & 0 \\ \Vdots & & & \Vdots \\[1cm] @@ -3109,12 +3137,12 @@ Consider the following matrix composed classicaly with the environment |{pmatrix}| of \pkg{amsmath}.\par\nobreak \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] $A = \begin{pmatrix} h & i & j & k & l & m \\ x & & & & & x \end{pmatrix}$ -\end{BVerbatim} +\end{Code} $A = \begin{pmatrix} h & i & j & k & l & m \\ x & & & & & x @@ -3126,12 +3154,12 @@ If we add |\ldots| instructions in the second row, the geometry of the matrix is modified.\par\nobreak \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] $B = \begin{pmatrix} h & i & j & k & l & m \\ x & \ldots & \ldots & \ldots & \ldots & x \end{pmatrix}$ -\end{BVerbatim} +\end{Code} $B = \begin{pmatrix} h & i & j & k & l & m \\ x & \ldots & \ldots & \ldots & \ldots & x @@ -3143,12 +3171,12 @@ By default, with \pkg{nicematrix}, if we replace |{pmatrix}| by changed.\par\nobreak \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] $C = \begin{pNiceMatrix} h & i & j & k & l & m \\ x & \Ldots & \Ldots & \Ldots & \Ldots & x \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} $C = \begin{pNiceMatrix} h & i & j & k & l & m \\ x & \Ldots & \Ldots & \Ldots & \Ldots & x @@ -3161,12 +3189,12 @@ using the option |nullify-dots| (and only one instruction |\Ldots| is necessary).\par\nobreak \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] -$D = \begin{pNiceMatrix}[~emphase#nullify-dots@] +\begin{Code}[width=10cm] +$D = \begin{pNiceMatrix}[\emph{nullify-dots}] h & i & j & k & l & m \\ -x & \Ldots & & & & x +x & \Ldots & & & & x \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} $D = \begin{pNiceMatrix}[nullify-dots] h & i & j & k & l & m \\ x & \Ldots & & & & x @@ -3197,14 +3225,14 @@ As with the other commands of \pkg{nicematrix} (like |\Cdots|, |\Ldots|, contents of the cells on both sides. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=7cm] +\begin{Code}[width=7cm] $\begin{pNiceMatrix} 1 & 2 & 3 & 4 & 5 \\ -1 & ~emphase#\Hdotsfor{3}@ & 5 \\ +1 & \emph{\Hdotsfor{3}} & 5 \\ 1 & 2 & 3 & 4 & 5 \\ 1 & 2 & 3 & 4 & 5 \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{pNiceMatrix} 1 & 2 & 3 & 4 & 5 \\ 1 & \Hdotsfor{3} & 5 \\ @@ -3217,14 +3245,14 @@ However, if these cells are empty, the dotted line extends only in the cells specified by the argument of |\Hdotsfor| (by design). \medskip -\begin{BVerbatim}[baseline=c,boxwidth=7cm] +\begin{Code}[width=7cm] $\begin{pNiceMatrix} 1 & 2 & 3 & 4 & 5 \\ - & ~emphase#\Hdotsfor{3}@ \\ + & \emph{\Hdotsfor{3}} \\ 1 & 2 & 3 & 4 & 5 \\ 1 & 2 & 3 & 4 & 5 \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{pNiceMatrix} 1 & 2 & 3 & 4 & 5 \\ & \Hdotsfor{3} \\ @@ -3247,38 +3275,41 @@ The package \pkg{nicematrix} also provides a command |\Vdotsfor| similar to \bigskip The following example uses both |\Hdotsfor| and |\Vdotsfor|: -\begin{Verbatim}[formatcom=\small\color{gray}] +\smallskip +\begin{scope} +\small +\begin{Code} \begin{bNiceMatrix} -C[a_1,a_1] & \Cdots & C[a_1,a_n] +C[a_1,a_1] & \Cdots & C[a_1,a_n] & \hspace*{20mm} & C[a_1,a_1^{(p)}] & \Cdots & C[a_1,a_n^{(p)}] \\ -\Vdots & \Ddots & \Vdots - & ~emphase#\Hdotsfor{1}@ & \Vdots & \Ddots & \Vdots \\ -C[a_n,a_1] & \Cdots & C[a_n,a_n] +\Vdots & \Ddots & \Vdots + & \emph{\Hdotsfor{1}} & \Vdots & \Ddots & \Vdots \\ +C[a_n,a_1] & \Cdots & C[a_n,a_n] & & C[a_n,a_1^{(p)}] & \Cdots & C[a_n,a_n^{(p)}] \\ -\rule{0pt}{15mm}\NotEmpty & ~emphase#\Vdotsfor{1}@ & & \Ddots & & ~emphase#\Vdotsfor{1}@ \\ -C[a_1^{(p)},a_1] & \Cdots & C[a_1^{(p)},a_n] +\rule{0pt}{15mm}\NotEmpty & \emph{\Vdotsfor{1}} & & \Ddots & & \emph{\Vdotsfor{1}} \\ +C[a_1^{(p)},a_1] & \Cdots & C[a_1^{(p)},a_n] & & C[a_1^{(p)},a_1^{(p)}] & \Cdots & C[a_1^{(p)},a_n^{(p)}] \\ -\Vdots & \Ddots & \Vdots - & ~emphase#\Hdotsfor{1}@ & \Vdots & \Ddots & \Vdots \\ -C[a_n^{(p)},a_1] & \Cdots & C[a_n^{(p)},a_n] +\Vdots & \Ddots & \Vdots + & \emph{\Hdotsfor{1}} & \Vdots & \Ddots & \Vdots \\ +C[a_n^{(p)},a_1] & \Cdots & C[a_n^{(p)},a_n] & & C[a_n^{(p)},a_1^{(p)}] & \Cdots & C[a_n^{(p)},a_n^{(p)}] \end{bNiceMatrix} -\end{Verbatim} +\end{Code} +\end{scope} \[\begin{bNiceMatrix} C[a_1,a_1] & \Cdots & C[a_1,a_n] & \hspace*{20mm} & C[a_1,a_1^{(p)}] & \Cdots & C[a_1,a_n^{(p)}] \\ -\Vdots & \Ddots & \Vdots & \Hdotsfor{1} & \Vdots & \Ddots & \Vdots \\ +\Vdots & \Ddots & \Vdots & \Hdotsfor{1} & \Vdots & \Ddots & \Vdots \\ C[a_n,a_1] & \Cdots & C[a_n,a_n] & & C[a_n,a_1^{(p)}] & \Cdots & C[a_n,a_n^{(p)}] \\ \rule{0pt}{15mm}\NotEmpty & \Vdotsfor{1} & & \Ddots & & \Vdotsfor{1} \\ C[a_1^{(p)},a_1] & \Cdots & C[a_1^{(p)},a_n] & & C[a_1^{(p)},a_1^{(p)}] & \Cdots & C[a_1^{(p)},a_n^{(p)}] \\ -\Vdots & \Ddots & \Vdots & \Hdotsfor{1} & \Vdots & \Ddots & \Vdots \\ +\Vdots & \Ddots & \Vdots & \Hdotsfor{1} & \Vdots & \Ddots & \Vdots \\ C[a_n^{(p)},a_1] & \Cdots & C[a_n^{(p)},a_n] & & C[a_n^{(p)},a_1^{(p)}] & \Cdots & C[a_n^{(p)},a_n^{(p)}] \end{bNiceMatrix}\] - \subsection{How to generate the continuous dotted lines transparently} \index{renew-matrix} @@ -3313,18 +3344,18 @@ With this option, the environment |{matrix}| is redefined and behave like Therefore, with the keys |renew-dots| and |renew-matrix|, a classical code gives directly the ouput of \pkg{nicematrix}.\par\nobreak -\bigskip +\medskip \begin{scope} \NiceMatrixOptions{renew-dots,renew-matrix} -\begin{BVerbatim}[baseline=c,boxwidth=10cm] -~emphase#\NiceMatrixOptions{renew-dots,renew-matrix}@ +\begin{Code}[width=10cm] +\emph{\NiceMatrixOptions{renew-dots,renew-matrix}} \begin{pmatrix} 1 & \cdots & \cdots & 1 \\ 0 & \ddots & & \vdots \\ \vdots & \ddots & \ddots & \vdots \\ 0 & \cdots & 0 & 1 \end{pmatrix} -\end{BVerbatim} +\end{Code} $\begin{pmatrix} 1 & \cdots & \cdots & 1 \\ 0 & \ddots & & \vdots \\ @@ -3347,13 +3378,13 @@ white background which is put on the line previously drawn (see example on p.~\pageref{ex:colon}). \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] $\begin{bNiceMatrix} 1 & \hspace*{1cm} & 0 \\[8mm] - & ~emphase#\Ddots^{n \text{ times}}@ & \\ + & \emph{\Ddots^{n \text{ times}}} & \\ 0 & & 1 \end{bNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{bNiceMatrix} 1 & \hspace*{1cm} & 0 \\[8mm] & \Ddots^{n \text{ times}} & \\ @@ -3365,13 +3396,13 @@ $\begin{bNiceMatrix} With the key |xdots/horizontal-labels|, the labels stay horizontal.\par\nobreak % \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] +\begin{Code}[width=10cm] $\begin{bNiceMatrix}[xdots/horizontal-labels] 1 & \hspace*{1cm} & 0 \\[8mm] - & ~emphase#\Ddots^{n \text{ times}}@ & \\ + & \emph{\Ddots^{n \text{ times}}} & \\ 0 & & 1 \end{bNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{bNiceMatrix}[xdots/horizontal-labels] 1 & \hspace*{1cm} & 0 \\[8mm] & \Ddots^{n \text{ times}} & \\ @@ -3487,8 +3518,8 @@ the TikZ pathes (with the exception of ``|color|'', ``|shorten >|'' and Here is for example a tridiagonal matrix with the style |loosely dotted|:\par\nobreak \medskip -\begin{BVerbatim}[baseline=c] -$\begin{pNiceMatrix}[nullify-dots,~emphase#xdots/line-style=loosely dotted@] +\begin{Code} +$\begin{pNiceMatrix}[nullify-dots,\emph{xdots/line-style=loosely dotted}] a & b & 0 & & \Cdots & 0 \\ b & a & b & \Ddots & & \Vdots \\ 0 & b & a & \Ddots & & \\ @@ -3496,7 +3527,7 @@ b & a & b & \Ddots & & \Vdots \\ \Vdots & & & & & b \\ 0 & \Cdots & & 0 & b & a \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} \[\begin{pNiceMatrix}[nullify-dots,xdots/line-style=loosely dotted] @@ -3523,14 +3554,14 @@ blocks).\footnote{On the other side, the command |\line| in the block.} \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10.6cm] -$\begin{bNiceMatrix}[margin,~emphase#hvlines@] +\begin{Code}[width=10.6cm] +$\begin{bNiceMatrix}[margin,\emph{hvlines}] \Block{3-3}<\LARGE>{A} & & & 0 \\ & \hspace*{1cm} & & \Vdots \\ & & & 0 \\ 0 & \Cdots& 0 & 0 \end{bNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{bNiceMatrix}[margin,hvlines] \Block{3-3}<\LARGE>{A} & & & 0 \\ & \hspace*{1cm} & & \Vdots \\ @@ -3538,6 +3569,7 @@ $\begin{bNiceMatrix}[margin,hvlines] 0 & \Cdots& 0 & 0 \end{bNiceMatrix}$ + \index{dotted@\textbf{Dotted lines}|)} \section{Delimiters in the preamble of the environment} @@ -3568,13 +3600,13 @@ All the vertical extensible delimiters of LaTeX are allowed. Here is a example which uses the delimiters |\lgroup| and |\rgroup|. \smallskip -\begin{BVerbatim} -$\begin{NiceArray}{~emphase#\left\lgroup@ ccc~emphase#\right\rgroup@ l} +\begin{Code} +$\begin{NiceArray}{\emph{\left\lgroup} ccc\emph{\right\rgroup} l} 1 & 2 & 3 & 4 & 1 & 6 & 7 & 8 & 9 & \scriptstyle L_3 \gets L_3 + L_1 + L_2 \end{NiceArray}$ -\end{BVerbatim} +\end{Code} \[\begin{NiceArray}{\left\lgroup ccc\right\rgroup l} 1 & 2 & 3 & \\ @@ -3588,12 +3620,34 @@ For this example, it would also have been possible to use the environment p.~\pageref{NiceArrayWithDelims}) and the key |last-col| (cf. p.~\pageref{exterior}). \bigskip -There is a particular case: for the delimiters |(|, |[| and |\{| (and the -corresponding closing delimiters), the prefixes |\left| et |\right| are +There is a particular case: for the delimiters |(|, |[| and |\{|\footnote{For + the braces, the protection by a backslash is mandatory (that's why we have + written |\{|).}, +and the corresponding closing delimiters, the prefixes |\left| et |\right| are optional.\footnote{For the delimiters |[| and |]|, the prefixes remain mandatory when there is a conflict of notation with the square brackets for the options of some descriptors of columns.} +\bigskip +Here is an example with a left delimiter |\{| in a |{NiceTabular}| (remark the +compatibility with the key |t|). + +\smallskip +\begin{Verbatim} +We define $f$ with\quad +\begin{NiceTabular}[t]{\{ll} +$f(x) = 0$ & if $x$ is non positive \\ +$f(x) = 1-e^x$ & if $x$ is positive +\end{Verbatim} + +\smallskip +\begin{center} +On définit $f$ par\quad +\begin{NiceTabular}[t]{\{ll} +$f(x) = 0$ & if $x$ is non positive\\ +$f(x) = 1-e^x$ & if $x$ is positive +\end{NiceTabular} +\end{center} \bigskip @@ -3602,13 +3656,13 @@ an opening one for another submatrix), a space equal to |\enskip| is automatically inserted. \medskip -\begin{BVerbatim} -$\begin{pNiceArray}{~emphase#(c)(c)(c)@} +\begin{Code} +$\begin{pNiceArray}{\emph{(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} +\end{Code} \[\begin{pNiceArray}{(c)(c)(c)} a_{11} & a_{12} & a_{13} \\ @@ -3676,16 +3730,16 @@ This command may be used, for example, to draw a dotted line between two adjacent cells. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=11cm] +\begin{Code}[width=11cm] \NiceMatrixOptions{xdots/shorten = 0.6 em} \begin{pNiceMatrix} I & 0 & \Cdots &0 \\ 0 & I & \Ddots &\Vdots\\ \Vdots &\Ddots & I &0 \\ 0 &\Cdots & 0 &I -~emphase#\CodeAfter \line{2-2}{3-3}@ +\emph{\CodeAfter \line{2-2}{3-3}} \end{pNiceMatrix} -\end{BVerbatim} +\end{Code} \begin{scope} \NiceMatrixOptions{xdots/shorten = 0.6 em} $\begin{pNiceMatrix} @@ -3703,15 +3757,15 @@ lines (by default, the dotted lines drawn by |\Ddots| are ``parallelized'': cf.~p.~\pageref{parallelization}). \medskip -\begin{BVerbatim} +\begin{Code} \begin{bNiceMatrix} 1 & \Cdots & & 1 & 2 & \Cdots & 2 \\ 0 & \Ddots & & \Vdots & \Vdots & \hspace*{2.5cm} & \Vdots \\ \Vdots & \Ddots & & & & & \\ 0 & \Cdots & 0 & 1 & 2 & \Cdots & 2 -~emphase#\CodeAfter \line[shorten=6pt]{1-5}{4-7}@ +\emph{\CodeAfter \line[shorten=6pt]{1-5}{4-7}} \end{bNiceMatrix} -\end{BVerbatim} +\end{Code} \[\begin{bNiceMatrix} 1 & \Cdots & & 1 & 2 & \Cdots & 2 \\ 0 & \Ddots & & \Vdots & \Vdots & \hspace*{2.5cm} & \Vdots \\ @@ -3760,17 +3814,16 @@ and you have added by hand some space between the third and fourth column with \medskip \begin{scope} \hfuzz=15cm -\fvset{commandchars=\~\#\+}% -\begin{BVerbatim}[boxwidth=11cm,baseline=c] -\[\begin{NiceArray}{ccc~emphase#@{\hspace{1.5em}}+c}[cell-space-limits=2pt,~emphase#margin+] +\begin{Code}[width=11cm] +\[\begin{NiceArray}{ccc\emph{@{\hspace{1.5em}}}c}[cell-space-limits=2pt,\emph{margin}] 1 & 1 & 1 & x \\ \dfrac{1}{4} & \dfrac{1}{2} & \dfrac{1}{4} & y \\ 1 & 2 & 3 & z \CodeAfter - ~emphase#\SubMatrix({1-1}{3-3})+ - ~emphase#\SubMatrix({1-4}{3-4})+ + \emph{\SubMatrix({1-1}{3-3}) + \SubMatrix({1-4}{3-4})} \end{NiceArray}\] -\end{BVerbatim} +\end{Code} \end{scope} $\begin{NiceArray}{ccc@{\hspace{1.5em}}c}[cell-space-limits=2pt,margin] 1 & 1 & 1 & x \\ @@ -3790,13 +3843,13 @@ with the following construction. \medskip \begin{scope} \hfuzz=15cm -\begin{BVerbatim}[boxwidth=11cm,baseline=c] -$\begin{NiceArray}{~emphase#(ccc)(c)@}[cell-space-limits=2pt] +\begin{Code}[width=11cm] +$\begin{NiceArray}{\emph{(ccc)(c)}}[cell-space-limits=2pt] 1 & 1 & 1 & x \\ \dfrac{1}{4} & \dfrac{1}{2} & \dfrac{1}{4} & y \\ 1 & 2 & 3 & z \end{NiceArray}$ -\end{BVerbatim} +\end{Code} \end{scope} $\begin{NiceArray}{(ccc)(c)}[cell-space-limits=2pt] 1 & 1 & 1 & x \\ @@ -3812,15 +3865,15 @@ and subscript. \medskip \begin{scope} \hfuzz=15cm -\begin{BVerbatim}[boxwidth=11cm,baseline=c] +\begin{Code}[width=11cm] $\begin{bNiceMatrix}[right-margin=1em] 1 & 1 & 1 \\ 1 & a & b \\ 1 & c & d \CodeAfter - ~emphase#\SubMatrix[{2-2}{3-3}]^{T}@ + \emph{\SubMatrix[{2-2}{3-3}]^{T}} \end{bNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{bNiceMatrix}[right-margin=1em] 1 & 1 & 1 \\ 1 & a & b \\ @@ -3880,19 +3933,18 @@ the prefix |sub-matrix| which means that their names are therefore \bigskip \begin{scope} \hfuzz=12cm -\fvset{commandchars=\~\#\!}% -\begin{BVerbatim}[baseline=c,boxwidth=11cm] +\begin{Code}[width=11cm] $\begin{NiceArray}{cc@{\hspace{5mm}}l}[cell-space-limits=2pt] - & & \frac12 \\ - & & \frac14 \\[1mm] -a & b & \frac12a+\frac14b \\ -c & d & \frac12c+\frac14d \\ + & & \frac{1}{2} \\ + & & \frac{1}{4} \\[1mm] +a & b & \frac{1}{2}a+\frac{1}{4}b \\ +c & d & \frac{1}{2}c+\frac{1}{4}d \\ \CodeAfter \SubMatrix({1-3}{2-3}) \SubMatrix({3-1}{4-2}) \SubMatrix({3-3}{4-3}) \end{NiceArray}$ -\end{BVerbatim} +\end{Code} \end{scope} $\begin{NiceArray}{cc@{\hspace{5mm}}l}[cell-space-limits=2pt] & & \frac12 \\ @@ -3911,19 +3963,18 @@ Here is the same example with the key |slim| used for one of the submatrices. \medskip \begin{scope} \hfuzz=12cm -\fvset{commandchars=\~\#\!}% -\begin{BVerbatim}[baseline=c,boxwidth=11cm] +\begin{Code}[width=11cm] $\begin{NiceArray}{cc@{\hspace{5mm}}l}[cell-space-limits=2pt] & & \frac12 \\ & & \frac14 \\[1mm] a & b & \frac12a+\frac14b \\ c & d & \frac12c+\frac14d \\ \CodeAfter - \SubMatrix({1-3}{2-3})[~emphase#slim!] + \SubMatrix({1-3}{2-3})[\emph{slim}] \SubMatrix({3-1}{4-2}) \SubMatrix({3-3}{4-3}) \end{NiceArray}$ -\end{BVerbatim} +\end{Code} \end{scope} $\begin{NiceArray}{cc@{\hspace{5mm}}l}[cell-space-limits=2pt] & & \frac12 \\ @@ -3949,17 +4000,17 @@ Despite its name, the command |\SubMatrix| may also be used within a |\toprule| of \pkg{booktabs}). \medskip -\begin{BVerbatim}[baseline=c] -\begin{NiceTabular}{~LetterAt{}ll~LetterAt{}} +\begin{Code}[width=8cm] +\begin{NiceTabular}{@{}ll@{}} \toprule Part A & the first part \\ \Block{2-1}{Part B} & a first sub-part \\ & a second sub-part \\ \bottomrule \CodeAfter - ~emphase#\SubMatrix{\{}{2-2}{3-2}{.}@ + \emph{\SubMatrix{\{}{2-2}{3-2}{.}} \end{NiceTabular} -\end{BVerbatim} +\end{Code} \hspace{2cm} \begin{NiceTabular}{@{}ll@{}} \toprule @@ -3983,7 +4034,7 @@ p.~\pageref{submatrix-in-codebefore}. \vspace{1cm} \emph{Caution} : The following functionnality is fragile and does not work with -the compilationn |latex|--|dvips|--|ps2pdf|.\par\nobreak +|latex|--|dvips|--|ps2pdf|.\par\nobreak The key |code| of the command |\SubMatrix| allows the insertion of code after the construction of the submatrix. It's meant to be used to insert TikZ @@ -3993,9 +4044,7 @@ numbers of row and columns \emph{relative to the submatrix}.\footnote{Be careful: the syntax \verb+j|-i+ is \emph{not} allowed.} \medskip -\begin{scope} -\fvset{commandchars=\~\#\!}% -\begin{Verbatim} +\begin{Code} $\begin{NiceArray}{ccc@{}w{c}{5mm}@{}ccc} & & && -1 & 1 & 2 \\ & & && 0 & 3 & 4 \\ @@ -4004,13 +4053,14 @@ $\begin{NiceArray}{ccc@{}w{c}{5mm}@{}ccc} 0 & 4 & 5 && 0 & 12 & 41 \\ 0 & 0 & 6 && 0 & 0 & 30 \CodeAfter - ~emphase#\NewDocumentCommand{\MyDraw}{}{\tikz \draw [blue] (2-|1) -| (3-|2) -| (4-|3) ;}! - \SubMatrix({1-5}{3-7})[~emphase#code = \MyDraw!] - \SubMatrix({4-1}{6-3})[~emphase#code = \MyDraw!] - \SubMatrix({4-5}{6-7})[~emphase#code = \MyDraw!] + \emph{\NewDocumentCommand{\MyDraw}{}{\tikz \draw [blue] (2-|1) -| (3-|2) -| + (4-|3) ;}} + \SubMatrix({1-5}{3-7})[\emph{code = \MyDraw} ] + \SubMatrix({4-1}{6-3})[\emph{code = \MyDraw} ] + \SubMatrix({4-5}{6-7})[\emph{code = \MyDraw} ] \end{NiceArray}$ -\end{Verbatim} -\end{scope} +\end{Code} + \[\begin{NiceArray}{ccc@{}w{c}{5mm}@{}ccc} @@ -4054,15 +4104,15 @@ syntax $i$|-|$j$ where $i$ the number of row and $j$ the number of column; \end{itemize} \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=9cm] +\begin{Code}[width=9cm] \begin{pNiceMatrix} 1 & 2 & 3 & 4 & 5 & 6 \\ 11 & 12 & 13 & 14 & 15 & 16 \\ \CodeAfter - ~emphase#\OverBrace{1-1}{2-3}{A}@ - ~emphase#\OverBrace{1-4}{2-6}{B}@ + \emph{\OverBrace{1-1}{2-3}{A} + \OverBrace{1-4}{2-6}{B}} \end{pNiceMatrix} -\end{BVerbatim} +\end{Code} $\begin{pNiceMatrix} 1 & 2 & 3 & 4 & 5 & 6 \\ 11 & 12 & 13 & 14 & 15 & 16 \\ @@ -4105,15 +4155,15 @@ and |right-shorten|; \end{itemize} \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=9cm] +\begin{Code}[width=9cm] \begin{pNiceMatrix} 1 & 2 & 3 & 4 & 5 & 6 \\ 11 & 12 & 13 & 14 & 15 & 16 \\ \CodeAfter - \OverBrace~emphase#[shorten,yshift=3pt]@{1-1}{2-3}{A} - \OverBrace~emphase#[shorten,yshift=3pt]@{1-4}{2-6}{B} + \OverBrace[\emph{shorten,yshift=3pt}]{1-1}{2-3}{A} + \OverBrace[\emph{shorten,yshift=3pt}]{1-4}{2-6}{B} \end{pNiceMatrix} -\end{BVerbatim} +\end{Code} $\begin{pNiceMatrix} 1 & 2 & 3 & 4 & 5 & 6 \\ 11 & 12 & 13 & 14 & 15 & 16 \\ @@ -4156,7 +4206,7 @@ which are the other keys in the argument of |\TikzEveryCell|. \medskip \begingroup \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=9cm] +\begin{Code}[width=9cm] \renewcommand{\arraystretch}{1.3} \begin{NiceTabular}{ccc}[corners] & \Block{1-2}{columns} \\ @@ -4164,9 +4214,9 @@ which are the other keys in the argument of |\TikzEveryCell|. & cell 1 1 & cell 1 2 \\ & cell 2 1 & cell 2 2 \CodeAfter - ~emphase#\TikzEveryCell{offset=1pt,draw}@ + \emph{\TikzEveryCell{offset=1pt,draw}} \end{NiceTabular} -\end{BVerbatim} +\end{Code} \renewcommand{\arraystretch}{1.3} \begin{NiceTabular}{ccc}[corners] & \Block{1-2}{columns} \\ @@ -4285,23 +4335,23 @@ been loaded (before or after \pkg{nicematrix}). Indeed, the notes are composed at the end of the array with a type of list provided by the package \pkg{enumitem}. -\begin{scope} -\fvset{commandchars=\~\#\!} -\begin{Verbatim} + + +\begin{Code} \begin{NiceTabular}{@{}llr@{}} \toprule \RowStyle{\bfseries} Last name & First name & Birth day \\ \midrule -Achard\tabularnote{~emphase#Achard is an old family of the Poitou.!} -& Jacques & 5 juin 1962 \\ -Lefebvre\tabularnote{~emphase#The name Lefebvre is an alteration of the name Lefebure.!} -& Mathilde & 23 mai 1988 \\ -Vanesse & Stephany & 30 octobre 1994 \\ -Dupont & Chantal & 15 janvier 1998 \\ +Achard\emph{\tabularnote{Achard is an old family of the Poitou.}} +& Jacques & June 5, 2005 \\ +Lefebvre\emph{\tabularnote{The name Lefebvre is an alteration of the name Lefebure.}} +& Mathilde & January 23, 1975 \\ +Vanesse & Stephany & October 30, 1994 \\ +Dupont & Chantal & January 15, 1998 \\ \bottomrule \end{NiceTabular} -\end{Verbatim} -\end{scope} +\end{Code} + \begin{center} \begin{NiceTabular}{@{}llr@{}} @@ -4377,15 +4427,15 @@ For an illustration of some of those remarks, see table with the following code (the package \pkg{caption} has been loaded in this document). \begin{center} -\fvset{commandchars=\~\#\!} -\begin{Verbatim}[formatcom=\small\color{gray}] +\small +\begin{Code} \begin{table} \centering \NiceMatrixOptions{caption-above} \begin{NiceTabular}{@{}llc@{} [ caption = A tabular whose caption has been specified by the key - \texttt{caption}~emphase#\tabularnote[$\star$]{It's possible to put a tabular note in the caption.}! , + \texttt{caption}\emph{\tabularnote[$\star$]{It's possible to put a tabular note in the caption.}} , label = t:tabularnote , tabularnote = Some text before the notes. , notes/bottomrule @@ -4394,16 +4444,16 @@ with the following code (the package \pkg{caption} has been loaded in this docum Last name & First name & Length of life \\ \midrule Churchill & Wiston & 91\\ -Nightingale~emphase#\tabularnote{Considered as the first nurse of history}!% -~emphase#\tabularnote{Nicknamed ``the Lady with the Lamp''.}! -& Florence~emphase#\tabularnote{This note is shared by two references.}! & 90 \\ -Schoelcher & Victor & 89~emphase#\tabularnote{The label of the note is overlapping.}!\\ -Touchet & Marie~emphase#\tabularnote{This note is shared by two references.}! & 89 \\ +Nightingale\emph{\tabularnote{Considered as the first nurse of history}}% +\emph{\tabularnote{Nicknamed ``the Lady with the Lamp''.}} +& Florence\emph{\tabularnote{This note is shared by two references.}} & 90 \\ +Schoelcher & Victor & 89\emph{\tabularnote{The label of the note is overlapping.}}\\ +Touchet & Marie\emph{\tabularnote{This note is shared by two references.}} & 89 \\ Wallis & John & 87 \\ \bottomrule \end{NiceTabular} \end{table} -\end{Verbatim} +\end{Code} \end{center} @@ -4603,14 +4653,14 @@ For an example of customisation of the tabular notes, see p.~\pageref{ex:notes}. If you wish to use an environment |{NiceTabular}|, |{NiceTabular*}| or |{NiceTabularX}| in an environment |{threeparttable}| of the eponymous package, -you have to patch |{threeparttable}| with the following code (with a version of -LaTeX at least 2020/10/01). -\begin{Verbatim}[commandchars=\~\#\!] +you have to patch |{threeparttable}| with the following code. + +\begin{Code} \makeatletter \AddToHook{env/threeparttable/begin} {\TPT@hookin{NiceTabular}\TPT@hookin{NiceTabular*}\TPT@hookin{NiceTabularX}} \makeatother -\end{Verbatim} +\end{Code} Nevertheless, the use of \pkg{threeparttable} in conjonction with \pkg{nicematrix} seems rather point-less because of the functionalities @@ -4652,9 +4702,9 @@ That key is available in all the environments and commands (e.g. |\NiceMatrixOptions|. \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=9cm] +\begin{Code}[width=9cm] \begin{NiceTabular} - [hvlines,~emphase#rounded-corners@] + [hvlines,\emph{rounded-corners}] {ccc} \CodeBefore \rowcolor{red!15}{1} @@ -4663,7 +4713,7 @@ Last name & First name & Profession \\ Arvy & Jacques & Physicist \\ Jalon & Amandine & Physicist \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{ccc}[hvlines,rounded-corners] \CodeBefore \rowcolor{red!15}{1} @@ -4688,14 +4738,14 @@ rectangle to fade the array (caution: some \textsc{pdf} readers don't support transparency). \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10.6cm] +\begin{Code}[width=10.6cm] \begin{NiceTabular}{ccc}[hvlines,cell-space-limits=3pt] \Block{2-2}{} & & test \\ & & blabla \\ & some text & nothing -~emphase#\CodeAfter \ShowCellNames@ +\emph{\CodeAfter \ShowCellNames} \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{ccc}[hvlines,cell-space-limits=3pt] \Block{2-2}{} & & test \\ & & blabla \\ @@ -4716,15 +4766,15 @@ macro of \pkg{siunitx}. \medskip -\begin{BVerbatim}[baseline = c, boxwidth = 11cm] -$\begin{pNiceArray}{~emphase#S@cW{c}{1cm}c}[nullify-dots,first-row] +\begin{Code}[width = 11cm] +$\begin{pNiceArray}{\emph{S}cW{c}{1cm}c}[nullify-dots,first-row] {C_1} & \Cdots & & C_n \\ 2.3 & 0 & \Cdots & 0 \\ 12.4 & \Vdots & & \Vdots \\ 1.45 \\ 7.2 & 0 & \Cdots & 0 \end{pNiceArray}$ -\end{BVerbatim} +\end{Code} $\begin{pNiceArray}{ScW{c}{1cm}c}[nullify-dots,first-row] {C_1} & \Cdots & & C_n \\ 2.3 & 0 & \Cdots & 0 \\ @@ -4752,12 +4802,12 @@ The keys |l| and |r| are shortcuts for |columns-type=l| and |columns-type=r|. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10cm] -$\begin{bNiceMatrix}[r] +\begin{Code}[width=10cm] +$\begin{bNiceMatrix}\emph{[r]} \cos x & - \sin x \\ \sin x & \cos x \end{bNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{bNiceMatrix}[r] \cos x & - \sin x \\ \sin x & \cos x @@ -4783,9 +4833,9 @@ In the following command, we use that command in the \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=12cm] +\begin{Code}[width=12cm] \NiceMatrixOptions% - {code-for-first-row = \scriptstyle ~emphase#\rotate@ \text{image of }, + {code-for-first-row = \scriptstyle \emph{\rotate} \text{image of }, code-for-last-col = \scriptstyle } $A = \begin{pNiceMatrix}[first-row,last-col=4] e_1 & e_2 & e_3 \\ @@ -4793,7 +4843,7 @@ e_1 & e_2 & e_3 \\ 4 & 5 & 6 & e_2 \\ 7 & 8 & 9 & e_3 \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} \begin{varwidth}{10cm} \NiceMatrixOptions% {code-for-first-row = \scriptstyle\rotate \text{image of }, @@ -4818,9 +4868,9 @@ the corresponding elements are aligned upwards as shown below. \index{last-col|textit} \index{code-for-last-col|textit} -\begin{BVerbatim}[baseline=c,boxwidth=12cm] +\begin{Code}[width=12cm] \NiceMatrixOptions% - {code-for-last-row = \scriptstyle ~emphase#\rotate@ , + {code-for-last-row = \scriptstyle \emph{\rotate} , code-for-last-col = \scriptstyle } $A = \begin{pNiceMatrix}[last-row=4,last-col=4] 1 & 2 & 3 & e_1 \\ @@ -4828,7 +4878,7 @@ $A = \begin{pNiceMatrix}[last-row=4,last-col=4] 7 & 8 & 9 & e_3 \\ \text{image of } e_1 & e_2 & e_3 \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} \begin{varwidth}{10cm} \NiceMatrixOptions% {code-for-last-row = \scriptstyle\rotate , @@ -4864,8 +4914,8 @@ package \pkg{amsmath} (and the environments |{psmallmatrix}|, |{bsmallmatrix}|, etc. of the package \pkg{mathtools}). \bigskip -\begin{Verbatim} -$\begin{bNiceArray}{cccc|c}[~emphase#small@, +\begin{Code} +$\begin{bNiceArray}{cccc|c}[\emph{small}, last-col, code-for-last-col = \scriptscriptstyle, columns-width = 3mm ] @@ -4873,7 +4923,7 @@ $\begin{bNiceArray}{cccc|c}[~emphase#small@, 0 & 3 & 2 & 1 & 2 & L_2 \gets 2 L_1 - L_2 \\ 0 & 1 & 1 & 2 & 3 & L_3 \gets L_1 + L_3 \end{bNiceArray}$ -\end{Verbatim} +\end{Code} % \[\begin{bNiceArray}{cccc|c}[small, last-col, code-for-last-col = \scriptscriptstyle, @@ -4926,18 +4976,18 @@ In the |\CodeBefore| (cf. p. \pageref{code-before}) and in the |\CodeAfter| of columns (except the potential exterior columns). \medskip -\begin{BVerbatim}[baseline=c,boxwidth=10.6cm] -$\begin{pNiceMatrix}% don't forget the % +\begin{Code}[width=10.6cm] +$\begin{pNiceMatrix}% don’t forget the % [first-row, first-col, - code-for-first-row = \mathbf{~emphase#\alph{jCol}@} , - code-for-first-col = \mathbf{~emphase#\arabic{iRow}@} ] + code-for-first-row = \mathbf{\emph{\alph{jCol}}} , + code-for-first-col = \mathbf{\emph{\arabic{iRow}}} ] & & & & \\ & 1 & 2 & 3 & 4 \\ & 5 & 6 & 7 & 8 \\ & 9 & 10 & 11 & 12 \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{pNiceMatrix}[first-row, first-col, code-for-first-row = \mathbf{\alph{jCol}} , @@ -4971,9 +5021,9 @@ number of columns. The second argument is the pattern (it's a list of tokens which are inserted in each cell of the constructed matrix). \medskip -\begin{Verbatim} -$C = ~emphase#\pAutoNiceMatrix@{3-3}{C_{\arabic{iRow},\arabic{jCol}}}$ -\end{Verbatim} +\begin{Code} +$C = \emph{\pAutoNiceMatrix}{3-3}{C_{\arabic{iRow},\arabic{jCol}}}$ +\end{Code} \[C = \pAutoNiceMatrix{3-3}{C_{\arabic{iRow},\arabic{jCol}}}\] @@ -4995,15 +5045,13 @@ between curly braces are considered as a whole. \medskip -\begin{scope} -\begin{BVerbatim}[baseline=c,boxwidth=10cm] -$\begin{bNiceMatrix}[~emphase#light-syntax@,first-row,first-col] +\begin{Code}[width=10cm] +$\begin{bNiceMatrix}[\emph{light-syntax},first-row,first-col] {} a b ; a 2\cos a {\cos a + \cos b} ; b \cos a+\cos b { 2 \cos b } \end{bNiceMatrix}$ -\end{BVerbatim} -\end{scope} +\end{Code} $\begin{bNiceMatrix}[light-syntax,first-row,first-col] {} a b ; a 2\cos a {\cos a + \cos b} ; @@ -5023,6 +5071,12 @@ the whole content of the environment is loaded as a TeX argument to be analyzed. The environment doesn't behave in that case as a standard environment of LaTeX which only put TeX commands before and after the content.} +\medskip +\colorbox{yellow!50}{\textbf{New 6.27}}\enskip The key |light-syntax-expanded| +has the same behaviour as the key |light-syntax| but the body of the +environment is expanded (in the TeX sens) before being splitted in lines (but +after the extraction of a potential |\CodeAfter|). + \subsection{Color of the delimiters} @@ -5036,12 +5090,12 @@ it's possible to change the color of the delimiters with the key |delimiters/color|. \medskip -\begin{BVerbatim}[boxwidth=12cm,baseline=c] +\begin{Code}[width=12cm] $\begin{bNiceMatrix}[delimiters/color=red] 1 & 2 \\ 3 & 4 \end{bNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{bNiceMatrix}[delimiters/color=red] 1 & 2 \\ 3 & 4 @@ -5067,14 +5121,14 @@ It's possible to use |{NiceArrayWithDelims}| if we want to use atypical or asymetrical delimiters. \medskip -\begin{BVerbatim}[baseline=c,boxwidth=11cm] -$\begin{~emphase#NiceArrayWithDelims@} +\begin{Code}[width=11cm] +$\begin{\emph{NiceArrayWithDelims}} {\downarrow}{\uparrow}{ccc}[margin] 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 -\end{~emphase#NiceArrayWithDelims@}$ -\end{BVerbatim} +\end{\emph{NiceArrayWithDelims}}$ +\end{Code} $\begin{NiceArrayWithDelims} {\downarrow}{\uparrow}{ccc}[margin] 1 & 2 & 3 \\ @@ -5095,7 +5149,8 @@ For an example of utilisation, see \url{tex.stackexchange.com/questions/488566} \section{Use of TikZ with nicematrix} -\label{name}\label{PGF-nodes} +\label{name} +\label{PGF-nodes} \index{tikza@TikZ (utilisation with \pkg{nicematrix})} \index{node@\textbf{Nodes of PGF/TikZ}|(} @@ -5155,15 +5210,15 @@ However, one should remind that \pkg{nicematrix} doesn't load TikZ by default. In the following examples, we assume that TikZ has been loaded. \bigskip -\begin{BVerbatim}[baseline=c,boxwidth=11cm] -$\begin{pNiceMatrix}[name=~emphase#mymatrix@] +\begin{Code}[width=11cm] +$\begin{pNiceMatrix}[name=\emph{mymatrix}] 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{pNiceMatrix}$ \tikz[remember picture,overlay] - \draw ~emphase#(mymatrix-2-2)@ circle (2mm) ; -\end{BVerbatim} + \draw \emph{(mymatrix-2-2)} circle (2mm) ; +\end{Code} $\begin{pNiceMatrix}[name=mymatrix] 1 & 2 & 3 \\ 4 & 5 & 6 \\ @@ -5182,15 +5237,15 @@ course the current environment). \medskip -\begin{BVerbatim}[baseline=c,boxwidth=11cm] +\begin{Code}[width=11cm] $\begin{pNiceMatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \CodeAfter - \tikz \draw ~emphase#(2-2)@ circle (2mm) ; + \tikz \draw \emph{(2-2)} circle (2mm) ; \end{pNiceMatrix}$ -\end{BVerbatim} +\end{Code} $\begin{pNiceMatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ @@ -5229,16 +5284,16 @@ Since those nodes are PGF nodes, one won't be surprised to learn that they are drawn by using a specific PGF style. That style is called |nicematrix/cell-node| and its definition in the source file |nicematrix.sty| is as follows: -\begin{Verbatim} +\begin{Code} \pgfset { - ~emphase#nicematrix / cell-node@ /.style = + \emph{nicematrix / cell-node} /.style = { inner sep = 0 pt , minimum width = 0 pt } } -\end{Verbatim} +\end{Code} The final user may modify that style by changing the values of the keys |text/rotate|, |inner xsep|, |inner ysep|, |inner sep|, |outer xsep|, |outer ysep|, |outer sep|, @@ -5528,8 +5583,7 @@ the array itself). Here is an example which uses these nodes in the |\CodeAfter|. \begin{center} -\fvset{commandchars=\~\#\+} -\begin{Verbatim} +\begin{Code} \begin{NiceArray}{c@{\;}c@{\;}c@{\;}c@{\;}c}[create-medium-nodes] u_1 &-& u_0 &=& r \\ u_2 &-& u_1 &=& r \\ @@ -5547,7 +5601,7 @@ Here is an example which uses these nodes in the |\CodeAfter|. (4-1.north west) -- (5-3.south east) (5-1.north west) -- (6-3.south east) ; \end{NiceArray} -\end{Verbatim} +\end{Code} \end{center} \[\begin{NiceArray}{c@{\;}c@{\;}c@{\;}c@{\;}c}[create-medium-nodes] @@ -5607,10 +5661,10 @@ by only \textsc{pgf}, which is a sub-layer of TikZ), we can access, in the syntax |(|$i$\verb+-|+$j$|)|. \medskip -\begin{Verbatim} +\begin{Code} \begin{NiceMatrix} \CodeBefore - ~emphase#\tikz \draw [fill=red!15] (7-|4) |- (8-|5) |- (9-|6) |- cycle ;@ + \emph{\tikz \draw [fill=red!15] (7-|4) |- (8-|5) |- (9-|6) |- cycle ;} \Body 1 \\ 1 & 1 \\ @@ -5622,7 +5676,7 @@ syntax |(|$i$\verb+-|+$j$|)|. 1 & 7 & 21 & 35 & 35 & 21 & 7 & 1 \\ 1 & 8 & 28 & 56 & 70 & 56 & 28 & 8 & 1 \end{NiceMatrix} -\end{Verbatim} +\end{Code} % \[\begin{NiceMatrix} \CodeBefore @@ -5645,15 +5699,15 @@ The nodes of the form $i$|.5| may be used, for example to cross a row of a matrix (if TikZ is loaded). \smallskip -\begin{BVerbatim}[boxwidth=11cm,baseline=c] +\begin{Code}[width=11cm] $\begin{pNiceArray}{ccc|c} 2 & 1 & 3 & 0 \\ 3 & 3 & 1 & 0 \\ 3 & 3 & 1 & 0 \CodeAfter - \tikz \draw [red] (~emphase#3.5@-|1) -- (~emphase#3.5@-|last) ; + \tikz \draw [red] (\emph{3.5}-|1) -- (\emph{3.5}-|last) ; \end{pNiceArray}$ -\end{BVerbatim} +\end{Code} $\begin{pNiceArray}{ccc|c} 2 & 1 & 3 & 0 \\ 3 & 3 & 1 & 0 \\ @@ -5744,9 +5798,8 @@ using the public variable |\g_nicematrix_code_before_tl|. \index{crossbox@\texttt{\textbackslash crossbox} (defined in an example)|textit} -\begin{scope} -\fvset{commandchars=\§\¤\μ} -\begin{Verbatim} + +\begin{Code} \ExplSyntaxOn \cs_new_protected:Nn \__pantigny_crossbox:nnn { @@ -5757,7 +5810,7 @@ using the public variable |\g_nicematrix_code_before_tl|. \NewDocumentCommand \crossbox { ! O { } } { - \tl_gput_right:Nx §emphase¤\g_nicematrix_code_before_tlμ + \tl_gput_right:Nx \emph{\g_nicematrix_code_before_tl} { \__pantigny_crossbox:nnn { \int_use:c { c@iRow } } @@ -5766,8 +5819,8 @@ using the public variable |\g_nicematrix_code_before_tl|. } } \ExplSyntaxOff -\end{Verbatim} -\end{scope} +\end{Code} + \ExplSyntaxOn @@ -5795,16 +5848,16 @@ using the public variable |\g_nicematrix_code_before_tl|. Here is an example of utilisation: \medskip -\begin{BVerbatim}[baseline=c,boxwidth=9cm] +\begin{Code}[width=9cm] \begin{NiceTabular}{ccc}[hvlines] \CodeBefore \arraycolor{gray!10} \Body merlan & requin & cabillaud \\ -baleine & ~emphase#\crossbox[red]@ & morue \\ +baleine & \emph{\crossbox[red]} & morue \\ mante & raie & poule \end{NiceTabular} -\end{BVerbatim} +\end{Code} \begin{NiceTabular}{ccc}[hvlines] \CodeBefore \arraycolor{gray!10} @@ -5837,20 +5890,19 @@ of the instructions |\Ddots| in the array can have a marked effect on the final result. \medskip -In the following examples, the first |\Ddots| instruction is written in color: +In the following examples, the first |\Ddots| instruction is written in color. -% \medskip \begin{scope} \begin{minipage}{9.5cm} Example with parallelization (default): -\begin{Verbatim} +\begin{Code} $A = \begin{pNiceMatrix} 1 & \Cdots & & 1 \\ -a+b & ~emphase#\Ddots@~ & & \Vdots \\ +a+b & \emph{\Ddots} & & \Vdots \\ \Vdots & \Ddots & & \\ a+b & \Cdots & a+b & 1 \end{pNiceMatrix}$ -\end{Verbatim} +\end{Code} \end{minipage} $A = \begin{pNiceMatrix} 1 & \Cdots & & 1 \\ @@ -5862,14 +5914,14 @@ a+b & \Cdots & a+b & 1 \bigskip \NiceMatrixOptions{parallelize-diags=true}% \begin{minipage}{9.5cm} -\begin{Verbatim} +\begin{Code} $A = \begin{pNiceMatrix} 1 & \Cdots & & 1 \\ a+b & & & \Vdots \\ -\Vdots & ~emphase#\Ddots@~ & \Ddots & \\ +\Vdots & \emph{\Ddots} & \Ddots & \\ a+b & \Cdots & a+b & 1 \end{pNiceMatrix}$ -\end{Verbatim} +\end{Code} \end{minipage} $A = \begin{pNiceMatrix} 1 & \Cdots & & 1 \\ @@ -6010,7 +6062,7 @@ However, it seems that this is no longer mandatory with the recent versions of \bigskip The package \pkg{nicematrix} is not fully compatible with the packages and classes -of \LuaTeX-ja: the detection of the empty corners (cf. % p.~\pageref{corners}) +of LuaTeX-ja: the detection of the empty corners (cf. p.~\pageref{corners}) may be wrong in some circonstances. \bigskip @@ -6028,8 +6080,8 @@ the colums |S| of \pkg{siunitx}). \section{Examples} -\subsection[{Utilisation of the key 'TikZ' of the command \textbackslash -Block}]{Utilisation of the key ``TikZ'' of the command \textbackslash Block} +\subsection[{Utilisation of the key 'tikz' of the command \textbackslash +Block}]{Utilisation of the key ``tikz'' of the command \textbackslash Block} \label{tikz-key-examples} \index{tikzz@tikz!key of \texttt{\textbackslash Block}|textit} @@ -6045,21 +6097,21 @@ For the following example, we also need the TikZ library |patterns|. \end{Verbatim} -\begin{Verbatim} +\begin{Code} \ttfamily \small \begin{NiceTabular}{X[m]X[m]X[m]}[hvlines,cell-space-limits=3pt,rounded-corners] - \Block[~emphase#tikz={pattern=grid,pattern color=lightgray}@]{} + \Block[\emph{tikz={pattern=grid,pattern color=lightgray}}]{} {pattern = grid,\\ pattern color = lightgray} -& \Block[~emphase#tikz={pattern = north west lines,pattern color=blue}@]{} +& \Block[\emph{tikz={pattern = north west lines,pattern color=blue}}]{} {pattern = north west lines,\\ pattern color = blue} -& \Block[~emphase#tikz={outer color = red!50, inner color=white }@]{2-1} +& \Block[\emph{tikz={outer color = red!50, inner color=white }}]{2-1} {outer color = red!50,\\ inner color = white} \\ - \Block[~emphase#tikz={pattern = sixpointed stars, pattern color = blue!15}@]{} + \Block[\emph{tikz={pattern = sixpointed stars, pattern color = blue!15}}]{} {pattern = sixpointed stars,\\ pattern color = blue!15} -& \Block[~emphase#tikz={left color = blue!50}@]{} +& \Block[\emph{tikz={left color = blue!50}}]{} {left color = blue!50} \\ \end{NiceTabular} -\end{Verbatim} +\end{Code} \begin{center} \ttfamily \small @@ -6089,16 +6141,17 @@ p.~\pageref{rules}} \texttt{\textbackslash CodeBefore}|textit} -\begin{Verbatim} +\begin{Code} \begin{NiceTabular}{ccc}[hvlines] \CodeBefore \columncolor[RGB]{169,208,142}{2} \Body one & two & three \\ -\Block[~emphase#transparent, tikz={pattern = north west lines, pattern color = gray}@]{1-*}{} +\Block[\emph{transparent, tikz={pattern = north west lines, pattern color = gray}}]{1-*}{} four & five & six \\ seven & eight & nine -\end{Verbatim} +\end{NiceTabular} +\end{Code} \begin{center} \begin{NiceTabular}{ccc}[hvlines] @@ -6122,7 +6175,7 @@ Here is an example of use of |{NiceTabular}| within a command |\tcbox| of the rules except on the borders (which are, of course, added by \pkg{tcolorbox}) \medskip -\begin{BVerbatim} +\begin{Code} \tcbset { colframe = blue!50!black , @@ -6145,7 +6198,7 @@ the rules except on the borders (which are, of course, added by \pkg{tcolorbox}) ] { \renewcommand{\arraystretch}{1.2}% <-- the % is mandatory here - \begin{NiceTabular}{rcl}[~emphase#hvlines-except-borders@,rules/color=blue!50!black] + \begin{NiceTabular}{rcl}[\emph{hvlines-except-borders},rules/color=blue!50!black] \CodeBefore \rowcolor{red!15}{1} \Body @@ -6154,7 +6207,7 @@ the rules except on the borders (which are, of course, added by \pkg{tcolorbox}) Upper & Middle & Lower \end{NiceTabular} } -\end{BVerbatim} +\end{Code} \index{hvlines-except-borders|textit} @@ -6220,12 +6273,12 @@ the tabular.} First, we write a command |\stars| similar the well-known commands |\arabic|, |\alph|, |\Alph|, etc. which produces a number of stars equal to its argument\footnote{In fact: the value of its argument.}. -\begin{Verbatim} +\begin{Code} \ExplSyntaxOn -\NewDocumentCommand ~emphase#\stars@ { m } - { \prg_replicate:nn { \value { ~#1 } } { $ \star $ } } +\NewDocumentCommand { \emph{\stars} } { m } + { \prg_replicate:nn { \value { #1 } } { $ \star $ } } \ExplSyntaxOff -\end{Verbatim} +\end{Code} % Of course, we change the style of the labels with the key |notes/style|. However, it would be interesting to change also some parameters in the type of @@ -6239,20 +6292,21 @@ number of stars. We know that number: it is equal to |\value{tabularnote}| therefore, at the end of the tabular, its value is equal to the total number of tabular notes). We use the key |widest*| of \pkg{enumitem} in order to require a width equal to that value: |widest*=\value{tabularnote}|. -\begin{Verbatim} + +\begin{Code} \NiceMatrixOptions { notes = { - ~emphase#style = \stars{~#1} , @ - ~emphase#enumitem-keys = @ - ~emphase# { @ - ~emphase# widest* = \value{tabularnote} ,@ - ~emphase# align = right @ - ~emphase# } @ + \emph{style = \stars{#1} , + enumitem-keys = + { + widest* = \value{tabularnote} , + align = right + } } } } -\end{Verbatim} +\end{Code} @@ -6273,20 +6327,20 @@ require a width equal to that value: |widest*=\value{tabularnote}|. } } \ExplSyntaxOff -\begin{Verbatim} -\begin{NiceTabular}{~@{}llr~@{}} +\begin{Code} +\begin{NiceTabular}{@{}llr@{}} \toprule \RowStyle{\bfseries} Last name & First name & Birth day \\ \midrule -Achard\tabularnote{~emphase#Achard is an old family of the Poitou.@} +Achard\tabularnote{\emph{Achard is an old family of the Poitou.}} & Jacques & 5 juin 1962 \\ -Lefebvre\tabularnote{~emphase#The name Lefebvre is an alteration of the name Lefebure.@} +Lefebvre\tabularnote{\emph{The name Lefebvre is an alteration of the name Lefebure.}} & Mathilde & 23 mai 1988 \\ Vanesse & Stephany & 30 octobre 1994 \\ Dupont & Chantal & 15 janvier 1998 \\ \bottomrule \end{NiceTabular} -\end{Verbatim} +\end{Code} \begin{center} \begin{NiceTabular}{@{}llr@{}} @@ -6497,19 +6551,19 @@ In the following example, we use the command |\Block| to draw dashed rules. For that example, TikZ should be loaded (by |\usepackage{tikz}|). -\begin{Verbatim} +\begin{Code} \begin{pNiceMatrix} -~emphase#\Block[borders={bottom,right,tikz=dashed}]{2-2}{}@ +\emph{\Block[borders={bottom,right,tikz=dashed}]{2-2}{}} 1 & 2 & 0 & 0 & 0 & 0 \\ 4 & 5 & 0 & 0 & 0 & 0 \\ -0 & 0 & ~emphase#\Block[borders={bottom,top,right,left,tikz=dashed}]{2-2}{}@ +0 & 0 & \emph{\Block[borders={bottom,top,right,left,tikz=dashed}]{2-2}{}} 7 & 1 & 0 & 0 \\ 0 & 0 & -1 & 2 & 0 & 0 \\ -0 & 0 & 0 & 0 & ~emphase#\Block[borders={left,top,tikz=dashed}]{2-2}{}@ +0 & 0 & 0 & 0 & \emph{\Block[borders={left,top,tikz=dashed}]{2-2}{}} 3 & 4 \\ 0 & 0 & 0 & 0 & 1 & 4 \end{pNiceMatrix} -\end{Verbatim} +\end{Code} \[\begin{pNiceMatrix} @@ -6537,9 +6591,9 @@ In order to have the columns aligned one above the other, it's possible to fix a width for all the columns. That's what is done in the following example with the environment |{NiceMatrixBlock}| and its option |auto-columns-width|. -\begin{Verbatim}[formatcom=\small\color{gray}] -\begin{Verbatim}[formatcom=\small\color{gray}] -~emphase#\begin{NiceMatrixBlock}[auto-columns-width]@ +\begin{small} +\begin{Code} +\emph{\begin{NiceMatrixBlock}[auto-columns-width]} \NiceMatrixOptions { light-syntax, @@ -6577,8 +6631,9 @@ with the environment |{NiceMatrixBlock}| and its option |auto-columns-width|. 12 -8 7 5 3 {} ; 0 64 -41 1 19 ; \end{pNiceMatrix}$ -~emphase#\end{NiceMatrixBlock}@ -\end{Verbatim} +\emph{\end{NiceMatrixBlock}} +\end{Code} +\end{small} \medskip \index{auto-columns-width!(clé de \texttt{\{NiceMatrixBlock\}})|textit} @@ -6634,11 +6689,12 @@ In order the solve that problem, it's possible to require the delimiters to be composed with the maximal width, thanks to the boolean key |delimiters/max-width|. -\begin{Verbatim}[formatcom=\small\color{gray}] -~emphase#\begin{NiceMatrixBlock}[auto-columns-width]@ +\begin{small} +\begin{Code} +\emph{\begin{NiceMatrixBlock}[auto-columns-width]} \NiceMatrixOptions { - ~emphase#delimiters/max-width@, + \emph{delimiters/max-width}, light-syntax, last-col, code-for-last-col = \color{blue}\scriptstyle, vlines = 5 , @@ -6654,8 +6710,9 @@ composed with the maximal width, thanks to the boolean key 9 10 -5 4 7 \end{pNiceMatrix}$ ... -~emphase#\end{NiceMatrixBlock}@ -\end{Verbatim} +\emph{\end{NiceMatrixBlock}} +\end{Code} +\end{small} \medskip \begin{NiceMatrixBlock}[auto-columns-width] @@ -6711,7 +6768,7 @@ array can't be broken by a page break. \texttt{\textbackslash CodeAfter}\newline and \texttt{\textbackslash CodeBefore})|textit} -\begin{Verbatim} +\begin{Code} \setlength{\extrarowheight}{1mm} \[\begin{NiceMatrix}[ r, last-col=6, code-for-last-col = \scriptstyle \color{blue} ] 12 & -8 & 7 & 5 & 3 \\ @@ -6727,13 +6784,13 @@ array can't be broken by a page break. 0 & 0 &0 &0 & 0 & L_3 \gets 3L_2+L_3 \\[1mm] 12 & -8 &7 &5 & 3 \\ 0 & 64 &-41 & 1 & 19 \\ -~emphase#\CodeAfter [sub-matrix/vlines=4]@ -~emphase# \SubMatrix({1-1}{4-5})@ -~emphase# \SubMatrix({5-1}{8-5})@ -~emphase# \SubMatrix({9-1}{11-5})@ -~emphase# \SubMatrix({12-1}{13-5})@ +\emph{\CodeAfter [sub-matrix/vlines=4] + \SubMatrix({1-1}{4-5}) + \SubMatrix({5-1}{8-5}) + \SubMatrix({9-1}{11-5}) + \SubMatrix({12-1}{13-5})} \end{NiceMatrix}\] -\end{Verbatim} +\end{Code} \medskip \begin{scope} @@ -6773,11 +6830,11 @@ drawn in the |\SubMatrix| only (by adding space between the columns). \index{vlines-in-sub-matrix} \medskip -\begin{Verbatim} +\begin{Code} \setlength{\extrarowheight}{1mm} \[\begin{NiceArray} [ - ~emphase#vlines-in-sub-matrix=I@, + \emph{vlines-in-sub-matrix=I}, last-col, code-for-last-col = \scriptstyle \color{blue} ] @@ -6801,7 +6858,7 @@ drawn in the |\SubMatrix| only (by adding space between the columns). \SubMatrix({9-1}{11-5}) \SubMatrix({12-1}{13-5}) \end{NiceArray}\] -\end{Verbatim} +\end{Code} \medskip @@ -6854,14 +6911,14 @@ the command |\Block| is left empty, that means that the block is a mono-cell blo \label{example-CodeAfter} -\begin{Verbatim} +\begin{Code} $\begin{pNiceArray}{>{\strut}cccc}[margin,rules/color=blue] -~emphase#\Block[draw]{}{a_{11}}@ & a_{12} & a_{13} & a_{14} \\ +\emph{\Block[draw]{}{a_{11}}} & a_{12} & a_{13} & a_{14} \\ a_{21} & \Block[draw]{}{a_{22}} & a_{23} & a_{24} \\ a_{31} & a_{32} & \Block[draw]{}{a_{33}} & a_{34} \\ a_{41} & a_{42} & a_{43} & \Block[draw]{}{a_{44}} \\ \end{pNiceArray}$ -\end{Verbatim} +\end{Code} \[\begin{pNiceArray}{>{\strut}cccc}[margin,rules/color=blue] \Block[draw]{}{a_{11}} & a_{12} & a_{13} & a_{14} \\ a_{21} & \Block[draw]{}{a_{22}} & a_{23} & a_{24} \\ @@ -6887,16 +6944,14 @@ used−even when \pkg{colortbl} is not loaded). \medskip -\begin{Verbatim} +\begin{Code} \begin{pNiceArray}{>{\strut}cccc}[margin, extra-margin=2pt,color-inside] - ~emphase#\rowcolor{red!15}@A_{11} & A_{12} & A_{13} & A_{14} \\ - A_{21} & ~emphase#\rowcolor{red!15}@A_{22} & A_{23} & A_{24} \\ - A_{31} & A_{32} & ~emphase#\rowcolor{red!15}@A_{33} & A_{34} \\ - A_{41} & A_{42} & A_{43} & ~emphase#\rowcolor{red!15}@A_{44} + \emph{\rowcolor{red!15}}A_{11} & A_{12} & A_{13} & A_{14} \\ + A_{21} & \emph{\rowcolor{red!15}}A_{22} & A_{23} & A_{24} \\ + A_{31} & A_{32} & \emph{\rowcolor{red!15}}A_{33} & A_{34} \\ + A_{41} & A_{42} & A_{43} & \emph{\rowcolor{red!15}}A_{44} \end{pNiceArray} -\end{Verbatim} - - +\end{Code} \[\begin{pNiceArray}{>{\strut}cccc}[margin, extra-margin=2pt,color-inside] \rowcolor{red!15}A_{11} & A_{12} & A_{13} & A_{14} \\ @@ -6932,22 +6987,22 @@ their creation with the key |create-cell-nodes| of the keyword |\CodeBefore|. \medskip \index{highlight (TikZ style defined in\newline an example)|textit} -\begin{Verbatim} +\begin{Code} \tikzset{highlight/.style={rectangle, fill=red!15, rounded corners = 0.5 mm, inner sep=1pt, - fit=~#1}} + fit=#1}} $\begin{bNiceMatrix} -~emphase#\CodeBefore [create-cell-nodes] @ -~emphase# \tikz \node [highlight = (2-1) (2-3)] {} ; @ -~emphase# \Body @ +\emph{\CodeBefore [create-cell-nodes] + \tikz \node [highlight = (2-1) (2-3)] {} ; +\Body} 0 & \Cdots & 0 \\ 1 & \Cdots & 1 \\ 0 & \Cdots & 0 \\ \end{bNiceMatrix}$ -\end{Verbatim} +\end{Code} \index{create-cell-nodes (key of \texttt{\textbackslash CodeBefore})|textit} \index{CodeBefore@\texttt{\textbackslash CodeBefore}...\texttt{\textbackslash Body}|textit} @@ -6965,20 +7020,20 @@ $\begin{bNiceMatrix} We consider now the following matrix. If we want to highlight each row of this matrix, we can use the previous technique three times. -\begin{Verbatim} -\[\begin{pNiceArray}{ccc}[last-col, margin = 2pt] +\begin{Code} +\begin{pNiceArray}{ccc}[last-col, margin = 2pt] \CodeBefore [create-cell-nodes] \begin{tikzpicture} -~emphase# \node [highlight = (1-1) (1-3)] {} ;@ -~emphase# \node [highlight = (2-1) (2-3)] {} ;@ -~emphase# \node [highlight = (3-1) (3-3)] {} ;@ + \emph{\node [highlight = (1-1) (1-3)] {} ; + \node [highlight = (2-1) (2-3)] {} ; + \node [highlight = (3-1) (3-3)] {} ;} \end{tikzpicture} \Body a & a + b & a + b + c & L_1 \\ a & a & a + b & L_2 \\ a & a & a & L_3 -\end{pNiceArray}\] -\end{Verbatim} +\end{pNiceArray} +\end{Code} \[\begin{pNiceArray}{ccc}[last-col, margin = 2pt] @@ -7002,10 +7057,10 @@ nodes'' instead of the ``normal nodes''. \index{create-cell-nodes (key of \texttt{\textbackslash CodeBefore})|textit} -\begin{Verbatim} +\begin{Code} \[\begin{pNiceArray}{ccc}[last-col, margin = 2pt, create-medium-nodes] \CodeBefore [create-cell-nodes] - \begin{tikzpicture} ~emphase#[name suffix = -medium]@ + \begin{tikzpicture} \emph{[name suffix = -medium]} \node [highlight = (1-1) (1-3)] {} ; \node [highlight = (2-1) (2-3)] {} ; \node [highlight = (3-1) (3-3)] {} ; @@ -7015,7 +7070,7 @@ a & a + b & a + b + c & L_1 \\ a & a & a + b & L_2 \\ a & a & a & L_3 \end{pNiceArray}\] -\end{Verbatim} +\end{Code} \[\begin{pNiceArray}{ccc}[last-col, margin = 2pt, create-medium-nodes] @@ -7093,8 +7148,9 @@ parenthesis have been added with |\SubMatrix| in the |\CodeBefore|. fit=~#1}} \end{Verbatim} -\begin{Verbatim}[formatcom = \small\color{gray}] -\[\begin{NiceArray}{*{6}{c}~LetterAt{\hspace{6mm}}*{5}{c}}[nullify-dots] +\begin{small} +\begin{Code} +\[\begin{NiceArray}{*{6}{c}@{\hspace{6mm}}*{5}{c}}[nullify-dots] \CodeBefore [create-cell-nodes] \SubMatrix({2-7}{6-last}) \SubMatrix({7-2}{last-6}) @@ -7119,7 +7175,8 @@ parenthesis have been added with |\SubMatrix| in the |\CodeBefore|. \CodeAfter \tikz \draw [gray,shorten > = 1mm, shorten < = 1mm] (9-4.north) to [bend left] (4-9.west) ; \end{NiceArray}\] -\end{Verbatim} +\end{Code} +\end{small} @@ -7140,16 +7197,16 @@ package, which must be loaded previously). \medskip -\begin{Verbatim} +\begin{Code} \pgfset { - ~emphase#nicematrix/cell-node@/.append style = + \emph{nicematrix/cell-node}/.append style = { text/rotate = 45, minimum size = 6 mm } } \setlength{\tabcolsep}{0pt} -~emphase#\adjustbox@{rotate = -45, set depth = 6mm + 1.414 \arrayrulewidth} +\emph{\adjustbox}{rotate = -45, set depth = 6mm + 1.414 \arrayrulewidth} {\begin{NiceTabular} [ hvlines, corners=SE, baseline = line-9 ] { cccccccc } \CodeBefore \chessboardcolors{red!15}{blue!15} @@ -7163,7 +7220,7 @@ package, which must be loaded previously). 1 & 7 \\ 1 \end{NiceTabular}} -\end{Verbatim} +\end{Code} \begin{center} @@ -7205,6 +7262,10 @@ The successive versions of the file |nicematrix.sty| provided by TeXLive are ava \subsection*{Changes between version 6.25 and 6.26} +New key |light-syntax-expanded|. + +\subsection*{Changes between version 6.25 and 6.26} + Special color |nocolor|. \subsection*{Changes between version 6.24 and 6.25} -- cgit v1.2.3