texlive[46394] Master/texmf-dist: witharrows (20jan18)

commits+karl at tug.org commits+karl at tug.org
Sun Jan 21 01:44:26 CET 2018


Revision: 46394
          http://tug.org/svn/texlive?view=revision&revision=46394
Author:   karl
Date:     2018-01-21 01:44:26 +0100 (Sun, 21 Jan 2018)
Log Message:
-----------
witharrows (20jan18)

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

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

Modified: trunk/Master/texmf-dist/source/latex/witharrows/witharrows.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/witharrows/witharrows.dtx	2018-01-21 00:44:09 UTC (rev 46393)
+++ trunk/Master/texmf-dist/source/latex/witharrows/witharrows.dtx	2018-01-21 00:44:26 UTC (rev 46394)
@@ -15,8 +15,8 @@
 %
 % \fi
 % \iffalse
-\def\myfileversion{1.3}
-\def\myfiledate{2018/01/11}
+\def\myfileversion{1.4}
+\def\myfiledate{2018/01/20}
 %
 %
 %<*batchfile>
@@ -52,7 +52,7 @@
 \usepackage{geometry}
 \usepackage[dvipsnames]{xcolor} % color is already loaded with l3doc (?)
 \geometry{left=2.8cm,right=2.8cm,top=2.5cm,bottom=2.5cm,papersize={21cm,29.7cm}}
-\usepackage{witharrows}
+\usepackage[footnotehyper]{witharrows}
 \usepackage{mathtools}
 \usepackage{amsfonts}
 \usepackage{stmaryrd}
@@ -83,10 +83,8 @@
 % \vskip1cm 
 % This package can be used with |xelatex|, |lualatex|, |pdflatex| but also by the classical workflow
 % |latex|-|dvips|-|ps2pdf| (or Adobe Distiller). Two compilations may be necessary. This package requires the
-% packages \pkg{expl3}, \pkg{xparse}, \pkg{footnote}\footnote{The package footnote is used to extract the notes
-% from the environments \texttt{\{WithArrows\}}. This package must be loaded \emph{after} the package
-% \pkg{xcolor}.} and \pkg{tikz}. The following Tikz libraries are also required: \pkg{calc}, \pkg{arrows.meta} and
-% \pkg{bending}.
+% packages \pkg{expl3}, \pkg{xparse} and \pkg{tikz}. The following Tikz libraries are also required: \pkg{calc},
+% \pkg{arrows.meta} and \pkg{bending}.
 %
 % \bigskip
 % This package gives an environment |{WithArrows}| to construct alignments of equations with arrows for the
@@ -363,9 +361,9 @@
 % Almost all the options can also be set at the document level with the command |\WithArrowsOptions|. In this case,
 % the scope of the declarations is the current TeX group (these declarations are ``semi-global''). For example, if
 % we want all the environments |{WithArrows}| composed in |\displaystyle| with blue arrows, we can write
-% |\WithArrowsOptions{displaystyle,tikz=blue}|.\footnote{It's also possible to give the options directly when
-% loading the package, \emph{i.e.} with the command \texttt{\string\usepackage} in the preamble.}
-% %
+% |\WithArrowsOptions{displaystyle,tikz=blue}|.\footnote{Since version 1.4 of \pkg{witharrows}, it's no longer possible
+% to give these options directly when loading the package, \emph{i.e.} with the command \texttt{\string\usepackage} in the preamble.}
+% 
 % \begin{Verbatim}
 % ~emphase#\WithArrowsOptions{displaystyle,tikz=blue}@
 % $\begin{WithArrows}
@@ -531,10 +529,10 @@
 %
 % \bigskip
 % The environment |{WithArrows}| gives also a |groups| option (with a \emph{s} in the name). With this option, the
-% arrows are divided into several ``groups''. Each group is a set of connected\footnote{More precisely : for each
+% arrows are divided into several ``groups''. Each group is a set of connected\footnote{More precisely: for each
 % arrow $a$, we note $i(a)$ the number of its initial line and $f(a)$ the number of its final line ; for two arrows
 % $a$ and $b$, we say that $a \sim b$ when
-% $\llbracket i(a),f(a)\rrbracket \cap \llbracket i(b),f(b)\rrbracket \neq \emptyset$ ; the groups are the
+% $\llbracket i(a),f(a)\rrbracket \cap \llbracket i(b),f(b)\rrbracket \neq \varnothing$ ; the groups are the
 % equivalence classes of the transitive closure of $\sim$.} arrows. All the arrows of a given group are grouped on
 % a same vertical line and at a leftmost position.
 %
@@ -768,7 +766,7 @@
 % It's possible to use |\MoveEqLeft| of \pkg{mathtools} (if we don't want ampersand on the first line):
 % %
 % \begin{Verbatim}[formatcom=\small\color{gray}]
-% $\begin{WithArrows}[jot=2mm]
+% $\begin{WithArrows}[interline=0.5ex]
 % ~emphase#\MoveEqLeft@ \arccos(x) = \arcsin \frac45 + \arcsin \frac5{13} 
 % \Arrow{because both are in $[-\frac{\pi}2,\frac{\pi}2]$} \\
 % & \Leftrightarrow x = \sin\left(\arcsin\frac45 + \arcsin\frac5{13}\right) \\
@@ -781,7 +779,7 @@
 %
 %
 % \medskip
