texlive[68047] Master/texmf-dist: witharrows (24aug23)

commits+karl at tug.org commits+karl at tug.org
Thu Aug 24 22:18:25 CEST 2023


Revision: 68047
          http://tug.org/svn/texlive?view=revision&revision=68047
Author:   karl
Date:     2023-08-24 22:18:25 +0200 (Thu, 24 Aug 2023)
Log Message:
-----------
witharrows (24aug23)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/generic/witharrows/witharrows-french.pdf
    trunk/Master/texmf-dist/doc/generic/witharrows/witharrows-french.tex
    trunk/Master/texmf-dist/doc/generic/witharrows/witharrows.pdf
    trunk/Master/texmf-dist/doc/generic/witharrows/witharrows.tex
    trunk/Master/texmf-dist/source/generic/witharrows/witharrows.dtx
    trunk/Master/texmf-dist/tex/generic/witharrows/witharrows.sty

Modified: trunk/Master/texmf-dist/doc/generic/witharrows/witharrows-french.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/generic/witharrows/witharrows-french.tex
===================================================================
--- trunk/Master/texmf-dist/doc/generic/witharrows/witharrows-french.tex	2023-08-24 20:18:16 UTC (rev 68046)
+++ trunk/Master/texmf-dist/doc/generic/witharrows/witharrows-french.tex	2023-08-24 20:18:25 UTC (rev 68047)
@@ -99,7 +99,7 @@
 
 \medskip
 Les flèches sont tracées avec Tikz et donc \textbf{plusieurs compilations peuvent être nécessaires}.\footnote{Si
-  vous utilisez Overleaf, Overleaf effectue automatiquement le nombre de compilations nécessaire.}
+  vous utilisez Overleaf, Overleaf effectue automatiquement un nombre de compilations suffisant (en utilisant |latexmk|).}
 
 \bigskip
 Cette extension fournit un environnement |{WithArrows}| pour construire des alignements d'équations
@@ -1924,16 +1924,33 @@
 L'extension \pkg{witharrows} fournit une commande |\WithArrowsNewStyle| pour définir
 des styles d'une manière similaire aux «styles» de Tikz.
 
+\smallskip
 La commande |\WithArrowsNewStyle| prend deux arguments obligatoires. Le premier est 
 le nom du style et le second est une liste de couples clé-valeur. La portée
-de la definition ainsi faite par |\WithArrowsNewStyle| est le groupe TeX courant.
-
+de la definition ainsi faite par |\WithArrowsNewStyle| est le groupe TeX courant.\footnote{On rappelle que, en
+  particulier, tout environnement LaTeX est un groupe TeX.}
+\smallskip
 Le style peut être utilisé comme une clé au niveau du document (avec |\WithArrowsOptions|), au niveau d'un
 environnement (via les arguments optionnels) ou bien encore dans une autre commande |\WithArrowsNewStyle|.
 
+\smallskip
 Pour un exemple d'utilisation, voir p.~\pageref{example-WithArrowsRightX}.
 
+
 \bigskip
