diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz')
3 files changed, 68 insertions, 16 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarypatterns.meta.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarypatterns.meta.code.tex index 3b52136f708..4327768186c 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarypatterns.meta.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarypatterns.meta.code.tex @@ -45,7 +45,7 @@ \let\tikz@transform=\relax\pgfkeys{/tikz/.cd,#1}}% }, infer tile bounding box/.code={ - \def\pgf@pat@codeafterhook{% + \def\pgf@pat@codeafter{% \xdef\tikz@pat@installbb{% \noexpand\pgfkeys{/tikz/patterns/bounding box={% (\the\pgf@picminx-#1,\the\pgf@picminy-#1) and @@ -62,13 +62,13 @@ \def\tikzdeclarepattern#1{% \begingroup% - \def\pgf@pat@codebeforehook{% + \def\pgf@pat@codebefore{% \let\tikz@transform=\relax% \pgftransformreset% <- Hmm? \tikz@declarepattern@install% \ifnum\pgf@pat@type=0\relax% - \let\pgfsetstrokecolor=\tikz@pat@gobbleone% - \let\pgfsetfillcolor=\tikz@pat@gobbleone% + \let\pgfsetstrokecolor=\pgfutil@gobble% + \let\pgfsetfillcolor=\pgfutil@gobble% \fi% \def\tikz@fig{% \tikzerror{You cannot use nodes inside a pattern}% @@ -76,7 +76,7 @@ \tikzset{pattern/.code={\tikzerror{You cannot nest patterns}}, pattern color/.style={pattern}}% }% - \pgfdeclarepattern{/tikz/patterns/.cd, #1}% + \pgfdeclarepattern{/tikz/patterns/.cd,#1}% \endgroup% }% diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarytopaths.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarytopaths.code.tex index b719271d57e..2051fce8fd6 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarytopaths.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarytopaths.code.tex @@ -34,9 +34,7 @@ \pgfmathsetmacro\tikz@to@bend{#1}% \fi% \let\tikz@to@out=\tikz@to@bend% - \c@pgf@counta=180\relax% - \advance\c@pgf@counta by-\tikz@to@out\relax% - \edef\tikz@to@in{\the\c@pgf@counta}% + \pgfmathsetmacro\tikz@to@in{180-\tikz@to@out}% \tikz@to@switch@on% \tikz@to@relativetrue% } diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex index 090155e26d0..5f67167ad37 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex @@ -20,6 +20,8 @@ \newdimen\tikz@lasty \newdimen\tikz@lastxsaved \newdimen\tikz@lastysaved +\newdimen\tikz@lastmovetox +\newdimen\tikz@lastmovetoy \newdimen\tikzleveldistance \newdimen\tikzsiblingdistance @@ -146,6 +148,42 @@ \expandafter\def\expandafter\tikz@dashpattern\expandafter{\tikz@dashpattern{#1}}% \pgfutil@ifnextchar\@nil{\pgfutil@gobble}{\tikz@scandashon}}% +% use a decoration to expand the `off' section of a dash pattern. +% https://tex.stackexchange.com/a/133357 +\tikzset{ + dash expand off/.code={% + \ifcsname tikz@library@decorations@loaded\endcsname\else + \tikzerror{You need \string\usetikzlibrary{decorations} for ``dash offexpand''}% + \fi + \tikz@addoption{% + \pgfgetpath\currentpath + \pgfprocessround{\currentpath}{\currentpath}% + \pgf@decorate@parsesoftpath{\currentpath}{\currentpath}% + % Parse \on and \off from the current path + \edef\on{\expandafter\pgfutil@firstoftwo\tikz@dashpattern}% + \edef\off{\expandafter\pgfutil@secondoftwo\tikz@dashpattern}% + % \dashphase = max(\on - \dashphase, 0) + \pgfmathsubtract@{\on}{\tikz@dashphase}% + \pgfmathmax@{\pgfmathresult}{0}% + \edef\dashphase{\the\dimexpr\pgfmathresult pt\relax}% + % \rest = \pgf@decorate@totalpathlength - \on + \edef\rest{\expandafter\pgf@sys@tonumber\dimexpr\pgf@decorate@totalpathlength - \on + 2\dimexpr\dashphase\relax\relax}% + % \onoff = \on + \off + \edef\onoff{\expandafter\pgf@sys@tonumber\dimexpr\on+\off\relax}% + % \nfullonoff = max(floor(\rest/\onoff), 1) + \pgfmathdivide@{\rest}{\onoff}% + \pgfmathfloor@{\pgfmathresult}% + \pgfmathmax@{\pgfmathresult}{1}% + % \offexpand = max(\rest/\nfullonoff - \on, \off) + \pgfmathdivide@{\rest}{\pgfmathresult}% + \pgfmathsubtract@{\pgfmathresult}{\on}% + \pgfmathmax@{\pgfmathresult}{\off}% + \edef\tikz@marshal{\noexpand\pgfsetdash{{\on}{\pgfmathresult}}{\dashphase}}% + \tikz@marshal + }% + } +} + \tikzoption{draw opacity}{\tikz@addoption{\pgfsetstrokeopacity{#1}}}% % Double draw options @@ -1584,6 +1622,7 @@ % ID callbacks \newif\iftikz@is@node +\let\tikz@id@name\pgfutil@empty \let\tikz@id@hook\pgfutil@empty \def\tikz@call@id@hook{\ifx\tikz@id@hook\pgfutil@empty\else\tikz@id@hook\pgfuseid{\tikz@id@name}\fi}% @@ -2673,24 +2712,38 @@ \def\tikz@moveto{% \tikz@scan@one@point{\tikz@@moveto}}% \def\tikz@@moveto#1{% - \tikz@make@last@position{#1}% + \tikz@make@last@position{#1}% \iftikz@shapeborder% % ok, the moveto will have to wait. flag that we have a moveto in % waiting: \edef\tikz@moveto@waiting{\tikz@shapeborder@name}% \else% - \pgfpathmoveto{\tikz@last@position}% + \tikz@@movetosave{\tikz@last@position}% \let\tikz@moveto@waiting=\relax% \fi% \tikz@scan@next@command% }% + % Wrapper around \pgfpathmoveto that adds a save +\def\tikz@@movetosave#1{% + {\pgftransformreset + \pgf@process{#1}% + \xdef\tikz@marshal{% + \tikz@lastmovetox=\the\pgf@x\relax% + \tikz@lastmovetoy=\the\pgf@y\relax% + }% + }% + \tikz@marshal + \pgfpathmoveto{#1}% +}% + + \let\tikz@moveto@waiting=\relax % normally, nothing is waiting... \def\tikz@flush@moveto{% \ifx\tikz@moveto@waiting\relax% \else% - \pgfpathmoveto{\tikz@last@position}% + \tikz@@movetosave{\tikz@last@position}% \fi% \let\tikz@moveto@waiting=\relax% }% @@ -2707,7 +2760,7 @@ #2=\pgf@x% #3=\pgf@y% \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% - \pgfpathmoveto{\pgfqpoint{\pgf@x}{\pgf@y}}% + \tikz@@movetosave{\pgfqpoint{\pgf@x}{\pgf@y}}% \fi% \let\tikz@moveto@waiting=\relax% }% @@ -2954,7 +3007,8 @@ \tikz@make@last@position{\expandafter\pgfpoint\pgfsyssoftpath@lastmoveto}% \tikz@path@close{\expandafter\pgfpoint\pgfsyssoftpath@lastmoveto}% \def\pgfstrokehook{}% - \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \edef\tikz@timer@end{%\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \noexpand\pgfqpoint{\the\tikz@lastmovetox}{\the\tikz@lastmovetoy}}% \let\tikz@timer=\tikz@timer@line% \let\tikz@tangent\tikz@timer@start% \tikz@scan@next@command% @@ -3226,7 +3280,7 @@ \else% \pgf@process{\pgfpointshapeborder{\tikz@moveto@waiting}{\tikz@curve@first}}% \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% - \pgfpathmoveto{\pgfqpoint{\pgf@x}{\pgf@y}}% + \tikz@@movetosave{\pgfqpoint{\pgf@x}{\pgf@y}}% \fi% \let\tikz@timer@cont@one=\tikz@curve@first% \let\tikz@timer@cont@two=\tikz@curve@second% @@ -3271,7 +3325,7 @@ \tikz@make@last@position{#1}% \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% \let\tikz@timer=\tikz@timer@line% - \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}% + \tikz@@movetosave{\pgfqpoint{\pgf@xa}{\pgf@ya}}% \tikz@path@lineto{\pgfqpoint{\pgf@xa}{\tikz@lasty}}% \tikz@path@lineto{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}% \tikz@path@lineto{\pgfqpoint{\tikz@lastx}{\pgf@ya}}% @@ -3279,7 +3333,7 @@ \tikz@path@lineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}% \fi% \pgfpathclose% - \pgfpathmoveto{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}% + \tikz@@movetosave{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}% \def\pgfstrokehook{}% \let\tikz@tangent\relax% \tikz@scan@next@command% |