-% $\begin{WithArrows}[jot=2mm]
+% $\begin{WithArrows}[interline=0.5ex]
 % \MoveEqLeft \arccos(x) = \arcsin \frac45 + \arcsin \frac5{13} 
 % \Arrow{because both are in $[-\frac{\pi}2,\frac{\pi}2]$} \\
 % & \Leftrightarrow x = \sin\left(\arcsin\frac45 + \arcsin\frac5{13}\right) \\
@@ -869,7 +867,6 @@
 % \subsection{Automatic numerotation}
 %
 % The option |font| of Tikz contains in fact a list of tokens which will be placed at the beginning of the text.
-%
 % These tokens can be true commands for a change of font (like |\bfseries| or |\sffamily|) but can also be, in
 % fact, any TeX command.
 %
@@ -905,16 +902,48 @@
 % \end{WithArrows}$
 % \end{scope}
 %
+% \section{Footnotes in the environment WithArrows}
+% 
+% If you want to put footnotes in an environment |{WithArrows}|, you can use a pair
+% |\footnotemark|--|\footnotetext|.
 %
+% \smallskip
+% It's also possible to extract the footnotes with the help of the package \pkg{footnote} or the package \pkg{footnotehyper}.
 %
+% \smallskip
+% If \pkg{witharrows} is loaded with the option |footnote| (with |\usepackage[footnote]{witharrows}| or with
+% |\PassOptionsToPackage|), the package \pkg{footnote} is loaded (if it is not yet loaded) and it is used to
+% extract the footnotes.
+%
+% \smallskip
+% If \pkg{witharrows} is loaded with the option |footnotehyper|, the package \pkg{footnotehyper} is loaded (if it
+% is not yet loaded) ant it is used to extract footnotes.
+%
+% \smallskip
+% Caution: The packages \pkg{footnote} and \pkg{footnotehyper} are incompatible. The package \pkg{footnotehyper} is the
+% successor of the package \pkg{footnote} and should be used preferently. The package \pkg{footnote} has some
+% drawbacks, in particular: it must be loaded after the package \pkg{xcolor} and it is not perfectly compatible
+% with \pkg{hyperref}.
+%
+% \medskip
+% In this document, the package \pkg{witharrows} has been loaded with the option |footnotehyper| and we give an
+% example with a footnote in the label of an arrow:
+%
+% \smallskip
+% $\begin{WithArrows}
+% A & = (a+b)^2 
+% \Arrow{We expand\,\footnote{A footnote.}} \\
+%    & = a^2+b^2+2ab
+% \end{WithArrows}$
+% 
 %\section{Fine tuning}
 %
-% The version 1.3 of \pkg{witharrows} give two new options for a fine tuning of the arrows :
+% The version 1.3 of \pkg{witharrows} give two new options for a fine tuning of the arrows:
 % 
 % \begin{itemize}
 % \item the option |ystart| set the vertical distance between the base line of the text and the start of the arrow
-% (default value : 0.4 ex).
-% \item the option |ygap| set the vertical distance between two consecutive arrows (default value : 0.4 ex).
+% (default value: 0.4 ex).
+% \item the option |ygap| set the vertical distance between two consecutive arrows (default value: 0.4~ex).
 % \end{itemize}
 %
 % These options can be set at the document level or at the environment level.
@@ -943,7 +972,7 @@
 %
 %
 % \bigskip
-% \emph{Remark} : It's also possible to use the options ``|shorten <|'' and ``|shorten >|'' of Tikz (via the option
+% \emph{Remark}: It's also possible to use the options ``|shorten <|'' and ``|shorten >|'' of Tikz (via the option
 % |tikz| of \pkg{witharrows}).
 %
 % \section{An technical remark about the names of the nodes}
@@ -1039,13 +1068,107 @@
 \RequirePackage{xparse}
 %    \end{macrocode}
 %
+% \subsection{The packages footnote and footnotehyper }
+%
+% A few options can be given to the package \pkg{witharrows} when it is loaded (with |\usepackage|,
+% |\RequirePackage| or |\PassOptionsToPackage|). Currently (version \myfileversion), there are two such options:
+% |footnote| and |footnotehyper|. With the option |footnote|, \pkg{witharrows} loads \pkg{footnote} and uses it to
+% extract the footnotes from the environments |{WithArrows}|. Idem for the option |footnotehyper|.
+%
+% \medskip
+% The boolean |\g_@@_footnotehyper_bool| will indicate if the option |footnotehyper| is used.
+%    \begin{macrocode}
+\bool_new:N \g_@@_footnotehyper_bool
+%    \end{macrocode}
+%
+% \medskip
+% The boolean |\g_@@_footnote_bool| will indicate if the option |footnote| is used, but quicky, it will also be set
+% to |true| if the option |footnotehyper| is used.
+%    \begin{macrocode}
+\bool_new:N \g_@@_footnote_bool
+%    \end{macrocode}
+%
+% \medskip
+% We define a set of keys |WithArrows/package| for these options. However, first, we define a ``level of options''
+% |\l_@@_level_int| even if, in the version \myfileversion{} of \pkg{witharrows}, this integer is not used by the
+% options of the set |WithArrows/package|.
+%    \begin{macrocode}
+\int_new:N \l_@@_level_int
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\keys_define:nn {WithArrows/package}
+      {footnote      .bool_gset:N = \g_@@_footnote_bool,
+       footnotehyper .bool_gset:N = \g_@@_footnotehyper_bool}
+%    \end{macrocode}
+%
 % \bigskip
