diff options
author | Karl Berry <karl@freefriends.org> | 2018-01-21 00:44:26 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-01-21 00:44:26 +0000 |
commit | 5e0fb3573b2538b136d1b71b724482f55ebe44e9 (patch) | |
tree | 9161f1aefde87c3693afa3021917d525eff9d6fa /Master/texmf-dist/tex | |
parent | bae071d030d13f63f51e6d6d302f99e5e80a9551 (diff) |
witharrows (20jan18)
git-svn-id: svn://tug.org/texlive/trunk@46394 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/witharrows/witharrows.sty | 102 |
1 files changed, 69 insertions, 33 deletions
diff --git a/Master/texmf-dist/tex/latex/witharrows/witharrows.sty b/Master/texmf-dist/tex/latex/witharrows/witharrows.sty index 8f4add2a4bf..513e618da95 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.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@equation {\cs_set:Npn \spread@equation{\openup\jot - \cs_set_eq:NN \spread@equation \prg_do_nothing}} + \cs_set:Npn \spread@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,20 +426,15 @@ } \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.} -\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.} + 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} {The~option~"jump"~must~be~non~negative} {You~can't~use~a~strictly~negative~value~for~the~option~"jump"~of~command~ @@ -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} |