diff options
author | Norbert Preining <norbert@preining.info> | 2021-06-21 03:01:17 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2021-06-21 03:01:17 +0000 |
commit | e5ca43f7439d850f4193a932455792429cff61eb (patch) | |
tree | 35693997358e4b78d3efaeccbf948d9d68cf11ac /macros | |
parent | 0b024adf546cd484554e4de5bd1a9919a4fdd03d (diff) |
CTAN sync 202106210301
Diffstat (limited to 'macros')
78 files changed, 1516 insertions, 1039 deletions
diff --git a/macros/generic/expkv-cs/README.md b/macros/generic/expkv-cs/README.md index 89ab6b6de6..a3f1a6067e 100644 --- a/macros/generic/expkv-cs/README.md +++ b/macros/generic/expkv-cs/README.md @@ -1,7 +1,7 @@ ------------------------------------------------------------------------------- # expkv-cs -- define expandable key=val macros using expkv -Version 2021-06-03 v0.10 +Version 2021-06-20 v1.0 Released under the LaTeX Project Public License v1.3c or later See http://www.latex-project.org/lppl.txt diff --git a/macros/generic/expkv-cs/expkv-cs.dtx b/macros/generic/expkv-cs/expkv-cs.dtx index 55a6a134aa..599750404a 100644 --- a/macros/generic/expkv-cs/expkv-cs.dtx +++ b/macros/generic/expkv-cs/expkv-cs.dtx @@ -86,7 +86,7 @@ and the derived files expkv-cs.pdf \RequirePackage{caption} \RequirePackage{microtype} \RequirePackage{accsupp} -\lstdefinelanguage{expkvd}[primitive]{TeX} +\lstdefinelanguage{expkvc}[primitive]{TeX} { ,moretexcs=[4]^^A e-TeX { @@ -124,13 +124,15 @@ and the derived files expkv-cs.pdf ekvcHash,ekvcHashAndForward,ekvcHashAndUse, ekvcValue,ekvcValueFast,ekvcValueSplit,ekvcValueSplitFast, ekvcSecondaryKeys, + ekvcChange, ekvcFlagNew, ekvcFlagHeight, ekvcFlagRaise, ekvcFlagSetTrue,ekvcFlagSetFalse, ekvcFlagIf,ekvcFlagIfRaised, ekvcFlagReset, - ekvcFlagGetHeight,ekvcFlagGetHeights + ekvcFlagGetHeight,ekvcFlagGetHeights, + ekvcPass } ,moretexcs=[3]^^A expkv-pkg macros { @@ -157,7 +159,7 @@ and the derived files expkv-cs.pdf \def\mylstwd{.55em} \lstset { - ,language=expkvd + ,language=expkvc ,flexiblecolumns=false ,basewidth=\mylstwd ,gobble=2 @@ -214,6 +216,7 @@ and the derived files expkv-cs.pdf \definecolor{expkvred}{HTML}{9F393D} \colorlet{expkvgrey}{black!75} \makeatletter +\newcommand*\example{\par\smallskip\noindent\textit{Example:} \ignorespaces} \newcommand*\expkv {^^A \texorpdfstring @@ -282,9 +285,11 @@ and the derived files expkv-cs.pdf \DoNotIndex{\protected,\ProvidesFile,\ProvidesPackage,\relax,\space,\advance} \DoNotIndex{\@,\unexpanded,\string,\expanded,\dimexpr,\global,\glueexpr,\hbox} \DoNotIndex{\numexpr,\RequirePackage,\setbox,\the,\unless,\xdef,\gdef,\newcount} -\DoNotIndex{\^,\@firstofone,\@firstoftwo,\@gobble} +\DoNotIndex{\number,\detokenize,\meaning} +\DoNotIndex{\^,\@firstofone,\@firstoftwo,\@gobble,\@secondoftwo} \DoNotIndex{\ifcsname} \DoNotIndex{\ifx} +\DoNotIndex{\ifodd} \DoNotIndex{\ifnum} \DoNotIndex{\ifdefined} \DoNotIndex{\iffalse} @@ -296,6 +301,7 @@ and the derived files expkv-cs.pdf \@gobble\fi ^^A ignoring \ifx, \ifcsname, etc., but only one \fi \@gobble\fi ^^A ignoring \ifx, \ifcsname, etc., but only one \fi \@gobble\fi ^^A ignoring \ifx, \ifcsname, etc., but only one \fi +\@gobble\fi ^^A ignoring \ifx, \ifcsname, etc., but only one \fi \@ifdefinable\gobbledocstriptag{\def\gobbledocstriptag#1>{}} \makeatother \begin{document} @@ -357,12 +363,14 @@ and the derived files expkv-cs.pdf % has its own set of primary and secondary keys. % % A word of advice you should consider: If your macro doesn't have to be -% expandable (and often it doesn't) don't use \expkvc. The interface has some -% overhead (though it still can be considered fast -- check \autoref{sec:speed}) -% and the approach has its limits in versatility. If you don't need to be +% expandable (and often it doesn't) consider not using \expkvc. The interface +% has some overhead (though it still is fast -- check \autoref{sec:speed}) and +% the approach has its limits in versatility. If you don't need to be % expandable, you should consider either defining your keys manually using % \expkv\ or using \expkvd\ for convenience. Or you resort to another \kv\ -% interface. +% interface. Nevertheless setting up macros with \expkvc, especially with +% |\ekvcSplit|, is very convenient in my opinion, so if you just want to define +% a single macro with just a few keys this might be the way to go. % % \expkvc\ is usable as generic code and as a \LaTeX\ package. It'll % automatically load \expkv\ in the same mode as well. To use it, just use one @@ -373,13 +381,14 @@ and the derived files expkv-cs.pdf % \end{lstlisting} % % -% \subsection{Define Macros and Primary Keys} +% \subsection{Define Macros and Primary Keys}\label{sec:define} % % All macros defined with \expkvc\ have to be previously undefined or have the -% |\meaning| of |\relax|. This is necessary as there is no way to undefine keys -% once they are set up (neither \expkv\ nor \expkvc\ keep track of defined -% keys) -- so to make sure there are no conflicts only new definitions are -% allowed (that's not the case for individual keys, only for frontend macros). +% |\meaning| of |\relax|. This is necessary as there is no way to automatically +% undefine keys once they are set up (neither \expkv\ nor \expkvc\ keep track of +% defined keys) -- so to make sure there are no conflicts only new definitions +% are allowed (that's not the case for individual keys, only for frontend +% macros). % % % \subsubsection{Primary Keys}\label{sec:primaries} @@ -389,11 +398,36 @@ and the derived files expkv-cs.pdf % primary key and \val\ the associated initial value. By default all keys are % defined short, but you can define long keys by prefixing \key\ with |long| % (\emph{e.g.}, \texttt{long name=Jonathan P. Spratte}). You only need |long| if -% the key should be able to take a |\par| token. Note however that |long| keys -% are a microscopic grain faster (due to some internals of \expkvc). Only if at -% least one of the keys was |long| the \meta{cs} in the following defining -% macros will be |\long|. For obvious reasons there is no possibility to define -% a macro or key as |\protected|. +% the key should be able to take an explicit |\par| token. Note however that +% |long| keys are a microscopic grain faster (due to some internals of \expkvc). +% Only if at least one of the keys was |long| the \meta{cs} in the following +% defining macros will be |\long|. For obvious reasons there is no possibility +% to define a macro or key as |\protected|. +% +% To allow keys not defined |long| which key names should start with |long|, you +% can also use the prefix |short| (|short| and |long| are mutually exclusive, +% which ever comes first defines the behaviour, the latter is considered part of +% the key name). Note that this is the only reason for |short|'s existance, +% essentially it does nothing. +% +% The consequence culminates in the following: +% \begin{lstlisting} +% \ekvcSplit\foo +% { +% long short = abc\par +% ,short long = def +% } +% {#1#2} +% \end{lstlisting} +% will define a macro |\foo| that knows two primary keys, the first one is +% called |short|, and accepts explicit |\par| tokens inside its values, the +% second one is called |long| and will not accept |\par| tokens (leading to a +% low level \TeX\ error). A description of |\ekvcSplit| follows shortly. +% +% There is one exception to these syntax rules of \meta{primary keys}: One can +% include a key named |...| without a value. If this is found the \meta{cs} will +% be defined |\long|. Any unknown keys found at use time will end up in a list +% at this spot. See some examples in \autoref{sec:unknown}. % % At the moment \expkvc\ doesn't require any internal keys, but I can't foresee % whether this will be the case in the future as well, as it might turn out that @@ -420,6 +454,20 @@ and the derived files expkv-cs.pdf % key defined first). With |\ekvcSplit| you can define macros using at most % nine primary keys. % \end{function} +% \example The following defines a macro |\foo| that takes the keys |a| and |b| +% and outputs their values in a textual form:\\ +% \begin{minipage}{.75\linewidth} +% \begin{lstlisting} +% \ekvcSplit\foo{a=a,b=b}{a is #1.\par b is #2.\par} +% \foo{} +% \foo{b=e} +% \end{lstlisting} +% \end{minipage}^^A +% \begin{exresult}[nobeforeafter,box align=center]{.25\linewidth} +% \ekvcSplit\foo{a=a,b=b}{a is #1.\par b is #2.\par} +% \foo{} +% \foo{b=e} +% \end{exresult} % % \begin{function}{\ekvcSplitAndForward} % \begin{syntax} @@ -439,6 +487,9 @@ and the derived files expkv-cs.pdf % \ekvcSplitAndForward\foo{\foo@aux{more args}}{keyA = A, keyB = B} % \end{lstlisting} % \end{function} +% \noindent +% In the first case |\foo@aux| should take at least two arguments (|keyA| and +% |keyB|), in the second case at least three (|more args|, |keyA|, and |keyB|). % % \begin{function}{\ekvcSplitAndUse} % \begin{syntax} @@ -448,20 +499,23 @@ and the derived files expkv-cs.pdf % specifying what will be used after splitting the keys, \meta{cs} will use % what follows the \kv\ list. So its syntax will be % \end{function} -% \begin{syntax} -% \meta{cs}\{\key=\val, \ldots\}\marg{after} -% \end{syntax} +% \begin{quote} +% \ttfamily +% \meta{cs}\{\key=\val, \ldots\}\marg{after} +% \end{quote} +% and the code in |after| should expect at least as many arguments as the number +% of keys defined for \meta{cs}. % % \subsubsection{Hash} % % The hash variants will provide the key values as a single argument in which % you can access specific values using a special macro. The implementation might -% be more convenient and scale better, \emph{but} it is much slower (for a -% primitive macro with a single key benchmarking was almost $1.7$ times slower, -% the root of which being the key access with |\ekvcValue|, not the parsing, and -% for a key access using |\ekvcValueFast| it was still about $1.2$ times -% slower). So if your macro uses less than ten primary keys, you should most -% likely use the split approach. +% be more convenient and scale better, \emph{but} it is slower (for a +% rudimentary macro with a single key benchmarking was almost $1.7$ times +% slower, the root of which being the key access with |\ekvcValue|, not the +% parsing, and for a key access using |\ekvcValueFast| it was still about $1.2$ +% times slower). So if your macro uses less than ten primary keys, you should +% consider using the split approach. % % \begin{function}{\ekvcHash} % \begin{syntax} @@ -474,6 +528,22 @@ and the derived files expkv-cs.pdf % \meta{definition}, in which you can access the \val\ of a \key\ by using % \texttt{\cs[no-index]{ekvcValue}\{\key\}\{\#1\}}. % \end{function} +% \example This defines an equivalent macro to the |\foo| defined with +% |\ekvcSplit| earlier:\\ +% \begin{minipage}{.75\linewidth} +% \begin{lstlisting} +% \ekvcHash\foo{a=a,b=b}{a is \ekvcValue{a}{#1}.\par +% b is \ekvcValue{b}{#1}.\par} +% \foo{} +% \foo{b=e} +% \end{lstlisting} +% \end{minipage}^^A +% \begin{exresult}[nobeforeafter,box align=center]{.25\linewidth} +% \ekvcHash\foo{a=a,b=b}{a is \ekvcValue{a}{#1}.\par +% b is \ekvcValue{b}{#1}.\par} +% \foo{} +% \foo{b=e} +% \end{exresult} % % \begin{function}{\ekvcHashAndForward} % \begin{syntax} @@ -489,18 +559,26 @@ and the derived files expkv-cs.pdf % \texttt{\cs[no-index]{ekvcValue}\{\key\}\{\#1\}} (or whichever argument the % hashed \kv\ list will be). % \end{function} +% \example This defines a macro |\foo| processing two keys, and passing the +% result to |\foobar|: +% \begin{lstlisting} +% \ekvcHashAndForward\foo\foobar{a=a,b=b} +% \newcommand*\foobar[1]{a is \ekvcValue{a}{#1}.\par +% b is \ekvcValue{b}{#1}.\par} +% \end{lstlisting} % % \begin{function}{\ekvcHashAndUse} % \begin{syntax} % \cs{ekvcHashAndUse}\meta{cs}\marg{primary keys} % \end{syntax} % This will roughly do the same as |\ekvcHashAndForward|, but instead of -% specifying what will be used after hashing the keys, \meta{cs} will use what -% follows the \kv\ list. So its syntax will be +% specifying what will be used after hashing the keys at install time, +% \meta{cs} will use what follows the \kv\ list. So its syntax will be % \end{function} -% \begin{syntax} -% \meta{cs}\{\key=\val, \ldots\}\marg{after} -% \end{syntax} +% \begin{quote} +% \ttfamily +% \meta{cs}\{\key=\val, \ldots\}\marg{after} +% \end{quote} % % \begin{function}{\ekvcValue} % \begin{syntax} @@ -525,9 +603,9 @@ and the derived files expkv-cs.pdf % a result this is about $1.4$ times faster \emph{but} will throw low level % \TeX\ errors eventually if the hash function isn't defined or the \key\ % isn't part of the \meta{key list} (\emph{e.g.}, because it was defined as a -% key for another macro -- all macros share the same hash function per \key). -% Use it if you know what you're doing. This macro needs exactly three steps -% of expansion in the no-errors case. +% key for another macro -- all macros share the same hash function per \key\ +% name). Use it if you know what you're doing. This macro needs exactly three +% steps of expansion in the no-errors case. % \end{function} % % \begin{function}{\ekvcValueSplit} @@ -537,13 +615,34 @@ and the derived files expkv-cs.pdf % If you need a specific \key\ from a \meta{key list} more than once, it'll % be a good idea to only extract it once and from then on keep it as a % separate argument. Hence the macro \cs{ekvcValueSplit} will extract one -% specific \key's value from the list and forward the remainder of the list -% as the first and the \key's value as the second argument to \meta{next}, so -% the result of this will be \meta{next}\marg{key list'}\marg{value} with -% \meta{key list'} the remaining list. This is almost as fast as |\ekvcValue| -% and runs the same tests. Keep in mind that you can't fetch for the same -% \key\ again from \meta{key list'} as it got removed. +% specific \key's value from the list and forward it as an argument to +% \meta{next}, so the result +% of this will be \meta{next}\marg{value}. This is roughly as fast as +% |\ekvcValue| and runs the same tests. % \end{function} +% \example The following defines a macro |\foo| which will take three keys. +% Since the next parsing step will need the value of one of the keys multiple +% times we split that key off the list (in this example the next step doesn't +% use the key multiple times for simplicity though), and the entire list is +% forwarded as the second argument:\\ +% \begin{minipage}{.75\linewidth} +% \begin{lstlisting} +% \ekvcHash\foo{a=a,b=b,c=c} +% {\ekvcValueSplit{a}{#1}\foobar{#1}} +% \newcommand*\foobar[2]{a is #1.\par +% b is \ekvcValue{b}{#2}.\par +% c is \ekvcValue{c}{#2}.\par} +% \foo{} +% \end{lstlisting} +% \end{minipage}^^A +% \begin{exresult}[nobeforeafter,box align=center]{.25\linewidth} +% \ekvcHash\foo{a=a,b=b,c=c} +% {\ekvcValueSplit{a}{#1}\foobar{#1}} +% \newcommand*\foobar[2]{a is #1.\par +% b is \ekvcValue{b}{#2}.\par +% c is \ekvcValue{c}{#2}.\par} +% \foo{} +% \end{exresult} % % \begin{function}{\ekvcValueSplitFast} % \begin{syntax} @@ -555,7 +654,7 @@ and the derived files expkv-cs.pdf % \end{function} % % -% \subsection{Secondary Keys} +% \subsection{Secondary Keys}\label{sec:secondaries} % % To remove some of the limitations with the approach that each primary key % matches an argument or hash entry, you can define secondary keys. Those have @@ -641,8 +740,8 @@ and the derived files expkv-cs.pdf % If \key\ is a defined value taking key, you can define a |NoVal| version % with this that will behave as if \key\ was given \meta{default} as its % \val. Note that this doesn't change the initial values of primary keys set -% at definition time in |\ekvcSplit| and friends. \key\ can be a primary or -% secondary key. +% at definition time in |\ekvcSplit| and friends (see |\ekvcChange| in +% \autoref{sec:change} for this). \key\ can be a primary or secondary key. % \end{function} % % \begin{function}{flag-bool} @@ -681,6 +780,167 @@ and the derived files expkv-cs.pdf % \end{function} % % +% \subsection{Changing the Initial Values}\label{sec:change} +% +% \begin{function}{\ekvcChange} +% \begin{syntax} +% \cs{ekvcChange}\meta{cs}\{\kv,\ldots\} +% \end{syntax} +% This processes the \kv\ list for the macro \meta{cs} to set new defaults for +% it (meaning the values used if you don't provide anything at use time, not +% those specified with the |default| secondary key). \meta{cs} should be +% defined with \expkvc\ (so with any of the methods in \autoref{sec:define}). +% Inside the \kv\ list both primary and secondary keys can be used. If +% \meta{cs} was defined |\long| earlier it will still be |\long|, every other +% \TeX\ prefix will be stripped (but \expkvc\ doesn't support them anywhere +% else so that should be fine). The resulting new defaults will be stored +% inside the \meta{cs} locally (just as the original defaults were). If there +% was an unknown key forwarding added to \meta{cs} (see \autoref{sec:unknown}) +% any unknown key will be stored inside the list of unknown keys as well. +% |\ekvcChange| is not expandable! +% \end{function} +% +% Consider the following example:\\ +% \begin{minipage}[c]{.75\linewidth} +% \begin{lstlisting} +% \ekvcSplit\foo{a=a,b=b}{a is #1.\par b is #2.\par} +% \begingroup +% \ekvcChange\foo{b=B} +% \foo{} % new defaults +% \ekvcSecondaryKeys\foo{meta c={a={#1},b={#1}}} +% \ekvcChange\foo{c=c} +% \foo{} % newer defaults +% \endgroup +% \foo{} % initial defaults +% \end{lstlisting} +% \end{minipage}^^A +% \begin{exresult}[nobeforeafter,box align=center]{.25\linewidth} +% \ekvcSplit\foo{a=a,b=b}{a is #1.\par b is #2.\par} +% \begingroup +% \ekvcChange\foo{b=B} +% \foo{} +% \ekvcSecondaryKeys\foo{meta c={a={#1},b={#1}}} +% \ekvcChange\foo{c=c} +% \foo{} +% \endgroup +% \foo{} +% \end{exresult} +% +% As a result with this the typical setup macro could be implemented: +% \begin{lstlisting} +% \ekvcHashAndUse\foo{key=a,key=b} +% \newcommand*\foosetup{\ekvcChange\foo} +% \end{lstlisting} +% Of course the usage is limited to a single macro |\foo|, hence this might not +% be as powerful as similar macros used with other \kv\ interfaces. But at least +% a few similar macros could be grouped using the same key parsing macro +% internally. +% +% +% \subsection{Handling Unknown Keys}\label{sec:unknown} +% +% If your macro should handle unknown keys without directly throwing an error +% you can use the special |...| marker in the \meta{primary keys} list. Since +% those keys will be processed once by \expkv\ they will be forwarded +% normalised: The key name will be the result of one |\detokenize|, the value +% will be forwarded as \verb*| {|\meta{value}\verb*|} |, so with spaces around +% one set of braces (this way, most other \kv\ implementations should parse the +% correct input). +% +% The exact behaviour differs slightly between the two variants (as all keys +% do). The behaviour inside the split variants will be similar to normal primary +% keys, the $n$-th argument (corresponding to the position of |...| inside the +% primary keys list) will contain any unknown key encountered while parsing the +% argument. And inside the split variant you can use a primary key named |...| +% at the same time. +% +% \example The following will forward any unknown key to |\includegraphics| to +% control the appearance while processing its own keys:\\ +% \begin{minipage}{.6\linewidth} +% \begin{lstlisting} +% \newcommand*\foo{\ekvoptarg\fooKV{}} +% \ekvcSplitAndForward\fooKV\fooOUT +% { +% a=a +% ,... +% ,b=b +% ,...={} +% } +% \newcommand\fooOUT[5] +% {% +% a is #1 and b is #3.\par +% \includegraphics[{#2}]{#5}\par +% \texttt{...} is #4.\par +% } +% \foo[width=.5\linewidth, b=c, +% ...={a stupid key name, but works}] +% {example-image-duck} +% \end{lstlisting} +% \end{minipage}^^A +% \begin{exresult}[nobeforeafter,box align=center]{.4\linewidth} +% \newcommand*\foo{\ekvoptarg\fooKV{}} +% \ekvcSplitAndForward\fooKV\fooOUT +% { +% a=a +% ,... +% ,b=b +% ,...={} +% } +% \newcommand\fooOUT[5] +% {% +% a is #1 and b is #3.\par +% \includegraphics[{#2}]{#5}\par +% \texttt{...} is #4.\par +% } +% \foo[width=.5\linewidth, b=c, +% ...={a stupid key name, but works}] +% {example-image-duck} +% \end{exresult} +% +% Inside the hash variants the unknown keys list will be put inside the hash +% named |...| (we have to use some name, so why not this). As a consequence a +% primary key named |...| would clash with the unknown key handler. If you still +% used such a key it would remove any unknown key stored there until that point +% and replace the list with its value. +% +% \example The following is more or less equivalent to the example above, but +% with the hash variant, and it will not contain the primary |...| key. We have +% to make sure that |\includegraphics| sees the \kv\ list, so need to expand +% |\ekvcValue{...}{#1}| before |\includegraphics| parses it.\\ +% \begin{minipage}{.76\linewidth} +% \begin{lstlisting} +% \newcommand*\foo{\ekvoptarg\fooKV{}} +% \ekvcHashAndForward\fooKV\fooOUT +% {a=a, b=b, ...} +% \newcommand\fooOUT[2] +% {% +% a is \ekvcValue{a}{#1} and +% b is \ekvcValue{b}{#1}.\par +% \expanded{\noexpand\includegraphics +% [{\ekvcValue{...}{#1}}]} +% {#2}\par +% } +% \foo[width=\linewidth, b=c] +% {example-image-duck-portrait} +% \end{lstlisting} +% \end{minipage}^^A +% \begin{exresult}[nobeforeafter,box align=center]{.24\linewidth} +% \newcommand*\foo{\ekvoptarg\fooKV{}} +% \ekvcHashAndForward\fooKV\fooOUT +% {a=a, b=b, ...} +% \newcommand\fooOUT[2] +% {% +% a is \ekvcValue{a}{#1} and +% b is \ekvcValue{b}{#1}.\par +% \expanded{\noexpand\includegraphics +% [{\ekvcValue{...}{#1}}]} +% {#2}\par +% } +% \foo[width=\linewidth, b=c] +% {example-image-duck-portrait} +% \end{exresult} +% +% % \subsection{Flags}\label{sec:flags} % % The idea of flags is taken from \pkg{expl3}. They provide a way to store @@ -693,7 +953,8 @@ and the derived files expkv-cs.pdf % % The state of flags is always changed locally to the current group, but not to % the current macro, so if you're using one of the |t|-types involving flags -% bear in mind that they can affect other macros at the current group level! +% bear in mind that they can affect other macros using the same flags at the +% current group level! % % \expkvc\ provides some macros to access, alter, and use flags. Flags of % \expkvc\ don't share a name space with the flags of \pkg{expl3}. @@ -706,7 +967,7 @@ and the derived files expkv-cs.pdf % whether the macro \meta{flag} is currently undefined. A \meta{flag} will % expand to the flag's current height with a trailing space (so you can use it % directly with |\ifnum| for example and it will terminate the number scanning -% itself). +% on its own). % \end{function} % % All other macros dealing with flags take as a parameter a macro defined as a @@ -791,26 +1052,26 @@ and the derived files expkv-cs.pdf % \end{function} % % -% \subsection{Example} +% \subsection{Further Examples}\label{sec:examples} % -% How could a documentation be a good documentation without some basic examples? -% Say we want to define a small macro expanding to some character description -% (who knows why this has to be expandable?). A character description will not -% have too many items to it, so we use |\ekvcSplit|. +% How could a documentation be a good documentation without enough basic +% examples? Say we want to define a small macro expanding to some character +% description (who knows why this has to be expandable?). A character +% description will not have too many items to it, so we use |\ekvcSplit| (the +% comments with the parameter numbers are of course not necessary and just ease +% reading the example). % \begin{lstlisting} % \ekvcSplit\character % { -% name=John Doe, -% age=any, -% nationality=the Universe, -% hobby=to exist, -% type=Mister, -% pronoun=He, -% possessive=his, -% } -% {% -% #1 is a #5 from #3. #6 is of #2 age and #7 hobby is #4.\par +% name=John Doe, % #1 +% age=any, % #2 +% nationality=the Universe, % #3 +% hobby=to exist, % #4 +% type=Mister, % #5 +% pronoun=He, % #6 +% possessive=his, % #7 % } +% {#1 is a #5 from #3. #6 is of #2 age and #7 hobby is #4.\par} % \end{lstlisting} % Also we want to give some short cuts so that it's easier to describe several % persons. @@ -854,7 +1115,7 @@ and the derived files expkv-cs.pdf % As one might see, the |lady| key could actually have been an |nmeta| key as % well, as all that is done with the argument is using it as a \kv\ list. % -% The result of all the first two usages would be: +% The result of only the first two usages would be: % \begin{exresult}{\linewidth} % \ekvcSplit\character % { @@ -898,7 +1159,9 @@ and the derived files expkv-cs.pdf % and mandatory arguments as well. A small nonsense example (which should % perhaps use |\ekvcSplitAndForward| instead of |\ekvcHashAndForward| since it % only uses four keys and one other argument -- and isn't expandable since it -% uses a \env{tabular} environment): +% uses a \env{tabular} environment, so it would've been better to use a more +% feature rich \kv\ interface most likely, \emph{e.g.}, the one provided by +% \expkvd): % \begin{lstlisting} % \makeatletter % \newcommand*\nonsense{\ekvoptarg\nonsense@a{}} @@ -957,6 +1220,70 @@ and the derived files expkv-cs.pdf % \end{exresult} % % +% \subsection{Freedom for Keys!} +% +% If this was the \TeX book this subsection would have a double bend sign. Not +% because it is overly complicated, but because it shows things which could +% break \expkvc's expandability and its alignment safety. This is for +% experienced users wanting to get the most flexibility and knowing what they +% are doing. +% +% In case you're wondering, it is possible to define other keys than the +% primaries and the secondary types listed in \autoref{sec:secondaries} for a +% macro defined with \expkvc\ by using the low-level interface of \expkv\ or +% even the interface provided by \expkvd. The set name used for \expkvc's keys +% is the macro name, including the leading backslash, or more precisely +% |\string|\meta{cs} is used. This can be exploited to define additional keys +% with arbitrary code. Consider the following \emph{bad} example: +% \begin{lstlisting} +% \ekvcSplit\foo{a=A,b=B}{a is #1.\par b is #2\par} +% \protected\ekvdef{\string\foo}{c}{\def\fooC{#1}} +% \end{lstlisting} +% This would define a key named |c| that will store its value inside a macro. +% The issue with this is that this can't be done expandably. As a result, the +% macro |\foo| isn't always expandable any more (not that bad if this was never +% required; killjoy if it was) and as soon as the key |c| is used, it is also no +% longer alignment safe\footnote{This means that the \kv-list can't contain +% alignment markers that are not inside an additional set of braces if used +% inside a \TeX\ alignment.} +% (might be bad depending on the usage). +% +% So why do I show you this? Because we could as well do something useful like +% create a key that pre-parses the input and after that passes the parsed value +% on. This parsing would have to be completely expandable though. For the +% pass-on part we can use the following function: +% +% \begin{function}{\ekvcPass} +% \begin{syntax} +% \cs{ekvcPass}\meta{cs}\marg{key}\marg{value} +% \end{syntax} +% This passes \meta{value} on to \meta{key} for the \expkvc-macro \meta{cs}. +% It should be used inside the key parsing of a macro defined with \expkvc, +% else this most likely results in a low level \TeX\ error. You can't forward +% anything to the special unknown key handler |...| as that is no defined key. +% \end{function} +% +% With this we could for example split the value of a key at a hyphen and pass +% the parts to different keys:\\ +% \begin{minipage}[c]{.75\linewidth} +% \begin{lstlisting} +% \ekvcSplit\foo{a=A,b=B}{a is #1.\par b is #2.\par} +% \ekvdef{\string\foo}{c}{\fooSplit#1\par} +% \def\fooSplit#1-#2\par +% {\ekvcPass\foo{a}{#1}\ekvcPass\foo{b}{#2}} +% \foo{} +% \foo{c=1-2} +% \end{lstlisting} +% \end{minipage}^^A +% \begin{exresult}[nobeforeafter,box align=center]{.25\linewidth} +% \ekvcSplit\foo{a=A,b=B}{a is #1.\par b is #2.\par} +% \ekvdef{\string\foo}{c}{\fooSplit#1\par} +% \def\fooSplit#1-#2\par{\ekvcPass\foo{a}{#1}\ekvcPass\foo{b}{#2}} +% \foo{} +% \foo{c=1-2} +% \end{exresult} +% +% % \subsection{Speed Considerations}\label{sec:speed} % % As already mentioned in the introduction there are some speed considerations @@ -965,13 +1292,13 @@ and the derived files expkv-cs.pdf % use case. The key-parsing is still faster than with most other \kv\ packages % (see the ``Comparisons'' subsection in the \expkv\ documentation). % -% The speed considerations in this subsection use the first example in this -% documentation as the benchmark. So we have seven keys and a short sentence -% which should be typeset. For comparisons I use the following equivalent -% \expkvd\ definitions. Each result is the average between changing no keys from -% their initial values and altering four. Furthermore I'll compare three -% variants of \expkvc\ with the \expkvd\ definitions, namely the split example -% from above, a hash variant using |\ekvcValue| and a hash variant using +% The speed considerations in this subsection use the first example of +% \autoref{sec:examples} as the benchmark. So we have seven keys and a short +% sentence which should be typeset. For comparisons I use the following +% equivalent \expkvd\ definitions. Each result is the average between changing +% no keys from their initial values and altering four. Furthermore I'll compare +% three variants of \expkvc\ with the \expkvd\ definitions, namely the split +% example from above, a hash variant using |\ekvcValue| and a hash variant using % |\ekvcValueFast|. % \begin{lstlisting} % \usepackage{expkv-def} @@ -996,8 +1323,9 @@ and the derived files expkv-cs.pdf % {% % \begingroup % \ekvset{keys}{#1}% -% \KEYSname\ is a \KEYStype\ from \KEYSnationality. \KEYSpronoun\ is -% of \KEYSage\ age and \KEYSpossessive\ hobby is \KEYShobby.% +% \KEYSname\ is a \KEYStype\ from \KEYSnationality. +% \KEYSpronoun\ is of \KEYSage\ age and +% \KEYSpossessive\ hobby is \KEYShobby.% % \endgroup % } % \end{lstlisting} @@ -1021,14 +1349,16 @@ and the derived files expkv-cs.pdf % parsing part and only $1.5$ to $2.8$ times faster if the typesetting part is % factored in. So the real choke isn't the parsing. % -% So to summarize this, if you have a reasonable use case for expandable \kv\ -% parsing macros you should go on and define them using \expkvc. If you have a -% reasonable use case for \kv\ parsing macros but defining them expandable isn't -% necessary for your use you should take advantage of the greater flexibility of -% non-expandable \kv\ setups (but if you're after maximum speed there aren't -% that many \kv\ parsers beating \expkvc). And if you are after maximum -% performance maybe ditching the \kv\ interface altogether is a good idea, but -% depending on the number of arguments your interface might get convoluted. +% So to summarise this, if you have a use case for expandable \kv\ +% parsing macros you should go on and define them using \expkvc. If you just +% want to define a simple macro with a few keys |\ekvcSplit| might be the +% easiest interface there is. If you have a reasonable use case for \kv\ parsing +% macros but defining them expandable isn't necessary for your use you should +% take advantage of the greater flexibility of non-expandable \kv\ setups (but +% if you're after maximum speed there aren't that many \kv\ parsers beating +% \expkvc). And if you are after maximum performance maybe ditching the \kv\ +% interface altogether is a good idea, but depending on the number of arguments +% your interface might get convoluted. % % % \subsection{Useless Macros} @@ -1127,8 +1457,8 @@ and the derived files expkv-cs.pdf % \begin{macro}{\ekvcVersion,\ekvcDate} % We're on our first input, so lets store the version and date in a macro. % \begin{macrocode} -\def\ekvcVersion{0.10} -\def\ekvcDate{2021-06-03} +\def\ekvcVersion{1.0} +\def\ekvcDate{2021-06-20} % \end{macrocode} % \end{macro} % @@ -1148,6 +1478,14 @@ and the derived files expkv-cs.pdf % |\ekvc@tmp| will be reused later, but we don't need it to ever store % information long-term after \expkvc\ was initialized. % +% \begin{macro}[internal]{\ekvc@tripledots} +% This macro just serves as a marker for a comparison to allow the syntax +% for the unknown key handlers. +% \begin{macrocode} +\def\ekvc@tripledots{...} +% \end{macrocode} +% \end{macro} +% % \begin{macro}[internal]{\ekvc@keycount} % We'll need to keep count how many keys must be defined for each macro in the % |split| variants. @@ -1334,7 +1672,8 @@ and the derived files expkv-cs.pdf % \begin{macro}[internal] % { % \ekvc@SetupSplitKeys, \ekvc@SetupSplitKeys@a, \ekvc@SetupSplitKeys@b, -% \ekvc@SetupSplitKeys@c +% \ekvc@SetupSplitKeys@c, +% \ekvc@SetupSplitKeys@check@unknown,\ekvc@SetupSplitKeys@unknown % } % These macros parse the list of keys and set up the key macros. First we need % to initialise some macros and start |\ekvparse|. @@ -1344,7 +1683,7 @@ and the derived files expkv-cs.pdf \ekvc@keycount=0 \let\ekvc@any@long\ekv@empty \let\ekvc@initials\ekv@empty - \ekvparse\ekvc@err@value@required\ekvc@SetupSplitKeys@a + \ekvparse\ekvc@SetupSplitKeys@check@unknown\ekvc@SetupSplitKeys@a } % \end{macrocode} % Then we need to step the key counter for each key. Also we have to check @@ -1421,6 +1760,47 @@ and the derived files expkv-cs.pdf {}% } % \end{macrocode} +% If no value was provided this could either be an error, or the unknown key +% forwarding. We have to check this (comparing against |...| inside +% |\ekvc@tripledots|) and if this is the unknown key list type, set it up +% accordingly (advancing the key count and setting up the unknown handlers of +% \expkv). Else we simply throw an error and ignore the incident. +% \begin{macrocode} +\protected\long\def\ekvc@SetupSplitKeys@check@unknown#1% + {% + \begingroup + \edef\ekvc@tmp{\detokenize{#1}}% + \expandafter + \endgroup + \ifx\ekvc@tripledots\ekvc@tmp + \advance\ekvc@keycount1 +% \end{macrocode} +% The |\begingroup\expandafter\endgroup| ensures that the split mark isn't +% actually defined (even if it just were with meaning |\relax|). +% \begin{macrocode} + \begingroup\expandafter\endgroup + \expandafter\ekvc@SetupSplitKeys@unknown + \csname ekvc@splitmark@\the\ekvc@keycount\endcsname + \let\ekvc@any@long\long + \else + \ekvc@err@value@required{#1}% + \fi + } +% \end{macrocode} +% +% \begin{macrocode} +\protected\long\def\ekvc@SetupSplitKeys@unknown#1% + {% + \long\expandafter\def\csname\ekv@name\ekvc@set{}u\endcsname##1##2##3#1##4% + {##3#1{##4,##2= {##1} }}% + \long\expandafter\def\csname\ekv@name\ekvc@set{}uN\endcsname##1##2#1##3% + {##2#1{##3,##1}}% + \edef\ekvc@initials{\unexpanded\expandafter{\ekvc@initials#1{}}}% + \ekvc@helpers@needed + {\expandafter\ekvc@setup@splitmacro\expandafter{\the\ekvc@keycount}}% + {}% + } +% \end{macrocode} % \end{macro} % % \begin{macro}[internal]{\ekvc@split@p@long} @@ -1436,6 +1816,14 @@ and the derived files expkv-cs.pdf % \end{macrocode} % \end{macro} % +% \begin{macro}[internal]{\ekvc@split@p@short} +% The |short| prefix does essentially nothing, it is only provided to allow +% key names starting with |long| that aren't |\long|. +% \begin{macrocode} +\def\ekvc@split@p@short{\ekvc@SetupSplitKeys@c} +% \end{macrocode} +% \end{macro} +% % \begin{macro}[internal]{\ekvc@defarggobbler} % This is needed to define a macro with 1-9 parameters programmatically. % \LaTeX's \cs[no-index]{newcommand} does something similar for example. @@ -1623,7 +2011,11 @@ and the derived files expkv-cs.pdf % \end{macro} % % \begin{macro}[internal] -% {\ekvc@SetupHashKeys,\ekvc@SetupHashKeys@a,\ekvc@SetupHashKeys@b} +% {% +% \ekvc@SetupHashKeys,\ekvc@SetupHashKeys@a,\ekvc@SetupHashKeys@b, +% \ekvc@SetupHashKeys@c, +% \ekvc@SetupHashKeys@check@unknown,\ekvc@SetupHashKeys@unknown +% } % This should look awfully familiar as well, since it's just the same as for % the split keys with a few other names here and there. % \begin{macrocode} @@ -1631,7 +2023,7 @@ and the derived files expkv-cs.pdf {% \let\ekvc@any@long\ekv@empty \let\ekvc@initials\ekv@empty - \ekvparse\ekvc@err@value@required\ekvc@SetupHashKeys@a{#1}% + \ekvparse\ekvc@SetupHashKeys@check@unknown\ekvc@SetupHashKeys@a{#1}% } \protected\def\ekvc@SetupHashKeys@a#1% {% @@ -1685,6 +2077,39 @@ and the derived files expkv-cs.pdf \ekvc@setup@hashmacro{#1}% } % \end{macrocode} +% \begin{macrocode} +\protected\long\def\ekvc@SetupHashKeys@check@unknown#1% + {% + \begingroup + \edef\ekvc@tmp{\detokenize{#1}}% + \expandafter + \endgroup + \ifx\ekvc@tripledots\ekvc@tmp + \ekvc@SetupHashKeys@unknown + \let\ekvc@any@long\long + \else + \ekvc@err@value@required{#1}% + \fi + } +% \end{macrocode} +% \begin{macrocode} +\def\ekvc@SetupHashKeys@unknown#1% + {% + \protected\def\ekvc@SetupHashKeys@unknown + {% + \expandafter + \let\csname\ekv@name\ekvc@set{}u\endcsname\ekvc@hash@unknown@kv + \expandafter + \let\csname\ekv@name\ekvc@set{}uN\endcsname\ekvc@hash@unknown@k + \edef\ekvc@initials{\unexpanded\expandafter{\ekvc@initials#1{}}}% + \ekvc@setup@hashmacro{...}% + }% + \long\def\ekvc@hash@unknown@kv##1##2##3#1##4{##3#1{##4,##2= {##1} }}% + \long\def\ekvc@hash@unknown@k##1##2#1##3{##2#1{##3,##1}}% + } +\expandafter\ekvc@SetupHashKeys@unknown + \csname ekvc@hashmark@\ekvc@tripledots\endcsname +% \end{macrocode} % \end{macro} % % \begin{macro}[internal]{\ekvc@hash@p@long} @@ -1699,6 +2124,14 @@ and the derived files expkv-cs.pdf % \end{macrocode} % \end{macro} % +% \begin{macro}[internal]{\ekvc@hash@p@short} +% The |short| prefix does essentially nothing, it is only provided to allow +% key names starting with |long| that aren't |\long|. +% \begin{macrocode} +\def\ekvc@hash@p@short{\ekvc@SetupHashKeys@c} +% \end{macrocode} +% \end{macro} +% % \begin{macro}[internal]{\ekvc@setup@hashmacro} % The safe hash macros will be executed inside of an |\unexpanded| expansion % context, so they have to insert braces for that once they are done. @@ -1748,18 +2181,19 @@ and the derived files expkv-cs.pdf \unexpanded\expandafter{\csname ekvc@hashmark@#1\endcsname}% ####2####3\unexpanded{\ekvc@stop}####4% {% - ####4{####1####3}{####2}% + ####4{####2}% }% \long\gdef\unexpanded\expandafter {\csname ekvc@safesplithash@#1\endcsname}####1% {% \unexpanded\expandafter {\csname ekvc@@safesplithash@#1\endcsname}% - ####1\unexpanded{\ekvc@mark\ekvc@safe@found@hash}% + ####1\unexpanded{\ekvc@mark\ekvc@safe@after@hash}% \unexpanded\expandafter {% \csname ekvc@hashmark@#1\endcsname{}% - \ekvc@mark{\ekvc@err@missing@hash{#1}\ekvc@safe@no@hash}% + \ekvc@mark + {\ekvc@err@missing@hash{#1}\ekvc@safe@after@hash}% \ekvc@stop }% }% @@ -1770,7 +2204,7 @@ and the derived files expkv-cs.pdf ####2####3\unexpanded{\ekvc@mark}####4####5% \unexpanded{\ekvc@stop}% {% - ####4{####2}####1####3\unexpanded{\ekvc@stop}% + ####4{####2}% }% }% \ekvc@tmp @@ -1812,22 +2246,15 @@ and the derived files expkv-cs.pdf {\csname ekvc@safesplithash@#1\endcsname}% {\ekvc@err@unknown@hash{#1}\ekvcValueSplit@recover}% } -\long\def\ekvcValueSplit@recover#1#2% - {% - #2{#1}{}% - } +\long\def\ekvcValueSplit@recover#1#2{#2{}} % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\ekvc@safe@found@hash, \ekvc@safe@no@hash} +% \begin{macro}[internal]{\ekvc@safe@after@hash} % \begin{macrocode} -\long\def\ekvc@safe@found@hash#1#2\ekvc@stop#3% +\long\def\ekvc@safe@after@hash#1#2% {% - #3{#2}{#1}% - } -\long\def\ekvc@safe@no@hash#1#2\ekvc@mark\ekvc@safe@found@hash\ekvc@stop#3% - {% - #3{#2}{}% + #2{#1}% } % \end{macrocode} % \end{macro} @@ -1839,9 +2266,7 @@ and the derived files expkv-cs.pdf % sequence. % \begin{macrocode} \long\def\ekvcValueSplitFast#1#2% - {% - \csname ekvc@fastsplithash@#1\endcsname#2\ekvc@stop - } + {\csname ekvc@fastsplithash@#1\endcsname#2\ekvc@stop} % \end{macrocode} % \end{macro} % @@ -1858,8 +2283,8 @@ and the derived files expkv-cs.pdf % \begin{macrocode} \long\def\ekvc@safehash@#1{\ekvc@err@empty@hash{}} \long\def\ekvc@fasthash@#1\ekvc@stop{\ekvc@err@empty@hash} -\long\def\ekvc@safesplithash@#1#2{\ekvc@err@empty@hash#2{#1}{}} -\long\def\ekvc@fastsplithash@#1\ekvc@stop#2{\ekvc@err@empty@hash#2{#1}{}} +\long\def\ekvc@safesplithash@#1#2{\ekvc@err@empty@hash#2{}} +\long\def\ekvc@fastsplithash@#1\ekvc@stop#2{\ekvc@err@empty@hash#2{}} % \end{macrocode} % \end{macro} % @@ -1894,6 +2319,116 @@ and the derived files expkv-cs.pdf % \end{macrocode} % \end{macro} % +% \begin{macro}{\ekvcChange} +% This can be used to change the defaults of an \expkvc\ defined macro. It +% checks whether there is a set with the correct name and that the macro is +% defined. If both is true the real work is done by |\ekvc@change|. +% \begin{macrocode} +\protected\long\def\ekvcChange#1% + {% + \ekvifdefinedset{\string#1}% + {% + \ekvc@ifdefined#1% + {\ekvc@change#1}% + {\ekvc@err@no@key@macro#1\@gobble}% + }% + {\ekvc@err@no@key@macro#1\@gobble}% + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal] +% {\ekvc@change,\ekvc@change@a,\ekvc@change@b,\ekvc@change@c} +% First we need to see whether the macro is currently |\long|. For this we get +% the meaning and will parse it. |#1| is the macro name in which we want to +% change the defaults. +% \begin{macrocode} +\protected\def\ekvc@change#1% + {\expandafter\ekvc@change@a\meaning#1\ekv@stop#1} +% \end{macrocode} +% A temporary definition to get the stringified |macro:|. |##1| will be the +% list of prefixes, we don't care for the exact contents of |##2| and |##3|. +% \begin{macrocode} +\def\ekvc@change@a#1% + {% + \protected\def\ekvc@change@a##1#1##2->##3\ekv@stop + {% + \ekvc@change@iflong{##1}% + {\ekvc@change@b{}}% + {\ekvc@change@b{\long}}% + }% + } +\expandafter\ekvc@change@a\expandafter{\detokenize{macro:}} +% \end{macrocode} +% Next we expand the macro once to get its contents (including the current +% default values with their markers). |#1| is either |\long| or empty, |#2| is +% the macro. +% \begin{macrocode} +\protected\def\ekvc@change@b#1#2% + {\expandafter\ekvc@change@c\expandafter{#2{##1}}{#1}#2} +% \end{macrocode} +% Here we place an unbalanced closing brace after the expansion of the macro. +% Then we just parse the \kv-list with |\ekvset|, that will exchange the +% values behind the markers. Once those are changed we give control to +% |\ekvc@change@d|. The |\ekvset| step might horribly fail if the user defined +% some keys that don't behave nice. |#1| is the expansion of the macro, |#2| +% is either |\long| or empty, |#3| is the macro, and |#4| is the \kv-list +% containing the new defaults. +% \begin{macrocode} +\ekv@exparg{\protected\long\def\ekvc@change@c#1#2#3#4}% + {% + \expandafter\iffalse\expandafter{\expandafter\fi + \ekvset{\string#3}{#4}% + \ekvc@change@d{#2}{#3}% + #1% + }% + } +% \end{macrocode} +% The final step needs to put an unbalanced opening brace after |\def|. We do +% that with the help of a temporary macro which stores everything necessary +% for |\def| and expand an |\iffalse}\fi| construct to leave a single +% opening brace. |#1| will be either empty or |\long| and |#2| is the macro. +% Each of the macros defined with \expkvc\ takes exactly one parameter, so we +% put that here as |####1|. +% \begin{macrocode} +\protected\def\ekvc@change@d#1#2% + {% + \def\ekvc@tmp{#1\def#2####1}% + \expandafter\ekvc@tmp\expandafter{\iffalse}\fi + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal]{\ekvc@change@iflong,\ekvc@change@iflong@} +% Checking whether a string contains the string representation of |\long| can +% be done by gobbling everything up to the first |\long| and checking whether +% the result is completely empty. We need a temporary macro to get the result +% of |\string\long| inside the definitions. +% \begin{macrocode} +\def\ekvc@change@iflong#1% + {% + \protected\def\ekvc@change@iflong##1% + {\expandafter\ekv@ifempty\expandafter{\ekvc@change@iflong@##1#1}}% + \def\ekvc@change@iflong@##1#1{} + } +\expandafter\ekvc@change@iflong\expandafter{\string\long} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ekvcPass} +% This macro can be used to pass a value to a key of some macro (this way +% more complicated key codes are possible that in the end pass processed +% values on to some macro). The implemantation is pretty straight forward. +% \begin{macrocode} +\long\def\ekvcPass#1#2% + {% + \ekvifdefined{\string#1}{#2}% + {\csname\ekv@name{\string#1}{#2}\endcsname}% + {\ekvc@err@unknown@key@or@macro{#1}{#2}\@gobble}% + } +% \end{macrocode} +% \end{macro} +% % % \subsubsection{Secondary Key Types} % @@ -2287,7 +2822,7 @@ and the derived files expkv-cs.pdf % \begin{macro}[internal] % { % \ekvc@err@toomany,\ekvc@err@value@required,\ekvc@err@missing@type, -% \ekvc@err@already@defined +% \ekvc@err@already@defined,\ekvc@err@no@key@macro % } % Boring unexpandable error messages. % \begin{macrocode} @@ -2322,6 +2857,8 @@ and the derived files expkv-cs.pdf \errmessage {expkv-cs Error: Unknown key `\unexpanded{#1}' for macro `\ekvc@set'}% } +\long\def\ekvc@err@no@key@macro#1% + {\errmessage{expkv-cs Error: \string#1 is no key=val macro}} % \end{macrocode} % \end{macro} % @@ -2343,6 +2880,8 @@ and the derived files expkv-cs.pdf \long\def\ekvc@err@missing@hash#1{\ekvc@err{hash `#1' not found}} \long\def\ekvc@err@empty@hash{\ekvc@err{empty hash}} \def\ekvc@err@invalid@bool#1{\ekvc@err{invalid boolean value `#1'}} +\long\def\ekvc@err@unknown@key@or@macro#1#2% + {\ekvc@err{unknown key `#2' for macro #1}} % \end{macrocode} % \end{macro} % diff --git a/macros/generic/expkv-cs/expkv-cs.pdf b/macros/generic/expkv-cs/expkv-cs.pdf Binary files differindex 1e19349f76..b5d42c197b 100644 --- a/macros/generic/expkv-cs/expkv-cs.pdf +++ b/macros/generic/expkv-cs/expkv-cs.pdf diff --git a/macros/latex/contrib/docassembly/README.md b/macros/latex/contrib/docassembly/README.md index 6765966759..e5897f2e8c 100644 --- a/macros/latex/contrib/docassembly/README.md +++ b/macros/latex/contrib/docassembly/README.md @@ -9,7 +9,7 @@ %% macros/latex/base/lppl.txt; either version 1.2 of %% %% the License, or (at your option) any later version. %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -Dated: 2021-06-18 +Dated: 2021-06-19 Targeted audience: LaTeX authors who love their pdflatex, lualtex, xelatex, or dvips -> ps2pdf workflow, who also own Acrobat Pro application. @@ -25,6 +25,9 @@ package, which generally restricted to a dvips -> distiller workflow. Now, these methods are available to all those who own Acrobat, no matter what PDF creator used. +What's New (2021-06-19) Moved some documentation from this package to + the acrotex-js package. New require acrotex-js dated 2021/06/19 or later. + Now, I simply must get back to my retirement. D. P. Story diff --git a/macros/latex/contrib/docassembly/docassembly.dtx b/macros/latex/contrib/docassembly/docassembly.dtx index 429ee327e4..0f92b42948 100644 --- a/macros/latex/contrib/docassembly/docassembly.dtx +++ b/macros/latex/contrib/docassembly/docassembly.dtx @@ -14,7 +14,7 @@ %</copyright> %<package>\NeedsTeXFormat{LaTeX2e}[1997/12/01] %<package>\ProvidesPackage{docassembly} -%<package> [2021/06/18 v1.1 docassembly: Post PDF creation assembly (dps)] +%<package> [2021/06/19 v1.2 docassembly: Post PDF creation assembly (dps)] %<*driver> \documentclass{ltxdoc} \usepackage{amstext} @@ -88,14 +88,15 @@ % or even the much hated \app{dvips \texttt{->} Adobe Distiller}). % \end{minipage}} % \end{center} -% This package requires \pkg{insdljs},\footnote{Part of the \pkg{acrotex} bundle} which loads \pkg{hyperref}. It also requires +% This package requires \pkg{insdljs}\marginpar{\raggedleft\itshape\pkg{insdljs} pkg},\footnote{Part of the \pkg{acrotex} bundle} which loads \pkg{hyperref}. It also requires % the successful installation of the file \texttt{aeb\_pro.js}, which is distributed -% by the \pkg{acrotex-js} package. Version 1.6.1 of -% \texttt{aeb\_pro.js} is required.\footnote{If you already have \pkg{aeb\_pro} installed on your +% by the \pkg{acrotex-js} package\marginpar{\raggedleft\itshape\pkg{acrotex-js} pkg}, dated 2021/06/19 or later. Version 1.6.1 of +% \texttt{aeb\_pro.js} is required\marginpar{\raggedleft\itshape Version 1.6.1 required}.\footnote{If you already have \pkg{aeb\_pro} installed on your % system, be sure you have Version 1.6.1 of \texttt{aeb\_pro.js}, if not, use the version % of \texttt{aeb\_pro.js} that comes with \pkg{acrotex-js}.} Installation of \texttt{aeb\_pro.js} % is explained in \texttt{install\_jsfiles.pdf}, found in the \texttt{docs} folder of the \pkg{acrotex-js} package. % +% \changes{v1.2}{2021/06/19}{Revise documentation to reflect changes in changes in the \string\pkg{acrotex-js} package} % \changes{v1.1}{2021/06/18}{The \string\texttt{aeb\_pro.js} file is now distributed by the % \string\pkg{acrotex-js} package} % \changes{v1.0}{2021/06/11}{First publication version of this package} @@ -113,7 +114,11 @@ % % \paragraph*{Installation of \texttt{aeb\_pro.js}.} This file is essential to the % correct functioning of this package. It is important, therefore, to correctly -% install it. Follow the instructions of \texttt{docs/install\_jsfiles.pdf}. +% install it. If \texttt{aeb\_pro.js} is not already installed, download (if not already on your system) +% and install the \pkg{acrotex-js} package (dated 2021/06/19 or later);\footnote{\url{https://www.ctan.org/pkg/acrotex-js}} \texttt{aeb\_pro.js} is located +% in the \texttt{js-files} folder. Refer to the documentation of the \pkg{acrotex-js} package, +% \texttt{docs/install\_jsfiles.pdf}, for information on how to install \texttt{aeb\_pro.js}. +% The current version of \texttt{aeb\_pro.js} is Version 1.6.1. % % \paragraph*{Demo files.} Demo files are contained in the \texttt{examples} folder. % They illustrate all the security restricted methods of this package. @@ -140,6 +145,7 @@ % Require \pkg{insdljs} for this little exercise. % \begin{macrocode} \RequirePackage{insdljs} +\execJSOn % \end{macrocode} % The critical JavaScript files are no longer distributed with this package, % but are distributed by the \pkg{acrotex-js} package. This package must be @@ -157,10 +163,9 @@ Before continuing, install this package,\MessageBreak read the documentation, and place\MessageBreak aeb_pro.js in the expected folder} - \def\reqpkg{\usepackage{acrotex-js}} + \def\reqpkg{\usepackage{acrotex-js}[2021/06/19]} } \reqpkg -\execJSOn % \end{macrocode} % % \section{Document Assembly Methods}\label{s:DAM} @@ -187,7 +192,8 @@ % executed in a verbatim environment where `\verb!\!' is still the escape % character. Each of the JavaScript helper commands expects a left % parenthesis `\texttt{(}' following the command name \emph{on the -% same line} as the command name.\footnote{This requirement is consistent with JavaScript function usage.} +% same line} as the command name.\footnote{This requirement is consistent +% with JavaScript function usage.} % See the example below for correct usage. %\begin{verbatim} %\begin{docassembly} diff --git a/macros/latex/contrib/docassembly/docs/docassembly.pdf b/macros/latex/contrib/docassembly/docs/docassembly.pdf Binary files differindex f4aba50587..c782c598d6 100644 --- a/macros/latex/contrib/docassembly/docs/docassembly.pdf +++ b/macros/latex/contrib/docassembly/docs/docassembly.pdf diff --git a/macros/latex/contrib/hvfloat/Changes b/macros/latex/contrib/hvfloat/Changes index fd9d99736d..d3e0318635 100644 --- a/macros/latex/contrib/hvfloat/Changes +++ b/macros/latex/contrib/hvfloat/Changes @@ -1,4 +1,5 @@ hvfloat.sty: +2.30 2021-06-20 - fix for introduced bug for multifloats 2.29 2021-06-15 - some more fixes for doublepage objects - added option sameHeight for same text height on left and right page with a doublepage object @@ -53,5 +54,6 @@ hvfloat.tex: the source of the documentation hvfloat-fps.sty +0.03 2020-06-20 - dont't give a message when package is loaded 0.02 2017-09-20 - small changes 0.01 2017-09-16 - first CTAN version diff --git a/macros/latex/contrib/hvfloat/doc/examples/after1s1c.pdf b/macros/latex/contrib/hvfloat/doc/examples/after1s1c.pdf Binary files differindex 8aa7da3cf1..d74d1e268e 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/after1s1c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/after1s1c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/after2s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/after2s2c.pdf Binary files differindex b90848de1d..9567c26d36 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/after2s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/after2s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/capPos.pdf b/macros/latex/contrib/hvfloat/doc/examples/capPos.pdf Binary files differindex d7816f6ad2..072c584f82 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/capPos.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/capPos.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/default1s1c.pdf b/macros/latex/contrib/hvfloat/doc/examples/default1s1c.pdf Binary files differindex 32a7d1db77..ff8eec9e74 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/default1s1c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/default1s1c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/default1s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/default1s2c.pdf Binary files differindex 47eb520a09..752c54810d 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/default1s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/default1s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/default2s1c.pdf b/macros/latex/contrib/hvfloat/doc/examples/default2s1c.pdf Binary files differindex 29cde239da..6ac3baf5ad 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/default2s1c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/default2s1c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/default2s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/default2s2c.pdf Binary files differindex 539adf324a..388cf97645 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/default2s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/default2s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/doublepage2s1c.pdf b/macros/latex/contrib/hvfloat/doc/examples/doublepage2s1c.pdf Binary files differindex 41032411ce..dd444dd08a 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/doublepage2s1c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/doublepage2s1c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/doublepage2s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/doublepage2s2c.pdf Binary files differindex 5f2de396a7..7aa01b02f8 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/doublepage2s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/doublepage2s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/even1s1c.pdf b/macros/latex/contrib/hvfloat/doc/examples/even1s1c.pdf Binary files differindex e0051dc4cb..cc6273ead8 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/even1s1c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/even1s1c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/even1s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/even1s2c.pdf Binary files differindex 288a92fff9..eb062f70e2 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/even1s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/even1s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/even2s1c.pdf b/macros/latex/contrib/hvfloat/doc/examples/even2s1c.pdf Binary files differindex 11e4c5882e..4f86812e09 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/even2s1c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/even2s1c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/even2s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/even2s2c.pdf Binary files differindex 8c8d5e7cec..263b9afc8a 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/even2s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/even2s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/fullpage1s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/fullpage1s2c.pdf Binary files differindex 1d6f74c767..9cdd2ea882 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/fullpage1s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/fullpage1s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/inner1s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/inner1s2c.pdf Binary files differindex 8b3eac8c60..05ac77f5dd 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/inner1s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/inner1s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/inner2s1c.pdf b/macros/latex/contrib/hvfloat/doc/examples/inner2s1c.pdf Binary files differindex 682c3d3940..200ac470d6 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/inner2s1c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/inner2s1c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/inner2s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/inner2s2c.pdf Binary files differindex 93d370456c..94d1d37488 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/inner2s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/inner2s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/left2s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/left2s2c.pdf Binary files differindex 00919f05cc..406285913d 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/left2s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/left2s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/multi-after1s1c.pdf b/macros/latex/contrib/hvfloat/doc/examples/multi-after1s1c.pdf Binary files differindex 3ed7100f4f..6db4613d89 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/multi-after1s1c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/multi-after1s1c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/multi-default1s1c.pdf b/macros/latex/contrib/hvfloat/doc/examples/multi-default1s1c.pdf Binary files differindex 0c39135590..16b1cbfb19 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/multi-default1s1c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/multi-default1s1c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/multi-default1s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/multi-default1s2c.pdf Binary files differindex 95c0d74717..a4c58d96b9 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/multi-default1s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/multi-default1s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/multi-default2s1c.pdf b/macros/latex/contrib/hvfloat/doc/examples/multi-default2s1c.pdf Binary files differindex 2b1867b088..b955807071 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/multi-default2s1c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/multi-default2s1c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/multi-default2s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/multi-default2s2c.pdf Binary files differindex d9e38b05b8..75107f1a34 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/multi-default2s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/multi-default2s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/multi-inner2s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/multi-inner2s2c.pdf Binary files differindex 256ed12d1f..4370c39d84 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/multi-inner2s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/multi-inner2s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/multi-outer2s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/multi-outer2s2c.pdf Binary files differindex 179b315444..164dc77f64 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/multi-outer2s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/multi-outer2s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/multi-right1s1c.pdf b/macros/latex/contrib/hvfloat/doc/examples/multi-right1s1c.pdf Binary files differindex 9013d94523..1c3c610031 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/multi-right1s1c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/multi-right1s1c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/odd1s1c.pdf b/macros/latex/contrib/hvfloat/doc/examples/odd1s1c.pdf Binary files differindex 8480522fb2..fe0ca31256 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/odd1s1c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/odd1s1c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/odd1s1c.tex b/macros/latex/contrib/hvfloat/doc/examples/odd1s1c.tex index ae4ea4dd4a..dfce04c36b 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/odd1s1c.tex +++ b/macros/latex/contrib/hvfloat/doc/examples/odd1s1c.tex @@ -41,7 +41,12 @@ The fullpage image~\vref{fig:fullpage0} has a caption~\vpageref{fig:fullpage0-ca {fig:fullpage0} \Blindtext -\Blindtext + +\hvblindtext + +\hvblindtext + +\hvblindtext \begin{lstlisting} \hvFloat[fullpage,capPos=oddPage]% diff --git a/macros/latex/contrib/hvfloat/doc/examples/odd1s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/odd1s2c.pdf Binary files differindex e35c4fc529..c24ac2fa55 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/odd1s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/odd1s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/odd2s1c.pdf b/macros/latex/contrib/hvfloat/doc/examples/odd2s1c.pdf Binary files differindex 0bc26ee3e3..a357bdc1e1 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/odd2s1c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/odd2s1c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/odd2s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/odd2s2c.pdf Binary files differindex 1bd90be749..d7a49ea30d 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/odd2s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/odd2s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/outer1s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/outer1s2c.pdf Binary files differindex 0ee59f70b1..ca7e1e56ec 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/outer1s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/outer1s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/outer2s1c.pdf b/macros/latex/contrib/hvfloat/doc/examples/outer2s1c.pdf Binary files differindex a2ed22f860..323011e26f 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/outer2s1c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/outer2s1c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/outer2s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/outer2s2c.pdf Binary files differindex 3fa8364ebe..11003f09da 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/outer2s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/outer2s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/paper-after1s1c.pdf b/macros/latex/contrib/hvfloat/doc/examples/paper-after1s1c.pdf Binary files differindex 7d2d7801d4..495d644d55 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/paper-after1s1c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/paper-after1s1c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/paper-default1s1c.pdf b/macros/latex/contrib/hvfloat/doc/examples/paper-default1s1c.pdf Binary files differindex 5f4946f300..443aae8d5f 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/paper-default1s1c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/paper-default1s1c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/paper-default1s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/paper-default1s2c.pdf Binary files differindex 3e1e0287d5..bba76eb320 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/paper-default1s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/paper-default1s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/paper-default2s1c.pdf b/macros/latex/contrib/hvfloat/doc/examples/paper-default2s1c.pdf Binary files differdeleted file mode 100644 index 640629b541..0000000000 --- a/macros/latex/contrib/hvfloat/doc/examples/paper-default2s1c.pdf +++ /dev/null diff --git a/macros/latex/contrib/hvfloat/doc/examples/paper-default2s1c.tex b/macros/latex/contrib/hvfloat/doc/examples/paper-default2s1c.tex deleted file mode 100644 index 4db0220481..0000000000 --- a/macros/latex/contrib/hvfloat/doc/examples/paper-default2s1c.tex +++ /dev/null @@ -1,81 +0,0 @@ -\documentclass{scrartcl} -%% $Id: paper-default2s2c.tex 72 2021-05-02 11:40:10Z herbert $ - -\input{preamble.ltx} -\setlength\columnseprule{0.4pt} - -\begin{document} -\title{Example for FULLPAGE floats} -\author{Herbert Voß} -\maketitle - -\tableofcontents - -\blinddocument - -\section{File \texttt{\jobname}} - -\begin{lstlisting} -The FULLPAGE image~\vref{fig:FULLPAGE0} has a caption~\vpageref{fig:FULLPAGE0-cap}. -\end{lstlisting} - -The FULLPAGE image~\vref{fig:FULLPAGE0} has a caption~\vpageref{fig:FULLPAGE0-cap}. - -\begin{lstlisting} -\hvFloat*[FULLPAGE]% - {figure}% - {\includegraphics[FULLPAGE]{frose}}% - [A FULLPAGE float with the default caption setting]% - {A default caption of a ``FULLPAGE'' object with the default setting, which - is a ``left'' caption which means that it always appears before the object. - This can be an even or odd page. And some more text whch has no - real meaning because it fills only the space for a long caption.}% - {fig:FULLPAGE0} -\end{lstlisting} - - -\Float[default] -\hvFloat*[FULLPAGE]% - {figure}% - {\includegraphics[FULLPAGE]{frose}}% - [A FULLPAGE float with the default caption setting]% - {A default caption of a ``FULLPAGE'' object with the default setting, which - is a ``left'' caption which means that it always appears before the object. - This can be an even or odd page. And some more text whch has no - real meaning because it fills only the space for a long caption.}% - {fig:FULLPAGE0} - -\blinddocument - -\begin{lstlisting} -\hvFloat*[FULLPAGE]% - {figure}% - {\includegraphics[FULLPAGE]{frose}}% - [A FULLPAGE float with the default caption setting]% - {A default caption of a ``FULLPAGE'' object with the default setting, which - is a ``left'' caption which means that it always appears before the object. - This can be an even or odd page. And some more text whch has no - real meaning because it fills only the space for a long caption.}% - {fig:FULLPAGE1} -\end{lstlisting} - - -\Float[default] -\hvFloat*[FULLPAGE]% - {figure}% - {\includegraphics[FULLPAGE]{frose}}% - [A FULLPAGE float with the default caption setting]% - {A default caption of a ``FULLPAGE'' object with the default setting, which - is a ``left'' caption which means that it always appears before the object. - This can be an even or odd page. And some more text whch has no - real meaning because it fills only the space for a long caption.}% - {fig:FULLPAGE1} - -\blinddocument - -\Blindtext - -\blindtext - - -\end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/hvfloat/doc/examples/paper-default2s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/paper-default2s2c.pdf Binary files differindex a69f803c69..e86b9e6674 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/paper-default2s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/paper-default2s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/paper-inner2s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/paper-inner2s2c.pdf Binary files differindex 0fbf2c5155..56253d38e2 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/paper-inner2s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/paper-inner2s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/paper-right1s1c.pdf b/macros/latex/contrib/hvfloat/doc/examples/paper-right1s1c.pdf Binary files differindex 7e394e5d57..daca3967b6 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/paper-right1s1c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/paper-right1s1c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/right1s1c.pdf b/macros/latex/contrib/hvfloat/doc/examples/right1s1c.pdf Binary files differindex 91e2ad65cc..8c43e8c1f0 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/right1s1c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/right1s1c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/right1s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/right1s2c.pdf Binary files differindex 4dab820f09..954f63954d 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/right1s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/right1s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/right2s1c.pdf b/macros/latex/contrib/hvfloat/doc/examples/right2s1c.pdf Binary files differindex 439a827f28..037f72ae10 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/right2s1c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/right2s1c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/right2s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/right2s2c.pdf Binary files differindex 195114fb0a..2fecbfbe05 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/right2s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/right2s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/runAll.sh b/macros/latex/contrib/hvfloat/doc/examples/runAll.sh index 3b6bc2008f..0cecd6a0c2 100755 --- a/macros/latex/contrib/hvfloat/doc/examples/runAll.sh +++ b/macros/latex/contrib/hvfloat/doc/examples/runAll.sh @@ -3,18 +3,18 @@ for datei in *.tex do RUNS=1 echo "LuaLaTeX-Lauf Nr. $RUNS von $datei =======================================" - lualatex $datei + lualatex --interaction=nonstopmode $datei >/dev/null MAIN=$(basename -a -s .tex $datei) TEST=`grep -c "Label(s) may have changed." $MAIN.log` while [ $TEST -gt 0 ]; do let RUNS=RUNS+1 echo "LuaLaTeX-Lauf Nr. $RUNS von $datei =======================================" - lualatex $datei + lualatex --interaction=nonstopmode $datei >/dev/null TEST=`grep -c "Label(s) may have changed." $MAIN.log ` if [ $RUNS -gt 4 ] then TEST=0 fi done - rm $MAIN.aux $MAIN.log $MAIN.out $MAIN.toc + rm -fr $MAIN.aux $MAIN.log $MAIN.out $MAIN.toc done diff --git a/macros/latex/contrib/hvfloat/doc/examples/runEXA.sh b/macros/latex/contrib/hvfloat/doc/examples/runEXA.sh index ea7f8b1f78..de0ad052ec 100755 --- a/macros/latex/contrib/hvfloat/doc/examples/runEXA.sh +++ b/macros/latex/contrib/hvfloat/doc/examples/runEXA.sh @@ -3,14 +3,14 @@ for datei in $1????.tex do RUNS=1 echo "LuaLaTeX-Lauf Nr. $RUNS von $datei =======================================" - lualatex $datei + lualatex --interaction=nonstopmode $datei MAIN=$(basename -a -s .tex $datei) TEST=`grep -c "Label(s) may have changed." $MAIN.log` while [ $TEST -gt 0 ]; do let RUNS=RUNS+1 echo "LuaLaTeX-Lauf Nr. $RUNS von $datei =======================================" - lualatex $datei + lualatex --interaction=nonstopmode $datei TEST=`grep -c "Label(s) may have changed." $MAIN.log ` if [ $RUNS -gt 4 ] then TEST=0 diff --git a/macros/latex/contrib/hvfloat/doc/examples/sub-after1s1c.pdf b/macros/latex/contrib/hvfloat/doc/examples/sub-after1s1c.pdf Binary files differindex 807cb410c7..d2391f0870 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/sub-after1s1c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/sub-after1s1c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/sub-after2s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/sub-after2s2c.pdf Binary files differindex a8f2fcef06..a23af6e14d 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/sub-after2s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/sub-after2s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/sub-default1s1c.pdf b/macros/latex/contrib/hvfloat/doc/examples/sub-default1s1c.pdf Binary files differindex caa9d820ab..83d13d7824 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/sub-default1s1c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/sub-default1s1c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/sub-default1s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/sub-default1s2c.pdf Binary files differindex c5e4dbfdf7..b5e7ae13b8 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/sub-default1s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/sub-default1s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/sub-default2s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/sub-default2s2c.pdf Binary files differindex 374b2a0338..026910949f 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/sub-default2s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/sub-default2s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/sub-right1s1c.pdf b/macros/latex/contrib/hvfloat/doc/examples/sub-right1s1c.pdf Binary files differindex 45a7f59c13..68d689fca0 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/sub-right1s1c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/sub-right1s1c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/sub-right1s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/sub-right1s2c.pdf Binary files differindex f7e3d07b42..d67a0f806a 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/sub-right1s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/sub-right1s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/sub-right2s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/sub-right2s2c.pdf Binary files differindex 9ae77741d0..6456d85628 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/sub-right2s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/sub-right2s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/wide1s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/wide1s2c.pdf Binary files differindex 4753c61bde..6ee1ea42d1 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/wide1s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/wide1s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/examples/wide2s2c.pdf b/macros/latex/contrib/hvfloat/doc/examples/wide2s2c.pdf Binary files differindex e51326fc94..a12ef0d594 100644 --- a/macros/latex/contrib/hvfloat/doc/examples/wide2s2c.pdf +++ b/macros/latex/contrib/hvfloat/doc/examples/wide2s2c.pdf diff --git a/macros/latex/contrib/hvfloat/doc/hvfloat.pdf b/macros/latex/contrib/hvfloat/doc/hvfloat.pdf Binary files differindex 1bf89fbc6f..6ddf3c1f56 100644 --- a/macros/latex/contrib/hvfloat/doc/hvfloat.pdf +++ b/macros/latex/contrib/hvfloat/doc/hvfloat.pdf diff --git a/macros/latex/contrib/hvfloat/doc/hvfloat.tex b/macros/latex/contrib/hvfloat/doc/hvfloat.tex index 59805c7554..90bea8a9eb 100644 --- a/macros/latex/contrib/hvfloat/doc/hvfloat.tex +++ b/macros/latex/contrib/hvfloat/doc/hvfloat.tex @@ -1,4 +1,4 @@ -%% $Id: hvfloat.tex 112 2021-06-14 08:01:42Z herbert $ +%% $Id: hvfloat.tex 114 2021-06-15 13:20:03Z herbert $ \listfiles \errorcontextlines=100 \documentclass[twoside,paper=a4,]{scrartcl} @@ -166,8 +166,9 @@ \begin{document} -\title{Package \texttt{hvfloat}\\Rotating and scaling of objects and captions\\ver \hvFloatFileVersion} -\author{Herbert Voß\thanks{\protect\url{hvoss@tug.org}\newline Thanks to Frank Mittelbach, Rolf Niepraschk}} +\title{Package \texttt{hvfloat}\\ +Controlling captions, fullpage and doublepage floats\\ver \hvFloatFileVersion} +\author{Herbert Voß\thanks{\protect\url{hvoss@tug.org}\newline Thanks to Karl Berry, Frank Mittelbach, Rolf Niepraschk}} \date{\today} \maketitle diff --git a/macros/latex/contrib/hvfloat/doc/images/missing.txt b/macros/latex/contrib/hvfloat/doc/images/missing.txt deleted file mode 100644 index c10e55ce9c..0000000000 --- a/macros/latex/contrib/hvfloat/doc/images/missing.txt +++ /dev/null @@ -1,4 +0,0 @@ -Not all images of the documentation are listed here, because -some are not for public use. You can use any other image if you -want to run the documentation by yourselve. - diff --git a/macros/latex/contrib/hvfloat/latex/hvfloat-fps.sty b/macros/latex/contrib/hvfloat/latex/hvfloat-fps.sty index 99b7cbfbab..0090e80f5f 100644 --- a/macros/latex/contrib/hvfloat/latex/hvfloat-fps.sty +++ b/macros/latex/contrib/hvfloat/latex/hvfloat-fps.sty @@ -1,7 +1,6 @@ -%% $Id: hvfloat-fps.sty 35 2020-10-31 07:41:00Z herbert $ +%% $Id: hvfloat-fps.sty 120 2021-06-20 13:31:02Z herbert $ %% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{hvfloat-fps}[2017/09/16 setting float objects] %% %% IMPORTANT NOTICE: %% @@ -16,9 +15,10 @@ %% DESCRIPTION: %% `hvfloat-fps' offers global placement of floats %% -\def\fileversion{0.02} -\def\filedate{2017/09/20} -\message{`hvfloat-fps' v\fileversion, \filedate\space (Herbert Voss)} +\def\fileversion{0.03} +\def\filedate{2020/06/20} +\ProvidesPackage{hvfloat-fps}[\filedate\space v\fileversion\space global float position setting (hv)] +%\message{`hvfloat-fps' v\fileversion, \filedate\space (Herbert Voss)} % \RequirePackage{xkeyval} % diff --git a/macros/latex/contrib/hvfloat/latex/hvfloat.sty b/macros/latex/contrib/hvfloat/latex/hvfloat.sty index 681e5032d7..2159575d1c 100644 --- a/macros/latex/contrib/hvfloat/latex/hvfloat.sty +++ b/macros/latex/contrib/hvfloat/latex/hvfloat.sty @@ -1,4 +1,4 @@ -%% $Id: hvfloat.sty 114 2021-06-15 13:20:03Z herbert $ +%% $Id: hvfloat.sty 119 2021-06-20 13:28:09Z herbert $ %% %% %% IMPORTANT NOTICE: @@ -15,10 +15,10 @@ %% `hvfloat' offers rotating of captions and objects for floats %% \NeedsTeXFormat{LaTeX2e} -\def\fileversion{2.29} -\def\filedate{2021/06/15} -\message{`hvfloat' v\fileversion, \filedate\space (Herbert Voss)} -\ProvidesPackage{hvfloat}[\filedate\ rotating of floating objects] +\def\fileversion{2.30} +\def\filedate{2021/06/20} +%\message{`hvfloat' v\fileversion, \filedate\space (Herbert Voss)} +\ProvidesPackage{hvfloat}[\filedate\space v\fileversion\space special floating objects (hv)] \let\hvFloatFileVersion\fileversion % \newif\ifhv@fbox \hv@fboxfalse @@ -33,12 +33,6 @@ \ProcessOptions -\providecommand\@tugclass{\@empty} -\ifx\@tugclass\@empty -\else - \hv@tugboattrue % special page handling - \typeout{>>> we are using a TUGboat class}% -\fi \PassOptionsToPackage{hypcap}{caption} \RequirePackage{caption} @@ -65,6 +59,8 @@ \RequirePackage{stfloats}% for bottom floats in a twocolumn mode \fi % + + \providecommand*\LenToUnit[1]{\strip@pt\dimexpr#1*\p@/\unitlength} \newlength\hvObjectWidth @@ -179,7 +175,6 @@ \define@boolkey{hvSet}[hv@]{sameHeight}[true]{\@nameuse{hv@sameHeight#1}}% Write the caption only as text \define@boolkey{hvSet}[hv@]{Debug}[true]{}% give more infos in the terminal -\newcommand\hv@typeout[1]{\ifhv@Debug\typeout{>>>> #1}\fi} \newif\ifhv@fullpage \newif\ifhv@FULLPAGE @@ -258,6 +253,15 @@ \let\hvFloatSetDefaults\setDefaults +\newcommand\hv@typeout[1]{\ifhv@Debug\typeout{>>>> #1}\fi} + +\providecommand\@tugclass{\@empty} +\ifx\@tugclass\@empty +\else + \hv@tugboattrue % special page handling + \hv@typeout{>>> we are using a TUGboat class}% +\fi + \newcommand\reset@special@float{% \hv@set{subFloat=false,%fullpage=false, multiFloat=false,%FULLPAGE=false @@ -425,10 +429,6 @@ \newif\if@hvsubstar \setDefaults -\def\hvFloat{\@ifnextchar*% Main macro - {\global\hv@startrue\hv@maxImageWidth=\textwidth\hvFloat@i}% - {\global\hv@starfalse\hv@maxImageWidth=\columnwidth\hvFloat@i*}% -} %\newcommand*{\hvFloat}[5][]+{% % [#1}: keyvalues @@ -438,6 +438,12 @@ % #5: caption % #6: label % + +\def\hvFloat{\@ifnextchar*% Main macro + {\global\hv@startrue\hv@maxImageWidth=\textwidth\hvFloat@i}% + {\global\hv@starfalse\hv@maxImageWidth=\columnwidth\hvFloat@i*}% +} + \def\hvFloat@i*{\@ifnextchar[{\do@hvFloat}{\do@hvFloat[]}} \def\do@hvFloat[#1]{% \begingroup @@ -446,19 +452,13 @@ % \setlength\hvWideWidth{\dimexpr\linewidth+\marginparwidth}% \hv@maxImageWidth=\textwidth \reset@special@float - \setcounter{hv@pfigure}{\value{figure}}% - \setcounter{hv@ptable}{\value{table}}% + \global\setcounter{hv@pfigure}{\value{figure}}% + \global\setcounter{hv@ptable}{\value{table}}% \setcounter{hv@tempCNTfigA}{\value{figure}}% \setcounter{hv@tempCNTfigB}{\value{figure}}% \setcounter{hv@tempCNTtabA}{\value{table}}% \setcounter{hv@tempCNTtabB}{\value{table}}% - \renewcommand\thehv@pfigure{\thefigure}% - \renewcommand\thehv@ptable{\thetable}% - \renewcommand\thehv@tempCNTfigA{\thefigure}% - \renewcommand\thehv@tempCNTfigB{\thefigure}% - \renewcommand\thehv@tempCNTtabA{\thetable}% - \renewcommand\thehv@tempCNTtabB{\thetable}% - \gdef\hv@save@setting{#1}% + \gdef\hv@save@setting{#1}% for later use after \endgroup inside figure/table env \ifx\relax#1\relax\else\setkeys{hvSet}{#1}\fi \ifx\hv@caption@format\@empty\else\expandafter\captionsetup\expandafter{\hv@caption@format}\fi \ifx\hv@subcaption@format\@empty\else @@ -516,32 +516,28 @@ \ExplSyntaxOff - \newcount\hv@cnta \newcount\hv@cntb \def\hvFloat@ii[#1]#2#3{% #1: key/value, #2: floattype, #3: object \hv@maxImageWidth=\textwidth - \ifx\relax#1\relax\else\setkeys{hvSet}{#1}\fi +% \ifx\relax#1\relax\else\setkeys{hvSet}{#1}\fi \gdef\hv@floatType{#2}% \ifx\relax#2\relax \setkeys{hvSet}{nonFloat,onlyText}% + \xdef\hv@save@setting{\hv@save@setting,nonFloat,onlyText}% for later use after \endgroup inside figure/table env \fi - \xdef\hv@floatListOfExt{\@nameuse{ext@\hv@floatType}}% +% \xdef\hv@floatListOfExt{\@nameuse{ext@\hv@floatType}}% \gdef\hv@floatObject{#3}% \@ifnextchar[{\do@@hvFloat}{\do@@hvFloat[]}% } - \def\do@@hvFloat[#1]#2#3{% #1: listof caption, #2. long caption #3: label \gdef\hv@shortCap{#1}% \gdef\hv@longCap{#2}% \gdef\hv@label{#3}% \ifhv@capbeside\def\@@temp{1}\else\def\@@temp{0}\fi \ifhv@sameHeight\global\hv@global@sameHeighttrue\else\global\hv@global@sameHeightfalse\fi - \xdef\hv@global@@capVPos{\hv@@capVPos}% - \xdef\hvSet@global@capVPos{\hvSet@capVPos}% - \xdef\hvSet@global@capAngle{\hvSet@capAngle}% \global\setlength\hvSet@bindCorrection{\hvSet@bindCorr}% for doublepage objects \global\setlength\hv@floatCapSep{\hvSet@floatCapSep}% % @@ -641,7 +637,7 @@ \fi \fi \saveCaptionSkip% we put this space ourselve - \ifnum\hvSet@global@capAngle=0 % need rotation? + \ifnum\hvSet@capAngle=0 % need rotation? \savebox\hvCaptionBox{% NO rotation \minipage[b]{\hvCapWidth}%% minipage, to get hyphenation \ifhv@nonFloat @@ -675,7 +671,7 @@ }% \else \savebox\hvCaptionBox{% Rotation - \rotatebox{\hvSet@global@capAngle}{% + \rotatebox{\hvSet@capAngle}{% \minipage[b]{\hvCapWidth}%% minipage, to get hyphenation % \ifx\relax\hv@caption@format\relax\else\expandafter\captionsetup\expandafter{\hv@caption@format}\fi \ifhv@nonFloat @@ -779,12 +775,12 @@ %%%% \savebox{\@tempboxa}{% ***** @tempbox start \expandafter\ifcase\the\hv@@capPos% 0 is LEFT START \ifcase - \ifx\hvSet@global@capVPos\hv@Center + \ifx\hvSet@capVPos\hv@Center \put@CaptionBox \hspace{\hv@floatCapSep}% capfloatsep \put@ObjectBox \else - \ifx\hvSet@global@capVPos\hv@Top% caption and object at top aligned + \ifx\hvSet@capVPos\hv@Top% caption and object at top aligned \put@CaptionBox[1]% \hspace{\hv@floatCapSep}% capfloatsep \put@ObjectBox[1]% @@ -810,12 +806,12 @@ \fi \end{minipage}% \or%2 is right - \ifx\hvSet@global@capVPos\hv@Center + \ifx\hvSet@capVPos\hv@Center \put@ObjectBox \hspace{\hv@floatCapSep}% \put@CaptionBox \else - \ifx\hvSet@global@capVPos\hv@Top + \ifx\hvSet@capVPos\hv@Top \put@ObjectBox[1]% \hspace{\hv@floatCapSep}% capfloatsep \put@CaptionBox[1]% @@ -904,22 +900,22 @@ \let\clist@count@N\clist_count:N \ExplSyntaxOff -\def\do@@@@hvFloat{% special float page: caption <-> fullpage image - \ifx\hvSet@capPos\hv@After \hv@@capPos=1 +\def\do@@@@hvFloat{% special float page: caption <-> fullpage images + \ifx\hvSet@capPos\hv@After \global\hv@@capPos=1 \else - \ifx\hvSet@capPos\hv@Even \hv@@capPos=2 + \ifx\hvSet@capPos\hv@Even \global\hv@@capPos=2 \else - \ifx\hvSet@capPos\hv@Odd \hv@@capPos=3 + \ifx\hvSet@capPos\hv@Odd \global\hv@@capPos=3 \else - \ifx\hvSet@capPos\hv@Inner \hv@@capPos=4 + \ifx\hvSet@capPos\hv@Inner \global\hv@@capPos=4 \else - \ifx\hvSet@capPos\hv@Outer \hv@@capPos=5 + \ifx\hvSet@capPos\hv@Outer \global\hv@@capPos=5 \else - \ifx\hvSet@capPos\hv@Right \hv@@capPos=6% only for twocolumn mode + \ifx\hvSet@capPos\hv@Right \global\hv@@capPos=6% only for twocolumn mode \else - \ifx\hvSet@capPos\hv@Left \hv@@capPos=7% only for twocolumn mode + \ifx\hvSet@capPos\hv@Left \global\hv@@capPos=7% only for twocolumn mode \else - \hv@@capPos=0 + \global\hv@@capPos=0 \fi \fi \fi @@ -1058,6 +1054,11 @@ \global\setlength\hv@tempWidthA{\the\dimexpr1in+\oddsidemargin-\hvSet@bindCorrection}% \xdef\hv@caption@format@temp{\hv@caption@format}% it gets lost otherwise for next afterpage \global\hv@switchTypefalse +% \endgroup% started at main macro \hvFloat + \setcounter{hv@tempCNTfigA}{\value{figure}}% + \setcounter{hv@tempCNTfigB}{\value{figure}}% + \setcounter{hv@tempCNTtabA}{\value{table}}% + \setcounter{hv@tempCNTtabB}{\value{table}}% \savebox\hvCaptionBox{% NO rotation \minipage{\textwidth}%% minipage, to get hyphenation \let\@captype\hv@floatType @@ -1137,7 +1138,11 @@ % \def\do@hvFloat@doublePageCaptionRightObjectLeft#1{% left part of the object \begin{\hv@floatType*}[!t] - \hv@typeout{Floatpositionsparameter: !t}% + \let\c@hv@tempCNTfigA\c@figure + \let\c@hv@tempCNTtabA\c@table + \expandafter\hvFloatSet\expandafter{\hv@save@setting}% + \expandafter\hvFloatSet\expandafter{\hv@save@setting}% + \hv@typeout{Floatpositionsparameter: !t}% \global\savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}% \clipbox*{0 -\depth{} \hv@leftPageObjectWidth{} \height}{\usebox\hvObjectBox}% \ifx\hv@label\@empty @@ -1157,10 +1162,11 @@ \end{\hv@floatType*}% } \def\do@hvFloat@doublePageCaptionRightObjectRight#1{% right part of the object - \begin{\hv@floatType*}[!t] - \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}% - \hspace*{-\hv@tempWidthA}% - \savebox\hv@rightBox{\clipbox*{\hv@leftPageObjectWidth{} -\depth{} \width{} \height{}}{\usebox\hvObjectBox}}% + \begin{\hv@floatType*}[!t] + \expandafter\hvFloatSet\expandafter{\hv@save@setting}% + \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}% + \hspace*{-\hv@tempWidthA}% + \savebox\hv@rightBox{\clipbox*{\hv@leftPageObjectWidth{} -\depth{} \width{} \height{}}{\usebox\hvObjectBox}}% \global\setlength\hv@tempWidthB{\dimexpr\textwidth-\wd\hv@rightBox-\hvSet@bindCorrection+1in+\oddsidemargin-\hv@floatCapSep\relax}% \hv@typeout{Height of right box: \the\ht\hv@rightBox}% \hv@typeout{Depth of right box : \the\dp\hv@rightBox}% @@ -1169,22 +1175,26 @@ \else \usebox\hv@rightBox \fi + \c@hv@tempCNTfigB=\numexpr\c@figure-1\relax + \c@hv@tempCNTtabB=\numexpr\c@table-1\relax \ifx\hv@label\@empty\else \ifx\hv@floatType\hv@figure - \global\refstepcounter{hv@tempCNTfigB}% + \refstepcounter{hv@tempCNTfigB}% \else - \global\refstepcounter{hv@tempCNTtabB}% before caption + \refstepcounter{hv@tempCNTtabB}% before caption \fi \label{\hv@label-2}% \fi \ifx\hv@caption@format@temp\@empty\else \expandafter\captionsetup\expandafter{\hv@caption@format@temp}% \fi + \c@figure=\numexpr\c@hv@tempCNTfigB-1\relax + \c@table=\numexpr\c@hv@tempCNTtabB-1\relax \ifnum#1>\z@ % caption on the right - \hv@typeout{doublePage: capAngle=\hvSet@global@capAngle}% - \ifnum\hvSet@global@capAngle > \z@ + \hv@typeout{doublePage: capAngle=\hvSet@capAngle}% + \ifnum\hvSet@capAngle > \z@ \hspace{\hv@floatCapSep}% - \rlap{\rotatebox{\hvSet@global@capAngle}{\parbox[b]{\the\dimexpr\ht\hvObjectBox+\dp\hvObjectBox}{% + \rlap{\rotatebox{\hvSet@capAngle}{\parbox[b]{\the\dimexpr\ht\hvObjectBox+\dp\hvObjectBox}{% \abovecaptionskip=0pt% local inside parbox \belowcaptionskip=0pt% local inside parbox \ifx\relax\hv@shortCap\relax @@ -1197,7 +1207,7 @@ \else \global\setlength\hv@tempWidthB{\dimexpr\textwidth-\wd\hv@rightBox-\hvSet@bindCorrection+1in+\oddsidemargin-\hv@floatCapSep\relax}% \hspace{\hv@floatCapSep}% - \rlap{\parbox[b][\dimexpr\ht\hv@rightBox+\dp\hv@rightBox][\hv@global@@capVPos]{\hv@tempWidthB}{% + \rlap{\parbox[b][\dimexpr\ht\hv@rightBox+\dp\hv@rightBox][\hv@@capVPos]{\hv@tempWidthB}{% \abovecaptionskip=0pt% local inside parbox \belowcaptionskip=0pt% local inside parbox \ifx\hv@shortCap\@empty @@ -1233,7 +1243,8 @@ \expandafter\global\expandafter\savebox\expandafter\hvObjectBox\expandafter{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}% \expandafter\global\expandafter\savebox\expandafter\hv@boxLeftPage\expandafter{\clipbox*{0 -\depth{} \hv@leftPageObjectWidth{} \height}{\usebox\hvObjectBox}}% \expandafter\global\expandafter\savebox\expandafter\hv@boxRightPage\expandafter{\clipbox*{\hv@leftPageObjectWidth{} -\depth{} \width{} \height}{\usebox\hvObjectBox}}% - \checkoddpage +% \endgroup% started at main macro \hvFloat + \checkoddpage \ifoddpage \if@twocolumn \if@firstcolumn @@ -1261,6 +1272,7 @@ \def\do@hvFloat@doublePAGECaptionRight#1{% image on left and right page with caption on the right ---------------------------------- % #1-> 0/1 caption under/right \afterpage{% + \expandafter\hvFloatSet\expandafter{\hv@save@setting}% \global\savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}% \noindent \clipbox*{0 -\depth{} \hv@leftPageObjectWidth{} \height}{\usebox\hvObjectBox}% @@ -1269,6 +1281,7 @@ \noindent \hspace*{\dimexpr-\hv@tempWidthA}% \clipbox*{\the\hv@leftPageObjectWidth{} -\depth{} \width{} \height{}}{\usebox\hvObjectBox}% + \begingroup \ifnum#1>0 \medskip \ifdim\dp\hvObjectBox > \z@ @@ -1301,6 +1314,7 @@ \ifx\hv@label\@empty\else\label{\hv@label}\fi }% \fi + \endgroup \newpage\if@twocolumn\null\newpage\fi }% } @@ -1309,11 +1323,12 @@ % \def\do@hvFloat@doubleFULLPAGE#1{% image on left and right page with caption before/below/right/after % #1-> 0/1 caption under/right - \ifx\hvSet@capPos\hv@After \hv@@capPos=1 + \expandafter\hvFloatSet\expandafter{\hv@save@setting}% + \ifx\hvSet@capPos\hv@After \global\hv@@capPos=1 \else - \ifx\hvSet@capPos\hv@Before \hv@@capPos=0 + \ifx\hvSet@capPos\hv@Before \global\hv@@capPos=0 \else - \hv@@capPos=2 % other caption type + \global\hv@@capPos=2 % other caption type \fi\fi \checkoddpage \global\savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}% @@ -1421,6 +1436,7 @@ \def\set@Normal@Bottom@Caption{\@ifnextchar*\set@Normal@Bottom@CaptionStar\set@Normal@Bottom@Caption@} \def\set@Normal@Bottom@Caption@{% \begin{\hv@floatType}[!b] + \expandafter\hvFloatSet\expandafter{\hv@save@setting}% \ifhv@separatorLine\drawSepLine\fi % \expandafter\captionsetup\expandafter{\hv@caption@format}% \ifx\hv@shortCap\@empty @@ -1433,6 +1449,7 @@ } \def\set@Normal@Bottom@CaptionStar*{% \begin{\hv@floatType*}[!b] + \expandafter\hvFloatSet\expandafter{\hv@save@setting}% \ifhv@separatorLine\drawSepLine\fi % \expandafter\captionsetup\expandafter{\hv@caption@format}% \ifx\hv@shortCap\@empty @@ -1444,12 +1461,7 @@ \end{\hv@floatType*}% } - \def\do@hvFloat@doubleFULLPAGE@CaptionBefore{% -% \setcounter{hv@tempCNTfigA}{\value{figure}}% -% \setcounter{hv@tempCNTfigB}{\value{figure}}% -% \setcounter{hv@tempCNTtabA}{\value{table}}% -% \setcounter{hv@tempCNTtabB}{\value{table}}% \afterpage{% \global\savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}% \vspace*{\the\dimexpr-1in-\voffset-\topmargin-\headheight-\headsep-\baselineskip+2\lineskip}% no interlineskip @@ -1639,6 +1651,7 @@ \def\setBottomCaption{% \begin{\hv@floatType}[!b]% + \expandafter\hvFloatSet\expandafter{\hv@save@setting}% \ifhv@separatorLine\drawSepLine\fi \par \usebox\hvCaptionBox @@ -1651,6 +1664,7 @@ \else \begin{\hv@floatType}[p]% \fi + \expandafter\hvFloatSet\expandafter{\hv@save@setting}% \ifhv@FULLPAGE \vspace*{\the\dimexpr-1in-\voffset-\topmargin-\headheight-\headsep}%-0.5\baselineskip% \checkoddpage @@ -1664,7 +1678,7 @@ \hspace*{\the\dimexpr-\oddsidemargin-\parindent-1in}% \fi \AtBeginShipoutNext{\thispagestyle{empty}}% - \usebox\hvObjectBox% + \usebox\hvObjectBox \else \usebox\hvObjectBox \fi @@ -1679,6 +1693,7 @@ \def\getMultiCaptionAndLabel{% \global\sbox\hvCaptionBox{\minipage[b]{\linewidth}% + \expandafter\hvFloatSet\expandafter{\hv@save@setting}% % \ifx\relax\hv@caption@format\relax\else\expandafter\captionsetup\expandafter{\hv@caption@format}\fi \setlength\belowcaptionskip{5pt}% \setlength\abovecaptionskip{0pt}% @@ -1710,6 +1725,7 @@ \else \minipage{\columnwidth}% \fi + \expandafter\hvFloatSet\expandafter{\hv@save@setting}% % \ifx\relax\hv@caption@format\relax\else\expandafter\captionsetup\expandafter{\hv@caption@format}\fi \ifx\hvSet@objectPos\hv@Right\raggedleft\else \ifx\hvSet@objectPos\hv@Left\raggedleft\else @@ -1736,9 +1752,9 @@ \repeat \endminipage}% } - \def\getMultiSubCaptionAndLabel{% \global\sbox\hvCaptionBox{\minipage{\linewidth}% + \expandafter\hvFloatSet\expandafter{\hv@save@setting}% % \ifx\hv@caption@format\@empty\else\expandafter\captionsetup\expandafter{\hv@caption@format}\fi \setlength\belowcaptionskip{5pt}% \setlength\abovecaptionskip{0pt}% @@ -1756,6 +1772,7 @@ \def\getMultiSubObjectAndLabel{% \global\sbox\hvObjectBox{% + \expandafter\hvFloatSet\expandafter{\hv@save@setting}% \ifhv@vFill \minipage[b][\textheight][s]{\columnwidth}% \else @@ -1774,6 +1791,11 @@ \advance\hv@cntb by \@ne \hv@cnta=2 \edef\@captype{\clist_item:Nn\l_clist_Type{1}}% the same for all subfloats + \ifx\@tempa\@empty + \else +% \refstepcounter{\@captype}% +% \expandafter\label\expandafter{\@tempa}% + \fi \loop \def\@temp{\clist_item:Nn\l_clist_Object{\hv@cnta}}% \ifhv@objectFrame\frame{\@temp}\else\@temp\fi @@ -1798,8 +1820,9 @@ \edef\@tempa{\clist_item:Nn\l_clist_Label{1}}% the main label at the end \ifx\@tempa\@empty \else - \addtocounter{\@captype}{-1}% to get the same <object>-ref as "label"-cap - \refstepcounter{\@captype}% +% \addtocounter{\@captype}{-1}% to get the same <object>-ref as "label"-cap + \edef\@temp{hv@p\@captype}% + \refstepcounter{\@temp}% \expandafter\label\expandafter{\@tempa}% \fi \endminipage}% @@ -1808,6 +1831,7 @@ \def\getSingleCaptionAndLabel{% \global\sbox\hvCaptionBox{\minipage{\linewidth}% + \expandafter\hvFloatSet\expandafter{\hv@save@setting}% \setlength\belowcaptionskip{5pt}% \setlength\abovecaptionskip{0pt}% \edef\@captype{\hv@floatType}% @@ -1822,9 +1846,13 @@ \def\set@caption@object#1{% first caption, then object #1=\hv@floatType \ifhv@multiFloat + \setcounter{hv@pfigure}{\value{figure}}% + \setcounter{hv@ptable}{\value{table}}% \getMultiCaptionAndLabel \else \ifhv@subFloat + \setcounter{hv@pfigure}{\value{figure}}% + \setcounter{hv@ptable}{\value{table}}% \getMultiSubCaptionAndLabel \else \getSingleCaptionAndLabel diff --git a/macros/latex/contrib/nicematrix/nicematrix-french.pdf b/macros/latex/contrib/nicematrix/nicematrix-french.pdf Binary files differindex 646ec7e301..55b39da0c4 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 c80c13f352..5339ea7ac8 100644 --- a/macros/latex/contrib/nicematrix/nicematrix-french.tex +++ b/macros/latex/contrib/nicematrix/nicematrix-french.tex @@ -531,11 +531,10 @@ cette clé (la valeur par défaut est 4~pt\footnote{Cette valeur par défaut est \item la clé |borders| permet de ne tracer que certaines des bordures du bloc : cette clé prend comme valeur une liste d'éléments parmi les suivants : |left|, |right|, |top| et |bottom| ; +\item les clés |t| et |b| réglent la ligne de base qui sera donnée au bloc quand +celui-ci est constitué de plusieurs lignes (séparées par la commande |\\|) ; \item \colorbox{yellow!50}{\bfseries Nouveau 5.15}\enskip la clé |hvlines| trace -tous les filets horizontaux et verticaux dans le bloc ; -\item \colorbox{yellow!50}{\bfseries Nouveau 5.14}\enskip les clés |t| et |b| -réglent la ligne de base qui sera donnée au bloc quand celui-ci est constitué de -plusieurs lignes (séparées par la commande |\\|). +tous les filets horizontaux et verticaux dans le bloc. \end{itemize} @@ -1050,12 +1049,11 @@ A & A & A & A & A & A \\ \bigskip -\colorbox{yellow!50}{\textbf{Nouveau 5.14}}\enskip Quand la clé |corners| est -utilisée, \pkg{nicematrix} calcule les coins vides et ces coins sont alors pris -en compte par les outils de tracés de filets (les filets ne seront pas tracés -dans ces coins vides). \emph{Remarque} : Dans les versions précédentes de -\pkg{nicematrix}, il n'y avait qu'une clé |hvlines-except-corners| (maintenant -considérée comme obsolète). +Quand la clé |corners| est utilisée, \pkg{nicematrix} calcule les coins vides et +ces coins sont alors pris en compte par les outils de tracés de filets (les +filets ne seront pas tracés dans ces coins vides). \emph{Remarque} : Dans les +versions précédentes de \pkg{nicematrix}, il n'y avait qu'une clé +|hvlines-except-corners| (maintenant considérée comme obsolète). \bigskip \begin{BVerbatim}[boxwidth=11cm,baseline=c] @@ -3538,28 +3536,23 @@ Dans l'exemple suivant, nous avons surligné tous les nœuds de la matrice (on explique plus loin la technique utilisée : cf. p. \pageref{highlight}). \[\begin{pNiceMatrix} +\CodeBefore [create-cell-nodes] + \begin{tikzpicture}% + [every node/.style = { inner sep = 0 pt , fill = red!15 }] + \node [fit = (1-1)] {} ; + \node [fit = (1-3)] {} ; + \node [fit = (2-2)] {} ; + \node [fit = (3-1)] {} ; + \node [fit = (3-3)] {} ; + \node [fit = (1-2)] {} ; + \node [fit = (2-1)] {} ; + \node [fit = (2-3)] {} ; + \node [fit = (3-2)] {} ; + \end{tikzpicture} +\Body a & a + b & a + b + c \\ a & a & a + b \\ a & a & a -\CodeAfter -\begin{tikzpicture}[ - every node/.style = - { - blend mode = multiply, - inner sep = 0 pt , - fill = red!15 - } - ] -\node [fit = (1-1)] {} ; -\node [fit = (1-3)] {} ; -\node [fit = (2-2)] {} ; -\node [fit = (3-1)] {} ; -\node [fit = (3-3)] {} ; -\node [fit = (1-2)] {} ; -\node [fit = (2-1)] {} ; -\node [fit = (2-3)] {} ; -\node [fit = (3-2)] {} ; -\end{tikzpicture} \end{pNiceMatrix}\] @@ -3583,25 +3576,24 @@ nom des nœuds normaux. Dans l'exemple suivant, on a surligné tous les «nœuds moyens». Nous considérons que cet exemple se suffit à lui-même comme définition de ces nœuds. \[\begin{pNiceMatrix}[create-medium-nodes] +\CodeBefore [create-cell-nodes] + \begin{tikzpicture} + [every node/.style = {fill = red!15, inner sep = 0 pt}, + name suffix = -medium] + \node [fit = (1-1)] {} ; + \node [fit = (1-2)] {} ; + \node [fit = (1-3)] {} ; + \node [fit = (2-1)] {} ; + \node [fit = (2-2)] {} ; + \node [fit = (2-3)] {} ; + \node [fit = (3-1)] {} ; + \node [fit = (3-2)] {} ; + \node [fit = (3-3)] {} ; +\end{tikzpicture} +\Body a & a + b & a + b + c \\ a & a & a + b \\ a & a & a -\CodeAfter -\begin{tikzpicture} - [every node/.style = {fill = red!15, - blend mode = multiply, - inner sep = 0 pt}, - name suffix = -medium] -\node [fit = (1-1)] {} ; -\node [fit = (1-2)] {} ; -\node [fit = (1-3)] {} ; -\node [fit = (2-1)] {} ; -\node [fit = (2-2)] {} ; -\node [fit = (2-3)] {} ; -\node [fit = (3-1)] {} ; -\node [fit = (3-2)] {} ; -\node [fit = (3-3)] {} ; -\end{tikzpicture} \end{pNiceMatrix}\] @@ -3614,24 +3606,24 @@ de ces nœuds.\footnote{Il n'y a pas de «nœuds larges» créés dans les rang p.~\pageref{exterior}).} \[\begin{pNiceMatrix}[create-large-nodes] +\CodeBefore [create-cell-nodes] + \begin{tikzpicture} + [every node/.style = { inner sep = 0 pt} , + name suffix = -large] + \node [fit = (1-1),fill = red!15] {} ; + \node [fit = (1-3),fill = red!15] {} ; + \node [fit = (2-2),fill = red!15] {} ; + \node [fit = (3-1),fill = red!15] {} ; + \node [fit = (3-3),fill = red!15] {} ; + \node [fit = (1-2),fill = blue!15] {} ; + \node [fit = (2-1),fill = blue!15] {} ; + \node [fit = (2-3),fill = blue!15] {} ; + \node [fit = (3-2),fill = blue!15] {} ; + \end{tikzpicture} +\Body a & a + b & a + b + c \\ a & a & a + b \\ a & a & a -\CodeAfter -\begin{tikzpicture} - [every node/.style = {blend mode = multiply, - inner sep = 0 pt}, - name suffix = -large] -\node [fit = (1-1),fill = red!15] {} ; -\node [fit = (1-3),fill = red!15] {} ; -\node [fit = (2-2),fill = red!15] {} ; -\node [fit = (3-1),fill = red!15] {} ; -\node [fit = (3-3),fill = red!15] {} ; -\node [fit = (1-2),fill = blue!15] {} ; -\node [fit = (2-1),fill = blue!15] {} ; -\node [fit = (2-3),fill = blue!15] {} ; -\node [fit = (3-2),fill = blue!15] {} ; -\end{tikzpicture} \end{pNiceMatrix}\] @@ -3647,24 +3639,24 @@ utilisé les options |left-margin| et |right-margin|.\footnote{Les options elle est égale à |\arraycolsep| (valeur initiale : 5~pt). Il existe aussi une option |margin| pour fixer à la fois |left-margin| et |right-margin|.} \[\begin{pNiceMatrix}[create-large-nodes,left-margin,right-margin] +\CodeBefore [create-cell-nodes] + \begin{tikzpicture} + [every node/.style = {inner sep = 0 pt}, + name suffix = -large] + \node [fit = (1-1),fill = red!15] {} ; + \node [fit = (1-3),fill = red!15] {} ; + \node [fit = (2-2),fill = red!15] {} ; + \node [fit = (3-1),fill = red!15] {} ; + \node [fit = (3-3),fill = red!15] {} ; + \node [fit = (1-2),fill = blue!15] {} ; + \node [fit = (2-1),fill = blue!15] {} ; + \node [fit = (2-3),fill = blue!15] {} ; + \node [fit = (3-2),fill = blue!15] {} ; + \end{tikzpicture} +\Body a & a + b & a + b + c \\ a & a & a + b \\ a & a & a -\CodeAfter -\begin{tikzpicture} - [every node/.style = {blend mode = multiply, - inner sep = 0 pt}, - name suffix = -large] -\node [fit = (1-1),fill = red!15] {} ; -\node [fit = (1-3),fill = red!15] {} ; -\node [fit = (2-2),fill = red!15] {} ; -\node [fit = (3-1),fill = red!15] {} ; -\node [fit = (3-3),fill = red!15] {} ; -\node [fit = (1-2),fill = blue!15] {} ; -\node [fit = (2-1),fill = blue!15] {} ; -\node [fit = (2-3),fill = blue!15] {} ; -\node [fit = (3-2),fill = blue!15] {} ; -\end{tikzpicture} \end{pNiceMatrix}\] \medskip @@ -3674,24 +3666,24 @@ incorporées dans les «nœuds larges». Dans l'exemple suivant, nous avons util |extra-left-margin| et |extra-right-margin| avec la valeur $3$~pt. \[\begin{pNiceMatrix}% [create-large-nodes,left-margin,right-margin,extra-right-margin=3pt,extra-left-margin=3pt] +\CodeBefore [create-cell-nodes] + \begin{tikzpicture} + [every node/.style = {inner sep = 0 pt}, + name suffix = -large] + \node [fit = (1-1),fill = red!15] {} ; + \node [fit = (1-3),fill = red!15] {} ; + \node [fit = (2-2),fill = red!15] {} ; + \node [fit = (3-1),fill = red!15] {} ; + \node [fit = (3-3),fill = red!15] {} ; + \node [fit = (1-2),fill = blue!15] {} ; + \node [fit = (2-1),fill = blue!15] {} ; + \node [fit = (2-3),fill = blue!15] {} ; + \node [fit = (3-2),fill = blue!15] {} ; +\end{tikzpicture} +\Body a & a + b & a + b + c \\ a & a & a + b \\ a & a & a -\CodeAfter -\begin{tikzpicture} - [every node/.style = {blend mode = multiply, - inner sep = 0 pt}, - name suffix = -large] -\node [fit = (1-1),fill = red!15] {} ; -\node [fit = (1-3),fill = red!15] {} ; -\node [fit = (2-2),fill = red!15] {} ; -\node [fit = (3-1),fill = red!15] {} ; -\node [fit = (3-3),fill = red!15] {} ; -\node [fit = (1-2),fill = blue!15] {} ; -\node [fit = (2-1),fill = blue!15] {} ; -\node [fit = (2-3),fill = blue!15] {} ; -\node [fit = (3-2),fill = blue!15] {} ; -\end{tikzpicture} \end{pNiceMatrix}\] @@ -3748,28 +3740,38 @@ Voici maintenant tous les «nœuds larges» de ce tableau (sans utilisation de \begin{scope} \large \begin{NiceTabular}[c]{w{l}{2cm}ll}[hvlines,create-large-nodes] +\CodeBefore [create-cell-nodes] + \begin{tikzpicture} + [every node/.style = {inner sep = 0 pt}, + name suffix = -large] + \node [fit = (1-1),fill = red!15] {} ; + \node [fit = (1-3),fill = red!15] {} ; + \node [fit = (2-2),fill = red!15] {} ; + \node [fit = (3-1),fill = red!15] {} ; + \node [fit = (3-3),fill = red!15] {} ; + \node [fit = (1-2),fill = blue!15] {} ; + \node [fit = (2-1),fill = blue!15] {} ; + \node [fit = (2-3),fill = blue!15] {} ; + \node [fit = (3-2),fill = blue!15] {} ; + \end{tikzpicture} +\Body fraise & amande & abricot \\ prune & pêche & poire \\[1ex] noix & noisette & brugnon -\CodeAfter -\begin{tikzpicture} - [every node/.style = {blend mode = multiply, - inner sep = 0 pt}, - name suffix = -large] -\node [fit = (1-1),fill = red!15] {} ; -\node [fit = (1-3),fill = red!15] {} ; -\node [fit = (2-2),fill = red!15] {} ; -\node [fit = (3-1),fill = red!15] {} ; -\node [fit = (3-3),fill = red!15] {} ; -\node [fit = (1-2),fill = blue!15] {} ; -\node [fit = (2-1),fill = blue!15] {} ; -\node [fit = (2-3),fill = blue!15] {} ; -\node [fit = (3-2),fill = blue!15] {} ; -\end{tikzpicture} \end{NiceTabular} \end{scope} +\vspace{1cm} +Les nœuds que l'on vient de décrire ne sont pas accessibles par défaut dans le +|\CodeBefore| (décrit p.~\pageref{code-before}). \par\nobreak + +\colorbox{yellow!50}{\textbf{Nouveau 5.16}}\enskip On peut rendre ces nœuds +accessibles dans le |\CodeBefore| en utilisant la clé |create-cell-nodes| du +mot-clé |\CodeBefore| (dans ce cas-là, les nœuds sont créés une première fois +avant la construction du tableau en utilisant des informations écrites dans le +fichier |aux| puis recréés lors de la composition du tableau proprement dit). + \subsection{Les nœuds indiquant la position des filets} @@ -3779,11 +3781,8 @@ L'extension \pkg{nicematrix} crée un nœud PGF-Tikz nommé simplement $i$ (pré du préfixe habituel) à l'intersection du filet horizontal de numéro $i$ et du filet vertical de numéro~$i$ (ou plutôt la position potentielle de ces filets car ils ne sont peut-être pas tracés). Le dernier nœud a aussi un alias nommé -simplement |last|. - -\smallskip -\colorbox{yellow!50}{\textbf{Nouveau 5.14}}\enskip Il existe aussi un nœud nommé -$i$|.5| à mi-chemin entre le nœud $i$ et le nœud $i+1$. +simplement |last|. Il existe aussi un nœud nommé $i$|.5| à mi-chemin entre le +nœud $i$ et le nœud $i+1$. Ces nœuds sont accessibles dans le |\CodeAfter| mais aussi dans le |\CodeBefore|. @@ -4759,17 +4758,12 @@ suivantes dans le préambule du document : \medskip Nous créons un nœud Tikz rectangulaire qui englobe les nœuds de la deuxième -rangée en utilisant les outils de la bibliothèque Tikz \pkg{fit}. Ce nœud est -rempli après la construction de la matrice. Pour que l'on puisse voir le texte -\emph{sous} le nœud, nous devons utiliser la transparence avec le |blend mode| -égal à |multiply|. \textbf{Attention} : Certains lecteurs de \textsc{pdf} -n'affichent pas la transparence.\footnote{Dans Overleaf, the lecteur de - \textsc{PDF} «intégré» n'affiche pas la transparence. On peut sélectionner le - lecteur «natif» dans ce cas-là.} +rangée en utilisant les outils de la bibliothèque Tikz \pkg{fit}. Ces nœuds ne +sont pas créés par défaut dans le |\CodeBefore| (par souci d'efficacité). Il +faut utiliser la clé |create-cell-nodes| du |\CodeBefore| pour demander leur création. \tikzset{highlight/.style={rectangle, fill=red!15, - blend mode = multiply, rounded corners = 0.5 mm, inner sep=1pt, fit=#1}} @@ -4778,119 +4772,59 @@ n'affichent pas la transparence.\footnote{Dans Overleaf, the lecteur de \begin{Verbatim} \tikzset{highlight/.style={rectangle, fill=red!15, - ~emphase#blend mode = multiply@, rounded corners = 0.5 mm, inner sep=1pt, fit=~#1}} $\begin{bNiceMatrix} +~emphase#\CodeBefore [create-cell-nodes] @ +~emphase# \tikz \node [highlight = (2-1) (2-3)] {} ; @ +~emphase# \Body @ 0 & \Cdots & 0 \\ 1 & \Cdots & 1 \\ 0 & \Cdots & 0 \\ -~emphase#\CodeAfter \tikz \node [highlight = (2-1) (2-3)] {} ;@ \end{bNiceMatrix}$ \end{Verbatim} \[\begin{bNiceMatrix} +\CodeBefore [create-cell-nodes] + \tikz \node [highlight = (2-1) (2-3)] {} ; +\Body 0 & \Cdots & 0 \\ 1 & \Cdots & 1 \\ 0 & \Cdots & 0 \\ -\CodeAfter \tikz \node [highlight = (2-1) (2-3)] {} ; \end{bNiceMatrix}\] -\vspace{1cm} On rappelle que dans le cas d'un ensemble de cases fusionnées (avec -la commande |\Block|), un nœud Tikz est créé pour l'ensemble des cases avec pour -nom $i$|-|$j$|-block| où $i$ et $j$ sont les numéros de ligne et de colonne de -la case en haut à gauche (où a été utilisée la commande |\Block|). Si on a -demandé la création des nœuds |medium|, alors un nœud de ce type est aussi créé -pour ce bloc avec un nom suffixé par |-medium|. - -\medskip -\begin{BVerbatim}[baseline=c,boxwidth=11.6cm] -$\begin{pNiceMatrix}[margin,create-medium-nodes] - \Block{3-3}<\Large>{A} & & & 0 \\ - & \hspace*{1cm} & & \Vdots \\ - & & & 0 \\ - 0 & \Cdots& 0 & 0 -\CodeAfter - \tikz \node [~emphase#highlight = (1-1-block-medium)@] {} ; -\end{pNiceMatrix}$ -\end{BVerbatim} -$\begin{pNiceMatrix}[margin,create-medium-nodes] -\Block{3-3}<\Large>{A} & & & 0 \\ -& \hspace*{1cm} & & \Vdots \\ -& & & 0 \\ -0 & \Cdots& 0 & 0 -\CodeAfter -\tikz \node [highlight = (1-1-block-medium)] {} ; -\end{pNiceMatrix}$ - - \vspace{1cm} -On considère maintenant la matrice suivante que l'on a appelée |exemple|. +On considère maintenant la matrice suivante. Si on veut surligner chaque rangée +de la matrice, on peut utiliser la technique précédente trois fois. -\medskip \begin{Verbatim} -$\begin{pNiceArray}{ccc}[~emphase#name=exemple@,last-col,create-medium-nodes] -a & a + b & a + b + c & L_1 \\ -a & a & a + b & L_2 \\ -a & a & a & L_3 -\end{pNiceArray}$ -\end{Verbatim} - \[\begin{pNiceArray}{ccc}[last-col] +\CodeBefore [create-cell-nodes] + \begin{tikzpicture} +~emphase# \node [highlight = (1-1) (1-3)] {} ;@ +~emphase# \node [highlight = (2-1) (2-3)] {} ;@ +~emphase# \node [highlight = (3-1) (3-3)] {} ;@ + \end{tikzpicture} +\Body a & a + b & a + b + c & L_1 \\ a & a & a + b & L_2 \\ a & a & a & L_3 \end{pNiceArray}\] - -\bigskip -Si on veut surligner chaque rangée de la matrice, on peut utiliser la technique précédente trois fois. - -\begin{Verbatim} -\tikzset{mes-options/.style={remember picture, - overlay, - name prefix = exemple-, - highlight/.style = {fill = red!15, - blend mode = multiply, - inner sep = 0pt, - fit = ~#1}}} \end{Verbatim} - -\tikzset{mes-options/.style={remember picture, - overlay, - name prefix = exemple-, - highlight/.style = {fill = red!15, - blend mode = multiply, - inner sep = 0pt, - fit = #1}}} - - -\begin{Verbatim} -\begin{tikzpicture}[mes-options] -\node [highlight = (1-1) (1-3)] {} ; -\node [highlight = (2-1) (2-3)] {} ; -\node [highlight = (3-1) (3-3)] {} ; -\end{tikzpicture} -\end{Verbatim} - -\medskip -On obtient la matrice suivante. - -\[\begin{pNiceArray}{ccc}[ - last-col, - code-after = {\begin{tikzpicture}[highlight/.style = {fill = red!15, - blend mode = multiply, - inner sep = 0pt, - fit = #1}] - \node [highlight = (1-1) (1-3)] {} ; - \node [highlight = (2-1) (2-3)] {} ; - \node [highlight = (3-1) (3-3)] {} ; - \end{tikzpicture}}] +\[\begin{pNiceArray}{ccc}[last-col] +\CodeBefore [create-cell-nodes] + \begin{tikzpicture} + \node [highlight = (1-1) (1-3)] {} ; + \node [highlight = (2-1) (2-3)] {} ; + \node [highlight = (3-1) (3-3)] {} ; + \end{tikzpicture} +\Body a & a + b & a + b + c & L_1 \\ a & a & a + b & L_2 \\ a & a & a & L_3 @@ -4901,46 +4835,44 @@ Le résultat peut paraître décevant. On peut l'améliorer en utilisant les «n moyens» au lieu des «nœuds normaux». \begin{Verbatim} -\begin{tikzpicture}[mes-options, ~emphase#name suffix = -medium@] -\node [highlight = (1-1) (1-3)] {} ; -\node [highlight = (2-1) (2-3)] {} ; -\node [highlight = (3-1) (3-3)] {} ; -\end{tikzpicture} +\[\begin{pNiceArray}{ccc}[last-col,create-medium-nodes] +\CodeBefore [create-cell-nodes] + \begin{tikzpicture} ~emphase#[name suffix = -medium]@ + \node [highlight = (1-1) (1-3)] {} ; + \node [highlight = (2-1) (2-3)] {} ; + \node [highlight = (3-1) (3-3)] {} ; + \end{tikzpicture} +\Body +a & a + b & a + b + c & L_1 \\ +a & a & a + b & L_2 \\ +a & a & a & L_3 +\end{pNiceArray}\] \end{Verbatim} -\medskip -On obtient la matrice suivante. \[\begin{pNiceArray}{ccc}[last-col,create-medium-nodes] +\CodeBefore [create-cell-nodes] + \begin{tikzpicture} [name suffix = -medium] + \node [highlight = (1-1) (1-3)] {} ; + \node [highlight = (2-1) (2-3)] {} ; + \node [highlight = (3-1) (3-3)] {} ; + \end{tikzpicture} +\Body a & a + b & a + b + c & L_1 \\ a & a & a + b & L_2 \\ -a & a & a & L_3 \\ -\CodeAfter -\begin{tikzpicture}[highlight/.style = {fill = red!15, - blend mode = multiply, - inner sep = 0pt, - fit = #1}, - name suffix = -medium] -\node [highlight = (1-1) (1-3)] {} ; -\node [highlight = (2-1) (2-3)] {} ; -\node [highlight = (3-1) (3-3)] {} ; -\end{tikzpicture} +a & a & a & L_3 \end{pNiceArray}\] -\subsection{Utilisation de \textbackslash SubMatrix dans le code-before} +\subsection{Utilisation de \textbackslash SubMatrix dans le \textbackslash CodeBefore} Dans l'exemple suivant, on illustre le produit mathématique de deux matrices. L'ensemble de la figure est un environnement |{NiceArray}| et les trois paires -de parenthèses ont été rajoutées avec |\SubMatrix| dans le |code-before|. +de parenthèses ont été rajoutées avec |\SubMatrix| dans le |\CodeBefore|. + -Ceux qui sont intéressés par le code correspondant le trouveront dans le fichier -source de ce document. -% -% -% \tikzset{highlight/.style={rectangle, fill=red!15, rounded corners = 0.5 mm, @@ -4975,6 +4907,43 @@ source de ce document. \end{NiceArray}\] +\vspace{1cm} +\begin{Verbatim} +\tikzset{highlight/.style={rectangle, + fill=red!15, + rounded corners = 0.5 mm, + inner sep=1pt, + fit=~#1}} +\end{Verbatim} + +\begin{Verbatim}[formatcom = \small\color{gray}] +\[\begin{NiceArray}{*{6}{c}~LetterAt{\hspace{6mm}}*{5}{c}}[nullify-dots] +\CodeBefore [create-cell-nodes] + \SubMatrix({2-7}{6-11}) + \SubMatrix({7-2}{11-6}) + \SubMatrix({7-7}{11-11}) + \begin{tikzpicture} + \node [highlight = (9-2) (9-6)] { } ; + \node [highlight = (2-9) (6-9)] { } ; + \end{tikzpicture} +\Body + & & & & & & & & \color{blue}\scriptstyle C_j \\ + & & & & & & b_{11} & \Cdots & b_{1j} & \Cdots & b_{1n} \\ + & & & & & & \Vdots & & \Vdots & & \Vdots \\ + & & & & & & & & b_{kj} \\ + & & & & & & & & \Vdots \\ + & & & & & & b_{n1} & \Cdots & b_{nj} & \Cdots & b_{nn} \\[3mm] + & a_{11} & \Cdots & & & a_{1n} \\ + & \Vdots & & & & \Vdots & & & \Vdots \\ +\color{blue}\scriptstyle L_i + & a_{i1} & \Cdots & a_{ik} & \Cdots & a_{in} & \Cdots & & c_{ij} \\ + & \Vdots & & & & \Vdots \\ + & a_{n1} & \Cdots & & & a_{nn} \\ +\CodeAfter +\tikz \draw [gray,shorten > = 1mm, shorten < = 1mm] (9-4.north) to [bend left] (4-9.west) ; +\end{NiceArray}\] +\end{Verbatim} + \section*{Autre documentation} diff --git a/macros/latex/contrib/nicematrix/nicematrix.dtx b/macros/latex/contrib/nicematrix/nicematrix.dtx index 32206348c0..43fb1accbd 100644 --- a/macros/latex/contrib/nicematrix/nicematrix.dtx +++ b/macros/latex/contrib/nicematrix/nicematrix.dtx @@ -15,8 +15,8 @@ % % \fi % \iffalse -\def\myfileversion{5.15b} -\def\myfiledate{2021/06/05} +\def\myfileversion{5.16} +\def\myfiledate{2021/06/20} % % %<*batchfile> @@ -386,7 +386,9 @@ version 2005/12/01 or later. % \end{minipage} % % \medskip -% However, it's also possible to use the tools of \pkg{booktabs}: |\toprule|, +% However, it's also possible to use the tools of +% \pkg{booktabs}\footnote{The extension \pkg{booktabs} is \emph{not} loaded +% by \pkg{nicematrix}.}: |\toprule|, % |\bottomrule|, |\midrule|, etc.\par\nobreak % % \smallskip @@ -577,11 +579,10 @@ version 2005/12/01 or later. % \item the key |borders| provides the ability to draw only some borders of the % blocks; the value of that key is a (comma-separated) list of elements covered % by |left|, |right|, |top| and |bottom|; +% \item the keys |t| and |b| fix the base line that will be given to the block +% when it has a multi-line content (the lines are separated by |\\|); % \item \colorbox{yellow!50}{\bfseries New 5.15}\enskip the keys |hvlines| draws -% all the vertical and horizontal rules in the block; -% \item \colorbox{yellow!50}{\bfseries New 5.14}\enskip the keys |t| and |b| fix -% the base line that will be given to the block when it has a multi-line content -% (the lines are separated by |\\|). +% all the vertical and horizontal rules in the block. % \end{itemize} % % \interitem @@ -1067,11 +1068,11 @@ version 2005/12/01 or later. % \end{NiceTabular} % % \bigskip -% \colorbox{yellow!50}{\textbf{New 5.14}}\enskip When the key |corners| is used, -% \pkg{nicematrix} computes the (empty) corners and these corners will be taken -% into account by the tools for drawing the rules (the rules won't be drawn in -% the corners). \emph{Remark}: In the previous versions of \pkg{nicematrix}, -% there was only a key |hvlines-except-corners| (now considered as obsolete). +% When the key |corners| is used, \pkg{nicematrix} computes the (empty) corners +% and these corners will be taken into account by the tools for drawing the +% rules (the rules won't be drawn in the corners). \emph{Remark}: In the +% previous versions of \pkg{nicematrix}, there was only a key +% |hvlines-except-corners| (now considered as obsolete). % % \bigskip % \begin{BVerbatim}[boxwidth=11cm,baseline=c] @@ -3252,7 +3253,7 @@ version 2005/12/01 or later. % exists) has also the number~$0$.}. Of course, the user must not change the % value of these counters which are used internally by \pkg{nicematrix}. % -% In the |code-before| (cf. p. \pageref{code-before}) and in the |\CodeAfter| +% In the |\CodeBefore| (cf. p. \pageref{code-before}) and in the |\CodeAfter| % (cf. p. \pageref{code-after}), |iRow| represents the total number of rows % (excepted the potential exterior rows) and |jCol| represents the total number % of columns (excepted the potential exterior columns). @@ -3489,26 +3490,26 @@ version 2005/12/01 or later. % In the following example, we have underlined all the nodes of the matrix (we % explain below the technic used : cf. p. \pageref{highlight}). % -% \[\begin{pNiceMatrix}[ -% code-after = {\begin{tikzpicture} -% [every node/.style = {blend mode = multiply, -% fill = red!15, -% inner sep = 0 pt }] -% \node [fit = (1-1)] {} ; -% \node [fit = (1-3)] {} ; -% \node [fit = (2-2)] {} ; -% \node [fit = (3-1)] {} ; -% \node [fit = (3-3)] {} ; -% \node [fit = (1-2)] {} ; -% \node [fit = (2-1)] {} ; -% \node [fit = (2-3)] {} ; -% \node [fit = (3-2)] {} ; -% \end{tikzpicture}}] +% +% \[\begin{pNiceMatrix} +% \CodeBefore [create-cell-nodes] +% \begin{tikzpicture}% +% [every node/.style = { inner sep = 0 pt , fill = red!15 }] +% \node [fit = (1-1)] {} ; +% \node [fit = (1-3)] {} ; +% \node [fit = (2-2)] {} ; +% \node [fit = (3-1)] {} ; +% \node [fit = (3-3)] {} ; +% \node [fit = (1-2)] {} ; +% \node [fit = (2-1)] {} ; +% \node [fit = (2-3)] {} ; +% \node [fit = (3-2)] {} ; +% \end{tikzpicture} +% \Body % a & a + b & a + b + c \\ % a & a & a + b \\ % a & a & a % \end{pNiceMatrix}\] -% % % % \subsection{The ``medium nodes'' and the ``large nodes''} @@ -3529,23 +3530,22 @@ version 2005/12/01 or later. % ``|-medium|'' to the names of the ``normal nodes''. In the following example, % we have underlined the ``medium nodes''. We consider that this example is % self-explanatory. -% \[\begin{pNiceMatrix}[ -% create-medium-nodes, -% code-after = {\begin{tikzpicture} -% [every node/.style = {fill = red!15, -% blend mode = multiply, -% inner sep = 0pt}, -% name suffix = -medium] -% \node [fit = (1-1)] {} ; -% \node [fit = (1-2)] {} ; -% \node [fit = (1-3)] {} ; -% \node [fit = (2-1)] {} ; -% \node [fit = (2-2)] {} ; -% \node [fit = (2-3)] {} ; -% \node [fit = (3-1)] {} ; -% \node [fit = (3-2)] {} ; -% \node [fit = (3-3)] {} ; -% \end{tikzpicture}}] +% \[\begin{pNiceMatrix}[create-medium-nodes] +% \CodeBefore [create-cell-nodes] +% \begin{tikzpicture} +% [every node/.style = {fill = red!15, inner sep = 0 pt}, +% name suffix = -medium] +% \node [fit = (1-1)] {} ; +% \node [fit = (1-2)] {} ; +% \node [fit = (1-3)] {} ; +% \node [fit = (2-1)] {} ; +% \node [fit = (2-2)] {} ; +% \node [fit = (2-3)] {} ; +% \node [fit = (3-1)] {} ; +% \node [fit = (3-2)] {} ; +% \node [fit = (3-3)] {} ; +% \end{tikzpicture} +% \Body % a & a + b & a + b + c \\ % a & a & a + b \\ % a & a & a @@ -3558,27 +3558,27 @@ version 2005/12/01 or later. % we have underlined the ``large nodes''. We consider that this example is % self-explanatory.\footnote{There is no ``large nodes'' created in the exterior % rows and columns (for these rows and columns, cf. p.~\pageref{exterior}).} -% -% \[\begin{pNiceMatrix}[ -% create-large-nodes, -% code-after = {\begin{tikzpicture} -% [every node/.style = {blend mode = multiply, -% inner sep = 0pt}, -% name suffix = -large] -% \node [fit = (1-1),fill = red!15] {} ; -% \node [fit = (1-3),fill = red!15] {} ; -% \node [fit = (2-2),fill = red!15] {} ; -% \node [fit = (3-1),fill = red!15] {} ; -% \node [fit = (3-3),fill = red!15] {} ; -% \node [fit = (1-2),fill = blue!15] {} ; -% \node [fit = (2-1),fill = blue!15] {} ; -% \node [fit = (2-3),fill = blue!15] {} ; -% \node [fit = (3-2),fill = blue!15] {} ; -% \end{tikzpicture}}] +% \[\begin{pNiceMatrix}[create-large-nodes] +% \CodeBefore [create-cell-nodes] +% \begin{tikzpicture} +% [every node/.style = { inner sep = 0 pt} , +% name suffix = -large] +% \node [fit = (1-1),fill = red!15] {} ; +% \node [fit = (1-3),fill = red!15] {} ; +% \node [fit = (2-2),fill = red!15] {} ; +% \node [fit = (3-1),fill = red!15] {} ; +% \node [fit = (3-3),fill = red!15] {} ; +% \node [fit = (1-2),fill = blue!15] {} ; +% \node [fit = (2-1),fill = blue!15] {} ; +% \node [fit = (2-3),fill = blue!15] {} ; +% \node [fit = (3-2),fill = blue!15] {} ; +% \end{tikzpicture} +% \Body % a & a + b & a + b + c \\ % a & a & a + b \\ % a & a & a % \end{pNiceMatrix}\] +% % % % \medskip @@ -3591,26 +3591,27 @@ version 2005/12/01 or later. % value is given, the default value is used, which is |\arraycolsep| (by % default: 5~pt). There is also an option |margin| to fix both |left-margin| and % |right-margin| to the same value.} -% \[\begin{pNiceMatrix}[ -% create-large-nodes,left-margin,right-margin, -% code-after = {\begin{tikzpicture} -% [every node/.style = {blend mode = multiply, -% inner sep = 0pt}, -% name suffix = -large] -% \node [fit = (1-1),fill = red!15] {} ; -% \node [fit = (1-3),fill = red!15] {} ; -% \node [fit = (2-2),fill = red!15] {} ; -% \node [fit = (3-1),fill = red!15] {} ; -% \node [fit = (3-3),fill = red!15] {} ; -% \node [fit = (1-2),fill = blue!15] {} ; -% \node [fit = (2-1),fill = blue!15] {} ; -% \node [fit = (2-3),fill = blue!15] {} ; -% \node [fit = (3-2),fill = blue!15] {} ; -% \end{tikzpicture}}] +% \[\begin{pNiceMatrix}[create-large-nodes,left-margin,right-margin] +% \CodeBefore [create-cell-nodes] +% \begin{tikzpicture} +% [every node/.style = {inner sep = 0 pt}, +% name suffix = -large] +% \node [fit = (1-1),fill = red!15] {} ; +% \node [fit = (1-3),fill = red!15] {} ; +% \node [fit = (2-2),fill = red!15] {} ; +% \node [fit = (3-1),fill = red!15] {} ; +% \node [fit = (3-3),fill = red!15] {} ; +% \node [fit = (1-2),fill = blue!15] {} ; +% \node [fit = (2-1),fill = blue!15] {} ; +% \node [fit = (2-3),fill = blue!15] {} ; +% \node [fit = (3-2),fill = blue!15] {} ; +% \end{tikzpicture} +% \Body % a & a + b & a + b + c \\ % a & a & a + b \\ % a & a & a % \end{pNiceMatrix}\] +% % % \medskip % It's also possible to add more space on both side of the array with the @@ -3618,22 +3619,22 @@ version 2005/12/01 or later. % incorporated in the ``large nodes''. It's possible to fix both values with the % option |extra-margin| and, in the following example, we use |extra-margin| % with the value $3$~pt. -% \[\begin{pNiceMatrix}[ -% create-large-nodes,margin,extra-margin=3pt, -% code-after = {\begin{tikzpicture} -% [every node/.style = {blend mode = multiply, -% inner sep = 0 pt}, -% name suffix = -large] -% \node [fit = (1-1),fill = red!15] {} ; -% \node [fit = (1-3),fill = red!15] {} ; -% \node [fit = (2-2),fill = red!15] {} ; -% \node [fit = (3-1),fill = red!15] {} ; -% \node [fit = (3-3),fill = red!15] {} ; -% \node [fit = (1-2),fill = blue!15] {} ; -% \node [fit = (2-1),fill = blue!15] {} ; -% \node [fit = (2-3),fill = blue!15] {} ; -% \node [fit = (3-2),fill = blue!15] {} ; -% \end{tikzpicture}}] +% \[\begin{pNiceMatrix}[create-large-nodes,left-margin,right-margin,extra-right-margin=3pt,extra-left-margin=3pt] +% \CodeBefore [create-cell-nodes] +% \begin{tikzpicture} +% [every node/.style = {inner sep = 0 pt}, +% name suffix = -large] +% \node [fit = (1-1),fill = red!15] {} ; +% \node [fit = (1-3),fill = red!15] {} ; +% \node [fit = (2-2),fill = red!15] {} ; +% \node [fit = (3-1),fill = red!15] {} ; +% \node [fit = (3-3),fill = red!15] {} ; +% \node [fit = (1-2),fill = blue!15] {} ; +% \node [fit = (2-1),fill = blue!15] {} ; +% \node [fit = (2-3),fill = blue!15] {} ; +% \node [fit = (3-2),fill = blue!15] {} ; +% \end{tikzpicture} +% \Body % a & a + b & a + b + c \\ % a & a & a + b \\ % a & a & a @@ -3693,22 +3694,22 @@ version 2005/12/01 or later. % \hspace{1.5cm} % \begin{scope} % \large -% \begin{NiceTabular}[c]{wl{2cm}ll}[hvlines, -% create-large-nodes, -% code-after = {\begin{tikzpicture} -% [every node/.style = {blend mode = multiply, -% inner sep = 0 pt}, -% name suffix = -large] -% \node [fit = (1-1),fill = red!15] {} ; -% \node [fit = (1-3),fill = red!15] {} ; -% \node [fit = (2-2),fill = red!15] {} ; -% \node [fit = (3-1),fill = red!15] {} ; -% \node [fit = (3-3),fill = red!15] {} ; -% \node [fit = (1-2),fill = blue!15] {} ; -% \node [fit = (2-1),fill = blue!15] {} ; -% \node [fit = (2-3),fill = blue!15] {} ; -% \node [fit = (3-2),fill = blue!15] {} ; -% \end{tikzpicture}}] +% \begin{NiceTabular}[c]{w{l}{2cm}ll}[hvlines,create-large-nodes] +% \CodeBefore [create-cell-nodes] +% \begin{tikzpicture} +% [every node/.style = {inner sep = 0 pt}, +% name suffix = -large] +% \node [fit = (1-1),fill = red!15] {} ; +% \node [fit = (1-3),fill = red!15] {} ; +% \node [fit = (2-2),fill = red!15] {} ; +% \node [fit = (3-1),fill = red!15] {} ; +% \node [fit = (3-3),fill = red!15] {} ; +% \node [fit = (1-2),fill = blue!15] {} ; +% \node [fit = (2-1),fill = blue!15] {} ; +% \node [fit = (2-3),fill = blue!15] {} ; +% \node [fit = (3-2),fill = blue!15] {} ; +% \end{tikzpicture} +% \Body % fraise & amande & abricot \\ % prune & pêche & poire \\[1ex] % noix & noisette & brugnon @@ -3716,7 +3717,15 @@ version 2005/12/01 or later. % \end{scope} % % +% \vspace{1cm} +% The nodes we have described are not available by default in the |\CodeBefore| +% (described p.~\pageref{code-before}).\par\nobreak % +% \colorbox{yellow!50}{\textbf{New 5.16}}\enskip It's possible to have these +% nodes available in the |\CodeBefore| by using the key |create-cell-nodes| of +% the keyword |\CodeBefore| (in that case, the nodes are created first before +% the construction of the array by using informations written on the |aux| file +% and created a second time during the contruction of the array itself). % % \subsection{The nodes which indicate the position of the rules} % @@ -3725,10 +3734,8 @@ version 2005/12/01 or later. % the classical prefix) at the intersection of the horizontal rule of number~$i$ % and the vertical rule of number~$i$ (more specifically the potential position % of those rules because maybe there are not actually drawn). The last node has -% also an alias called |last|. -% -% \colorbox{yellow!50}{\textbf{New 5.14}}\enskip There is also a node called -% $i$|.5| midway between the node $i$ and the node $i+1$. +% also an alias called |last|. There is also a node called $i$|.5| midway +% between the node $i$ and the node $i+1$. % % These nodes are available in the |\CodeBefore| and the |\CodeAfter|. % @@ -4690,9 +4697,14 @@ version 2005/12/01 or later. % \usetikzlibrary{fit} % \end{verbatim} % +% \medskip +% We create a rectangular Tikz node which encompasses the nodes of the second +% row by using the tools of the Tikz library \pkg{fit}. Those nodes are not +% available by default in the |\CodeBefore| (for efficiency). We have to require +% their creation with the key |create-cell-nodes| of the keyword |\CodeBefore|. +% % \tikzset{highlight/.style={rectangle, % fill=red!15, -% blend mode = multiply, % rounded corners = 0.5 mm, % inner sep=1pt, % fit = #1}} @@ -4701,120 +4713,58 @@ version 2005/12/01 or later. % \begin{Verbatim} % \tikzset{highlight/.style={rectangle, % fill=red!15, -% ~emphase#blend mode = multiply@, % rounded corners = 0.5 mm, % inner sep=1pt, -% fit = ~#1}} +% fit=~#1}} % -% % $\begin{bNiceMatrix} +% ~emphase#\CodeBefore [create-cell-nodes] @ +% ~emphase# \tikz \node [highlight = (2-1) (2-3)] {} ; @ +% ~emphase# \Body @ % 0 & \Cdots & 0 \\ % 1 & \Cdots & 1 \\ % 0 & \Cdots & 0 \\ -% ~emphase#\CodeAfter \tikz \node [highlight = (2-1) (2-3)] {} ;@ % \end{bNiceMatrix}$ % \end{Verbatim} % \[\begin{bNiceMatrix} +% \CodeBefore [create-cell-nodes] +% \tikz \node [highlight = (2-1) (2-3)] {} ; +% \Body % 0 & \Cdots & 0 \\ % 1 & \Cdots & 1 \\ % 0 & \Cdots & 0 \\ -% \CodeAfter \tikz \node [highlight = (2-1) (2-3)] {} ; % \end{bNiceMatrix}\] % -% -% -% \vspace{1cm} -% We recall that, for a rectangle of merged cells (with the command |\Block|), a -% Tikz node is created for the set of merged cells with the name -% $i$|-|$j$-|block| where $i$ and $j$ are the number of the row and the number -% of the column of the upper left cell (where the command |\Block| has been -% issued). If the user has required the creation of the |medium| nodes, a node -% of this type is also created with a name suffixed by |-medium|. -% -% \medskip -% \begin{BVerbatim}[baseline=c,boxwidth=11.6cm] -% $\begin{pNiceMatrix}[margin,create-medium-nodes] -% \Block{3-3}<\Large>{A} & & & 0 \\ -% & \hspace*{1cm} & & \Vdots \\ -% & & & 0 \\ -% 0 & \Cdots& 0 & 0 -% \CodeAfter -% \tikz \node [~emphase#highlight = (1-1-block-medium)@] {} ; -% \end{pNiceMatrix}$ -% \end{BVerbatim} -% $\begin{pNiceMatrix}[margin,create-medium-nodes] -% \Block{3-3}<\Large>{A} & & & 0 \\ -% & \hspace*{1cm} & & \Vdots \\ -% & & & 0 \\ -% 0 & \Cdots& 0 & 0 -% \CodeAfter -% \tikz \node [highlight = (1-1-block-medium)] {} ; -% \end{pNiceMatrix}$ -% % % \vspace{1cm} -% Consider now the following matrix which we have named |example|. +% We consider now the following matrix. If we want to highlight each row of +% this matrix, we can use the previous technique three times. % -% \medskip % \begin{Verbatim} -% $\begin{pNiceArray}{ccc}[~emphase#name=example@,last-col,create-medium-nodes] -% a & a + b & a + b + c & L_1 \\ -% a & a & a + b & L_2 \\ -% a & a & a & L_3 -% \end{pNiceArray}$ -% \end{Verbatim} -% % \[\begin{pNiceArray}{ccc}[last-col] +% \CodeBefore [create-cell-nodes] +% \begin{tikzpicture} +% ~emphase# \node [highlight = (1-1) (1-3)] {} ;@ +% ~emphase# \node [highlight = (2-1) (2-3)] {} ;@ +% ~emphase# \node [highlight = (3-1) (3-3)] {} ;@ +% \end{tikzpicture} +% \Body % a & a + b & a + b + c & L_1 \\ % a & a & a + b & L_2 \\ % a & a & a & L_3 % \end{pNiceArray}\] -% -% \bigskip -% If we want to highlight each row of this matrix, we can use the previous -% technique three times. -% -% \begin{Verbatim} -% \tikzset{mes-options/.style={remember picture, -% overlay, -% name prefix = exemple-, -% highlight/.style = {fill = red!15, -% blend mode = multiply, -% inner sep = 0pt, -% fit = ~#1}}} -% \end{Verbatim} -% -% -% \tikzset{mes-options/.style={remember picture, -% overlay, -% name prefix = exemple-, -% highlight/.style = {fill = red!15, -% blend mode = multiply, -% inner sep = 0pt, -% fit = #1}}} -% -% \begin{Verbatim} -% \begin{tikzpicture}[mes-options] -% \node [highlight = (1-1) (1-3)] {} ; -% \node [highlight = (2-1) (2-3)] {} ; -% \node [highlight = (3-1) (3-3)] {} ; -% \end{tikzpicture} % \end{Verbatim} % % -% \medskip -% We obtain the following matrix. -% -% \[\begin{pNiceArray}{ccc}[ -% last-col, -% code-after = {\begin{tikzpicture}[every node/.style = {fill = red!15, -% blend mode = multiply, -% inner sep = 0pt}] -% \node [fit = (1-1) (1-3)] {} ; -% \node [fit = (2-1) (2-3)] {} ; -% \node [fit = (3-1) (3-3)] {} ; -% \end{tikzpicture}}] -% a & a + b & a + b + c & L_1\\ +% \[\begin{pNiceArray}{ccc}[last-col] +% \CodeBefore [create-cell-nodes] +% \begin{tikzpicture} +% \node [highlight = (1-1) (1-3)] {} ; +% \node [highlight = (2-1) (2-3)] {} ; +% \node [highlight = (3-1) (3-3)] {} ; +% \end{tikzpicture} +% \Body +% a & a + b & a + b + c & L_1 \\ % a & a & a + b & L_2 \\ % a & a & a & L_3 % \end{pNiceArray}\] @@ -4824,28 +4774,29 @@ version 2005/12/01 or later. % nodes'' instead of the ``normal nodes''. % % \begin{Verbatim} -% \begin{tikzpicture}[mes-options, ~emphase#name suffix = -medium@] -% \node [highlight = (1-1) (1-3)] {} ; -% \node [highlight = (2-1) (2-3)] {} ; -% \node [highlight = (3-1) (3-3)] {} ; -% \end{tikzpicture} +% \[\begin{pNiceArray}{ccc}[last-col,create-medium-nodes] +% \CodeBefore [create-cell-nodes] +% \begin{tikzpicture} ~emphase#[name suffix = -medium]@ +% \node [highlight = (1-1) (1-3)] {} ; +% \node [highlight = (2-1) (2-3)] {} ; +% \node [highlight = (3-1) (3-3)] {} ; +% \end{tikzpicture} +% \Body +% a & a + b & a + b + c & L_1 \\ +% a & a & a + b & L_2 \\ +% a & a & a & L_3 +% \end{pNiceArray}\] % \end{Verbatim} % -% \medskip -% We obtain the following matrix. -% -% \[\begin{pNiceArray}{ccc}[ -% last-col, -% create-medium-nodes, -% code-after = {\begin{tikzpicture}[highlight/.style = {fill = red!15, -% blend mode = multiply, -% inner sep = 0pt, -% fit = #1}, -% name suffix = -medium] -% \node [highlight = (1-1) (1-3)] {} ; -% \node [highlight = (2-1) (2-3)] {} ; -% \node [highlight = (3-1) (3-3)] {} ; -% \end{tikzpicture}}] +% +%\[\begin{pNiceArray}{ccc}[last-col,create-medium-nodes] +% \CodeBefore [create-cell-nodes] +% \begin{tikzpicture} [name suffix = -medium] +% \node [highlight = (1-1) (1-3)] {} ; +% \node [highlight = (2-1) (2-3)] {} ; +% \node [highlight = (3-1) (3-3)] {} ; +% \end{tikzpicture} +% \Body % a & a + b & a + b + c & L_1 \\ % a & a & a + b & L_2 \\ % a & a & a & L_3 @@ -4858,10 +4809,8 @@ version 2005/12/01 or later. % matrices. % % The whole figure is an environment |{NiceArray}| and the three pairs of -% parenthesis have been added with |\SubMatrix| in the |code-before|. +% parenthesis have been added with |\SubMatrix| in the |\CodeBefore|. % -% You will find the LaTeX code of that figure in the source file of this -% document. % \tikzset{highlight/.style={rectangle, % fill=red!15, % rounded corners = 0.5 mm, @@ -4893,6 +4842,44 @@ version 2005/12/01 or later. % \tikz \draw [gray,shorten > = 1mm, shorten < = 1mm] (9-4.north) to [bend left] (4-9.west) ; % \end{NiceArray}\] % +% +% \vspace{1cm} +% \begin{Verbatim} +% \tikzset{highlight/.style={rectangle, +% fill=red!15, +% rounded corners = 0.5 mm, +% inner sep=1pt, +% fit=~#1}} +% \end{Verbatim} +% +% \begin{Verbatim}[formatcom = \small\color{gray}] +% \[\begin{NiceArray}{*{6}{c}~LetterAt{\hspace{6mm}}*{5}{c}}[nullify-dots] +% \CodeBefore [create-cell-nodes] +% \SubMatrix({2-7}{6-11}) +% \SubMatrix({7-2}{11-6}) +% \SubMatrix({7-7}{11-11}) +% \begin{tikzpicture} +% \node [highlight = (9-2) (9-6)] { } ; +% \node [highlight = (2-9) (6-9)] { } ; +% \end{tikzpicture} +% \Body +% & & & & & & & & \color{blue}\scriptstyle C_j \\ +% & & & & & & b_{11} & \Cdots & b_{1j} & \Cdots & b_{1n} \\ +% & & & & & & \Vdots & & \Vdots & & \Vdots \\ +% & & & & & & & & b_{kj} \\ +% & & & & & & & & \Vdots \\ +% & & & & & & b_{n1} & \Cdots & b_{nj} & \Cdots & b_{nn} \\[3mm] +% & a_{11} & \Cdots & & & a_{1n} \\ +% & \Vdots & & & & \Vdots & & & \Vdots \\ +% \color{blue}\scriptstyle L_i +% & a_{i1} & \Cdots & a_{ik} & \Cdots & a_{in} & \Cdots & & c_{ij} \\ +% & \Vdots & & & & \Vdots \\ +% & a_{n1} & \Cdots & & & a_{nn} \\ +% \CodeAfter +% \tikz \draw [gray,shorten > = 1mm, shorten < = 1mm] (9-4.north) to [bend left] (4-9.west) ; +% \end{NiceArray}\] +% \end{Verbatim} +% % %\section{Implementation} % @@ -5048,10 +5035,38 @@ version 2005/12/01 or later. \cs_if_exist:NT \rvtx@ifformat@geq { \bool_set_true:N \c_@@_revtex_bool } % \end{macrocode} % -% +% \bigskip % \begin{macrocode} \cs_generate_variant:Nn \tl_if_single_token_p:n { V } % \end{macrocode} +% +% \bigskip +% The following regex will be used to modify the preamble of the array when the +% key |colortbl-like| is used. +% \begin{macrocode} +\regex_const:Nn \c_@@_columncolor_regex { \c { columncolor } } +% \end{macrocode} +% +% \bigskip +% If the final user uses \pkg{nicematrix}, PGF/Tikz will write instruction +% |\pgfsyspdfmark| in the |aux| file. If he changes its mind and no longer loads +% \pkg{nicematrix}, an error may occur at the next compilation because of +% remanent instructions |\pgfsyspdfmark| in the |aux| file. With the following +% code, we try to avoid that situation. +% \begin{macrocode} +\cs_new_protected:Npn \@@_provide_pgfsyspdfmark: + { + \iow_now:Nn \@mainaux + { + \ExplSyntaxOn + \cs_if_free:NT \pgfsyspdfmark + { \cs_set_eq:NN \pgfsyspdfmark \@gobblethree } + \ExplSyntaxOff + } + \cs_gset_eq:NN \@@_provide_pgfsyspdfmark: \prg_do_nothing: + } +% \end{macrocode} +% % % \bigskip % We define a command |\iddots| similar to |\ddots| ($\ddots$) but with dots @@ -5342,53 +5357,33 @@ version 2005/12/01 or later. % |\c_@@_table_print_tl| when the version of \pkg{siunitx} is prior to 3.0. The % command |\@@_adapt_S_column| is used in the environment |{NiceArrayWithDelims}|. % \begin{macrocode} -\cs_set_protected:Npn \@@_adapt_S_column: +\AtBeginDocument { - \bool_if:NT \c_@@_siunitx_loaded_bool - { - \group_begin: - \@temptokena = { } - \cs_set_eq:NN \NC@find \prg_do_nothing: - \NC@rewrite@S { } - \tl_gset:NV \g_tmpa_tl \@temptokena - \group_end: - \tl_new:N \c_@@_table_collect_begin_tl - \tl_set:Nx \l_tmpa_tl { \tl_item:Nn \g_tmpa_tl 2 } - \tl_gset:Nx \c_@@_table_collect_begin_tl { \tl_item:Nn \l_tmpa_tl 1 } - \tl_new:N \c_@@_table_print_tl - \tl_gset:Nx \c_@@_table_print_tl { \tl_item:Nn \g_tmpa_tl { -1 } } - \cs_gset_eq:NN \@@_adapt_S_column: \prg_do_nothing: + \cs_set_eq:NN \@@_adapt_S_column: \prg_do_nothing: + \bool_lazy_and:nnT + { \c_@@_siunitx_loaded_bool } + { ! \cs_if_exist_p:N \siunitx_cell_begin:w } + { + \cs_set_protected:Npn \@@_adapt_S_column: + { + \group_begin: + \@temptokena = { } + \cs_set_eq:NN \NC@find \prg_do_nothing: + \NC@rewrite@S { } + \tl_gset:NV \g_tmpa_tl \@temptokena + \group_end: + \tl_new:N \c_@@_table_collect_begin_tl + \tl_set:Nx \l_tmpa_tl { \tl_item:Nn \g_tmpa_tl 2 } + \tl_gset:Nx \c_@@_table_collect_begin_tl { \tl_item:Nn \l_tmpa_tl 1 } + \tl_new:N \c_@@_table_print_tl + \tl_gset:Nx \c_@@_table_print_tl { \tl_item:Nn \g_tmpa_tl { -1 } } + \cs_gset_eq:NN \@@_adapt_S_column: \prg_do_nothing: + } } } % \end{macrocode} % % -% \bigskip -% The following regex will be used to modify the preamble of the array when the -% key |colortbl-like| is used. -% \begin{macrocode} -\regex_const:Nn \c_@@_columncolor_regex { \c { columncolor } } -% \end{macrocode} -% -% \bigskip -% If the final user uses \pkg{nicematrix}, PGF/Tikz will write instruction -% |\pgfsyspdfmark| in the |aux| file. If he changes its mind and no longer loads -% \pkg{nicematrix}, an error may occur at the next compilation because of -% remanent instructions |\pgfsyspdfmark| in the |aux| file. With the following -% code, we try to avoid that situation. -% \begin{macrocode} -\cs_new_protected:Npn \@@_provide_pgfsyspdfmark: - { - \iow_now:Nn \@mainaux - { - \ExplSyntaxOn - \cs_if_free:NT \pgfsyspdfmark - { \cs_set_eq:NN \pgfsyspdfmark \@gobblethree } - \ExplSyntaxOff - } - \cs_gset_eq:NN \@@_provide_pgfsyspdfmark: \prg_do_nothing: - } -% \end{macrocode} % % \bigskip % \subsection*{Parameters} @@ -5550,6 +5545,15 @@ version 2005/12/01 or later. % \end{macrocode} % % \bigskip +% We will write in |\g_@@_aux_tl| all the instructions that we have to write on +% the |aux| file for the current environment. The contain of that token list +% will be written on the |aux| file at the end of the environment (in an +% instruction |\tl_gset:cn { c_@@_ \int_use:N \g_@@_env_int _ tl }|). +% \begin{macrocode} +\tl_new:N \g_@@_aux_tl +% \end{macrocode} +% +% \bigskip % \begin{macrocode} \cs_new_protected:Npn \@@_test_if_math_mode: { @@ -5795,6 +5799,17 @@ version 2005/12/01 or later. % \end{macrocode} % % \medskip +% The sequence |\g_@@_multicolumn_cells_seq| will contain the list of the cells +% of the array where a command |\multicolumn{|$n$|}{...}{...}| with $n>1$ is +% issued. In |\g_@@_multicolumn_sizes_seq|, the ``sizes'' (that is to say the +% values of $n$) correspondant will be stored. These lists will be used for the +% creation of the ``medium nodes'' (if they are created). +% \begin{macrocode} +\seq_new:N \g_@@_multicolumn_cells_seq +\seq_new:N \g_@@_multicolumn_sizes_seq +% \end{macrocode} +% +% \medskip % The following counters will be used when searching the extremities of a dotted % line (we need these counters because of the potential ``open'' lines in the % |\SubMatrix|---the |\SubMatrix| in the |code-before|). @@ -5854,7 +5869,7 @@ version 2005/12/01 or later. % \medskip % The parameters of position of the label of a block. For the horizontal % position, the possible values are |c|, |r| and |l|. For the vertical position, -% the possible values are |c|, |t| and |b|. Of course, it would be intesting to +% the possible values are |c|, |t| and |b|. Of course, it would be interesting to % program a key |T| and a key |B|. % \begin{macrocode} \tl_new:N \l_@@_hpos_of_block_tl @@ -7075,6 +7090,8 @@ version 2005/12/01 or later. \endpgfpicture } % \end{macrocode} +% Remark: If the key |recreate-cell-nodes| of the |\CodeBefore| is used, then we +% will add some lines to that command. % % % \interitem @@ -7244,7 +7261,7 @@ version 2005/12/01 or later. % \medskip % As its name says, the following command is a patch for the command % |\@@_node_for_cell:|. This patch will be appended on the left of -% |\@@_noce_for_the_cell:| when the construction of the cell nodes (of the forme +% |\@@_node_for_the_cell:| when the construction of the cell nodes (of the form % |(i-j)|) in the |\CodeBefore| is required. % \begin{macrocode} \cs_new_protected:Npn \@@_patch_node_for_cell:n #1 @@ -7278,6 +7295,8 @@ version 2005/12/01 or later. } % \end{macrocode} % +% \bigskip +% We have no explanation for the different behaviour between the TeX engines... % \begin{macrocode} \bool_lazy_or:nnTF \sys_if_engine_xetex_p: \sys_if_output_dvi_p: { @@ -7546,12 +7565,6 @@ version 2005/12/01 or later. \bool_if:NT \c_@@_booktabs_loaded_bool { \tl_put_left:Nn \@BTnormal \@@_create_row_node: } \box_clear_new:N \l_@@_cell_box - \cs_if_exist:NT \theiRow - { \int_set_eq:NN \l_@@_old_iRow_int \c@iRow } - \int_gzero_new:N \c@iRow - \cs_if_exist:NT \thejCol - { \int_set_eq:NN \l_@@_old_jCol_int \c@jCol } - \int_gzero_new:N \c@jCol \normalbaselines % \end{macrocode} % If the option |small| is used, we have to do some tuning. In particular, we @@ -7567,6 +7580,17 @@ version 2005/12/01 or later. } % \end{macrocode} % +% \bigskip +% \begin{macrocode} + \bool_if:NT \g_@@_recreate_cell_nodes_bool + { + \tl_put_right:Nn \@@_begin_of_row: + { + \pgfsys@markposition + { \@@_env: - row - \int_use:N \c@iRow - base } + } + } +% \end{macrocode} % % \bigskip % The environment |{array}| uses internally the command |\ialign|. We change the @@ -7662,8 +7686,8 @@ version 2005/12/01 or later. % values of $n$) correspondant will be stored. These lists will be used for the % creation of the ``medium nodes'' (if they are created). % \begin{macrocode} - \seq_gclear_new:N \g_@@_multicolumn_cells_seq - \seq_gclear_new:N \g_@@_multicolumn_sizes_seq + \seq_gclear:N \g_@@_multicolumn_cells_seq + \seq_gclear:N \g_@@_multicolumn_sizes_seq % \end{macrocode} % % @@ -7724,18 +7748,45 @@ version 2005/12/01 or later. % % % \bigskip +% The command |\@@_pre_array:| will be executed after analyse of the keys of the +% environment. % \begin{macrocode} \cs_new_protected:Npn \@@_pre_array: { - \seq_gclear:N \g_@@_submatrix_seq - \bool_if:NT \l_@@_code_before_bool \@@_exec_code_before: % \end{macrocode} % -% A value of $-1$ for the counter |\l_@@_last_row_int| means that the user has -% used the option |last-row| without value, that is to say without specifying -% the number of that last row. In this case, we try to read that value from the -% |aux| file (if it has been written on a previous run). +% \begin{macrocode} + \cs_if_exist:NT \theiRow { \int_set_eq:NN \l_@@_old_iRow_int \c@iRow } + \int_gzero_new:N \c@iRow + \cs_if_exist:NT \thejCol { \int_set_eq:NN \l_@@_old_jCol_int \c@jCol } + \int_gzero_new:N \c@jCol +% \end{macrocode} +% +% \bigskip +% We recall that |\l_@@_last_row_int| and |\l_@@_last_column_int| are \emph{not} +% the numbers of the last row and last column of the array. There are only the +% values of the keys |last-row| and |last-column| (maybe the user has provided +% erroneous values). The meaning of that counters does not change during the +% environment of \pkg{nicematrix}. There is only a slight adjustment: if the +% user have used one of those keys without value, we provide now the right value +% as read on the |aux| file (of course, it's possible only after the first compilation). +% \begin{macrocode} + \int_compare:nNnT \l_@@_last_row_int = { -1 } + { + \bool_set_true:N \l_@@_last_row_without_value_bool + \bool_if:NT \g_@@_aux_found_bool + { \int_set:Nn \l_@@_last_row_int { \seq_item:Nn \c_@@_size_seq 3 } } + } + \int_compare:nNnT \l_@@_last_col_int = { -1 } + { + \bool_if:NT \g_@@_aux_found_bool + { \int_set:Nn \l_@@_last_col_int { \seq_item:Nn \c_@@_size_seq 6 } } + } +% \end{macrocode} % +% \bigskip +% If there is a exterior row, we patch a command used in |\@@_Cell:| in order to +% keep track of some dimensions needed to the construction of that ``last row''. % \begin{macrocode} \int_compare:nNnT \l_@@_last_row_int > { -2 } { @@ -7747,58 +7798,36 @@ version 2005/12/01 or later. { \dim_max:nn \g_@@_dp_last_row_dim { \box_dp:N \l_@@_cell_box } } } } - \int_compare:nNnT \l_@@_last_row_int = { -1 } - { - \bool_set_true:N \l_@@_last_row_without_value_bool % \end{macrocode} -% A value based on the name is more reliable than a value based on the number of -% the environment. +% +% \bigskip % \begin{macrocode} - \str_if_empty:NTF \l_@@_name_str - { - \cs_if_exist:cT { @@_last_row_ \int_use:N \g_@@_env_int } - { - \int_set:Nn \l_@@_last_row_int - { \use:c { @@_last_row_ \int_use:N \g_@@_env_int } } - } - } - { - \cs_if_exist:cT { @@_last_row_ \l_@@_name_str } - { - \int_set:Nn \l_@@_last_row_int - { \use:c { @@_last_row_ \l_@@_name_str } } - } - } - } + \seq_gclear:N \g_@@_submatrix_seq % \end{macrocode} -% -% A value of $-1$ for the counter |\l_@@_last_col_int| means that the user has -% used the option |last-col| without value, that is to say without specifying -% the number of that last column. In this case, we try to read that value from -% the |aux| file (if it has been written on a previous run). +% +% \bigskip +% Now the |\CodeBefore|. +% \begin{macrocode} + \bool_if:NT \l_@@_code_before_bool \@@_exec_code_before: +% \end{macrocode} +% +% \bigskip +% The value of |\g_@@_pos_of_blocks_seq| has been written on the |aux| file and +% loaded before the (potential) execution of the |\CodeBefore|. Now, we clear +% that variable because it will be reconstructed during the creation of the +% array. % \begin{macrocode} - \int_compare:nNnT \l_@@_last_col_int = { -1 } - { - \str_if_empty:NTF \l_@@_name_str - { - \cs_if_exist:cT { @@_last_col_ \int_use:N \g_@@_env_int } - { - \int_set:Nn \l_@@_last_col_int - { \use:c { @@_last_col_ \int_use:N \g_@@_env_int } } - } - } - { - \cs_if_exist:cT { @@_last_col_ \l_@@_name_str } - { - \int_set:Nn \l_@@_last_col_int - { \use:c { @@_last_col_ \l_@@_name_str } } - } - } - } + \seq_gclear:N \g_@@_pos_of_blocks_seq % \end{macrocode} +% Idem for other sequences written on the |aux| file. +% \begin{macrocode} + \seq_gclear_new:N \g_@@_multicolumn_cells_seq + \seq_gclear_new:N \g_@@_multicolumn_sizes_seq +% \end{macrocode} +% % % \interitem -% The code in |\@@_pre_array_ii:| is used only by |{NiceArrayWithDelims}|. +% The code in |\@@_pre_array_ii:| is used only here. % \begin{macrocode} \@@_pre_array_ii: % \end{macrocode} @@ -7896,24 +7925,17 @@ version 2005/12/01 or later. % \end{macrocode} % First, we give values to the LaTeX counters |iRow| and |jCol|. We remind that, % in the |code-before| (and in the |\CodeAfter|) they represent the numbers of -% rows and columns of the array (without the potential last row and last column). +% rows and columns of the array (without the potential last row and last +% column). The value of |\g_@@_row_total_int| is the number of the last row +% (with potentially a last exterior row) and |\g_@@_col_total_int| is the number +% of the last column (with potentially a last exterior column). % \begin{macrocode} - \int_zero_new:N \c@iRow - \int_set:Nn \c@iRow - { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 2 } - \int_zero_new:N \c@jCol - \int_set:Nn \c@jCol - { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 4 } -% \end{macrocode} -% We have to adjust the values of |\c@iRow| and |\c@jCol| to take into account -% the potential last row and last column. A value of $-2$ for -% |\l_@@_last_row_int| means that there is no last row. Idem for the columns. -% \begin{macrocode} - \int_compare:nNnF \l_@@_last_row_int = { -2 } - { \int_decr:N \c@iRow } - \int_compare:nNnF \l_@@_last_col_int = { -2 } - { \int_decr:N \c@jCol } + \int_set:Nn \c@iRow { \seq_item:Nn \c_@@_size_seq 2 } + \int_set:Nn \c@jCol { \seq_item:Nn \c_@@_size_seq 5 } + \int_set_eq:NN \g_@@_row_total_int { \seq_item:Nn \c_@@_size_seq 3 } + \int_set_eq:NN \g_@@_col_total_int { \seq_item:Nn \c_@@_size_seq 6 } % \end{macrocode} +% % % Now, we will create all the |col| nodes and |row| nodes with the informations % written in the |aux| file. You use the technique described in the page~1229 of @@ -7926,9 +7948,7 @@ version 2005/12/01 or later. % \end{macrocode} % First, the recreation of the |row| nodes. % \begin{macrocode} - \int_step_inline:nnn - { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 1 } - { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 2 + 1 } + \int_step_inline:nnn \l_@@_first_row_int { \g_@@_row_total_int + 1 } { \pgfsys@getposition { \@@_env: - row - ##1 } \@@_node_position: \pgfcoordinate { \@@_env: - row - ##1 } @@ -7937,9 +7957,7 @@ version 2005/12/01 or later. % \end{macrocode} % Now, the recreation of the |col| nodes. % \begin{macrocode} - \int_step_inline:nnn - { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 3 } - { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 4 + 1 } + \int_step_inline:nnn \l_@@_first_col_int { \g_@@_col_total_int + 1 } { \pgfsys@getposition { \@@_env: - col - ##1 } \@@_node_position: \pgfcoordinate { \@@_env: - col - ##1 } @@ -7952,8 +7970,9 @@ version 2005/12/01 or later. \@@_create_diag_nodes: % \end{macrocode} % -% \medskip -% Now, the creation of the cell nodes |(i-j)|. +% \medskip +% Now, the creation of the cell nodes |(i-j)|, and, maybe also the ``medium +% nodes'' and the ``large nodes''. % \begin{macrocode} \bool_if:NT \g_@@_recreate_cell_nodes_bool \@@_recreate_cell_nodes: \endpgfpicture @@ -7977,18 +7996,6 @@ version 2005/12/01 or later. \cs_set_eq:NN \columncolor \@@_columncolor \cs_set_eq:NN \chessboardcolors \@@_chessboardcolors \cs_set_eq:NN \SubMatrix \@@_SubMatrix_in_code_before -% \end{macrocode} -% The list of the cells which are in the (empty) corners is stored in the |aux| -% file because we have to know it before the execution of the |\CodeBefore| (the -% commands which color the cells, rows and columns won't color the cells which -% are in the corners). -% \begin{macrocode} - \seq_if_exist:cT - { c_@@_corners_cells_ \int_use:N \g_@@_env_int _ seq } - { - \seq_set_eq:Nc \l_@@_corners_cells_seq - { c_@@_corners_cells_ \int_use:N \g_@@_env_int _ seq } - } } % \end{macrocode} % @@ -8058,7 +8065,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_CodeBefore:w #1 \q_stop { - \seq_if_exist:cT { @@_size_ \int_use:N \g_@@_env_int _ seq } + \bool_if:NT \g_@@_aux_found_bool { \@@_pre_code_before: #1 @@ -8074,17 +8081,16 @@ version 2005/12/01 or later. % nodes and |diag| nodes are available in that |\CodeBefore|. With the key % |create-cell-nodes|, the cell nodes, that is to say the nodes of the form % |(i-j)| (but not the extra nodes) are also available because those nodes also -% are recreated and that recreation is done by the following command. +% are recreated and that recreation is done by the following command. % \begin{macrocode} \cs_new_protected:Npn \@@_recreate_cell_nodes: { - \int_step_inline:nnn - { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 1 } - { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 2 } + \int_step_inline:nnn \l_@@_first_row_int \g_@@_row_total_int { - \int_step_inline:nnn - { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 3 } - { \seq_item:cn { @@_size_ \int_use:N \g_@@_env_int _ seq } 4 } + \pgfsys@getposition { \@@_env: - ##1 - base } \@@_node_position: + \pgfcoordinate { \@@_env: - row - ##1 - base } + { \pgfpointdiff \@@_picture_position: \@@_node_position: } + \int_step_inline:nnn \l_@@_first_col_int \g_@@_col_total_int { \cs_if_exist:cT { pgf @ sys @ pdf @ mark @ pos @ \@@_env: - ##1 - ####1 - NW } @@ -8102,6 +8108,7 @@ version 2005/12/01 or later. } } } + \@@_create_extra_nodes: } % \end{macrocode} % @@ -8116,6 +8123,7 @@ version 2005/12/01 or later. \@@_provide_pgfsyspdfmark: \bool_if:NT \c_@@_footnote_bool \savenotes % \end{macrocode} +% % The aim of the following |\bgroup| (the corresponding |\egroup| is, of course, % at the end of the environment) is to be able to put an exposant to a matrix in % a mathematical formula. @@ -8198,14 +8206,31 @@ version 2005/12/01 or later. % \begin{macrocode} \seq_gclear:N \g_@@_pos_of_stroken_blocks_seq \seq_gclear:N \g_@@_pos_of_xdots_seq + \tl_gclear_new:N \g_@@_code_before_tl +% \end{macrocode} +% +% \bigskip +% We load all the informations written in the |aux| file during previous +% compilations corresponding to the current environment. +% \begin{macrocode} + \bool_gset_false:N \g_@@_aux_found_bool + \tl_if_exist:cT { c_@@ _ \int_use:N \g_@@_env_int _ tl } + { + \bool_gset_true:N \g_@@_aux_found_bool + \use:c { c_@@ _ \int_use:N \g_@@_env_int _ tl } + } +% \end{macrocode} +% Now, we prepare the token list for the instructions that we will have to write +% on the |aux| file at the end of the environment. +% \begin{macrocode} + \tl_gclear:N \g_@@_aux_tl % \end{macrocode} % % \begin{macrocode} - \tl_if_exist:cT { g_@@_code_before_ \int_use:N \g_@@_env_int _ tl } + \tl_if_empty:NF \g_@@_code_before_tl { \bool_set_true:N \l_@@_code_before_bool - \exp_args:NNv \tl_put_right:Nn \l_@@_code_before_tl - { g_@@_code_before_ \int_use:N \g_@@_env_int _ tl } + \tl_put_right:NV \l_@@_code_before_tl \g_@@_code_before_tl } % \end{macrocode} % @@ -8431,6 +8456,23 @@ version 2005/12/01 or later. % a mathematical formula. % \begin{macrocode} \egroup +% \end{macrocode} +% +% \bigskip +% We want to write on the |aux| file all the informations corresponding to the +% current environment. +% \begin{macrocode} + \iow_now:Nn \@mainaux { \ExplSyntaxOn } + \iow_now:Nx \@mainaux + { + \tl_gset:cn { c_@@_ \int_use:N \g_@@_env_int _ tl } + \iow_newline: { \iow_newline: \exp_not:V \g_@@_aux_tl } + } + \iow_now:Nn \@mainaux { \ExplSyntaxOff } +% \end{macrocode} +% +% \bigskip +% \begin{macrocode} \bool_if:NT \c_@@_footnote_bool \endsavenotes } % \end{macrocode} @@ -8490,7 +8532,7 @@ version 2005/12/01 or later. \@tempswatrue % \end{macrocode} % The following line actually does the expansion (it's has been copied from -% |array.sty|). +% |array.sty|). The expanded version is still in |\@temptokena|. % \begin{macrocode} \@whilesw \if@tempswa \fi { \@tempswafalse \the \NC@list } % \end{macrocode} @@ -8505,7 +8547,7 @@ version 2005/12/01 or later. % |\@@_patch_preamble:n|. In the same time, we will count the columns with the % counter |\c@jCol|. % \begin{macrocode} - \int_gzero_new:N \c@jCol + \int_gzero:N \c@jCol \tl_gclear:N \g_@@_preamble_tl \tl_if_eq:NnTF \l_@@_vlines_clist { all } { @@ -9892,102 +9934,58 @@ version 2005/12/01 or later. % % If we are in an environment without preamble (like |{NiceMatrix}| or % |{pNiceMatrix}|) and if the option |last-col| has been used without value -% we fix the real value of |\l_@@_last_col_int|. +% we also fix the real value of |\l_@@_last_col_int|. % \begin{macrocode} \bool_if:NT \l_@@_last_col_without_value_bool - { - \dim_set_eq:NN \l_@@_last_col_int \g_@@_col_total_int - \iow_shipout:Nn \@mainaux \ExplSyntaxOn - \iow_shipout:Nx \@mainaux - { - \cs_gset:cpn { @@_last_col_ \int_use:N \g_@@_env_int } - { \int_use:N \g_@@_col_total_int } - } - \str_if_empty:NF \l_@@_name_str - { - \iow_shipout:Nx \@mainaux - { - \cs_gset:cpn { @@_last_col_ \l_@@_name_str } - { \int_use:N \g_@@_col_total_int } - } - } - \iow_shipout:Nn \@mainaux \ExplSyntaxOff - } + { \int_set_eq:NN \l_@@_last_col_int \g_@@_col_total_int } % \end{macrocode} % -% It's also time to give to |\l_@@_last_row_int| its real value. But, if the -% user had used the option |last-row| without value, we write in the |aux| file -% the number of that last row for the next run. +% \medskip +% It's also time to give to |\l_@@_last_row_int| its real value. % \begin{macrocode} \bool_if:NT \l_@@_last_row_without_value_bool - { - \dim_set_eq:NN \l_@@_last_row_int \g_@@_row_total_int -% \end{macrocode} -% If the option |light-syntax| is used, we have nothing to write since, in this -% case, the number of rows is directly determined. -% \begin{macrocode} - \bool_if:NF \l_@@_light_syntax_bool - { - \iow_shipout:Nn \@mainaux \ExplSyntaxOn - \iow_shipout:Nx \@mainaux - { - \cs_gset:cpn { @@_last_row_ \int_use:N \g_@@_env_int } - { \int_use:N \g_@@_row_total_int } - } + { \int_set_eq:NN \l_@@_last_row_int \g_@@_row_total_int } % \end{macrocode} -% If the environment has a name, we also write a value based on the name -% because it's more reliable than a value based on the number of the -% environment. +% +% \medskip % \begin{macrocode} - \str_if_empty:NF \l_@@_name_str - { - \iow_shipout:Nx \@mainaux - { - \cs_gset:cpn { @@_last_row_ \l_@@_name_str } - { \int_use:N \g_@@_row_total_int } - } - } - \iow_shipout:Nn \@mainaux \ExplSyntaxOff + \tl_gput_right:Nx \g_@@_aux_tl + { + \seq_gset_from_clist:Nn \exp_not:N \c_@@_size_seq + { + \int_use:N \l_@@_first_row_int , + \int_use:N \c@iRow , + \int_use:N \g_@@_row_total_int , + \int_use:N \l_@@_first_col_int , + \int_use:N \c@jCol , + \int_use:N \g_@@_col_total_int } + \iow_newline: } % \end{macrocode} -% -% If the key |code-before| is used, we have to write on the |aux| file the actual -% size of the array and other informations. -% \begin{macrocode} - \bool_if:NT \l_@@_code_before_bool - { - \iow_now:Nn \@mainaux \ExplSyntaxOn - \iow_now:Nx \@mainaux - { \seq_clear_new:c { @@_size _ \int_use:N \g_@@_env_int _ seq } } - \iow_now:Nx \@mainaux - { - \seq_gset_from_clist:cn { @@_size _ \int_use:N \g_@@_env_int _ seq } - { - \int_use:N \l_@@_first_row_int , - \int_use:N \g_@@_row_total_int , - \int_use:N \l_@@_first_col_int , -% \end{macrocode} -% If the user has used a key |last-row| in an environment with preamble (like -% |{pNiceArray}|) and that that last row has not been found, we have to -% increment the value because it will be decreased when used in the |code-before|. -% \begin{macrocode} - \bool_lazy_and:nnTF - { \int_compare_p:nNn \l_@@_last_col_int > { -2 } } - { \bool_not_p:n \g_@@_last_col_found_bool } - \@@_succ:n - \int_use:N - \g_@@_col_total_int - } -% \end{macrocode} % We write also the potential content of |\g_@@_pos_of_blocks_seq| (it will be % useful if the command |\rowcolors| is used with the key |respect-blocks|). % \begin{macrocode} - \seq_gset_from_clist:cn - { c_@@_pos_of_blocks_ \int_use:N \g_@@_env_int _ seq } + \seq_if_empty:NF \g_@@_pos_of_blocks_seq + { + \tl_gput_right:Nx \g_@@_aux_tl + { + \seq_gset_from_clist:Nn \exp_not:N \g_@@_pos_of_blocks_seq { \seq_use:Nnnn \g_@@_pos_of_blocks_seq , , , } + \iow_newline: + } + } + \seq_if_empty:NF \g_@@_multicolumn_cells_seq + { + \tl_gput_right:Nx \g_@@_aux_tl + { + \seq_gset_from_clist:Nn \exp_not:N \g_@@_multicolumn_cells_seq + { \seq_use:Nnnn \g_@@_multicolumn_cells_seq , , , } + \iow_newline: + \seq_gset_from_clist:Nn \exp_not:N \g_@@_multicolumn_sizes_seq + { \seq_use:Nnnn \g_@@_multicolumn_sizes_seq , , , } + \iow_newline: } - \iow_now:Nn \@mainaux \ExplSyntaxOff } % \end{macrocode} % @@ -10166,14 +10164,12 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_set_protected:Npn \rectanglecolor { } \cs_set_protected:Npn \columncolor { } - \iow_now:Nn \@mainaux \ExplSyntaxOn - \iow_now:Nx \@mainaux + \tl_gput_right:Nx \g_@@_aux_tl { - \tl_gset:cn - { g_@@_code_before_ \int_use:N \g_@@_env_int _ tl } + \tl_gset:Nn \exp_not:N \g_@@_code_before_tl { \exp_not:V \g_nicematrix_code_before_tl } + \iow_newline: } - \iow_now:Nn \@mainaux \ExplSyntaxOff \bool_set_true:N \l_@@_code_before_bool } % \end{macrocode} @@ -12400,19 +12396,14 @@ version 2005/12/01 or later. % color or of the second color. % \begin{macrocode} \bool_set_true:N \l_tmpa_bool - \bool_lazy_and:nnT - \l_@@_respect_blocks_bool - { - \cs_if_exist_p:c - { c_@@_pos_of_blocks_ \int_use:N \g_@@_env_int _ seq } } + \bool_if:NT \l_@@_respect_blocks_bool { % \end{macrocode} % We don't want to take into account a block which is completely in the ``first % column'' of (number $0$) or in the ``last column'' and that's why we filter % the sequence of the blocks (in a the sequence |\l_tmpa_seq|). % \begin{macrocode} - \seq_set_eq:Nc \l_tmpb_seq - { c_@@_pos_of_blocks_ \int_use:N \g_@@_env_int _ seq } + \seq_set_eq:NN \l_tmpb_seq \g_@@_pos_of_blocks_seq \seq_set_filter:NNn \l_tmpa_seq \l_tmpb_seq { \@@_not_in_exterior_p:nnnn ##1 } } @@ -12443,12 +12434,7 @@ version 2005/12/01 or later. % If the key |respect-blocks| is in force, we have to adjust that value (of % course). % \begin{macrocode} - \bool_lazy_and:nnT - \l_@@_respect_blocks_bool - { - \cs_if_exist_p:c - { c_@@_pos_of_blocks_ \int_use:N \g_@@_env_int _ seq } - } + \bool_if:NT \l_@@_respect_blocks_bool { \seq_set_filter:NNn \l_tmpb_seq \l_tmpa_seq { \@@_intersect_our_row_p:nnnn ####1 } @@ -13299,14 +13285,12 @@ version 2005/12/01 or later. % commands which color the |rows|, |columns| and |cells| must not color the % cells in the corners. % \begin{macrocode} - \iow_now:Nn \@mainaux \ExplSyntaxOn - \iow_now:Nx \@mainaux + \tl_gput_right:Nx \g_@@_aux_tl { - \seq_gset_from_clist:cn - { c_@@_corners_cells_ \int_use:N \g_@@_env_int _ seq } + \seq_set_from_clist:Nn \exp_not:N \l_@@_corners_cells_seq { \seq_use:Nnnn \l_@@_corners_cells_seq , , , } + \iow_newline: } - \iow_now:Nn \@mainaux \ExplSyntaxOff } } % \end{macrocode} @@ -17481,6 +17465,12 @@ version 2005/12/01 or later. % The version 5.15b is compatible with the version 3.0+ of \pkg{siunitx} % (previous versions were not). % +% % \subsection*{Changes between versions 5.15 and 5.16} +% +% It's now possible to use the cells corresponding to the contents of the nodes +% (of the form |i-j|) in the |\CodeBefore| when the key |create-cell-nodes| of +% that |\CodeBefore| is used. The medium and the large nodes are also available +% if the corresponding keys are used. % % \PrintIndex % diff --git a/macros/latex/contrib/nicematrix/nicematrix.pdf b/macros/latex/contrib/nicematrix/nicematrix.pdf Binary files differindex b096ea1e0f..40b867d72e 100644 --- a/macros/latex/contrib/nicematrix/nicematrix.pdf +++ b/macros/latex/contrib/nicematrix/nicematrix.pdf diff --git a/macros/xetex/latex/xecjk/README.md b/macros/xetex/latex/xecjk/README.md index 0b9712861b..4d014cc1a9 100644 --- a/macros/xetex/latex/xecjk/README.md +++ b/macros/xetex/latex/xecjk/README.md @@ -20,8 +20,8 @@ Copyright and Licence --------------------- Copyright (C) 2007--2010 by Wenchang Sun <sunwch@nankai.edu.cn> - Copyright (C) 2009--2020 by Leo Liu <leoliu.pku@gmail.com> - Copyright (C) 2012--2020 by Qing Lee <sobenlee@gmail.com> + Copyright (C) 2009--2021 by Leo Liu <leoliu.pku@gmail.com> + Copyright (C) 2012--2021 by Qing Lee <sobenlee@gmail.com> ---------------------------------------------------------------------- This work may be distributed and/or modified under the diff --git a/macros/xetex/latex/xecjk/xeCJK.dtx b/macros/xetex/latex/xecjk/xeCJK.dtx index 1e1398c406..d22b6aa7d0 100644 --- a/macros/xetex/latex/xecjk/xeCJK.dtx +++ b/macros/xetex/latex/xecjk/xeCJK.dtx @@ -26,8 +26,8 @@ Copyright and Licence --------------------- Copyright (C) 2007--2010 by Wenchang Sun <sunwch@nankai.edu.cn> - Copyright (C) 2009--2020 by Leo Liu <leoliu.pku@gmail.com> - Copyright (C) 2012--2020 by Qing Lee <sobenlee@gmail.com> + Copyright (C) 2009--2021 by Leo Liu <leoliu.pku@gmail.com> + Copyright (C) 2012--2021 by Qing Lee <sobenlee@gmail.com> ---------------------------------------------------------------------- This work may be distributed and/or modified under the @@ -92,8 +92,8 @@ Copyright and Licence \preamble Copyright (C) 2007--2010 by Wenchang Sun <sunwch@nankai.edu.cn> - Copyright (C) 2009--2020 by Leo Liu <leoliu.pku@gmail.com> - Copyright (C) 2012--2020 by Qing Lee <sobenlee@gmail.com> + Copyright (C) 2009--2021 by Leo Liu <leoliu.pku@gmail.com> + Copyright (C) 2012--2021 by Qing Lee <sobenlee@gmail.com> ---------------------------------------------------------------------- This work may be distributed and/or modified under the @@ -194,7 +194,7 @@ Copyright and Licence %<*package|config|fntef|listings|xunicode|xunextra> %<!(config|xunextra)>\NeedsTeXFormat{LaTeX2e} %<!(config|xunextra)>\RequirePackage{expl3} -%<+!driver>\GetIdInfo$Id: xeCJK.dtx f475abb 2020-10-19 20:24:03 +0800 Qing Lee <sobenlee@gmail.com> $ +%<+!driver>\GetIdInfo$Id: xeCJK.dtx 71a7646 2021-06-20 17:05:49 +0800 Qing Lee <sobenlee@gmail.com> $ %<package> {Typesetting CJK scripts with XeLaTeX} %<config> {Configuration file for xeCJK package} %<fntef> {xeCJK font effect} @@ -207,7 +207,7 @@ Copyright and Licence %<listings>\ProvidesExplPackage{xeCJK-listings} %<xunicode>\ProvidesExplPackage{xunicode-addon} %<xunextra>\ProvidesExplFile{xunicode-extra.def} -%<!driver> {\ExplFileDate}{3.8.6}{\ExplFileDescription} +%<!driver> {\ExplFileDate}{3.8.7}{\ExplFileDescription} %</package|config|fntef|listings|xunicode|xunextra> %<*driver> \documentclass{ctxdoc} @@ -287,7 +287,7 @@ Copyright and Licence % \changes{v3.8.0}{2020/02/09}{清理过时的兼容性补丁代码。} % \changes{v3.8.3}{2020/04/07}{删除 \texttt{\_nopar}。} % -% \CheckSum{10926} +% \CheckSum{10934} % \GetFileId{xeCJK.sty} % % \title{\bfseries\pkg{xeCJK} 宏包} @@ -1620,6 +1620,11 @@ Copyright and Licence { \msg_critical:nnn { xeCJK } { l3-too-old } { expl3 } } % \end{macrocode} % +% \cs{ctex_disable_package:n} 由 \pkg{ctexhook} 提供。 +% \begin{macrocode} +\RequirePackage { ctexhook } +% \end{macrocode} +% % \begin{macro}[pTF,int]{\xeCJK_if_package_loaded:n} % 判断宏包是否被引入,可用于文档正文中。 % \begin{macrocode} @@ -1632,13 +1637,11 @@ Copyright and Licence % \end{macrocode} % \end{macro} % +% \changes{v3.8.7}{2021/06/09}{应用 \tn{disable@package@load} 和 +% \tn{declare@file@substitution}。} +% % 下面这些 \pkg{CJK} 系列宏包不应该被使用。 % \begin{macrocode} -\msg_new:nnn { xeCJK } { incompatible-package } - { - The~`#1'~package~and~xeCJK~are~incompatible.\\\\ - Please~do~not~use~it. - } \msg_new:nnn { xeCJK } { after-package } { The~`#1'~package~and~xeCJK~are~incompatible.\\\\ @@ -1650,12 +1653,17 @@ Copyright and Licence { \msg_error:nnn { xeCJK } { after-package } {#1} } } \clist_map_inline:nn - { CJKfntef , CJKulem , CJKvert , CJKpunct , CJKutf8 , CJK } - { - \xeCJK_if_package_loaded:nTF {#1} - { \msg_error:nnn { xeCJK } { incompatible-package } {#1} } - { \tl_const:cn { ver@ #1 . \c_@@_package_ext_tl } { 9999/99/99 } } - } + { CJKulem , CJKvert , CJKpunct , CJKutf8 , CJK } + { \ctex_disable_package:n {#1} } +% \end{macrocode} +% +% \changes{v3.8.7}{2021/06/09}{将 \pkg{CJKfntef} 包替换为 \pkg{xeCJKfntef} 包。} +% +% 将 \pkg{CJKfntef} 包替换为 \pkg{xeCJKfntef} 包。 +% \begin{macrocode} +\ctex_if_format_at_least:nTF { 2020/10/01 } + { \ctex_replace_package:nn { CJKfntef } { xeCJKfntef } } + { \ctex_disable_package:n { CJKfntef } } % \end{macrocode} % % \begin{macrocode} @@ -1708,7 +1716,6 @@ Copyright and Licence % \@@_after_end_preamble:n,\@@_package_hook:nn} % 在 \tn{document} 前后和宏包后加上各种钩子,依赖 \pkg{ctexhook}。 % \begin{macrocode} -\RequirePackage { ctexhook } \AtBeginDocument { \xeCJK@document@hook } \ctex_at_end_preamble:n { \xeCJK@document@left@hook } \ctex_after_end_preamble:n { \xeCJK@document@right@hook } @@ -9006,18 +9013,19 @@ Copyright and Licence % % % \changes{v3.3.3}{2015/12/12}{解决与 \pkg{microtype} 宏包的兼容问题。} -% 由于 \pkg{xeCJK} 假装 \pkg{CJK} 已经被引入了,这会导致 \pkg{everysel} 和 -% \pkg{microtype} 等宏包判断错误。需要在它们判断之前取消定义。 +% 由于 \pkg{xeCJK} 假装 \pkg{CJK} 已经被引入了,这会可能导致旧版本的 \pkg{everysel} 包判断错误。 +% 需要在它们判断之前取消定义。 % \begin{macrocode} -\clist_map_inline:nn { everysel , microtype } +\@@_package_hook:nn { everysel } { - \@@_package_hook:nn {#1} + \cs_if_exist:NF \@EverySelectfont@Legacy { \cs_undefine:c { ver@CJK . \c_@@_package_ext_tl } } } % \end{macrocode} % % \changes{v3.2.4}{2013/06/25}{不再使用 \texttt{CJKnumber} 选项,可以在 % \pkg{xeCJK} 之后直接使用 \pkg{CJKnumb} 宏包得到中文数字。} +% \changes{v3.8.7}{2021/06/04}{更好地兼容 \pkg{CJKnumb}。} % % \begin{macro}[int]{\CJKaddEncHook} % 为使用 \pkg{CJKnumb} 宏包而作一些处理。另外 \pkg{CJKnumb} 使用的是传统汉字“萬” @@ -9025,25 +9033,33 @@ Copyright and Licence % \changes{v3.2.10}{2014/03/01}{使用 \pkg{CJKnumb} 时,让 \tn{Unicode} 有定义。} % \changes{v3.3.1}{2015/05/08}{应用 \texttt{0.99992} 版的新原语 \tn{Ucharcat}。} % \begin{macrocode} -\cs_new_protected:Npn \CJKaddEncHook #1#2 +\ctex_at_begin_package:nn { CJKnumb } { - \str_if_eq:nnT {#1} { \CJK@UnicodeEnc } + \tl_new:N \l_@@_CJK_version_tl + \tl_set_eq:Nc \l_@@_CJK_version_tl { ver@CJK . \c_@@_package_ext_tl } + \tl_set:cn { ver@CJK . \c_@@_package_ext_tl } { 9999/99/99 } + \cs_new_protected:Npn \CJKaddEncHook #1#2 { - \group_begin: - \cs_set_eq:NN \Unicode \xeCJK_unicode_char:nn - \cs_set_eq:NN \def \xdef - #2 - \group_end: - \str_gset:Nn \CJK@tenthousand { ^^^^4e07 } - \str_gset:Nn \CJK@hundredmillion { ^^^^4ebf } - \tl_if_exist:NF \CJK@UnicodeEnc - { \tl_const:Nn \CJK@UnicodeEnc { UTF8 } } - \cs_if_exist:NF \Unicode - { \cs_new_eq:NN \Unicode \xeCJK_unicode_char:nn } + \str_if_eq:nnT {#1} { \CJK@UnicodeEnc } + { + \group_begin: + \cs_set_eq:NN \Unicode \xeCJK_unicode_char:nn + \cs_set_eq:NN \def \xdef + #2 + \group_end: + \str_gset:Nn \CJK@tenthousand { ^^^^4e07 } + \str_gset:Nn \CJK@hundredmillion { ^^^^4ebf } + \tl_if_exist:NF \CJK@UnicodeEnc + { \tl_const:Nn \CJK@UnicodeEnc { UTF8 } } + \cs_if_exist:NF \Unicode + { \cs_new_eq:NN \Unicode \xeCJK_unicode_char:nn } + } } + \cs_new:Npn \xeCJK_unicode_char:nn #1#2 + { \tex_Uchar:D \tex_numexpr:D (#1) * 256 + (#2) \scan_stop: } } -\cs_new:Npn \xeCJK_unicode_char:nn #1#2 - { \tex_Uchar:D \tex_numexpr:D (#1) * 256 + (#2) \scan_stop: } +\ctex_at_end_package:nn { CJKnumb } + { \tl_set_eq:cN { ver@CJK . \c_@@_package_ext_tl } \l_@@_CJK_version_tl } % \end{macrocode} % \end{macro} % @@ -14050,7 +14066,7 @@ int main() \usepackage[margin=2cm]{geometry} \usepackage{fontspec} \usepackage{xunicode-addon} -\usepackage{longtable,tabu,booktabs} +\usepackage{array,longtable,booktabs} \usepackage{zref-base} \setmainfont{FreeSerif} @@ -14196,14 +14212,17 @@ int main() \section{#2~(\zref@extractdefault{#1}{default}{0})} \zref@refused{#1} \noindent - \begin{longtabu} to \linewidth {>{\ttfamily\footnotesize}rc>{\ttfamily\footnotesize}X>{\tiny}X} - \toprule\rowfont{\normalfont\normalsize} - \multicolumn1c{USV} & Symbol & Macro(s) & Description \\ + \begin{longtable}[c]{>{\ttfamily\footnotesize}rc>{\ttfamily\footnotesize}p{55mm}>{\tiny}l} + \toprule + \multicolumn1c{\normalfont\normalsize USV} & + \normalfont\normalsize Symbol & + \normalfont\normalsize Macro(s) & + \normalfont\normalsize Description \\ \midrule \endhead \bottomrule \endfoot \int_gzero:N \g_@@_symbol_int \input{#3} - \end{longtabu} + \end{longtable} \group_begin: \zref@setcurrent{default}{\int_use:N\g_@@_symbol_int} \zref@wrapper@immediate{\zref@labelbyprops{#1}{default}} diff --git a/macros/xetex/latex/xecjk/xeCJK.pdf b/macros/xetex/latex/xecjk/xeCJK.pdf Binary files differindex 3fa0591aa8..e6643597c3 100644 --- a/macros/xetex/latex/xecjk/xeCJK.pdf +++ b/macros/xetex/latex/xecjk/xeCJK.pdf diff --git a/macros/xetex/latex/xecjk/xunicode-symbols.pdf b/macros/xetex/latex/xecjk/xunicode-symbols.pdf Binary files differindex 937e245b87..e461a9c3e5 100644 --- a/macros/xetex/latex/xecjk/xunicode-symbols.pdf +++ b/macros/xetex/latex/xecjk/xunicode-symbols.pdf |