-% The package \pkg{footnote} will be used to extract footnotes of the environments |{WithArrows}| via the pair
-% |\savenotes|-|\spewnotes|.
+% We process the options when the package is loaded (with |\usepackage|).
 %    \begin{macrocode}
-\RequirePackage{footnote}
+\ProcessKeysOptions {WithArrows/package}
 %    \end{macrocode}
+% 
+% \medskip
+%    \begin{macrocode}
+\msg_new:nnn {witharrows}
+             {Option~incompatible~with~Beamer}
+             {The~option~"\tl_use:N \l_keys_key_tl"\ is~incompatible~
+              with~Beamer~because~Beamer~has~its~own~system~to~extract~footnotes.}
+%    \end{macrocode}
 %
+%    \begin{macrocode}
+\msg_new:nnn {witharrows}
+             {footnote~with~footnotehyper~package}
+             {You~can't~use~the~option~footnote~because~the~package~
+              footnotehyper~has~already~been~loaded.~
+              If~you~want,~you~can~use~the~option~"footnotehyper"~and~the~footnotes~  
+              within~the~environments~{WithArrows}~will~be~extracted~with~the~tools~
+              of~the~package~footnotehyper.}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\msg_new:nnn {witharrows}
+             {footnotehyper~with~footnote~package}
+             {You~can't~use~the~option~"footnotehyper"~because~the~package~
+              footnote~has~already~been~loaded.~
+              If~you~want,~you~can~use~the~option~"footnote"~and~the~footnotes~  
+              within~the~environments~{WithArrows}~will~be~extracted~with~the~tools~
+              of~the~package~footnote.}
+%    \end{macrocode}
+%
+% \medskip
+%    \begin{macrocode}
+\cs_new_protected:Nn \@@_test_beamer:n
+         {\@ifclassloaded {beamer}
+                {\msg_fatal:nn {witharrows} 
+                               {Option~incompatible~with~Beamer}}
+                {} }
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\bool_if:NT \g_@@_footnote_bool 
+      {\@@_test_beamer:n {footnote}
+       \@ifpackageloaded{footnotehyper}
+           {\msg_fatal:nn {witharrows}
+                          {footnote~with~footnotehyper~package}}
+           {}
+       \usepackage{footnote}}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\bool_if:NT \g_@@_footnotehyper_bool 
+      {\@@_test_beamer:n {footnotehyper}
+       \@ifpackageloaded{footnote}
+           {\msg_fatal:nn {witharrows}
+                          {footnotehyper~with~footnote~package}}
+           {}
+       \usepackage{footnotehyper}
+       \bool_gset_true:N \g_@@_footnote_bool}
+%    \end{macrocode}
+% The flag |\g_@@_footnote_bool| has been set to |true| and so, we will only have to test 
+% |\g_@@_footnote_bool| in order to known if we have to insert an environnement |{savenotes}| (see the definition
+% of environnement |{WithArrows}|).
+%
 % \subsection{Some technical definitions}
 %
 % We define a Tikz style |@@_node_style| for the nodes that will be created in the |\halign|. The nodes are Tikz
@@ -1082,13 +1205,14 @@
 %    \begin{macrocode}
 \cs_if_free:NT \spread at equation
     {\cs_set:Npn \spread at equation{\openup\jot   
-                                  \cs_set_eq:NN \spread at equation \prg_do_nothing}}
+                                  \cs_set:Npn \spread at equation {}}}
 %    \end{macrocode}
+% Don't put |\cs_set_eq:NN \spread at equation \prog_do_nothing:| in the last line because this would raise errors
+% with nested environments.
 %
 %
 % \subsection{Variables}
 %
-% \bigskip
 % The following sequence is the position of the last environment |{WithArrows}| in the tree of the nested
 % environments |{WithArrows}|. 
 %    \begin{macrocode}
@@ -1104,13 +1228,7 @@
 %    \end{macrocode}
 %
 % \bigskip
-% The following counter will be use to specify the level when we set keys: $0$~(global level as with
-% |\WithArrowsOptions|), $1$~(environment level with the |\begin{WithArrows}|) or $2$~(local level with the
-% |\Arrow| command).
-%    \begin{macrocode}
-\int_new:N \l_@@_level_int
-%    \end{macrocode}
-% \bigskip
+
 % The following skip (=glue) is the vertical space inserted between two lines of the |\halign|.
 %    \begin{macrocode}
 \skip_new:N \l_@@_interline_skip
@@ -1132,6 +1250,7 @@
 % The integer |\l_@@_pos_arrows_int| indicates the position of the arrows with the following code:
 %
 % \begin{center}
+% \setlength{\extrarowheight}{2pt}
 % \begin{tabular}{|l|c|c|c|c|c|c|c|}
 % \hline
 % option                 & |rr| & |ll| & |rl| & |lr| & |i| & |group| & |groups| \\
@@ -1206,7 +1325,7 @@
 % values will be appended on the right of this token list.
 %
 % \bigskip
-% The dimension |\g_@@_x_dim| will be used to compute the $x$-value for some verticals arrows when one of the
+% The dimension |\g_@@_x_dim| will be used to compute the $x$-value for some vertical arrows when one of the
 % options |i|, |group| and |groups| (values 4, 5 and 6 of |\l_@@_pos_arrows_int|) is used.
 %    \begin{macrocode}
 \dim_new:N \g_@@_x_dim
@@ -1234,21 +1353,27 @@
 \seq_new:N \g_@@_line_bis_int_seq
 \int_new:N \g_@@_line_bis_int
 %    \end{macrocode}
