diff options
author | Norbert Preining <norbert@preining.info> | 2020-10-07 03:00:49 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-10-07 03:00:49 +0000 |
commit | 6a2f87148a137f5014278229a8175b7babf238cf (patch) | |
tree | 9dcfc63f084f80d07d68442a837f468630f71b98 /macros | |
parent | 2884d8fdd76b2def1d759c76c03141710c219ad7 (diff) |
CTAN sync 202010070300
Diffstat (limited to 'macros')
21 files changed, 1682 insertions, 438 deletions
diff --git a/macros/latex/contrib/nicematrix/nicematrix-french.pdf b/macros/latex/contrib/nicematrix/nicematrix-french.pdf Binary files differindex 1b03c3ddec..c60b8277c7 100644 --- a/macros/latex/contrib/nicematrix/nicematrix-french.pdf +++ b/macros/latex/contrib/nicematrix/nicematrix-french.pdf diff --git a/macros/latex/contrib/nicematrix/nicematrix-french.tex b/macros/latex/contrib/nicematrix/nicematrix-french.tex index ede56a3b74..6f158b920f 100644 --- a/macros/latex/contrib/nicematrix/nicematrix-french.tex +++ b/macros/latex/contrib/nicematrix/nicematrix-french.tex @@ -32,6 +32,7 @@ \usepackage{multicol} \setlength{\columnseprule}{0.4pt} +\def\LetterAt{@} \def\interitem{\vspace{7mm plus 2 mm minus 3mm}} \def\emphase{\bgroup\color{RoyalPurple}\let\next=} @@ -404,9 +405,12 @@ $A=\begin{pNiceArray}{cc|cc}[baseline=line-3] \section{Les blocs} \label{Block} + +\subsection{Cas général} + + Dans les environnements de \pkg{nicematrix}, on peut utiliser la commande -|\Block| pour placer un élément au centre d'un rectangle de cases fusionnées. La -commande |\Block| ne crée pas d'espace par elle-même. +|\Block| pour placer un élément au centre d'un rectangle de cases fusionnées. La commande |\Block| doit être utilisée dans la case supérieure gauche du bloc avec deux arguments. Le premier argument est la taille de ce bloc avec la @@ -416,11 +420,92 @@ bloc. Le deuxième argument, est, sans surprise, le contenu du bloc. Dans |{NiceTabular}|, le contenu est composé en mode texte. Dans les autres environnements, il est composé en mode mathématique. + +\interitem +Voici un exemple d'utilisation de la commande |\Block| dans une matrice mathématique. + +\medskip +\begin{BVerbatim}[baseline=c,boxwidth=10.6cm] +$\begin{bNiceArray}{ccc|c}[margin] +~emphase#\Block{3-3}{A}@ & & & 0 \\ +& \hspace*{1cm} & & \Vdots \\ +& & & 0 \\ +\hline +0 & \Cdots& 0 & 0 +\end{bNiceArray}$ +\end{BVerbatim} +$\begin{bNiceArray}{ccc|c}[margin] +\Block{3-3}{A} & & & 0 \\ +& \hspace*{1cm} & & \Vdots \\ +& & & 0 \\ +\hline +0 & \Cdots& 0 & 0 +\end{bNiceArray}$ + +\bigskip +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 +utiliser une commande comme |\large|, |\Large| ou |\LARGE|. C'est pourquoi une +option à mettre entre chevrons est proposée par |\Block| pour spécifier du code +LaTeX qui sera inséré \emph{avant} le début du mode mathématique. + +\medskip +\begin{BVerbatim}[baseline=c,boxwidth=10.6cm] +$\begin{bNiceArray}{ccc|c}[margin] +\Block{3-3}~emphase#<\LARGE>@{A} & & & 0 \\ +& \hspace*{1cm} & & \Vdots \\ +& & & 0 \\ +\hline +0 & \Cdots& 0 & 0 +\end{bNiceArray}$ +\end{BVerbatim} +$\begin{bNiceArray}{ccc|c}[margin] +\Block{3-3}<\LARGE>{A} & & & 0 \\ +& \hspace*{1cm} & & \Vdots \\ +& & & 0 \\ +\hline +0 & \Cdots& 0 & 0 +\end{bNiceArray}$ + + +\bigskip +On peut régler le positionnement horizontal du bloc avec l'une des clés |l|, |c| +et |r|. + + +\medskip +\begin{BVerbatim}[baseline=c,boxwidth=10.6cm] +$\begin{bNiceArray}{ccc|c}[margin] +\Block~emphase#[r]@{3-3}<\LARGE>{A} & & & 0 \\ +& \hspace*{1cm} & & \Vdots \\ +& & & 0 \\ +\hline +0 & \Cdots& 0 & 0 +\end{bNiceArray}$ +\end{BVerbatim} +$\begin{bNiceArray}{ccc|c}[margin] +\Block[r]{3-3}<\LARGE>{A} & & & 0 \\ +& \hspace*{1cm} & & \Vdots \\ +& & & 0 \\ +\hline +0 & \Cdots& 0 & 0 +\end{bNiceArray}$ + + +\interitem +\textbf{On doit remarquer que, par défaut, les blocs ne créent pas d'espace} +(seuls les blocks mono-colonne font exception dans une certaine mesure : voir +plus bas). + +\medskip +Dans l'exemple suivant, on a dû élargir à la main les colonnes 2 et 3 (avec la +construction |wc{...}| de \pkg{array}). + \medskip \begin{BVerbatim} -\begin{NiceTabular}{cccc} +\begin{NiceTabular}~emphase#{cwc{2cm}wc{3cm}c}@ rose & tulipe & marguerite & dahlia \\ -violette & ~emphase#\Block{2-2}{\LARGE\color{blue} fleurs}@ & & souci \\ +violette & \Block{2-2}{\LARGE\color{blue}De très jolies fleurs} & & souci \\ pervenche & & & lys \\ arum & iris & jacinthe & muguet \end{NiceTabular} @@ -429,16 +514,69 @@ arum & iris & jacinthe & muguet \medskip \begin{center} -\begin{NiceTabular}{cccc} +\begin{NiceTabular}{cwc{2cm}wc{3cm}c} rose & tulipe & marguerite & dahlia \\ -violette & \Block{2-2}{\LARGE\color{blue} fleurs} & & souci \\ +violette & \Block{2-2}{\LARGE\color{blue}De très jolies fleurs} & & souci \\ pervenche & & & lys \\ arum & iris & jacinthe & muguet \end{NiceTabular} \end{center} -\interitem On remarquera que le centrage horizontal du contenu des blocs est + +\subsection{Les blocs mono-colonne} + +\colorbox{yellow!50}{\textbf{Nouveau 5.4}}\enskip Les blocs mono-colonne ont un +comportement spécial. +\begin{itemize} +\item La largeur naturelle du contenu de ces blocs est prise en compte pour la +largeur de la colonne courante. + +\item La spécification d'alignement horizontal donnée par le type de +colonne (|c|, |r| ou |l|) est prise en compte pour le bloc (mais le bloc peut +avoir sa propre specification d'alignement horizontal). + +\item Les spécifications de fontes imposées à une colonne via la construction +|>{...}| dans le préambule du tableau sont prises en compte pour les +blocs mono-colonne de cette colonne (ce comportement est assez naturel). +\end{itemize} + + +\medskip +\begin{scope} +\hfuzz=10cm +\begin{BVerbatim}[baseline=c,boxwidth=12cm] +\begin{NiceTabular}{~LetterAt{}>{\bfseries}lr~LetterAt{}} \hline +\Block{2-1}{Pierre} & 12 \\ + & 13 \\ \hline +Jacques & 8 \\ \hline +\Block{3-1}{Stéphanie} & 18 \\ + & 17 \\ + & 15 \\ \hline +Amélie & 20 \\ \hline +Henri & 14 \\ \hline +\Block{2-1}{Estelle} & 15 \\ + & 19 \\ \hline +\end{NiceTabular} +\end{BVerbatim} +\begin{NiceTabular}{@{}>{\bfseries}lr@{}} \hline +\Block{2-1}{Pierre} & 12 \\ + & 13 \\ \hline +Jacques & 8 \\ \hline +\Block{3-1}{Stéphanie} & 18 \\ + & 17 \\ + & 15 \\ \hline +Amélie & 20 \\ \hline +Henri & 14 \\ \hline +\Block{2-1}{Estelle} & 15 \\ + & 19 \\ \hline +\end{NiceTabular} +\end{scope} + + +\subsection{Petite remarque} + +On remarquera que le centrage horizontal du contenu des blocs est correct même si un espacement des colonnes a été demandé par une instruction comme |!{\qquad}| dans le préambule (ce n'est pas le cas avec |\multicolumn|). Dans l'exemple suivant, l'en-tête «Premier groupe» est correctement centré. @@ -476,55 +614,6 @@ Rang & 1A & 1B & 1C & 2A & 2B & 2C \\ \end{NiceTabular} \end{center} -\interitem -\colorbox{yellow!50}{\textbf{Nouveau 5.3}}\enskip La commande |\Block| accepte -les options |l|, |c| et |r| pour le placement horizontal. - -\interitem -On peut aussi utiliser la commande |\Block| dans des matrices mathématiques. - -\medskip -\begin{BVerbatim}[baseline=c,boxwidth=10.6cm] -$\begin{bNiceArray}{ccc|c}[margin] -~emphase#\Block{3-3}{A}@ & & & 0 \\ -& \hspace*{1cm} & & \Vdots \\ -& & & 0 \\ -\hline -0 & \Cdots& 0 & 0 -\end{bNiceArray}$ -\end{BVerbatim} -$\begin{bNiceArray}{ccc|c}[margin] -\Block{3-3}{A} & & & 0 \\ -& \hspace*{1cm} & & \Vdots \\ -& & & 0 \\ -\hline -0 & \Cdots& 0 & 0 -\end{bNiceArray}$ - -\bigskip -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 -utiliser une commande comme |\large|, |\Large| ou |\LARGE|. C'est pourquoi une -option à mettre entre chevrons est proposée par |\Block| pour spécifier du code -LaTeX qui sera inséré \emph{avant} le début du mode mathématique. - -\medskip -\begin{BVerbatim}[baseline=c,boxwidth=10.6cm] -$\begin{bNiceArray}{ccc|c}[margin] -\Block{3-3}~emphase#<\LARGE>@{A} & & & 0 \\ -& \hspace*{1cm} & & \Vdots \\ -& & & 0 \\ -\hline -0 & \Cdots& 0 & 0 -\end{bNiceArray}$ -\end{BVerbatim} -$\begin{bNiceArray}{ccc|c}[margin] -\Block{3-3}<\LARGE>{A} & & & 0 \\ -& \hspace*{1cm} & & \Vdots \\ -& & & 0 \\ -\hline -0 & \Cdots& 0 & 0 -\end{bNiceArray}$ \section{Les filets horizontaux et verticaux} @@ -1146,31 +1235,30 @@ englober les blocs. \begin{BVerbatim}[baseline=c,boxwidth=9cm] \begin{NiceTabular}{lr}[hvlines,code-before = ~emphase#\rowcolors{1}{blue!10}{}[respect-blocks]@] -\Block[l]{2-1}{Pierre} & 12 \\ +\Block{2-1}{Pierre} & 12 \\ & 13 \\ -Jacques & 8 \\ -\hphantom{Stéphanie} -\Block[l]{3-1}{Stéphanie} & 18 \\ - & 17 \\ - & 15 \\ -Amélie & 20 \\ -Henri & 14 \\ -\Block[l]{2-1}{Estelle} & 15 \\ - & 19 +Jacques & 8 \\ +\Block{3-1}{Stéphanie} & 18 \\ + & 17 \\ + & 15 \\ +Amélie & 20 \\ +Henri & 14 \\ +\Block{2-1}{Estelle} & 15 \\ + & 19 \end{NiceTabular} \end{BVerbatim} -\begin{NiceTabular}{lr}[hvlines,code-before = \rowcolors{1}{blue!10}{}[respect-blocks],baseline=c] -\Block[l]{2-1}{Pierre} & 12 \\ - & 13 \\ -Jacques & 8 \\ -\hphantom{Stéphanie} -\Block[l]{3-1}{Stéphanie} & 18 \\ +\begin{NiceTabular}{lr}[hvlines,code-before = +\rowcolors{1}{blue!10}{}[respect-blocks],baseline=c] +\Block{2-1}{Pierre} & 12 \\ + & 13 \\ +Jacques & 8 \\ +\Block{3-1}{Stéphanie} & 18 \\ & 17 \\ & 15 \\ -Amélie & 20 \\ -Henri & 14 \\ -\Block[l]{2-1}{Estelle} & 15 \\ - & 19 +Amélie & 20 \\ +Henri & 14 \\ +\Block{2-1}{Estelle} & 15 \\ + & 19 \end{NiceTabular} \end{scope} @@ -1271,7 +1359,7 @@ autre commande, elle-même utilisée dans le préambule). \medskip \begin{Verbatim} -\NewDocumentCommand { \Blue } { } { ~emphase#\columncolor{blue!15}@ } +\NewDocumentCommand { \Blue } { } {~emphase#\columncolor{blue!15}@} \begin{NiceTabular}[colortbl-like]{>{\Blue}c>{\Blue}cc} \toprule ~emphase#\rowcolor{red!15}@ @@ -1287,7 +1375,7 @@ Dupont & Chantal & 15 janvier 1998 \\ \begin{center} -\NewDocumentCommand { \Blue } { } { \columncolor{blue!15} } +\NewDocumentCommand { \Blue } { } {\columncolor{blue!15}} \begin{NiceTabular}[colortbl-like]{>{\Blue}c>{\Blue}cc} \toprule \rowcolor{red!15} @@ -2269,7 +2357,8 @@ Dupont & Chantal & 15 janvier 1998 \\ \caption{Utilisation de \texttt{\textbackslash tabularnote}\tabularnote{On peut mettre une note dans le titre.}} \label{t:tabularnote} -\begin{NiceTabular}{@{}llc@{}}[notes/bottomrule] +\begin{NiceTabular}{@{}llc@{}}% + [notes/bottomrule, tabularnote = Un peu de texte avant les notes.] \toprule Nom & Prénom & Durée de vie \\ \midrule @@ -2304,6 +2393,10 @@ colonne). \item Si la clé |notes/para| est utilisée, les notes sont composées à la fin du tableau en un seul paragraphe. +\item \colorbox{yellow!50}{\textbf{Nouveau 5.4}}\enskip +Il existe une clé |tabularnote| qui permet d'insérer du texte dans la zone +des notes avant les notes numérotées. + \item Si l'extension \pkg{booktabs} a été chargée (avant ou après \pkg{nicematrix}), la clé |notes/bottomrule| permet de faire tracer un |\bottomrule| de \pkg{booktabs} \emph{après} les notes. @@ -2325,7 +2418,8 @@ remarques illustrées. Cette table a été composée avec le code suivant. tabularnote}~emphase#\tabularnote{On peut! ~emphase# mettre une note dans le titre.}!} \label{t:tabularnote} -\begin{NiceTabular}{@{}llc@{}}[~emphase#notes/bottomrule!] +\begin{NiceTabular}{@{}llc@{}}% + [~emphase#notes/bottomrule!, tabularnote = Un peu de texte avant les notes.] \toprule Nom & Prénom & Durée de vie \\ \midrule @@ -3436,7 +3530,7 @@ a+b & \Cdots & a+b & 1 \colorbox{yellow!50}{\textbf{Nouveau 5.3}}\enskip On peut choisir l'instruction |\Ddots| qui sera tracée en premier (et qui servira pour tracer les suivantes quand la parallélisation est activée) avec la clé |draw-first| : - |\Ddots[draw-first]|. + |\Ddots[draw-first]|\rlap{.} \subsection{Les cases «vides»} diff --git a/macros/latex/contrib/nicematrix/nicematrix.dtx b/macros/latex/contrib/nicematrix/nicematrix.dtx index 03a6705cd3..22c7112ee0 100644 --- a/macros/latex/contrib/nicematrix/nicematrix.dtx +++ b/macros/latex/contrib/nicematrix/nicematrix.dtx @@ -15,8 +15,8 @@ % % \fi % \iffalse -\def\myfileversion{5.3} -\def\myfiledate{2020/09/03} +\def\myfileversion{5.4} +\def\myfiledate{2020/10/06} % % %<*batchfile> @@ -68,6 +68,7 @@ version 2005/12/01 or later. \setlength{\columnseprule}{0.4pt} \usepackage{footnotehyper} \usepackage{varwidth} +\def\LetterAt{@} \parindent 0pt \EnableCrossrefs @@ -444,9 +445,11 @@ version 2005/12/01 or later. % \section{The blocks} % \label{Block} % +% \subsection{General case} +% % In the environments of \pkg{nicematrix}, it's possible to use the command % |\Block| in order to place an element in the center of a rectangle of merged -% cells of the array. The command |\Block| don't create space by itself. +% cells of the array. % % The command |\Block| must be used in the upper leftmost cell of the array with % two arguments. The first argument is the size of the block with the syntax @@ -456,11 +459,93 @@ version 2005/12/01 or later. % In |{NiceTabular}| the content of the block is composed in text mode. In the % other environments, it is composed in math mode. % +% +% \interitem +% Here is an example of utilisation of the command |\Block| in mathematical matrices. +% +% \medskip +% \begin{BVerbatim}[baseline=c,boxwidth=10.6cm] +% $\begin{bNiceArray}{ccc|c}[margin] +% ~emphase#\Block{3-3}{A}@ & & & 0 \\ +% & \hspace*{1cm} & & \Vdots \\ +% & & & 0 \\ +% \hline +% 0 & \Cdots& 0 & 0 +% \end{bNiceArray}$ +% \end{BVerbatim} +% $\begin{bNiceArray}{ccc|c}[margin] +% \Block{3-3}{A} & & & 0 \\ +% & \hspace*{1cm} & & \Vdots \\ +% & & & 0 \\ +% \hline +% 0 & \Cdots& 0 & 0 +% \end{bNiceArray}$ +% +% \bigskip +% One may wish to raise the size of the ``$A$'' placed in the block of the +% previous example. Since this element is composed in math mode, it's not +% possible to use directly a command like |\large|, |\Large| and |\LARGE|. +% That's why the command |\Block| provides an option between angle brackets to +% specify some TeX code which will be inserted before the beginning of the +% math mode. +% +% \medskip +% \begin{BVerbatim}[baseline=c,boxwidth=10.6cm] +% $\begin{bNiceArray}{ccc|c}[margin] +% \Block{3-3}~emphase#<\Large>@{A} & & & 0 \\ +% & \hspace*{1cm} & & \Vdots \\ +% & & & 0 \\ +% \hline +% 0 & \Cdots& 0 & 0 +% \end{bNiceArray}$ +% \end{BVerbatim} +% \begin{scope} +% $\begin{bNiceArray}{ccc|c}[margin] +% \Block{3-3}<\Large>{A} & & & 0 \\ +% & \hspace*{1cm} & & \Vdots \\ +% & & & 0 \\ +% \hline +% 0 & \Cdots& 0 & 0 +% \end{bNiceArray}$ +% \end{scope} +% +% \medskip +% \colorbox{yellow!50}{\textbf{New 5.3}}\enskip It's possible to set the +% horizontal position of the block with one of the keys |l|, |c| and |r|. +% +% +% \medskip +% \begin{BVerbatim}[baseline=c,boxwidth=10.6cm] +% $\begin{bNiceArray}{ccc|c}[margin] +% \Block~emphase#[r]@{3-3}<\LARGE>{A} & & & 0 \\ +% & \hspace*{1cm} & & \Vdots \\ +% & & & 0 \\ +% \hline +% 0 & \Cdots& 0 & 0 +% \end{bNiceArray}$ +% \end{BVerbatim} +% $\begin{bNiceArray}{ccc|c}[margin] +% \Block[r]{3-3}<\LARGE>{A} & & & 0 \\ +% & \hspace*{1cm} & & \Vdots \\ +% & & & 0 \\ +% \hline +% 0 & \Cdots& 0 & 0 +% \end{bNiceArray}$ +% +% +% \interitem +% {\bfseries One must remark that, by default, the commands |\Blocks| don't create space} +% (excepted, to some extent, the mono-column blocks: see below). +% +% \medskip +% In the following example, we have had to enlarge by hand the columns 2 and 3 +% (with the construction |wc{...}| of \pkg{array}). +% % \medskip % \begin{BVerbatim} -% \begin{NiceTabular}{cccc} +% \begin{NiceTabular}~emphase#{cwc{2cm}wc{3cm}c}@ % rose & tulipe & marguerite & dahlia \\ -% violette & ~emphase#\Block{2-2}{\LARGE\color{blue} fleurs}@ & & souci \\ +% violette & \Block{2-2}{\LARGE\color{blue}De très jolies fleurs} & & souci \\ % pervenche & & & lys \\ % arum & iris & jacinthe & muguet % \end{NiceTabular} @@ -469,15 +554,68 @@ version 2005/12/01 or later. % % \medskip % \begin{center} -% \begin{NiceTabular}{cccc} +% \begin{NiceTabular}{cwc{2cm}wc{3cm}c} % rose & tulipe & marguerite & dahlia \\ -% violette & \Block{2-2}{\LARGE\color{blue} fleurs} & & souci \\ +% violette & \Block{2-2}{\LARGE\color{blue}De très jolies fleurs} & & souci \\ % pervenche & & & lys \\ % arum & iris & jacinthe & muguet % \end{NiceTabular} % \end{center} % -% \interitem +% +% \subsection{The mono-column blocks} +% +% % \colorbox{yellow!50}{\textbf{New 5.4}}\enskip The mono-column blocks have a +% special behaviour. +% +% \begin{itemize} +% \item The natural width of the contents of these blocks is taken into account +% for the width of the current column. +% +% \item The specification of the horizontal position provided by the type of +% column (|c|, |r| or |l|) is taken into account for the blocks. +% +% \item The specifications of font specified for the column by a construction +% |>{...}| in the preamble of the array are taken into account for the +% mono-column blocks of that column (this behaviour is probably expected). +% \end{itemize} +% +% +% \bigskip +% \begin{scope} +% \hfuzz=10cm +% \begin{BVerbatim}[baseline=c,boxwidth=12cm] +% \begin{NiceTabular}{~LetterAt{}>{\bfseries}lr~LetterAt{}} \hline +% \Block{2-1}{John} & 12 \\ +% & 13 \\ \hline +% Steph & 8 \\ \hline +% \Block{3-1}{Sarah} & 18 \\ +% & 17 \\ +% & 15 \\ \hline +% Ashley & 20 \\ \hline +% Henry & 14 \\ \hline +% \Block{2-1}{Madison} & 15 \\ +% & 19 \\ \hline +% \end{NiceTabular} +% \end{BVerbatim} +% \begin{NiceTabular}{@{}>{\bfseries}lr@{}}[baseline=c] \hline +% \Block{2-1}{John} & 12 \\ +% & 13 \\ \hline +% Steph & 8 \\ \hline +% \Block{3-1}{Sarah} & 18 \\ +% & 17 \\ +% & 15 \\ \hline +% Ashley & 20 \\ \hline +% Henry & 14 \\ \hline +% \Block{2-1}{Madison} & 15 \\ +% & 19 \\ \hline +% \end{NiceTabular} +% \end{scope} +% +% +% +% \subsection{A small remark} +% % One should remark that the horizontal centering of the contents of the blocks % is correct even when an instruction such as |!{\qquad}| has been used in the % preamble of the array in order to increase the space between two columns (this @@ -518,61 +656,6 @@ version 2005/12/01 or later. % \end{center} % % -% \interitem -% \colorbox{yellow!50}{\textbf{New 5.3}}\enskip -% -% It's possible to use with the command |\Block| the options |l|, |r| and |c| -% for the horizontal positionning. -% -% -% \interitem -% It's also possible to use the command |\Block| in mathematical matrices. -% -% \medskip -% \begin{BVerbatim}[baseline=c,boxwidth=10.6cm] -% $\begin{bNiceArray}{ccc|c}[margin] -% ~emphase#\Block{3-3}{A}@ & & & 0 \\ -% & \hspace*{1cm} & & \Vdots \\ -% & & & 0 \\ -% \hline -% 0 & \Cdots& 0 & 0 -% \end{bNiceArray}$ -% \end{BVerbatim} -% $\begin{bNiceArray}{ccc|c}[margin] -% \Block{3-3}{A} & & & 0 \\ -% & \hspace*{1cm} & & \Vdots \\ -% & & & 0 \\ -% \hline -% 0 & \Cdots& 0 & 0 -% \end{bNiceArray}$ -% -% \bigskip -% One may wish to raise the size of the ``$A$'' placed in the block of the -% previous example. Since this element is composed in math mode, it's not -% possible to use directly a command like |\large|, |\Large| and |\LARGE|. -% That's why the command |\Block| provides an option between angle brackets to -% specify some TeX code which will be inserted before the beginning of the -% math mode. -% -% \medskip -% \begin{BVerbatim}[baseline=c,boxwidth=10.6cm] -% $\begin{bNiceArray}{ccc|c}[margin] -% \Block{3-3}~emphase#<\Large>@{A} & & & 0 \\ -% & \hspace*{1cm} & & \Vdots \\ -% & & & 0 \\ -% \hline -% 0 & \Cdots& 0 & 0 -% \end{bNiceArray}$ -% \end{BVerbatim} -% \begin{scope} -% $\begin{bNiceArray}{ccc|c}[margin] -% \Block{3-3}<\Large>{A} & & & 0 \\ -% & \hspace*{1cm} & & \Vdots \\ -% & & & 0 \\ -% \hline -% 0 & \Cdots& 0 & 0 -% \end{bNiceArray}$ -% \end{scope} % % \section{The rules} % @@ -1140,7 +1223,7 @@ version 2005/12/01 or later. % \begin{scope} % \hfuzz=10cm % \begin{BVerbatim}[baseline=c,boxwidth=9cm] -% \begin{NiceTabular}{lr}[hlines,code-before = ~emphase#\rowcolors{1}{blue!10}{}@] +% \begin{NiceTabular}{~LetterAt{}lr~LetterAt{}}[hlines,code-before = ~emphase#\rowcolors{1}{blue!10}{}@] % John & 12 \\ % Stephen & 8 \\ % Sarah & 18 \\ @@ -1149,7 +1232,7 @@ version 2005/12/01 or later. % Madison & 15 % \end{NiceTabular} % \end{BVerbatim} -% \begin{NiceTabular}{lr}[hlines,code-before = \rowcolors{1}{blue!10}{},baseline=3] +% \begin{NiceTabular}{@{}lr@{}}[hlines,code-before = \rowcolors{1}{blue!10}{},baseline=3] % John & 12 \\ % Stephen & 8 \\ % Sarah & 18 \\ @@ -1162,7 +1245,7 @@ version 2005/12/01 or later. % \bigskip % \colorbox{yellow!30}{\textbf{New 5.2}}\enskip There is a key |respect-blocks| % for the instruction |\rowcolors|. With that key, the ``rows'' alternately -% colored may extend over several row if they have to incorporate blocks. +% colored may extend over several rows if they have to incorporate blocks. % % \medskip % \begin{scope} @@ -1170,28 +1253,29 @@ version 2005/12/01 or later. % \begin{BVerbatim}[baseline=c,boxwidth=9cm] % \begin{NiceTabular}{lr}[hvlines,code-before = % ~emphase#\rowcolors{1}{blue!10}{}[respect-blocks]@] -% \Block[l]{2-1}{John} & 12 \\ -% & 13 \\ -% Stephen & 8 \\ -% \Block[l]{3-1}{Sarah} & 18 \\ -% & 17 \\ -% & 15 \\ -% Ashley & 20 \\ -% Henry & 14 \\ -% \Block[l]{2-1}{Madison} & 15 \\ +% \Block{2-1}{John} & 12 \\ +% & 13 \\ +% Steph & 8 \\ +% \Block{3-1}{Sarah} & 18 \\ +% & 17 \\ +% & 15 \\ +% Ashley & 20 \\ +% Henry & 14 \\ +% \Block{2-1}{Madison} & 15 \\ % & 19 % \end{NiceTabular} % \end{BVerbatim} -% \begin{NiceTabular}{lr}[hvlines,code-before = \rowcolors{1}{blue!10}{}[respect-blocks],baseline=c] -% \Block[l]{2-1}{John} & 12 \\ -% & 13 \\ -% Stephen & 8 \\ -% \Block[l]{3-1}{Sarah} & 18 \\ -% & 17 \\ -% & 15 \\ -% Ashley & 20 \\ -% Henry & 14 \\ -% \Block[l]{2-1}{Madison} & 15 \\ +% \begin{NiceTabular}{lr}[hvlines,code-before = +% \rowcolors{1}{blue!10}{}[respect-blocks],baseline=c] +% \Block{2-1}{John} & 12 \\ +% & 13 \\ +% Steph & 8 \\ +% \Block{3-1}{Sarah} & 18 \\ +% & 17 \\ +% & 15 \\ +% Ashley & 20 \\ +% Henry & 14 \\ +% \Block{2-1}{Madison} & 15 \\ % & 19 % \end{NiceTabular} % \end{scope} @@ -2274,6 +2358,10 @@ version 2005/12/01 or later. % \item If the key |notes/para| is used, the notes are composed at the end of % the array in a single paragraph (as with the key |para| of \pkg{threeparttable}). % +% \item \colorbox{yellow!50}{\textbf{New 5.4}}\enskip There is a key +% |tabularnote| which provides a way to insert some texte in the zone of the +% notes before the numbered tabular notes. +% % \item If the package \pkg{booktabs} has been loaded (before or after % \pkg{nicematrix}), the key |notes/bottomrule| draws a |\bottomrule| of % \pkg{booktabs} \emph{after} the notes. @@ -2299,7 +2387,8 @@ version 2005/12/01 or later. % \caption{Use of \texttt{\textbackslash tabularnote}~emphase#\tabularnote{It's possible! % ~emphase#to put a note in the caption.}}! % \label{t:tabularnote} -% \begin{NiceTabular}{@{}llc@{}[~emphase#notes/bottomrule!] +% \begin{NiceTabular}{@{}llc@{} +% [~emphase#notes/bottomrule!, tabularnote = Some text before the notes.] % \toprule % Last name & First name & Length of life \\ % \midrule @@ -2323,7 +2412,8 @@ version 2005/12/01 or later. % \caption{Use of \texttt{\textbackslash tabularnote}\tabularnote{It's possible % to put a note in the caption.}} % \label{t:tabularnote} -% \begin{NiceTabular}{@{}llc@{}}[notes/bottomrule] +% \begin{NiceTabular}{@{}llc@{}}[notes/bottomrule, +% tabularnote = Some text before the notes.] % \toprule % Last name & First name & Length of life \\ % \midrule @@ -4341,6 +4431,21 @@ version 2005/12/01 or later. \RequirePackage { xparse } % \end{macrocode} % +% \begin{macrocode} +\cs_set_eq:NN \box_use_drop_i:N \box_use_drop:N +\cs_set_eq:NN \box_use_drop_ii:N \box_use_drop:N +\cs_set_eq:NN \box_use_drop_iii:N \box_use_drop:N +\cs_set_eq:NN \box_use_drop_iv:N \box_use_drop:N +\cs_set_eq:NN \box_use_drop_v:N \box_use_drop:N +\cs_set_eq:NN \box_use_drop_vi:N \box_use_drop:N +\cs_set_eq:NN \box_use_drop_vii:N \box_use_drop:N +\cs_set_eq:NN \box_use_drop_viii:N \box_use_drop:N +\cs_set_eq:NN \box_use_drop_ix:N \box_use_drop:N +\cs_set_eq:NN \box_use_drop_x:N \box_use_drop:N +\cs_set_eq:NN \box_use_drop_xi:N \box_use_drop:N +\cs_set_eq:NN \box_use_drop_xii:N \box_use_drop:N +% \end{macrocode} +% % \bigskip % \begin{macrocode} \cs_new_protected:Npn \@@_error:n { \msg_error:nn { nicematrix } } @@ -4621,11 +4726,6 @@ version 2005/12/01 or later. % \end{macrocode} % % -% \bigskip -% \begin{macrocode} -\cs_new:Npn \@@_tab_or_array_colsep: - { \bool_if:NTF \l_@@_NiceTabular_bool \tabcolsep \arraycolsep } -% \end{macrocode} % % \bigskip % \textbf{The column S of siunitx}\par\nobreak @@ -4856,6 +4956,24 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip +% The following token list will contain the type of the current cell (|l|, |c| +% or |r|). It will be used by the blocks. +% \begin{macrocode} +\tl_new:N \l_@@_cell_type_tl +\tl_set:Nn \l_@@_cell_type_tl { c } +% \end{macrocode} +% +% \bigskip +% When there is a mono-column block (created by the command |\Block|), we want +% to take into account the width of that block for the width of the column. +% That's why we compute the width of that block in the |\g_@@_blocks_width_dim| +% and, after the construction of the box |\l_@@_cell_box|, we change the width +% of that box to take into account the length |\g_@@_blocks_width_dim|. +% \begin{macrocode} +\dim_new:N \g_@@_blocks_width_dim +% \end{macrocode} +% +% \bigskip % The sequence |\g_@@_names_seq| will be the list of all the names of % environments used (via the option |name|) in the document: two environments % must not have the same name. However, it's possible to use the option @@ -4901,6 +5019,12 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip +% The following boolean will be raised when the command |\rotate| is used. +% \begin{macrocode} +\bool_new:N \g_@@_rotate_bool +% \end{macrocode} +% +% \bigskip % \begin{macrocode} \cs_new_protected:Npn \@@_test_if_math_mode: { @@ -5106,13 +5230,20 @@ version 2005/12/01 or later. \tl_new:N \l_@@_pos_of_block_tl \tl_set:Nn \l_@@_pos_of_block_tl { c } % \end{macrocode} -% +% % \medskip % Used when the key |draw-first| is used for |\Ddots| or |\Iddots|. % \begin{macrocode} \bool_new:N \l_@@_draw_first_bool % \end{macrocode} % +% \medskip +% The blocks which use the key |-| will store their content in a box. These +% boxes are numbered with the following counter. +% \begin{macrocode} +\int_new:N \g_@@_block_box_int +% \end{macrocode} +% % \bigskip % \textbf{Variables for the exterior rows and columns}\par\nobreak % @@ -5224,6 +5355,14 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip +% However, before the actual tabular notes, it's possible to put a text +% specified by the key |tabularnote| of the environment. The token list +% |\l_@@_tabularnote_tl| corresponds to the value of that key. +% \begin{macrocode} +\tl_new:N \l_@@_tabularnote_tl +% \end{macrocode} +% +% \bigskip % The following counter will be used to count the number of successive tabular % notes such as in % |\tabularnote{Note 1}\tabularnote{Note 2}\tabularnote{Note 3}|. @@ -5286,7 +5425,11 @@ version 2005/12/01 or later. \newlist { tabularnotes } { enumerate } { 1 } \setlist [ tabularnotes ] { - noitemsep , leftmargin = * , align = left , labelsep = 0pt , + topsep = 0pt , + noitemsep , + leftmargin = * , + align = left , + labelsep = 0pt , label = \@@_notes_label_in_list:n { \@@_notes_style:n { tabularnotesi } } , } @@ -5331,7 +5474,7 @@ version 2005/12/01 or later. % We expand the content of the note at the point of use of % |\tabularnote| as does |\footnote|. % \begin{macrocode} - \seq_gput_right:Nx \g_@@_tabularnotes_seq { #1 } + \seq_gput_right:Nn \g_@@_tabularnotes_seq { #1 } \peek_meaning:NF \tabularnote { % \end{macrocode} @@ -6087,6 +6230,8 @@ version 2005/12/01 or later. notes / para .default:n = true , notes / bottomrule .bool_set:N = \l_@@_notes_bottomrule_bool , notes / bottomrule .default:n = true , + tabularnote .tl_set:N = \l_@@_tabularnote_tl , + tabularnote .value_required:n = true , unknown .code:n = \@@_error:n { Unknown~option~for~NiceArray } } % \end{macrocode} @@ -6118,6 +6263,8 @@ version 2005/12/01 or later. notes / para .default:n = true , notes / bottomrule .bool_set:N = \l_@@_notes_bottomrule_bool , notes / bottomrule .default:n = true , + tabularnote .tl_set:N = \l_@@_tabularnote_tl , + tabularnote .value_required:n = true , last-col .code:n = \tl_if_empty:nF {#1} { \@@_error:n { last-col~non~empty~for~NiceArray } } \int_zero:N \l_@@_last_col_int , @@ -6239,12 +6386,42 @@ version 2005/12/01 or later. } % \end{macrocode} % +% \begin{macrocode} +\cs_new_protected:Npn \@@_rotate_cell_box: + { + \box_rotate:Nn \l_@@_cell_box { 90 } + \int_compare:nNnT \c@iRow = \l_@@_last_row_int + { + \vbox_set_top:Nn \l_@@_cell_box + { + \vbox_to_zero:n { } + \skip_vertical:n { - \box_ht:N \@arstrutbox + 0.8 ex } + \box_use:N \l_@@_cell_box + } + } + \bool_gset_false:N \g_@@_rotate_bool + } +% \end{macrocode} +% +% \begin{macrocode} +\cs_new_protected:Npn \@@_adjust_width_box: + { + \dim_compare:nNnT \g_@@_blocks_width_dim > \c_zero_dim + { + \box_set_wd:Nn \l_@@_cell_box + { \dim_max:nn { \box_wd:N \l_@@_cell_box } \g_@@_blocks_width_dim } + \dim_gzero:N \g_@@_blocks_width_dim + } + } +% \end{macrocode} % % \begin{macrocode} \cs_new_protected:Npn \@@_end_Cell: { \@@_math_toggle_token: \hbox_set_end: + \bool_if:NT \g_@@_rotate_bool \@@_rotate_cell_box: + \@@_adjust_width_box: % \end{macrocode} % % \begin{macrocode} @@ -6292,11 +6469,11 @@ version 2005/12/01 or later. % \end{itemize} % \begin{macrocode} \bool_if:NTF \g_@@_empty_cell_bool - { \box_use_drop:N \l_@@_cell_box } + { \box_use_drop_i:N \l_@@_cell_box } { \dim_compare:nNnTF { \box_wd:N \l_@@_cell_box } > \c_zero_dim \@@_node_for_the_cell: - { \box_use_drop:N \l_@@_cell_box } + { \box_use_drop_ii:N \l_@@_cell_box } } \bool_gset_false:N \g_@@_empty_cell_bool } @@ -6319,7 +6496,7 @@ version 2005/12/01 or later. \pgfnode { rectangle } { base } - { \box_use_drop:N \l_@@_cell_box } + { \box_use_drop_iii:N \l_@@_cell_box } { \@@_env: - \int_use:N \c@iRow - \int_use:N \c@jCol } { } \str_if_empty:NF \l_@@_name_str @@ -6776,6 +6953,7 @@ version 2005/12/01 or later. \bgroup \tl_set:Nn \l_@@_left_delim_tl { #1 } \tl_set:Nn \l_@@_right_delim_tl { #2 } + \int_gzero:N \g_@@_block_box_int \dim_zero:N \g_@@_width_last_col_dim \dim_zero:N \g_@@_width_first_col_dim \bool_gset_false:N \g_@@_row_of_col_done_bool @@ -6800,11 +6978,13 @@ version 2005/12/01 or later. % \end{macrocode} % % We deactivate Tikz externalization because we will use \textsc{pgf} pictures -% with the options |overlay| and |remember picture| (or equivalent forms). +% with the options |overlay| and |remember picture| (or equivalent forms). We +% deactivate with |\tikzexternaldisable| and not with +% |\tikzset{external/export=false}| which is \emph{not} equivalent. % \begin{macrocode} \cs_if_exist:NT \tikz@library@external@loaded { - \tikzset { external / export = false } + \tikzexternaldisable \cs_if_exist:NT \ifstandalone { \tikzset { external / optimize = false } } } @@ -7153,8 +7333,21 @@ version 2005/12/01 or later. % \begin{macrocode} \int_compare:nNnT \l_@@_first_col_int = 0 { - \skip_horizontal:N \arraycolsep - \skip_horizontal:N \g_@@_width_first_col_dim + \skip_horizontal:N \col@sep + \dim_if_exist:cTF { g_@@_ block _ width _col _ 0 _ dim } + { + \skip_horizontal:n + { + \dim_max:nn + { + \dim_use:c { g_@@_ block _ width _col _ 0 _ dim } + - 2 \col@sep + } + \g_@@_width_first_col_dim + } + \dim_gzero:c { g_@@_ block _ width _col _ 0 _ dim } + } + { \skip_horizontal:N \g_@@_width_first_col_dim } } % \end{macrocode} % @@ -7254,8 +7447,27 @@ version 2005/12/01 or later. % \begin{macrocode} \bool_if:NT \g_@@_last_col_found_bool { - \skip_horizontal:N \g_@@_width_last_col_dim - \skip_horizontal:N \arraycolsep + \dim_if_exist:cTF + { g_@@_ block _ width _col _ \int_use:N \g_@@_col_total_int _ dim } + { + \skip_horizontal:n + { + \dim_max:nn + { + \dim_use:c + { + g_@@_ block _ width _col _ + \int_use:N \g_@@_col_total_int + _ dim + } + } + { \g_@@_width_first_col_dim + \col@sep } + } + } + { + \skip_horizontal:N \g_@@_width_last_col_dim + \skip_horizontal:N \col@sep + } } \@@_after_array: \egroup @@ -7449,7 +7661,12 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_patch_preamble_i:n #1 { - \tl_gput_right:Nn \g_@@_preamble_tl { > \@@_Cell: #1 < \@@_end_Cell: } + \tl_gput_right:Nn \g_@@_preamble_tl + { + > { \@@_Cell: \tl_set:Nn \l_@@_cell_type_tl { #1 } } + #1 + < \@@_end_Cell: + } % \end{macrocode} % We increment the counter of columns. % \begin{macrocode} @@ -7547,13 +7764,16 @@ version 2005/12/01 or later. > { \hbox_set:Nw \l_@@_cell_box \@@_Cell: + \tl_set:Nn \l_@@_cell_type_tl { #1 } } c < { \@@_end_Cell: #1 - \hbox_set_end: - \makebox [ #4 ] [ #3 ] { \box_use_drop:N \l_@@_cell_box } + \hbox_set_end: + \bool_if:NT \g_@@_rotate_bool \@@_rotate_cell_box: + \@@_adjust_width_box: + \makebox [ #4 ] [ #3 ] { \box_use_drop_iv:N \l_@@_cell_box } } } % \end{macrocode} @@ -7635,7 +7855,7 @@ version 2005/12/01 or later. \box_set_ht:Nn \l_tmpa_box { \box_ht:N \l_tmpa_box + \l_tmpa_dim } \box_set_dp:Nn \l_tmpa_box { \box_dp:N \l_tmpa_box + \l_tmpb_dim } \str_if_eq:VnTF \l_@@_baseline_str { c } - { \box_use_drop:N \l_tmpa_box } + { \box_use_drop_v:N \l_tmpa_box } \@@_put_box_in_flow_i: } % \end{macrocode} @@ -7693,8 +7913,8 @@ version 2005/12/01 or later. % Now, |\g_tmpa_dim| contains the value of the $y$ translation we have to to. % \begin{macrocode} \endpgfpicture - \box_move_up:nn \g_tmpa_dim { \box_use_drop:N \l_tmpa_box } - \box_use_drop:N \l_tmpa_box + \box_move_up:nn \g_tmpa_dim { \box_use_drop_vi:N \l_tmpa_box } + \box_use_drop_vii:N \l_tmpa_box } % \end{macrocode} % @@ -7702,11 +7922,13 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_use_arraybox_with_notes_c: { - \int_compare:nNnTF \c@tabularnote = 0 - { \box_use_drop:N \l_@@_the_array_box } + \bool_lazy_and:nnTF + { \int_compare_p:nNn \c@tabularnote = 0 } + { \tl_if_empty_p:V \l_@@_tabularnote_tl } + { \box_use_drop_viii:N \l_@@_the_array_box } { \begin { minipage } { \box_wd:N \l_@@_the_array_box } - \box_use_drop:N \l_@@_the_array_box + \box_use_drop_ix:N \l_@@_the_array_box \skip_vertical:N 0.65ex % \end{macrocode} % The TeX group is for potential specifications in the @@ -7714,26 +7936,30 @@ version 2005/12/01 or later. % \begin{macrocode} \group_begin: \l_@@_notes_code_before_tl + \tl_if_empty:NF \l_@@_tabularnote_tl { \l_@@_tabularnote_tl \par } % \end{macrocode} % We compose the tabular notes with a list of \pkg{enumitem}. The |\strut| and % the |\unskip| are designed to give the ability to put a |\bottomrule| at the % end of the notes with a good vertical space. % \begin{macrocode} - \bool_if:NTF \l_@@_notes_para_bool + \int_compare:nNnF \c@tabularnote = 0 { - \begin { tabularnotes* } - \seq_map_inline:Nn \g_@@_tabularnotes_seq { \item ##1 } \strut - \end { tabularnotes* } + \bool_if:NTF \l_@@_notes_para_bool + { + \begin { tabularnotes* } + \seq_map_inline:Nn \g_@@_tabularnotes_seq { \item ##1 } \strut + \end { tabularnotes* } % \end{macrocode} % The following |\par| is mandatory for the event that the user has put % |\footnotesize| (for example) in the |notes/code-before|. % \begin{macrocode} - \par - } - { - \tabularnotes - \seq_map_inline:Nn \g_@@_tabularnotes_seq { \item ##1 } \strut - \endtabularnotes + \par + } + { + \tabularnotes + \seq_map_inline:Nn \g_@@_tabularnotes_seq { \item ##1 } \strut + \endtabularnotes + } } \unskip \group_end: @@ -7799,18 +8025,31 @@ version 2005/12/01 or later. % Now, we convert the value of |\l_@@_baseline_str| (which should represent an % integer) to an integer stored in |\l_tmpa_int|. % \begin{macrocode} - \int_set:Nn \l_tmpa_int \l_@@_baseline_str - \bool_lazy_or:nnT - { \int_compare_p:nNn \l_tmpa_int < \l_@@_first_row_int } - { \int_compare_p:nNn \l_tmpa_int > \g_@@_row_total_int } - { - \@@_error:n { bad~value~for~baseline } - \int_set:Nn \l_tmpa_int 1 - } \pgfpicture \@@_qpoint:n { row - 1 } \dim_gset_eq:NN \g_tmpa_dim \pgf@y - \@@_qpoint:n { row - \int_use:N \l_tmpa_int - base } + \str_if_in:NnTF \l_@@_baseline_str { line- } + { + \int_set:Nn \l_tmpa_int + { + \str_range:Nnn + \l_@@_baseline_str + 6 + { \str_count:N \l_@@_baseline_str } + } + \@@_qpoint:n { row - \int_use:N \l_tmpa_int } + } + { + \int_set:Nn \l_tmpa_int \l_@@_baseline_str + \bool_lazy_or:nnT + { \int_compare_p:nNn \l_tmpa_int < \l_@@_first_row_int } + { \int_compare_p:nNn \l_tmpa_int > \g_@@_row_total_int } + { + \@@_error:n { bad~value~for~baseline } + \int_set:Nn \l_tmpa_int 1 + } + \@@_qpoint:n { row - \int_use:N \l_tmpa_int - base } + } \dim_gsub:Nn \g_tmpa_dim \pgf@y \endpgfpicture \dim_gadd:Nn \g_tmpa_dim \arrayrulewidth @@ -8029,15 +8268,19 @@ version 2005/12/01 or later. \int_compare:nNnT \l_@@_first_col_int = 0 { \omit - \skip_horizontal:N -2\col@sep - \bool_if:NT \l_@@_code_before_bool - { \pgfsys@markposition { \@@_env: - col - 0 } } - \pgfpicture - \pgfrememberpicturepositiononpagetrue - \pgfcoordinate { \@@_env: - col - 0 } \pgfpointorigin - \str_if_empty:NF \l_@@_name_str - { \pgfnodealias { \l_@@_name_str - col - 0 } { \@@_env: - col - 0 } } - \endpgfpicture + \hbox_overlap_left:n + { + \bool_if:NT \l_@@_code_before_bool + { \pgfsys@markposition { \@@_env: - col - 0 } } + \pgfpicture + \pgfrememberpicturepositiononpagetrue + \pgfcoordinate { \@@_env: - col - 0 } \pgfpointorigin + \str_if_empty:NF \l_@@_name_str + { \pgfnodealias { \l_@@_name_str - col - 0 } { \@@_env: - col - 0 } } + \endpgfpicture + \skip_horizontal:N 2\col@sep + \skip_horizontal:N \g_@@_width_first_col_dim + } & } \omit @@ -8108,7 +8351,7 @@ version 2005/12/01 or later. { \skip_gset_eq:NN \g_tmpa_skip \l_@@_columns_width_dim } \skip_gadd:Nn \g_tmpa_skip { 2 \col@sep } } - \skip_horizontal:N \g_tmpa_skip + \skip_horizontal:N \g_tmpa_skip \hbox { \bool_if:NT \l_@@_code_before_bool @@ -8139,12 +8382,12 @@ version 2005/12/01 or later. { & \omit + \int_gincr:N \g_tmpa_int % \end{macrocode} % The incrementation of the counter |\g_tmpa_int| must be done after the |\omit| % of the cell. % \begin{macrocode} - \int_gincr:N \g_tmpa_int - \skip_horizontal:N \g_tmpa_skip + \skip_horizontal:N \g_tmpa_skip \bool_if:NT \l_@@_code_before_bool { \hbox @@ -8171,23 +8414,27 @@ version 2005/12/01 or later. } \bool_if:NT \g_@@_last_col_found_bool { - \bool_if:NT \l_@@_code_before_bool - { - \pgfsys@markposition { \@@_env: - col - \@@_succ:n \g_@@_col_total_int } - } - \skip_horizontal:N 2\col@sep - \pgfpicture - \pgfrememberpicturepositiononpagetrue - \pgfcoordinate { \@@_env: - col - \@@_succ:n \g_@@_col_total_int } - \pgfpointorigin - \str_if_empty:NF \l_@@_name_str - { - \pgfnodealias - { \l_@@_name_str - col - \@@_succ:n \g_@@_col_total_int } - { \@@_env: - col - \@@_succ:n \g_@@_col_total_int } - } - \endpgfpicture - \skip_horizontal:N -2\col@sep + \hbox_overlap_right:n + { + % \skip_horizontal:N \col@sep + \skip_horizontal:N \g_@@_width_last_col_dim + \bool_if:NT \l_@@_code_before_bool + { + \pgfsys@markposition + { \@@_env: - col - \@@_succ:n \g_@@_col_total_int } + } + \pgfpicture + \pgfrememberpicturepositiononpagetrue + \pgfcoordinate { \@@_env: - col - \@@_succ:n \g_@@_col_total_int } + \pgfpointorigin + \str_if_empty:NF \l_@@_name_str + { + \pgfnodealias + { \l_@@_name_str - col - \@@_succ:n \g_@@_col_total_int } + { \@@_env: - col - \@@_succ:n \g_@@_col_total_int } + } + \endpgfpicture + } } \cr } @@ -8235,6 +8482,8 @@ version 2005/12/01 or later. { \@@_math_toggle_token: \hbox_set_end: + \bool_if:NT \g_@@_rotate_bool \@@_rotate_cell_box: + \@@_adjust_width_box: \@@_update_for_first_and_last_row: % \end{macrocode} % We actualise the width of the ``first column'' because we will use this width @@ -8250,7 +8499,7 @@ version 2005/12/01 or later. { \dim_compare:nNnTF { \box_wd:N \l_@@_cell_box } > \c_zero_dim \@@_node_for_the_cell: - { \box_use_drop:N \l_@@_cell_box } + { \box_use_drop_x:N \l_@@_cell_box } \skip_horizontal:N \l_@@_left_delim_dim \skip_horizontal:N \l_@@_left_margin_dim \skip_horizontal:N \l_@@_extra_left_margin_dim @@ -8303,6 +8552,8 @@ version 2005/12/01 or later. { \@@_math_toggle_token: \hbox_set_end: + \bool_if:NT \g_@@_rotate_bool \@@_rotate_cell_box: + \@@_adjust_width_box: \@@_update_for_first_and_last_row: % \end{macrocode} % We actualise the width of the ``last column'' because we will use this width @@ -8660,8 +8911,6 @@ version 2005/12/01 or later. } \bool_if:NT \l_@@_hlines_bool \@@_draw_hlines: \bool_if:NT \l_@@_vlines_bool \@@_draw_vlines: - \g_@@_internal_code_after_tl - \tl_gclear:N \g_@@_internal_code_after_tl % \end{macrocode} % % \bigskip @@ -8671,6 +8920,11 @@ version 2005/12/01 or later. \cs_set_eq:NN \ialign \@@_old_ialign: \seq_if_empty:NF \g_@@_blocks_seq \@@_draw_blocks: % \end{macrocode} +% +% \begin{macrocode} + \g_@@_internal_code_after_tl + \tl_gclear:N \g_@@_internal_code_after_tl +% \end{macrocode} % % \bigskip % Now, the |code-after|. @@ -9122,7 +9376,7 @@ version 2005/12/01 or later. { \@@_qpoint:n { col - \int_use:N \l_@@_initial_j_int } \dim_set_eq:NN \l_@@_x_initial_dim \pgf@x - \dim_add:Nn \l_@@_x_initial_dim \@@_tab_or_array_colsep: + \dim_add:Nn \l_@@_x_initial_dim \col@sep \@@_qpoint:n { row - \int_use:N \l_@@_initial_i_int - base } \dim_set_eq:NN \l_@@_y_initial_dim \pgf@y } @@ -9131,7 +9385,7 @@ version 2005/12/01 or later. { \@@_qpoint:n { col - \@@_succ:n \l_@@_final_j_int } \dim_set_eq:NN \l_@@_x_final_dim \pgf@x - \dim_sub:Nn \l_@@_x_final_dim \@@_tab_or_array_colsep: + \dim_sub:Nn \l_@@_x_final_dim \col@sep \@@_qpoint:n { row - \int_use:N \l_@@_final_i_int - base } \dim_set_eq:NN \l_@@_y_final_dim \pgf@y } @@ -9199,16 +9453,14 @@ version 2005/12/01 or later. { \@@_qpoint:n { col - \int_use:N \l_@@_initial_j_int } \dim_set_eq:NN \l_@@_x_initial_dim \pgf@x - \dim_add:Nn \l_@@_x_initial_dim - { \bool_if:NTF \l_@@_NiceTabular_bool \tabcolsep \arraycolsep } + \dim_add:Nn \l_@@_x_initial_dim \col@sep } { \@@_set_initial_coords_from_anchor:n { mid~east } } \bool_if:NTF \l_@@_final_open_bool { \@@_qpoint:n { col - \@@_succ:n \l_@@_final_j_int } \dim_set_eq:NN \l_@@_x_final_dim \pgf@x - \dim_sub:Nn \l_@@_x_final_dim - { \bool_if:NTF \l_@@_NiceTabular_bool \tabcolsep \arraycolsep } + \dim_sub:Nn \l_@@_x_final_dim \col@sep } { \@@_set_final_coords_from_anchor:n { mid~west } } \bool_lazy_and:nnTF @@ -10255,44 +10507,8 @@ version 2005/12/01 or later. % \vspace{1cm} % The command |\@@_rotate:| will be linked to |\rotate| in % |{NiceArrayWithDelims}|. -% -% The command will exit three levels of groups (only two in |{NiceTabular}| -% because there is not the group of the math mode to exit) in order -% to execute the command -% -% \qquad ``|\box_rotate:Nn \l_@@_cell_box { 90 }|'' -% -% just after the construction of the box |\l_@@_cell_box|. -% \begin{macrocode} -\cs_new_protected:Npn \@@_rotate: - { - \bool_if:NTF \l_@@_NiceTabular_bool - { \group_insert_after:N \@@_rotate_ii: } - { \group_insert_after:N \@@_rotate_i: } - } -\cs_new_protected:Npn \@@_rotate_i: { \group_insert_after:N \@@_rotate_ii: } -\cs_new_protected:Npn \@@_rotate_ii: { \group_insert_after:N \@@_rotate_iii: } -\cs_new_protected:Npn \@@_rotate_iii: - { - \box_rotate:Nn \l_@@_cell_box { 90 } -% \end{macrocode} -% If we are in the last row, we want all the boxes composed with the command -% |\rotate| aligned upwards. -% \begin{macrocode} - \int_compare:nNnT \c@iRow = \l_@@_last_row_int - { - \vbox_set_top:Nn \l_@@_cell_box - { - \vbox_to_zero:n { } -% \end{macrocode} -% |0.8 ex| will be the distance between the principal part of the array and our -% element (which is composed with |\rotate|). % \begin{macrocode} - \skip_vertical:n { - \box_ht:N \@arstrutbox + 0.8 ex } - \box_use:N \l_@@_cell_box - } - } - } +\cs_new_protected:Npn \@@_rotate: { \bool_gset_true:N \g_@@_rotate_bool } % \end{macrocode} % % \bigskip @@ -11468,7 +11684,9 @@ version 2005/12/01 or later. % \end{macrocode} % We recall that, when externalization is used, |\tikzpicture| and % |\endtikzpicture| (or |\pgfpicture| and |\endpgfpicture|) must be directly -% ``visible''. +% ``visible''. That's why we construct now a version of |\@@_hdottedline:n| with +% the right environment (|\begin{pgfpicture}\end{pgfpicture}| or +% |\begin{tikzpiture}...\end{tikzpicture}|). % \begin{macrocode} \cs_new_protected:Npx \@@_hdottedline:n #1 { @@ -11552,14 +11770,18 @@ version 2005/12/01 or later. \dim_set:Nn \l_@@_x_initial_dim { \pgf@x + - \bool_if:NTF \l_@@_NiceTabular_bool \tabcolsep \arraycolsep +% \end{macrocode} +% We do a reduction by |\arraycolsep| for the environments with delimiters (and +% not for the other). +% \begin{macrocode} + \bool_if:NTF \l_@@_NiceArray_bool \c_zero_dim \arraycolsep - \l_@@_left_margin_dim } \@@_qpoint:n { col - \@@_succ:n \c@jCol } \dim_set:Nn \l_@@_x_final_dim { \pgf@x - - \bool_if:NTF \l_@@_NiceTabular_bool \tabcolsep \arraycolsep + \bool_if:NTF \l_@@_NiceArray_bool \c_zero_dim \arraycolsep + \l_@@_right_margin_dim } % \end{macrocode} @@ -12059,14 +12281,28 @@ version 2005/12/01 or later. % The code deals with the command |\Block|. This command has no direct link with % the environment |{NiceMatrixBlock}|. % +% \bigskip +% The options of the command |\Block| will be analyzed first in the cell of the +% array (and once again when the block will be put in the array in the |code-after|). +% \begin{macrocode} +\keys_define:nn { NiceMatrix / Block / FirstPass } + { + l .code:n = \tl_set:Nn \l_@@_pos_of_block_tl l , + l .value_forbidden:n = true , + r .code:n = \tl_set:Nn \l_@@_pos_of_block_tl r , + r .value_forbidden:n = true , + c .code:n = \tl_set:Nn \l_@@_pos_of_block_tl c , + c .value_forbidden:n = true , + } +% \end{macrocode} +% % % The following command will be linked to |\Block| in the environments of % \pkg{nicematrix}. We define it with |\NewDocumentCommand| of \pkg{xparse} % because it has an optional argument between |<| and |>| (for TeX instructions % put before the math mode of the label) % -% It's mandatory to use an expandable command (probably because of the first -% optional argument?). +% It's mandatory to use an expandable command (why?). % \begin{macrocode} \NewExpandableDocumentCommand \@@_Block: { O { } m D < > { } m } { \@@_Block_i #2 \q_stop { #1 } { #3 } { #4 } } @@ -12088,10 +12324,18 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_Block_ii:nnnnn #1 #2 #3 #4 #5 { - \bool_if:NT \l_@@_NiceTabular_bool - { \tl_if_empty:nF { #4 } { \@@_error:n { angle~option~in~NiceTabular } } } % \end{macrocode} % +% \begin{macrocode} + \tl_if_empty:NTF \l_@@_cell_type_tl + { \tl_set:Nn \l_@@_pos_of_block_tl c } + { \tl_set_eq:NN \l_@@_pos_of_block_tl \l_@@_cell_type_tl } +% \end{macrocode} +% \medskip +% \begin{macrocode} + \keys_set_known:nn { NiceMatrix / Block / FirstPass } { #3 } +% \end{macrocode} +% % \medskip % \begin{macrocode} \tl_set:Nx \l_tmpa_tl @@ -12103,7 +12347,7 @@ version 2005/12/01 or later. } % \end{macrocode} % Now, |\l_tmpa_tl| contains an ``object'' corresponding to the position of the -% block whith four components surrounded by curly brackets: +% block whith four components, each of them surrounded by curly brackets: % % |{|\textsl{imin}|}{|\textsl{jmin}|}{|\textsl{imax}|}{|\textsl{jmax}|}|. % @@ -12118,13 +12362,157 @@ version 2005/12/01 or later. % components: % % |{|\textsl{imin}|}{|\textsl{jmin}|}{|\textsl{imax}|}{|\textsl{jmax}|}{|\textsl{options}|}{|\textsl{contents}|}|. +% +% \medskip +% If the block is mono-column, we have a special treatment. % \begin{macrocode} - \seq_gput_left:Nx \g_@@_blocks_seq - { - \l_tmpa_tl - { #3 } - \exp_not:n { { #4 \@@_math_toggle_token: #5 \@@_math_toggle_token: } } - } + \int_compare:nNnTF { #2 } = 1 + { + \int_gincr:N \g_@@_block_box_int + \cs_set_protected_nopar:Npn \diagbox ##1 ##2 + { + \tl_gput_right:Nx \g_@@_internal_code_after_tl + { + \@@_actually_diagbox:nnnnnn + { \int_use:N \c@iRow } + { \int_use:N \c@jCol } + { \int_eval:n { \c@iRow + #1 - 1 } } + { \int_eval:n { \c@jCol + #2 - 1 } } + { \exp_not:n { ##1 } } { \exp_not:n { ##2 } } + } + } + \box_gclear_new:c + { g_@@_ block _ box _ \int_use:N \g_@@_block_box_int _ box } + \hbox_gset:cn + { g_@@_ block _ box _ \int_use:N \g_@@_block_box_int _ box } + { +% \end{macrocode} +% The main aim of the following |\color_ensure_current:| is to retrieve in the +% box a color specified for that column in the preamble (e.g. something like +% |>{\color{red}}|). +% \begin{macrocode} + \color_ensure_current: + \bool_if:NTF \l_@@_NiceTabular_bool + { + \group_begin: + \cs_set:Npn \arraystretch { 1 } + \dim_set_eq:NN \extrarowheight \c_zero_dim + #4 +% \end{macrocode} +% If the box is rotated (the key |\rotate| may be in the previous |#4|), the +% tabular used for the content of the cell will be constructed with a format +% |c|. In the other cases, the tabular will be constructed with a format equal +% to the key of position of the box. In other words: the alignement internal to +% the tabular is the same as the external alignment of the tabular (that is to +% say the position of the block in its zone of merged cells). +% \begin{macrocode} + \bool_if:NT \g_@@_rotate_bool + { \tl_set:Nn \l_@@_pos_of_block_tl c } + \exp_args:Nnx \begin { tabular } + { @ { } \l_@@_pos_of_block_tl @ { } } + #5 + \end { tabular } + \group_end: + } + { + \group_begin: + \cs_set:Npn \arraystretch { 1 } + \dim_set_eq:NN \extrarowheight \c_zero_dim + #4 + \bool_if:NT \g_@@_rotate_bool + { \tl_set:Nn \l_@@_pos_of_block_tl c } + \c_math_toggle_token + \exp_args:Nnx \begin { array } + { @ { } \l_@@_pos_of_block_tl @ { } } + #5 + \end { array } + \c_math_toggle_token + \group_end: + } + } + \bool_if:NT \g_@@_rotate_bool + { + \box_grotate:cn + { g_@@_ block _ box _ \int_use:N \g_@@_block_box_int _ box } + { 90 } + \bool_gset_false:N \g_@@_rotate_bool + } + \dim_gset:Nn \g_@@_blocks_width_dim + { + \dim_max:nn + \g_@@_blocks_width_dim + { + \box_wd:c + { g_@@_ block _ box _ \int_use:N \g_@@_block_box_int _ box } + } + } + \seq_gput_right:Nx \g_@@_blocks_seq + { + \l_tmpa_tl +% \end{macrocode} +% In the list of options |#3|, maybe there is a key for the horizontal alignment +% (|l|, |r| or |c|). In that case, that key has been read and stored in +% |\l_@@_pos_of_block_tl|. However, maybe there were no key of the horizontal +% alignement and that's why we put a key corresponding to the value of +% |\l_@@_pos_of_block_tl|, which is fixed by the type of current column. +% \begin{macrocode} + { #3 , \l_@@_pos_of_block_tl } + { + \box_use_drop:c + { g_@@_ block _ box _ \int_use:N \g_@@_block_box_int _ box } + } + } + } +% \end{macrocode} +% In the standard case, that is to say a |\Block| which is \emph{not} mono-column. +% \begin{macrocode} + { + \seq_gput_right:Nx \g_@@_blocks_seq + { + \l_tmpa_tl + { #3 } + \exp_not:n + { + { + \bool_if:NTF \l_@@_NiceTabular_bool + { + \group_begin: + \cs_set:Npn \arraystretch { 1 } + \dim_set_eq:NN \extrarowheight \c_zero_dim + #4 +% \end{macrocode} +% If the box is rotated (the key |\rotate| may be in the previous |#4|), the +% tabular used for the content of the cell will be constructed with a format +% |c|. In the other cases, the tabular will be constructed with a format equal +% to the key of position of the box. In other words: the alignement internal to +% the tabular is the same as the external alignment of the tabular (that is to +% say the position of the block in its zone of merged cells). +% \begin{macrocode} + \bool_if:NT \g_@@_rotate_bool + { \tl_set:Nn \l_@@_pos_of_block_tl c } + \exp_args:Nnx \begin { tabular } + { @ { } \l_@@_pos_of_block_tl @ { } } + #5 + \end { tabular } + \group_end: + } + { + \group_begin: + \cs_set:Npn \arraystretch { 1 } + \dim_set_eq:NN \extrarowheight \c_zero_dim + #4 + \bool_if:NT \g_@@_rotate_bool + { \tl_set:Nn \l_@@_pos_of_block_tl c } + \c_math_toggle_token + \exp_args:Nnx \begin { array } + { @ { } \l_@@_pos_of_block_tl @ { } } #5 \end { array } + \c_math_toggle_token + \group_end: + } + } + } + } + } } % \end{macrocode} % @@ -12135,7 +12523,7 @@ version 2005/12/01 or later. % ``medium'' one). \textbf{In fact, as of now, it is \emph{not} documented}. Is % it really a good idea to provide such a key? % \begin{macrocode} -\keys_define:nn { NiceMatrix / Block } +\keys_define:nn { NiceMatrix / Block / SecondPass } { tikz .tl_set:N = \l_@@_tikz_tl , tikz .value_required:n = true , @@ -12166,7 +12554,7 @@ version 2005/12/01 or later. % The group is for the keys. % \begin{macrocode} \group_begin: - \keys_set:nn { NiceMatrix / Block } { #5 } + \keys_set:nn { NiceMatrix / Block / SecondPass} { #5 } % \end{macrocode} % % \begin{macrocode} @@ -12202,11 +12590,8 @@ version 2005/12/01 or later. { \int_compare_p:nNn { #4 } > \g_@@_col_total_int } { \msg_error:nnnn { nicematrix } { Block~too~large } { #1 } { #2 } } { -% \end{macrocode} -% We put the contents of the cell in the box |\l_@@_cell_box| because we want -% the command |\rotate| used in the content to be able to rotate the box. -% \begin{macrocode} - \hbox_set:Nn \l_@@_cell_box { #6 } + \hbox_set:Nn \l_@@_cell_box { #6 } + \bool_if:NT \g_@@_rotate_bool \@@_rotate_cell_box: % \end{macrocode} % % \bigskip @@ -12359,7 +12744,7 @@ version 2005/12/01 or later. { % \end{macrocode} % We take into account the case of a block of one row in the ``first row'' or -% the ``end row''. +% the ``last row''. % \begin{macrocode} \int_compare:nNnTF { #1 } = 0 { \l_@@_code_for_first_row_tl } @@ -12402,22 +12787,29 @@ version 2005/12/01 or later. r { base~east } } } - { \box_use_drop:N \l_@@_cell_box } { } { } + { \box_use_drop_xi:N \l_@@_cell_box } { } { } } % \end{macrocode} % % \medskip -% If the number of rows is different of $1$, we put the label of the block in -% using the short node (the label of the block has been composed in +% If the number of rows is different of $1$, we will put the label of the block +% in using the short node (the label of the block has been composed in % |\l_@@_cell_box|). % \begin{macrocode} { +% \end{macrocode} +% If we are in the first column, we must put the block as if it was with the key~|r|. +% \begin{macrocode} + \int_compare:nNnT \c@jCol = 0 + { \tl_set:Nn \l_@@_pos_of_block_tl r } + \int_compare:nNnT \c@jCol = \l_@@_last_col_int + { \tl_set:Nn \l_@@_pos_of_block_tl l } \pgftransformshift { \pgfpointanchor { \@@_env: - #1 - #2 - block - short } { - \str_case:Vn \l_@@_pos_of_block_tl + \str_case:Vn \l_@@_pos_of_block_tl { c { center } l { west } @@ -12436,7 +12828,7 @@ version 2005/12/01 or later. r { east } } } - { \box_use_drop:N \l_@@_cell_box } { } { } + { \box_use_drop_xii:N \l_@@_cell_box } { } { } } \endpgfpicture } @@ -13118,14 +13510,6 @@ version 2005/12/01 or later. % \end{macrocode} % % \begin{macrocode} -\@@_msg_new:nn { angle~option~in~NiceTabular } - { - You~should~not~the~option~between~angle~brackets~(<~and~>)~for~a~command~ - \token_to_str:N \Block\ in~\{NiceTabular\}.~However,~you~can~go~on. - } -% \end{macrocode} -% -% \begin{macrocode} \@@_msg_new:nn { tabularnote~forbidden } { You~can't~use~the~command~\token_to_str:N\tabularnote\ @@ -13187,6 +13571,7 @@ version 2005/12/01 or later. } % \end{macrocode} % +% % \begin{macrocode} \@@_msg_new:nnn { Unknown~key~for~Block } { @@ -13195,7 +13580,7 @@ version 2005/12/01 or later. For~a~list~of~the~available~keys,~type~H~<return>. } { - The~available~options~are~(in~alphabetic~order):~c,~ + The~available~options~are~(in~alphabetic~order):~-,~c,~ color,~l,~and~r. } % \end{macrocode} @@ -13297,6 +13682,7 @@ version 2005/12/01 or later. first-row,~ hlines,~ hvlines,~ + hvlines-except-corners,~ last-col,~ last-row,~ left-margin,~ @@ -13353,6 +13739,7 @@ version 2005/12/01 or later. first-row,~ hlines,~ hvlines,~ + hvlines-except-corners,~ l,~ last-col,~ last-row,~ @@ -13405,6 +13792,7 @@ version 2005/12/01 or later. first-row,~ hlines,~ hvlines,~ + hvlines-except-corners,~ last-col,~ last-row,~ left-margin,~ @@ -13824,7 +14212,12 @@ version 2005/12/01 or later. % specify which dotted line will be drawn first (the other lines will be drawn % parallel to that one if parallelization is activated). % +% \subsection*{Changes between versions 5.3 and 5.4} % +% Key |tabularnote|. +% +% Different behaviour for the mono-column blocks. +% % \PrintIndex % % \tableofcontents diff --git a/macros/latex/contrib/nicematrix/nicematrix.pdf b/macros/latex/contrib/nicematrix/nicematrix.pdf Binary files differindex 9743eb335d..12313e198a 100644 --- a/macros/latex/contrib/nicematrix/nicematrix.pdf +++ b/macros/latex/contrib/nicematrix/nicematrix.pdf diff --git a/macros/latex/contrib/nnext/README.md b/macros/latex/contrib/nnext/README.md new file mode 100644 index 0000000000..4b2823bdcd --- /dev/null +++ b/macros/latex/contrib/nnext/README.md @@ -0,0 +1,20 @@ +# nnext + +This is the nnext package for LaTeX. It is an add-on for the [**gb4e**](https://www.ctan.org/pkg/gb4e) example package used in linguistics. It implements the `\Next`, `\NNext`, `\Last`, and `\LLast` commands from the [**linguex**](https://www.ctan.org/pkg/linguex) package or the `\nextx`, `\anextx`, `\lastx`, `\blastx`, and `\bblastx` commands from the [**expex**](https://www.ctan.org/pkg/expex) package. The package takes its name from the distinctively named `\NNext` command found in **linguex**. + +## Introduction + +The popular linguistics example package **linguex** and the less popular (though more powerful) package **expex** allow users to refer to previously or to-be defined examples through mnemonic commands such as `\Next` or `\nextx`. The popular package **gb4e** lacks any such functionality. The goal of this package is to provide this functionality for **gb4e** and related packages so that users that need (or want) to use **gb4e** but are more comfortable with **linguex** or **expex** can still have access to these macros while using **gb4e**. + +This package is currently compatible with the original **gb4e** package as well as the modified version **langsci-gb4e** used by [Language Science Press](https://langsci-press.org/) and with [**gb4e-emulate** by Alan Munn](https://github.com/amunn/gb4e-emulate +) (which reimplements **gb4e**’s functionality with the package **enumitem**). + +## License + +Copyright (C) 2020 by Nicholas LaCara + +This file may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 of this license or (at your option) any later version. The latest version of this license is in: + +<http://www.latex-project.org/lppl.txt> + +and version 1.3 or later is part of all distributions of LaTeX version 2005/12/01 or later. diff --git a/macros/latex/contrib/nnext/nnext.dtx b/macros/latex/contrib/nnext/nnext.dtx new file mode 100644 index 0000000000..21c244325e --- /dev/null +++ b/macros/latex/contrib/nnext/nnext.dtx @@ -0,0 +1,644 @@ +% \iffalse meta-comment +% +% Copyright (C) 2020 by Nicholas LaCara +% +% This file may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3 of this license or (at your option) any later +% version. The latest version of this license is in: +% +% http://www.latex-project.org/lppl.txt +% +% and version 1.3 or later is part of all distributions of +% LaTeX version 2005/12/01 or later. +% +% \fi +% +% \iffalse +%<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01] +%<package>\ProvidesPackage{nnext} +%<package> [2020/10/06 v0.0 The nnext package] +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{url} +\usepackage{charter} +\usepackage{gb4e} +\usepackage{nnext} +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\begin{document} +\DocInput{nnext.dtx} +\end{document} +%</driver> +% \fi +% \CheckSum{0} +% +% \changes{v0.0}{2020/10/05}{Initial version} +% +% \GetFileInfo{nnext.sty} +% \DoNotIndex{\newcommand,} +% +% \title{The \textsf{nnext} package} +% \author{Nicholas LaCara \\ \texttt{nick.lacara@gmail.com}} +% +% \maketitle +% +% \abstract{This package is an add-on for the \textsf{gb4e} example package +% used in linguistics. It implements the \cmd{\Next}, \cmd{\NNext}, +% \cmd{\Last}, and \cmd{\LLast} commands from the \textsf{linguex} package or +% the \cmd{\nextx}, \cmd{\anextx}, \cmd{\lastx}, \cmd{\blastx}, and +% \cmd{\bblastx} commands from the \textsf{expex} package.} The package takes +% its name from the distinctively named \cmd{\NNext} command found in +% \textsf{linguex}. +% +% \section{Introduction} +% +% The popular linguistics example package \textsf{linguex} and the less popular +% (though more powerful) package \textsf{expex} allow users to refer to +% previously or to-be defined examples through mnemonic commands such as +% \cmd{\Next} or \cmd{\nextx}. The popular package \textsf{gb4e} lacks any such +% functionality. The goal of this package is to provide this functionality for +% \textsf{gb4e} and related packages so that users that need (or want) to use +% \textsf{gb4e} but are more comfortable with \textsf{linguex} or +% \textsf{expex} can still have access to these macros while using +% \textsf{gb4e}. +% +% This package is currently compatible with the original \textsf{gb4e} package +% as well as the modified version \textsf{langsci-gb4e} used by Language +% Science Press and with \textsf{gb4e-emulate} by Alan Munn (which reimplements +% \textsf{gb4e}'s functionality with the package \textsf{enumitem}).\footnote{% +% Unfortunately, \textsf{gb4e-emulate} is not on \textsc{ctan}. It is, however, +% available at its GitHub repository: % +% \url{https://github.com/amunn/gb4e-emulate}} +% +% \section{Usage} +% +% \subsection{Loading the package} +% +% The package should be loaded in your preamble with |\usepackage{nnext}|. It +% should be loaded \emph{after} \textsf{gb4e} (or whichever variant you are +% using). +% +% \subsection{Package options} +% +% The package has a few options that may be specified when loaded: +% +% \begin{description} +% \item[\texttt{linguex}] This option defines the macros \cmd{\Next}, +% \cmd{\NNext}, \cmd{\Last}, and \cmd{\LLast}, as found in the +% \textsf{linguex} package. It is the default package option and does not +% need to be specified. +% +% \item[\texttt{expex}] This option defines the macros \cmd{\nextx}, +% \cmd{\anextx}, \cmd{\lastx}, \cmd{\blastx}, and \cmd{\bblastx}, as +% found in the \textsf{expex} package. +% +% \item[\texttt{noparens}] This option disables the use of parentheses around +% example numbers that are on by default when \textsf{linguex} emulation +% is used. This is the typical behavior for \textsf{gb4e} and +% \textsf{expex}. +% +% \end{description} +% +% \subsection{Macros} +% +% \subsubsection{\textsf{linguex} emulation mode (default)} +% +% If the user loads the package with the \textsf{linguex} option or, indeed, +% with no options specified, the package will provide the following macros. +% +% \begin{itemize} +% +% \item \DescribeMacro{\Next} The macro \cmd{\Next} will print the next +% example number. So, if the previous example was (15), this will +% print (16). +% +% \item \DescribeMacro{\NNext} The macro \cmd{\NNext} will print the +% example number after next. So, if the previous example was (15), +% this will print (17). +% +% \item \DescribeMacro{\Last} The macro \cmd{\Last} will print the +% previous example number. So, if the previous example was (15), +% this will print (15). +% +% \item \DescribeMacro{\LLast} The macro \cmd{\LLast} will print the +% example number before last. So, if the previous example was (15), +% this will print (14). +% +% \end{itemize} +% +% \noindent Usage of these macros is straightforward. Simply deploy +% them in running text, as in the following code: +% +% \begin{verbatim} +% If you want to refer to the next example, type \Next. +% If you want to refer to the example after that, type \NNext. +% +% \begin{exe} +% \ex[]{This is an example.} +% \ex[*]{This are another example.} +% \end{exe} +% +% \noindent If you want to refer to the previous example, +% type \Last. If you want to refer to the example before +% that, type \LLast. +% \end{verbatim} +% +% +% \noindent This code produces the following output:\medskip +% +% \framebox{\begin{minipage}{0.9\linewidth} +%If you want to refer to the next example, type \Next. +%If you want to refer to the example after that, type \NNext. +% +% \begin{exe} +% \ex[]{This is an example.} +% \ex[*]{This are another example.} +% \end{exe} +% +%\noindent If you want to refer to the previous example, type \Last. +%If you want to refer to the example before that, +%type \LLast. +% +% \end{minipage}} +% +% \subsubsection{\textsf{expex} emulation mode} +% +% If the user loads the package with the \textsf{expex} option the package will +% provide the following macros. +% +% \begin{itemize} +% +% \item \DescribeMacro{\nextx} The macro \cmd{\nextx} will print the next +% example number. So, if the previous example was (15), this will +% print (16). +% +% \item \DescribeMacro{\anextx} The macro \cmd{\anextx} will print the +% example number after next. So, if the previous example was (15), +% this will print (17). +% +% \item \DescribeMacro{\lastx} The macro \cmd{\lastx} will print the +% previous example number. So, if the previous example was (15), this +% will print (15). +% +% \item \DescribeMacro{\blastx} The macro \cmd{\blastx} will print the +% example number before last. So, if the previous example was (15), +% this will print (14). +% +% \item \DescribeMacro{\bblastx} The macro \cmd{\bblastx} will print the +% example number before last. So, if the previous example was (15), +% this will print (13). +% \end{itemize} +% +% \noindent Usage of these macros is straightforward. Simply deploy +% them in running text, as in the following code: +% +% \begin{verbatim} +% If you want to refer to the next example, type (\nextx). +% If you want to refer to the example after that, type (\anextx). +% +% \begin{exe} +% \ex[]{This is an example.} +% \ex[*]{This are another example.} +% \end{exe} +% +% \noindent If you want to refer to the previous example, +% type (\lastx). If you want to refer to the example before +% that, type (\blastx). If you want to refer to the example +% before that, type (\bblastx). +% \end{verbatim} +% +% +% \noindent This code produces the following output:\medskip +% +% \framebox{\begin{minipage}{0.9\linewidth} +%If you want to refer to the next example, type \Next. +%If you want to refer to the example after that, type \NNext. +% +% \begin{exe} +% \ex[]{This is an example.} +% \ex[*]{This are another example.} +% \end{exe} +% +%\noindent If you want to refer to the previous example, type \Last. +%If you want to refer to the example before that, +%type \LLast. If you want to refer to the example +% before that, type (2). +% +% \end{minipage}} +% +% \subsection{Class compatibility} +% +% I have tested the package with a variety of common \LaTeX\ document classes +% (including the ams-\LaTeX\ classes, scr* group of classes, +% \textsf{tufte-handout}, and the \textsf{exam} class, among several others) +% and believe it should be broadly compatible with most people's set-ups (so +% far I have only found it to be incompatible with the \textsf{standalone} +% class). If you have an issue, drop me an email and I'll see if I can't make +% it work for you. +% +% +% \section{Rationale} +% +% This package is really just a quality-of-life add-on for people using the +% \textsf{gb4e} example package. +% +% The initial motivation for this package came from a colleague who needed to +% typeset a document for submission to a publisher but was unable to use +% \textsf{linguex} due to constraints imposed by the publisher's class file. +% She asked specifically if there was any way to get \textsf{gb4e} to replicate +% the functionality of the \textsf{linguex} commands \cmd{\Next}, \cmd{\NNext}, +% and \cmd{\Last}, among others. +% +% I figured it wouldn't be too difficult to code up a solution and send it to +% her (which I did!), but given that there are likely other people who, due to +% various externally imposed requirements, might need to use \textsf{gb4e} when +% they are used to another example pacakge, I thought a more robust solution +% might be appropriate. This package attempts to provide that. +% +% I also hope that this package can help people migrate to \textsf{gb4e} from +% \textsf{linguex}. There are several benefits to using \textsf{gb4e} over +% \textsf{linguex}, including a more robust syntax that is more aligned with +% standard \LaTeX\ syntax and less sensitive to code formatting such as +% line-breaks. That said, \textsf{gb4e} is a little less user-friendly than +% \textsf{linguex}, so I think that providing one of the features that +% \textsf{linguex} users expect can help people to migrate if they so choose. +% +% \section{Some notes for \textsf{linguex} users} +% +% The \textsf{gb4e} package behaves slightly differently from \textsf{linguex} +% in a handful of ways. A few of those differences may impact how you +% experience using this package. +% +% \begin{itemize} +% +% \item \textsf{gb4e} handles example numbering in footnotes poorly, using +% numbering from the main body of the text (\textsf{linguex} uses roman +% numerals in footnotes, one of the ways in which it is better). This is +% something to keep in mind if you put an example in a footnote. +% +% \item Relatedly, if you use \textsf{gb4e}'s commands for customizing example +% label numbers (\emph{e.g.}, \cmd{\exi} and \cmd{\exr}), the code here will +% not use those special labels. +% +% \end{itemize} +% +% \StopEventually{\PrintIndex\PrintChanges} +% +% +% \section{Implementation} +% +% In the following section, I present the fully commented code for the package. +% +% +% \subsection{Dependencies} +% +% I use the \textsf{xspace} package to make the spacing after example numbers +% right when using the \cmd{\Next}, \cmd{\Last}, \emph{etc}., commands. This +% mimics the behavior of \textsf{linguex}. +% +% \begin{macrocode} +\RequirePackage{xspace} +% \end{macrocode} +% +% \noindent I also use \textsf{ifthen} for various booleans set by the package +% options. +% +% \begin{macrocode} +\RequirePackage{ifthen} +% \end{macrocode} +% +% Because this package is designed to work with a range of \textsf{gb4e} +% variants, there is no line in the code for loading \textsf{gb4e}. Documents +% loading \textsf{nnext} without loading a \textsf{gb4e} variant will compile +% will compile, but using any of the included macros will cause an error. +% +% +% \subsection{Booleans} +% +% Here I define what the booleans will be. The first will set the +% package to emulate linguex's \cmd{\Next}, \cmd{\NNext}, \cmd{\Last}, and +% \cmd{\LLast} commands. The boolean is set to `false' initially. +% +% \begin{macrocode} +\newboolean{emulatelinguex} +\setboolean{emulatelinguex}{false} +% \end{macrocode} +% +% \noindent The next boolean will set the package to emulate expex's +% \cmd{\nextx}, \cmd{\lastx}, \cmd{\blastx}, \cmd{\anextx}, and \cmd{\bblastx} +% commands. The boolean is set to `false' initially. +% +% \begin{macrocode} +\newboolean{emulateexpex} +\setboolean{emulateexpex}{false} +% \end{macrocode} +% +% \noindent The final boolean will set whether the example numbers in the text +% should be set with surrounding parentheses or not. The boolean is set to +% `true' initially. +% +% \begin{macrocode} +\newboolean{parentheses} +\setboolean{parentheses}{true} +% \end{macrocode} +% +% +% \subsection{Package options} +% +% Here is where various package options are defined. All the package options do +% is manipulate the values of the booleans declared in the previous subsection. +% +% By using the package option \texttt{linguex}, the user sets the +% \texttt{emulatelinguex} boolean to `true'. +% +% \begin{macrocode} +\DeclareOption{linguex}{ + \setboolean{emulatelinguex}{true} +} +% \end{macrocode} +% +% \noindent By using the package option \texttt{expex}, the user sets the +% \texttt{emulateexpex} boolean to `true' and the \texttt{emulatelinguex} and +% \texttt{parentheses} booleans to `false'. +% +% \begin{macrocode} +\DeclareOption{expex}{ + \setboolean{emulateexpex}{true} + \setboolean{emulatelinguex}{false} + \setboolean{parentheses}{false} +} +% \end{macrocode} +% +% \noindent By using the package option \texttt{noparens}, the user sets the +% \texttt{parentheses} boolean to `false'. +% +% \begin{macrocode} +\DeclareOption{noparens}{ + \setboolean{parentheses}{false} +} +% \end{macrocode} +% +% \noindent After defining our package options, we tell \LaTeX\ to use +% \textsf{linguex} emulation as the default mode. +% +% \begin{macrocode} +\ExecuteOptions{linguex} +\ProcessOptions\relax +% \end{macrocode} +% +% +% \subsection{Detecting \textsf{gb4e} variants} +% +% To make this compatible with different variants of \textsf{gb4e}, we need to +% detect which variant of \textsf{gb4e} the user is using, since there is some +% variation in what each variant uses for its example counter. Right now, the +% code is compatible with the following gb4e-like packages: +% +% \begin{itemize} +% \item \textsf{gb4e} +% \item \textsf{langsci-gb4e} (for Language Science Press books) +% \item \textsf{gb4e-emulate} (by Alan Munn, which +% reimplements \textsf{gb4e} using the package \textsf{enumitem}) +% \end{itemize} +% +% The code below checks to see if \textsf{langsci-gb4e} is loaded; if it isn't, +% it checks to see if \textsf{gb4e-emulate} is loaded; if it isn't, it checks +% to see if \textsf{gb4e} is loaded. If this fails, the package defaults to +% using the \texttt{exx} counter from \textsf{gb4e} on the assumption that the +% most likely package to be used instead of \textsf{gb4e} is a modded version. +% It also prints a warning to the terminal. +% +% The reason this needs to be done is because each of these packages uses a +% different counter for example numbering under the hood: +% +% \begin{itemize} +% \item \textsf{gb4e} uses the counter \texttt{exx} +% \item \textsf{langsci-gb4e} uses the counter \texttt{equation} +% \item \textsf{gb4e-emulate} uses the counter \texttt{exei} +% \end{itemize} +% +% \begin{macro}{\@countername} +% Once the right package is identified, the value of \cmd{\@countername} is +% defined to match the counter used by that package. This allows the macros +% defined below to get the current value of the example counter at any point in +% the document regardless of what example package is being used. +% +% \begin{macrocode} +\@ifpackageloaded{langsci-gb4e}% + {\newcommand{\@countername}{equation}} + {\@ifpackageloaded{gb4e-emulate}% + {\newcommand{\@countername}{exei}} + {\@ifpackageloaded{gb4e}% + {\newcommand{\@countername}{exx}} + {\PackageWarningNoLine{nnext}{No known compatible % + example package loaded! Examples may not be correctly % + referenced, or there may be fatal errors}% + \newcommand{\@countername}{exx}}}}% +% \end{macrocode} +% +% \end{macro} +% +% +% \subsection{Manipulating parentheses} +% +% \begin{macro}{\@lparens} +% \begin{macro}{\@rparens} +% \begin{macro}{\@afterspace} +% +% % \textsf{linguex} and \textsf{expex} behave differently with regard to +% % whether the output of reference commands include parentheses: +% \textsf{linguex} includes them; \textsf{expex} (like \textsf{gb4e}) does not. +% The code here defines whether the macros include parentheses based on the +% booleans defined above. It does this by setting the commands \cmd{\@lparens} +% and \cmd{\@rparens} to either be parentheses or by defining them to be empty. +% It also defines whether there should be space included after the number (as +% in \textsf{linguex}) or not (as in \textsf{expex}). It does so, again, by +% defining the macro \textsf{\@afterspace} to either to expand to \cmd{\xspace} +% or to exapand to nothing. These macros are then used in the +% \cmd{\printtmpcounter} macro below. +% +% \begin{macrocode} +\ifthenelse{\boolean{emulatelinguex}% + \AND \boolean{parentheses}}{% + \newcommand{\@lparens}{(} + \newcommand{\@rparens}{)} + \newcommand{\@afterspace}{\xspace}}{% + \newcommand{\@lparens}{} + \newcommand{\@rparens}{} + \newcommand{\@afterspace}{}}% +% \end{macrocode} +% +%\end{macro} +%\end{macro} +%\end{macro} +% +% +% \subsection{Generic macros} +% +% \textsf{linguex} implements its commands by getting the current value of the +% example counter, storing that value in a temporary counter, and then adding +% or subtracting from that temporary counter. This is the approach that I take +% below. To replicate this functionality with \textsf{gb4e}, we only have to do +% this with the counter that it (or its variants) uses +% +% +% \subsubsection{Setting up the temporary counter} +% +% First, we create a temporary counter, which will be used to store the value +% of the next, last, or whichever example number the macro is looking for. +% +% \begin{macrocode} +\newcounter{tmpcounter} +% \end{macrocode} +% +% +% \begin{macro}{\settmpcounter} +% +% Now we define the command \cmd{\settmpcounter}, which gets the value of +% the \textsf{gb4e} example counter (the name of which is stored in +% \cmd{\@countername}) and sets the value of the temporary counter to this +% value plus some integer: +% +% \begin{macrocode} +\newcommand{\settmpcounter}[1]{% +\setcounter{tmpcounter}{\value{\@countername}}% + \addtocounter{tmpcounter}{#1}} +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\printtmpcounter} +% +% Now we define a command for printing the value of temporary counter with or +% without parentheses and with or without the trailing space, depending on +% whether \textsf{linguex} or \textsf{expex} is being emulated. This relies on +% how \cmd{\@lparens}, \cmd{\@rparens}, and \cmd{\@afterspace} were defined +% above. +% +% \begin{macrocode} +\newcommand{\printtmpcounter}[1]{\settmpcounter{#1}% +\@lparens\thetmpcounter\@rparens\@afterspace} +% \end{macrocode} +% +% \end{macro} +% +% +% \subsubsection{Generic definitions} +% +% Now we define some generic, under-the-hood macros for commands that add to or +% subtract from the temporary counters and print those numbers as though they +% were references. These under-the-hood commands will be assigned user-facing +% names depending on whether \textsf{linguex} or \textsf{expex} is being +% emulated. +% +% \begin{macro}{\@Next} +% +% The macro \cmd{\@Next} increments the tempory counter by one, which will be +% the value of the next example: +% +% \begin{macrocode} +\newcommand{\@Next}{\printtmpcounter{1}} +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\@NNext} +% +% The macro \cmd{\@NNext} increments the tempory counter by two, which will be +% the value of the example after next: +% +% \begin{macrocode} +\newcommand{\@NNext}{\printtmpcounter{2}} +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\@Last} +% +% The macro \cmd{\@Last} does not change the value of the temporary counter, +% since this is the value of the previous example: +% +% \begin{macrocode} +\newcommand{\@Last}{\printtmpcounter{0}} +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\@LLast} +% +% The macro \cmd{\@LLast} decreases the tempory counter by one, which will be +% the value of the example before last: +% +% \begin{macrocode} +\newcommand{\@LLast}{\printtmpcounter{-1}} +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\@LLLast} +% +% The macro \cmd{\@LLLast} decreases the tempory counter by two, which will be +% the value of the example before the example before last: +% +% \begin{macrocode} +\newcommand{\@LLLast}{\printtmpcounter{-2}} +% \end{macrocode} +% +% \end{macro} +% +% +% \subsection{Emulate \textsf{linguex}} +% +% \begin{macro}{\Next} +% \begin{macro}{\NNext} +% \begin{macro}{\Last} +% \begin{macro}{\LLast} +% +% If the user chooses to emulate the \textsf{linguex} commands, then this +% conditional uses the command names from \textsf{linguex} and defines them to +% expand to the macros defined in the previous subsection.\bigskip +% +% \begin{macrocode} +\ifthenelse{\boolean{emulatelinguex}}{% + \newcommand{\Next}{\@Next} + \newcommand{\NNext}{\@NNext} + \newcommand{\Last}{\@Last} + \newcommand{\LLast}{\@LLast}}{} +% \end{macrocode} +% +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsection{Emulate \textsf{expex}} +% +% \begin{macro}{\nextx} +% \begin{macro}{\anextx} +% \begin{macro}{\lastx} +% \begin{macro}{\blastx} +% \begin{macro}{\bblastx} +% If the user chooses to emulate the \textsf{linguex} commands, then this +% conditional uses the command names from \textsf{linguex} and defines them to +% expand to the macros defined in the previous subsection.\bigskip\medskip +% +% \begin{macrocode} +\ifthenelse{\boolean{emulateexpex}}{% + \newcommand{\nextx}{\@Next} + \newcommand{\anextx}{\@NNext} + \newcommand{\lastx}{\@Last} + \newcommand{\blastx}{\@LLast} + \newcommand{\bblastx}{\@LLLast}}{} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \Finale +\endinput diff --git a/macros/latex/contrib/nnext/nnext.ins b/macros/latex/contrib/nnext/nnext.ins new file mode 100644 index 0000000000..baa1cb6dba --- /dev/null +++ b/macros/latex/contrib/nnext/nnext.ins @@ -0,0 +1,48 @@ +%% +%% Copyright (C) 2020 by Nicholas LaCara +%% +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any later +%% version. The latest version of this license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2005/12/01 or later. +%% +\input docstrip.tex +\keepsilent +\usedir{tex/latex/nnext} + +\preamble + This is a generated file. + Copyright (C) 2020 by Nicholas LaCara + This file may be distributed and/or modified under the + conditions of the LaTeX Project Public License, either + version 1.3 of this license or (at your option) any later + version. The latest version of this license is in: + http://www.latex-project.org/lppl.txt + and version 1.3 or later is part of all distributions of + LaTeX version 2005/12/01 or later. +\endpreamble + +\generate{\file{nnext.sty}{\from{nnext.dtx}{package}}} + +\Msg{=========================================================} +\Msg{*} +\Msg{* To finish the installation you have to move the} +\Msg{* following file into a directory searched by TeX:} +\Msg{*} +\Msg{* \space\space nnext.sty} +\Msg{*} +\Msg{* To produce the documentation run the file nnext.dtx} +\Msg{* through LaTeX. You will need to have gb4e installed} +\Msg{* in order to compile the documentation.} +\Msg{*} +\Msg{* Happy TeXing!} +\Msg{*} +\Msg{=========================================================} + +\endbatchfile + diff --git a/macros/latex/contrib/nnext/nnext.pdf b/macros/latex/contrib/nnext/nnext.pdf Binary files differnew file mode 100644 index 0000000000..83ef25cc26 --- /dev/null +++ b/macros/latex/contrib/nnext/nnext.pdf diff --git a/macros/latex/contrib/regexpatch/README b/macros/latex/contrib/regexpatch/README index a6b0b7f792..f0198a4432 100644 --- a/macros/latex/contrib/regexpatch/README +++ b/macros/latex/contrib/regexpatch/README @@ -6,9 +6,9 @@ experimental packages. This version fixes a silly typo introduced in version 0.2c -This is version 0.2d of the package (a maintainance release) +This is version 0.2e of the package (a maintainance release) - Copyright 2012-2018 Enrico Gregorio + Copyright 2012-2020 Enrico Gregorio It may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of this @@ -40,5 +40,5 @@ o move "regexpatch.sty" to locations where LaTeX will find it (the FAQ on CTAN in /help/uktug-FAQ gives more information about this magic place -2018/05/02 +2020/10/06 Enrico Gregorio diff --git a/macros/latex/contrib/regexpatch/regexpatch.dtx b/macros/latex/contrib/regexpatch/regexpatch.dtx index e7d5dabf6b..deaadd1255 100644 --- a/macros/latex/contrib/regexpatch/regexpatch.dtx +++ b/macros/latex/contrib/regexpatch/regexpatch.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: regexpatch.dtx (C) Copyright 2012-2016 Enrico Gregorio +%% File: regexpatch.dtx (C) Copyright 2012-2020 Enrico Gregorio %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -25,7 +25,7 @@ \newcommand{\sv}{[\texttt{*}]} %</driver> %<*driver|package> -\GetIdInfo$Id: regexpatch.dtx 0.2d 2018-05-02 12:00:00Z Enrico $ +\GetIdInfo$Id: regexpatch.dtx 0.2e 2020-10-06 12:00:00Z Enrico $ {Extending etoolbox patching commands} %</driver|package> %<*driver> @@ -55,6 +55,7 @@ % % \maketitle % +% \changes{v0.2e}{2020/10/06}{Replaced deprecated commands} % \changes{v0.2d}{2018/05/02}{Fixed silly typo} % \changes{v0.2c}{2018/03/31}{Removed loading of \texttt{l3regex}} % \changes{v0.2b}{2016/05/15}{Fix for removed function} @@ -701,7 +702,7 @@ % A variant for checking a regex match so that we can give the second % argument as a token list. % \begin{macrocode} -\cs_generate_variant:Nn \regex_match:nnT {nV} +\prg_generate_conditional_variant:Nnn \regex_match:nn {nV} { T,F,TF } % \end{macrocode} % % \subsection{Functions} @@ -757,8 +758,8 @@ { \bool_set_false:N \l_xpatch_protect_bool \bool_set_false:N \l_xpatch_optional_bool - \tl_set:Nx \l_xpatch_name_tl { \cs_to_str:N #1 } - \tl_set:Nx \l_xpatch_repl_tl { \token_get_replacement_spec:N #1 } + \tl_set:Nf \l_xpatch_name_tl { \cs_to_str:N #1 } + \tl_set:Nf \l_xpatch_repl_tl { \token_get_replacement_spec:N #1 } \tl_clear:N \l_xpatch_type_tl \regex_match:nVT % \DeclareRobustCommand<control word> {^\\protect\ \\\u{l_xpatch_name_tl}\ \ } @@ -802,7 +803,7 @@ } \bool_if:NT \l_xpatch_protect_bool { - \tl_set:Nx \l_xpatch_repl_tl + \tl_set:Nf \l_xpatch_repl_tl { \exp_after:wN \token_get_replacement_spec:N \cs:w \l_xpatch_name_tl \cs_end: } \regex_match:nVT % \DeclareRobustCommand<any cs> with opt arg @@ -842,9 +843,9 @@ \exp_after:wN #1 \cs:w \l_xpatch_name_tl \cs_end: {#3}{#4}{#5}{#6} } { - \msg_term:n + \iow_term:x { - xpatch~message \\ + xpatch~message: ^^J `\token_to_str:N #2'~is~undefined;~ I'll~ignore~the~request. } @@ -1054,7 +1055,7 @@ { \bool_if:NT \l_xpatch_tracing_bool { - \msg_term:n { xpatch~message \\ #1 } + \iow_term:x { xpatch~message ^^J ~ #1 } } } \cs_new:Npn \xpatch_message_cstype:N #1 @@ -1651,7 +1652,7 @@ % Gather the prefix (it is |\protected| when |#1| has been defined % with |\newrobustcmd|). % \begin{macrocode} - \tl_set:Nf \l_xpatch_prefix_tl { \token_get_prefix_spec:N #1 } + \tl_set:Nx \l_xpatch_prefix_tl { \token_get_prefix_spec:N #1 } \tl_clear:N \l_xpatch_prefix_tl \tl_set_rescan:Nnx \l_xpatch_prefix_tl { } \l_xpatch_prefix_tl % \end{macrocode} diff --git a/macros/latex/contrib/regexpatch/regexpatch.ins b/macros/latex/contrib/regexpatch/regexpatch.ins index 93fd3aeb50..ba88d86942 100644 --- a/macros/latex/contrib/regexpatch/regexpatch.ins +++ b/macros/latex/contrib/regexpatch/regexpatch.ins @@ -1,6 +1,6 @@ \iffalse meta-comment -File regexpatch.ins Copyright (C) 2012-2018 Enrico Gregorio +File regexpatch.ins Copyright (C) 2012-2020 Enrico Gregorio It may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of this diff --git a/macros/latex/contrib/regexpatch/regexpatch.pdf b/macros/latex/contrib/regexpatch/regexpatch.pdf Binary files differindex fe376263f7..798e1940b9 100644 --- a/macros/latex/contrib/regexpatch/regexpatch.pdf +++ b/macros/latex/contrib/regexpatch/regexpatch.pdf diff --git a/macros/latex/contrib/semantex/semantex.pdf b/macros/latex/contrib/semantex/semantex.pdf Binary files differindex 009f3033c9..7a31129246 100644 --- a/macros/latex/contrib/semantex/semantex.pdf +++ b/macros/latex/contrib/semantex/semantex.pdf diff --git a/macros/latex/contrib/semantex/semantex.sty b/macros/latex/contrib/semantex/semantex.sty index 82cf996f5a..84ab00e470 100644 --- a/macros/latex/contrib/semantex/semantex.sty +++ b/macros/latex/contrib/semantex/semantex.sty @@ -1,5 +1,5 @@ \RequirePackage{xparse,l3keys2e,leftindex,semtex} -\ProvidesExplPackage{semantex}{2020/10/03}{0.45}{} +\ProvidesExplPackage{semantex}{2020/10/06}{0.46}{} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % @@ -1504,7 +1504,6 @@ % #2 = options \group_begin: \cs_set:Nn\semantex_this: { #1 } - \semantex_data_tl_inherit:nn { #1 } { symbol } % Inherit the symbol from parent if not done already #2 % This is where keys can be set up \semantex_parse:n { #1 } % Run the "parse" routine, i.e. run the collection of code that the user has added via the key "parseoptions" \semantex_data_bool_get:nnTF { #1 } { output } % Checks if the register is supposed to output @@ -1530,7 +1529,8 @@ { \semantex_data_bool_get:nnTF { #1 } { leftargument } % Checks if left or right argument { - \semantex_left_pre_return:n { #1 } + \semantex_left_indices_pre_return:n { #1 } + \semantex_left_arg_pre_return:n { #1 } \tl_set:Nx\l__semantex_render_symbol_temp_tl { \semantex_data_tl_get_exp_not:nn { #1 } { symbol } } % Stores the symbol in a temporary command \tl_set:Nx \l__semantex_render_temp_tl { @@ -1564,7 +1564,8 @@ } } { - \semantex_right_pre_return:n { #1 } + \semantex_right_indices_pre_return:n { #1 } + \semantex_right_arg_pre_return:n { #1 } \tl_set:Nx\l__semantex_render_symbol_temp_tl { \semantex_data_tl_get_exp_not:nn { #1 } { symbol } } % Stores the symbol in a temporary command \tl_set:Nx \l__semantex_render_temp_tl { @@ -1897,8 +1898,10 @@ % This is an umbrella key that runs all of the three % return routines, innerreturn, rightreturn, and leftreturn \semantex_inner_return:n { #1 } - \semantex_left_return:n { #1 } - \semantex_right_return:n { #1 } + \semantex_left_index_return:n { #1 } + \semantex_left_arg_return:n { #1 } + \semantex_right_index_return:n { #1 } + \semantex_right_arg_return:n { #1 } } \cs_new_protected:Npn\semantex_pre_return:n#1 @@ -1909,8 +1912,10 @@ % resetting parameters in this case would just waste % time. \semantex_inner_pre_return:n { #1 } - \semantex_left_pre_return:n { #1 } - \semantex_right_pre_return:n { #1 } + \semantex_left_indices_pre_return:n { #1 } + \semantex_left_arg_pre_return:n { #1 } + \semantex_right_indices_pre_return:n { #1 } + \semantex_right_arg_pre_return:n { #1 } } \cs_new_protected:Npn\semantex_inner_return:n#1 @@ -1940,16 +1945,11 @@ \cs_new_protected:Npn\semantex_right_return:n#1 { + \semantex_inner_return:n { #1 } \semantex_right_index_return:n { #1 } \semantex_right_arg_return:n { #1 } } -\cs_new_protected:Npn\semantex_right_pre_return:n#1 -{ - \semantex_right_indices_pre_return:n { #1 } - \semantex_right_arg_pre_return:n { #1 } -} - \cs_new_protected:Npn\semantex_right_index_return:n#1 { \semantex_right_indices_pre_return:n { #1 } @@ -2010,16 +2010,11 @@ \cs_new_protected:Npn\semantex_left_return:n#1 { + \semantex_inner_return:n { #1 } \semantex_left_index_return:n { #1 } \semantex_left_arg_return:n { #1 } } -\cs_new_protected:Npn\semantex_left_pre_return:n#1 -{ - \semantex_left_indices_pre_return:n { #1 } - \semantex_left_arg_pre_return:n { #1 } -} - \cs_new_protected:Npn\semantex_left_index_return:n#1 { \semantex_left_indices_pre_return:n { #1 } diff --git a/macros/latex/contrib/semantex/semantex.tex b/macros/latex/contrib/semantex/semantex.tex index c1a4a97f73..37ccd1c3bc 100644 --- a/macros/latex/contrib/semantex/semantex.tex +++ b/macros/latex/contrib/semantex/semantex.tex @@ -34,11 +34,15 @@ \usepackage[english=american]{csquotes} -\usepackage[hidelinks]{hyperref} +%\usepackage[hidelinks]{hyperref} +\newcommand\hypersetup[1]{} +\newcommand\href[2]{\texttt{#2}} +\newcommand\url[1]{\texttt{#1}} +\newcommand\texorpdfstring[2]{#1} \usepackage[nameinlink]{cleveref} -\title{Seman\!\TeX: semantic, keyval-based mathematics (v0.45)} +\title{Seman\!\TeX: semantic, keyval-based mathematics (v0.46)} \date{\today} \author{Sebastian Ørsted (\href{mailto:sorsted@gmail.com}{sorsted@gmail.com})} @@ -249,7 +253,7 @@ Still, suggestions, ideas, and bug reports are more than welcome! }, definekeys[1]={ {der}{upper={ (#1) } }, - {res}{ rightreturn ,symbolputright={|}, lower={#1} }, + {res}{ rightreturn, symbolputright={|}, lower={#1} }, {stalk}{seplower={#1}}, % "seplower" means "separator + lower", i.e. lower index % separated from any previous lower index by a separator, @@ -681,7 +685,7 @@ $\vh[\va,\vb,inv]$ \end{LTXexample} Other keys might need to take one value. -For defining these, we use the key~\lstinline!definekeys[1]!. +For defining these, we use a different key, \lstinline!definekeys[1]!. For instance, suppose we want a command for deriving a function \( n \)~times. For this, we add the key~\lstinline!der!: \begin{lstlisting} @@ -1178,15 +1182,39 @@ For instance, if you want to comjugate the inverse of a function, the following \begin{LTXexample} $\vf[inv,conj]$ \end{LTXexample} -Therefore, there is a command \lstinline!return! that can be applied at any point to invoke the routine of adding all indices and commands to the symbol. Let us try it out: +Therefore, there is a key, called \lstinline!return!, that can be applied at any point to invoke the routine of adding all current commands, indices, and arguments to the symbol. Let us try it out: \begin{LTXexample} $\vf[inv,return,conj]$ \end{LTXexample} -In fact, \lstinline!return! is an umbrella key that invokes three different return routines: \lstinline!leftreturn!, \lstinline!innerreturn!, and \lstinline!rightreturn!. The command \lstinline!leftreturn! adds the left indices to the symbol (we have not discussed left indices yet, though). The command \lstinline!innerreturn! adds all commands to the symbol (those defined using the \lstinline!command!~key). -Finally, \lstinline!rightreturn! adds all right indices and arguments to the symbol. -There is also a collection of partial return routines that add either the indices or the argument to the symbol. -See~\cref{sec:fundamental_keys} for an overview of these. -In general, most of the time, the user should probably be satisfied with just using~\lstinline!return!. +Before we invoked~\lstinline!return!, the symbol was~\lstinline!f!, and the~\lstinline!-1! was stored as an upper index. +But after the \lstinline!return! routine, the symbol is~\lstinline!f^{-1}!, and consequently, when we apply the~\lstinline!conj! key, you add a line above the whole thing. + +There are some cases when you do not want to add all commands, indices, and arguments to the symbol at the same time. +Therefore, there exist a few extra, partial \lstinline!return! keys that only add some of them to the symbol and save the rest of later. +We list the most important ones here and refer to~\cref{sec:fundamental_keys} for the remaining ones. +Most users will probably only ever need the keys \lstinline!return! and~\lstinline!rightreturn!. +\begin{itemize} + \item + \mylst!return! + + Invokes the return routine, i.e.\ adds all commands, indices, and arguments to the symbol, if any such exist. + + \item + \mylst!innerreturn! + + Invokes the inner return routine, i.e.\ adds all commands to the symbol, if any such exist. + + \item + \mylst!rightreturn! + + Invokes the right return routine, i.e.\ adds all commands, right indices, and right arguments to the symbol, if any such exist. + + \item + \mylst!leftreturn! + + Invokes the left return routine, i.e.\ adds all commands, left indices, and left arguments to the symbol, if any such exist. +\end{itemize} + \section{Keyval syntax conflicts} @@ -1648,22 +1676,18 @@ This can be done the following way: \SetupClass\MyVar{ definekeys[1]={ {Lder} { - innerreturn,leftreturn, - symbolputleft=\mathbb{L}^{#1}, + leftreturn, symbolputleft=\mathbb{L}^{#1}, }, {Rder} { - innerreturn,leftreturn, - symbolputleft=\mathbb{R}^{#1}, + leftreturn, symbolputleft=\mathbb{R}^{#1}, }, }, definekeys={ {Lder} { - innerreturn,leftreturn, - symbolputleft=\mathbb{L}, + leftreturn, symbolputleft=\mathbb{L}, }, {Rder} { - innerreturn,leftreturn, - symbolputleft=\mathbb{R}, + leftreturn, symbolputleft=\mathbb{R}, }, }, } @@ -1671,22 +1695,18 @@ This can be done the following way: \SetupClass\MyVar{ definekeys[1]={ {Lder} { - innerreturn,leftreturn, - symbolputleft=\mathbb{L}^{#1}, + leftreturn, symbolputleft=\mathbb{L}^{#1}, }, {Rder} { - innerreturn,leftreturn, - symbolputleft=\mathbb{R}^{#1}, + leftreturn, symbolputleft=\mathbb{R}^{#1}, }, }, definekeys={ {Lder} { - innerreturn,leftreturn, - symbolputleft=\mathbb{L}, + leftreturn, symbolputleft=\mathbb{L}, }, {Rder} { - innerreturn,leftreturn, - symbolputleft=\mathbb{R}, + leftreturn, symbolputleft=\mathbb{R}, }, }, } @@ -1798,7 +1818,10 @@ $ \leftindex^* {A} $, $ \leftindex[P]^* {A} $ \end{LTXexample} We refer to the manual of the package \pack{leftindex} for details, -see~\url{https://ctan.org/pkg/leftindex}. +see +\begin{center} + \url{https://ctan.org/pkg/leftindex} +\end{center} Our solution for left indices in \semantex is based directly on the one from \pack{leftindex}. However, it works much better if you use \semantex @@ -3365,52 +3388,52 @@ In the following sections, we include the full list. \item \mylst!return! - Invokes the return routine. + Invokes the return routine, i.e.\ adds all commands, indices, and arguments to the symbol, if any such exist. \item - \mylst!leftreturn! - - Invokes the left return routine. + \mylst!innerreturn! + Invokes the inner return routine, i.e.\ adds all commands to the symbol, if any such exist. + \item \mylst!rightreturn! - Invokes the right return routine. - + Invokes the right return routine, i.e.\ adds all commands, right indices, and right arguments to the symbol, if any such exist. + \item - \mylst!innerreturn! + \mylst!leftreturn! - Invokes the inner return routine. + Invokes the left return routine, i.e.\ adds all commands, left indices, and left arguments to the symbol, if any such exist. \item \mylst!leftindexreturn! - Adds the left indices to the symbol, but not the left argument, if any such exists. + Adds the left indices to the symbol, if any such exists. \item \mylst!rightindexreturn! - Adds the right indices to the symbol, but not the right argument, if any such exists. + Adds the right indices to the symbol, if any such exists. \item \mylst!indexreturn! - Adds all indices to the symbol, left and right, but not the argument, if any such exists. + Adds all indices, left and right to the symbol, if any such exists. \item \mylst!leftargreturn! - Adds the left argument, if any such exists, to the symbol, otherwise does nothing. + Adds the left argument, if any such exists, to the symbol. \item \mylst!rightargreturn! - Adds the right argument, if any such exists, to the symbol, otherwise does nothing. + Adds the right argument, if any such exists, to the symbol. \item \mylst!argreturn! - Adds the argument, if any such exists, to the symbol, otherwise does nothing. + Adds the argument, if any such exists, to the symbol. \item \mylst!output={$\<Class\>$}! @@ -3636,7 +3659,7 @@ In the following sections, we include the full list. \mylst!Otherspar={$\<left parenthesis\>$}{$\<right parenthesis\>$}{$\values\<normal|auto|*|{\textit{other}}\>$}! Invokes the \lstinline!spar! routine, but with the assigned parentheses and size. - Here,~\lstinline!normal! means normal size + Here, \lstinline!normal! means normal size parentheses, \lstinline!auto! and~\lstinline!*! mean auto-scaled parentheses using~\lstinline!\left...\right!. @@ -5207,8 +5230,8 @@ The following commands are available for programming inside keys, including \lst \item \mylst!\SemantexThis! - Returns the name of the current class or object. The name is stored in the form \mylst!object_$\<name of object without backslash\>$! - or~\mylst!class_$\<name of class without backslash\>$!, + Returns the name of the current class or object. It is returned in the format \mylst!object_$\<name of object without backslash\>$! + and \mylst!class_$\<name of class without backslash\>$!, which is the way the names are stored internally. \item diff --git a/macros/latex/contrib/semantex/stripsemantex.sty b/macros/latex/contrib/semantex/stripsemantex.sty index 679b2ab72c..221cc7cafe 100644 --- a/macros/latex/contrib/semantex/stripsemantex.sty +++ b/macros/latex/contrib/semantex/stripsemantex.sty @@ -1,5 +1,5 @@ \RequirePackage{xparse} -\ProvidesExplPackage{stripsemantex}{2020/10/03}{0.45}{} +\ProvidesExplPackage{stripsemantex}{2020/10/06}{0.46}{} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % diff --git a/macros/latex/required/babel/base/README.md b/macros/latex/required/babel/base/README.md index 9c0dd6e35b..217de7c78a 100644 --- a/macros/latex/required/babel/base/README.md +++ b/macros/latex/required/babel/base/README.md @@ -1,4 +1,4 @@ -## Babel 3.49 +## Babel 3.50 This package manages culturally-determined typographical (and other) rules, and hyphenation patterns for a wide range of languages. Many @@ -7,9 +7,9 @@ lualatex out of the box. A few even work with plain formats. The latest stable version is available on <https://ctan.org/pkg/babel>. -Changes in version 3.49 are described in: +Changes in version 3.50 are described in: -https://github.com/latex3/babel/wiki/What's-new-in-babel-3.49 +https://github.com/latex3/babel/wiki/What's-new-in-babel-3.50 Included is a set of ini files for about 250 languages. @@ -43,12 +43,19 @@ respective authors. ### Latest changes ``` +3.50 2020-10-06 + - Fixes: + - main=<language> stopped working in some cases (#96). + - Footnotes were not \long with layout=footnotes. + 3.49 2020-10-03 + - BUG. This version has a severe bug with main= (fixed in 3.50). - Allow standard LaTeX syntax to recognize locales based on ini files in the most common cases. - frenchspacing is set with ini files. - Fixes: - layout.lists=off didn't work (#94) +https://github.com/latex3/babel/wiki/What's-new-in-babel-3.49 3.48 2020-09-01 - New (tentative) tools to customize some labels (like chapters diff --git a/macros/latex/required/babel/base/babel.dtx b/macros/latex/required/babel/base/babel.dtx index 73badc9980..6c7fff3f8e 100644 --- a/macros/latex/required/babel/base/babel.dtx +++ b/macros/latex/required/babel/base/babel.dtx @@ -31,7 +31,7 @@ % % \iffalse %<*filedriver> -\ProvidesFile{babel.dtx}[2020/10/03 v3.49 The Babel package] +\ProvidesFile{babel.dtx}[2020/10/06 v3.50 The Babel package] \documentclass{ltxdoc} \GetFileInfo{babel.dtx} \usepackage{fontspec} @@ -2405,8 +2405,8 @@ If the language has been loaded as an argument in |\documentclass| or |\usepackage|, then |\babelprovide| redefines the requested data. \Describe{import=}{\meta{language-tag}} -\New{3.13} Imports data from an |ini| file, including captions, date, -and hyphenmins. For example: +\New{3.13} Imports data from an |ini| file, including captions and date +(also line breaking rules in newly defined languages). For example: \begin{verbatim} \babelprovide[_import=hu_]{hungarian} \end{verbatim} @@ -2422,11 +2422,11 @@ be written: \babelprovide[_import_]{hungarian} \end{verbatim} -There are about 200 |ini| files, with data taken from the |ldf| files +There are about 250 |ini| files, with data taken from the |ldf| files and the CLDR provided by Unicode. Not all languages in the latter are complete, and therefore neither are the |ini| files. A few languages -will show a warning about the current lack of suitability of the date -format (\textsf{french}, \textsf{breton}, and \textsf{occitan}). +may show a warning about the current lack of suitability of some +features. Besides |\today|, this option defines an additional command for dates: |\<language>date|, which takes three arguments, namely, year, month and @@ -2508,12 +2508,14 @@ cases. \Describe{onchar=}{\texttt{ids} $\string|$ \texttt{fonts}} \New{3.38} This option is much like an ‘event’ called when a character -belonging to the script of this locale is found. There are currently -two ‘actions’, which can be used at the same time (separated by a -space): with |ids| the |\language| and the |\localeid| are set to the -values of this locale; with |fonts|, the fonts are changed to those of -this locale (as set with |\babelfont|). This option is not compatible -with |mapfont|. Characters can be added with |\babelcharproperty|. +belonging to the script of this locale is found (as its name implies, +it acts on characters, not on spaces). There are currently two +‘actions’, which can be used at the same time (separated by a space): +with |ids| the |\language| and the |\localeid| are set to the values of +this locale; with |fonts|, the fonts are changed to those of this +locale (as set with |\babelfont|). This option is not compatible with +|mapfont|. Characters can be added or modified with +|\babelcharproperty|. \begin{note} An alternative approach with \luatex{} and Harfbuzz is the font @@ -2522,16 +2524,6 @@ with |mapfont|. Characters can be added with |\babelcharproperty|. cases it can be enough. \end{note} -\Describe{mapfont=}{\texttt{direction}} -Assigns the font for the writing direction of this language (only with -|bidi=basic|). Whenever possible, instead of this option use |onchar|, -based on the script, which usually makes more sense. More precisely, -what |mapfont=direction| means is, ‘when a character has the same -direction as the script for the “provided” language, then change its -font to that set for this language’. There are 3 directions, following -the bidi Unicode algorithm, namely, Arabic-like, Hebrew-like and left -to right. So, there should be at most 3 directives of this kind. - \Describe{intraspace=}{\meta{base} \meta{shrink} \meta{stretch}} Sets the interword space for the writing system of the language, in em units (so, |0 .1 0| is |0em plus .1em|). Like |\spaceskip|, the em unit @@ -2544,6 +2536,16 @@ Sets the interword penalty for the writing system of this language. Currently used only in Southeast Asian scrips, like Thai. Ignored if 0 (which is the default value). +\Describe{mapfont=}{\texttt{direction}} +Assigns the font for the writing direction of this language (only with +|bidi=basic|). Whenever possible, instead of this option use |onchar|, +based on the script, which usually makes more sense. More precisely, +what |mapfont=direction| means is, ‘when a character has the same +direction as the script for the “provided” language, then change its +font to that set for this language’. There are 3 directions, following +the bidi Unicode algorithm, namely, Arabic-like, Hebrew-like and left +to right. So, there should be at most 3 directives of this kind. + \begin{note} (1) If you need shorthands, you can define them with |\useshorthands| and |\defineshorthand| as described above. (2) Captions and |\today| @@ -4776,8 +4778,8 @@ help from Bernd Raichle, for which I am grateful. % \section{Tools} % % \begin{macrocode} -%<<version=3.49>> -%<<date=2020/10/03>> +%<<version=3.50>> +%<<date=2020/10/06>> % \end{macrocode} % % \textbf{Do not use the following macros in \texttt{ldf} files. They @@ -6828,6 +6830,7 @@ help from Bernd Raichle, for which I am grateful. \else % case 0,2 \chardef\bbl@iniflag\z@ % Force ldf \expandafter\let\csname ds@\bbl@opt@main\endcsname\bbl@loadmain + \ExecuteOptions{\bbl@opt@main} \DeclareOption*{}% \ProcessOptions* \fi @@ -10469,7 +10472,7 @@ help from Bernd Raichle, for which I am grateful. \let\bbl@KVP@main\@nil \let\bbl@KVP@script\@nil \let\bbl@KVP@language\@nil - \let\bbl@KVP@hyphenrules\@nil % only for provide@new + \let\bbl@KVP@hyphenrules\@nil \let\bbl@KVP@mapfont\@nil \let\bbl@KVP@maparabic\@nil \let\bbl@KVP@mapdigits\@nil @@ -11090,6 +11093,7 @@ help from Bernd Raichle, for which I am grateful. From babel-\bbl@cs{lini@\languagename}.ini:\\% \bbl@cs{@kv@identification.warning#1}\\% Reported }}} +% \let\bbl@inikv@identification\bbl@inikv \def\bbl@secpost@identification{% \bbl@iniwarning{}% @@ -11113,9 +11117,23 @@ help from Bernd Raichle, for which I am grateful. \ifbbl@bcptoname \bbl@csarg\xdef{bcp@map@\bbl@cl{lbcp}}{\languagename}% \fi} +% \end{macrocode} +% +% By default, the following sections are just read. Actions are taken +% later. +% +% \begin{macrocode} \let\bbl@inikv@typography\bbl@inikv \let\bbl@inikv@characters\bbl@inikv \let\bbl@inikv@numbers\bbl@inikv +% \end{macrocode} +% +% Additive numerals require an additional definition. When |.1| is +% found, two macros are defined -- the basic one, without |.1| called +% by |\localenumeral|, and another one preserving the trailing |.1| for +% the ‘units’. +% +% \begin{macrocode} \def\bbl@inikv@counters#1=#2\@@{% \bbl@ifsamestring{#1}{digits}% {\bbl@error{The counter name 'digits' is reserved for mapping\\% @@ -12465,12 +12483,12 @@ help from Bernd Raichle, for which I am grateful. \@ifnextchar[% {\bbl@footnote@o{#1}{#2}{#3}}% {\bbl@footnote@x{#1}{#2}{#3}}} - \def\bbl@footnote@x#1#2#3#4{% + \long\def\bbl@footnote@x#1#2#3#4{% \bgroup \select@language@x{\bbl@main@language}% \bbl@fn@footnote{#2#1{\ignorespaces#4}#3}% \egroup} - \def\bbl@footnote@o#1#2#3[#4]#5{% + \long\def\bbl@footnote@o#1#2#3[#4]#5{% \bgroup \select@language@x{\bbl@main@language}% \bbl@fn@footnote[#4]{#2#1{\ignorespaces#5}#3}% @@ -12479,12 +12497,12 @@ help from Bernd Raichle, for which I am grateful. \@ifnextchar[% {\bbl@footnotetext@o{#1}{#2}{#3}}% {\bbl@footnotetext@x{#1}{#2}{#3}}} - \def\bbl@footnotetext@x#1#2#3#4{% + \long\def\bbl@footnotetext@x#1#2#3#4{% \bgroup \select@language@x{\bbl@main@language}% \bbl@fn@footnotetext{#2#1{\ignorespaces#4}#3}% \egroup} - \def\bbl@footnotetext@o#1#2#3[#4]#5{% + \long\def\bbl@footnotetext@o#1#2#3[#4]#5{% \bgroup \select@language@x{\bbl@main@language}% \bbl@fn@footnotetext[#4]{#2#1{\ignorespaces#5}#3}% @@ -14043,7 +14061,8 @@ end \AtBeginDocument {\ifx\tikz@atbegin@node\@undefined\else \let\bbl@OL@pgfpicture\pgfpicture - \bbl@sreplace\pgfpicture{\pgfpicturetrue}{\bbl@pictsetdir\pgfpicturetrue}% + \bbl@sreplace\pgfpicture{\pgfpicturetrue}% + {\bbl@pictsetdir\pgfpicturetrue}% \bbl@add\pgfsys@beginpicture{\bbl@pictsetdir}% \bbl@add\tikz@atbegin@node{\bbl@pictresetdir}% \fi}} diff --git a/macros/latex/required/babel/base/babel.ins b/macros/latex/required/babel/base/babel.ins index 3112ec6eb5..18bea2ad3f 100644 --- a/macros/latex/required/babel/base/babel.ins +++ b/macros/latex/required/babel/base/babel.ins @@ -26,7 +26,7 @@ %% and covered by LPPL is defined by the unpacking scripts (with %% extension .ins) which are part of the distribution. %% -\def\filedate{2020/10/03} +\def\filedate{2020/10/06} \def\batchfile{babel.ins} \input docstrip.tex diff --git a/macros/latex/required/babel/base/babel.pdf b/macros/latex/required/babel/base/babel.pdf Binary files differindex 85865d7cf6..b032d324ec 100644 --- a/macros/latex/required/babel/base/babel.pdf +++ b/macros/latex/required/babel/base/babel.pdf diff --git a/macros/latex/required/babel/base/bbcompat.dtx b/macros/latex/required/babel/base/bbcompat.dtx index 09bc92e3ef..cb2c9a078f 100644 --- a/macros/latex/required/babel/base/bbcompat.dtx +++ b/macros/latex/required/babel/base/bbcompat.dtx @@ -30,7 +30,7 @@ % % \iffalse %<*dtx> -\ProvidesFile{bbcompat.dtx}[2020/10/03 v3.49] +\ProvidesFile{bbcompat.dtx}[2020/10/06 v3.50] %</dtx> % %% File 'bbcompat.dtx' |