diff options
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/celtic/tikzlibraryceltic.code.tex | 52 |
1 files changed, 40 insertions, 12 deletions
diff --git a/Master/texmf-dist/tex/latex/celtic/tikzlibraryceltic.code.tex b/Master/texmf-dist/tex/latex/celtic/tikzlibraryceltic.code.tex index 20ac5a97c07..f70dc9e1f84 100644 --- a/Master/texmf-dist/tex/latex/celtic/tikzlibraryceltic.code.tex +++ b/Master/texmf-dist/tex/latex/celtic/tikzlibraryceltic.code.tex @@ -38,26 +38,35 @@ \fp_new:N \l__celtic_inner_fp \fp_new:N \l__celtic_outer_fp \seq_new:N \l__celtic_path_seq +\seq_new:N \l__celtic_overpath_seq \seq_new:N \l__celtic_component_seq \seq_new:N \l__celtic_crossing_seq \seq_new:N \l__celtic_tmpa_seq \clist_new:N \l__celtic_tmpa_clist \tl_new:N \l__celtic_tmpa_tl \tl_new:N \l__celtic_path_tl -\tl_new:N \g__celtic_colon_tl \tl_new:N \l__celtic_bar_tl \tl_new:N \l__celtic_active_bar_tl +\tl_new:N \l__celtic_start_tl \bool_new:N \l__celtic_bounce_bool \bool_new:N \l__celtic_pbounce_bool + +\cs_new_nopar:Npn \tl_split_after:Nnn #1#2#3 +{ + \cs_set:Npn \tl_split_aux:nnn ##1#3##2 \q_stop: {#3##2} + \tl_set:Nx #1 {\tl_split_aux:nnn #2 \q_stop:} +} +\cs_generate_variant:Nn \tl_split_after:Nnn {NVn} +\cs_new_nopar:Npn \tl_split_before:Nnn #1#2#3 +{ + \cs_set:Npn \tl_split_aux:nnn ##1#3##2 \q_stop: {##1#3} + \tl_set:Nx #1 {\tl_split_aux:nnn #2 \q_stop:} +} +\cs_generate_variant:Nn \tl_split_before:Nnn {NVn} \msg_new:nnnn { celtic } { max~ steps } { Limit~ of~ number~ of~ steps~ exceeded~ \msg_line_context:.} { Paths~ may~ not~ be~ correctly~ constructed.~ Consider~ raising~ the~ limit~ from \int_use:N \l__celtic_max_steps_int.} -\group_begin: -\char_set_lccode:nn {`;}{`:} -\tl_to_lowercase:n { -\group_end: - \tl_set:Nn \g__celtic_colon_tl {;} -} +\tl_const:Nx \c__celtic_colon_tl { \token_to_str:N : } \tl_set:Nn \l__celtic_bar_tl {|} \group_begin: \char_set_catcode_active:N \| @@ -98,7 +107,7 @@ Consider~ raising~ the~ limit~ from \int_use:N \l__celtic_max_steps_int.} } \cs_new_nopar:Npn \celtic_maybe_xrange:nnnn #1#2#3#4 { - \tl_if_in:nVTF {#3} \g__celtic_colon_tl + \tl_if_in:nVTF {#3} \c__celtic_colon_tl { \celtic_do_xrange:w {#1}{#2}#3\q_stop{#4} } @@ -108,7 +117,7 @@ Consider~ raising~ the~ limit~ from \int_use:N \l__celtic_max_steps_int.} } \cs_new_nopar:Npn \celtic_maybe_yrange:nnnn #1#2#3#4 { - \tl_if_in:nVTF {#4} \g__celtic_colon_tl + \tl_if_in:nVTF {#4} \c__celtic_colon_tl { \celtic_do_yrange:w {#1}{#2}{#3}#4\q_stop } @@ -118,14 +127,14 @@ Consider~ raising~ the~ limit~ from \int_use:N \l__celtic_max_steps_int.} } \tl_set:Nx \l_tmpa_tl { - \exp_not:N \cs_new_nopar:Npn \exp_not:N \celtic_do_xrange:w ##1##2##3\tl_use:N \g__celtic_colon_tl ##4\exp_not:N \q_stop##5 + \exp_not:N \cs_new_nopar:Npn \exp_not:N \celtic_do_xrange:w ##1##2##3\tl_use:N \c__celtic_colon_tl ##4\exp_not:N \q_stop##5 { \exp_not:N \int_step_inline:nnnn {##3} {2} {##4} { \exp_not:N \celtic_maybe_yrange:nnnn {##1}{##2} {####1}{##5} } } - \exp_not:N \cs_new_nopar:Npn \exp_not:N \celtic_do_yrange:w ##1##2##3##4\tl_use:N \g__celtic_colon_tl ##5\exp_not:N \q_stop + \exp_not:N \cs_new_nopar:Npn \exp_not:N \celtic_do_yrange:w ##1##2##3##4\tl_use:N \c__celtic_colon_tl ##5\exp_not:N \q_stop { \exp_not:N \int_step_inline:nnnn {##4} {2} {##5} { @@ -155,7 +164,9 @@ Consider~ raising~ the~ limit~ from \int_use:N \l__celtic_max_steps_int.} \int_zero:N \l__celtic_cross_int \tl_clear:N \l__celtic_crossing_tl \tl_clear:N \l__celtic_path_tl + \tl_clear:N \l__celtic_overpath_tl \bool_set_false:N \l__celtic_bounce_tl + \tl_set:Nx \l__celtic_start_tl {(\int_use:N \l__celtic_x, \int_use:N \l__celtic_y)} \tl_put_right:Nx \l__celtic_path_tl {(\int_use:N \l__celtic_x, \int_use:N \l__celtic_y)} \int_set:Nn \l__celtic_lout {(90 - \l__celtic_dx * 45) * \l__celtic_dy} \bool_do_until:nn {\int_compare_p:n {\l__celtic_cross_int > 1}} @@ -273,6 +284,21 @@ Consider~ raising~ the~ limit~ from \int_use:N \l__celtic_max_steps_int.} \int_set:Nn \l__celtic_lout {(90 - \l__celtic_dx * 45) * \l__celtic_dy} } } + \tl_set_eq:NN \l__celtic_overpath_tl \l__celtic_path_tl + \tl_set:Nx \l__celtic_tmpa_tl {(\int_use:N \l__celtic_x, \int_use:N +\l__celtic_y)} + \tl_if_eq:NNT \l__celtic_crossing_tl \l__celtic_tmpa_tl + { + \tl_reverse:N \l__celtic_overpath_tl + \tl_set:Nx \l__celtic_overpath_tl {\tl_tail:N \l__celtic_overpath_tl} + \tl_split_after:NVn \l__celtic_overpath_tl \l__celtic_overpath_tl {)} + \tl_reverse:N \l__celtic_overpath_tl + } + \tl_if_eq:NNT \l__celtic_crossing_tl \l__celtic_start_tl + { + \tl_set:Nx \l__celtic_overpath_tl {\tl_tail:N \l__celtic_overpath_tl} + \tl_split_after:NVn \l__celtic_overpath_tl \l__celtic_overpath_tl {(} + } } \keys_define:nn { celtic } { @@ -342,6 +368,7 @@ Consider~ raising~ the~ limit~ from \int_use:N \l__celtic_max_steps_int.} \group_begin: \pgfscope \seq_clear:N \l__celtic_path_seq + \seq_clear:N \l__celtic_overpath_seq \seq_clear:N \l__celtic_component_seq \seq_clear:N \l__celtic_crossing_seq \int_set:Nn \l__celtic_flip_int {1} @@ -416,6 +443,7 @@ Consider~ raising~ the~ limit~ from \int_use:N \l__celtic_max_steps_int.} \int_incr:N \l__celtic_int \celtic_next_crossing: \seq_put_left:NV \l__celtic_path_seq \l__celtic_path_tl + \seq_put_left:NV \l__celtic_overpath_seq \l__celtic_overpath_tl \seq_put_left:NV \l__celtic_crossing_seq \l__celtic_crossing_tl \seq_put_left:NV \l__celtic_component_seq \l__celtic_component_int } @@ -448,7 +476,7 @@ Consider~ raising~ the~ limit~ from \int_use:N \l__celtic_max_steps_int.} \tl_use:N \l__celtic_tmpa_tl \fp_set:Nn \l__celtic_inner_clip_fp {sqrt(2) * (\l__celtic_clip_fp + \l__celtic_inner_fp)} \fp_set:Nn \l__celtic_clip_fp {sqrt(2) * (\l__celtic_clip_fp + \l__celtic_outer_fp)} - \seq_map_inline:Nn \l__celtic_path_seq + \seq_map_inline:Nn \l__celtic_overpath_seq { \seq_pop:NN \l__celtic_crossing_seq \l__celtic_crossing_tl \seq_pop:NN \l__celtic_component_seq \l__celtic_tmpa_tl |