diff options
author | Karl Berry <karl@freefriends.org> | 2018-11-02 20:53:13 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-11-02 20:53:13 +0000 |
commit | 81ff1d170397a06ef756be4f72edcbb12886d187 (patch) | |
tree | 8fb6eaac75e605bc35477ab07cbc7b9e1e388e16 /Master/texmf-dist | |
parent | 1497b86192848950669e33be4a1a916199d768e0 (diff) |
witharrows (2nov18)
git-svn-id: svn://tug.org/texlive/trunk@49054 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/witharrows/README.md | 27 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/witharrows/witharrows.pdf | bin | 321825 -> 328060 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/witharrows/witharrows.dtx | 314 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/witharrows/witharrows.sty | 148 |
4 files changed, 324 insertions, 165 deletions
diff --git a/Master/texmf-dist/doc/latex/witharrows/README.md b/Master/texmf-dist/doc/latex/witharrows/README.md index dd874066dcb..1c2534bc9c2 100644 --- a/Master/texmf-dist/doc/latex/witharrows/README.md +++ b/Master/texmf-dist/doc/latex/witharrows/README.md @@ -1,9 +1,24 @@ -The LaTeX extension witharrows is distributed under the LPPL 1.3 license. +# Readme for the package witharrows -This extension has been written by F. Pantigny (fpantigny@wanadoo.fr). +## License +The LaTeX extension `witharrows` is distributed under the LPPL 1.3 license. -This extension is entirely contained in a single file : witharrows.sty +## Presentation +This extension has been written by F. Pantigny (`fpantigny@wanadoo.fr`). -The extension witharrows gives a LaTeX environment {WithArrows} which is similar -to the environment {aligned} of amsmath but which gives the possibility to draw arrows -on the right side of the equations for explanations.
\ No newline at end of file +The extension `witharrows` gives a LaTeX environment `{WithArrows}` which is similar +to the environment `{aligned}` of `amsmath` but which gives the possibility to draw arrows +on the right side of the equations for explanations. + +## Installation + +The package `witharrows` is present in the distributions MiKTeX, TeXLive and MacTeX. + +For a manual installation: + +* put the files `witharrows.ins` dans `witharrows.dtx` in the same directory; +* run `latex witharrows.ins`. + +The file `witharrows.sty` will be generated. + +The file `witharrows.sty` is the only file necessary to use the extension `witharrows`. diff --git a/Master/texmf-dist/doc/latex/witharrows/witharrows.pdf b/Master/texmf-dist/doc/latex/witharrows/witharrows.pdf Binary files differindex 17b8fde1193..3c88afc583b 100644 --- a/Master/texmf-dist/doc/latex/witharrows/witharrows.pdf +++ b/Master/texmf-dist/doc/latex/witharrows/witharrows.pdf diff --git a/Master/texmf-dist/source/latex/witharrows/witharrows.dtx b/Master/texmf-dist/source/latex/witharrows/witharrows.dtx index a40d66b2476..1b3ae26aa8b 100644 --- a/Master/texmf-dist/source/latex/witharrows/witharrows.dtx +++ b/Master/texmf-dist/source/latex/witharrows/witharrows.dtx @@ -15,8 +15,8 @@ % % \fi % \iffalse -\def\myfileversion{1.10.1} -\def\myfiledate{2018/09/24} +\def\myfileversion{1.11} +\def\myfiledate{2018/11/02} % % %<*batchfile> @@ -484,7 +484,7 @@ version 2005/12/01 or later. % \end{WithArrows}$ % % \medskip -% Special commands are available in |CodeAfter|: a command |\NbLines| which gives the number of lines (=rows) of +% Special commands are available in |CodeAfter|: a command |\WithArrowsNbLines| which gives the number of lines (=rows) of % the current environment (this is a command and not a counter), a special form of the command |\Arrow| and the % command |\MultiArrow|: these commands are described in the section concerning the nested environments, % p.~\pageref{NestedEnv}. @@ -1237,7 +1237,9 @@ version 2005/12/01 or later. % \pkg{nccmath} if this package is loaded). % % If the option |leqno| is used as a class option, the labels will be composed on the left also for the -% environments |{DispWithArrows}| et |{DispWithArrows*}|. +% environments |{DispWithArrows}| and |{DispWithArrows*}|.\footnote{The package \pkg{amsmath} has an option |leqno| +% but \pkg{witharrows}, of course, is not aware of that option: \pkg{witharrows} only checks the option |leqno| of +% the document class.} % % \bigskip % The environment |{DispWithArrows}| is similar to the environment |{align}| of \pkg{amsmath}. However, @@ -1294,6 +1296,8 @@ version 2005/12/01 or later. % |{DispWithArrows}| or |{DispWithArrows*}|. However, it applies to the instructions |\Arrow| and |\MultiArrow| of % the |CodeAfter| of the environments |{DispWithArrows}| or |{DispWithArrows*}|. % +% +% % \section{Advanced features} % % @@ -1322,13 +1326,13 @@ version 2005/12/01 or later. % \begin{Verbatim} % \begin{WithArrows}[ygap=5pt,interline=4mm, % ~emphase#TikzCode = {\draw[rounded corners]@ -% ~emphase# (~#1) -- ($(~#1) + (5mm,0)$)@ +% ~emphase# (~#1) -- ([xshift=5mm]~#1)@ % ~emphase# -- node[circle,@ % ~emphase# draw,@ % ~emphase# auto = false,@ % ~emphase# fill = gray!50,@ % ~emphase# inner sep = 1pt] {\tiny ~#3}@ -% ~emphase# ($(~#2) + (5mm,0)$)@ +% ~emphase# ([xshift=5mm]~#2)@ % ~emphase# -- (~#2) ; }@] % E & \Longleftrightarrow 3 (2x+4) = 6 \Arrow{$\div 3$} \\ % & \Longleftrightarrow 2x+4 = 2 \Arrow{$-4$} \\ @@ -1343,13 +1347,13 @@ version 2005/12/01 or later. % TikzCode = {\draw[rounded corners] % (#1) % -- -% ($(#1) + (5mm,0)$) +% ([xshift=5mm]#1) % -- node[circle, % draw, % auto=false, % fill=gray!50, % inner sep = 1pt] {\tiny #3} -% ($(#2) + (5mm,0)$) +% ([xshift=5mm]#2) % -- % (#2) ; }] % E & \Longleftrightarrow 3 (2x+4) = 6 @@ -1361,6 +1365,28 @@ version 2005/12/01 or later. % & \Longleftrightarrow 2x = -1 % \end{WithArrows}\] % +% +% \bigskip +% The environments |{DispWithArrows}| and its starred version |{DispWithArrows*}| provide a command +% |\WithArrowsRightX| which can be used in a definition of |TikzCode|. This command gives the +% $x$-value of the right side of the composition box (taking into account the eventual tags of the equations). For +% an example of use, see p.~\pageref{example-WithArrowsRightX}. +% +% \bigskip +% \subsection{The command WithArrowsNewStyle} +% +% The extension \pkg{witharrows} provides a command |\WithArrowsNewStyle| to define styles in a way similar to the +% ``styles'' of Tikz. +% +% 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. +% +% 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}|). +% +% For an example of use, see p.~\pageref{example-WithArrowsRightX}. +% % \bigskip % \subsection{Footnotes in the environments of witharrows} % @@ -1509,7 +1535,7 @@ version 2005/12/01 or later. % draws the arrow itself and the second puts the label in a Tikz node in the rectangle delimited by the arrow. % % \begin{Verbatim} -% $\begin{WithArrows}[ +% \begin{DispWithArrows*}[ % displaystyle, % ygap = 2mm, % ystart = 0mm, @@ -1523,7 +1549,7 @@ version 2005/12/01 or later. % % % \bigskip -% $\begin{WithArrows}[ +% \begin{DispWithArrows*}[ % displaystyle, % ygap = 2mm, % ystart = 0mm, @@ -1541,10 +1567,73 @@ version 2005/12/01 or later. % \Arrow{sum of terms of a geometric progression of ratio $e^{i\frac{2\pi}n}$}\\ % & = \frac1n \Re \left( \frac{1-\bigl(e^{i\frac{\pi}{2n}}\bigr)^n}{1-e^{i\frac{\pi}{2n}}}\right)\\ % & = \frac1n \Re \left(\frac{1-i}{1-e^{i\frac{\pi}{2n}}}\right) -% \end{WithArrows}$ +% \end{DispWithArrows*} % % \bigskip % \subsubsection{Example 2} +% +% \label{example-WithArrowsRightX} +% It's possible to modify the previous example to have the ``|text width|'' automatically computed with the right +% margin (in a way similar as the |wrap-lines| option) in the environments |{DispWithArrows}| +% and |{DispWithArrows*}|. In the definition of |TikzCode|, we use the command |\WithArrowsRightX| which is the +% $x$-value of the right margin of the current composition box (it's a TeX command and not a dimension). +% For lisibilit, we use a style. This example requires the Tikz library \pkg{calc}. +% +% \begin{Verbatim} +% \WithArrowsNewStyle{MyStyle}% +% {displaystyle, +% ygap = 2mm, +% xoffset = 0pt, +% ystart = 0mm, +% TikzCode = {\path let \p1 = (~#~#1) +% in (~#~#1) +% -- node [anchor = west, +% text width = {~emphase#\WithArrowsRightX@ - \x1 - 0.5 em}] +% {~#~#3} +% (~#~#2) ; +% \draw let \p1 = (~#~#1) +% in (~#~#1) -- ++(~emphase#\WithArrowsRightX@ - \x1,0) |- (~#~#2) ; }} +% \end{Verbatim} +% +% \begin{Verbatim} +%\begin{DispWithArrows}[MyStyle] +% S_n +% & = \frac1n \sum_{k=0}^{n-1}\cos\bigl(\tfrac{\pi}2\cdot\tfrac kn\bigr) +% \Arrow{$\cos x = \Re(e^{ix})$}\\ +% ........... +% \end{Verbatim} +% +% \WithArrowsNewStyle{MyStyle}% +% {displaystyle, +% ygap = 2mm, +% xoffset = 0pt, +% ystart = 0mm, +% TikzCode = {\path let \p1 = (##1) +% in (##1) +% -- node [anchor = west, +% text width = {\WithArrowsRightX - \x1 - 0.5 em}] {##3} +% (##2) ; +% \draw let \p1 = (##1) +% in (##1) -- ++(\WithArrowsRightX - \x1,0) |- (##2) ; }} +% +%\begin{DispWithArrows}[MyStyle] +% S_n +% & = \frac1n \sum_{k=0}^{n-1}\cos\bigl(\tfrac{\pi}2\cdot\tfrac kn\bigr) +% \Arrow{$\cos x = \Re(e^{ix})$}\\ +% & = \frac1n\sum_{k=0}^{n-1} \Re\left(e^{i\frac{k\pi}{2n}}\right) +% \Arrow{$\Re(z+z')=\Re(z)+\Re(z')$}\\ +% & = \frac1n \Re\left(\sum_{k=0}^{n-1} e^{i\frac{k\pi}{2n}}\right) +% \Arrow{$\exp$ is a morphism for $\times$ et $+$} \\ +% & = \frac1n \Re \left(\sum_{k=0}^{n-1}\bigl(e^{i\frac{\pi}{2n}}\bigr)^k\right) +% \Arrow{sum of terms of a geometric progression of ratio $e^{i\frac{2\pi}n}$}\\ +% & = \frac1n \Re \left( \frac{1-\bigl(e^{i\frac{\pi}{2n}}\bigr)^n}{1-e^{i\frac{\pi}{2n}}}\right)\\ +% & = \frac1n \Re \left(\frac{1-i}{1-e^{i\frac{\pi}{2n}}}\right) +% \end{DispWithArrows} +% +% +% +% \bigskip +% \subsubsection{Example 3} % % In the following example, we change the shape of the arrow depending on wether the start row is longer than the % end row or not. This example requires the Tikz library \pkg{calc}. @@ -1615,13 +1704,13 @@ version 2005/12/01 or later. % % \begin{Verbatim} % \NewDocumentCommand \NumberedLoop {} -% {\foreach \j in {2,...,\NbLines} +% {\foreach \j in {2,...,\WithArrowsNbLines} % { \pgfmathtruncatemacro{\i}{\j-1} % \Arrow[rr]{\i}{\j}{\i} } -% \Arrow[rr,xoffset=1cm,tikz=<-]{1}{\NbLines}{\NbLines}} +% \Arrow[rr,xoffset=1cm,tikz=<-]{1}{\WithArrowsNbLines}{\WithArrowsNbLines}} % \end{Verbatim} % -% The command |\NbLines| is a command available in |CodeAfter| which gives the total number of lines (=rows) of the +% The command |\WithArrowsNbLines| is a command available in |CodeAfter| which gives the total number of lines (=rows) of the % current environment (it's a command and not a counter). % % @@ -1639,10 +1728,10 @@ version 2005/12/01 or later. % \bigskip % \begin{scope} % \NewDocumentCommand \NumberedLoop {} -% {\foreach \j in {2,...,\NbLines} +% {\foreach \j in {2,...,\WithArrowsNbLines} % { \pgfmathtruncatemacro{\i}{\j-1} % \Arrow[rr]{\i}{\j}{\i} } -% \Arrow[rr,xoffset=1cm,tikz=<-]{1}{\NbLines}{\NbLines}} +% \Arrow[rr,xoffset=1cm,tikz=<-]{1}{\WithArrowsNbLines}{\WithArrowsNbLines}} % % % $\begin{WithArrows}[CodeAfter = \NumberedLoop] @@ -1842,8 +1931,10 @@ version 2005/12/01 or later. % \subsection{Some technical definitions} % % \begin{macrocode} -\cs_new_protected:Nn \@@_msg_error:n +\cs_new_protected:Nn \@@_error:n {\msg_error:nn {witharrows} {#1}} +\cs_new_protected:Nn \@@_error:nn + {\msg_error:nnn {witharrows} {#1} {#2}} % \end{macrocode} % % \medskip @@ -1930,10 +2021,11 @@ version 2005/12/01 or later. % \subsection{Variables} % % -% The boolean |\l_@@_in_witharrows_bool| will be raised if (and only if) we are in an environment |{WithArrows}| -% (and not in an environment |{DispWithArrows}| or |{DispWithArrows*}|). +% The boolean |\l_@@_in_WithArrows_bool| will be raised in an environment |{WithArrows}| and the +% boolean |\l_@@_in_dispwitharrows_bool| in a an environment |{DispWithArrows}| or |{DispWithArrows*}|. % \begin{macrocode} -\bool_new:N \l_@@_in_witharrows_bool +\bool_new:N \l_@@_in_WithArrows_bool +\bool_new:N \l_@@_in_DispWithArrows_bool % \end{macrocode} % % The following sequence is the position of the last environment |{WithArrows}| in the tree of the nested @@ -2066,7 +2158,7 @@ version 2005/12/01 or later. % \begin{macrocode} \seq_new:N \l_@@_labels_seq \cs_set:Nn \@@_label:n {\seq_if_empty:NF \l_@@_labels_seq - {\@@_msg_error:n {Multiple~labels}} + {\@@_error:n {Multiple~labels}} \seq_put_right:Nn \l_@@_labels_seq {#1} % \end{macrocode} % @@ -2133,17 +2225,17 @@ version 2005/12/01 or later. % |{DispWithArrows}| or |{DispWithArrows*}| % \begin{macrocode} \keys_define:nn {WithArrows/GlobalOrEnv} - { t .code:n = {\bool_if:NTF \l_@@_in_witharrows_bool - {\int_set:Nn \l_@@_pos_env_int 0} - {\@@_msg_error:n {Option~will~be~ignored}}}, + { t .code:n = {\bool_if:NTF \l_@@_in_DispWithArrows_bool + {\@@_error:n {Option~will~be~ignored} + {\int_set:Nn \l_@@_pos_env_int 0}}}, t .value_forbidden:n = true, - c .code:n = {\bool_if:NTF \l_@@_in_witharrows_bool - {\int_set:Nn \l_@@_pos_env_int 1} - {\@@_msg_error:n {Option~will~be~ignored}}}, + c .code:n = {\bool_if:NTF \l_@@_in_DispWithArrows_bool + {\@@_error:n {Option~will~be~ignored}} + {\int_set:Nn \l_@@_pos_env_int 1}}, c .value_forbidden:n = true, - b .code:n = {\bool_if:NTF \l_@@_in_witharrows_bool - {\int_set:Nn \l_@@_pos_env_int 2} - {\@@_msg_error:n {Option~will~be~ignored}}}, + b .code:n = {\bool_if:NTF \l_@@_in_DispWithArrows_bool + {\@@_error:n {Option~will~be~ignored}} + {\int_set:Nn \l_@@_pos_env_int 2}}, b .value_forbidden:n = true, % \end{macrocode} % @@ -2228,7 +2320,7 @@ version 2005/12/01 or later. % leftmost position. % \begin{macrocode} group .code:n = {\int_compare:nNnT \l_@@_previous_pos_arrows_int > {-1} - {\@@_msg_error:n {Two~options~are~incompatible}} + {\@@_error:n {Two~options~are~incompatible}} \int_set:Nn \l_@@_previous_pos_arrows_int 6 \int_set:Nn \l_@@_pos_arrows_int 6} , group .value_forbidden:n = true, @@ -2241,7 +2333,7 @@ version 2005/12/01 or later. % for a individual key. % \begin{macrocode} groups .code:n = {\int_compare:nNnT \l_@@_previous_pos_arrows_int > {-1} - {\@@_msg_error:n {Two~options~are~incompatible}} + {\@@_error:n {Two~options~are~incompatible}} \int_set:Nn \l_@@_previous_pos_arrows_int 7 \int_set:Nn \l_@@_pos_arrows_int 7} , groups .value_forbidden:n = true, @@ -2252,7 +2344,7 @@ version 2005/12/01 or later. % the eventual |\begin{savenotes}|). % \begin{macrocode} CodeBefore .code:n = {\int_compare:nNnTF \l_@@_level_int = 1 - {\@@_msg_error:n {Option~will~be~ignored}} + {\@@_error:n {Option~will~be~ignored}} {\tl_put_right:Nn \l_@@_code_before_tl {#1}}} , CodeBefore .value_required:n = true, % \end{macrocode} @@ -2262,7 +2354,7 @@ version 2005/12/01 or later. % eventual |\end{savenotes}|). % \begin{macrocode} CodeAfter .code:n = {\int_compare:nNnTF \l_@@_level_int = 1 - {\@@_msg_error:n {Option~will~be~ignored}} + {\@@_error:n {Option~will~be~ignored}} {\tl_put_right:Nn \l_@@_code_after_tl {#1}}} , CodeAfter .value_required:n = true, % \end{macrocode} @@ -2273,7 +2365,7 @@ version 2005/12/01 or later. % the environment). % \begin{macrocode} name .code:n = {\int_compare:nNnTF \l_@@_level_int = 1 - {\@@_msg_error:n {Option~will~be~ignored}} + {\@@_error:n {Option~will~be~ignored}} {\tl_set:Nn \l_@@_name_tl {#1}}} , name .value_required:n = true, % \end{macrocode} @@ -2281,8 +2373,8 @@ version 2005/12/01 or later. % \bigskip % The option |fleqn| indicates wether the environments |{DispWithArrows}| are composed centered or flush left. % \begin{macrocode} - fleqn .code:n = {\bool_if:NTF \l_@@_in_witharrows_bool - {\@@_msg_error:n {Option~will~be~ignored}} + fleqn .code:n = {\bool_if:NTF \l_@@_in_WithArrows_bool + {\@@_error:n {Option~will~be~ignored}} {\tl_if_eq:nnTF {#1} {true} {\bool_set_true:N \l_@@_fleqn_bool} {\bool_set_false:N \l_@@_fleqn_bool}}}, @@ -2292,8 +2384,8 @@ version 2005/12/01 or later. % \bigskip % The option |mathindent| is the left margin of the environments |{DispWithArrows}| when the option |fleqn| is used. % \begin{macrocode} - mathindent .code:n = {\bool_if:NTF \l_@@_in_witharrows_bool - {\@@_msg_error:n {Option~will~be~ignored}} + mathindent .code:n = {\bool_if:NTF \l_@@_in_WithArrows_bool + {\@@_error:n {Option~will~be~ignored}} {\dim_set:Nn \l_@@_mathindent_dim {#1}}}, mathindent .value_required:n = true, % \end{macrocode} @@ -2301,8 +2393,8 @@ version 2005/12/01 or later. % \bigskip % The option |notag| indicates wether the environments |{DispWithArrows}| will be without tags (like |{DispWithArrows*}|). % \begin{macrocode} - notag .code:n = {\bool_if:NTF \l_@@_in_witharrows_bool - {\@@_msg_error:n {Option~will~be~ignored}} + notag .code:n = {\bool_if:NTF \l_@@_in_WithArrows_bool + {\@@_error:n {Option~will~be~ignored}} {\tl_if_eq:nnTF {#1} {true} {\bool_set_true:N \l_@@_notag_bool} {\bool_set_false:N \l_@@_notag_bool}}}, @@ -2314,8 +2406,8 @@ version 2005/12/01 or later. % The option |AllowMultipleLabels| indicates wether multiple labels are allowed for the same line of an environment % |{DispWithArrows}| or |{DispWithArrows*}|. % \begin{macrocode} - AllowMultipleLabels .code:n = {\bool_if:NTF \l_@@_in_witharrows_bool - {\@@_msg_error:n {Option~will~be~ignored}} + AllowMultipleLabels .code:n = {\bool_if:NTF \l_@@_in_WithArrows_bool + {\@@_error:n {Option~will~be~ignored}} {\msg_redirect_name:nnn {witharrows} {Multiple~labels} {none}}}, @@ -2326,15 +2418,15 @@ version 2005/12/01 or later. % With the option |wrap-lines|, a special |TikzCode| is used in the environments |{DispWithArrows}| and % |{DispWithArrows*}| and, with this |TikzCode|, the lines of the labels are automatically wrapped on the right. % \begin{macrocode} - wrap-lines .code:n = {\bool_if:NTF \l_@@_in_witharrows_bool - {\@@_msg_error:n {Option~will~be~ignored}} + wrap-lines .code:n = {\bool_if:NTF \l_@@_in_WithArrows_bool + {\@@_error:n {Option~will~be~ignored}} {\tl_if_eq:nnTF {#1} {true} {\bool_set_true:N \l_@@_wrap_lines_bool} {\bool_set_false:N \l_@@_wrap_lines_bool}}}, wrap-lines .default:n = true, % \end{macrocode} % \begin{macrocode} - unknown .code:n = \@@_msg_error:n {Option~unknown} + unknown .code:n = \@@_error:n {Option~unknown} } % \end{macrocode} % @@ -2378,7 +2470,7 @@ version 2005/12/01 or later. % \begin{macrocode} xoffset .code:n = {\bool_if:nTF {\int_compare_p:nNn \l_@@_level_int = 3 && \int_compare_p:nNn \l_@@_pos_arrows_int > 5} - {\@@_msg_error:n {Option~incompatible~with~"group(s)"}} + {\@@_error:n {Option~incompatible~with~"group(s)"}} {\dim_set:Nn \l_@@_xoffset_dim {#1}}} , xoffset .value_required:n = true, % \end{macrocode} @@ -2390,7 +2482,7 @@ version 2005/12/01 or later. % \begin{macrocode} jot .code:n = {\int_compare:nNnTF \l_@@_level_int = 2 {\dim_set:Nn \jot {#1}} - {\@@_msg_error:n {Option~will~be~ignored}}} , + {\@@_error:n {Option~will~be~ignored}}} , jot .value_required:n = true, % \end{macrocode} % @@ -2401,15 +2493,15 @@ version 2005/12/01 or later. % \begin{macrocode} interline .code:n = {\int_compare:nNnTF \l_@@_level_int = 2 {\skip_set:Nn \l_@@_interline_skip {#1}} - {\@@_msg_error:n {Option~will~be~ignored}}} , + {\@@_error:n {Option~will~be~ignored}}} , interline .value_required:n = true, % \end{macrocode} % % \bigskip % Eventually, a key |jump| (see below) and a key for unknown keys. % \begin{macrocode} - jump .code:n = \@@_msg_error:n {Option~will~be~ignored} , - unknown .code:n = \@@_msg_error:n {Option~unknown} + jump .code:n = \@@_error:n {Option~will~be~ignored} , + unknown .code:n = \@@_error:n {Option~unknown} } % \end{macrocode} % @@ -2422,7 +2514,7 @@ version 2005/12/01 or later. \keys_define:nn {WithArrows/jump} {jump .code:n = {\int_set:Nn \l_@@_jump_int {#1} \int_compare:nNnF \l_@@_jump_int > 0 - {\@@_msg_error:n {The~option~"jump"~must~be~non~negative}}} , + {\@@_error:n {The~option~"jump"~must~be~non~negative}}} , jump .value_required:n = true} % \end{macrocode} % @@ -2432,7 +2524,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Nn \@@_analyze_option_position:n {\int_compare:nNnT \l_@@_previous_pos_arrows_int > {-1} - {\@@_msg_error:n {Two~options~are~incompatible}} + {\@@_error:n {Two~options~are~incompatible}} \int_set:Nn \l_@@_previous_pos_arrows_int {#1} % \end{macrocode} % @@ -2443,7 +2535,7 @@ version 2005/12/01 or later. % \begin{macrocode} \bool_if:nTF { \int_compare_p:nNn \l_@@_level_int = 3 && \int_compare_p:nNn \l_@@_pos_arrows_int > 5} - {\@@_msg_error:n {Option~incompatible~with~"group(s)"}} + {\@@_error:n {Option~incompatible~with~"group(s)"}} {\int_set:Nn \l_@@_pos_arrows_int {#1}}} % \end{macrocode} % @@ -2533,10 +2625,10 @@ version 2005/12/01 or later. \cs_new_protected:Nn \@@_Arrow_first_column: % \end{macrocode} % All messages of LaTeX3 must be \emph{fully expandable} and that's why we do the affectation (necessary for a -% comparison) before the |\msg_error:nn|. +% comparison) before the |\@@_error:n|. % \begin{macrocode} {\tl_set:Nn \l_tmpa_tl {Arrow} - \@@_msg_error:n {Arrow~in~first~column} + \@@_error:n {Arrow~in~first~column} \@@_Arrow} % \end{macrocode} % @@ -2650,9 +2742,9 @@ version 2005/12/01 or later. % Now, we begin the environment |{WithArrows}|. % \begin{macrocode} \NewDocumentEnvironment {WithArrows} {O{}} - { \bool_set_true:N \l_@@_in_witharrows_bool + { \bool_set_true:N \l_@@_in_WithArrows_bool \reverse_if:N \if_mode_math: - \@@_msg_error:n {{WithArrows}~used~outside~math~mode} + \@@_error:n {{WithArrows}~used~outside~math~mode} \fi: \cs_set:Npn \notag {\msg_error:nnn {witharrows} {Command~not~allowed~in~{WithArrows}} @@ -2746,7 +2838,7 @@ version 2005/12/01 or later. % Usually, the |\halign| of an environment |{WithArrows}| will have exactly two columns. Nevertheless, if the user % wants to use more columns (without arrows) it's possible with the option |MoreColumns|. % \begin{macrocode} - && \@@_msg_error:n {Third~column~in~an~environment~{WithArrows}} + && \@@_error:n {Third~column~in~an~environment~{WithArrows}} $\bool_if:NT \l_@@_displaystyle_bool \displaystyle {##}$ \cr } @@ -2782,7 +2874,13 @@ version 2005/12/01 or later. % an \textsc{pgf} error for an unknown node since the nodes are created in the second column). % \begin{macrocode} {\int_compare:nNnT \g_@@_line_bis_int < \g_@@_line_int - {\@@_msg_error:n {All~lines~must~have~an~ampersand}} + {\@@_error:n {All~lines~must~have~an~ampersand}} +% \end{macrocode} +% +% \bigskip +% The command |\WithArrowsRightX| is not used by \pkg{witharrows}. It's only a convenience given to the user. +% \begin{macrocode} + \cs_set:Npn \WithArrowsRightX {\g_@@_right_x_dim} % \end{macrocode} % % \bigskip @@ -2806,9 +2904,9 @@ version 2005/12/01 or later. \group_begin: \tikzset{every~picture/.style = @@_standard} % \end{macrocode} -% The command |\NbLines| is not used by \pkg{witharrows}. It's only a convenience given to the user. +% The command |\WithArrowsNbLines| is not used by \pkg{witharrows}. It's only a convenience given to the user. % \begin{macrocode} - \cs_set:Npn \NbLines {\int_use:N \g_@@_line_int} + \cs_set:Npn \WithArrowsNbLines {\int_use:N \g_@@_line_int} % \end{macrocode} % The command |\MultiArrow| is available in |CodeAfter|, and we have a special version of |\Arrow|, called % ``|\Arrow| in |CodeAfter|'' in the documentation.\footnote{As for now, |\MultiArrow| has no option, and that's @@ -2878,7 +2976,7 @@ version 2005/12/01 or later. % For the environment |{DispWithArrows}|, the behaviour of |\\| is different because we add the third column which % is the column for the tag (number of the equation). % \begin{macrocode} - \bool_if:NF \l_@@_in_witharrows_bool + \bool_if:NT \l_@@_in_DispWithArrows_bool {\bool_if:NTF \l_@@_notag_bool % \end{macrocode} % If there is no tag to put, we use as well the third column because you want to raise an error if the user uses @@ -3007,9 +3105,9 @@ version 2005/12/01 or later. % \begin{macrocode} \bool_if:NT \c_@@_amsmath_loaded_bool \intertext@ \if_mode_math: - \@@_msg_error:n {{DispWithArrows}~used~in~math~mode} + \@@_error:n {{DispWithArrows}~used~in~math~mode} \fi: - \bool_set_false:N \l_@@_in_witharrows_bool + \bool_set_true:N \l_@@_in_DispWithArrows_bool \@@_pre_environment:n {#1} % \end{macrocode} % We don't use |\[| of LaTeX because some extensions, like \pkg{autonum}, do a redefinition of |\[|. However, we @@ -3080,7 +3178,7 @@ version 2005/12/01 or later. -\int_use:N\g_@@_line_int}} & ## \tabskip = \c_zero_skip - && \@@_msg_error:n {Third~column~in~an~environment~{DispWithArrows}} + && \@@_error:n {Third~column~in~an~environment~{DispWithArrows}} \iffalse ## \fi \cr} {\\ @@ -3094,21 +3192,21 @@ version 2005/12/01 or later. \egroup % \end{macrocode} % -% If the option |wrap-lines| is used (only in |{DispWithArrows}| and |{DispWithArrows*}|), we compute -% |\g_@@_x_right_dim|. As a first approximation, |\g_@@_x_right_dim| is the $x$-value of the right side of the -% current composition box. In fact, we must take into account the potential labels of the equations. That's why -% we compute |\g_@@_x_right_dim| with the |v|-nodes of each row specifically built in this goal. |\g_@@_x_right_dim| -% is the minimal value of the $x$-value of these nodes. +% If we are in an environment |{DispWithArrows}| or |{DispWithArrows*}|, we compute the dimension +% |\g_@@_right_x_dim|. As a first approximation, |\g_@@_right_x_dim| is the $x$-value of the right side of the +% current composition box. In fact, we must take into account the potential labels of the equations. That's why we +% compute |\g_@@_right_x_dim| with the |v|-nodes of each row specifically built in this goal. |\g_@@_right_x_dim| +% is the minimal value of the $x$-value of these nodes. % \begin{macrocode} - \bool_if:NT \l_@@_wrap_lines_bool - {\dim_gzero_new:N \g_@@_x_right_dim - \dim_gset:Nn \g_@@_x_right_dim \c_max_dim + \bool_if:NT \l_@@_in_DispWithArrows_bool + {\dim_gzero_new:N \g_@@_right_x_dim + \dim_gset:Nn \g_@@_right_x_dim \c_max_dim \begin{tikzpicture} [@@_standard] \int_step_variable:nnnNn 1 1 \g_@@_line_int \l_tmpa_int {\tikz@parse@node\pgfutil@firstofone (\l_tmpa_int-v) \dim_set:Nn \l_tmpa_dim \pgf@x - \dim_compare:nNnT \l_tmpa_dim < \g_@@_x_right_dim - {\dim_gset:Nn \g_@@_x_right_dim \l_tmpa_dim} } + \dim_compare:nNnT \l_tmpa_dim < \g_@@_right_x_dim + {\dim_gset:Nn \g_@@_right_x_dim \l_tmpa_dim} } \end{tikzpicture}} % \end{macrocode} % @@ -3150,12 +3248,12 @@ version 2005/12/01 or later. \tl_set:Nn \l_@@_tag_tl {#2} \bool_set:Nn \l_@@_tag_star_bool {#1} % \end{macrocode} -% The starred version |\tag*| can't be use if \pkg{amsmath} has not been loaded because this version does the job +% The starred version |\tag*| can't be used if \pkg{amsmath} has not been loaded because this version does the job % by desactivating the command |\tagform@| inserted by \pkg{amsmath} in the (two versions of the) command % |\@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} - { \@@_msg_error:n {tag*~without~amsmath} } + { \@@_error:n {tag*~without~amsmath} } } % \end{macrocode} % @@ -3334,11 +3432,11 @@ version 2005/12/01 or later. % the case where the user goes on and we try to avoid other errors.} % \begin{macrocode} \int_compare:nNnTF \l_@@_final_int > \g_@@_line_int - {\@@_msg_error:n {Too~few~lines~for~an~arrow}} + {\@@_error:n {Too~few~lines~for~an~arrow}} {\cs_if_free:cTF{pgf@sh@ns@wa-\l_@@_prefix_str-\int_use:N\l_@@_initial_int-l} - { \@@_msg_error:n {A~PGF~node~doesn't~exist} } + { \@@_error:n {A~PGF~node~doesn't~exist} } {\cs_if_free:cTF{pgf@sh@ns@wa-\l_@@_prefix_str-\int_use:N\l_@@_final_int-l} - { \@@_msg_error:n {A~PGF~node~doesn't~exist} } + { \@@_error:n {A~PGF~node~doesn't~exist} } {\@@_draw_arrows_i:}}} \int_incr:N \l_@@_arrow_int } @@ -3515,7 +3613,7 @@ version 2005/12/01 or later. % If the option |wrap-lines| is used, we have to use a special version of |\l_@@_tikz_code_tl| (which corresponds % to the option |TikzCode|). % \begin{macrocode} - \bool_if:nT {\l_@@_wrap_lines_bool && ! \l_@@_in_witharrows_bool} + \bool_if:nT {\l_@@_wrap_lines_bool && \l_@@_in_DispWithArrows_bool} { \tl_set_eq:NN \l_@@_tikz_code_tl \c_@@_tikz_code_wrap_lines_tl } % \end{macrocode} % @@ -3544,9 +3642,9 @@ version 2005/12/01 or later. % \end{macrocode} % We compute in |\l_tmpa_dim| the maximal width possible for the label. |0.3333 em| is the default value of % |inner sep| in the nodes of Tikz. Maybe we should put the exact Tikz parameter. Here is the use of -% |\g_@@_x_right_dim| which has been computed previously with the |v|-nodes. +% |\g_@@_right_x_dim| which has been computed previously with the |v|-nodes. % \begin{macrocode} - \dim_set:Nn \l_tmpa_dim {\g_@@_x_right_dim - \pgf@x - 0.3333 em} + \dim_set:Nn \l_tmpa_dim {\g_@@_right_x_dim - \pgf@x - 0.3333 em} % \end{macrocode} % We retrieve in |\g_tmpa_tl| the current value of the Tikz parameter ``|text width|''.\footnote{In fact, it's not % the current value of ``|text width|'': it's the value of ``|text width|'' set in the option |tikz| provided by @@ -3562,7 +3660,7 @@ version 2005/12/01 or later. \dim_compare:nNnT \l_tmpb_dim < \l_tmpa_dim {\dim_set_eq:NN \l_tmpa_dim \l_tmpb_dim}} % \end{macrocode} -% Now, we can put the label with the right value for |``text width''|. +% Now, we can put the label with the right value for ``|text width|''. % \begin{macrocode} \dim_compare:nNnT \l_tmpa_dim > \c_zero_dim {\path (@@_label.west) @@ -3700,7 +3798,7 @@ version 2005/12/01 or later. % We sort the list |\g_tmpa_clist| because we want to extract the minimum and the maximum. % \begin{macrocode} \int_compare:nNnTF {\clist_count:N \g_tmpa_clist} < 2 - {\@@_msg_error:n {Too~small~specification~for~MultiArrow}} + {\@@_error:n {Too~small~specification~for~MultiArrow}} {\clist_sort:Nn \g_tmpa_clist {\int_compare:nNnTF {##1} > {##2} {\sort_return_swapped:} @@ -3738,8 +3836,8 @@ version 2005/12/01 or later. \dim_set:Nn \l_tmpa_dim {20 cm} \path \pgfextra {\tl_gset:Nx \g_tmpa_tl \tikz@text@width} ; \tl_if_empty:NF \g_tmpa_tl {\dim_set:Nn \l_tmpa_dim \g_tmpa_tl} - \bool_if:nT {\l_@@_wrap_lines_bool && ! \l_@@_in_witharrows_bool} - {\dim_set:Nn \l_tmpb_dim {\g_@@_x_right_dim - \pgf@x - 0.3333 em} + \bool_if:nT {\l_@@_wrap_lines_bool && \l_@@_in_DispWithArrows_bool} + {\dim_set:Nn \l_tmpb_dim {\g_@@_right_x_dim - \pgf@x - 0.3333 em} \dim_compare:nNnT \l_tmpb_dim < \l_tmpa_dim {\dim_set_eq:NN \l_tmpa_dim \l_tmpb_dim}} \path (@@_label.west) @@ -3980,9 +4078,9 @@ version 2005/12/01 or later. \bool_set_true:N \l_@@_notag_bool}} \bool_if:NT \c_@@_amsmath_loaded_bool \intertext@ \if_mode_math: - \@@_msg_error:n {{DispWithArrows}~used~in~math~mode} + \@@_error:n {{DispWithArrows}~used~in~math~mode} \fi: - \bool_set_false:N \l_@@_in_witharrows_bool + \bool_set_true:N \l_@@_in_DispWithArrows_bool % \_@@_pre_environment:n {#2} \nointerlineskip @@ -4042,7 +4140,7 @@ version 2005/12/01 or later. -\int_use:N\g_@@_line_int}} & ## \tabskip = \c_zero_skip - && \@@_msg_error:n {Third~column~in~an~environment~{DispWithArrows}} + && \@@_error:n {Third~column~in~an~environment~{DispWithArrows}} \if_false: ## \fi: \cr} { \\ @@ -4080,6 +4178,35 @@ version 2005/12/01 or later. } % \end{macrocode} % +% \subsection{The command WithArrowsNewStyle} +% +% A new key defined with |\WithArrowsNewStyle| will not be available at the local level (|\l_@@_level_int| = 3). +% \begin{macrocode} +\NewDocumentCommand \WithArrowsNewStyle {mm} + { \keys_if_exist:nnTF {WithArrows/General} {#1} + {\@@_error:nn {Key~already~defined} {#1}} + {\keys_define:nn {WithArrows/General} + {#1 .code:n = {\int_compare:nNnTF \l_@@_level_int < 3 + {\keys_set:nn {WithArrows/General} {#2}} + {\@@_error:n {Option~unknown}}}} +% \end{macrocode} +% We set the options in a TeX group in order to detect if some keys in |#2| are unknown. If a key is unknown, an +% error will be raised. However, the key will, even so, be stored in the definition of key |#1|. When the key |#1| +% will be used, the error will be raised again. +% \begin{macrocode} + \group_begin: + \WithArrowsOptions{#2} + \group_end:} } +% \end{macrocode} +% +% \begin{macrocode} +\msg_new:nnn {witharrows} + {Key~already~defined} + {The~key~'#1'~is~already~defined.~If~you~go~on,~ + your~instruction~\token_to_str:N\WithArrowsNewStyle\ will~be~ignored.} +% \end{macrocode} +% +% % \section{History} % % \subsection{Changes between versions 1.0 and 1.1} @@ -4159,10 +4286,9 @@ version 2005/12/01 or later. % Correction of a bug: |\nointerlineskip| and |\makebox[.6\linewidth]{}| should be inserted in |{DispWithArrows}|. % only in vertical mode. % -% \subsection{Changes between 1.10 and 1.10.1} +% \subsection{Changes between 1.10 and 1.11} % -% The test of collision in the environments |{DispWithArrows}| is deleted (because the programmation was -% incorrect). +% Commands |\WithArrowsNewStyle| and |\WithArrowsRightX|. % % \endinput % diff --git a/Master/texmf-dist/tex/latex/witharrows/witharrows.sty b/Master/texmf-dist/tex/latex/witharrows/witharrows.sty index 0edba169c1d..bcfd92509d5 100644 --- a/Master/texmf-dist/tex/latex/witharrows/witharrows.sty +++ b/Master/texmf-dist/tex/latex/witharrows/witharrows.sty @@ -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.10.1} -\def\myfiledate{2018/09/24} +\def\myfileversion{1.11} +\def\myfiledate{2018/11/02} \RequirePackage{tikz} \usetikzlibrary{arrows.meta,bending} \RequirePackage{l3keys2e} @@ -85,8 +85,10 @@ \DeclareOption {leqno} {\bool_set_true:N \c__ww_leqno_bool} \DeclareOption* {} \ProcessOptions \relax -\cs_new_protected:Nn \__ww_msg_error:n +\cs_new_protected:Nn \__ww_error:n {\msg_error:nn {witharrows} {#1}} +\cs_new_protected:Nn \__ww_error:nn + {\msg_error:nnn {witharrows} {#1} {#2}} \AtBeginDocument{\clist_map_inline:nn {amsmath,mathtools,autonum,cleveref,hyperref,typedref} {\bool_new:c {c__ww_#1_loaded_bool} @@ -115,7 +117,8 @@ {\cs_set_protected:Npn \spread@equation {\openup\jot \cs_set_protected:Npn \spread@equation {}}}} -\bool_new:N \l__ww_in_witharrows_bool +\bool_new:N \l__ww_in_WithArrows_bool +\bool_new:N \l__ww_in_DispWithArrows_bool \seq_new:N \g__ww_position_in_the_tree_seq \seq_gput_right:Nn \g__ww_position_in_the_tree_seq 1 \int_new:N \g__ww_last_env_int @@ -138,7 +141,7 @@ \bool_new:N \l__ww_tag_star_bool \seq_new:N \l__ww_labels_seq \cs_set:Nn \__ww_label:n {\seq_if_empty:NF \l__ww_labels_seq - {\__ww_msg_error:n {Multiple~labels}} + {\__ww_error:n {Multiple~labels}} \seq_put_right:Nn \l__ww_labels_seq {#1} \bool_if:nT \c__ww_mathtools_loaded_bool {\MH_if_boolean:nT {show_only_refs} @@ -155,17 +158,17 @@ \bool_new:N \l__ww_wrap_lines_bool \int_set:Nn \l__ww_level_int 1 \keys_define:nn {WithArrows/GlobalOrEnv} - { t .code:n = {\bool_if:NTF \l__ww_in_witharrows_bool - {\int_set:Nn \l__ww_pos_env_int 0} - {\__ww_msg_error:n {Option~will~be~ignored}}}, + { t .code:n = {\bool_if:NTF \l__ww_in_DispWithArrows_bool + {\__ww_error:n {Option~will~be~ignored} + {\int_set:Nn \l__ww_pos_env_int 0}}}, t .value_forbidden:n = true, - c .code:n = {\bool_if:NTF \l__ww_in_witharrows_bool - {\int_set:Nn \l__ww_pos_env_int 1} - {\__ww_msg_error:n {Option~will~be~ignored}}}, + c .code:n = {\bool_if:NTF \l__ww_in_DispWithArrows_bool + {\__ww_error:n {Option~will~be~ignored}} + {\int_set:Nn \l__ww_pos_env_int 1}}, c .value_forbidden:n = true, - b .code:n = {\bool_if:NTF \l__ww_in_witharrows_bool - {\int_set:Nn \l__ww_pos_env_int 2} - {\__ww_msg_error:n {Option~will~be~ignored}}}, + b .code:n = {\bool_if:NTF \l__ww_in_DispWithArrows_bool + {\__ww_error:n {Option~will~be~ignored}} + {\int_set:Nn \l__ww_pos_env_int 2}}, b .value_forbidden:n = true, ygap .dim_set:N = \l__ww_ygap_dim, ygap .value_required:n = true, @@ -196,57 +199,57 @@ shownodenames .bool_set:N = \l__ww_shownodenames_bool, shownodenames .initial:n = false, group .code:n = {\int_compare:nNnT \l__ww_previous_pos_arrows_int > {-1} - {\__ww_msg_error:n {Two~options~are~incompatible}} + {\__ww_error:n {Two~options~are~incompatible}} \int_set:Nn \l__ww_previous_pos_arrows_int 6 \int_set:Nn \l__ww_pos_arrows_int 6} , group .value_forbidden:n = true, groups .code:n = {\int_compare:nNnT \l__ww_previous_pos_arrows_int > {-1} - {\__ww_msg_error:n {Two~options~are~incompatible}} + {\__ww_error:n {Two~options~are~incompatible}} \int_set:Nn \l__ww_previous_pos_arrows_int 7 \int_set:Nn \l__ww_pos_arrows_int 7} , groups .value_forbidden:n = true, CodeBefore .code:n = {\int_compare:nNnTF \l__ww_level_int = 1 - {\__ww_msg_error:n {Option~will~be~ignored}} + {\__ww_error:n {Option~will~be~ignored}} {\tl_put_right:Nn \l__ww_code_before_tl {#1}}} , CodeBefore .value_required:n = true, CodeAfter .code:n = {\int_compare:nNnTF \l__ww_level_int = 1 - {\__ww_msg_error:n {Option~will~be~ignored}} + {\__ww_error:n {Option~will~be~ignored}} {\tl_put_right:Nn \l__ww_code_after_tl {#1}}} , CodeAfter .value_required:n = true, name .code:n = {\int_compare:nNnTF \l__ww_level_int = 1 - {\__ww_msg_error:n {Option~will~be~ignored}} + {\__ww_error:n {Option~will~be~ignored}} {\tl_set:Nn \l__ww_name_tl {#1}}} , name .value_required:n = true, - fleqn .code:n = {\bool_if:NTF \l__ww_in_witharrows_bool - {\__ww_msg_error:n {Option~will~be~ignored}} + fleqn .code:n = {\bool_if:NTF \l__ww_in_WithArrows_bool + {\__ww_error:n {Option~will~be~ignored}} {\tl_if_eq:nnTF {#1} {true} {\bool_set_true:N \l__ww_fleqn_bool} {\bool_set_false:N \l__ww_fleqn_bool}}}, fleqn .default:n = true, - mathindent .code:n = {\bool_if:NTF \l__ww_in_witharrows_bool - {\__ww_msg_error:n {Option~will~be~ignored}} + mathindent .code:n = {\bool_if:NTF \l__ww_in_WithArrows_bool + {\__ww_error:n {Option~will~be~ignored}} {\dim_set:Nn \l__ww_mathindent_dim {#1}}}, mathindent .value_required:n = true, - notag .code:n = {\bool_if:NTF \l__ww_in_witharrows_bool - {\__ww_msg_error:n {Option~will~be~ignored}} + notag .code:n = {\bool_if:NTF \l__ww_in_WithArrows_bool + {\__ww_error:n {Option~will~be~ignored}} {\tl_if_eq:nnTF {#1} {true} {\bool_set_true:N \l__ww_notag_bool} {\bool_set_false:N \l__ww_notag_bool}}}, notag .default:n = true, nonumber .meta:n = notag, - AllowMultipleLabels .code:n = {\bool_if:NTF \l__ww_in_witharrows_bool - {\__ww_msg_error:n {Option~will~be~ignored}} + AllowMultipleLabels .code:n = {\bool_if:NTF \l__ww_in_WithArrows_bool + {\__ww_error:n {Option~will~be~ignored}} {\msg_redirect_name:nnn {witharrows} {Multiple~labels} {none}}}, AllowMultipleLabels .value_forbidden:n = true, - wrap-lines .code:n = {\bool_if:NTF \l__ww_in_witharrows_bool - {\__ww_msg_error:n {Option~will~be~ignored}} + wrap-lines .code:n = {\bool_if:NTF \l__ww_in_WithArrows_bool + {\__ww_error:n {Option~will~be~ignored}} {\tl_if_eq:nnTF {#1} {true} {\bool_set_true:N \l__ww_wrap_lines_bool} {\bool_set_false:N \l__ww_wrap_lines_bool}}}, wrap-lines .default:n = true, - unknown .code:n = \__ww_msg_error:n {Option~unknown} + unknown .code:n = \__ww_error:n {Option~unknown} } \keys_define:nn {WithArrows/General} {tikz .code:n = \tikzset {WithArrows/arrow/.append~style = {#1}}, @@ -264,32 +267,32 @@ i .code:n = \__ww_analyze_option_position:n 5 , xoffset .code:n = {\bool_if:nTF {\int_compare_p:nNn \l__ww_level_int = 3 && \int_compare_p:nNn \l__ww_pos_arrows_int > 5} - {\__ww_msg_error:n {Option~incompatible~with~"group(s)"}} + {\__ww_error:n {Option~incompatible~with~"group(s)"}} {\dim_set:Nn \l__ww_xoffset_dim {#1}}} , xoffset .value_required:n = true, jot .code:n = {\int_compare:nNnTF \l__ww_level_int = 2 {\dim_set:Nn \jot {#1}} - {\__ww_msg_error:n {Option~will~be~ignored}}} , + {\__ww_error:n {Option~will~be~ignored}}} , jot .value_required:n = true, interline .code:n = {\int_compare:nNnTF \l__ww_level_int = 2 {\skip_set:Nn \l__ww_interline_skip {#1}} - {\__ww_msg_error:n {Option~will~be~ignored}}} , + {\__ww_error:n {Option~will~be~ignored}}} , interline .value_required:n = true, - jump .code:n = \__ww_msg_error:n {Option~will~be~ignored} , - unknown .code:n = \__ww_msg_error:n {Option~unknown} + jump .code:n = \__ww_error:n {Option~will~be~ignored} , + unknown .code:n = \__ww_error:n {Option~unknown} } \keys_define:nn {WithArrows/jump} {jump .code:n = {\int_set:Nn \l__ww_jump_int {#1} \int_compare:nNnF \l__ww_jump_int > 0 - {\__ww_msg_error:n {The~option~"jump"~must~be~non~negative}}} , + {\__ww_error:n {The~option~"jump"~must~be~non~negative}}} , jump .value_required:n = true} \cs_new_protected:Nn \__ww_analyze_option_position:n {\int_compare:nNnT \l__ww_previous_pos_arrows_int > {-1} - {\__ww_msg_error:n {Two~options~are~incompatible}} + {\__ww_error:n {Two~options~are~incompatible}} \int_set:Nn \l__ww_previous_pos_arrows_int {#1} \bool_if:nTF { \int_compare_p:nNn \l__ww_level_int = 3 && \int_compare_p:nNn \l__ww_pos_arrows_int > 5} - {\__ww_msg_error:n {Option~incompatible~with~"group(s)"}} + {\__ww_error:n {Option~incompatible~with~"group(s)"}} {\int_set:Nn \l__ww_pos_arrows_int {#1}}} \NewDocumentCommand \WithArrowsOptions {m} {\int_set:Nn \l__ww_previous_pos_arrows_int {-1} @@ -314,7 +317,7 @@ } \cs_new_protected:Nn \__ww_Arrow_first_column: {\tl_set:Nn \l_tmpa_tl {Arrow} - \__ww_msg_error:n {Arrow~in~first~column} + \__ww_error:n {Arrow~in~first~column} \__ww_Arrow} \cs_new_protected:Nn \__ww_pre_environment:n { \seq_gput_right:NV \g__ww_arrow_int_seq \g__ww_arrow_int @@ -344,9 +347,9 @@ \l__ww_code_before_tl \cs_set_eq:cN \l__ww_CommandName_tl \__ww_Arrow} \NewDocumentEnvironment {WithArrows} {O{}} - { \bool_set_true:N \l__ww_in_witharrows_bool + { \bool_set_true:N \l__ww_in_WithArrows_bool \reverse_if:N \if_mode_math: - \__ww_msg_error:n {{WithArrows}~used~outside~math~mode} + \__ww_error:n {{WithArrows}~used~outside~math~mode} \fi: \cs_set:Npn \notag {\msg_error:nnn {witharrows} {Command~not~allowed~in~{WithArrows}} @@ -389,7 +392,7 @@ \bool_if:NT \l__ww_shownodenames_bool {\hbox_overlap_right:n {\small wa-\l__ww_prefix_str -\int_use:N\g__ww_line_int}} - && \__ww_msg_error:n {Third~column~in~an~environment~{WithArrows}} + && \__ww_error:n {Third~column~in~an~environment~{WithArrows}} $\bool_if:NT \l__ww_displaystyle_bool \displaystyle {##}$ \cr } @@ -401,14 +404,15 @@ } \cs_new_protected:Nn \__ww_post_environment: {\int_compare:nNnT \g__ww_line_bis_int < \g__ww_line_int - {\__ww_msg_error:n {All~lines~must~have~an~ampersand}} + {\__ww_error:n {All~lines~must~have~an~ampersand}} + \cs_set:Npn \WithArrowsRightX {\g__ww_right_x_dim} \int_compare:nNnT \g__ww_arrow_int > 0 {\int_compare:nNnTF \l__ww_pos_arrows_int > 5 \__ww_draw_arrows: {\__ww_draw_arrows:nn 1 \g__ww_arrow_int}} \group_begin: \tikzset{every~picture/.style = __ww_standard} - \cs_set:Npn \NbLines {\int_use:N \g__ww_line_int} + \cs_set:Npn \WithArrowsNbLines {\int_use:N \g__ww_line_int} \cs_set_eq:NN \MultiArrow \__ww_MultiArrow:nn \cs_set_eq:cN \l__ww_CommandName_tl \__ww_Arrow_code_after \l__ww_code_after_tl @@ -433,7 +437,7 @@ {\peek_meaning:NTF [ {\__ww_cr_ii:} {\__ww_cr_ii:[\c_zero_dim]} } \cs_new_protected:Npn \__ww_cr_ii:[#1] {\group_align_safe_end: - \bool_if:NF \l__ww_in_witharrows_bool + \bool_if:NT \l__ww_in_DispWithArrows_bool {\bool_if:NTF \l__ww_notag_bool {& \tikz [__ww_standard] \coordinate (\int_use:N\g__ww_line_int-v) ; } { @@ -482,9 +486,9 @@ \bool_set_true:N \l__ww_notag_bool}} \bool_if:NT \c__ww_amsmath_loaded_bool \intertext@ \if_mode_math: - \__ww_msg_error:n {{DispWithArrows}~used~in~math~mode} + \__ww_error:n {{DispWithArrows}~used~in~math~mode} \fi: - \bool_set_false:N \l__ww_in_witharrows_bool + \bool_set_true:N \l__ww_in_DispWithArrows_bool \__ww_pre_environment:n {#1} \if_mode_vertical: \nointerlineskip @@ -544,21 +548,21 @@ -\int_use:N\g__ww_line_int}} & ## \tabskip = \c_zero_skip - && \__ww_msg_error:n {Third~column~in~an~environment~{DispWithArrows}} + && \__ww_error:n {Third~column~in~an~environment~{DispWithArrows}} \iffalse ## \fi \cr} {\\ \egroup \egroup - \bool_if:NT \l__ww_wrap_lines_bool - {\dim_gzero_new:N \g__ww_x_right_dim - \dim_gset:Nn \g__ww_x_right_dim \c_max_dim + \bool_if:NT \l__ww_in_DispWithArrows_bool + {\dim_gzero_new:N \g__ww_right_x_dim + \dim_gset:Nn \g__ww_right_x_dim \c_max_dim \begin{tikzpicture} [__ww_standard] \int_step_variable:nnnNn 1 1 \g__ww_line_int \l_tmpa_int {\tikz@parse@node\pgfutil@firstofone (\l_tmpa_int-v) \dim_set:Nn \l_tmpa_dim \pgf@x - \dim_compare:nNnT \l_tmpa_dim < \g__ww_x_right_dim - {\dim_gset:Nn \g__ww_x_right_dim \l_tmpa_dim} } + \dim_compare:nNnT \l_tmpa_dim < \g__ww_right_x_dim + {\dim_gset:Nn \g__ww_right_x_dim \l_tmpa_dim} } \end{tikzpicture}} \__ww_post_environment: \bool_if:nT \c__ww_mathtools_loaded_bool @@ -579,7 +583,7 @@ \tl_set:Nn \l__ww_tag_tl {#2} \bool_set:Nn \l__ww_tag_star_bool {#1} \bool_if:nT {#1 && ! \bool_if_p:N \c__ww_amsmath_loaded_bool} - { \__ww_msg_error:n {tag*~without~amsmath} } + { \__ww_error:n {tag*~without~amsmath} } } \NewDocumentEnvironment {DispWithArrows*} {} {\WithArrowsOptions{notag} @@ -642,11 +646,11 @@ {final} \l_tmpa_tl \int_set:Nn \l__ww_final_int {\l_tmpa_tl} \int_compare:nNnTF \l__ww_final_int > \g__ww_line_int - {\__ww_msg_error:n {Too~few~lines~for~an~arrow}} + {\__ww_error:n {Too~few~lines~for~an~arrow}} {\cs_if_free:cTF{pgf@sh@ns@wa-\l__ww_prefix_str-\int_use:N\l__ww_initial_int-l} - { \__ww_msg_error:n {A~PGF~node~doesn't~exist} } + { \__ww_error:n {A~PGF~node~doesn't~exist} } {\cs_if_free:cTF{pgf@sh@ns@wa-\l__ww_prefix_str-\int_use:N\l__ww_final_int-l} - { \__ww_msg_error:n {A~PGF~node~doesn't~exist} } + { \__ww_error:n {A~PGF~node~doesn't~exist} } {\__ww_draw_arrows_i:}}} \int_incr:N \l__ww_arrow_int } @@ -705,7 +709,7 @@ \end{tikzpicture}}} \cs_new_protected:Nn \__ww_draw_arrow:nnn { - \bool_if:nT {\l__ww_wrap_lines_bool && ! \l__ww_in_witharrows_bool} + \bool_if:nT {\l__ww_wrap_lines_bool && \l__ww_in_DispWithArrows_bool} { \tl_set_eq:NN \l__ww_tikz_code_tl \c__ww_tikz_code_wrap_lines_tl } \exp_args:No \__ww_def_function_tmpa:n \l__ww_tikz_code_tl \__ww_tmpa:nnn {#1} {#2} {#3} } @@ -714,7 +718,7 @@ { \draw (#1) to node (__ww_label) {} (#2) ; \tikz@parse@node \pgfutil@firstofone (__ww_label.west) - \dim_set:Nn \l_tmpa_dim {\g__ww_x_right_dim - \pgf@x - 0.3333 em} + \dim_set:Nn \l_tmpa_dim {\g__ww_right_x_dim - \pgf@x - 0.3333 em} \path \pgfextra {\tl_gset:Nx \g_tmpa_tl \tikz@text@width} ; \tl_if_empty:NF \g_tmpa_tl {\dim_set:Nn \l_tmpb_dim \g_tmpa_tl @@ -798,7 +802,7 @@ {\x}} {\clist_gput_right:Nx \g_tmpa_clist {\x}}} \int_compare:nNnTF {\clist_count:N \g_tmpa_clist} < 2 - {\__ww_msg_error:n {Too~small~specification~for~MultiArrow}} + {\__ww_error:n {Too~small~specification~for~MultiArrow}} {\clist_sort:Nn \g_tmpa_clist {\int_compare:nNnTF {##1} > {##2} {\sort_return_swapped:} @@ -817,8 +821,8 @@ \dim_set:Nn \l_tmpa_dim {20 cm} \path \pgfextra {\tl_gset:Nx \g_tmpa_tl \tikz@text@width} ; \tl_if_empty:NF \g_tmpa_tl {\dim_set:Nn \l_tmpa_dim \g_tmpa_tl} - \bool_if:nT {\l__ww_wrap_lines_bool && ! \l__ww_in_witharrows_bool} - {\dim_set:Nn \l_tmpb_dim {\g__ww_x_right_dim - \pgf@x - 0.3333 em} + \bool_if:nT {\l__ww_wrap_lines_bool && \l__ww_in_DispWithArrows_bool} + {\dim_set:Nn \l_tmpb_dim {\g__ww_right_x_dim - \pgf@x - 0.3333 em} \dim_compare:nNnT \l_tmpb_dim < \l_tmpa_dim {\dim_set_eq:NN \l_tmpa_dim \l_tmpb_dim}} \path (__ww_label.west) @@ -980,9 +984,9 @@ \bool_set_true:N \l__ww_notag_bool}} \bool_if:NT \c__ww_amsmath_loaded_bool \intertext@ \if_mode_math: - \__ww_msg_error:n {{DispWithArrows}~used~in~math~mode} + \__ww_error:n {{DispWithArrows}~used~in~math~mode} \fi: - \bool_set_false:N \l__ww_in_witharrows_bool + \bool_set_true:N \l__ww_in_DispWithArrows_bool % \__ww_pre_environment:n {#2} \nointerlineskip @@ -1042,7 +1046,7 @@ -\int_use:N\g__ww_line_int}} & ## \tabskip = \c_zero_skip - && \__ww_msg_error:n {Third~column~in~an~environment~{DispWithArrows}} + && \__ww_error:n {Third~column~in~an~environment~{DispWithArrows}} \if_false: ## \fi: \cr} { \\ @@ -1078,6 +1082,20 @@ \MT_showonlyrefs_true:} \ignorespacesafterend } +\NewDocumentCommand \WithArrowsNewStyle {mm} + { \keys_if_exist:nnTF {WithArrows/General} {#1} + {\__ww_error:nn {Key~already~defined} {#1}} + {\keys_define:nn {WithArrows/General} + {#1 .code:n = {\int_compare:nNnTF \l__ww_level_int < 3 + {\keys_set:nn {WithArrows/General} {#2}} + {\__ww_error:n {Option~unknown}}}} + \group_begin: + \WithArrowsOptions{#2} + \group_end:} } +\msg_new:nnn {witharrows} + {Key~already~defined} + {The~key~'#1'~is~already~defined.~If~you~go~on,~ + your~instruction~\token_to_str:N\WithArrowsNewStyle\ will~be~ignored.} \endinput %% %% End of file `witharrows.sty'. |