From eaa1f591a82e989becf47d769a8c44a6e607095b Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 20 Feb 2016 23:39:23 +0000 Subject: celtic (20feb16) git-svn-id: svn://tug.org/texlive/trunk@39797 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/celtic/celtic.pdf | Bin 356708 -> 357298 bytes Master/texmf-dist/doc/latex/celtic/celtic_code.pdf | Bin 264119 -> 330231 bytes Master/texmf-dist/doc/latex/celtic/celtic_doc.tex | 4 +- Master/texmf-dist/source/latex/celtic/celtic.dtx | 67 +++++++++++++++------ .../tex/latex/celtic/tikzlibraryceltic.code.tex | 52 ++++++++++++---- 5 files changed, 92 insertions(+), 31 deletions(-) diff --git a/Master/texmf-dist/doc/latex/celtic/celtic.pdf b/Master/texmf-dist/doc/latex/celtic/celtic.pdf index a6ad95c6777..74e79bdab9b 100644 Binary files a/Master/texmf-dist/doc/latex/celtic/celtic.pdf and b/Master/texmf-dist/doc/latex/celtic/celtic.pdf differ diff --git a/Master/texmf-dist/doc/latex/celtic/celtic_code.pdf b/Master/texmf-dist/doc/latex/celtic/celtic_code.pdf index ae297dd4bcb..36757a9306f 100644 Binary files a/Master/texmf-dist/doc/latex/celtic/celtic_code.pdf and b/Master/texmf-dist/doc/latex/celtic/celtic_code.pdf differ diff --git a/Master/texmf-dist/doc/latex/celtic/celtic_doc.tex b/Master/texmf-dist/doc/latex/celtic/celtic_doc.tex index cf7271d72e8..a8cd3abaa15 100644 --- a/Master/texmf-dist/doc/latex/celtic/celtic_doc.tex +++ b/Master/texmf-dist/doc/latex/celtic/celtic_doc.tex @@ -37,7 +37,7 @@ \title{The \textsf{celtic} TikZ Library: Documentation} \author{Andrew Stacey \\ \url{stacey@math.ntnu.no}} -\date{24th May 2014} +\date{19th February 2016} \begin{document} \VerbatimFootnotes @@ -226,4 +226,4 @@ It is also used on the outer border (prior to the \Verb+celtic surround+ so it c % Local Variables: % tex-output-type: "pdf18" -% End: \ No newline at end of file +% End: diff --git a/Master/texmf-dist/source/latex/celtic/celtic.dtx b/Master/texmf-dist/source/latex/celtic/celtic.dtx index b5e6a92232b..4cc3caa118b 100644 --- a/Master/texmf-dist/source/latex/celtic/celtic.dtx +++ b/Master/texmf-dist/source/latex/celtic/celtic.dtx @@ -120,7 +120,7 @@ and the derived files celtic.ins % % \fi % -% \CheckSum{716} +% \CheckSum{783} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -146,7 +146,7 @@ and the derived files celtic.ins % \providecommand*{\url}{\texttt} % \title{The \textsf{celtic} package} % \author{Andrew Stacey \\ \url{loopspace@mathforge.org}} -% \date{1.0 from 2014/05/23} +% \date{1.1 from 2016/02/19} % % % \maketitle @@ -204,17 +204,32 @@ and the derived files celtic.ins \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 \c__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} % \end{macrocode} % Define our warning message. % \begin{macrocode} @@ -225,12 +240,7 @@ Consider~ raising~ the~ limit~ from \int_use:N \l__celtic_max_steps_int.} % Using a colon for a range separator was possibly not the best idea I ever had, seeing as \LaTeX3 alters its catcode. % So we need to get creative. % \begin{macrocode} -\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 : } % \end{macrocode} % Some packages mess with the catcode of \Verb+|+. % \begin{macrocode} @@ -302,7 +312,7 @@ Consider~ raising~ the~ limit~ from \int_use:N \l__celtic_max_steps_int.} % \begin{macrocode} \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} } @@ -318,7 +328,7 @@ Consider~ raising~ the~ limit~ from \int_use:N \l__celtic_max_steps_int.} % \begin{macrocode} \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 } @@ -330,8 +340,8 @@ Consider~ raising~ the~ limit~ from \int_use:N \l__celtic_max_steps_int.} % \end{macro} % % When processing ranges, we need to use colons with the original catcode. -% We've stored one in \Verb+\g__celtic_colon_tl+ but we need to use it in actuality. -% So we make a token list containing the definitions we want to make, expanding \Verb+\g__celtic_colon_tl+ to its colon, but not expanding anything else. +% We've stored one in \Verb+\c__celtic_colon_tl+ but we need to use it in actuality. +% So we make a token list containing the definitions we want to make, expanding \Verb+\c__celtic_colon_tl+ to its colon, but not expanding anything else. % \begin{macrocode} \tl_set:Nx \l_tmpa_tl { @@ -340,7 +350,7 @@ Consider~ raising~ the~ limit~ from \int_use:N \l__celtic_max_steps_int.} % \begin{macro}{\celtic_do_xrange:w} % This splits the \Verb+x+-coordinate into a range and repeats the function for each intermediate value. % \begin{macrocode} - \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} { @@ -353,7 +363,7 @@ Consider~ raising~ the~ limit~ from \int_use:N \l__celtic_max_steps_int.} % \begin{macro}{\celtic_do_yrange:w} % Same, for the \Verb+y+-coordinate. % \begin{macrocode} - \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} { @@ -418,7 +428,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)} % \end{macrocode} % Start our path with a move to the initial point and record our current direction. % \begin{macrocode} @@ -652,6 +664,25 @@ 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} } } +% \end{macrocode} +% Is our overcrossing one of the undercrossings? +% If so, remove the initial or final segment as appropriate. +% \begin{macrocode} + \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 {(} + } } % \end{macrocode} % \end{macro} @@ -771,6 +802,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} @@ -870,7 +902,7 @@ Consider~ raising~ the~ limit~ from \int_use:N \l__celtic_max_steps_int.} } { % \end{macrocode} -% Those tests failed, so we procede. +% Those tests failed, so we proceed. % First, we mark the crossing as used and set our initial data. % Position, original position, and direction. % \begin{macrocode} @@ -911,6 +943,7 @@ Consider~ raising~ the~ limit~ from \int_use:N \l__celtic_max_steps_int.} % Then return to the start of the loop. % \begin{macrocode} \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 } @@ -981,7 +1014,7 @@ Consider~ raising~ the~ limit~ from \int_use:N \l__celtic_max_steps_int.} % % This second pass through the segments redraws each one clipped to a diamond neighbourhood of its over-crossing. % \begin{macrocode} - \seq_map_inline:Nn \l__celtic_path_seq + \seq_map_inline:Nn \l__celtic_overpath_seq { % \end{macrocode} % We get the crossing coordinate. 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 -- cgit v1.2.3