%% %% This is file `tikzlibrarycalligraphy.code.tex', %% generated with the docstrip utility. %% %% The original source files were: %% %% spath3.dtx (with options: `calligraphy') %% ---------------------------------------------------------------- %% spath3 --- Functions for manipulating PGF soft paths %% E-mail: stacey@math.ntnu.no %% Released under the LaTeX Project Public License v1.3c or later %% See http://www.latex-project.org/lppl.txt %% ---------------------------------------------------------------- %% \RequirePackage{spath3} \ExplSyntaxOn \tl_new:N \l__cal_tmpa_tl \tl_new:N \l__cal_tmpb_tl \int_new:N \l__cal_tmpa_int \int_new:N \l__cal_tmpb_int \int_new:N \l__cal_path_component_int \int_new:N \l__cal_label_int \dim_new:N \l__cal_tmpa_dim \dim_new:N \l__cal_tmpb_dim \dim_new:N \l__cal_tmpc_dim \dim_new:N \l__cal_tmpd_dim \dim_new:N \l__cal_tmpe_dim \dim_new:N \l__cal_tmpf_dim \dim_new:N \l__cal_tmpg_dim \dim_new:N \l__cal_tmph_dim \bool_new:N \l__cal_annotate_bool \bool_new:N \l__cal_taper_start_bool \bool_new:N \l__cal_taper_end_bool \bool_new:N \l__cal_taperable_bool \dim_new:N \l__cal_taper_width_dim \dim_new:N \l__cal_line_width_dim \bool_set_true:N \l__cal_taper_start_bool \bool_set_true:N \l__cal_taper_end_bool \cs_generate_variant:Nn \tl_put_right:Nn {Nv} \tikzset{ define~pen/.code={ \tikzset{pen~name=#1} \pgf@relevantforpicturesizefalse \tikz@addmode{ \pgfsyssoftpath@getcurrentpath\l__cal_tmpa_tl \MakeSPathList{calligraphy pen \pgfkeysvalueof{/tikz/pen~name}}{\l__cal_tmpa_tl} \SPathListPrepare{calligraphy pen \pgfkeysvalueof{/tikz/pen~name}} \pgfusepath{discard}% } }, define~pen/.default={default}, use~pen/.code={ \tikzset{pen~name=#1} \int_gzero:N \l__cal_path_component_int \cs_set_eq:NN \pgfpathmoveto \cal_moveto:n \tikz@addmode{ \pgfsyssoftpath@getcurrentpath\l__cal_tmpa_tl \MakeSPathList{calligraphy path}{\l__cal_tmpa_tl} \SPathListPrepare{calligraphy path} \CalligraphyPathCreate{calligraphy path}{\pgfkeysvalueof{/tikz/pen~name}} } }, use~pen/.default={default}, pen~name/.initial={default}, copperplate/.style={pen~name=copperplate}, pen~colour/.initial={black}, weight/.is~choice, weight/heavy/.style={ line~width=\pgfkeysvalueof{/tikz/heavy~line~width}, taper~width=\pgfkeysvalueof{/tikz/light~line~width}, }, weight/light/.style={ line~width=\pgfkeysvalueof{/tikz/light~line~width}, taper~width=0pt, }, heavy/.style={ weight=heavy }, light/.style={ weight=light }, heavy~line~width/.initial=2pt, light~line~width/.initial=1pt, taper/.is~choice, taper/.default=both, taper/none/.style={ taper~start=false, taper~end=false, }, taper/both/.style={ taper~start=true, taper~end=true, }, taper/start/.style={ taper~start=true, taper~end=false, }, taper/end/.style={ taper~start=false, taper~end=true, }, taper~start/.code={ \tl_if_eq:nnTF {#1} {true} { \bool_set_true:N \l__cal_taper_start_bool } { \bool_set_false:N \l__cal_taper_start_bool } }, taper~start/.default={true}, taper~end/.code={ \tl_if_eq:nnTF {#1} {true} { \bool_set_true:N \l__cal_taper_end_bool } { \bool_set_false:N \l__cal_taper_end_bool } }, taper~end/.default={true}, taper~width/.code={\dim_set:Nn \l__cal_taper_width_dim {#1}}, nib~style/.code~2~args={ \tl_clear_new:c {l__cal_nib_style_#1} \tl_set:cn {l__cal_nib_style_#1} {#2} }, stroke~style/.code~2~args={ \tl_clear_new:c {l__cal_stroke_style_#1} \tl_set:cn {l__cal_stroke_style_#1} {#2} }, this~stroke~style/.code={ \tl_clear_new:c {l__cal_stroke_inline_style_ \int_use:N \l__cal_path_component_int} \tl_set:cn {l__cal_stroke_inline_style_ \int_use:N \l__cal_path_component_int} {#1} }, annotate/.style={ annotate~if, annotate~reset, annotation~style/.update~value={#1}, }, annotate~if/.default={true}, annotate~if/.code={ \tl_if_eq:nnTF {#1} {true} { \bool_set_true:N \l__cal_annotate_bool } { \bool_set_false:N \l__cal_annotate_bool } }, annotate~reset/.code={ \int_gzero:N \l__cal_label_int }, annotation~style/.initial={draw,->}, annotation~shift/.initial={(0,1ex)}, every~annotation~node/.initial={anchor=south~west}, annotation~node~style/.code~2~args={ \tl_set:cn {l__cal_annotation_style_ #1 _tl}{#2} }, tl~use:N/.code={ \exp_args:NV \pgfkeysalso #1 }, tl~use:c/.code={ \tl_if_exist:cT {#1} { \exp_args:Nv \pgfkeysalso {#1} } }, /handlers/.update~style/.code={ \tl_if_eq:nnF {#1} {\pgfkeysnovalue} { \pgfkeys{\pgfkeyscurrentpath/.code=\pgfkeysalso{#1}} } }, /handlers/.update~value/.code={ \tl_if_eq:nnF {#1} {\pgfkeysnovalue} { \pgfkeyssetvalue{\pgfkeyscurrentpath}{#1} } } } \NewDocumentCommand \pen { O{} } { \path[define~ pen,every~ calligraphy~ pen/.try,#1] } \NewDocumentCommand \definepen { O{} } { \tikz \path[define~ pen,every~ calligraphy~ pen/.try,#1] } \NewDocumentCommand \calligraphy { O{} } { \path[use~ pen,every~ calligraphy/.try,#1] } \NewDocumentCommand \CalligraphyPathCreate { m m } { \int_zero:N \l__cal_tmpa_int \tl_map_inline:cn {l__spath_list_#1} { \int_incr:N \l__cal_tmpa_int \int_zero:N \l__cal_tmpb_int \tl_map_inline:cn {l__spath_list_calligraphy pen #2} { \int_incr:N \l__cal_tmpb_int \group_begin: \pgfsys@beginscope \cal_apply_style:c {l__cal_stroke_style_ \int_use:N \l__cal_tmpa_int} \cal_apply_style:c {l__cal_stroke_inline_style_ \int_use:N \l__cal_tmpa_int} \cal_apply_style:c {l__cal_nib_style_ \int_use:N \l__cal_tmpb_int} \spath_clone:nn {##1} {calligraphy temp path} \__spath_get:nnN {####1} {initial point} \l__cal_tmpa_tl \spath_translate:nV {calligraphy temp path} \l__cal_tmpa_tl \__spath_get:nnN {####1} {length} \l__cal_tmpa_tl \int_compare:nTF {\l__cal_tmpa_tl = 1} { \cal_at_least_three:n {calligraphy temp path} \spath_protocol_path:n {calligraphy temp path} \__spath_get:nnN {calligraphy temp path} {path} \l__cal_tmpa_tl \tikz@options \dim_set:Nn \l__cal_line_width_dim {\pgflinewidth} \cal_maybe_taper:N \l__cal_tmpa_tl } { \spath_weld:nn {calligraphy temp path} {####1} \spath_reverse:n {##1} \spath_reverse:n {####1} \spath_weld:nn {calligraphy temp path} {##1} \spath_weld:nn {calligraphy temp path} {####1} \spath_reverse:n {##1} \spath_reverse:n {####1} \tl_clear:N \l__cal_tmpa_tl \tl_set:Nn \l__cal_tmpa_tl {fill=\pgfkeysvalueof{/tikz/pen~colour},draw=none} \tl_if_exist:cT {l__cal_stroke_style_ \int_use:N \l__cal_tmpa_int} { \tl_put_right:Nv \l__cal_tmpa_tl {l__cal_stroke_style_ \int_use:N \l__cal_tmpa_int} } \tl_if_exist:cT {l__cal_stroke_inline_style_ \int_use:N \l__cal_tmpa_int} { \tl_put_right:Nn \l__cal_tmpa_tl {,} \tl_put_right:Nv \l__cal_tmpa_tl {l__cal_stroke_inline_style_ \int_use:N \l__cal_tmpa_int} } \tl_if_exist:cT {l__cal_nib_style_ \int_use:N \l__cal_tmpb_int} { \tl_put_right:Nn \l__cal_tmpa_tl {,} \tl_put_right:Nv \l__cal_tmpa_tl {l__cal_nib_style_ \int_use:N \l__cal_tmpb_int} } \spath_tikz_path:Vn \l__cal_tmpa_tl {calligraphy temp path} } \pgfsys@endscope \group_end: } \bool_if:NT \l__cal_annotate_bool { \spath_clone:nn {##1} {calligraphy temp path} \tl_set_eq:Nc \l_tmpa_tl {l__spath_list_calligraphy pen #2} \tl_reverse:N \l_tmpa_tl \tl_set:Nx \l_tmpa_tl {\tl_head:N \l_tmpa_tl} \spath_generate_finalpoint:V \l_tmpa_tl \spath_get:VnN \l_tmpa_tl {final point} \l_tmpa_tl \spath_translate:nV {calligraphy temp path} \l_tmpa_tl \tikz@scan@one@point\pgfutil@firstofone\pgfkeysvalueof{/tikz/annotation~shift} \spath_translate:nnn {calligraphy temp path} {\pgf@x} {\pgf@y} \pgfkeysgetvalue{/tikz/annotation~style}{\l_tmpa_tl} \spath_tikz_path:Vn \l_tmpa_tl {calligraphy temp path} \spath_get:nnN {calligraphy temp path} {final point} \l_tmpa_tl \exp_last_unbraced:NV \pgfqpoint \l_tmpa_tl \begin{scope}[reset~ cm] \node[every~annotation~node/.try,tl~use:c = {l__cal_annotation_style_ \int_use:N \l__cal_tmpa_int _tl}] at (\pgf@x,\pgf@y) {\int_use:N \l__cal_tmpa_int}; \end{scope} } } } \cs_new_eq:NN \cal_orig_moveto:n \pgfpathmoveto \cs_new_nopar:Npn \cal_moveto:n #1 { \int_gincr:N \l__cal_path_component_int \cal_orig_moveto:n {#1} } \cs_new_nopar:Npn \cal_apply_style:N #1 { \tl_if_exist:NT #1 { \exp_args:NV \tikzset #1 } } \cs_generate_variant:Nn \cal_apply_style:N {c} \cs_new_nopar:Npn \cal_at_least_three:n #1 { \spath_get:nnN {#1} {real length} \l__cal_tmpa_tl \tl_clear:N \l__cal_tmpb_tl \int_compare:nTF {\l__cal_tmpa_tl = 1} { \spath_get:nnN {#1} {path} \l__cal_tmpa_tl \spath_map_segment_inline:Nn \l__cal_tmpa_tl { \tl_case:NnF ##1 { \g__spath_lineto_tl { \cal_split_line_in_three:NN \l__cal_tmpb_tl ##2 } \g__spath_curvetoa_tl { \cal_split_curve_in_three:NN \l__cal_tmpb_tl ##2 } } { \tl_put_right:NV \l__cal_tmpb_tl ##2 } } \spath_put:nnV {#1} {path} \l__cal_tmpb_tl } { \int_compare:nT {\l__cal_tmpa_tl = 2} { \spath_get:nnN {#1} {path} \l__cal_tmpa_tl \spath_map_segment_inline:Nn \l__cal_tmpa_tl { \tl_case:NnF ##1 { \g__spath_lineto_tl { \cal_split_line_in_two:NN \l__cal_tmpb_tl ##2 } \g__spath_curvetoa_tl { \cal_split_curve_in_two:NN \l__cal_tmpb_tl ##2 } } { \tl_put_right:NV \l__cal_tmpb_tl ##2 } } \spath_put:nnV {#1} {path} \l__cal_tmpb_tl } } } \cs_new_nopar:Npn \cal_split_line_in_two:NN #1#2 { \tl_set_eq:NN \l__cal_tmpc_tl #2 \tl_set:Nx \l__cal_tmpc_tl {\tl_tail:N \l__cal_tmpc_tl} \dim_set:Nn \l__cal_tmpa_dim {\tl_head:N \l__cal_tmpc_tl} \tl_set:Nx \l__cal_tmpc_tl {\tl_tail:N \l__cal_tmpc_tl} \dim_set:Nn \l__cal_tmpb_dim {\tl_head:N \l__cal_tmpc_tl} \tl_set:Nx \l__cal_tmpc_tl {\tl_tail:N \l__cal_tmpc_tl} \tl_set:Nx \l__cal_tmpc_tl {\tl_tail:N \l__cal_tmpc_tl} \dim_set:Nn \l__cal_tmpc_dim {\tl_head:N \l__cal_tmpc_tl} \tl_set:Nx \l__cal_tmpc_tl {\tl_tail:N \l__cal_tmpc_tl} \dim_set:Nn \l__cal_tmpd_dim {\tl_head:N \l__cal_tmpc_tl} \tl_set:Nx \l__cal_tmpc_tl {\tl_tail:N \l__cal_tmpc_tl} \tl_put_right:NV #1 \g__spath_lineto_tl \tl_put_right:Nx #1 { {\dim_eval:n {(\l__cal_tmpa_dim + \l__cal_tmpc_dim)/2}} {\dim_eval:n {(\l__cal_tmpb_dim + \l__cal_tmpd_dim)/2}} } \tl_put_right:NV #1 \g__spath_lineto_tl \tl_put_right:Nx #1 { {\dim_use:N \l__cal_tmpc_dim} {\dim_use:N \l__cal_tmpd_dim} } } \cs_new_nopar:Npn \cal_split_line_in_three:NN #1#2 { \tl_set_eq:NN \l__cal_tmpc_tl #2 \tl_set:Nx \l__cal_tmpc_tl {\tl_tail:N \l__cal_tmpc_tl} \dim_set:Nn \l__cal_tmpa_dim {\tl_head:N \l__cal_tmpc_tl} \tl_set:Nx \l__cal_tmpc_tl {\tl_tail:N \l__cal_tmpc_tl} \dim_set:Nn \l__cal_tmpb_dim {\tl_head:N \l__cal_tmpc_tl} \tl_set:Nx \l__cal_tmpc_tl {\tl_tail:N \l__cal_tmpc_tl} \tl_set:Nx \l__cal_tmpc_tl {\tl_tail:N \l__cal_tmpc_tl} \dim_set:Nn \l__cal_tmpc_dim {\tl_head:N \l__cal_tmpc_tl} \tl_set:Nx \l__cal_tmpc_tl {\tl_tail:N \l__cal_tmpc_tl} \dim_set:Nn \l__cal_tmpd_dim {\tl_head:N \l__cal_tmpc_tl} \tl_set:Nx \l__cal_tmpc_tl {\tl_tail:N \l__cal_tmpc_tl} \tl_put_right:NV #1 \g__spath_lineto_tl \tl_put_right:Nx #1 { {\dim_eval:n {(2\l__cal_tmpa_dim + \l__cal_tmpc_dim)/3}} {\dim_eval:n {(2\l__cal_tmpb_dim + \l__cal_tmpd_dim)/3}} } \tl_put_right:NV #1 \g__spath_lineto_tl \tl_put_right:Nx #1 { {\dim_eval:n {(\l__cal_tmpa_dim + 2\l__cal_tmpc_dim)/3}} {\dim_eval:n {(\l__cal_tmpb_dim + 2\l__cal_tmpd_dim)/3}} } \tl_put_right:NV #1 \g__spath_lineto_tl \tl_put_right:Nx #1 { {\dim_use:N \l__cal_tmpc_dim} {\dim_use:N \l__cal_tmpd_dim} } } \cs_new_nopar:Npn \cal_split_curve_in_two:NN #1#2 { \spath_split_curve:nVNN {.5} #2 \l_tmpa_tl \l_tmpb_tl \tl_set:Nx \l_tmpa_tl {\tl_tail:N \l_tmpa_tl} \tl_set:Nx \l_tmpa_tl {\tl_tail:N \l_tmpa_tl} \tl_set:Nx \l_tmpa_tl {\tl_tail:N \l_tmpa_tl} \tl_set:Nx \l_tmpb_tl {\tl_tail:N \l_tmpb_tl} \tl_set:Nx \l_tmpb_tl {\tl_tail:N \l_tmpb_tl} \tl_set:Nx \l_tmpb_tl {\tl_tail:N \l_tmpb_tl} \tl_put_right:NV #1 \l_tmpa_tl \tl_put_right:NV #1 \l_tmpb_tl } \cs_new_nopar:Npn \cal_split_curve_in_three:NN #1#2 { \spath_split_curve:nVNN {1/3} #2 \l_tmpa_tl \l_tmpb_tl \tl_set:Nx \l_tmpa_tl {\tl_tail:N \l_tmpa_tl} \tl_set:Nx \l_tmpa_tl {\tl_tail:N \l_tmpa_tl} \tl_set:Nx \l_tmpa_tl {\tl_tail:N \l_tmpa_tl} \tl_put_right:NV #1 \l_tmpa_tl \spath_split_curve:nVNN {.5} \l_tmpb_tl \l_tmpa_tl \l_tmpb_tl \tl_set:Nx \l_tmpa_tl {\tl_tail:N \l_tmpa_tl} \tl_set:Nx \l_tmpa_tl {\tl_tail:N \l_tmpa_tl} \tl_set:Nx \l_tmpa_tl {\tl_tail:N \l_tmpa_tl} \tl_set:Nx \l_tmpb_tl {\tl_tail:N \l_tmpb_tl} \tl_set:Nx \l_tmpb_tl {\tl_tail:N \l_tmpb_tl} \tl_set:Nx \l_tmpb_tl {\tl_tail:N \l_tmpb_tl} \tl_put_right:NV #1 \l_tmpa_tl \tl_put_right:NV #1 \l_tmpb_tl } \cs_new_nopar:Npn \cal_maybe_taper:N #1 { \tl_set_eq:NN \l__cal_tmpa_tl #1 \bool_if:NT \l__cal_taper_start_bool { \dim_set:Nn \l__cal_tmpa_dim {\tl_item:Nn \l__cal_tmpa_tl {2}} \dim_set:Nn \l__cal_tmpb_dim {\tl_item:Nn \l__cal_tmpa_tl {3}} \tl_set:Nx \l__cal_tmpb_tl {\tl_item:Nn \l__cal_tmpa_tl {4}} \tl_case:NnF \l__cal_tmpb_tl { \g__spath_lineto_tl { \bool_set_true:N \l__cal_taperable_bool \dim_set:Nn \l__cal_tmpg_dim {\tl_item:Nn \l__cal_tmpa_tl {5}} \dim_set:Nn \l__cal_tmph_dim {\tl_item:Nn \l__cal_tmpa_tl {6}} \dim_set:Nn \l__cal_tmpc_dim {(2\l__cal_tmpa_dim + \l__cal_tmpg_dim)/3} \dim_set:Nn \l__cal_tmpd_dim {(2\l__cal_tmpb_dim + \l__cal_tmph_dim)/3} \dim_set:Nn \l__cal_tmpe_dim {(\l__cal_tmpa_dim + 2\l__cal_tmpg_dim)/3} \dim_set:Nn \l__cal_tmpf_dim {(\l__cal_tmpb_dim + 2\l__cal_tmph_dim)/3} \prg_replicate:nn {4} { \tl_set:Nx \l__cal_tmpa_tl {\tl_tail:N \l__cal_tmpa_tl} } \tl_put_left:NV \l__cal_tmpa_tl \g__spath_moveto_tl } \g__spath_curvetoa_tl { \bool_set_true:N \l__cal_taperable_bool \dim_set:Nn \l__cal_tmpc_dim {\tl_item:Nn \l__cal_tmpa_tl {5}} \dim_set:Nn \l__cal_tmpd_dim {\tl_item:Nn \l__cal_tmpa_tl {6}} \dim_set:Nn \l__cal_tmpe_dim {\tl_item:Nn \l__cal_tmpa_tl {8}} \dim_set:Nn \l__cal_tmpf_dim {\tl_item:Nn \l__cal_tmpa_tl {9}} \dim_set:Nn \l__cal_tmpg_dim {\tl_item:Nn \l__cal_tmpa_tl {11}} \dim_set:Nn \l__cal_tmph_dim {\tl_item:Nn \l__cal_tmpa_tl {12}} \prg_replicate:nn {10} { \tl_set:Nx \l__cal_tmpa_tl {\tl_tail:N \l__cal_tmpa_tl} } \tl_put_left:NV \l__cal_tmpa_tl \g__spath_moveto_tl } } { \bool_set_false:N \l__cal_taperable_bool } \bool_if:NT \l__cal_taperable_bool { \__cal_taper_aux: } } \bool_if:NT \l__cal_taper_end_bool { \dim_set:Nn \l__cal_tmpa_dim {\tl_item:Nn \l__cal_tmpa_tl {-2}} \dim_set:Nn \l__cal_tmpb_dim {\tl_item:Nn \l__cal_tmpa_tl {-1}} \tl_set:Nx \l__cal_tmpb_tl {\tl_item:Nn \l__cal_tmpa_tl {-3}} \tl_case:NnF \l__cal_tmpb_tl { \g__spath_lineto_tl { \bool_set_true:N \l__cal_taperable_bool \dim_set:Nn \l__cal_tmpg_dim {\tl_item:Nn \l__cal_tmpa_tl {-5}} \dim_set:Nn \l__cal_tmph_dim {\tl_item:Nn \l__cal_tmpa_tl {-4}} \dim_set:Nn \l__cal_tmpc_dim {(2\l__cal_tmpa_dim + \l__cal_tmpg_dim)/3} \dim_set:Nn \l__cal_tmpd_dim {(2\l__cal_tmpb_dim + \l__cal_tmph_dim)/3} \dim_set:Nn \l__cal_tmpe_dim {(\l__cal_tmpa_dim + 2\l__cal_tmpg_dim)/3} \dim_set:Nn \l__cal_tmpf_dim {(\l__cal_tmpb_dim + 2\l__cal_tmph_dim)/3} \tl_reverse:N \l__cal_tmpa_tl \prg_replicate:nn {3} { \tl_set:Nx \l__cal_tmpa_tl {\tl_tail:N \l__cal_tmpa_tl} } \tl_reverse:N \l__cal_tmpa_tl } \g__spath_curveto_tl { \bool_set_true:N \l__cal_taperable_bool \dim_set:Nn \l__cal_tmpc_dim {\tl_item:Nn \l__cal_tmpa_tl {-5}} \dim_set:Nn \l__cal_tmpd_dim {\tl_item:Nn \l__cal_tmpa_tl {-4}} \dim_set:Nn \l__cal_tmpe_dim {\tl_item:Nn \l__cal_tmpa_tl {-8}} \dim_set:Nn \l__cal_tmpf_dim {\tl_item:Nn \l__cal_tmpa_tl {-7}} \dim_set:Nn \l__cal_tmpg_dim {\tl_item:Nn \l__cal_tmpa_tl {-11}} \dim_set:Nn \l__cal_tmph_dim {\tl_item:Nn \l__cal_tmpa_tl {-10}} \tl_reverse:N \l__cal_tmpa_tl \prg_replicate:nn {9} { \tl_set:Nx \l__cal_tmpa_tl {\tl_tail:N \l__cal_tmpa_tl} } \tl_reverse:N \l__cal_tmpa_tl } } { \bool_set_false:N \l__cal_taperable_bool } \bool_if:NT \l__cal_taperable_bool { \__cal_taper_aux: } } \pgfsyssoftpath@setcurrentpath\l__cal_tmpa_tl \pgfsetstrokecolor{\pgfkeysvalueof{/tikz/pen~colour}} \pgfusepath{stroke} } \cs_new_nopar:Npn \__cal_taper_aux: { \tl_clear:N \l__cal_tmpb_tl \tl_put_right:NV \l__cal_tmpb_tl \g__spath_moveto_tl \fp_set:Nn \l__cal_tmpa_fp { \l__cal_tmpd_dim - \l__cal_tmpb_dim } \fp_set:Nn \l__cal_tmpb_fp { \l__cal_tmpa_dim - \l__cal_tmpc_dim } \fp_set:Nn \l__cal_tmpe_fp { (\l__cal_tmpa_fp^2 + \l__cal_tmpb_fp^2)^.5 } \fp_set:Nn \l__cal_tmpa_fp {.5*\l__cal_taper_width_dim * \l__cal_tmpa_fp / \l__cal_tmpe_fp} \fp_set:Nn \l__cal_tmpb_fp {.5*\l__cal_taper_width_dim * \l__cal_tmpb_fp / \l__cal_tmpe_fp} \fp_set:Nn \l__cal_tmpc_fp { \l__cal_tmph_dim - \l__cal_tmpf_dim } \fp_set:Nn \l__cal_tmpd_fp { \l__cal_tmpe_dim - \l__cal_tmpg_dim } \fp_set:Nn \l__cal_tmpe_fp { (\l__cal_tmpc_fp^2 + \l__cal_tmpd_fp^2)^.5 } \fp_set:Nn \l__cal_tmpc_fp {.5*\l__cal_line_width_dim * \l__cal_tmpc_fp / \l__cal_tmpe_fp} \fp_set:Nn \l__cal_tmpd_fp {.5*\l__cal_line_width_dim * \l__cal_tmpd_fp / \l__cal_tmpe_fp} \tl_put_right:Nx \l__cal_tmpb_tl { {\dim_eval:n { \fp_to_dim:N \l__cal_tmpa_fp + \l__cal_tmpa_dim}} {\dim_eval:n { \fp_to_dim:N \l__cal_tmpb_fp + \l__cal_tmpb_dim}} } \tl_put_right:NV \l__cal_tmpb_tl \g__spath_curvetoa_tl \tl_put_right:Nx \l__cal_tmpb_tl { {\dim_eval:n { \fp_to_dim:N \l__cal_tmpa_fp + \l__cal_tmpc_dim}} {\dim_eval:n { \fp_to_dim:N \l__cal_tmpb_fp + \l__cal_tmpd_dim}} } \tl_put_right:NV \l__cal_tmpb_tl \g__spath_curvetob_tl \tl_put_right:Nx \l__cal_tmpb_tl { {\dim_eval:n { \fp_to_dim:N \l__cal_tmpc_fp + \l__cal_tmpe_dim}} {\dim_eval:n { \fp_to_dim:N \l__cal_tmpd_fp + \l__cal_tmpf_dim}} } \tl_put_right:NV \l__cal_tmpb_tl \g__spath_curveto_tl \tl_put_right:Nx \l__cal_tmpb_tl { {\dim_eval:n { \fp_to_dim:N \l__cal_tmpc_fp + \l__cal_tmpg_dim}} {\dim_eval:n { \fp_to_dim:N \l__cal_tmpd_fp + \l__cal_tmph_dim}} } \tl_put_right:NV \l__cal_tmpb_tl \g__spath_curvetoa_tl \tl_put_right:Nx \l__cal_tmpb_tl { {\dim_eval:n { \fp_to_dim:N \l__cal_tmpc_fp + \l__cal_tmpg_dim - \fp_to_dim:n{ 1.32 * \l__cal_tmpd_fp}}} {\dim_eval:n { \fp_to_dim:N \l__cal_tmpd_fp + \l__cal_tmph_dim + \fp_to_dim:n {1.32* \l__cal_tmpc_fp}}} } \tl_put_right:NV \l__cal_tmpb_tl \g__spath_curvetob_tl \tl_put_right:Nx \l__cal_tmpb_tl { {\dim_eval:n { -\fp_to_dim:N \l__cal_tmpc_fp + \l__cal_tmpg_dim - \fp_to_dim:n {1.32 * \l__cal_tmpd_fp}}} {\dim_eval:n { -\fp_to_dim:N \l__cal_tmpd_fp + \l__cal_tmph_dim + \fp_to_dim:n {1.32 * \l__cal_tmpc_fp}}} } \tl_put_right:NV \l__cal_tmpb_tl \g__spath_curveto_tl \tl_put_right:Nx \l__cal_tmpb_tl { {\dim_eval:n { -\fp_to_dim:N \l__cal_tmpc_fp + \l__cal_tmpg_dim}} {\dim_eval:n { -\fp_to_dim:N \l__cal_tmpd_fp + \l__cal_tmph_dim}} } \tl_put_right:NV \l__cal_tmpb_tl \g__spath_curvetoa_tl \tl_put_right:Nx \l__cal_tmpb_tl { {\dim_eval:n { -\fp_to_dim:N \l__cal_tmpc_fp + \l__cal_tmpe_dim}} {\dim_eval:n { -\fp_to_dim:N \l__cal_tmpd_fp + \l__cal_tmpf_dim}} } \tl_put_right:NV \l__cal_tmpb_tl \g__spath_curvetob_tl \tl_put_right:Nx \l__cal_tmpb_tl { {\dim_eval:n { -\fp_to_dim:N \l__cal_tmpa_fp + \l__cal_tmpc_dim}} {\dim_eval:n { -\fp_to_dim:N \l__cal_tmpb_fp + \l__cal_tmpd_dim}} } \tl_put_right:NV \l__cal_tmpb_tl \g__spath_curveto_tl \tl_put_right:Nx \l__cal_tmpb_tl { {\dim_eval:n { -\fp_to_dim:N \l__cal_tmpa_fp + \l__cal_tmpa_dim}} {\dim_eval:n { -\fp_to_dim:N \l__cal_tmpb_fp + \l__cal_tmpb_dim}} } \tl_put_right:NV \l__cal_tmpb_tl \g__spath_curvetoa_tl \tl_put_right:Nx \l__cal_tmpb_tl { {\dim_eval:n { -\fp_to_dim:N \l__cal_tmpa_fp + \l__cal_tmpa_dim + \fp_to_dim:n{ 1.32 * \l__cal_tmpb_fp}}} {\dim_eval:n { -\fp_to_dim:N \l__cal_tmpb_fp + \l__cal_tmpb_dim - \fp_to_dim:n {1.32* \l__cal_tmpa_fp}}} } \tl_put_right:NV \l__cal_tmpb_tl \g__spath_curvetob_tl \tl_put_right:Nx \l__cal_tmpb_tl { {\dim_eval:n { \fp_to_dim:N \l__cal_tmpa_fp + \l__cal_tmpa_dim + \fp_to_dim:n {1.32 * \l__cal_tmpb_fp}}} {\dim_eval:n { \fp_to_dim:N \l__cal_tmpb_fp + \l__cal_tmpb_dim - \fp_to_dim:n {1.32 * \l__cal_tmpa_fp}}} } \tl_put_right:NV \l__cal_tmpb_tl \g__spath_curveto_tl \tl_put_right:Nx \l__cal_tmpb_tl { {\dim_eval:n { \fp_to_dim:N \l__cal_tmpa_fp + \l__cal_tmpa_dim}} {\dim_eval:n { \fp_to_dim:N \l__cal_tmpb_fp + \l__cal_tmpb_dim}} } \pgfsyssoftpath@setcurrentpath\l__cal_tmpb_tl \pgfsetfillcolor{\pgfkeysvalueof{/tikz/pen~colour}} \pgfusepath{fill} } \tl_set:Nn \l__cal_tmpa_tl {\pgfsyssoftpath@movetotoken{0pt}{0pt}} \MakeSPathList{calligraphy pen copperplate}{\l__cal_tmpa_tl} \SPathListPrepare{calligraphy pen copperplate} \ExplSyntaxOff \expandafter\ifx\csname pgfdeclaredecoration\endcsname\relax \else \pgfdeclaredecoration{calligraphic brace}{brace} { \state{brace}[width=+\pgfdecoratedremainingdistance,next state=final] { \pgfsyssoftpath@setcurrentpath{\pgfutil@empty} \pgfpathmoveto{\pgfpointorigin} \pgfpathcurveto {\pgfqpoint{.15\pgfdecorationsegmentamplitude}{.3\pgfdecorationsegmentamplitude}} {\pgfqpoint{.5\pgfdecorationsegmentamplitude}{.5\pgfdecorationsegmentamplitude}} {\pgfqpoint{\pgfdecorationsegmentamplitude}{.5\pgfdecorationsegmentamplitude}} { \pgftransformxshift{+\pgfdecorationsegmentaspect\pgfdecoratedremainingdistance} \pgfpathlineto{\pgfqpoint{-\pgfdecorationsegmentamplitude}{.5\pgfdecorationsegmentamplitude}} \pgfpathcurveto {\pgfqpoint{-.5\pgfdecorationsegmentamplitude}{.5\pgfdecorationsegmentamplitude}} {\pgfqpoint{-.15\pgfdecorationsegmentamplitude}{.7\pgfdecorationsegmentamplitude}} {\pgfqpoint{0\pgfdecorationsegmentamplitude}{1\pgfdecorationsegmentamplitude}} \pgfpathmoveto{\pgfqpoint{0\pgfdecorationsegmentamplitude}{1\pgfdecorationsegmentamplitude}} \pgfpathcurveto {\pgfqpoint{.15\pgfdecorationsegmentamplitude}{.7\pgfdecorationsegmentamplitude}} {\pgfqpoint{.5\pgfdecorationsegmentamplitude}{.5\pgfdecorationsegmentamplitude}} {\pgfqpoint{\pgfdecorationsegmentamplitude}{.5\pgfdecorationsegmentamplitude}} } { \pgftransformxshift{+\pgfdecoratedremainingdistance} \pgfpathlineto{\pgfqpoint{-\pgfdecorationsegmentamplitude}{.5\pgfdecorationsegmentamplitude}} \pgfpathcurveto {\pgfqpoint{-.5\pgfdecorationsegmentamplitude}{.5\pgfdecorationsegmentamplitude}} {\pgfqpoint{-.15\pgfdecorationsegmentamplitude}{.3\pgfdecorationsegmentamplitude}} {\pgfqpoint{0pt}{0pt}} } \tikzset{ taper width=.5\pgflinewidth, taper }% \pgfsyssoftpath@getcurrentpath\cal@tmp@path \MakeSPathList{calligraphy path}{\cal@tmp@path}% \SPathListPrepare{calligraphy path}% \CalligraphyPathCreate{calligraphy path}{copperplate}% } \state{final}{} } \pgfdeclaredecoration{calligraphic straight parenthesis}{brace} { \state{brace}[width=+\pgfdecoratedremainingdistance,next state=final] { \pgfsyssoftpath@setcurrentpath{\pgfutil@empty} \pgfpathmoveto{\pgfpointorigin} \pgfpathcurveto {\pgfqpoint{.76604\pgfdecorationsegmentamplitude}{.64279\pgfdecorationsegmentamplitude}} {\pgfqpoint{2.3333\pgfdecorationsegmentamplitude}{\pgfdecorationsegmentamplitude}} {\pgfqpoint{3.3333\pgfdecorationsegmentamplitude}{\pgfdecorationsegmentamplitude}} { \pgftransformxshift{+\pgfdecoratedremainingdistance} \pgfpathlineto{\pgfqpoint{-3.3333\pgfdecorationsegmentamplitude}{\pgfdecorationsegmentamplitude}} \pgfpathcurveto {\pgfqpoint{-2.3333\pgfdecorationsegmentamplitude}{\pgfdecorationsegmentamplitude}} {\pgfqpoint{-.76604\pgfdecorationsegmentamplitude}{.64279\pgfdecorationsegmentamplitude}} {\pgfqpoint{0pt}{0pt}} } \tikzset{ taper width=.5\pgflinewidth, taper }% \pgfsyssoftpath@getcurrentpath\cal@tmp@path \MakeSPathList{calligraphy path}{\cal@tmp@path}% \SPathListPrepare{calligraphy path}% \CalligraphyPathCreate{calligraphy path}{copperplate}% } \state{final}{}% } \pgfdeclaredecoration{calligraphic curved parenthesis}{brace} { \state{brace}[width=+\pgfdecoratedremainingdistance,next state=final] { \pgfsyssoftpath@setcurrentpath{\pgfutil@empty} \pgfpathmoveto{\pgfpointorigin} \pgf@xa=\pgfdecoratedremainingdistance\relax \advance\pgf@xa by -1.5890\pgfdecorationsegmentamplitude\relax \edef\cgrphy@xa{\the\pgf@xa} \pgfpathcurveto {\pgfqpoint{1.5890\pgfdecorationsegmentamplitude}{1.3333\pgfdecorationsegmentamplitude}} {\pgfqpoint{\cgrphy@xa}{1.3333\pgfdecorationsegmentamplitude}} {\pgfqpoint{\pgfdecoratedremainingdistance}{0pt}} \tikzset{ taper width=.5\pgflinewidth, taper }% \pgfsyssoftpath@getcurrentpath\cal@tmp@path \MakeSPathList{calligraphy path}{\cal@tmp@path}% \SPathListPrepare{calligraphy path}% \CalligraphyPathCreate{calligraphy path}{copperplate}% } \state{final}{}% } \fi %% %% Copyright (C) 2011-2019 by Andrew Stacey %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License (LPPL), either %% version 1.3c of this license or (at your option) any later %% version. The latest version of this license is in the file: %% %% http://www.latex-project.org/lppl.txt %% %% This work is "maintained" (as per LPPL maintenance status) by %% Andrew Stacey. %% %% This work consists of the files spath3.dtx %% calligraphy_doc.tex %% knots_doc.tex %% and the derived files spath3.ins, %% spath3_code.pdf, %% spath3.sty, %% tikzlibrarycalligraphy.code.tex %% tikzlibraryknots.code.tex %% calligraphy.pdf %% knots.pdf %% README %% %% %% End of file `tikzlibrarycalligraphy.code.tex'.