-
 %
 % \subsection{The definition of the options}
-% There are three levels where options can be set:
+% There are four levels where options can be set:
 % \begin{itemize}
-% \item with |\WithArrowsOptions{...}|: this level will be called \emph{global} level (number~0);
-% \item with |\begin{WithArrows}[...]|: this level will be called \emph{environment} level (number~1);
-% \item with |\Arrow[...]|: this level will be called \emph{local} level (number~2).
+% \item in the options of the |\usepackage|: this level will be called \emph{package} level (number~$0$);
+% \item with |\WithArrowsOptions{...}|: this level will be called \emph{global} level (number~$1$);
+% \item with |\begin{WithArrows}[...]|: this level will be called \emph{environment} level (number~$2$);
+% \item with |\Arrow[...]|: this level will be called \emph{local} level (number~$3$).
 % \end{itemize}
 %
+% \bigskip
 % The level is specified in the variable |\l_@@_level_int| and the code attached to the options can use this
 % information to alter their actions.
 %
+% \medskip
+%    \begin{macrocode}
+\int_set:Nn \l_@@_level_int 1
+%    \end{macrocode}
+%
 % \bigskip
-% We begin with a first submodule which will be loaded only at the global or the environment level.
+% We go on with a submodule which will be loaded only at the global or the environment level.
 %
 % \medskip
 % The options |t|, |c| and |b| indicate if we will create a |\vtop|, a |\vcenter| of a |\vbox|. This information is
@@ -1373,7 +1498,7 @@
 % It's not possible to change the value of this parameter for a individual arrow if the option |group| or the
 % option |groups| is used.
 %    \begin{macrocode}