+Il n'existe pas de style pour les flèches individuelles. Néanmoins, il reste possible de définir de nouvelles
+commandes s'appuyant sur la commande |\Arrow|. Par exemple :
+
+\begin{Verbatim}
+\newcommand{\ThickArrow}{\Arrow[tikz=thick]}
+\end{Verbatim}
+
+Cette nouvelle commande |\ThickArrow| garde la possibilité\footnote{Dans la version de \pkg{witharrows} pour LaTeX
+  mais pas dans la version pour plain-TeX.} d'accepter des clés entre crochets. On peut écrire
+|\ThickArrow[jump=2]| car en fait, |\Arrow[tikz=thick][jump=2]| est une syntaxe autorisée pour la commande |\Arrow|
+(on peut mettre un nombre arbitraire d'arguments optionnels entre crochets après la commande |\Arrow|). 
+
+\bigskip
 \subsection{La clé right-overlap}
 
 \colorbox{yellow!50}{\textbf{Nouveau 2.8}}

Modified: trunk/Master/texmf-dist/doc/generic/witharrows/witharrows.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/generic/witharrows/witharrows.tex
===================================================================
--- trunk/Master/texmf-dist/doc/generic/witharrows/witharrows.tex	2023-08-24 20:18:16 UTC (rev 68046)
+++ trunk/Master/texmf-dist/doc/generic/witharrows/witharrows.tex	2023-08-24 20:18:25 UTC (rev 68047)
@@ -18,11 +18,12 @@
 %% and version 1.3 or later is part of all distributions of
 %% LaTeX version 2005/12/01 or later.
 %% 
-\def\myfileversion{2.8a}
-\def\myfiledate{2023/02/14}
+\def\myfileversion{2.8b}
+\def\myfiledate{2023/08/24}
 \input tikz.tex
 \input expl3-generic.tex
-\usetikzlibrary{arrows.meta,bending}
+\usetikzlibrary{arrows.meta}
+\usepgfmodule{bending} % https://texnique.fr/osqa/questions/12199
 \ExplSyntaxOn
 \catcode `\@ = 11
 \cs_new_protected:Npn \__witharrows_msg_new:nn { \msg_new:nnn { witharrows } }
@@ -47,31 +48,14 @@
     || \str_if_eq_p:Vn \c_sys_jobname_str { output }   % for Overleaf
   }
 \cs_generate_variant:Nn \seq_set_split:Nnn { N x x }
-\AtBeginDocument
-  {
-    \clist_map_inline:nn
-      {
-        amsmath, amsthm, autonum, cleveref, hyperref, mathtools, showlabels,
-        typedref, unicode-math
-      }
-      {
-        \bool_new:c { c__witharrows_#1_loaded_bool }
-        \bool_set_false:c { c__witharrows_#1_loaded_bool }
-      }
-  }
 \cs_new_protected:Npn \__witharrows_sort_seq:N #1
   {
     \seq_sort:Nn #1
       {
-        \int_compare:nNnTF
-          {
-            \tex_strcmp:D
-              { \str_lower_case:n { ##1 } }
-              { \str_lower_case:n { ##2 } }
-          }
-          > 0
+        \str_compare:eNeTF
+          { \str_lowercase:n { ##1 } } < { \str_lowercase:n { ##2 } }
+          \sort_return_same:
           \sort_return_swapped:
-          \sort_return_same:
       }
   }
 \cs_new_protected:Npn \__witharrows_set_seq_of_str_from_clist:Nn #1 #2
@@ -122,8 +106,21 @@
         remember~picture ,
         overlay ,
         name~prefix = wa - \l__witharrows_prefix_str -
+      } ,
+    __witharrows_standard_arrow / .style =
+      {
+        __witharrows_standard ,
+        every~path / .style = WithArrows / arrow
       }
   }
+\sys_if_engine_xetex:T
+  {
+    \tikzset
+      {
+        __witharrows_standard_arrow / .append~style =
+          { every~node / .append~style = { text = . } }
+      }
+  }
 \tikzset
   {
     WithArrows / arrow / tips / .style =
@@ -290,8 +287,8 @@
     right-overlap .bool_set:N       = \l__witharrows_right_overlap_bool ,
     right-overlap .value_required:n = true
   }
-\clist_new:N \c__witharrows_extensible_delimiters_clist
-\clist_set:Nn \c__witharrows_extensible_delimiters_clist
+\clist_new:N \c__witharrows_ext_delimiters_clist
+\clist_set:Nn \c__witharrows_ext_delimiters_clist
   {
     ., \{, (, [, \lbrace, \lbrack, \lgroup, \langle, \lmoustache, \lceil, \lfloor
   }
@@ -308,7 +305,7 @@
       {
         \tl_set:Nx \l_tmpa_tl { \tl_head:n { #1 } }
         \clist_if_in:NVTF
-          \c__witharrows_extensible_delimiters_clist
+          \c__witharrows_ext_delimiters_clist
           \l_tmpa_tl
           { \tl_set:Nn \l__witharrows_replace_left_brace_by_tl { #1 } }
           { \__witharrows_error:n { Bad~value~for~replace~brace~by } }
@@ -575,6 +572,7 @@
   {
     \cs_if_exist:NT \tikz at library@external at loaded
       { \tikzset { external / export = false } }
+    \tikzset { arrows = [ flex ] }  % https://texnique.fr/osqa/questions/12199
     \str_clear_new:N \l__witharrows_name_str
     \str_clear_new:N \l__witharrows_status_arrow_str
     \dim_zero_new:N \l__witharrows_x_dim
@@ -1280,10 +1278,7 @@
     \cs_set:Npn \__witharrows_tmpa:nnn ##1 ##2 ##3
       {
         \tikzpicture
-        [
-          __witharrows_standard ,
-          every~path / .style = WithArrows / arrow
-        ]
+        [ __witharrows_standard_arrow ]
         \pgf at relevantforpicturesizetrue
           #1
         \dim_compare:nNnTF \pgf at picminx = { 16000 pt }
@@ -1846,7 +1841,7 @@
   }
 \__witharrows_msg_new:nn { Incompatible~options a}
   {
-    Incompatible~options.
+    Incompatible~options.\\
     You~try~to~use~the~option~'\l_keys_key_str'~but~
     this~option~is~incompatible~or~redundant~with~the~option~
     '\l__witharrows_previous_key_str'~set~in~the~same~command~
@@ -1859,7 +1854,7 @@
   }
 \__witharrows_msg_new:nnn { Arrow~not~in~last~column }
   {
-    Bad~use~of~\l__witharrows_string_Arrow_for_msg_str.
+    Bad~use~of~\l__witharrows_string_Arrow_for_msg_str.\\
     You~should~use~the~command~\l__witharrows_string_Arrow_for_msg_str\
     only~in~the~last~column~(column~\int_use:N\l__witharrows_nb_cols_int)~
     in~the~row~\int_use:N \g__witharrows_line_int\

Modified: trunk/Master/texmf-dist/source/generic/witharrows/witharrows.dtx
===================================================================
--- trunk/Master/texmf-dist/source/generic/witharrows/witharrows.dtx	2023-08-24 20:18:16 UTC (rev 68046)
+++ trunk/Master/texmf-dist/source/generic/witharrows/witharrows.dtx	2023-08-24 20:18:25 UTC (rev 68047)
@@ -15,8 +15,8 @@
 %
 % \fi
 % \iffalse
-\def\myfileversion{2.8a}
-\def\myfiledate{2023/02/14}
+\def\myfileversion{2.8b}
+\def\myfiledate{2023/08/24}
 %
 %
 %<*batchfile>
@@ -119,7 +119,7 @@
 % \medskip
 % The arrows are drawn with Tikz and that's why \textbf{several compilations may
 % be necessary}.\footnote{If you use Overleaf, Overleaf will do automatically
-% the right number of compilations.}
+% a number compilations sufficient (by using |latexmk|).}
 %
 % \bigskip
 % This package provides an environment |{WithArrows}| to construct alignments of
@@ -1999,17 +1999,36 @@
 % The extension \pkg{witharrows} provides a command |\WithArrowsNewStyle| to
 % define styles in a way similar to the ``styles'' of Tikz.
 %
+% \smallskip
 % The command |\WithArrowsNewStyle| takes two mandatory arguments. The first is
 % the name of the style and the second is a list of key-value pairs. The scope
-% of the definition done by |\WithArrowsNewStyle| is the current TeX scope.
+% of the definition done by |\WithArrowsNewStyle| is the current TeX
+% scope.\footnote{We recall that, in particular, every LaTeX environment is a
+% TeX group.}
 %
+% \smallskip
 % The style can be used as a key at the document level (with
 % |\WithArrowsOptions|) or at the environment level (in the optional arguments
 % of |{WithArrows}| and |{DispWithArrows}|). The style can also be used in
 % another command |\WithArrowsNewStyle|.
 %
+% \smallskip
 % For an example of use, see p.~\pageref{example-WithArrowsRightX}.
 %
+% \bigskip
+% At this time, there is no style for indivual arrows. However, it's, of course,
+% possible to define new commands based upton the command |\Arrow|. For example :
+%
+% \begin{Verbatim}
+% \newcommand{\ThickArrow}{\Arrow[tikz=thick]}
+% \end{Verbatim}
+% 
+% This new command |\ThickArrow| still accepts options between square brackets.
+% It's possible to write |\ThickArrow[jump=2]| because, in fact, 
+% |\Arrow[tikz=thick][jump=2]| is an allowed syntax for the command |\Arrow|
+% (it's possible to put an arbitrary number of optional arguments between square
+% brackets after |\Arrow|).
+%
 % \subsection{The key right-overlap}
 %
 % \colorbox{yellow!50}{\textbf{New 2.8}}
@@ -2687,7 +2706,7 @@
 % \bigskip
 % First, \pkg{tikz} and some Tikz libraries are loaded before the
 % |\ProvidesExplPackage|. They are loaded this way because |\usetikzlibrary| in
-% |expl3| code fails.\footnote{cf.
+% |L3| code fails.\footnote{cf.
 %   |tex.stackexchange.com/questions/57424/using-of-usetikzlibrary-in-an-expl3-package-fails|}
 %
 % 
@@ -2699,7 +2718,8 @@
 \input tikz.tex
 \input expl3-generic.tex
 %</plain-TeX>
-\usetikzlibrary{arrows.meta,bending}
+\usetikzlibrary{arrows.meta}
+\usepgfmodule{bending} % https://texnique.fr/osqa/questions/12199
 %    \end{macrocode}
 %
 % \bigskip
@@ -2908,9 +2928,59 @@
 %</LaTeX>
 %    \end{macrocode}
 %
+% \bigskip
+% \subsection{Collecting options}
+%
+% The following technic allows to create user commands with the ability to put 
+% an arbitrary number of |[|\textsl{list of (key=val)}|]| after the name of the
+% command.
+%
+% \medskip
+% \emph{Exemple} :\par\nobreak
+%
+% |\@@_collect_options:n { \F } [x=a,y=b] [z=c,t=d] { arg }|
+%
+% will be transformed in :\quad |\F{x=a,y=b,z=c,t=d}{arg}|
+%
+% \smallskip
+% Therefore, by writing : |\def\G{\@@_collect_options:n{\F}}|,
+%
+% the command |\G| takes in an arbitrary number of optional arguments between
+% square brackets.
 % 
+% \bigskip
+%    \begin{macrocode}
+%<*LaTeX>
+\cs_new_protected:Npn \@@_collect_options:n #1 
+  { 
+    \peek_meaning:NTF [
+      { \@@_collect_options:nw { #1 } }
+      { #1 { } }
+  }
+%    \end{macrocode}
 %
 % \bigskip
+% We use |\NewDocumentCommand| in order to be able to allow nested brackets
+% within the argument between |[| and |]|.
+%    \begin{macrocode}
+\NewDocumentCommand \@@_collect_options:nw { m r[] }
+  { \@@_collect_options:nn { #1 } { #2 } }
+
+\cs_new_protected:Npn \@@_collect_options:nn #1 #2
+  {
+    \peek_meaning:NTF [
+      { \@@_collect_options:nnw { #1 } { #2 } }
+      { #1 { #2 } }
+  }
+
+\cs_new_protected:Npn \@@_collect_options:nnw #1#2[#3]
+  { \@@_collect_options:nn { #1 } { #2 , #3 } }
+%</LaTeX>
+%    \end{macrocode}
+%
+% 
+%
+% \bigskip
 % \subsection{Some technical definitions}
 %
 % 
@@ -2918,33 +2988,6 @@
 \cs_generate_variant:Nn \seq_set_split:Nnn { N x x }
 %    \end{macrocode}
 % 
-% \medskip
-% We create booleans in order to know if some packages are loaded. For example,
-% for the package \pkg{amsmath}, the boolean is called
-% |\c_@@_amsmath_loaded_bool|.\footnote{It's not possible to use
-%   |\@ifpackageloaded| in the core of the functions because |\@ifpackageloaded|
-%   is available only in the preamble.}
-%    \begin{macrocode}
-\AtBeginDocument
-  { 
-    \clist_map_inline:nn
-      { 
-        amsmath, amsthm, autonum, cleveref, hyperref, mathtools, showlabels,
-        typedref, unicode-math
-      }
-      {
-        \bool_new:c { c_@@_#1_loaded_bool }
-%<*LaTeX>
-        \@ifpackageloaded { #1 }
-          { \bool_set_true:c { c_@@_#1_loaded_bool } }
-          { } 
-%</LaTeX>
-%<*plain-TeX>
-        \bool_set_false:c { c_@@_#1_loaded_bool }
-%</plain-TeX>
-      }
-  }
-%    \end{macrocode}
 %
 % \bigskip
 % We define a command |\@@_sort_seq:N| which will sort a sequence.
@@ -2953,15 +2996,10 @@
   { 
     \seq_sort:Nn #1
       { 
-        \int_compare:nNnTF 
-          { 
-            \tex_strcmp:D
-              { \str_lower_case:n { ##1 } } 
-              { \str_lower_case:n { ##2 } } 
-          } 
-          > 0
+        \str_compare:eNeTF 
+          { \str_lowercase:n { ##1 } } < { \str_lowercase:n { ##2 } } 
+          \sort_return_same:    
           \sort_return_swapped:
-          \sort_return_same:    
       } 
   }
 %    \end{macrocode}
@@ -3060,9 +3098,26 @@
         remember~picture ,
         overlay ,
         name~prefix = wa - \l_@@_prefix_str -
+      } ,
+    @@_standard_arrow / .style = 
+      {
+        @@_standard , 
+        every~path / .style = WithArrows / arrow 
       }
   }
 %    \end{macrocode}
+% The following line is a security when using |xelatex| and RTL language (cf.
+% question~683570 on TeX StackExchange).
+%    \begin{macrocode}
+\sys_if_engine_xetex:T
+  {
+    \tikzset
+      {
+        @@_standard_arrow / .append~style = 
+          { every~node / .append~style = { text = . } }
+      }   
+  }
+%    \end{macrocode}
 % 
 % \bigskip
 % We also define a style for the tips of arrow. The final user of the extension
@@ -3112,7 +3167,7 @@
 %<*LaTeX>
 \AtBeginDocument
   {
-    \bool_if:NTF \c_@@_amsmath_loaded_bool
+    \IfPackageLoadedTF { amsmath }
       {
         \seq_put_right:Nn \l_@@_options_WithArrowsOptions_seq { subequations }
         \seq_put_right:Nn \l_@@_options_DispWithArrows_seq { subequations }
@@ -3128,9 +3183,7 @@
 % 
 % Nevertheless, we want the extension \pkg{witharrows} available without
 % \pkg{amsmath}. That's why we give a definition of |\spread at equation| if
-% \pkg{amsmath} is not loaded (we put the code in the hook |begindocument|
-% because the flag |\c_@@_amsmath_loaded_bool| is itself set in the hook
-% |begindocument|).
+% \pkg{amsmath} is not loaded.
 %    \begin{macrocode}
       { 
 %</LaTeX>
@@ -3558,8 +3611,8 @@
 % The following list of the (left) extensible delimiters of LaTeX is only for
 % the validation of the key |replace-left-brace-by|.
 %    \begin{macrocode}
-\clist_new:N \c_@@_extensible_delimiters_clist
-\clist_set:Nn \c_@@_extensible_delimiters_clist
+\clist_new:N \c_@@_ext_delimiters_clist
+\clist_set:Nn \c_@@_ext_delimiters_clist
   { 
     ., \{, (, [, \lbrace, \lbrack, \lgroup, \langle, \lmoustache, \lceil, \lfloor
   }
@@ -3566,12 +3619,11 @@
 %<*LaTeX>
 \AtBeginDocument
   { 
-    \bool_lazy_or:nnT 
-      \c_@@_amsmath_loaded_bool 
-      { \use:c { c_@@_unicode-math_loaded_bool } }
-      { 
-        \clist_put_right:Nn \c_@@_extensible_delimiters_clist { \lvert, \lVert }
-      }  
+    \bool_set_false:N \l_tmpa_bool
+    \IfPackageLoadedTF { amsmath } { \bool_set_true:N \l_tmpa_bool } { }
+    \IfPackageLoadedTF { unicode-math } { \bool_set_true:N \l_tmpa_bool } { }
+    \bool_if:NT \l_tmpa_bool 
+      { \clist_put_right:Nn \c_@@_ext_delimiters_clist { \lvert, \lVert } }  
   }
 %</LaTeX>
 %    \end{macrocode}
@@ -3601,7 +3653,7 @@
 % must test whether the package \pkg{amsmath} is loaded. 
 %    \begin{macrocode}
     subequations .code:n = 
-      \bool_if:NTF \c_@@_amsmath_loaded_bool
+      \IfPackageLoadedTF { amsmath }
         { \bool_set_true:N \l_@@_subequations_bool }
         { 
           \@@_error:n { amsmath~not~loaded } 
@@ -3631,7 +3683,7 @@
       {
         \tl_set:Nx \l_tmpa_tl { \tl_head:n { #1 } }
         \clist_if_in:NVTF 
-          \c_@@_extensible_delimiters_clist
+          \c_@@_ext_delimiters_clist
           \l_tmpa_tl
           { \tl_set:Nn \l_@@_replace_left_brace_by_tl { #1 } }
           { \@@_error:n { Bad~value~for~replace~brace~by } }
@@ -4025,7 +4077,9 @@
 % \medskip
 %    \begin{macrocode}
 %<*LaTeX>
-\NewDocumentCommand \@@_Arrow { O { } m ! O { } }
+\cs_new_protected:Npn \@@_Arrow
+  { \@@_collect_options:n { \@@_Arrow_i } }
+\NewDocumentCommand \@@_Arrow_i { m m ! O { } }
 %</LaTeX>
 %<*plain-TeX>
 \cs_new_protected:Npn \@@_Arrow
@@ -4102,7 +4156,7 @@
 %
 % \item The label of the arrow (it's also a token list):
 %    \begin{macrocode}
-    \prop_put:Nnn \l_tmpa_prop { label } { #2 }
+    \prop_put:Nnn \l_tmpa_prop { label } { #2 } 
 %    \end{macrocode}
 % 
 % \item The number of the line where the command |\Arrow| is issued in the TeX
@@ -4175,8 +4229,13 @@
     \cs_if_exist:NT \tikz at library@external at loaded
       { \tikzset { external / export = false } }
 %    \end{macrocode}
-%
+% 
 % \bigskip
+%    \begin{macrocode}
+    \tikzset { arrows = [ flex ] }  % https://texnique.fr/osqa/questions/12199
+%    \end{macrocode}
+% 
+% \bigskip
 % The token list |\l_@@_name_str| will contain the potential name of the
 % environment (given with the option |name|). This name will be used to create
 % aliases for the names of the nodes.
@@ -4505,7 +4564,7 @@
 % The command |\@@_set_qedhere:| will do a redefinition of |\qedhere| in each
 % cell of the last column.
 %    \begin{macrocode}
-                    \bool_if:NT \c_@@_amsthm_loaded_bool \@@_set_qedhere:
+                    \IfPackageLoadedTF { amsmath } { \@@_set_qedhere: } { }
                   }
 %</LaTeX>
               }
@@ -4986,12 +5045,13 @@
 % Then, an action done by \pkg{hyperref} in its redefinition of
 % |\refstepcounter|.
 %    \begin{macrocode}
-                \bool_if:NT \c_@@_hyperref_loaded_bool
+                \IfPackageLoadedTF { hyperref }
                   { 
-                    % the following line is probably useless (2022/05/16)
+                    % the following line is probably pointless (2022/05/16)
                     % \str_set:Nn \This at name { equation }
                     \hyper at refstepcounter { equation }
                   }
+                  { }
 %    \end{macrocode}
 % Then, an action done by \pkg{cleveref} in its redefinition of
 % |\refstepcounter|. The package \pkg{cleveref} creates in the |aux| file a
@@ -4998,7 +5058,7 @@
 % command |\cref at currentlabel| similar to |\@currentlabel| but with more
 % informations.
 %    \begin{macrocode}        
-                \bool_if:NT \c_@@_cleveref_loaded_bool
+                \IfPackageLoadedTF { cleveref }
                   {
                     \cref at constructprefix { equation } \cref at result
                     \protected at edef \cref at currentlabel
@@ -5012,6 +5072,7 @@
                         \p at equation \g_tmpa_tl
                       }
                   }
+                  { }
 %    \end{macrocode}
 % Now, we can issue the command |\label| (some packages may have redefined
 % |\label|, for example \pkg{typedref}) for each item in the sequence of the
@@ -5219,7 +5280,7 @@
 % environment). 
 %    \begin{macrocode}
 %<*LaTeX>
-    \bool_if:nT \c_@@_mathtools_loaded_bool 
+    \IfPackageLoadedTF { mathtools }
       { 
         \MH_if_boolean:nT { show_only_refs } 
           {
@@ -5232,6 +5293,7 @@
             \MH_set_boolean_T:n { show_only_refs } 
           }
       }
+      { }
 %    \end{macrocode}
 %
 % An action done by \pkg{typedref} in its redefinition of |\refstepcounter|. The
@@ -5238,13 +5300,15 @@
 % command |\sr at name| is a prefix added to the name of the label by the
 % redefinition of |\label| done by \pkg{typedref}.
 %    \begin{macrocode}
-    \bool_if:NT \c_@@_typedref_loaded_bool { \str_set:Nn \sr at name { equation } }
+    \IfPackageLoadedTF { typedref } 
+      { \str_set:Nn \sr at name { equation } }
+      { }
 %    \end{macrocode}
 %
 % The command |\intertext@| is a command of \pkg{amsmath} which loads the
 % definition of |\intertext|.
 %    \begin{macrocode}
-    \bool_if:NT \c_@@_amsmath_loaded_bool \intertext@
+    \IfPackageLoadedTF { amsmath } { \intertext@ } { }
 %</LaTeX>
     \exp_args:No \tl_if_novalue:nF { #1 } { \tl_set:Nn \l_@@_left_brace_tl { #1 } }
     \@@_pre_halign:n { #2 }
@@ -5513,8 +5577,9 @@
 % the environment).
 %    \begin{macrocode}
 %<*LaTeX>
-    \bool_if:nT \c_@@_mathtools_loaded_bool
+    \IfPackageLoadedTF { mathtools }
       { \MH_if_boolean:nT { show_only_refs } \MT_showonlyrefs_true: }
+      { }
     \bool_if:NTF \l_@@_in_label_or_minipage_bool
       { 
         \c_math_toggle_token
@@ -5617,7 +5682,7 @@
         \tl_if_empty:NF \l_@@_tag_tl
           { \@@_error:nn  { Multiple~tags } { #2 } }
         \clist_set:Nn \l_@@_tags_clist { all }
-        \bool_if:nT \c_@@_mathtools_loaded_bool
+        \IfPackageLoadedTF { mathtools }
           {
             \MH_if_boolean:nT { show_only_refs }
               {
@@ -5625,6 +5690,7 @@
                   { \clist_clear:N \l_@@_tags_clist }
               }
           }
+          { }
         \tl_set:Nn \l_@@_tag_tl { #2 }
         \bool_set:Nn \l_@@_tag_star_bool { #1 }
 %    \end{macrocode}
@@ -5634,8 +5700,12 @@
 % |\@eqnnum|.\footnote{There are two versions of |@eqnnum|, a standard version
 % and a version for the option |leqno|.}
 %    \begin{macrocode}
-        \bool_if:nT { #1 && ! \bool_if_p:N \c_@@_amsmath_loaded_bool }
-          { \@@_error:n { tag*~without~amsmath } } 
+        \bool_if:nT { #1 }
+          {
+            \IfPackageLoadedTF { amsmath } 
+              { }
+              { \@@_error:n { tag*~without~amsmath } }
+          }
       }
   }
 %    \end{macrocode}
@@ -5653,12 +5723,12 @@
       { 
         \seq_if_empty:NF \l_@@_labels_seq 
           { 
-            \bool_if:NTF \c_@@_cleveref_loaded_bool
+            \IfPackageLoadedTF { cleveref } 
               { \@@_error:n { Multiple~labels~with~cleveref } }
               { \@@_error:n { Multiple~labels } } 
           }
         \seq_put_right:Nn \l_@@_labels_seq { #1 }
-        \bool_if:nT \c_@@_mathtools_loaded_bool
+        \IfPackageLoadedTF { mathtools }
           {
             \MH_if_boolean:nT { show_only_refs } 
               { 
@@ -5667,12 +5737,14 @@
                   { \clist_clear:N \l_@@_tags_clist } 
               }
           }
-        \bool_if:nT \c_@@_autonum_loaded_bool
+          { }
+        \IfPackageLoadedTF { autonum }
           { 
             \cs_if_exist:cTF { autonum@#1Referenced }
               { \clist_set:Nn \l_@@_tags_clist { all } }
               { \clist_clear:N \l_@@_tags_clist } 
           } 
+          { }
       } 
   }
 %    \end{macrocode}
@@ -6333,10 +6405,7 @@
 %<*plain-TeX>
         \tikzpicture
 %</plain-TeX>
-        [
-          @@_standard ,
-          every~path / .style = WithArrows / arrow
-        ]
+        [ @@_standard_arrow ]
 %    \end{macrocode}
 % You keep track of the bounding box because we want to compute the total width
 % of the arrow (with the label) for the arrows of type |over| and also for the
@@ -7329,7 +7398,7 @@
 %    \begin{macrocode}          
 \@@_msg_new:nn { Incompatible~options a}
   { 
-    Incompatible~options.
+    Incompatible~options.\\
     You~try~to~use~the~option~'\l_keys_key_str'~but~
     this~option~is~incompatible~or~redundant~with~the~option~
     '\l_@@_previous_key_str'~set~in~the~same~command~
@@ -7345,7 +7414,7 @@
 %    \begin{macrocode}
 \@@_msg_new:nnn { Arrow~not~in~last~column }
   { 
-    Bad~use~of~\l_@@_string_Arrow_for_msg_str.
+    Bad~use~of~\l_@@_string_Arrow_for_msg_str.\\
     You~should~use~the~command~\l_@@_string_Arrow_for_msg_str\
     only~in~the~last~column~(column~\int_use:N\l_@@_nb_cols_int)~
     in~the~row~\int_use:N \g_@@_line_int\ 
@@ -7448,8 +7517,8 @@
     Normally,~we~can't~use~the~command~\token_to_str:N\label\ 
     twice~in~a~line~of~the~environment~\{\l_@@_type_env_str\}. \\
     However,~you~can~go~on.~
-    \bool_if:NT \c_@@_showlabels_loaded_bool
-      { However,~only~the~last~label~will~be~shown~by~showlabels.~ }
+    \IfPackageLoadedTF { showlabels }
+      { However,~only~the~last~label~will~be~shown~by~showlabels.~ } { }
     If~you~don't~want~to~see~this~message~again,~you~can~use~the~option~
     'allow-multiple-labels'~at~the~global~or~environment~level.
   }
@@ -7982,6 +8051,7 @@
 %    \end{macrocode}
 % 
 % \section{History}
+%
 % 
 % \subsection*{Changes between 2.7 and 2.8}
 %

Modified: trunk/Master/texmf-dist/tex/generic/witharrows/witharrows.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/witharrows/witharrows.sty	2023-08-24 20:18:16 UTC (rev 68046)
+++ trunk/Master/texmf-dist/tex/generic/witharrows/witharrows.sty	2023-08-24 20:18:25 UTC (rev 68047)
@@ -18,10 +18,11 @@
 %% and version 1.3 or later is part of all distributions of
 %% LaTeX version 2005/12/01 or later.
 %% 
-\def\myfileversion{2.8a}
-\def\myfiledate{2023/02/14}
+\def\myfileversion{2.8b}
+\def\myfiledate{2023/08/24}
 \RequirePackage{tikz}
-\usetikzlibrary{arrows.meta,bending}
+\usetikzlibrary{arrows.meta}
+\usepgfmodule{bending} % https://texnique.fr/osqa/questions/12199
 \RequirePackage{l3keys2e}
 \ProvidesExplPackage
   {witharrows}
@@ -110,34 +111,33 @@
 \DeclareOption { leqno } { \bool_set_true:N \c__witharrows_leqno_bool }
 \DeclareOption* { }
 \ProcessOptions*
-\cs_generate_variant:Nn \seq_set_split:Nnn { N x x }
-\AtBeginDocument
+\cs_new_protected:Npn \__witharrows_collect_options:n #1
   {
-    \clist_map_inline:nn
-      {
-        amsmath, amsthm, autonum, cleveref, hyperref, mathtools, showlabels,
-        typedref, unicode-math
-      }
-      {
-        \bool_new:c { c__witharrows_#1_loaded_bool }
-        \@ifpackageloaded { #1 }
-          { \bool_set_true:c { c__witharrows_#1_loaded_bool } }
-          { }
-      }
+    \peek_meaning:NTF [
+      { \__witharrows_collect_options:nw { #1 } }
+      { #1 { } }
   }
+\NewDocumentCommand \__witharrows_collect_options:nw { m r[] }
+  { \__witharrows_collect_options:nn { #1 } { #2 } }
+
+\cs_new_protected:Npn \__witharrows_collect_options:nn #1 #2
+  {
+    \peek_meaning:NTF [
+      { \__witharrows_collect_options:nnw { #1 } { #2 } }
+      { #1 { #2 } }
+  }
+
+\cs_new_protected:Npn \__witharrows_collect_options:nnw #1#2[#3]
+  { \__witharrows_collect_options:nn { #1 } { #2 , #3 } }
+\cs_generate_variant:Nn \seq_set_split:Nnn { N x x }
 \cs_new_protected:Npn \__witharrows_sort_seq:N #1
   {
     \seq_sort:Nn #1
       {
-        \int_compare:nNnTF
-          {
-            \tex_strcmp:D
-              { \str_lower_case:n { ##1 } }
-              { \str_lower_case:n { ##2 } }
-          }
-          > 0
+        \str_compare:eNeTF
+          { \str_lowercase:n { ##1 } } < { \str_lowercase:n { ##2 } }
+          \sort_return_same:
           \sort_return_swapped:
-          \sort_return_same:
       }
   }
 \cs_new_protected:Npn \__witharrows_set_seq_of_str_from_clist:Nn #1 #2
@@ -188,8 +188,21 @@
         remember~picture ,
         overlay ,
         name~prefix = wa - \l__witharrows_prefix_str -
+      } ,
+    __witharrows_standard_arrow / .style =
+      {
+        __witharrows_standard ,
+        every~path / .style = WithArrows / arrow
       }
   }
+\sys_if_engine_xetex:T
+  {
+    \tikzset
+      {
+        __witharrows_standard_arrow / .append~style =
+          { every~node / .append~style = { text = . } }
+      }
+  }
 \tikzset
   {
     WithArrows / arrow / tips / .style =
@@ -209,7 +222,7 @@
  }
 \AtBeginDocument
   {
-    \bool_if:NTF \c__witharrows_amsmath_loaded_bool
+    \IfPackageLoadedTF { amsmath }
       {
         \seq_put_right:Nn \l__witharrows_options_WithArrowsOptions_seq { subequations }
         \seq_put_right:Nn \l__witharrows_options_DispWithArrows_seq { subequations }
@@ -379,19 +392,18 @@
     right-overlap .bool_set:N       = \l__witharrows_right_overlap_bool ,
     right-overlap .value_required:n = true
   }
-\clist_new:N \c__witharrows_extensible_delimiters_clist
-\clist_set:Nn \c__witharrows_extensible_delimiters_clist
+\clist_new:N \c__witharrows_ext_delimiters_clist
+\clist_set:Nn \c__witharrows_ext_delimiters_clist
   {
     ., \{, (, [, \lbrace, \lbrack, \lgroup, \langle, \lmoustache, \lceil, \lfloor
   }
 \AtBeginDocument
   {
-    \bool_lazy_or:nnT
-      \c__witharrows_amsmath_loaded_bool
-      { \use:c { c__witharrows_unicode-math_loaded_bool } }
-      {
-        \clist_put_right:Nn \c__witharrows_extensible_delimiters_clist { \lvert, \lVert }
-      }
+    \bool_set_false:N \l_tmpa_bool
+    \IfPackageLoadedTF { amsmath } { \bool_set_true:N \l_tmpa_bool } { }
+    \IfPackageLoadedTF { unicode-math } { \bool_set_true:N \l_tmpa_bool } { }
+    \bool_if:NT \l_tmpa_bool
+      { \clist_put_right:Nn \c__witharrows_ext_delimiters_clist { \lvert, \lVert } }
   }
 \keys_define:nn { WithArrows / DispWithArrowsSpecific }
   {
@@ -406,7 +418,7 @@
         { \clist_set:Nn \l__witharrows_tags_clist { all } } ,
     notag .default:n = true ,
     subequations .code:n =
-      \bool_if:NTF \c__witharrows_amsmath_loaded_bool
+      \IfPackageLoadedTF { amsmath }
         { \bool_set_true:N \l__witharrows_subequations_bool }
         {
           \__witharrows_error:n { amsmath~not~loaded }
@@ -435,7 +447,7 @@
       {
         \tl_set:Nx \l_tmpa_tl { \tl_head:n { #1 } }
         \clist_if_in:NVTF
-          \c__witharrows_extensible_delimiters_clist
+          \c__witharrows_ext_delimiters_clist
           \l_tmpa_tl
           { \tl_set:Nn \l__witharrows_replace_left_brace_by_tl { #1 } }
           { \__witharrows_error:n { Bad~value~for~replace~brace~by } }
@@ -670,7 +682,9 @@
     \str_clear_new:N \l__witharrows_previous_key_str
     \keys_set:nn { WithArrows / WithArrowsOptions } { #1 }
   }
-\NewDocumentCommand \__witharrows_Arrow { O { } m ! O { } }
+\cs_new_protected:Npn \__witharrows_Arrow
+  { \__witharrows_collect_options:n { \__witharrows_Arrow_i } }
+\NewDocumentCommand \__witharrows_Arrow_i { m m ! O { } }
   {
     \int_gincr:N \g__witharrows_arrow_int
     \str_clear_new:N \l__witharrows_previous_key_str
@@ -697,6 +711,7 @@
     \str_set:NV \l__witharrows_type_env_str \@currenvir
     \cs_if_exist:NT \tikz at library@external at loaded
       { \tikzset { external / export = false } }
+    \tikzset { arrows = [ flex ] }  % https://texnique.fr/osqa/questions/12199
     \str_clear_new:N \l__witharrows_name_str
     \str_clear_new:N \l__witharrows_status_arrow_str
     \dim_zero_new:N \l__witharrows_x_dim
@@ -769,7 +784,7 @@
                 \bool_if:NT \l__witharrows_in_DispWithArrows_bool
                   {
                     \__witharrows_test_if_to_tag:
-                    \bool_if:NT \c__witharrows_amsthm_loaded_bool \__witharrows_set_qedhere:
+                    \IfPackageLoadedTF { amsmath } { \__witharrows_set_qedhere: } { }
                   }
               }
             \str_if_eq:VnT \l__witharrows_type_col_str { c } \hfil
@@ -966,13 +981,14 @@
             \seq_if_empty:NF \l__witharrows_labels_seq
               {
                 \cs_set:Npx \@currentlabel { \p at equation \g_tmpa_tl }
-                \bool_if:NT \c__witharrows_hyperref_loaded_bool
+                \IfPackageLoadedTF { hyperref }
                   {
-                    % the following line is probably useless (2022/05/16)
+                    % the following line is probably pointless (2022/05/16)
                     % \str_set:Nn \This at name { equation }
                     \hyper at refstepcounter { equation }
                   }
-                \bool_if:NT \c__witharrows_cleveref_loaded_bool
+                  { }
+                \IfPackageLoadedTF { cleveref }
                   {
                     \cref at constructprefix { equation } \cref at result
                     \protected at edef \cref at currentlabel
@@ -986,6 +1002,7 @@
                         \p at equation \g_tmpa_tl
                       }
                   }
+                  { }
                 \seq_map_function:NN \l__witharrows_labels_seq \__witharrows_old_label
               }
             \__witharrows_save:N \l__witharrows_tag_star_bool
@@ -1077,7 +1094,7 @@
         \legacy_if:nT { @minipage }
           { \bool_set_true:N \l__witharrows_in_label_or_minipage_bool }
       }
-    \bool_if:nT \c__witharrows_mathtools_loaded_bool
+    \IfPackageLoadedTF { mathtools }
       {
         \MH_if_boolean:nT { show_only_refs }
           {
@@ -1085,8 +1102,11 @@
             \MH_set_boolean_T:n { show_only_refs }
           }
       }
-    \bool_if:NT \c__witharrows_typedref_loaded_bool { \str_set:Nn \sr at name { equation } }
-    \bool_if:NT \c__witharrows_amsmath_loaded_bool \intertext@
+      { }
+    \IfPackageLoadedTF { typedref }
+      { \str_set:Nn \sr at name { equation } }
+      { }
+    \IfPackageLoadedTF { amsmath } { \intertext@ } { }
     \exp_args:No \tl_if_novalue:nF { #1 } { \tl_set:Nn \l__witharrows_left_brace_tl { #1 } }
     \__witharrows_pre_halign:n { #2 }
     \bool_if:NT \l__witharrows_subequations_bool { \begin { subequations } }
@@ -1222,8 +1242,9 @@
         }
     \endpgfpicture
     \__witharrows_post_halign:
-    \bool_if:nT \c__witharrows_mathtools_loaded_bool
+    \IfPackageLoadedTF { mathtools }
       { \MH_if_boolean:nT { show_only_refs } \MT_showonlyrefs_true: }
+      { }
     \bool_if:NTF \l__witharrows_in_label_or_minipage_bool
       {
         \c_math_toggle_token
@@ -1261,7 +1282,7 @@
         \tl_if_empty:NF \l__witharrows_tag_tl
           { \__witharrows_error:nn  { Multiple~tags } { #2 } }
         \clist_set:Nn \l__witharrows_tags_clist { all }
-        \bool_if:nT \c__witharrows_mathtools_loaded_bool
+        \IfPackageLoadedTF { mathtools }
           {
             \MH_if_boolean:nT { show_only_refs }
               {
@@ -1269,10 +1290,15 @@
                   { \clist_clear:N \l__witharrows_tags_clist }
               }
           }
+          { }
         \tl_set:Nn \l__witharrows_tag_tl { #2 }
         \bool_set:Nn \l__witharrows_tag_star_bool { #1 }
-        \bool_if:nT { #1 && ! \bool_if_p:N \c__witharrows_amsmath_loaded_bool }
-          { \__witharrows_error:n { tag*~without~amsmath } }
+        \bool_if:nT { #1 }
+          {
+            \IfPackageLoadedTF { amsmath }
+              { }
+              { \__witharrows_error:n { tag*~without~amsmath } }
+          }
       }
   }
 \cs_new_protected:Npn \__witharrows_label:n #1
@@ -1281,12 +1307,12 @@
       {
         \seq_if_empty:NF \l__witharrows_labels_seq
           {
-            \bool_if:NTF \c__witharrows_cleveref_loaded_bool
+            \IfPackageLoadedTF { cleveref }
               { \__witharrows_error:n { Multiple~labels~with~cleveref } }
               { \__witharrows_error:n { Multiple~labels } }
           }
         \seq_put_right:Nn \l__witharrows_labels_seq { #1 }
-        \bool_if:nT \c__witharrows_mathtools_loaded_bool
+        \IfPackageLoadedTF { mathtools }
           {
             \MH_if_boolean:nT { show_only_refs }
               {
@@ -1295,12 +1321,14 @@
                   { \clist_clear:N \l__witharrows_tags_clist }
               }
           }
-        \bool_if:nT \c__witharrows_autonum_loaded_bool
+          { }
+        \IfPackageLoadedTF { autonum }
           {
             \cs_if_exist:cTF { autonum@#1Referenced }
               { \clist_set:Nn \l__witharrows_tags_clist { all } }
               { \clist_clear:N \l__witharrows_tags_clist }
           }
+          { }
       }
   }
 \cs_new_protected:Npn \__witharrows_tagnextline:
@@ -1604,10 +1632,7 @@
     \cs_set:Npn \__witharrows_tmpa:nnn ##1 ##2 ##3
       {
         \begin{tikzpicture}
-        [
-          __witharrows_standard ,
-          every~path / .style = WithArrows / arrow
-        ]
+        [ __witharrows_standard_arrow ]
         \pgf at relevantforpicturesizetrue
           #1
         \dim_compare:nNnTF \pgf at picminx = { 16000 pt }
@@ -2194,7 +2219,7 @@
   }
 \__witharrows_msg_new:nn { Incompatible~options a}
   {
-    Incompatible~options.
+    Incompatible~options.\\
     You~try~to~use~the~option~'\l_keys_key_str'~but~
     this~option~is~incompatible~or~redundant~with~the~option~
     '\l__witharrows_previous_key_str'~set~in~the~same~command~
@@ -2207,7 +2232,7 @@
   }
 \__witharrows_msg_new:nnn { Arrow~not~in~last~column }
   {
-    Bad~use~of~\l__witharrows_string_Arrow_for_msg_str.
+    Bad~use~of~\l__witharrows_string_Arrow_for_msg_str.\\
     You~should~use~the~command~\l__witharrows_string_Arrow_for_msg_str\
     only~in~the~last~column~(column~\int_use:N\l__witharrows_nb_cols_int)~
     in~the~row~\int_use:N \g__witharrows_line_int\
@@ -2280,8 +2305,8 @@
     Normally,~we~can't~use~the~command~\token_to_str:N\label\
     twice~in~a~line~of~the~environment~\{\l__witharrows_type_env_str\}. \\
     However,~you~can~go~on.~
-    \bool_if:NT \c__witharrows_showlabels_loaded_bool
-      { However,~only~the~last~label~will~be~shown~by~showlabels.~ }
+    \IfPackageLoadedTF { showlabels }
+      { However,~only~the~last~label~will~be~shown~by~showlabels.~ } { }
     If~you~don't~want~to~see~this~message~again,~you~can~use~the~option~
     'allow-multiple-labels'~at~the~global~or~environment~level.
   }



More information about the tex-live-commits mailing list.