summaryrefslogtreecommitdiff
path: root/macros/latex/contrib
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2024-02-14 03:01:19 +0000
committerNorbert Preining <norbert@preining.info>2024-02-14 03:01:19 +0000
commita90336c3069c198b41b7b6eb76e3389610ad5eb7 (patch)
tree1d39210ab0b0caece02b2322e3fd773db8385982 /macros/latex/contrib
parentff59efb1f42e705d74a6d50a1f8dbd7988ccf380 (diff)
CTAN sync 202402140301
Diffstat (limited to 'macros/latex/contrib')
-rw-r--r--macros/latex/contrib/exesheet/README.md6
-rw-r--r--macros/latex/contrib/exesheet/exesheet.dtx124
-rw-r--r--macros/latex/contrib/exesheet/exesheet.pdfbin334627 -> 342355 bytes
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix-code.dtx47
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix-code.pdfbin968305 -> 2326087 bytes
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix-french.pdfbin597386 -> 911886 bytes
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix-french.tex1215
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix.pdfbin612085 -> 941616 bytes
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix.tex1147
-rw-r--r--macros/latex/contrib/spbmark/spbmark.pdfbin89117 -> 93819 bytes
-rw-r--r--macros/latex/contrib/spbmark/spbmark.sty63
-rw-r--r--macros/latex/contrib/spbmark/spbmark.tex50
-rw-r--r--macros/latex/contrib/verse/verse.dtx8
-rw-r--r--macros/latex/contrib/verse/verse.pdfbin423239 -> 469138 bytes
-rw-r--r--macros/latex/contrib/xfrac/CHANGELOG.md19
-rw-r--r--macros/latex/contrib/xfrac/README.md29
-rw-r--r--macros/latex/contrib/xfrac/xfrac.dtx1146
-rw-r--r--macros/latex/contrib/xfrac/xfrac.ins49
-rw-r--r--macros/latex/contrib/xfrac/xfrac.pdfbin0 -> 658541 bytes
19 files changed, 2712 insertions, 1191 deletions
diff --git a/macros/latex/contrib/exesheet/README.md b/macros/latex/contrib/exesheet/README.md
index 1c56562c44..cd802580ef 100644
--- a/macros/latex/contrib/exesheet/README.md
+++ b/macros/latex/contrib/exesheet/README.md
@@ -8,15 +8,15 @@ The primary advantage of exesheet is its ability to display
a detailed scoring guide and correction instructions as needed.
This feature is especially beneficial for grading papers with multiple graders.
-Additionally, the exesheet class loads the schooldocs package
-which manages the page layout, the main title, headers and footers.
-
The exesheet package offers the following features:
- macros for organizing exercises and subparts,
- specific settings for enumeration lists,
- environments for questions and answers, which can be displayed or hidden,
- macros for detailed comments and grading instructions in the margins which can be displayed or hidden.
+Additionally, the exesheet class loads the schooldocs package
+which manages the page layout, the main title, headers and footers.
+
## Installation
diff --git a/macros/latex/contrib/exesheet/exesheet.dtx b/macros/latex/contrib/exesheet/exesheet.dtx
index 02a8f5e68c..d3c92b9ef3 100644
--- a/macros/latex/contrib/exesheet/exesheet.dtx
+++ b/macros/latex/contrib/exesheet/exesheet.dtx
@@ -23,7 +23,7 @@
%<class>\ProvidesClass{exesheet}
%<package>\ProvidesPackage{exesheet}
%<*class|package>
-[2024/02/03 v2.6 .dtx Typesetting exercise or exam sheets]
+[2024/02/13 v2.7 .dtx Typesetting exercise or exam sheets]
%</class|package>
%<*driver>
\documentclass{ltxdoc}
@@ -85,7 +85,7 @@
%</driver>
% \fi
%
-% \CheckSum{1192}
+% \CheckSum{1206}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -178,6 +178,12 @@
% - error message when using colsenum or colsitem without loading multicol
% - changes in the comparison with other packages}
%
+% \changes{v2.7}{2024/02/13}{
+% - an expl3 update prevents the correction color in tasks environment -> fixed
+% - new command enumfont
+% - babel-french option 'StandardLists=true' works now if french is passed in documentclass
+% - completion of the comparison with other packages}
+%
% \GetFileInfo{exesheet.dtx}
%
% \maketitle
@@ -318,6 +324,7 @@
% \subpart
% Now you are ready to proceed with the current exercise.
%
+% \bigskip
% \pagebreak
% The following macros allow customization in the same manner as for |\exercise|.
%
@@ -545,12 +552,16 @@
% (for \texttt{tablenum1}) and |\labelenuma| (for \texttt{tablenuma}),
% using the \texttt{task} counter:
% \eg |\renewcommand\labelenuma{\Alph{task}.}| yields the labels
-% \textbf{A.}, \textbf{B.}, \ldots
+% \textbf{A.}, \textbf{B.}, etc.
%
% \smallskip
+% \DescribeMacro{\enumfont}
+% With the default option \texttt{setlist=true},
+% the font of all enumeration labels may be changed by redefining |\enumfont|
+% (|\bfseries| by default).
% If the \textsf{exesheet} package is invoked with the option \texttt{setlist=false},
% labels within \texttt{tablenum1} and \texttt{tablenuma} environments
-% will be presented with indentation and in normal font rather than bold.
+% will be presented with indentation, and in normal font rather than bold.
% You can change the label formatting globally with the command |\settask|, \eg
% |\settask{label-format=\itshape}|.
% You can also completely redefine the environments using |\RenewTasksEnvironment|.
@@ -562,17 +573,12 @@
% immediately after inserting the |\item| command
% within an \texttt{enumerate} environment,
% a vertical misplacement may occur.
-% ^^A as demonstrated in the following example:
-% ^^A \begin{enumerate}
-% ^^A \item
-% ^^A \begin{tablenuma}(3) \item One \item Two \item Three \end{tablenuma}
-% ^^A \end{enumerate}
% To achieve proper vertical spacing in such cases, we offer
% the starred environments \texttt{tablenuma*} and \texttt{tablitem*},
% with corrected alignment as shown below:
%
% \noindent\psframe(-0.25,0.05)(12.75,-0.97)
-% \psline[linewidth=0.1pt,linecolor=green,linestyle=dashed](0, -0.63)(10.5, -0.63)
+% \psline[linewidth=0.1pt,linecolor=green,linestyle=dashed](0, -0.6)(10.5, -0.6)
% \begin{enumerate}
% \item
% \begin{tablenuma*}(3) \item One \item Two \item Three \end{tablenuma*}
@@ -1294,39 +1300,40 @@
% \item \textsf{esami}, Grazia Messineo, Salvatore Vassallo~\cite{ESAMI}
% \item \textsf{randexam}, Jianrui Lyu~\cite{RAND}
% \item \textsf{hideanswer}, Yukoh Kusakabe~\cite{HIDE}
-% ^^A\item \textsf{mathexam}, Jan Hlavacek~\cite{MATH}
+% \item \textsf{mathexam}, Jan Hlavacek~\cite{MATH}
% \item \textsf{exesheet}, Antoine Missier
% \end{enumerate}
% \end{flushleft}
% \end{multicols}
%
% \newcommand\X{\ding{56}}
-% \setlength{\extrarowheight}{2pt}
-% \noindent\begin{tabular}{@{\hspace{1.8pt}}l@{\hspace{2pt}}|%
-% *{17}{@{\hspace{1.8pt}}c@{\hspace{1.8pt}}|}}
+% \setlength{\extrarowheight}{2pt}\noindent
+% {\small
+% \begin{tabular}{@{\hspace{2pt}}l@{\hspace{5pt}}|%
+% *{18}{@{\hspace{1.8pt}}c@{\hspace{2pt}}|}}
% \hline
-% Functionality &A&B&C&D&E&F&G&H&I&J&K&L&M&N&O&P&Q \\
+% Functionality &A&B&C&D&E&F&G&H&I&J&K&L&M&N&O&P&Q&R \\
% \hline
-% Optional text for exercise titles &\X&&\X&\X&\X&&&&\X&&&&\X&&&&\X \\
-% Subparts of exercises &\X&&&\X&\X&&&&\X&&\X&\X&\X&\X&\X&&\X \\
-% Annex title or appendix &&&&&&&&&&&&&&&\X&&\X \\
-% Exercise titles in TOC of PDF files &\X&&&&&&&&&&&&&&&&\X \\
-% Short labels for exercises &\X&&\X&\X&&&&&&&&&&&&&\X \\
-% Hiding questions or answers* &\X&*&\X&\X&*&\X&\X&\X&&&*&\X&&\X&*&*&\X \\
-% Different placements for answers &\X&&&&&&&&&&\X&\X&&&&&\X \\
-% Change answers placement in output &\X&&&\X&&\X&&\X&&&&\X&&&&& \\
-% Blank spacing in place of answers &&\X&\X&&\X&&&&&&&\X&&\X&\X&&\X \\
-% Marking scheme commands &&\X&\X&\X&\X&&&&\X&\X&\X&\X&&\X&\X&&\X \\
-% Various positions of points &&&&\X&\X&&&&&&&\X&&\X&&&\X \\
-% Marking scheme calculation/checking &&\X&\X&\X&\X&&&&\X&&\X&\X&&&\X&&\X \\
-% Detailed notes for scoring guide &&&&&&&&&&&&&&&&&\X \\
+% Optional text for exercise titles &\X&&\X&\X&\X&&&&\X&&&&\X&&&&&\X \\
+% Subparts of exercises &\X&&&\X&\X&&&&\X&&\X&\X&\X&\X&\X&&&\X \\
+% Annex title or appendix &&&&&&&&&&&&&&&\X&&&\X \\
+% Exercise titles in TOC of PDF files &\X&&&&&&&&&&&&&&&&&\X \\
+% Short labels for exercises &\X&&\X&\X&&&&&&&&&&&&&&\X \\
+% Hiding questions or answers* &\X&*&\X&\X&*&\X&\X&\X&&&*&\X&&\X&*&*&&\X \\
+% Different placements for answers &\X&&&&&&&&&&\X&\X&&&&&&\X \\
+% Change answers placement in output &\X&&&\X&&\X&&\X&&&&\X&&&&&& \\
+% Blank spacing in place of answers &&\X&\X&&\X&&&&&&&\X&&\X&\X&&\X&\X \\
+% Marking scheme commands &&\X&\X&\X&\X&&&&\X&\X&\X&\X&&\X&\X&&&\X \\
+% Various positions of points &&&&\X&\X&&&&&&&\X&&\X&&&&\X \\
+% Marking scheme calculation/checking &&\X&\X&\X&\X&&&&\X&&\X&\X&&&\X&&&\X \\
+% Detailed notes for scoring guide &&&&&&&&&&&&&&&&&&\X \\
% \hline
% \end{tabular}
+% }
% \medskip
%
% \StopEventually{}
%
-% \pagebreak
% \section{Implementation}
%
% \subsection{Options and required packages}
@@ -1468,8 +1475,8 @@
\renewcommand{\noteragged}{#1}
}
\newcommand*{\displaynotesright}[1][\RaggedRight]{%
- \PackageWarning{exesheet}{Old command \string\displaynotesright\space
- is used. \MessageBreak
+ \PackageWarning{exesheet}{Old command \string\displaynotesright
+ \space is used. \MessageBreak
It can be replaced by the options `display=notes, margin=right'}
\renewcommand\exesheet@display{notes}
\exs@process@display
@@ -1709,8 +1716,10 @@
% (|\setenumerate| is deprecated). By default, |itemsep=1ex| is set for first-level lists,
% and |leftmargin=1.5em| is used to align labels with the start of lines.
% \begin{macrocode}
+\newcommand\enumfont{\bfseries}
+
\newenvironment{exenumerate}[1][]{%
- \setlist[enumerate]{font=\bfseries}
+ \setlist[enumerate]{font=\enumfont}
\setlist[enumerate,1]{leftmargin=1.5em,
itemsep=3ex plus 1ex minus 1ex,topsep=3ex plus 1ex minus 1ex}
\setlist[enumerate,3]{noitemsep,nolistsep}
@@ -1720,49 +1729,46 @@
% \end{macrocode}
% \end{macro}
-% When using the \textsf{babel} package with the \texttt{french} option,
+% When using the \textsf{babel-french} package,
% \texttt{itemize} lists are altered to use the same dash label for each list level.
% These modifications are undone here to revert to the default
% \LaTeX\ \texttt{itemize} lists, including labels and spaces.
-% We have created the |\standardfrenchlists| command, which should be invoked within the
-% |\AtBeginDocument| command or immediately, depending on whether
+% This setting is done by the |\frenchsetup| command, which should be invoked within
+% the |\AtBeginDocument| command or immediately, depending on whether
% \textsf{exesheet} is loaded before or after \textsf{babel}.
% \begin{macrocode}
-\newcommand\standardfrenchlists{%
- \@ifpackagewith{babel}{french}{
- \frenchsetup{StandardLists=true}
- }{}
-}
\ifexesheet@setlist
- \standardfrenchlists
+ \@ifundefined{frenchsetup}{}{\frenchsetup{StandardLists=true}}
% must be executed here (and not at begin doc) if loaded after babel
\fi
\newcommand\labelenumone{\arabic{task}.}
\newcommand\labelenuma{(\alph{task})}
+\newcommand\refenuma{\alph{task}}
\def\exs@process@setlist{% must be executed at begin document
\ifexesheet@setlist
- \standardfrenchlists % executed at begin doc if loaded before babel
- \setlist[enumerate]{font=\bfseries}
+ \@ifundefined{frenchsetup}{}{\frenchsetup{StandardLists=true}}
+ % executed at begin doc if loaded before babel
+ \setlist[enumerate]{font=\enumfont}
\setlist[enumerate,1]{topsep=1.5ex plus 1ex minus 1ex,leftmargin=1.5em}
\fi
% \end{macrocode}
% \DescribeEnv{tablenum1} \DescribeEnv{tablenuma}
-% The |\NewTasks| command is part of the \textsf{tasks} package~\cite{TASK}.
+% The |\NewTasksEnvironment| command is part of the \textsf{tasks} package~\cite{TASK}.
% It enables the definition of the environments \texttt{tablenum1},
% \texttt{tablenuma} and \texttt{tablitem}.
% Horizontal spacing is adjusted to ensure proper alignment with
% items in other \texttt{enumerate} (or \texttt{itemize}) environments.
% \begin{macrocode}
\ifexesheet@setlist
- \settasks{label-format=\bfseries}
+ \settasks{label-format=\enumfont}
\NewTasksEnvironment[label=\labelenumone,
column-sep=1em,label-align=right,
item-indent=1.5em,label-width=1em,label-offset=0.5em,
after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenum1}[\item](2)
- \NewTasksEnvironment[label=\labelenuma,ref=\alph{task},
+ \NewTasksEnvironment[label=\labelenuma,ref=\refenuma,
column-sep=1em,label-align=right,
item-indent=2.15em,label-width=1.6em,label-offset=0.5em,
after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenuma}[\item](2)
@@ -1771,7 +1777,7 @@
column-sep=1em,label-align=right,
label-width=1em,label-offset=0.5em,
after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenum1}[\item](2)
- \NewTasksEnvironment[label=\labelenuma,ref=\alph{task},
+ \NewTasksEnvironment[label=\labelenuma,ref=\refenuma,
column-sep=1em,label-align=right,
item-indent=2.15em,label-width=1.6em,label-offset=0.5em,
after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenuma}[\item](2)
@@ -1986,6 +1992,8 @@
% \end{macrocode}
% Then we proceed to define the \texttt{answers} environment.
+% It seems that the \textsf{tasks} package resets the color to black,
+% therefore the |\color{correctioncolor}| options in |\settasks|.
% \begin{macrocode}
\newenvironment{answers}[1][]{% #1 is the optional level
\ifthenelse{\boolean{exesheet@answers}}{%
@@ -1993,9 +2001,21 @@
\set@toclevel[#1]
\typeset@correctionname
\correctionstyle%
+ \ifexesheet@setlist
+ \settasks{
+ label-format = \color{correctioncolor}\enumfont,
+ item-format = \color{correctioncolor}
+ }%
+ \else
+ \settasks{
+ label-format = \color{correctioncolor},
+ item-format = \color{correctioncolor}
+ }%
+ \fi%
\ifexesheet@multicol
- \renewcommand{\columnseprulecolor}{\color{correctioncolor}}
- \fi
+ \renewcommand{\columnseprulecolor}{%
+ \color{correctioncolor}}
+ \fi%
}{}
}{\comment}
}{\ifthenelse{\boolean{exesheet@answers}}{}{\endcomment}}
@@ -2378,7 +2398,8 @@
\AtEndDocument{% final checking (global)
\ifthenelse{\equal{\exe@currentlabel}{none}}{
\ifthenelse{\lengthtest{\sum@pts = 0pt}}{
- \PackageWarningNoLine{exesheet}{checkpts: No points displayed}
+ \PackageWarningNoLine{exesheet}{checkpts:
+ No points displayed}
}{
\ifthenelse{\lengthtest{\sheet@total = \sum@pts}}{
\PackageWarningNoLine{exesheet}{Total:
@@ -2391,7 +2412,8 @@
}{% last exercise and final checking
\exe@check
\ifthenelse{\lengthtest{\sum@exe} = 0pt}{
- \PackageWarningNoLine{exesheet}{checkpts: No points displayed}
+ \PackageWarningNoLine{exesheet}{checkpts:
+ No points displayed}
}{
\ifthenelse{\lengthtest{\sheet@total = \sum@exe}}{
\PackageWarningNoLine{exesheet}{Total:
diff --git a/macros/latex/contrib/exesheet/exesheet.pdf b/macros/latex/contrib/exesheet/exesheet.pdf
index b18f1858e7..8f1760acc1 100644
--- a/macros/latex/contrib/exesheet/exesheet.pdf
+++ b/macros/latex/contrib/exesheet/exesheet.pdf
Binary files differ
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
--- a/macros/latex/contrib/nicematrix/nicematrix-code.pdf
+++ b/macros/latex/contrib/nicematrix/nicematrix-code.pdf
Binary files differ
diff --git a/macros/latex/contrib/nicematrix/nicematrix-french.pdf b/macros/latex/contrib/nicematrix/nicematrix-french.pdf
index 4797714502..c5b00a3a49 100644
--- a/macros/latex/contrib/nicematrix/nicematrix-french.pdf
+++ b/macros/latex/contrib/nicematrix/nicematrix-french.pdf
Binary files differ
diff --git a/macros/latex/contrib/nicematrix/nicematrix-french.tex b/macros/latex/contrib/nicematrix/nicematrix-french.tex
index 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
--- a/macros/latex/contrib/nicematrix/nicematrix.pdf
+++ b/macros/latex/contrib/nicematrix/nicematrix.pdf
Binary files 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}
diff --git a/macros/latex/contrib/spbmark/spbmark.pdf b/macros/latex/contrib/spbmark/spbmark.pdf
index 90e46b31bf..2a9f56f6c2 100644
--- a/macros/latex/contrib/spbmark/spbmark.pdf
+++ b/macros/latex/contrib/spbmark/spbmark.pdf
Binary files differ
diff --git a/macros/latex/contrib/spbmark/spbmark.sty b/macros/latex/contrib/spbmark/spbmark.sty
index e846f52fde..41fa6ea8b1 100644
--- a/macros/latex/contrib/spbmark/spbmark.sty
+++ b/macros/latex/contrib/spbmark/spbmark.sty
@@ -9,7 +9,7 @@
% https://creativecommons.org/licenses/by/4.0/legalcode
\NeedsTeXFormat{LaTeX2e}[2018/12/31]
\RequirePackage{xparse,l3keys2e}
-\ProvidesExplPackage{spbmark}{2024/02/06}{1.46b}
+\ProvidesExplPackage{spbmark}{2024/02/13}{1.46d}
{Customize superscripts and subscripts}
\cs_generate_variant:Nn \box_set_ht:Nn { cv }
@@ -341,6 +341,61 @@
}
}
}
+\spb_define:n
+ {
+ thiswd .code:n =
+ {
+ \spb_local_case_init:nnn
+ { \tl_set:Nn \l__spb_super_thiswd_mode_tl {#1} }
+ { \tl_set:Nn \l__spb_sub_thiswd_mode_tl {#1} } { }
+ },
+ regex .code:n =
+ {
+ \spb_local_case_init:nnn
+ { \tl_set:Nn \l__spb_super_regex_next_tl {#1} }
+ { \tl_set:Nn \l__spb_sub_regex_next_tl {#1} } { }
+ },
+ spthiswd .tl_set:N = \l__spb_super_thiswd_mode_tl,
+ spthiswd .initial:n = keep,
+ sbthiswd .tl_set:N = \l__spb_sub_thiswd_mode_tl,
+ sbthiswd .initial:n = keep,
+ spregex .tl_set:N = \l__spb_super_regex_next_tl,
+ spregex .initial:n = \c{sub}|\c{textsubscript}|\c{sb}|\_,
+ sbregex .tl_set:N = \l__spb_sub_regex_next_tl,
+ sbregex .initial:n = \c{super}|\c{textsuperscript}|\c{sp}|\^
+ }
+\cs_new:Npn \spb_clear_thiswd:n #1
+ {
+ \str_case:nn {#1}
+ {
+ { super }
+ {
+ \peek_regex:nF
+ { \exp_not:o { \l__spb_super_regex_next_tl } }
+ {
+ \exp_not:n
+ {
+ \dim_zero:N \llastwd
+ \dim_zero:N \clastwd
+ \dim_zero:N \rlastwd
+ }
+ }
+ }
+ { sub }
+ {
+ \peek_regex:nF
+ { \exp_not:o { \l__spb_sub_regex_next_tl } }
+ {
+ \exp_not:n
+ {
+ \dim_zero:N \llastwd
+ \dim_zero:N \clastwd
+ \dim_zero:N \rlastwd
+ }
+ }
+ }
+ }
+ }
\cs_new_protected:Npn \spb_both_newcmd_map:n #1
{
@@ -354,7 +409,13 @@
\spb_content_hbox_set:nn {#1} {##1}
\spb_ht_dp_assign:nnnn {#1} {#1} { i } { _outer }
\box_use:c { l__#1_i_outer_box }
+ \exp_last_unbraced:Nx
\group_end:
+ {
+ \exp_args:Nv \str_if_eq:nnT
+ { l__spb_#1_thiswd_mode_tl } { auto }
+ { \spb_clear_thiswd:n {#1} }
+ }
}
}
\cs_new_protected:Npn \spb_content_hbox_set:nn #1#2
diff --git a/macros/latex/contrib/spbmark/spbmark.tex b/macros/latex/contrib/spbmark/spbmark.tex
index 2c9319118c..9fbf4962cf 100644
--- a/macros/latex/contrib/spbmark/spbmark.tex
+++ b/macros/latex/contrib/spbmark/spbmark.tex
@@ -7,8 +7,8 @@
{
package = spbmark,
title = the spbmark package,
- version = v1.46b,
- date = 2024/02/06,
+ version = v1.46d,
+ date = 2024/02/13,
authors = Qu Yi,
info = Customize superscript and subscript,
email = toquyi@163.com,
@@ -46,7 +46,6 @@
\begin{document}
\section{Macro package options}
-\label{sec:macro package options}
The following macro package options will redefine the script commands of the \LaTeX{} kernel. If you do not specify the values of boolean options, they default to \code{true}. These options can also be changed in the preamble area and main body using the global control command \cs{sbpset}.
\begin{options}
\keychoice{text}{true,\fbox{false}}\newtag[Changed]%
@@ -72,7 +71,8 @@ The following macro package options will redefine the script commands of the \La
\end{options}
\section{User commands}
-There are currently three commands to set superscript and subscript. Their format can be set temporarily using the optional parameters of the command, or set globally using a key-value list, see section \ref{sec:global control interface}.
+\label{sec:user commands}
+There are currently three commands to set superscript and subscript. Their format can be set temporarily using the optional parameters of the command, or set globally using a key-value list, see Section \ref{sec:global control interface}.
\begin{commands}
\command{super}[\sarg\oarg{kv list}\marg{content}\oarg{kv list}]
This is a superscript output command. The two \meta{kv list} are equivalent.
@@ -82,11 +82,11 @@ There are currently three commands to set superscript and subscript. Their forma
When the horizontal movement distance of the marker is \emph{non-negative}, since the \cs{super} and \cs{sub} commands put the marker in a horizontal box, the horizontal position is staggered when using superscript and subscript \emph{consecutively}, which is a different mechanism than the sequential use of \code{\^{}} and \code{\_{}} symbols in math mode. The following three commands save the width of the previous marker, use it for negative move of the \option{hmove} option of the next marker, and provide the corresponding alignment.
It should be noted that the following commands should save the longer width of the marker, that is, the longer width of the marker in the front, the shorter width of the marker in the back. This is due to the fact that horizontal movement uses a negative distance to leave the marker in a zero-width box state.
- \command{llastwd}\newtag%
+ \command{llastwd}
Save the width of the previous marker and provide left alignment. This is actually the width of the previous marker, and is the same as the value of \cs{rlastwd} after the next command is used.
- \command{clastwd}\newtag%
+ \command{clastwd}
Save the width of the previous marker and provide center alignment.
- \command{rlastwd}\newtag%
+ \command{rlastwd}
Save the width of the previous marker and provide right alignment. Actually this is the width of the next marker.
\begin{example}
1A\super{bcd}\sub{e}B \\
@@ -118,7 +118,7 @@ There are currently three commands to set superscript and subscript. Their forma
Defines the style of the superscript or subscript used for the \option{style} option.
\command{spbifmath}[\marg{math code}\marg{text code}]
In some cases, \code{math} or \code{text} output modes require different code for format or move. This command can be used when using the \code{match} option or changing the output mode locally, whitch should be used in the move or format options. It can switch the corresponding code according to different output modes.
- \command{spbshortkv}[\marg{short opt}\marg{key value}]\newtag%
+ \command{spbshortkv}[\marg{short opt}\marg{key value}]
Converts any existing key-value pair to a shorthand option. The value of key \code{\#1} indicates that the shorthand option needs to be assigned a value.
\begin{example}
\spbshortkv{x}{sphmove=#1}
@@ -151,6 +151,21 @@ The options common to \meta{kv list} of the three commands are as follows. They
Use the \meta{style name} defined by the \cs{defspbstyle} command to make it work global or local.
\keychoice{mode}{text,math,\fbox{match}}
The mode of superscript or subscript output can be \code{text} or \code{math} mode. The \code{match} option automatically matches output modes according to the current mode.
+ \keychoice{thiswd}{auto,\fbox{keep}}\newtag%
+ Sets how the length of the this marker is handled after this command is used. If it is \code{keep}, the width of the previous marker remains the same. If it is \code{auto}, if the next token is a marker command and the upper or lower position is the \textcolor{red}{opposite} of the this command, the width of the this marker is maintained, otherwise the width automatically returns to \textcolor{red}{zero}.
+ \begin{example}
+ \spbset{sbhmove=-\llastwd,sbthiswd=auto,sbcmd=\color{red}}
+ 1A\super{bcd}\sub[thiswd=keep]{e}Some texts\sub{e} \\
+ 3A\super{bcd}\sub{e}Some texts\sub{e} \\
+ 3A\sub{bcd}[thiswd=keep]\sub{e}Some texts\sub{e} \\
+ 4A\sub{bcd}\sub{e}Some texts\sub{e}
+ \end{example}
+ \keyval{regex}{regular expression}\newtag%
+ After using the superscript or subscript command, this option is used to determine whether the \textcolor{red}{following} tokens match the \meta{regular expression}. If it does \textcolor{red}{not}, the width of the this marker returns to zero.
+ \begin{example}[code-only]
+ \newcommand{\mysp}[2][]{\super[regex=\c{mysb},#2]{#1}}
+ \newcommand{\mysb}[2][]{\sub[regex=\c{mysp},#2]{#1}}
+ \end{example}
\end{options}
\section{Global control interface}
@@ -190,6 +205,14 @@ The following list of keys control the format both of superscript \emph{or} subs
The distance between the subscript baseline and the previous line.
\keyval{sbdepth}{fixed length}
The distance between the subscript baseline and the next line.
+ \keychoice{spthiswd}{auto,\fbox{keep}}\newtag%
+ Width processing mode after using this superscript. See Section \ref{sec:user commands} for the meaning of this option.
+ \keychoice{sbthiswd}{auto,\fbox{keep}}\newtag%
+ Width processing mode after using this subscript. See Section \ref{sec:user commands} for the meaning of this option.
+ \keyval{spregex}{regular expression}\newtag%
+ After the superscript command is used, the regular expression rules of the following tokens are matched. See Section \ref{sec:user commands} for the meaning of this option.
+ \keyval{sbregex}{regular expression}\newtag%
+ After the subscript command is used, the regular expression rules of the following tokens are matched. See Section \ref{sec:user commands} for the meaning of this option.
\end{options}
If \option{sphmove} is positive, the superscript or subscript moves to the right, conversely it moves to the left. The positive direction of vertical offset of subscript and superscript is opposite. For superscript, if \option{spvmove} is positive, the superscript moves up, conversely it moves down. For subscript, if \option{spvmove} is positive, the subscript moves down, conversely it moves up.
@@ -206,7 +229,7 @@ The following list of keys control the format of superscript \emph{and} subscrip
The distance between the superscript baseline and the previous line.
\keyval{spbdepth}{fixed length}
The distance between the subscript baseline and the next line.
- \kvsplit{vsep}{super move}{sub move}\Default{0.6ex}\newtag[Changed]%
+ \kvsplit{vsep}{super move}{sub move}\Default{0.6ex}
The extra vertical distance between superscript and subscript. The front part is the movement amount of the superscript, and the latter part is the movement amount of the subscript. If only the front part means that both are vertically shifted by one-half of the current value.
\keychoice{halign}{\fbox{l},c,r}
The alignment of superscript and subscript, which contains \code{l}, \code{c}, and \code{r} parameters respectively for left, center, and right alignment.
@@ -220,7 +243,8 @@ Here is a list of the three commands, please pay attention to the usage of optio
1A\super[vmove=0.2ex,hmove=0.2em,cmd=\textcolor{red}]{exam}B \\
2$A\sub[style=fancy,cmd+=\mathsf,mode=math]{exam}B$ \\
3A\supersub[vsep=0.6ex,halign=c]{examsuper}{sub}B \\
- 4A\super{c}[vmove=5pt,hmove=-5.5pt]B\sub[vmove=5pt,hmove=-5pt]{d}AB
+ 4A\super{c}[vmove=5pt,hmove=-5.5pt]B\sub[vmove=5pt,hmove=-5pt]{d}AB \\
+ 5A\super{c\super{d}}B
\end{example}
\subsection{siunitx}
@@ -232,15 +256,15 @@ It can also be used with the \pkg*{siunitx} package to output superscript and su
\end{example}
\subsection{realscripts}
-If the OpenType text font you are using does not have optical sizes, the superscript and subscript may not appear correctly. Loading the \pkg*{realscripts} macro package before the \pkg*{spbmark} macro package fixes this behavior.
+If the OpenType text font you are using does not have optical sizes, the superscript and subscript may not appear correctly. Loading the \pkg*{realscripts} package before the \pkg*{spbmark} package fixes this behavior.
\begin{example}[code-only]
\usepackage{realscripts,spbmark}
\end{example}
\subsection{altsubsup}
-The \pkg*{altsubsup} package allows to write alternate superscript and subscript in math mode with \code{\^{}}\oarg{mark} and \code{\_{}}\oarg{mark} dimensions. When the macro package is loaded using the \code{spbmark} option, the superscript and subscript mechanism of \pkg*{spbmark} is used, you can use \cs{defspbstyle} to define its superscript style \code{altsup} and subscript style \code{altsub}.
+The \pkg*{altsubsup} package allows to write alternate superscript and subscript in math mode with \code{\^{}}\oarg{mark} and \code{\_{}}\oarg{mark} dimensions. When the package is loaded using the \code{spbmark} option, the superscript and subscript mechanism of \pkg*{spbmark} is used, you can use \cs{defspbstyle} to define its superscript style \code{altsup} and subscript style \code{altsub}.
\begin{example}
- \defspbstyle{altsup}{sphmove=-\llastwd,spvmove=1pt}
+ \defspbstyle{altsup}{sphmove=-\llastwd,spthiswd=auto,spvmove=1pt}
$A_[bcd]^[e]B$
\end{example}
diff --git a/macros/latex/contrib/verse/verse.dtx b/macros/latex/contrib/verse/verse.dtx
index cf9d69488c..6b0b4d186b 100644
--- a/macros/latex/contrib/verse/verse.dtx
+++ b/macros/latex/contrib/verse/verse.dtx
@@ -60,7 +60,7 @@
%
% \fi
%
-% \CheckSum{551}
+% \CheckSum{553}
%
% \DoNotIndex{\',\.,\@M,\@@input,\@addtoreset,\@arabic,\@badmath}
% \DoNotIndex{\@centercr,\@cite}
@@ -115,6 +115,7 @@
% \changes{v2.4}{2007/01/10}{Added code to start numbering at a given line}
% \changes{v2.4a}{2009/09/04}{New maintainer (Will Robertson)}
% \changes{v2.4b}{2014/05/10}{Documentation updates}
+% \changes{v2.4c}{2024/02/11}{Avoid clash with tagging}
%
% \def\dtxfile{verse.dtx}
% ^^A \def\fileversion{v1.0}
@@ -133,6 +134,7 @@
% \def\fileversion{v2.4} \def\filedate{2007/01/10}
% \def\fileversion{v2.4a} \def\filedate{2009/09/04}
% \def\fileversion{v2.4b} \def\filedate{2014/05/10}
+% \def\fileversion{v2.4c} \def\filedate{2024/02/12}
% \newcommand*{\Lpack}[1]{\textsf {#1}} ^^A typeset a package
% \newcommand*{\Lopt}[1]{\textsf {#1}} ^^A typeset an option
% \newcommand*{\file}[1]{\texttt {#1}} ^^A typeset a file
@@ -968,6 +970,7 @@
% \changes{v2.22}{2005/08/22}{Added verse@envctr counter and
% \cs{theHpoemlines} for hyperref}
% \changes{v2.4}{2007/01/10}{Added fvsline counter}
+% \changes{v2.4c}{2024/02/12}{Use provide/renew instead of newcommand}
% \begin{macrocode}
\newcounter{vslineno}
\newcounter{poemline}
@@ -975,7 +978,8 @@
\setcounter{fvsline}{0}
\newcounter{modulo@vs}
\newcounter{verse@envctr}\setcounter{verse@envctr}{0}
-\newcommand*{\theHpoemline}{\arabic{verse@envctr}.\arabic{poemline}}
+\providecommand{\theHpoemline}{}
+\renewcommand*{\theHpoemline}{\arabic{verse@envctr}.\arabic{poemline}}
% \end{macrocode}
% \end{macro}
% \end{macro}
diff --git a/macros/latex/contrib/verse/verse.pdf b/macros/latex/contrib/verse/verse.pdf
index 0129ac8ed9..870b125287 100644
--- a/macros/latex/contrib/verse/verse.pdf
+++ b/macros/latex/contrib/verse/verse.pdf
Binary files differ
diff --git a/macros/latex/contrib/xfrac/CHANGELOG.md b/macros/latex/contrib/xfrac/CHANGELOG.md
new file mode 100644
index 0000000000..e2f119f66a
--- /dev/null
+++ b/macros/latex/contrib/xfrac/CHANGELOG.md
@@ -0,0 +1,19 @@
+# Changelog
+All notable changes to the `xfrac` since February 2024 will be documented in
+this file.
+
+The format is based on [Keep a
+Changelog](https://keepachangelog.com/en/1.0.0/), this project uses date-based
+'snapshot' version identifiers.
+
+## [Unreleased]
+
+## [2024-02-13]
+
+### Changed
+- New independent repository https://github.com/latex3/xfrac
+- Updated package dependencies (track kernel improvements)
+- Preparation for move of `xtemplate` concepts to the kernel
+
+[Unreleased]: https://github.com/latex3/latex3/compare/2024-02-13...HEAD
+[2024-02-13]: https://github.com/latex3/xfrac/compare/2023-10-10...2024-02-13
diff --git a/macros/latex/contrib/xfrac/README.md b/macros/latex/contrib/xfrac/README.md
new file mode 100644
index 0000000000..8af29b97d2
--- /dev/null
+++ b/macros/latex/contrib/xfrac/README.md
@@ -0,0 +1,29 @@
+# `xfrac`: Split level fractions
+
+Release 2024-02-13
+
+## Overview
+
+The `xfrac` package uses the interface defined by LaTeX templates to provide
+flexible split-level fractions _via_ the `\sfrac` macro. This is both a
+demonstration of the power of the template concept and also a useful addition
+to the available functionality in LaTeX2e.
+
+## Issues
+
+The issue tracker for LaTeX is currently located
+[on GitHub](https://github.com/latex3/xfrac/issues).
+
+## Development team
+
+This code is developed by [The LaTeX Project](https://latex-project.org).
+
+## License
+
+Released under the LaTeX Project Public License v1.3c or later. See https://www.latex-project.org/lppl.txt
+
+-----
+
+<p>Copyright (C) 2024 The LaTeX Project <br />
+<a href="https://latex-project.org/">https://latex-project.org/</a> <br />
+All rights reserved.</p>
diff --git a/macros/latex/contrib/xfrac/xfrac.dtx b/macros/latex/contrib/xfrac/xfrac.dtx
new file mode 100644
index 0000000000..55c26ca76f
--- /dev/null
+++ b/macros/latex/contrib/xfrac/xfrac.dtx
@@ -0,0 +1,1146 @@
+% \iffalse meta-comment
+%
+%% File: xfrac.dtx
+%
+% Copyright (C) 2004,2008-2010 Morten Hoegholm
+% (C) 2011,2012,2014-2024 The LaTeX Project
+%
+% It may be distributed and/or modified under the conditions of the
+% LaTeX Project Public License (LPPL), either version 1.3c of this
+% license or (at your option) any later version. The latest version
+% of this license is in the file
+%
+% https://www.latex-project.org/lppl.txt
+%
+% This file is part of the "xfrac package" (The Work in LPPL)
+% and all files in that bundle must be distributed together.
+%
+% -----------------------------------------------------------------------
+%
+% The development version of the bundle can be found at
+%
+% https://github.com/latex3/xfrac
+%
+% for those people who are interested.
+%
+%<*driver|package>
+\RequirePackage{amstext,graphicx}
+%</driver|package>
+%<*driver>
+\documentclass[full]{l3doc}
+\usepackage{nicefrac,xfrac} ^^A Need nicefrac for demo purposes
+\providecommand*\key[1]{\textbf{#1}}
+\newcommand*\switch[2]{{\fontfamily{#1}\selectfont #2}}
+\begin{document}
+ \DocInput{\jobname.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \title{^^A
+% The \pkg{xfrac} package\\ Split-level fractions^^A
+% }
+%
+% \author{^^A
+% The \LaTeX{} Project\thanks
+% {^^A
+% E-mail:
+% \href{mailto:latex-team@latex-project.org}
+% {latex-team@latex-project.org}^^A
+% }^^A
+% }
+%
+% \date{Released 2024-02-13}
+%
+% \maketitle
+%
+% \begin{documentation}
+%
+% The \pkg{xfrac} package defines a document command \cs{sfrac}
+% with the following syntax:
+% \begin{quote}
+% \cs{sfrac}\oarg{instance}\marg{num}\oarg{sep}\marg{denom}
+% \end{quote}
+% Let's show a few examples:
+% \begin{verbatim}
+% \sfrac{1}{2}, $\sfrac{1}{2}$,
+% $\mathbf{3\times\sfrac{1}{2}}$
+% \quad \fontfamily{ppl}\selectfont Palatino: \sfrac{1}{2}
+% \quad \fontfamily{ptm}\selectfont Times: \sfrac{1}{2}
+% \end{verbatim}
+% \begin{quote}
+% \sfrac{1}{2}, $\sfrac{1}{2}$, $\mathbf{3\times\sfrac{1}{2}}$
+% \quad \fontfamily{ppl}\selectfont Palatino: \sfrac{1}{2}
+% \quad \fontfamily{ptm}\selectfont Times: \sfrac{1}{2}
+% \end{quote}
+% You'll notice something interesting: not only does the \cs{sfrac}
+% command work as it should in math mode, it also gets the job done
+% for other fonts as well.
+%
+% \section{A Bit of History}
+%
+% \subsection{The Past}
+%
+% One of the first exercises in \emph{The \TeX{}Book} is to design a
+% macro for split level fractions. The solution presented is fairly
+% simple, using a \emph{virgule} (a slash) for separating the two
+% components. It looks okay because the text font and math font of
+% Computer Modern look almost identical.
+%
+% The proper symbol to use instead of the virgule is a \emph{solidus}
+% which does not exist in Computer Modern. It is however available in
+% the European Computer Modern fonts, but I'll get back to that.
+%
+% \subsection{The Present}
+%
+% The most common way to produce split level fractions within \LaTeXe{}
+% is by means of the \pkg{nicefrac} package. Part of the reason it
+% has found widespread use is due to the strange design of the
+% built-in text fractions of the EC fonts, which look like this:
+% \textonehalf{}. The package is very simple to use but there are a few
+% issues:
+% \begin{itemize}
+% \item It uses the virgule instead of the solidus.
+% \item Font size of numerator and denominator is bigger than in the
+% built-in symbol. Compare Palatino: \switch{ppl}{\nicefrac{1}{2}}
+% \emph{vs.}~\switch{ppl}{\textonehalf}.
+% \item It doesn't correct for fonts using text figures such as in the
+% \pkg{eco} package. Compare \switch{cmor}{\nicefrac{1}{2}} and
+% \switch{cmor}{\nicefrac{8}{9}}.
+% \item In math mode, it doesn't always pick up the correct math
+% alphabet.
+% \end{itemize}
+% In short: \pkg{nicefrac} doesn't attempt to be the answer to
+% everything and so this is not a criticism of the package. It works
+% quite well for Computer Modern which was pretty much what was widely
+% available at the time it was developed. Users these days, however,
+% have a choice of many fonts when they write their documents.
+%
+% \subsection{The Future}
+%
+% Fonts are wildly different; one macro that works fine for Computer
+% Modern obviously doesn't work well at all in Palatino. For one we
+% have to make the separator symbol configurable, and we need to
+% take care of several details as well: font scaling of the
+% numerator/denominator pair (ND), font selection of ND, \emph{etc.} If we
+% are to have a single package for this in the future we have to define a
+% totally generic interface for the fraction commands and then adjust
+% parameters depending on the current font. What you see in this
+% prototype implementation of \pkg{xfrac} is just that.
+%
+% \section{Advanced User Interface}
+%
+% \subsection{Text mode}
+%
+% The usual problem in text mode has a name: Computer Modern. The
+% solidi of all the Computer Modern fonts leave a lot to be desired,
+% although things are potentially looking better as the Latin Modern
+% fonts are becoming more stable and widespread. As long as the
+% default fonts are Computer Modern variants we must however work
+% around this. One idea that comes to mind is to see what happens
+% when you use a solidus from another font instead. Let's try with
+% Times:
+% \begin{quote}
+% \DeclareInstance{xfrac}{cmr2}{text}
+% {slash-symbol-font = ptm}
+% \enquote{You take \sfrac[cmr2]{1}{2} cup of sugar, \ldots}
+% \end{quote}
+% That looks quite good actually, so it was probably very difficult
+% to obtain that result. Nope, it was extremely easy---if you happen
+% to know about \emph{instances}:
+% \begin{verbatim}
+% \DeclareInstance{xfrac}{cmr}{text}
+% {slash-symbol-font = ptm}
+% \end{verbatim}
+% So we define an instance with the name |cmr| from the template
+% |text| which in turn is of object type |xfrac|. You'll notice
+% the |cmr| is also the name of the font family for Computer Modern
+% Roman and the reasoning behind is that every font family should
+% have it's own settings, and if a document command is to work well
+% in that scheme, letting it use the name of the current font family
+% seems like a good idea. Thus the \cs{sfrac} command checks to see
+% whether an instance with same name as the current font family
+% exists and uses it if the test is true; otherwise the default
+% setting is used. Here we defined the instance to be used for the
+% font family |cmr| and just told it to use the Times font for
+% typesetting the slash symbol which turns out to be a solidus by
+% default.
+%
+% The option \texttt{cm-recommended} which is loaded by default uses
+% the Times solidus for Computer Modern Roman and Computer Modern
+% Sans Serif and the Palatino solidus for Computer Modern Typewriter
+% Type. This looks quite good. Should you however not want this you
+% can use the option \texttt{cm-standard} which produces somewhat
+% acceptable results using Computer Modern exclusively.
+%
+% So what about old style figures? If you use the \pkg{eco}
+% package you might define an instance similar to this (`cmor' is
+% the name of the roman font activated by \pkg{eco}):
+% \DeclareInstance{xfrac}{cmor}{text}
+% {
+% slash-symbol-font = ptm,
+% numerator-font = cmr,
+% denominator-font = cmr
+% }
+% \begin{verbatim}
+% \DeclareInstance{xfrac}{cmor}{text}
+% {
+% slash-symbol-font = ptm,
+% numerator-font = cmr,
+% denominator-font = cmr
+% }
+% \end{verbatim}
+% We also use regular Computer Modern Roman for typesetting ND, so
+% we end up with \switch{cmor}{\sfrac{1}{2}} and
+% \switch{cmor}{\sfrac{8}{9}} instead of
+% \switch{cmor}{\nicefrac{1}{2}} and \switch{cmor}{\nicefrac{8}{9}}.
+% Much better.
+%
+% There are also situations where other tricks are useful. If you
+% don't have the inferior and superior figures available in a font,
+% or the font doesn't have a wider design for small font sizes, you
+% can cheat by manually scaling the ND-pair. I got nice results for
+% Adobe's Stempel Garamond (with small caps and old style figures)
+% with the following setup:
+% \begin{verbatim}
+% \DeclareInstance{xfrac}{pegj}{text}
+% {
+% numerator-font = pegx,
+% denominator-font = pegx,
+% scale-factor = 0.9,
+% h-scale = 1.1
+% }
+% \end{verbatim}
+% We use the font family |pegx| (Stempel Garamond with real small
+% caps) for typesetting the ND-pair. Additionally the key
+% \key{scale-factor} specifies that the font size used for the
+% ND-pair should be $0.9$ of the height of the solidus, and the key
+% \key{h-scale} specifies that the ND-pair should be scaled an extra
+% 10\,\% horizontally.
+%
+% Should you be so fortunate the have a font with inferior and
+% superior figures like in the Monotype Janson example from Philipp
+% Lehman's excellent \emph{The Font Installation Guide}. In that
+% example Philipp defines the font families |mjn0| for the inferior
+% figures and |mjn1| for the superior. Thus to get the \cs{sfrac}
+% command to use them on the fly for the font family |mjnj| (Janson,
+% old style figures) we would say
+% \begin{verbatim}
+% \DeclareInstance{xfrac}{mjnj}{text}
+% {
+% numerator-font = mjn1,
+% denominator-font = mjn0,
+% scaling = false,
+% numerator-bot-sep = 0 pt,
+% denominator-bot-sep = 0 pt
+% }
+% \end{verbatim}
+% I think this example is a very clean way to do it. An alternative
+% approach could be to use the keys \key{numerator-format} and
+% \key{denominator-format} to process the arguments and let them
+% determine what to do.
+%
+% \subsection{Math Mode}
+%
+% In math mode the choices are a lot fewer because first of all
+% \TeX{} comes with a built-in limitation of $16$ math families.
+% Additionally we will not need a solidus for typesetting split
+% fractions in math, as tradition is to use a virgule instead. We
+% define the basic |mathdefault| instance to simply use the math
+% family in use when the instance is run. So if we're in normal math
+% like |$\sfrac{7}{9}$| we simply get family~$-1$. If we're inside a
+% \cs{mathbf} we're in family~$4$ (in the standard setup at least),
+% and so the fraction is typeset with the same math family. Simple,
+% isn't?
+%
+% You can also declare instances for the math families, but I really
+% don't see why you would. If you do then name them according to the
+% scheme \texttt{mathfam\meta{N}}, where \meta{N} is the family number, and
+% only do it if you \emph{really} know how to set up math fonts.
+% That is, if \cs{DeclareMathAlphabet} is unbeknownst to you, then
+% just don't go there.
+%
+% \section{The Template Interface}
+%
+% \begin{TemplateInterfaceDescription}{xfrac}
+%
+% \TemplateArgument{1}{The numerator}
+%
+% \TemplateArgument{2}{The separator}
+%
+% \TemplateArgument{3}{The denominator}
+%
+% \TemplateSemantics
+%
+% Typesets arguments 1 and 3 separated by argument 2, which in text
+% mode by default is a \emph{solidus}. This is taken from
+% \pkg{textcomp} where it is denoted \cs{textfractionsolidus}.
+% This is the character used for the ready made split level
+% fractions such as \textonehalf{}---except in the (European) Computer
+% Modern fonts. In math mode a \emph{virgule} is used instead as
+% this is more appropriate and it is always available in the math
+% fonts. The solidus is a text symbol only.
+%
+% \end{TemplateInterfaceDescription}
+%
+% \begin{TemplateDescription}{xfrac}{text}
+%
+% \TemplateKey{numerator-font}{tokenlist}
+% {Font family specification to use for the numerator.}
+% {\cs{f@family}}
+%
+% \TemplateKey{numerator-format}{function 1 arg}
+% {Action to be taken on the numerator.}
+% {Process argument unchanged}
+%
+% \TemplateKey{slash-symbol}{tokenlist}
+% {The separator symbol. If not specified the default value will be
+% used instead.}
+% {Solidus (\cs{textfractionsolidus})}
+%
+% \TemplateKey{slash-symbol-font}{tokenlist}
+% {Font family specification to use for the separator symbol.}
+% {\cs{f@family}}
+%
+% \TemplateKey{slash-symbol-format}{function 1 arg}
+% {Action to be taken on the separator symbol.}
+% {Process argument unchanged}
+%
+% \TemplateKey{denominator-font}{tokenlist}
+% {Font family specification to use for the denominator.}
+% {\cs{f@family}}
+%
+% \TemplateKey{denominator-format}{function 1 arg}
+% {Action to be taken on the denominator.}
+% {Process argument unchanged}
+%
+% \TemplateKey{h-scale}{real}
+% {Factor by which the numerator and denominator should be
+% horizontally scaled. It should only be used if the real superior
+% and inferior fonts are not available. For instance Stempel
+% Garamond looks excellent if scaled 10\,\% extra horizontally, \emph{i.e.},
+% by a factor of 1.1.}
+% {1}
+%
+% \TemplateKey{v-scale}{real}
+% {Same as \key{h-scale} only vertically. Probably not of much use
+% but added for completeness.}
+% {1}
+%
+% \TemplateKey{scale-factor}{real}
+% {Fraction of the size of \key{slash-symbol}. Used for setting the
+% font size of numerator and denominator. Usually a value of app.\
+% \sfrac{5}{6} produces fine results. It should only be used if the
+% real superior and inferior fonts are not available. As an example
+% Stempel Garamond looks better if the factor is 0.9.}
+% {0.83333}
+%
+% \TemplateKey{scale-relative}{choice}
+% {If set to |true| the font size of the numerator and denominator
+% is scaled with respect to the height of the \key{slash-symbol}. If
+% set to |false| the font is scaled with respect to the total height
+% of the \key{slash-symbol}.}
+% {true}
+%
+% \TemplateKey{scaling}{choice}
+% {If set to |true| the fonts are allowed to scale. If set to
+% |false| they are not. See the `Janson' example for an application.}
+% {true}
+%
+% \TemplateKey{numerator-top-sep}{length}
+% {Dimension specifying the space between the top of the
+% \key{slash-symbol} and the top of the numerator. If not specified,
+% the depth of the solidus will be used, because this value will
+% make the fraction look even.}
+% {Unspecified}
+%
+% \TemplateKey{numerator-bot-sep}{length}
+% {Dimension specifying the lift of the numerator from the
+% baseline.}
+% {Unspecified}
+%
+% \TemplateKey{denominator-bot-sep}{length}
+% {Dimension specifying the lift of the denominator from the
+% baseline.}
+% {Unspecified}
+%
+% \TemplateKey{slash-right-kern}{length}
+% {Dimension specifying the kerning between the \key{slash-symbol}
+% and the numerator.}
+% {\texttt{0pt}}
+%
+% \TemplateKey{slash-left-kern}{length}
+% {Dimension specifying the kerning between the \key{slash-symbol}
+% and the denominator.}
+% {\texttt{0pt}}
+%
+% \TemplateKey{math-mode}{choice}
+% {Are we in math mode or not?}
+% {false}
+%
+% \TemplateKey{phantom}{tokenlist}
+% {A character that suits the common cases. As we would mostly want
+% to use numbers in text mode we choose a \enquote{tall} number, while in
+% math it is somewhat different.}
+% {8}
+%
+% \TemplateSemantics
+%
+% This template is also the foundation for the \enquote{math} template. The
+% keys \key{slash-right-mkern} and \key{slash-left-mkern} can only
+% be used in math mode and are not shown here.
+%
+% \end{TemplateDescription}
+%
+% \begin{TemplateDescription}{xfrac}{math}
+%
+% \TemplateKey{numerator-font}{tokenlist}
+% {Font family specification to use for the numerator.}
+% {\cs{number}\cs{fam}}
+%
+% \TemplateKey{slash-symbol}{tokenlist}
+% {The separator symbol. If not specified the default value will be
+% used instead.}
+% {Virgule ($/$)}
+%
+% \TemplateKey{slash-symbol-font}{tokenlist}
+% {Font family specification to use for the separator symbol.}
+% {\cs{number}\cs{fam}}
+%
+% \TemplateKey{denominator-font}{tokenlist}
+% {Font family specification to use for the denominator.}
+% {\cs{number}\cs{fam}}
+%
+% \TemplateKey{scale-factor}{real}
+% {Fraction of the size of \key{slash-symbol}. In math mode we
+% cannot rely on the fonts to be able to scale, but giving a default
+% scale of 0.7 fits into the regular size changing scheme---the
+% default scheme has values $(D,T,S,SS)=(1,1,0.7,0.5)$ whereas we
+% with a default \key{scale-factor} of 0.7 get $(1,1,0.7,0.49)$.
+% That's close enough.}
+% {0.7}
+%
+% \TemplateKey{scale-relative}{choice}
+% {If set to |true| the font size of the numerator and denominator
+% is scaled with respect to the height of the \key{slash-symbol}. If
+% set to |false| the font is scaled with respect to the total height
+% of the \key{slash-symbol}.}
+% {false}
+%
+% \TemplateKey{scaling}{choice}
+% {If set to |true| the fonts are allowed to scale. If set to
+% |false| they are not. See the |plainmath| example for an application.}
+% {true}
+%
+% \TemplateKey{numerator-top-sep}{length}
+% {Dimension specifying the space between the top of the
+% \key{slash-symbol} and the top of the numerator. If not specified,
+% the depth of the virgule will be used, because this value will
+% make the fraction look even.}
+% {\texttt{0pt}}
+%
+% \TemplateKey{denominator-bot-sep}{length}
+% {Dimension specifying the lift of the denominator from the
+% baseline.}
+% {\texttt{0pt}}
+%
+% \TemplateKey{slash-right-mkern}{muskip}
+% {Same as \key{slash-right-kern} but for math mode only and should
+% be specified in \texttt{mu} units.}
+% {\texttt{-2mu}}
+%
+% \TemplateKey{slash-left-mkern}{muskip}
+% {Same as \key{slash-left-kern} but for math mode only and should
+% be specified in \texttt{mu} units.}
+% {\texttt{-1mu}}
+%
+% \TemplateKey{math-mode}{choice}
+% {Are we in math mode or not?}
+% {true}
+%
+% \TemplateKey{phantom}{tokenlist}
+% {A character that suits the common cases. In math we have a high
+% risk of using a parenthesis, so we choose that. Text mode is
+% another story.}
+% {(^^A)
+% }
+%
+% \TemplateSemantics
+%
+% This template is a restricted version of the |text| template. Only
+% the keys that are different from the |text| template are shown
+% here. Also bear in mind that the attributes \key{slash-left-kern}
+% and \key{slash-right-kern} have no meaning in this template.
+%
+% \end{TemplateDescription}
+%
+% \end{documentation}
+%
+% \begin{implementation}
+%
+% \section{\pkg{xfrac} implementation}
+%
+% \begin{macrocode}
+%<*package>
+% \end{macrocode}
+%
+% \begin{macrocode}
+%<@@=xfrac>
+% \end{macrocode}
+%
+% Load \pkg{expl3} \enquote{up-front} only if required.
+% \begin{macrocode}
+\@ifundefined{ExplLoaderFileDate}
+ {\RequirePackage{expl3}}
+ {}
+% \end{macrocode}
+%
+% Make sure that the version of \pkg{l3kernel} in use is sufficiently new.
+% We use \cs{ExplFileDate} as \cs{@ifpackagelater} doesn't work for pre-loaded
+% \pkg{expl3} in the absence of the package.
+% \begin{macrocode}
+\@ifl@t@r\ExplLoaderFileDate{2018-02-21}
+ {}
+ {%
+ \PackageError{xfrac}{Support package expl3 too old}
+ {%
+ You need to update your installation of 'l3kernel'.\MessageBreak
+ Loading~xfrac~will~abort!%
+ }%
+ \endinput
+ }%
+% \end{macrocode}
+%
+% \begin{macrocode}
+\ProvidesExplPackage{xfrac}{2024-02-13}{}
+ {Split-level fractions}
+% \end{macrocode}
+%
+% \begin{macro}{\IfFormatAtLeastTF}
+% Not present in older kernels: use the \LaTeXe{} mechanism as this is correct
+% for this case.
+% \begin{macrocode}
+\providecommand \IfFormatAtLeastTF { \@ifl@t@r \fmtversion }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\IfFormatAtLeastTF { 2020-02-02 }
+ { }
+ { \RequirePackage { textcomp } }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\IfFormatAtLeastTF { 2020-10-01 }
+ { }
+ { \RequirePackage { xparse } }
+% \end{macrocode}
+%
+% \begin{variable}{\l_@@_cm_std_bool}
+% There is one option to support.
+% \begin{macrocode}
+\keys_define:nn { xfrac }
+ {
+ cm-recommended .choice:,
+ cm-recommended /
+ false .code:n =
+ { \bool_set_true:N \l_@@_cm_std_bool },
+ cm-recommended /
+ true .code:n =
+ { \bool_set_false:N \l_@@_cm_std_bool },
+ cm-recommended .default:n = { true },
+ cm-standard .bool_set:N = \l_@@_cm_std_bool
+ }
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macrocode}
+\IfFormatAtLeastTF { 2022-06-01 }
+ { \ProcessKeyOptions }
+ {
+ \RequirePackage { l3keys2e }
+ \ProcessKeysOptions { xfrac }
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\IfFormatAtLeastTF { 2024-06-01 }
+ { }
+ { \RequirePackage { xtemplate } }
+% \end{macrocode}
+%
+% \begin{variable}{\l_@@_slash_box}
+% \begin{variable}{\l_@@_tmp_box}
+% In keeping with the \LaTeX3 philosophy, rather than use generic
+% scratch boxes and get confused, \pkg{xfrac} reserves its own named
+% working space.
+% \begin{macrocode}
+\box_new:N \l_@@_slash_box
+\box_new:N \l_@@_tmp_box
+% \end{macrocode}
+% \end{variable}
+% \end{variable}
+%
+% \begin{macro}{\@@_tmp:w}
+% Used for the raised boxes: weird as it does not take an argument
+% but the \cs{raisebox} does.
+% \begin{macrocode}
+\cs_new:Npn \@@_tmp:w { }
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsection{Initialisation of variables}
+%
+% Variables used in templates have to be set up: there is not
+% much to say about these, other than that they must exist.
+%
+% \begin{variable}{\l_@@_denominator_bot_sep_dim}
+% \begin{variable}{\l_@@_numerator_bot_sep_dim}
+% \begin{variable}{\l_@@_numerator_top_sep_dim}
+% \begin{variable}{\l_@@_slash_left_sep_dim}
+% \begin{variable}{\l_@@_slash_right_sep_dim}
+% Fixed lengths.
+% \begin{macrocode}
+\dim_new:N \l_@@_denominator_bot_sep_dim
+\dim_new:N \l_@@_numerator_bot_sep_dim
+\dim_new:N \l_@@_numerator_top_sep_dim
+\dim_new:N \l_@@_slash_left_sep_dim
+\dim_new:N \l_@@_slash_right_sep_dim
+% \end{macrocode}
+% \end{variable}
+% \end{variable}
+% \end{variable}
+% \end{variable}
+% \end{variable}
+%
+% \begin{variable}{\l_@@_slash_left_muskip}
+% \begin{variable}{\l_@@_slash_right_muskip}
+% Math mode skips.
+% \begin{macrocode}
+\muskip_new:N \l_@@_slash_left_muskip
+\muskip_new:N \l_@@_slash_right_muskip
+% \end{macrocode}
+% \end{variable}
+% \end{variable}
+%
+% \begin{variable}{\l_@@_hscale_fp}
+% \begin{variable}{\l_@@_scale_factor_fp}
+% \begin{variable}{\l_@@_vscale_fp}
+% Floating point values.
+% \begin{macrocode}
+\fp_new:N \l_@@_hscale_fp
+\fp_new:N \l_@@_scale_factor_fp
+\fp_new:N \l_@@_vscale_fp
+% \end{macrocode}
+% \end{variable}
+% \end{variable}
+% \end{variable}
+%
+% \begin{variable}{\l_@@_denominator_font_tl}
+% \begin{variable}{\l_@@_numerator_font_tl}
+% \begin{variable}{\l_@@_phantom_tl }
+% \begin{variable}{\l_@@_slash_symbol_tl}
+% \begin{variable}{\l_@@_slash_symbol_font_tl}
+% Token lists, which include floating-point numbers and math(s)
+% skips.
+% \begin{macrocode}
+\tl_new:N \l_@@_denominator_font_tl
+\tl_new:N \l_@@_numerator_font_tl
+\tl_new:N \l_@@_phantom_tl
+\tl_new:N \l_@@_slash_symbol_tl
+\tl_new:N \l_@@_slash_symbol_font_tl
+% \end{macrocode}
+% \end{variable}
+% \end{variable}
+% \end{variable}
+% \end{variable}
+% \end{variable}
+%
+% \begin{macro}{\@@_fontscale:}
+% \begin{macro}{\@@_math:n}
+% \begin{macro}{\@@_denominator_font_change:}
+% \begin{macro}{\@@_denominator_format:n}
+% \begin{macro}{\@@_numerator_font_change:}
+% \begin{macro}{\@@_numerator_format:n}
+% \begin{macro}{\@@_relscale:}
+% \begin{macro}{\@@_slash_symbol_font_change:}
+% \begin{macro}{\@@_slash_symbol_format:n}
+% \begin{macro}{\@@_text_or_math:n}
+% Functions, either things which are calculated \enquote{on the fly}
+% (no argument required) or are functions taking one argument in the
+% code.
+% \begin{macrocode}
+\cs_new:Npn \@@_fontscale: { }
+\cs_new:Npn \@@_math:n #1 { }
+\cs_new:Npn \@@_denominator_font_change: { }
+\cs_new:Npn \@@_denominator_format:n #1 { }
+\cs_new:Npn \@@_numerator_font_change: { }
+\cs_new:Npn \@@_numerator_format:n #1 { }
+\cs_new:Npn \@@_relscale: { }
+\cs_new:Npn \@@_slash_symbol_font_change: { }
+\cs_new:Npn \@@_slash_symbol_format:n #1 { }
+\cs_new:Npn \@@_text_or_math:n #1 { }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{The template}
+%
+% There is only one object type in \pkg{xfrac}, rather unimaginatively
+% named \texttt{xfrac}.
+% \begin{macrocode}
+\IfFormatAtLeastTF { 2024-06-01 }
+ { \NewTemplateType }
+ { \DeclareObjectType }
+ { xfrac } { 3 }
+% \end{macrocode}
+%
+% A single template interface is used for both text and math(s), which
+% does make a few things a little complex later.
+% \begin{macrocode}
+\DeclareTemplateInterface { xfrac } { text } { 3 }
+ {
+ denominator-bot-sep : length = \c_max_dim ,
+ denominator-font : tokenlist = \f@family ,
+ denominator-format : function 1 = #1 ,
+ h-scale : real = 1 ,
+ math-mode : choice { false , true }
+ = false ,
+ numerator-font : tokenlist = \f@family ,
+ numerator-format : function 1 = #1 ,
+ numerator-bot-sep : length = \c_max_dim ,
+ numerator-top-sep : length = \c_max_dim ,
+ phantom : tokenlist = 8 ,
+ scale-factor : real = 0.83333 ,
+ scale-relative : choice { false , true }
+ = true ,
+ scaling : choice { false , true }
+ = true ,
+ slash-left-kern : length = 0 pt ,
+ slash-left-mkern : muskip = -2 mu ,
+ slash-right-kern : length = 0 pt ,
+ slash-right-mkern : muskip = -1 mu ,
+ slash-symbol : tokenlist = \textfractionsolidus ,
+ slash-symbol-font : tokenlist = \f@family ,
+ slash-symbol-format : function 1 = #1 ,
+ v-scale : real = 1 ,
+ }
+% \end{macrocode}
+% Most of the variable binding is quite simple: of course, the choices
+% are a little more complicated. That is particularly true where
+% these have to set up \enquote{on the fly} functions.
+% \begin{macrocode}
+\DeclareTemplateCode { xfrac } { text } { 3 }
+ {
+ denominator-bot-sep = \l_@@_denominator_bot_sep_dim ,
+ denominator-font = \l_@@_denominator_font_tl ,
+ denominator-format = \@@_denominator_format:n ,
+ h-scale = \l_@@_hscale_fp ,
+ math-mode =
+ {
+ false = \cs_set_eq:NN \@@_math:n \use:n,
+ true = \cs_set_eq:NN \@@_math:n \ensuremath
+ },
+ numerator-font = \l_@@_numerator_font_tl ,
+ numerator-format = \@@_numerator_format:n ,
+ numerator-bot-sep = \l_@@_numerator_bot_sep_dim ,
+ numerator-top-sep = \l_@@_numerator_top_sep_dim ,
+ phantom = \l_@@_phantom_tl ,
+ scale-factor = \l_@@_scale_factor_fp ,
+ scale-relative =
+ {
+ false =
+ \cs_set:Npn \@@_relscale:
+ {
+ \dim_eval:n
+ { \box_ht:N \l_@@_tmp_box + \box_dp:N \l_@@_tmp_box }
+ },
+ true =
+ \cs_set:Npn \@@_relscale:
+ { \dim_eval:n { \box_ht:N \l_@@_slash_box } }
+ },
+ scaling =
+ {
+ false = \cs_set_eq:NN \@@_fontscale: \prg_do_nothing:,
+ true =
+ \cs_set:Npn \@@_fontscale:
+ {
+ \fontsize
+ { \fp_to_dim:n { \l_@@_scale_factor_fp * \@@_relscale: } }
+ { \c_zero_dim }
+ \selectfont
+ }
+ },
+ slash-left-kern = \l_@@_slash_left_sep_dim ,
+ slash-left-mkern = \l_@@_slash_left_muskip ,
+ slash-right-kern = \l_@@_slash_right_sep_dim ,
+ slash-right-mkern = \l_@@_slash_right_muskip ,
+ slash-symbol = \l_@@_slash_symbol_tl ,
+ slash-symbol-font = \l_@@_slash_symbol_font_tl ,
+ slash-symbol-format = \@@_slash_symbol_format:n ,
+ v-scale = \l_@@_vscale_fp
+ }
+% \end{macrocode}
+% The implementation part starts with applying all of the settings
+% from above. The first part of the set up is then to determine
+% whether the surroundings are text or math(s), and react accordingly.
+% \begin{macrocode}
+ {
+ \mode_if_math:TF
+ {
+ \cs_set_eq:NN \@@_text_or_math:n \text
+ \cs_set:Npe \@@_denominator_font_change:
+ { \tex_fam:D \l_@@_denominator_font_tl }
+ \cs_set:Npe \@@_numerator_font_change:
+ { \tex_fam:D \l_@@_numerator_font_tl }
+ \cs_set:Npe \@@_slash_symbol_font_change:
+ { \tex_fam:D \l_@@_slash_symbol_font_tl }
+ }
+ {
+ \cs_set_eq:NN \@@_text_or_math:n \mbox
+ \cs_set:Npn \@@_denominator_font_change:
+ {
+ \fontfamily { \l_@@_denominator_font_tl }
+ \selectfont
+ }
+ \cs_set:Npn \@@_numerator_font_change:
+ {
+ \fontfamily { \l_@@_numerator_font_tl }
+ \selectfont
+ }
+ \cs_set:Npn \@@_slash_symbol_font_change:
+ {
+ \fontfamily { \l_@@_slash_symbol_font_tl }
+ \selectfont
+ }
+ }
+% \end{macrocode}
+% Everything is now either inside \cs{text} or an \cs{mbox}, depending
+% upon the surroundings. First, there are some boxes to set up.
+% \begin{macrocode}
+ \@@_text_or_math:n
+ {
+ \m@th
+ \hbox_set:Nn \l_@@_tmp_box
+ { \@@_math:n { \vphantom { ( ) } } }
+ \hbox_set:Nn \l_@@_slash_box
+ {
+ \@@_math:n
+ {
+ \@@_slash_symbol_format:n
+ {
+ \@@_math:n
+ {
+ \@@_slash_symbol_font_change:
+ \IfNoValueTF {#2}
+ { \l_@@_slash_symbol_tl } {#2}
+ }
+ }
+ }
+ }
+% \end{macrocode}
+% Check on the numerator separator dimensions. The code starts with the
+% assumption that neither has been given, as this can then be used to
+% set up a default, which is also used when both values are set
+% erroneously.
+% \begin{macrocode}
+ \cs_set:Npn \@@_tmp:w
+ {
+ \raisebox
+ {
+ \dim_eval:n
+ {
+ \box_ht:N \l_@@_slash_box
+ - \box_dp:N \l_@@_slash_box
+ - \height
+ }
+ }
+ }
+ \dim_compare:nNnTF
+ { \l_@@_numerator_top_sep_dim } = { \c_max_dim }
+ {
+ \dim_compare:nNnF
+ { \l_@@_numerator_bot_sep_dim } = { \c_max_dim }
+ {
+ \cs_set:Npn \@@_tmp:w
+ {
+ \raisebox
+ { \dim_use:N \l_@@_numerator_bot_sep_dim }
+ }
+ }
+ }
+ {
+ \dim_compare:nNnTF
+ { \l_@@_numerator_bot_sep_dim } = { \c_max_dim }
+ {
+ \cs_set:Npn \@@_tmp:w
+ {
+ \raisebox
+ {
+ \dim_eval:n
+ {
+ \box_ht:N \l_@@_slash_box
+ - \dim_use:N \l_@@_numerator_top_sep_dim
+ - \height
+ }
+ }
+ }
+ }
+ {
+ \msg_error:nn { xfrac }
+ { over-specified-numerator-sep }
+ }
+ }
+% \end{macrocode}
+% Typeset the numerator.
+% \begin{macrocode}
+ \@@_tmp:w
+ {
+ \@@_fontscale:
+ \@@_numerator_format:n
+ {
+ \scalebox
+ { \fp_use:N \l_@@_hscale_fp }
+ [ \fp_use:N \l_@@_vscale_fp ]
+ {
+ \@@_math:n
+ {
+ \@@_numerator_font_change:
+ {
+ \vphantom { \l_@@_phantom_tl }
+ #1
+ }
+ }
+ }
+ }
+ }
+ \@@_math:n
+ { % THIS IS JUST WRONG!
+ \mode_if_math:TF
+ { \tex_mskip:D \l_@@_slash_right_muskip }
+ { \tex_hskip:D \l_@@_slash_right_sep_dim }
+ }
+% \end{macrocode}
+% Typeset the separator.
+% \begin{macrocode}
+ \box_use:N \l_@@_slash_box
+ \@@_math:n
+ {
+ \mode_if_math:TF
+ { \tex_mskip:D \l_@@_slash_left_muskip }
+ { \tex_hskip:D \l_@@_slash_left_sep_dim }
+ }
+% \end{macrocode}
+% Typeset the denominator.
+% \begin{macrocode}
+ \dim_compare:nNnTF
+ { \l_@@_denominator_bot_sep_dim } = { \c_max_dim }
+ {
+ \cs_set:Npn \@@_tmp:w
+ { \raisebox { - \box_dp:N \l_@@_slash_box } }
+ }
+ {
+ \cs_set:Npn \@@_tmp:w
+ {
+ \raisebox
+ { \dim_use:N \l_@@_denominator_bot_sep_dim }
+ }
+ }
+ \@@_tmp:w
+ {
+ \@@_fontscale:
+ \@@_denominator_format:n
+ {
+ \scalebox
+ { \fp_use:N \l_@@_hscale_fp }
+ [ \fp_use:N \l_@@_vscale_fp ]
+ {
+ \@@_math:n
+ {
+ \@@_denominator_font_change:
+ {
+ \vphantom { \l_@@_phantom_tl }
+ #3
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+% \end{macrocode}
+%
+% Since math(s) and text mode are wildly different entities we define a
+% separate template for each. You already saw the \enquote{text}
+% template, and here is the \enquote{math} template.
+% \begin{macrocode}
+\IfFormatAtLeastTF { 2024-06-01 }
+ {
+ \DeclareTemplateCopy { xfrac } { math } { text }
+ \EditTemplateDefaults { xfrac } { math }
+ }
+ { \DeclareRestrictedTemplate { xfrac } { text } { math } }
+ {
+ numerator-font = \number \fam ,
+ slash-symbol = / ,
+ slash-symbol-font = \number \fam ,
+ denominator-font = \number \fam ,
+ scale-factor = 0.7 ,
+ scale-relative = false ,
+ scaling = true ,
+ denominator-bot-sep = 0 pt ,
+ math-mode = true ,
+ phantom = ( % )
+ }
+% \end{macrocode}
+%
+%\subsection{The standard instances}
+%
+% For the default instances we just use the relevant templates with
+% the default settings.
+%
+% The default \enquote{text} instance.
+% \begin{macrocode}
+\DeclareInstance { xfrac } { default } { text } { }
+% \end{macrocode}
+%
+% The default \enquote{math(s)} instance. We annot set the
+% |numerator-top-sep| in the restricted template above.
+% \begin{macrocode}
+\DeclareInstance { xfrac } { mathdefault } { math }
+ { numerator-top-sep = 0pt }
+% \end{macrocode}
+%
+% Default Computer Modern setup. Far from optimal, but better than
+% nothing.
+% \begin{macrocode}
+\DeclareInstance { xfrac } { cmr } { text }
+ {
+ denominator-bot-sep = 0 pt ,
+ numerator-top-sep = 0.2 ex ,
+ slash-left-kern = -0.1 em ,
+ slash-right-kern = -0.1 em
+ }
+\DeclareInstance { xfrac } { cmss } { text }
+ {
+ denominator-bot-sep = 0 pt ,
+ numerator-top-sep = 0.2 ex ,
+ slash-left-kern = -0.1 em ,
+ slash-right-kern = -0.1 em
+ }
+\DeclareInstance { xfrac } { cmtt } { text }
+ {
+ denominator-bot-sep = 0 pt ,
+ numerator-top-sep = 0.2 ex ,
+ slash-left-kern = -0.1 em ,
+ slash-right-kern = -0.1 em
+ }
+% \end{macrocode}
+%
+% We can do better for the Computer Modern fonts. For cmr and cmss
+% we choose Times, and for cmtt use Palatino.
+% \begin{macrocode}
+\bool_if:NF \l_@@_cm_std_bool
+ {
+ \DeclareInstance { xfrac } { cmr } { text }
+ { slash-symbol-font = ptm }
+ \DeclareInstance { xfrac } { cmss } { text }
+ { slash-symbol-font = ptm }
+ \DeclareInstance { xfrac } { cmtt } { text }
+ { slash-symbol-font = ppl }
+ }
+% \end{macrocode}
+%
+% Things works slightly better with Latin Modern.
+% \begin{macrocode}
+\DeclareInstance { xfrac } { lmr } { text }
+ {
+ denominator-bot-sep = 0 pt ,
+ numerator-top-sep = 0.1 ex ,
+ slash-left-kern = -0.15 em ,
+ slash-right-kern = -0.15 em
+ }
+\DeclareInstance { xfrac } { lmss } { text }
+ {
+ denominator-bot-sep = 0 pt ,
+ numerator-top-sep = 0 pt ,
+ slash-left-kern = -0.15 em ,
+ slash-right-kern = -0.15 em
+ }
+\DeclareInstance { xfrac } { lmtt } { text }
+ {
+ denominator-bot-sep = 0 pt ,
+ numerator-top-sep = 0 pt ,
+ slash-left-kern = -0.15 em ,
+ slash-right-kern = -0.15 em
+ }
+% \end{macrocode}
+%
+% \subsection{The user command}
+%
+% \begin{macro}{\sfrac}
+% Currently there is just a single user command. \cs{sfrac} takes
+% two mandatory arguments: numerator and denominator. It can take an
+% optional argument between the mandatory specifying the separator
+% like this:
+% \begin{verbatim}
+% \sfrac{7}[/]{12}
+% \end{verbatim}
+% It also has an optional argument that comes before the first
+% mandatory argument. If used it will use that instance instead of
+% the auto-detected one, so a user who has defined the instance
+% \enquote{cmr2} may use
+% \begin{verbatim}
+% \sfrac[cmr2]{7}{12}
+% \end{verbatim}
+% and get the settings from \enquote{cmr2} instead of the settings of
+% the current font family.
+% \begin{macrocode}
+\NewDocumentCommand \sfrac { o m o m }
+ {
+ \mode_if_math:TF
+ {
+ \IfInstanceExistTF { xfrac } { mathfam \number \fam }
+ { \UseInstance { xfrac } { mathfam \number \fam } }
+ { \UseInstance { xfrac } { mathdefault } }
+ {#2} {#3} {#4}
+ }
+ {
+ \IfInstanceExistTF { xfrac } {#1}
+ { \UseInstance { xfrac } {#1} }
+ {
+ \IfInstanceExistTF { xfrac } { \f@family }
+ { \UseInstance { xfrac } { \f@family } }
+ { \UseInstance { xfrac } { default } }
+ }
+ {#2} {#3} {#4}
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Messages}
+%
+% Just the one.
+% \begin{macrocode}
+\msg_new:nnnn { xfrac } { over-specified-numerator-sep }
+ { You~have~specified~both~"numerator-top-sep"~and~"numerator-bot-sep". }
+ { I~will~pretend~that~you~didn't~specify~either~of~them. }
+% \end{macrocode}
+%
+% \begin{macrocode}
+%</package>
+% \end{macrocode}
+%
+% \end{implementation}
+%
+% \PrintIndex
diff --git a/macros/latex/contrib/xfrac/xfrac.ins b/macros/latex/contrib/xfrac/xfrac.ins
new file mode 100644
index 0000000000..aec317dbb3
--- /dev/null
+++ b/macros/latex/contrib/xfrac/xfrac.ins
@@ -0,0 +1,49 @@
+\iffalse meta-comment
+
+File: xfrac.ins
+
+Copyright (C) 2004,2008-2010 Morten Hoegholm
+ (C) 2011,2012,2016,2017,2019-2024 The LaTeX Project
+
+It may be distributed and/or modified under the conditions of the
+LaTeX Project Public License (LPPL), either version 1.3c of this
+license or (at your option) any later version. The latest version
+of this license is in the file
+
+ http://www.latex-project.org/lppl.txt
+
+This file is part of the "l3packages bundle" (The Work in LPPL)
+and all files in that bundle must be distributed together.
+
+The released version of this bundle is available from CTAN.
+
+\fi
+
+\input docstrip %
+\askforoverwritefalse
+
+\preamble
+
+Copyright (C) 2004,2008-2010 Morten Hoegholm
+ (C) 2011-2024 The LaTeX Project
+
+It may be distributed and/or modified under the conditions of
+the LaTeX Project Public License (LPPL), either version 1.3c of
+this license or (at your option) any later version. The latest
+version of this license is in the file:
+
+ http://www.latex-project.org/lppl.txt
+
+This file is part of the "l3packages bundle" (The Work in LPPL)
+and all files in that bundle must be distributed together.
+
+\endpreamble
+% stop docstrip adding \endinput
+\postamble
+\endpostamble
+
+\keepsilent
+
+\generate{\file{xfrac.sty} {\from{xfrac.dtx} {package}}}
+
+\endbatchfile
diff --git a/macros/latex/contrib/xfrac/xfrac.pdf b/macros/latex/contrib/xfrac/xfrac.pdf
new file mode 100644
index 0000000000..e79462c3dd
--- /dev/null
+++ b/macros/latex/contrib/xfrac/xfrac.pdf
Binary files differ