-      xoffset  .code:n  = {\bool_if:nTF {\int_compare_p:nNn \l_@@_level_int = 2 &&
+      xoffset  .code:n  = {\bool_if:nTF {\int_compare_p:nNn \l_@@_level_int = 3 &&
                                          \int_compare_p:nNn \l_@@_pos_arrows_int > 4}
                                {\msg_error:nn {witharrows}
                                               {Option~incompatible~with~"group(s)"}}
@@ -1386,7 +1511,7 @@
 % LaTeX parameter and not a parameter specific to \pkg{witharrows}. It's allowed only at the level of the
 % environment (maybe we should suppress completely this option in the future).
 %    \begin{macrocode}
-      jot       .code:n     = {\int_compare:nNnTF \l_@@_level_int = 1
+      jot       .code:n     = {\int_compare:nNnTF \l_@@_level_int = 2
                                   {\dim_set:Nn \jot {#1}}
                                   {\msg_error:nn {witharrows} {Option~will~be~ignored} }}, 
       jot       .value_required:n  = true,
@@ -1397,7 +1522,7 @@
 % accepted only at the level of the environment (this last point is a kind of security). Futhermore, this option has a
 % particular behaviour: it applies only to the current environment and doesn't apply to the nested environments.
 %    \begin{macrocode}
-      interline   .code:n       = {\int_compare:nNnTF \l_@@_level_int = 1
+      interline   .code:n       = {\int_compare:nNnTF \l_@@_level_int = 2
                                       {\skip_set:Nn \l_@@_interline_skip {#1}}
                                       {\msg_error:nn {witharrows} {Option~will~be~ignored}}},
       interline   .value_required:n = true,
@@ -1441,7 +1566,7 @@
 % previous option |group| or |groups| (this previous option |group| or |groups| would necessarily have been set at
 % a global level by |\WithArrowsOptions|).
 %    \begin{macrocode}
-      \bool_if:nTF { \int_compare_p:nNn \l_@@_level_int = 2 &&
+      \bool_if:nTF { \int_compare_p:nNn \l_@@_level_int = 3 &&
                      \int_compare_p:nNn \l_@@_pos_arrows_int > 4}
          {\msg_error:nn {witharrows}
                         {Option~incompatible~with~"group(s)"}}
@@ -1448,12 +1573,6 @@
          {\int_set:Nn \l_@@_pos_arrows_int {#1}}}
 %    \end{macrocode}
 %
-% \bigskip
-% We process the options when the package is loaded (with |\usepackage|) but we recommend to use
-% |\WithArrowsOptions| instead. 
-%    \begin{macrocode}
-\ProcessKeysOptions {WithArrows}
-%    \end{macrocode}
 %
 % \bigskip
 % |\WithArrowsOptions| is the command of the \pkg{witharrows} package to fix options at the document level.
@@ -1475,8 +1594,7 @@
 % \medskip
 %    \begin{macrocode}
 \NewDocumentCommand \@@_Arrow {O{} m O{}}
-         {\tl_if_eq:noF {WithArrows} {\@currenvir} 
-                  {\msg_error:nn {witharrows} {Arrow~used~outside~{WithArrows}~environment}}
+         {
 %    \end{macrocode}
 %
 % The counter |\g_@@_arrow_int| counts the arrows in the environment. The incrementation must be global (|gincr|)
@@ -1581,9 +1699,6 @@
            \tl_clear_new:N \l_@@_prefix_tl
            \tl_set:Nx \l_@@_prefix_tl {\seq_use:Nnnn \l_tmpa_seq {-} {-} {-}}
 %    \end{macrocode}
-%
-%
-
 % 
 % \bigskip
 % The environment |{WithArrows}| must be used in math mode.
@@ -1594,10 +1709,10 @@
 %    \end{macrocode}
 %
 % \bigskip
-% We extract the footnotes of the environments |{WithArrows}| with the pair |\savenotes-\spewnotes| of the
-% extension \pkg{footnote} (of course, we have put a |\spewnotes| at the end of the environment).
+% If the option |footnote| or the option |footnotehyper| is used, then we extract the footnotes with an environment
+% |{savenotes}| (of the package \pkg{footnote} or the package \pkg{footnotehyper}).
 %    \begin{macrocode}
-           \savenotes
+           \bool_if:NT \g_@@_footnote_bool {\begin{savenotes}}
 %    \end{macrocode}
 %
 % \bigskip
@@ -1627,7 +1742,7 @@
 % We process the options given to the |{WithArrows}| environment. The level of options is set to 1.
 %    \begin{macrocode}
            \int_set:Nn \l_@@_previous_pos_arrows_int {-1}
-           \int_set:Nn \l_@@_level_int 1
+           \int_set:Nn \l_@@_level_int 2
            \keys_set_known:nnN {WithArrows} {#1} \l_tmpa_tl
            \keys_set:nV {WithArrows/GlobalOrEnv} \l_tmpa_tl
 %    \end{macrocode}
@@ -1754,10 +1869,10 @@
 %    \end{macrocode}
 %
 % \bigskip
-% We use |\spewnotes| of \pkg{footnote} to spew the footnotes of the environment (a |\savenotes| has been put at
-% the beginning of the environment).
+% If the option |footnote| or the option |footnotehyper| is used, then we extract the footnotes with an environment
+% |{footnote}| (of the package \pkg{footnote} or the package \pkg{footnotehyper}).
 %    \begin{macrocode}
-           \spewnotes
+           \bool_if:NT \g_@@_footnote_bool {\end{savenotes}}
 %    \end{macrocode}
 %
 % \bigskip
@@ -1878,7 +1993,7 @@
 %
 % \bigskip
 % The flag |\l_@@_new_group_bool| indicates if we have to begin a new group of arrows. In fact, We have to begin a
-% new group in two circonstancies : if we are at the first arrow of the environment (that's why the flag is raised
+% new group in two circonstancies: if we are at the first arrow of the environment (that's why the flag is raised
 % before the beginning of the loop) an if we have just finished a group (that's why the flag is raised in the
 % previous conditionnal). At the beginning of a group, we have to initialize four variables:
 % |\l_@@_first_arrow_int|, |\l_@@_first_line_of_group_int|, |\l_@@_last_line_of_group| and |\g_@@_x_dim| (global
@@ -1982,7 +2097,7 @@
 %    \begin{macrocode}
       \group_begin:
       \int_set:Nn \l_@@_previous_pos_arrows_int {-1}
-      \int_set:Nn \l_@@_level_int 2
+      \int_set:Nn \l_@@_level_int 3
 %    \end{macrocode}
 %
 % \bigskip
@@ -2095,7 +2210,7 @@
 % the second method. \footnote{cf.:
 % |tex.stackexchange.com/questions/298177/how-to-get-around-a-problem-with-usetikzlibrarybabel|}
 %    \begin{macrocode}
-              to node [node~contents = {\tl_use:N \l_tmpa_tl}] {}
+              to node [node~contents = {\tl_use:N \l_tmpa_tl}]  {}
               (\int_compare:nNnTF \l_@@_pos_arrows_int > 3 
                 {\dim_use:N \g_@@_x_dim + \dim_use:N \l_@@_xoffset_dim, \y2}
                 {\x2 + \dim_use:N \l_@@_xoffset_dim, \y2} ) ; 
@@ -2140,11 +2255,7 @@
     }   
 %    \end{macrocode}
 %
-%    \begin{macrocode}
-\cs_generate_variant:Nn \tl_if_eq:nnF {noF}
-%    \end{macrocode}
 %
-%
 % \bigskip
 % The command |\WithArrowsLastEnv| is not used by the package \pkg{witharrows}. It's only a facility given to the
 % final user. It gives the number of the last environment |{WithArrows}| at level~$0$ (to the sens of the nested
@@ -2159,18 +2270,11 @@
 \msg_new:nnn {witharrows}
              {Third~column~in~a~{WithArrows}~environment}
              {By~default,~a~\{WithArrows\}~environment~can~only~have~two~columns.~
-              Maybe~you~have~forgotten~a~newline~symbol.~If~you~really~want~
-              more~than~two~columns,~you~should~use~the~option~"MoreColumns"~at~
-              a~global~level~or~for~an~environment.~However,~you~can~go~one~for~this~time.}
+              Maybe~you~have~forgotten~a~\str_use:N \c_backslash_str 
+              \str_use:N \c_backslash_str.~If~you~really~want~more~than~two~columns,~
+              you~should~use~the~option~"MoreColumns"~at~a~global~level~or~for~
+              an~environment.~However,~you~can~go~one~for~this~time.}
 %    \end{macrocode}
-%             
-%    \begin{macrocode}          
-\msg_new:nnn {witharrows}
-             {Arrow~used~outside~{WithArrows}~environment}
-             {The~command~\token_to_str:N\Arrow\ should~be~used~only~directly~
-              in~\{WithArrows\}~environment~and~not~in~a~subenvironment.~However,~you~
-              can~go~on.}
-%    \end{macrocode}
 %
 %    \begin{macrocode}          
 \msg_new:nnn {witharrows}
@@ -2183,8 +2287,8 @@
 %    \begin{macrocode}          
 \msg_new:nnn {witharrows}          
              {Too~few~lines~for~an~arrow}
-             {There~is~at~least~an~arrow~that~can't~be~drawn~because~it~arrives~after~the~
-              last~line~of~the~environment.}
+             {An~arrow~specified~in~line~\int_use:N \l_@@_initial_int\ can't~be~drawn~
+              because~it~arrives~after~the~last~line~of~the~environment.}
 %    \end{macrocode}
 %
 %    \begin{macrocode}          
@@ -2209,9 +2313,9 @@
                    6 {groups}}"~
               previously~set~in~the~same~
               \int_case:nn\l_@@_level_int 
-                   {0 {command~\token_to_str:N\WithArrowsOptions}
-                    1 {declaration~of~options~of~the~environment~\{WithArrows\}}
-                    2 {command~\token_to_str:N\Arrow}}.~
+                   {1 {command~\token_to_str:N\WithArrowsOptions}
+                    2 {declaration~of~options~of~the~environment~\{WithArrows\}}
+                    3 {command~\token_to_str:N\Arrow}}.~
               If~you~go~on,~I~will~overwrite~the~first~option.}
 %    \end{macrocode}
 %
@@ -2266,10 +2370,10 @@
               first~column).\\
               However~you~can~go~on~for~this~time.}
 %    \end{macrocode}
-% 
 %
 %
 %
+%
 % \section{History}
 %
 % \subsection{Changes between versions 1.0 and 1.1}
@@ -2293,12 +2397,19 @@
 %
 % Better error messages
 % 
-% \subsection{Changes between versions 1.1 and 1.2}
+% \subsection{Changes between versions 1.2 and 1.3}
 % 
 % New options |ygap| and |ystart| for fine tuning.
 %
 % Minor bugs.
 %
+% \subsection{Changes between versions 1.3 and 1.4}
+% 
+% The package \pkg{footnote} is no longer loaded by default. Instead, two options |footnote| and |footnotehyper| have
+% been added. In particular, \pkg{witharrows} becomes compatible with \cls{beamer}.
+% 
+%
+%
 % \endinput
 %
 % Local Variables:

Modified: trunk/Master/texmf-dist/tex/latex/witharrows/witharrows.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/witharrows/witharrows.sty	2018-01-21 00:44:09 UTC (rev 46393)
+++ trunk/Master/texmf-dist/tex/latex/witharrows/witharrows.sty	2018-01-21 00:44:26 UTC (rev 46394)
@@ -18,8 +18,8 @@
 %% and version 1.3 or later is part of all distributions of
 %% LaTeX version 2005/12/01 or later.
 %% 
-\def\myfileversion{1.3}
-\def\myfiledate{2018/01/11}
+\def\myfileversion{1.4}
+\def\myfiledate{2018/01/20}
 \RequirePackage{tikz}
 \usetikzlibrary{calc,arrows.meta,bending}
 \RequirePackage{l3keys2e}
@@ -29,7 +29,51 @@
   {\myfileversion}
   {Draws arrows for explanations on the right}
 \RequirePackage{xparse}
-\RequirePackage{footnote}
+\bool_new:N \g__wa_footnotehyper_bool
+\bool_new:N \g__wa_footnote_bool
+\int_new:N \l__wa_level_int
+\keys_define:nn {WithArrows/package}
+      {footnote      .bool_gset:N = \g__wa_footnote_bool,
+       footnotehyper .bool_gset:N = \g__wa_footnotehyper_bool}
+\ProcessKeysOptions {WithArrows/package}
+\msg_new:nnn {witharrows}
+             {Option~incompatible~with~Beamer}
+             {The~option~"\tl_use:N \l_keys_key_tl"\ is~incompatible~
+              with~Beamer~because~Beamer~has~its~own~system~to~extract~footnotes.}
+\msg_new:nnn {witharrows}
+             {footnote~with~footnotehyper~package}
+             {You~can't~use~the~option~footnote~because~the~package~
+              footnotehyper~has~already~been~loaded.~
+              If~you~want,~you~can~use~the~option~"footnotehyper"~and~the~footnotes~
+              within~the~environments~{WithArrows}~will~be~extracted~with~the~tools~
+              of~the~package~footnotehyper.}
+\msg_new:nnn {witharrows}
+             {footnotehyper~with~footnote~package}
+             {You~can't~use~the~option~"footnotehyper"~because~the~package~
+              footnote~has~already~been~loaded.~
+              If~you~want,~you~can~use~the~option~"footnote"~and~the~footnotes~
+              within~the~environments~{WithArrows}~will~be~extracted~with~the~tools~
+              of~the~package~footnote.}
+\cs_new_protected:Nn \__wa_test_beamer:n
+         {\@ifclassloaded {beamer}
+                {\msg_fatal:nn {witharrows}
+                               {Option~incompatible~with~Beamer}}
+                {} }
+\bool_if:NT \g__wa_footnote_bool
+      {\__wa_test_beamer:n {footnote}
+       \@ifpackageloaded{footnotehyper}
+           {\msg_fatal:nn {witharrows}
+                          {footnote~with~footnotehyper~package}}
+           {}
+       \usepackage{footnote}}
+\bool_if:NT \g__wa_footnotehyper_bool
+      {\__wa_test_beamer:n {footnotehyper}
+       \@ifpackageloaded{footnote}
+           {\msg_fatal:nn {witharrows}
+                          {footnotehyper~with~footnote~package}}
+           {}
+       \usepackage{footnotehyper}
+       \bool_gset_true:N \g__wa_footnote_bool}
 \tikzset{__wa_node_style/.style={
                above = \l__wa_ystart_dim,
                inner~sep = 0 pt,
@@ -40,11 +84,11 @@
 \tikzset{TipsOfWithArrows/.style= { > = {Straight~Barb[scale=1.2,bend]}} }
 \cs_if_free:NT \spread at equation
     {\cs_set:Npn \spread at equation{\openup\jot
-                                  \cs_set_eq:NN \spread at equation \prg_do_nothing}}
+                                  \cs_set:Npn \spread at equation {}}}
 \seq_new:N \g__wa_position_in_the_tree_seq
 \seq_gput_right:Nn \g__wa_position_in_the_tree_seq 1
 \int_new:N \g__wa_last_env_int
-\int_new:N \l__wa_level_int
+
 \skip_new:N \l__wa_interline_skip
 \bool_new:N \l__wa_MoreColumns_bool
 \int_new:N \l__wa_pos_env_int
@@ -67,7 +111,7 @@
 \int_new:N \g__wa_line_int
 \seq_new:N \g__wa_line_bis_int_seq
 \int_new:N \g__wa_line_bis_int
-
+\int_set:Nn \l__wa_level_int 1
 \keys_define:nn {WithArrows/GlobalOrEnv}
    {  t   .code:n            = {\int_set:Nn \l__wa_pos_env_int 0},
       t   .value_forbidden:n = true,
@@ -112,17 +156,17 @@
       lr       .code:n            = {\__wa_analyze_option_position:n 3},
       i        .value_forbidden:n = true,
       i        .code:n            = {\__wa_analyze_option_position:n 4},
-      xoffset  .code:n  = {\bool_if:nTF {\int_compare_p:nNn \l__wa_level_int = 2 &&
+      xoffset  .code:n  = {\bool_if:nTF {\int_compare_p:nNn \l__wa_level_int = 3 &&
                                          \int_compare_p:nNn \l__wa_pos_arrows_int > 4}
                                {\msg_error:nn {witharrows}
                                               {Option~incompatible~with~"group(s)"}}
                                {\dim_set:Nn \l__wa_xoffset_dim {#1}}},
       xoffset  .value_required:n  = true,
-      jot       .code:n     = {\int_compare:nNnTF \l__wa_level_int = 1
+      jot       .code:n     = {\int_compare:nNnTF \l__wa_level_int = 2
                                   {\dim_set:Nn \jot {#1}}
                                   {\msg_error:nn {witharrows} {Option~will~be~ignored} }},
       jot       .value_required:n  = true,
-      interline   .code:n       = {\int_compare:nNnTF \l__wa_level_int = 1
+      interline   .code:n       = {\int_compare:nNnTF \l__wa_level_int = 2
                                       {\skip_set:Nn \l__wa_interline_skip {#1}}
                                       {\msg_error:nn {witharrows} {Option~will~be~ignored}}},
       interline   .value_required:n = true,
@@ -140,19 +184,17 @@
         {\msg_error:nn {witharrows}
                        {Two~options~are~incompatible}}
       \int_set:Nn \l__wa_previous_pos_arrows_int {#1}
-      \bool_if:nTF { \int_compare_p:nNn \l__wa_level_int = 2 &&
+      \bool_if:nTF { \int_compare_p:nNn \l__wa_level_int = 3 &&
                      \int_compare_p:nNn \l__wa_pos_arrows_int > 4}
          {\msg_error:nn {witharrows}
                         {Option~incompatible~with~"group(s)"}}
          {\int_set:Nn \l__wa_pos_arrows_int {#1}}}
-\ProcessKeysOptions {WithArrows}
 \NewDocumentCommand \WithArrowsOptions {m}
     {\int_set:Nn \l__wa_previous_pos_arrows_int {-1}
      \keys_set_known:nnN {WithArrows} {#1} \l_tmpa_tl
      \keys_set:nV {WithArrows/GlobalOrEnv} \l_tmpa_tl}
 \NewDocumentCommand \__wa_Arrow {O{} m O{}}
-         {\tl_if_eq:noF {WithArrows} {\@currenvir}
-                  {\msg_error:nn {witharrows} {Arrow~used~outside~{WithArrows}~environment}}
+         {
           \int_gincr:N \g__wa_arrow_int
           \int_zero_new:N \l__wa_jump_int
           \int_set:Nn \l__wa_jump_int 1
@@ -184,11 +226,10 @@
            \seq_pop_right:NN \l_tmpa_seq \l_tmpa_tl
            \tl_clear_new:N \l__wa_prefix_tl
            \tl_set:Nx \l__wa_prefix_tl {\seq_use:Nnnn \l_tmpa_seq {-} {-} {-}}
-
            \reverse_if:N \if_mode_math:
                              \msg_error:nn {witharrows} {{WithArrows}~used~outside~math~mode}
                          \fi
-           \savenotes
+           \bool_if:NT \g__wa_footnote_bool {\begin{savenotes}}
            \cs_set_eq:NN \\ \__wa_cr:
            \mathsurround = \c_zero_dim
            \int_zero_new:N \l__wa_initial_int
@@ -196,7 +237,7 @@
            \int_zero_new:N \l__wa_arrow_int
            \skip_zero:N \l__wa_interline_skip
            \int_set:Nn \l__wa_previous_pos_arrows_int {-1}
-           \int_set:Nn \l__wa_level_int 1
+           \int_set:Nn \l__wa_level_int 2
            \keys_set_known:nnN {WithArrows} {#1} \l_tmpa_tl
            \keys_set:nV {WithArrows/GlobalOrEnv} \l_tmpa_tl
            \cs_set_eq:cN \l__wa_CommandName_tl \__wa_Arrow
@@ -238,7 +279,7 @@
                   {\int_compare:nNnTF \l__wa_pos_arrows_int > 4
                     \__wa_draw_arrows:
                     {\__wa_draw_arrows:nn 1 \g__wa_arrow_int}}
-           \spewnotes
+           \bool_if:NT \g__wa_footnote_bool {\end{savenotes}}
            \seq_gpop_right:NN \g__wa_position_in_the_tree_seq \l_tmpa_tl
            \seq_gpop_right:NN \g__wa_position_in_the_tree_seq \l_tmpa_tl
            \seq_gput_right:Nx \g__wa_position_in_the_tree_seq {\int_eval:n {\l_tmpa_tl + 1}}
@@ -319,7 +360,7 @@
              {\msg_fatal:nn {witharrows} {Too~few~lines~for~an~arrow}}
       \group_begin:
       \int_set:Nn \l__wa_previous_pos_arrows_int {-1}
-      \int_set:Nn \l__wa_level_int 2
+      \int_set:Nn \l__wa_level_int 3
       \prop_get:cnN {g__wa_arrow_\l__wa_prefix_tl
                         _\int_use:N\l__wa_arrow_int _prop} {options} \l_tmpa_tl
       \exp_args:NNo \exp_args:No \keys_set_WithArrows: {\l_tmpa_tl}
@@ -360,7 +401,7 @@
               (\int_compare:nNnTF \l__wa_pos_arrows_int > 3
                 {\dim_use:N \g__wa_x_dim + \dim_use:N \l__wa_xoffset_dim, \y1}
                 {\x1 + \dim_use:N \l__wa_xoffset_dim, \y1} )
-              to node [node~contents = {\tl_use:N \l_tmpa_tl}] {}
+              to node [node~contents = {\tl_use:N \l_tmpa_tl}]  {}
               (\int_compare:nNnTF \l__wa_pos_arrows_int > 3
                 {\dim_use:N \g__wa_x_dim + \dim_use:N \l__wa_xoffset_dim, \y2}
                 {\x2 + \dim_use:N \l__wa_xoffset_dim, \y2} ) ;
@@ -385,21 +426,16 @@
          }
      \group_end:
     }
-\cs_generate_variant:Nn \tl_if_eq:nnF {noF}
 \NewDocumentCommand \WithArrowsLastEnv {}
      {\int_use:N \g__wa_last_env_int}
 \msg_new:nnn {witharrows}
              {Third~column~in~a~{WithArrows}~environment}
              {By~default,~a~\{WithArrows\}~environment~can~only~have~two~columns.~
-              Maybe~you~have~forgotten~a~newline~symbol.~If~you~really~want~
-              more~than~two~columns,~you~should~use~the~option~"MoreColumns"~at~
-              a~global~level~or~for~an~environment.~However,~you~can~go~one~for~this~time.}
+              Maybe~you~have~forgotten~a~\str_use:N \c_backslash_str
+              \str_use:N \c_backslash_str.~If~you~really~want~more~than~two~columns,~
+              you~should~use~the~option~"MoreColumns"~at~a~global~level~or~for~
+              an~environment.~However,~you~can~go~one~for~this~time.}
 \msg_new:nnn {witharrows}
-             {Arrow~used~outside~{WithArrows}~environment}
-             {The~command~\token_to_str:N\Arrow\ should~be~used~only~directly~
-              in~\{WithArrows\}~environment~and~not~in~a~subenvironment.~However,~you~
-              can~go~on.}
-\msg_new:nnn {witharrows}
              {The~option~"jump"~must~be~non~negative}
              {You~can't~use~a~strictly~negative~value~for~the~option~"jump"~of~command~
               \token_to_str:N\Arrow.~ You~can~create~an~arrow~going~backwards~with~
@@ -406,8 +442,8 @@
               the~option~"<-"~of~Tikz.}
 \msg_new:nnn {witharrows}
              {Too~few~lines~for~an~arrow}
-             {There~is~at~least~an~arrow~that~can't~be~drawn~because~it~arrives~after~the~
-              last~line~of~the~environment.}
+             {An~arrow~specified~in~line~\int_use:N \l__wa_initial_int\ can't~be~drawn~
+              because~it~arrives~after~the~last~line~of~the~environment.}
 \msg_new:nnn {witharrows}
              {{WithArrows}~used~outside~math~mode}
              {The~environment~\{WithArrows\}~should~be~used~only~in~math~mode.~
@@ -426,9 +462,9 @@
                    6 {groups}}"~
               previously~set~in~the~same~
               \int_case:nn\l__wa_level_int
-                   {0 {command~\token_to_str:N\WithArrowsOptions}
-                    1 {declaration~of~options~of~the~environment~\{WithArrows\}}
-                    2 {command~\token_to_str:N\Arrow}}.~
+                   {1 {command~\token_to_str:N\WithArrowsOptions}
+                    2 {declaration~of~options~of~the~environment~\{WithArrows\}}
+                    3 {command~\token_to_str:N\Arrow}}.~
               If~you~go~on,~I~will~overwrite~the~first~option.}
 \msg_new:nnnn {witharrows}
               {All~lines~must~have~an~ampersand}



More information about the tex-live-commits mailing list