summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-07-29 20:56:10 +0000
committerKarl Berry <karl@freefriends.org>2018-07-29 20:56:10 +0000
commit49401a31aacb9f38f0cb73c473504c3249b34284 (patch)
tree83fec09e11d11088e52d021aa925e8ce7caa4fe9 /Master/texmf-dist/tex
parent4ddcb3a398a5a51feca788a9e7b8149dff418823 (diff)
witharrows
git-svn-id: svn://tug.org/texlive/trunk@48304 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/witharrows/witharrows.sty180
1 files changed, 117 insertions, 63 deletions
diff --git a/Master/texmf-dist/tex/latex/witharrows/witharrows.sty b/Master/texmf-dist/tex/latex/witharrows/witharrows.sty
index 81837e0a9af..789ee8a9624 100644
--- a/Master/texmf-dist/tex/latex/witharrows/witharrows.sty
+++ b/Master/texmf-dist/tex/latex/witharrows/witharrows.sty
@@ -6,7 +6,7 @@
%%
%% witharrows.dtx (with options: `package')
%%
-%% Copyright (C) 2017 by F. Pantigny
+%% Copyright (C) 2017-2018 by F. Pantigny
%%
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
@@ -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.7}
-\def\myfiledate{2018/07/18}
+\def\myfileversion{1.8}
+\def\myfiledate{2018/07/25}
\RequirePackage{tikz}
\usetikzlibrary{arrows.meta,bending}
\RequirePackage{l3keys2e}
@@ -33,8 +33,8 @@
\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}
+ {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}
@@ -75,6 +75,12 @@
{}
\usepackage{footnotehyper}
\bool_gset_true:N \g__wa_footnote_bool}
+\AtBeginDocument{\clist_map_inline:nn
+ {amsmath,mathtools,autonum,cleveref,hyperref,typedref}
+ {\bool_new:c {c__wa_#1_loaded_bool}
+ \@ifpackageloaded {#1}
+ {\bool_set_true:c {c__wa_#1_loaded_bool}}
+ {}}}
\tikzset{__wa_node_style/.style= {
above = \l__wa_ystart_dim,
inner~sep = 0 pt,
@@ -92,10 +98,11 @@
WithArrows/arrow/tips,
bend~left = 45,
-> }}
-\cs_if_free:NT \spread@equation
- {\cs_set_protected:Npn \spread@equation
- {\openup\jot
- \cs_set_protected:Npn \spread@equation {}}}
+\AtBeginDocument
+ {\bool_if:NF \c__wa_amsmath_loaded_bool
+ {\cs_set_protected:Npn \spread@equation
+ {\openup\jot
+ \cs_set_protected:Npn \spread@equation {}}}}
\bool_new:N \l__wa_in_witharrows_bool
\seq_new:N \g__wa_position_in_the_tree_seq
\seq_gput_right:Nn \g__wa_position_in_the_tree_seq 1
@@ -117,8 +124,19 @@
\bool_new:N \l__wa_notag_bool
\tl_new:N \l__wa_tag_tl
\bool_new:N \l__wa_tag_star_bool
-\tl_new:N \l__wa_label_tl
-\cs_set:Nn \__wa_label:n {\tl_set:Nn \l__wa_label_tl {#1}}
+\seq_new:N \l__wa_labels_seq
+\cs_set:Nn \__wa_label:n {\seq_if_empty:NF \l__wa_labels_seq
+ {\msg_error:nn {witharrows} {Multiple~labels}}
+ \seq_put_right:Nn \l__wa_labels_seq {#1}
+ \bool_if:nT \c__wa_mathtools_loaded_bool
+ {\MH_if_boolean:nT {show_only_refs}
+ {\cs_if_exist:cTF {MT_r_#1}
+ {\bool_set_false:N \l__wa_notag_bool}
+ {\bool_set_true:N \l__wa_notag_bool}}}
+ \bool_if:nT \c__wa_autonum_loaded_bool
+ {\cs_if_exist:cTF {autonum@#1Referenced}
+ {\bool_set_false:N \l__wa_notag_bool}
+ {\bool_set_true:N \l__wa_notag_bool}}}
\bool_new:N \l__wa_fleqn_bool
\dim_new:N \l__wa_mathindent_dim
\dim_set:Nn \l__wa_mathindent_dim {25pt}
@@ -205,6 +223,13 @@
{\bool_set_false:N \l__wa_notag_bool}}},
notag .default:n = true,
nonumber .meta:n = notag,
+ AllowMultipleLabels .code:n = {\bool_if:NTF \l__wa_in_witharrows_bool
+ {\msg_error:nn {witharrows} {Option~will~be~ignored}}
+ {\msg_redirect_name:nnn {witharrows}
+ {Multiple~labels}
+ {none}}},
+ AllowMultipleLabels .value_forbidden:n = true,
+ fleqn .default:n = true,
unknown .code:n = \msg_error:nn {witharrows} {Option~unknown}
}
\keys_define:nn {WithArrows/General}
@@ -341,23 +366,17 @@
&
\int_gincr:N \g__wa_line_bis_int
$\bool_if:NT \l__wa_displaystyle_bool \displaystyle {{}##}$
- \tl_if_empty:NTF \l__wa_name_tl
- {\tikz [remember~picture,overlay]
- \node [__wa_node_style,
- name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-l] {} ;}
- {\tikz [remember~picture,overlay]
- \node [__wa_node_style,
- name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-l,
- alias = \l__wa_name_tl-\int_use:N\g__wa_line_int-l] {} ;}
+ \tikz [remember~picture,overlay]
+ \node [__wa_node_style,
+ name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-l,
+ alias = {\tl_if_empty:NF \l__wa_name_tl
+ {\l__wa_name_tl-\int_use:N\g__wa_line_int-l}} ] {} ;
\hfil
- \tl_if_empty:NTF \l__wa_name_tl
- {\tikz [remember~picture,overlay]
- \node [__wa_node_style,
- name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-r] {} ;}
- {\tikz [remember~picture,overlay]
- \node [__wa_node_style,
- name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-r,
- alias = \l__wa_name_tl-\int_use:N\g__wa_line_int-r] {} ;}
+ \tikz [remember~picture,overlay]
+ \node [__wa_node_style,
+ name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-r,
+ alias = {\tl_if_empty:NF \l__wa_name_tl
+ {\l__wa_name_tl-\int_use:N\g__wa_line_int-r}} ] {} ;
\bool_if:NT \l__wa_shownodenames_bool
{\hbox_overlap_right:n {\small wa-\l__wa_prefix_str
-\int_use:N\g__wa_line_int}}
@@ -414,13 +433,22 @@
{\tl_if_empty:NTF \l__wa_tag_tl
\theequation
\l__wa_tag_tl}
- \tl_if_empty:NF \l__wa_label_tl
+ \seq_if_empty:NF \l__wa_labels_seq
{
- \cs_set_eq:NN \@currentlabel \g_tmpa_tl
- \cs_if_exist:NT \hyper@refstepcounter
+ \cs_set:Npx \@currentlabel {\p@equation \g_tmpa_tl}
+ \bool_if:NT \c__wa_hyperref_loaded_bool
{\cs_set:Npn \This@name {equation}
\hyper@refstepcounter{equation}}
- \__wa_old_label {\l__wa_label_tl}}
+ \bool_if:NT \c__wa_cleveref_loaded_bool
+ {\cref@constructprefix{equation}{\cref@result}
+ \@ifundefined{cref@equation@alias}
+ {\def\@tempa{equation}}
+ {\def\@tempa{\csname cref@equation@alias\endcsname}}
+ \protected@edef\cref@currentlabel{[\@tempa][\arabic{equation}][\cref@result]
+ \p@equation \g_tmpa_tl}}
+ \bool_if:NT \c__wa_typedref_loaded_bool
+ {\cs_set:Npn \sr@name {equation}}
+ \seq_map_function:NN \l__wa_labels_seq \__wa_old_label}
\bool_gset_eq:NN \g_tmpa_bool \l__wa_tag_star_bool
& \cs_set_eq:NN \theequation \g_tmpa_tl
\bool_if:NT \g_tmpa_bool {\cs_set:Npn \tagform@ {}}
@@ -430,20 +458,27 @@
\scan_stop:}}
\NewDocumentEnvironment {DispWithArrows} {O{}}
{
- \cs_if_exist_use:N \intertext@
+ \bool_if:nT \c__wa_mathtools_loaded_bool
+ {\MH_if_boolean:nT {show_only_refs}
+ {\MT_showonlyrefs_false:
+ \MH_set_boolean_T:n {show_only_refs}
+ \bool_set_true:N \l__wa_notag_bool}}
+ \bool_if:NT \c__wa_amsmath_loaded_bool \intertext@
\if_mode_math:
\msg_error:nn {witharrows}
{{DispWithArrows}~used~in~math~mode}
\fi:
\bool_set_false:N \l__wa_in_witharrows_bool
\__wa_pre_environment:n {#1}
- \begin{displaymath}
+ \nointerlineskip
+ \makebox[.6\linewidth]{}
+ $$
\vcenter \bgroup
\spread@equation
\bool_if:NTF \l__wa_fleqn_bool
{\tabskip = \c_zero_skip}
{\tabskip = 0 pt plus 1000 pt minus 1000 pt}
- \cs_if_exist:NTF \ltx@label
+ \bool_if:NTF \c__wa_amsmath_loaded_bool
{\cs_set_eq:NN \__wa_old_label \ltx@label}
{\cs_set_eq:NN \__wa_old_label \label}
\cs_set:Npn \notag {\msg_error:nnn {witharrows}
@@ -463,7 +498,7 @@
\cs_set_eq:cN \l__wa_CommandName_tl \__wa_Arrow_first_column:
\strut
\bool_if:NT \l__wa_fleqn_bool
- {\hspace{\l__wa_mathindent_dim}}
+ {\skip_horizontal:n \l__wa_mathindent_dim}
\hfil
$\bool_if:NT \l__wa_displaystyle_bool \displaystyle {##}$
\tabskip = \c_zero_skip
@@ -475,23 +510,17 @@
$\bool_if:NT \l__wa_displaystyle_bool \displaystyle {{}##}$
\tabskip = 0 pt plus 1000 pt minus 1000 pt
\int_gincr:N \g__wa_line_bis_int
- \tl_if_empty:NTF \l__wa_name_tl
- {\tikz [remember~picture,overlay]
- \node [__wa_node_style,
- name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-l] {} ;}
- {\tikz [remember~picture,overlay]
- \node [__wa_node_style,
- name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-l,
- alias = \l__wa_name_tl-\int_use:N\g__wa_line_int-l] {} ;}
+ \tikz [remember~picture,overlay]
+ \node [__wa_node_style,
+ name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-l,
+ alias = {\tl_if_empty:NF \l__wa_name_tl
+ {\l__wa_name_tl-\int_use:N\g__wa_line_int-l}} ] {} ;
\hfil
- \tl_if_empty:NTF \l__wa_name_tl
- {\tikz [remember~picture,overlay]
- \node [__wa_node_style,
- name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-r] {} ;}
- {\tikz [remember~picture,overlay]
- \node [__wa_node_style,
- name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-r,
- alias = \l__wa_name_tl-\int_use:N\g__wa_line_int-r] {} ;}
+ \tikz [remember~picture,overlay]
+ \node [__wa_node_style,
+ name = wa-\l__wa_prefix_str-\int_use:N\g__wa_line_int-r,
+ alias = {\tl_if_empty:NF \l__wa_name_tl
+ {\l__wa_name_tl-\int_use:N\g__wa_line_int-r}} ] {} ;
\bool_if:NT \l__wa_shownodenames_bool
{\hbox_overlap_right:n {\small wa-\l__wa_prefix_str
-\int_use:N\g__wa_line_int}}
@@ -503,15 +532,24 @@
{\\
\egroup
\egroup
- \end{displaymath}
+ $$
\__wa_post_environment:
+ \bool_if:nT \c__wa_mathtools_loaded_bool
+ {\MH_if_boolean:nT {show_only_refs}
+ \MT_showonlyrefs_true:}
\ignorespacesafterend
}
\NewDocumentCommand \__wa_tag {sm}
- {\bool_set_false:N \l__wa_notag_bool
+ {\tl_if_empty:NF \l__wa_tag_tl
+ {\msg_error:nnn {witharrows} {Multiple~tags} {#2}}
+ \bool_set_false:N \l__wa_notag_bool
+ \bool_if:nT \c__wa_mathtools_loaded_bool
+ {\MH_if_boolean:nT {show_only_refs}
+ {\MH_if_boolean:nF {show_manual_tags}
+ {\bool_set_true:N \l__wa_notag_bool}}}
\tl_set:Nn \l__wa_tag_tl {#2}
\bool_set:Nn \l__wa_tag_star_bool {#1}
- \bool_if:nT {#1 && ! \cs_if_exist_p:N \tagform@}
+ \bool_if:nT {#1 && ! \bool_if_p:N \c__wa_amsmath_loaded_bool}
{ \msg_error:nn {witharrows} {tag*~without~amsmath} }
}
\NewDocumentEnvironment {DispWithArrows*} {}
@@ -742,8 +780,8 @@
an~environment.~However,~you~can~go~one~for~this~time.}
\msg_new:nnn {witharrows}
{Third~column~in~an~environment~{DispWithArrows}}
- {An~environment~\{DispWithArrows\}~or~\{DispWithArrows*\}~can~only~have~two~columns.~
- If~you~go~on,~you~may~have~an~incorrect~output.}
+ {An~environment~\{DispWithArrows\}~or~\{DispWithArrows*\}~can~only~
+ have~two~columns.~If~you~go~on,~you~may~have~an~incorrect~output.}
\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~
@@ -776,18 +814,21 @@
5 {i}
6 {group}
7 {groups}}"~
- previously~set~in~the~same~
+ set~in~the~same~
\int_case:nn\l__wa_level_int
{1 {command~\token_to_str:N\WithArrowsOptions}
- 2 {declaration~of~options~of~the~environment~\{WithArrows\}}
+ 2 {declaration~of~options~of~the~environment~
+ \{\@currenvir\}}
3 {command~\token_to_str:N\Arrow}}.~
- If~you~go~on,~I~will~overwrite~the~first~option.}
+ If~you~go~on,~I~will~use~the~option~"\tl_use:N\l_keys_key_tl".}
\msg_new:nnnn {witharrows}
{All~lines~must~have~an~ampersand}
- {All~lines~of~an~environment~\{WithArrows\}~should~have~an~second~column~
- (because~the~nodes~are~created~in~the~second~column).~However,~you~can~go~but~you~will~
- have~an~error~if~one~of~your~arrows~needs~an~PGF~node~absent~by~lack~of~ampersand.~
- If~you~don't~want~to~see~this~message~again,~you~can~use~the~option~
+ {All~lines~of~an~environment~\{WithArrows\}~should~
+ have~an~second~column~(because~the~nodes~are~created~
+ in~the~second~column).~However,~you~can~go~but~you~will~
+ have~an~error~if~one~of~your~arrows~needs~an~PGF~
+ node~absent~by~lack~of~ampersand.~If~you~don't~want~to~
+ see~this~message~again,~you~can~use~the~option~
AllowLineWithoutAmpersand.}
{Moreover, the~ampersand~can~be~implicit~
(e.g.~if~you~use~\token_to_str:N\MoveEqLeft\ of~mathtools).}
@@ -856,6 +897,19 @@
is~not~allowed~in~\{WithArrows\}~but~is~allowed~in~the~second~
column~of~\{DispWithArrows\}~(and,~of~course,~in~the~
environments~of~amsmath).~If~you~go~on,~this~command~will~be~ignored.}
+\msg_new:nnn {witharrows}
+ {Multiple~tags}
+ {You~can't~use~twice~the~command~\token_to_str:N\tag\
+ in~a~line~of~the~environment~\{\@currenvir\}.~If~you~go~on,~the~tag~
+ '#1'~will~be~used.}
+\msg_new:nnn {witharrows}
+ {Multiple~labels}
+ {Normaly,~we~can't~use~the~command~\token_to_str:N\label\
+ twice~in~a~line~of~the~environment~\{\@currenvir\}.~
+ However,~you~can~go~on.~
+ If~you~don't~want~to~see~this~message~again,~you~can~use~the~option~
+ "AllowMultipleLabels"~at~the~global~or~
+ environment~level~(this~doesn't~work~if~you~use~cleveref).}
\endinput
%%
%% End of file `witharrows.sty'.