diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/tikz-ext')
10 files changed, 659 insertions, 56 deletions
diff --git a/Master/texmf-dist/tex/generic/tikz-ext/pgffor-ext.code.tex b/Master/texmf-dist/tex/generic/tikz-ext/pgffor-ext.code.tex new file mode 100644 index 00000000000..b4d9e60f500 --- /dev/null +++ b/Master/texmf-dist/tex/generic/tikz-ext/pgffor-ext.code.tex @@ -0,0 +1,73 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% + +%% foreach +%% http://tex.stackexchange.com/a/126418/16595 +%% instead of \foreach \var in {start, start + delta, ..., end} +%% this allows to use \foreach[use int={start to end step delta}] without(!) a list in {} +%% the values start, end and delta are evaluated by PGFmath at the start of the loop. +%% In addition to use int, there's also use float. +\newif\iftikzext@pgf@foreach@no@list +\pgfqkeys{/pgf/foreach}{ + normal list/.code={% + \tikzext@pgf@foreach@no@listfalse + \def\pgffor@scan{\pgfutil@ifnextchar({\pgffor@scanround}{\pgffor@scanone}}% + }, + no separator/.code={% token for token + \def\pgffor@scan@custom##1{% + \def\pgffor@value{##1}% + \pgffor@scanned + }% + \def\pgffor@scan@custom@comma,{% + \pgfutil@ifnextchar\pgffor@stop + \pgffor@scanone + {\pgffor@scan@custom,}% + }% + \def\pgffor@scan{% + \pgfutil@ifnextchar,% + \pgffor@scan@custom@comma + {% + \pgfutil@ifnextchar\pgffor@stop + \pgffor@scanone + \pgffor@scan@custom + }% + }% + }, + use int/.code={% + \tikzext@pgf@foreach@no@list@parse@to\pgfmathtruncatemacro#1\pgffor@stop + }, + use float/.code={% + \tikzext@pgf@foreach@no@list@parse@to\pgfmathsetmacro#1\pgffor@stop + } +} + +\def\tikzext@pgf@foreach@no@list@parse@to#1#2to#3\pgffor@stop{% + \tikzext@pgf@foreach@no@listtrue + #1\foreachStart{#2}% + \pgfutil@in@{step}{#3} + \ifpgfutil@in@ + \tikzext@pgf@foreach@no@list@parse@step{#1}#3\pgffor@stop + \else + \tikzext@pgf@foreach@no@list@parse@step{#1}#3step1\pgffor@stop + \fi + \edef\tikzext@pgf@foreach@no@list@list{\foreachStart,\foreachSecond,...,\foreachEnd}% +} +\def\tikzext@pgf@foreach@no@list@parse@step#1#2step#3\pgffor@stop{% + #1\foreachEnd{#2}% + #1\foreachSecond{\foreachStart+#3}% +} +\def\pgffor@vars{% + \pgfutil@ifnextchar i{\pgffor@@vars@end}{% + \pgfutil@ifnextchar[{\pgffor@@vars@opt}{%] + \pgfutil@ifnextchar/{\pgffor@@vars@slash@gobble}{% + \iftikzext@pgf@foreach@no@list\expandafter\pgfutil@firstoftwo\else + \expandafter\pgfutil@secondoftwo\fi + {\tikzext@pgf@foreach@no@listfalse\pgffor@macro@list\tikzext@pgf@foreach@no@list@list} + {\pgffor@@vars}}}}}% + +\endinput
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/tikz-ext/pgfkeyslibraryext.pgfkeys-plus.code.tex b/Master/texmf-dist/tex/generic/tikz-ext/pgfkeyslibraryext.pgfkeys-plus.code.tex index 49aedb64c6c..50cbe7a60c9 100644 --- a/Master/texmf-dist/tex/generic/tikz-ext/pgfkeyslibraryext.pgfkeys-plus.code.tex +++ b/Master/texmf-dist/tex/generic/tikz-ext/pgfkeyslibraryext.pgfkeys-plus.code.tex @@ -88,13 +88,22 @@ }, %% http://tex.stackexchange.com/a/144187/16595 %% key/.List={(point-1),(point-2),(point-...),(point-6)} will call - %% key=(point-1)(point-2)(point-3)(point-4)(point-5),(point-6) + %% key=(point-1)(point-2)(point-3)(point-4)(point-5)(point-6) .List/.code=% \let\pgfkeys@global@temp\pgfutil@empty \foreach\pgfkeys@temp in{#1}{% \expandafter\pgfutil@g@addto@macro\expandafter\pgfkeys@global@temp\expandafter{\pgfkeys@temp}% }% - \expandafter\pgfkeys@exp@call\expandafter{\pgfkeys@global@temp}% + \expandafter\pgfkeys@exp@call\expandafter{\pgfkeys@global@temp}, + .--/.code=% decrements a value (only TeX integers!) + \pgfkeyssetevalue{\pgfkeyscurrentpath} + {\the\numexpr\pgfkeysvalueof{\pgfkeyscurrentpath}-1\relax}, + .++/.code=% increments a value (only TeX integers!) + \pgfkeyssetevalue{\pgfkeyscurrentpath} + {\the\numexpr\pgfkeysvalueof{\pgfkeyscurrentpath}+1\relax}, + .value/.code=% copies the value of one key to another w/o expanding it + \pgfkeysgetvalue{#1}\pgfkeys@temp + \expandafter\pgfkeys@exp@call\expandafter{\pgfkeys@temp}} } \pgfqkeys{/utils}{ @@ -134,6 +143,7 @@ \pgfutil@ifempty{#1}{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}% }, tex/.search also=/utils/TeX, + loops/do until/.code 2 args={\pgfutil@loop\pgfkeysalso{#1}#2\relax\pgfutil@repeat}% } \endinput
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/tikz-ext/pgflibraryext.shapes.uncenteredrectangle.code.tex b/Master/texmf-dist/tex/generic/tikz-ext/pgflibraryext.shapes.uncenteredrectangle.code.tex index 182ebbbcb7f..f0ed9c5c46b 100644 --- a/Master/texmf-dist/tex/generic/tikz-ext/pgflibraryext.shapes.uncenteredrectangle.code.tex +++ b/Master/texmf-dist/tex/generic/tikz-ext/pgflibraryext.shapes.uncenteredrectangle.code.tex @@ -12,7 +12,11 @@ \let\pgfnodepartleftbox\pgfnodeparttwobox \let\pgfnodepartrightbox\pgfnodepartthreebox } + +\newif\iftikzext@uncenteredrectangle@usesavedcenter + \pgfset{ + uncentered rectangle use saved center/.is if=tikzext@uncenteredrectangle@usesavedcenter, uncentered rectangle center yshift/.initial=, uncentered rectangle center/@center/.initial=2, uncentered rectangle center/.is choice, @@ -176,8 +180,16 @@ \advance\pgf@y by \pgf@ya }% % + \savedmacro\center{% + \pgfkeysgetvalue{/pgf/uncentered rectangle center/@center}\center + } \anchor{center}{% - \ifcase\pgfkeysvalueof{/pgf/uncentered rectangle center/@center}\relax + \ifcase + \iftikzext@uncenteredrectangle@usesavedcenter + \center + \else + \pgfkeysvalueof{/pgf/uncentered rectangle center/@center}% + \fi\relax \realCenter\or \leftCenter\or \middleCenter\or @@ -203,7 +215,8 @@ \pgfmathsetlength\pgf@y{.5ex}}% \anchor{base}{% \csname pgf@anchor@uncentered rectangle@center\endcsname - \pgf@y=0pt }% + \pgf@y=0pt + }% \anchor{left mid} {\leftCenter \pgfmathsetlength\pgf@y{+.5ex}} \anchor{text mid} {\middleCenter\pgfmathsetlength\pgf@y{+.5ex}} \anchor{right mid} {\rightCenter \pgfmathsetlength\pgf@y{+.5ex}} @@ -273,30 +286,51 @@ \pgf@xa=\pgf@x \pgf@ya=\pgf@y % xc/yc is "center" - \pgf@sh@reanchor{uncentered rectangle}{center}% + \pgf@process{\csname pgf@anchor@uncentered rectangle@center\endcsname}% \pgf@xc=\pgf@x \pgf@yc=\pgf@y \ifdim\pgf@xa<0pt % left side \southwest - \advance\pgf@x by -\pgf@xc - \advance\pgf@y by -\pgf@yc - \pgf@x=-\pgf@x - \pgf@y=-\pgf@y + \pgf@xb=\pgf@x + \pgf@yb=\pgf@y + \advance\pgf@xb by -\pgf@xc + \ifdim\pgf@ya<0pt + % south west side + \advance\pgf@yb by -\pgf@yc + \pgf@yb=-\pgf@yb + \else + % north west side + \northeast + \pgf@yb=\pgf@y + \advance\pgf@yb by -\pgf@yc + \fi + \pgf@xb=-\pgf@xb \edef\pgf@marshal{% \noexpand\pgfpointborderrectangle {\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}} - {\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% }% \else % right side \northeast - \advance\pgf@x by -\pgf@xc - \advance\pgf@y by -\pgf@yc + \pgf@xb=\pgf@x + \pgf@yb=\pgf@y + \advance\pgf@xb by -\pgf@xc + \ifdim\pgf@ya>0pt + % north east side + \advance\pgf@yb by -\pgf@yc + \else + % south east side + \southwest + \pgf@yb=\pgf@y + \advance\pgf@yb by -\pgf@yc + \pgf@yb=-\pgf@yb + \fi \edef\pgf@marshal{% \noexpand\pgfpointborderrectangle {\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}} - {\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% }% \fi \pgf@process{\pgf@marshal}% diff --git a/Master/texmf-dist/tex/generic/tikz-ext/tikzlibraryext.calendar-plus.code.tex b/Master/texmf-dist/tex/generic/tikz-ext/tikzlibraryext.calendar-plus.code.tex index 195ecf9414e..1ad4c9fe52b 100644 --- a/Master/texmf-dist/tex/generic/tikz-ext/tikzlibraryext.calendar-plus.code.tex +++ b/Master/texmf-dist/tex/generic/tikz-ext/tikzlibraryext.calendar-plus.code.tex @@ -13,18 +13,33 @@ \def\tikz@lib@cal@xshift{\pgfkeysvalueof{/tikz/day xshift}} \def\tikz@lib@cal@yshift{\pgfkeysvalueof{/tikz/day yshift}} +\pgfkeyslet{/tikz/day xshift/.@cmd}\@undefined +\pgfkeyslet{/tikz/day xshift/.@body}\@undefined +\pgfkeyslet{/tikz/day xshift/.@def}\@undefined +\pgfkeyslet{/tikz/day yshift/.@cmd}\@undefined +\pgfkeyslet{/tikz/day yshift/.@body}\@undefined +\pgfkeyslet{/tikz/day yshift/.@def}\@undefined \tikzset{day xshift/.initial=3ex,day yshift/.initial=3.5ex} % Shift between months \def\tikz@lib@cal@month@xshift{\pgfkeysvalueof{/tikz/month xshift}} \def\tikz@lib@cal@month@yshift{\pgfkeysvalueof{/tikz/month yshift}} +\pgfkeyslet{/tikz/month xshift/.@cmd}\@undefined +\pgfkeyslet{/tikz/month xshift/.@body}\@undefined +\pgfkeyslet{/tikz/month xshift/.@def}\@undefined +\pgfkeyslet{/tikz/month yshift/.@cmd}\@undefined +\pgfkeyslet{/tikz/month yshift/.@body}\@undefined +\pgfkeyslet{/tikz/month xshift/.@def}\@undefined \tikzset{month xshift/.initial=9ex,month yshift/.initial=9ex} % Internal option for storing the "width" of a calendar as a number of % days \def\tikz@lib@cal@width{\pgfkeysvalueof{/tikz/tikz@lib@cal@width}} +\pgfkeyslet{/tikz/tikz@lib@cal@width/.@cmd}\@undefined +\pgfkeyslet{/tikz/tikz@lib@cal@width/.@body}\@undefined +\pgfkeyslet{/tikz/tikz@lib@cal@width/.@def}\@undefined \tikzset{tikz@lib@cal@width/.initial=1} % Weeks diff --git a/Master/texmf-dist/tex/generic/tikz-ext/tikzlibraryext.layers.code.tex b/Master/texmf-dist/tex/generic/tikz-ext/tikzlibraryext.layers.code.tex new file mode 100644 index 00000000000..c981190f4d0 --- /dev/null +++ b/Master/texmf-dist/tex/generic/tikz-ext/tikzlibraryext.layers.code.tex @@ -0,0 +1,235 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% + +\pgfdeclarelayer{discard} + +\def\tikzext@layers@swapfirstsetbox#1\setbox#2\tikzext@stop{% + #1\tikzext@layers@setbox@which#2% +} +\let\tikzext@layers@setbox@which\setbox + +\def\tikzshowdiscardlayeranyway{\box\pgf@layerbox@discard} +\tikzset{ + discard layer/.code=\expandafter\let\csname pgf@layerbox@#1\endcsname\pgfutil@voidb@x, + discard layer global/.code=\expandafter\global\expandafter\let\csname pgf@layerbox@#1\endcsname\pgfutil@voidb@x, +} +\def\tikzext@layers@whichbox{\tikz@figbox}% +\pgfqkeys{/tikz-ext/layers}{ + in box/.code={% + \expandafter\ifx\tikzext@layers@whichbox#1% + \pgfutil@packagewarning{tikz-ext}{Layer is already set. Setting will be skipped.}% + \else + \def\tikzext@layers@whichbox{#1}% + \def\tikz@whichbox{#1}% + \def\tikzext@layers@setbox@which{\global\setbox}% + \fi + }, + on layer/.style={ + /tikz-ext/layers/in box/.expand once=\csname pgf@layerbox@#1\endcsname + }, + discard/.style={ + /tikz-ext/layers/on layer=discard + }, + @common patch/.style={ + /tikz/behind path/.append code =\let\tikzext@layers@setbox@which\setbox, + /tikz/in front of path/.append code =\let\tikzext@layers@setbox@which\setbox, + /tikz-ext/layers/@common patch/.code=% + }, + patch/.is choice, + patch/all/.style={ + /tikz-ext/layers/@common patch, + /tikz-ext/layers/patch/node, + /tikz-ext/layers/patch/matrix, + /tikz-ext/layers/patch/pic, + /tikz-ext/layers/patch/edge, + }, + patch/node/.style={% + /utils/exec=% + \expandafter\expandafter\expandafter\def + \expandafter\expandafter\expandafter\tikz@fig@continue + \expandafter\expandafter\expandafter{\expandafter\tikzext@layers@swapfirstsetbox\tikz@fig@continue\tikzext@stop},% + /tikz-ext/layers/@common patch, + /tikz-ext/layers/patch/node/.code=\pgfutil@packagewarning{tikz-ext}{You can't apply the layers patch twice.}, + /tikz/discard node/.style ={/tikz-ext/layers/discard}, + /tikz/node on layer/.style={/tikz-ext/layers/on layer={##1}}, + /tikz/node in box/.style ={/tikz-ext/layers/in box={##1}}, + }, + patch/matrix/.style={% + /utils/exec=% + \expandafter\expandafter\expandafter\def + \expandafter\expandafter\expandafter\tikz@do@matrix + \expandafter\expandafter\expandafter{\expandafter\tikzext@layers@swapfirstsetbox\tikz@do@matrix\tikzext@stop},% + /tikz-ext/layers/@common patch, + /tikz-ext/layers/patch/matrix/.code=\pgfutil@packagewarning{tikz-ext}{You can't apply the layers patch twice.}, + /tikz/execute at begin matrix={% in case patched node/edge/pic is used inside matrix + \let\tikzext@layers@setbox@which\setbox + \def\tikz@whichbox{\tikz@figbox}% + \pgfkeys{/tikz-ext/layers/in box/.code=\pgfutil@packageerror{tikz-ext}{Layers inside a matrix can't be used.}}% + }, + /tikz/discard matrix/.style ={/tikz-ext/layers/discard}, + /tikz/matrix on layer/.style={/tikz-ext/layers/on layer={##1}}, + /tikz/matrix in box/.style ={/tikz-ext/layers/in box={##1}}, + }, + patch/edge/.style={% + /utils/exec=\let\tikz@do@edge\tikzext@layers@tikz@do@edge, + /tikz-ext/layers/@common patch, + /tikz-ext/layers/patch/edge/.code=\pgfutil@packagewarning{tikz-ext}{You can't apply the layers patch twice.}, + /tikz/discard edge/.style={/tikz-ext/layers/discard}, + /tikz/edge on layer/.style={ + /tikz-ext/layers/on layer={##1} + }, + /tikz/edge in box/.style={/tikz-ext/layers/in box={##1}}, + }, + patch/pic/.style={% + /utils/exec=\let\tikz@subpicture@handle@\tikzext@layers@tikz@subpicture@handle@, + /tikz-ext/layers/@common patch, + /tikz-ext/layers/patch/pic/.code=\pgfutil@packagewarning{tikz-ext}{You can't apply the layers patch twice.}, + /tikz/discard pic/.style={/tikz-ext/layers/discard}, + /tikz/pic on layer/.style={/tikz-ext/layers/on layer={##1}}, + /tikz/pic in box/.style={/tikz-ext/layers/in box={##1}}, + } +} +\def\tikzext@layers@tikz@do@edge{% + \ifx\tikz@edge@macro\pgfutil@empty% + \tikzext@layers@setbox@which\tikz@whichbox=\hbox\bgroup% + \unhbox\tikz@whichbox% + \hbox\bgroup + \bgroup% + \pgfinterruptpath% + \pgfscope% + \let\tikz@transform=\pgfutil@empty% + \let\tikz@options=\pgfutil@empty% + \tikz@clear@rdf@options% + \let\tikz@tonodes=\tikz@collected@onpath% + \def\tikztonodes{{\pgfextra{\tikz@node@is@a@labeltrue}\tikz@tonodes}}% + \let\tikz@collected@onpath=\pgfutil@empty% + \tikz@options% + \tikz@do@rdf@pre@options% + \pgfidscope% + \tikz@do@rdf@post@options% + \tikz@transform% + \let\tikz@transform=\relax% + % Typeset node: + \let\tikz@after@path\pgfutil@empty% + \tikz@atbegin@to% + \tikz@enable@edge@quotes% + % in case patched nodes/edges/pics/matrices are used + \let\tikzext@layers@setbox@which\setbox + \def\tikz@whichbox{\tikz@figbox}% + \path[style=every edge]\expandafter[\tikz@@to@local@options](\tikztostart)\tikz@to@path + \pgfextra{\global\let\tikz@after@path@smuggle=\tikz@after@path};% + \tikz@atend@to% + \endpgfidscope% + \endpgfscope% + \endpgfinterruptpath% + \egroup + \egroup% + \egroup% + \ifx\tikzext@layers@setbox@which\setbox + \global\setbox\tikz@tempbox=\box\tikz@whichbox% + \expandafter\endgroup% + \expandafter\setbox\tikz@whichbox=\box\tikz@tempbox% + \else + \endgroup + \fi + \else% + \expandafter\expandafter\expandafter\tikz@edge@macro% + \expandafter\expandafter\expandafter{\expandafter\tikz@@to@local@options\expandafter}\expandafter{\tikz@collected@onpath}% + \endgroup% + \let\tikz@after@path@smuggle=\pgfutil@empty% + \fi% + \expandafter\tikz@scan@next@command\tikz@after@path@smuggle% +}% +\def\tikzext@layers@tikz@subpicture@handle@#1{ + \pgfkeys{/tikz/pics/.cd,#1}% + \tikz@node@transformations% + \let\tikz@transform=\relax% + \let\tikz@picmode\tikz@mode% + \tikzset{name prefix ../.style/.expanded={/tikz/name prefix=\pgfkeysvalueof{/tikz/name prefix}}}% + \ifx\tikz@fig@name\pgfutil@empty\else% + \tikzset{name prefix/.expanded=\tikz@fig@name}% + \fi% + \pgfkeysvalueof{/tikz/pics/setup code}% + \pgfkeysgetvalue{/tikz/pics/code}{\tikz@pic@code} + \ifx\tikz@pic@code\pgfutil@empty\else% Qrr: next line + \tikzext@layers@setbox@which\tikz@whichbox=\hbox\bgroup% + \unhbox\tikz@whichbox% + \hbox\bgroup + \bgroup% + \pgfinterruptpath% + \pgfscope% + \tikz@options% + % Qrr: in case patched node/matrix/edge/pic is used inside the pic + \let\tikzext@layers@setbox@which\setbox + \def\tikz@whichbox{\tikz@figbox}% + \setbox\tikz@figbox=\box\pgfutil@voidb@x% + \setbox\tikz@figbox@bg=\box\pgfutil@voidb@x% + \tikz@atbegin@scope% + \scope[every pic/.try]% + \tikz@pic@code% + \endscope% + \tikz@atend@scope% + \endpgfscope% + \endpgfinterruptpath% + \egroup + \egroup% + \egroup% + \fi% + \pgfkeysgetvalue{/tikz/pics/foreground code}{\tikz@pic@code} + \ifx\tikz@pic@code\pgfutil@empty\else% + \unless\ifx\tikzext@layers@setbox@which\setbox + \pgfutil@packagewarning{tikz-ext}{Only the main pic code can be placed on selective layers.} + \fi + \setbox\tikz@figbox=\hbox\bgroup% + \unhbox\tikz@figbox% + \hbox\bgroup + \bgroup% + \pgfinterruptpath% + \pgfscope% + \tikz@options% + \setbox\tikz@figbox=\box\pgfutil@voidb@x% + \setbox\tikz@figbox@bg=\box\pgfutil@voidb@x% + \tikz@atbegin@scope% + \scope[every front pic/.try]% + \tikz@pic@code% + \endscope% + \tikz@atend@scope% + \endpgfscope% + \endpgfinterruptpath% + \egroup + \egroup% + \egroup% + \fi% + \pgfkeysgetvalue{/tikz/pics/background code}{\tikz@pic@code} + \ifx\tikz@pic@code\pgfutil@empty\else% + \unless\ifx\tikzext@layers@setbox@which\setbox + \pgfutil@packagewarning{tikz-ext}{Only the main pic code can be placed on selective layers.} + \fi + \setbox\tikz@figbox@bg=\hbox\bgroup% + \unhbox\tikz@figbox@bg% + \hbox\bgroup + \bgroup% + \pgfinterruptpath% + \pgfscope% + \tikz@options% + \setbox\tikz@figbox=\box\pgfutil@voidb@x% + \setbox\tikz@figbox@bg=\box\pgfutil@voidb@x% + \tikz@atbegin@scope% + \scope[every behind pic/.try]% + \tikz@pic@code% + \endscope% + \tikz@atend@scope% + \endpgfscope% + \endpgfinterruptpath% + \egroup + \egroup% + \egroup% + \fi% + \tikz@node@finish% +}% +\endinput
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/tikz-ext/tikzlibraryext.misc.code.tex b/Master/texmf-dist/tex/generic/tikz-ext/tikzlibraryext.misc.code.tex index a5a982020fd..0f06079e747 100644 --- a/Master/texmf-dist/tex/generic/tikz-ext/tikzlibraryext.misc.code.tex +++ b/Master/texmf-dist/tex/generic/tikz-ext/tikzlibraryext.misc.code.tex @@ -35,45 +35,9 @@ \pgfmath@returnone\pgfmath@x \endgroup} -%% foreach -%% http://tex.stackexchange.com/a/126418/16595 -%% instead of \foreach \var in {start, start + delta, ..., end} -%% this allows to use \foreach[use int={start to end step delta}] without(!) a list in {} -%% the values start, end and delta are evaluated by PGFmath at the start of the loop. -%% In addition to use int, there's also use float. -\newif\iftikzext@pgf@foreach@no@list -\pgfqkeys{/pgf/foreach}{ - use int/.code={% - \tikzext@pgf@foreach@no@list@parse@to\pgfmathtruncatemacro#1\pgffor@stop - }, - use float/.code={% - \tikzext@pgf@foreach@no@list@parse@to\pgfmathsetmacro#1\pgffor@stop - } -} - -\def\tikzext@pgf@foreach@no@list@parse@to#1#2to#3\pgffor@stop{% - \tikzext@pgf@foreach@no@listtrue - #1\foreachStart{#2}% - \pgfutil@in@{step}{#3} - \ifpgfutil@in@ - \tikzext@pgf@foreach@no@list@parse@step{#1}#3\pgffor@stop - \else - \tikzext@pgf@foreach@no@list@parse@step{#1}#3step1\pgffor@stop - \fi - \edef\tikzext@pgf@foreach@no@list@list{\foreachStart,\foreachSecond,...,\foreachEnd}% -} -\def\tikzext@pgf@foreach@no@list@parse@step#1#2step#3\pgffor@stop{% - #1\foreachEnd{#2}% - #1\foreachSecond{\foreachStart+#3}% -} -\def\pgffor@vars{% manually extended, better etoolbox - \pgfutil@ifnextchar i{\pgffor@@vars@end}{% - \pgfutil@ifnextchar[{\pgffor@@vars@opt}{%] - \pgfutil@ifnextchar/{\pgffor@@vars@slash@gobble}{% - \iftikzext@pgf@foreach@no@list\expandafter\pgfutil@firstoftwo\else - \expandafter\pgfutil@secondoftwo\fi - {\tikzext@pgf@foreach@no@listfalse\pgffor@macro@list\tikzext@pgf@foreach@no@list@list} - {\pgffor@@vars}}}}}% +\pgfutil@IfUndefined{tikzext@pgf@foreach@no@list@parse@to}{% stupid test + \input pgffor-ext.code.tex +}{} %% PGFmath %% strrepeat("x", 5) = "xxxxx" @@ -134,6 +98,7 @@ \pgfmathdeclarefunction{distancebetween}{2}{% only coordinates/nodes \begingroup + \nullfont \pgfpointdiff{\pgfpointanchor{#1}{center}}{\pgfpointanchor{#2}{center}}% \edef\pgfmath@temp{{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}}% \expandafter\pgfmathveclen@\pgfmath@temp @@ -141,6 +106,7 @@ \endgroup} \pgfmathdeclarefunction{qdistancebetween}{1}{% only coordinates/nodes \begingroup + \nullfont \pgfpointdiff{\pgfpointorigin}{\pgfpointanchor{#1}{center}}% \edef\pgfmath@temp{{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}}% \expandafter\pgfmathveclen@\pgfmath@temp @@ -148,10 +114,20 @@ \endgroup} \pgfmathdeclarefunction{qanglebetween}{1}{% - \pgfmathanglebetweenpoints{\pgfpointorigin}{\pgfpointanchor{#1}{center}}} + \begingroup + \nullfont + \pgfmathanglebetweenpoints{\pgfpointorigin}{\pgfpointanchor{#1}{center}}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +} \pgfmathdeclarefunction{anglebetween}{2}{% - \pgfmathanglebetweenpoints{\pgfpointanchor{#1}{center}}{\pgfpointanchor{#2}{center}}} + \begingroup + \nullfont + \pgfmathanglebetweenpoints{\pgfpointanchor{#1}{center}}{\pgfpointanchor{#2}{center}}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +} \pgfmathdeclarefunction{isEmpty}{1}{% \begingroup @@ -177,4 +153,57 @@ \pgfutil@g@addto@macro\pgfmathdeclareconstant@@@{\pgfmathdeclarepseudoconstant{#1}{\def\pgfmathresult{#2}}}% \pgfmathdeclareconstant@#3\pgf@stop }% -}
\ No newline at end of file +} + +%%% Some shape + +\tikzset{% quick versions of reverse clips + reverse clip/.is choice, + reverse clip/clockwise/.code={% + \begingroup + \pgfsetcornersarced{\pgfpointorigin}% + \pgfpathqmoveto{16000pt}{16000pt}% + \pgfpathqlineto{16000pt}{-16000pt}% + \pgfpathqlineto{-16000pt}{-16000pt}% + \pgfpathqlineto{-16000pt}{16000pt}% + \pgfpathclose + \endgroup + }, + reverse clip/counter clockwise/.code={% + \begingroup + \pgfsetcornersarced{\pgfpointorigin}% + \pgfpathqmoveto{16000pt}{16000pt}% + \pgfpathqlineto{-16000pt}{16000pt}% + \pgfpathqlineto{-16000pt}{-16000pt}% + \pgfpathqlineto{16000pt}{-16000pt}% + \pgfpathclose + \endgroup + }, + clip rule/.is choice, + clip rule/even odd/.code=\pgfseteorule, + clip rule/nonzero/.code=\pgfsetnonzerorule, + reverse clip/.default=counter clockwise, + remember path/.code={% + \tikz@addmode{% + \expandafter\pgfsyssoftpath@getcurrentpath\csname tikz@intersect@path@name@remember path-#1\endcsname + \immediate\write\pgfutil@auxout{% + \noexpand\expandafter\gdef\noexpand\csname tikz@intersect@path@name@remember path-#1\endcsname{% + \expandafter\expandafter\expandafter\unexpanded + \expandafter\expandafter\expandafter{% + \csname tikz@intersect@path@name@remember path-#1\endcsname + }% + }% + }% + }% + }, + remembered path/.code={% + \pgfutil@IfUndefined{tikz@intersect@path@name@remember path-#1}{}{% + \tikz@addmode{% + \expandafter\pgfsyssoftpath@setcurrentpath + \expandafter{% + \csname tikz@intersect@path@name@remember path-#1\endcsname + }% + }% + }% + },% +}
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/tikz-ext/tikzlibraryext.node-families.code.tex b/Master/texmf-dist/tex/generic/tikz-ext/tikzlibraryext.node-families.code.tex index c0ecda441ac..8661ec637a6 100644 --- a/Master/texmf-dist/tex/generic/tikz-ext/tikzlibraryext.node-families.code.tex +++ b/Master/texmf-dist/tex/generic/tikz-ext/tikzlibraryext.node-families.code.tex @@ -67,6 +67,19 @@ }% } +% #1 = family type +% #2 = family +\def\tikzext@nf@get#1#2{% + \pgfutil@IfUndefined{tikzext@nf@#1@\pgfkeysvalueof{/tikz/node family/prefix}#2@previous} + {0pt} + {\csname tikzext@nf@#1@\pgfkeysvalueof{/tikz/node family/prefix}#2@previous\endcsname}% +} +\def\tikzextnodefamiliesgetwidth{\tikzext@nf@get{width}} +\def\tikzextnodefamiliesgetheight{\tikzext@nf@get{height}} +\def\tikzextnodefamiliesgettextwidth{\tikzext@nf@get{text width}} +\def\tikzextnodefamiliesgettextdepth{\tikzext@nf@get{text depth}} +\def\tikzextnodefamiliesgettextheight{\tikzext@nf@get{text height}} + \pgfdeclareshape{Rectangle}{% \savedanchor\northeast{% % Calculate x diff --git a/Master/texmf-dist/tex/generic/tikz-ext/tikzlibraryext.nodes.code.tex b/Master/texmf-dist/tex/generic/tikz-ext/tikzlibraryext.nodes.code.tex new file mode 100644 index 00000000000..ab7678022bd --- /dev/null +++ b/Master/texmf-dist/tex/generic/tikz-ext/tikzlibraryext.nodes.code.tex @@ -0,0 +1,140 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% + +\newcount\tikzext@nodesonpath +\tikzset{ + pic/.is if=tikz@node@is@pic, + /tikz-ext/nodes/node on line/.style 2 args={ + /tikz/to path={ + \pgfextra{% + \edef\tikz@temp{% rescuing nodes and target for edge + edge[ + line to,% -- + path only,% no draw, no fill, … + every edge quotes/.append style={auto=false},% node *on* the line + nodes={alias=tikzext-node on line}] + coordinate(tikzext-node on line)% fallback coordinate + \unexpanded\expandafter{\tikz@tonodes}(\tikztotarget) + }\expandafter + }\tikz@temp + -- (tikzext-node on line#1) + (tikzext-node on line#2) + -- (\tikztotarget) + } + }, + /tikz-ext/nodes/@node on line/.style args={#1 and #2}{ + /tikz-ext/nodes/node on line={.#1}{.#2} + }, + node on line/.default=, + node on line/.code={% + \pgfutil@ifempty{#1}{% + \pgfkeys{/tikz-ext/nodes/node on line={}{}}% + }{% + \pgfutil@in@{ and }{#1}% + \ifpgfutil@in@ + \pgfkeys{/tikz-ext/nodes/@node on line={#1}}% + \else + \pgfkeys{/tikz-ext/nodes/@node on line={#1 and #1}}% + \fi + }% + }, + nodes on line/.style={ + /tikz/to path={ + \pgfextra{% + \tikzext@nodesonpath=0 + \edef\tikz@temp{% rescuing nodes and target for edge + edge[ + line to,% -- + path only,% no draw, no fill, … + every edge quotes/.append style={auto=false},% node *on* the line + nodes={ + /utils/exec=\global\noexpand\advance\tikzext@nodesonpath by 1, + alias=tikzext-node on line-\noexpand\the\tikzext@nodesonpath + }] + \pgfutil@unexpanded\expandafter{\tikz@tonodes}(\tikztotarget) + }\expandafter + }\tikz@temp + \ifnum\tikzext@nodesonpath=0 + -- (\tikztotarget) + \else + -- (tikzext-node on line-1) + \unless\ifnum\tikzext@nodesonpath=1 + foreach[expand list] \tikzext@counter in {2, ..., \the\tikzext@nodesonpath} { + (tikzext-node on line-\pgfinteval{\tikzext@counter-1}) + -- (tikzext-node on line-\tikzext@counter) + } + \fi + (tikzext-node on line-\the\tikzext@nodesonpath) -- (\tikztotarget) + \fi + } + }, + %%% nodes on curve, needs spath3 + /tikz-ext/spath/split multiple at intersections/.style n args={3}{ + /utils/temp/.style={ + /tikz/spath/split at intersections with={#1}{#2##1} + }, + /utils/temp/.list={#3} + }, + nodes on curve/.default=line to, + nodes on curve'/.default=line to, + nodes on curve/.style={% normal path + /tikz-ext/nodes/nodes on curve={#1}{/tikz/spath/append}{} + }, + nodes on curve'/.style={% for edges and tos + /tikz-ext/nodes/nodes on curve={#1}{/tikz/spath/use}{% + \ifx\tikz@to@or@edge@function\tikz@do@to(\tikztotarget)\fi + } + }, + % spath/prefix/tikzext-nodes/.style={ + % set prefix=tikzext-node on curve + % }, + % spath/suffix/tikzext-nodes/.style={ + % set suffix= + % }, + /tikz-ext/nodes/nodes on curve/.code n args={3}{% + \pgfutil@IfUndefined{tikz@library@spath3@loaded}{% + \pgfutil@packagerror{tikz-ext}{% + You need to say \string\usetikzlibrary{spath3} to use nodes on curve.}{}% + }{% + \tikzset{to path={% + % \def\tikz@to@path{% to path = + \pgfextra{% + \tikzext@nodesonpath=0 + \edef\tikz@temp{% rescuing nodes and target for edge + edge[% + #1, path only,% path only = no draw, no fill, … + every edge quotes/.append style={auto=false},% node *on* the line + nodes={ + /utils/exec=\global\noexpand\advance\tikzext@nodesonpath by 1, + % spath/set name=tikzext-nodes, + spath/save global=tikzext-node on curve-\noexpand\the\tikzext@nodesonpath, + }, + % spath/set name=tikzext-nodes, + spath/save global=tikzext-node on curve-curve + ] + \pgfutil@unexpanded\expandafter{\tikz@tonodes}(\tikztotarget) + }\expandafter + }\tikz@temp + [% + /tikz-ext/spath/split multiple at intersections/.expanded=% + {tikzext-node on curve-curve}% + {tikzext-node on curve-}% + {1\ifnum\tikzext@nodesonpath>1 ,...,\the\tikzext@nodesonpath\fi}, + spath/remove components/.expanded={tikzext-node on curve-curve}{% + 2% + \ifnum\tikzext@nodesonpath>1 + ,4,...,\pgfinteval{2*\the\tikzext@nodesonpath}% + \fi + }, + #2=tikzext-node on curve-curve% + ]% + #3% + }}% + } + } +}
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/tikz-ext/tikzlibraryext.paths.timer.code.tex b/Master/texmf-dist/tex/generic/tikz-ext/tikzlibraryext.paths.timer.code.tex index 3a4d30e68f0..5fadd1738d3 100644 --- a/Master/texmf-dist/tex/generic/tikz-ext/tikzlibraryext.paths.timer.code.tex +++ b/Master/texmf-dist/tex/generic/tikz-ext/tikzlibraryext.paths.timer.code.tex @@ -5,6 +5,7 @@ % 1. under the LaTeX Project Public License and/or % 2. under the GNU Free Documentation License. % + \def\tikz@rectB#1{% originally from tikz.code.tex \tikz@make@last@position{#1}% \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% @@ -63,7 +64,7 @@ \tikz@scan@next@command } -\def\tikz@timer@rectangle{% +\def\tikzext@timer@rectangle{% \pgfutil@tempdima\tikz@time pt \ifdim\pgfutil@tempdima<.5pt\else % if we're at the return pos-ition we switch start and end \advance\pgfutil@tempdima-.5pt @@ -185,4 +186,11 @@ {\noexpand\tikz@timer@end}}% \tikz@marshall } + +\tikzset{ + rectangle timer/.is choice, + rectangle timer/line/.code=\let\tikz@timer@rectangle\tikz@timer@line, + rectangle timer/rectangle/.code=\let\tikz@timer@rectangle\tikzext@timer@rectangle, + rectangle timer=rectangle +} \endinput
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/tikz-ext/tikzlibraryext.shapes.uncenteredrectangle.code.tex b/Master/texmf-dist/tex/generic/tikz-ext/tikzlibraryext.shapes.uncenteredrectangle.code.tex new file mode 100644 index 00000000000..71ee1d6be8f --- /dev/null +++ b/Master/texmf-dist/tex/generic/tikz-ext/tikzlibraryext.shapes.uncenteredrectangle.code.tex @@ -0,0 +1,46 @@ +% Copyright 2023 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% +\usepgflibrary{ext.shapes.uncenteredrectangle} +\newif\iftikzext@uncrec@mathmode +\pgfqkeys{/tikz-ext}{ + tikz-cd fix/.code={% #1 + \tikzcdset{ + /tikz-ext/tikz-cd fix/.code=, + urc/.style={/pgf/uncentered rectangle center={##1}}, + every diagram/.append style={% ##1 + /pgf/uncentered rectangle center yshift=axis_height, + /tikz/uncentered rectangle/.style={ + /tikz/shape=uncentered rectangle, + /tikz/commutative diagrams/math mode=false, + }, + /tikz/matrix of math nodes/.style={ + /tikz/matrix of nodes, + /tikz/nodes={ + execute at begin node=\iftikzcd@mathmode$\fi, + execute at end node=\iftikzcd@mathmode$\fi + } + }, + /utils/exec=% + \def\uncrec####1####2####3{% + \iftikzext@uncrec@mathmode$\fi####2\iftikzext@uncrec@mathmode$\fi + \nodepart{left}\iftikzext@uncrec@mathmode$\fi####1\iftikzext@uncrec@mathmode$\fi + \nodepart{right}\iftikzext@uncrec@mathmode$\fi####3\iftikzext@uncrec@mathmode$\fi + }, + /tikz/uncrec math mode/.is if=tikzext@uncrec@mathmode, + /tikz/uncrec math mode=true, + /tikz/uncrec/.style={% ####1 + /tikz/uncentered rectangle, + /pgf/uncentered rectangle center={####1} + }, + install uncentered rectangle in column/.style={ + /tikz/column ####1/.append style={/tikz/uncentered rectangle} + } + } + } + } +}
\ No newline at end of file |