summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/celtic
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-02-20 23:39:23 +0000
committerKarl Berry <karl@freefriends.org>2016-02-20 23:39:23 +0000
commiteaa1f591a82e989becf47d769a8c44a6e607095b (patch)
tree974adf4715d899714c34606b9e0b1c0b14be5093 /Master/texmf-dist/source/latex/celtic
parent30be8b5d845b9d5d18758f65c22ded6e8e53f435 (diff)
celtic (20feb16)
git-svn-id: svn://tug.org/texlive/trunk@39797 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/celtic')
-rw-r--r--Master/texmf-dist/source/latex/celtic/celtic.dtx67
1 files changed, 50 insertions, 17 deletions
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
%</driver>
% \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.