From 0da533cdc3dbbf007f674c9cf301d0953cbeebd4 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 22 Aug 2022 03:01:56 +0000 Subject: CTAN sync 202208220301 --- graphics/pgf/contrib/tikz-ext/README.md | 17 +- .../tikz-ext/doc/tikz-ext-manual-en-calendar.tex | 80 +++ .../tikz-ext/doc/tikz-ext-manual-en-intro.tex | 9 + .../tikz-ext-manual-en-library-calendar-plus.tex | 69 +++ .../doc/tikz-ext-manual-en-library-misc.tex | 101 ++- .../tikz-ext-manual-en-library-node-families.tex | 102 +++ .../doc/tikz-ext-manual-en-library-paths.arcto.tex | 17 +- .../doc/tikz-ext-manual-en-library-paths.ortho.tex | 75 ++- .../doc/tikz-ext-manual-en-library-paths.timer.tex | 46 +- .../tikz-ext-manual-en-library-patterns.images.tex | 8 +- ...tikz-ext-manual-en-library-positioning-plus.tex | 183 ++++++ ...kz-ext-manual-en-library-topaths.arcthrough.tex | 11 +- .../doc/tikz-ext-manual-en-library-trans.tex | 24 +- .../tikz-ext/doc/tikz-ext-manual-en-main-body.tex | 91 ++- .../doc/tikz-ext-manual-en-main-preamble.tex | 277 ++++++++- .../tikz-ext/doc/tikz-ext-manual-en-pgf-trans.tex | 110 ++-- .../pgf/contrib/tikz-ext/doc/tikz-ext-manual.pdf | Bin 233128 -> 356908 bytes .../pgf/contrib/tikz-ext/doc/tikz-ext-manual.tex | 14 +- .../pgf/contrib/tikz-ext/pgfcalendar-ext.code.tex | 327 ++++++++++ graphics/pgf/contrib/tikz-ext/pgfcalendar-ext.sty | 11 + graphics/pgf/contrib/tikz-ext/pgfcalendar-ext.tex | 13 + .../pgflibraryext.transformations.mirror.code.tex | 96 +++ .../pgflibrarytransformations.mirror.code.tex | 96 --- .../tikz-ext/tikzlibraryext.calendar-plus.code.tex | 93 +++ .../contrib/tikz-ext/tikzlibraryext.misc.code.tex | 251 ++++++++ .../tikz-ext/tikzlibraryext.node-families.code.tex | 305 +++++++++ .../tikz-ext/tikzlibraryext.paths.arcto.code.tex | 104 ++++ .../tikz-ext/tikzlibraryext.paths.ortho.code.tex | 683 +++++++++++++++++++++ .../tikz-ext/tikzlibraryext.paths.timer.code.tex | 188 ++++++ .../tikzlibraryext.patterns.images.code.tex | 53 ++ .../tikzlibraryext.positioning-plus.code.tex | 262 ++++++++ .../tikzlibraryext.topaths.arcthrough.code.tex | 50 ++ .../tikzlibraryext.transformations.mirror.code.tex | 70 +++ .../pgf/contrib/tikz-ext/tikzlibrarymisc.code.tex | 251 -------- .../tikz-ext/tikzlibrarypaths.arcto.code.tex | 104 ---- .../tikz-ext/tikzlibrarypaths.ortho.code.tex | 183 ------ .../contrib/tikz-ext/tikzlibrarypaths.ortho.tex | 509 --------------- .../tikz-ext/tikzlibrarypaths.timer.code.tex | 188 ------ .../tikz-ext/tikzlibrarypatterns.images.code.tex | 53 -- .../tikzlibrarytopaths.arcthrough.code.tex | 50 -- .../tikzlibrarytransformations.mirror.code.tex | 70 --- 41 files changed, 3523 insertions(+), 1721 deletions(-) create mode 100644 graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-calendar.tex create mode 100644 graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-calendar-plus.tex create mode 100644 graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-node-families.tex create mode 100644 graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-positioning-plus.tex create mode 100644 graphics/pgf/contrib/tikz-ext/pgfcalendar-ext.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/pgfcalendar-ext.sty create mode 100644 graphics/pgf/contrib/tikz-ext/pgfcalendar-ext.tex create mode 100644 graphics/pgf/contrib/tikz-ext/pgflibraryext.transformations.mirror.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/pgflibrarytransformations.mirror.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tikzlibraryext.calendar-plus.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tikzlibraryext.misc.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tikzlibraryext.node-families.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tikzlibraryext.paths.arcto.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tikzlibraryext.paths.ortho.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tikzlibraryext.paths.timer.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tikzlibraryext.patterns.images.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tikzlibraryext.positioning-plus.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tikzlibraryext.topaths.arcthrough.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tikzlibraryext.transformations.mirror.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tikzlibrarymisc.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.arcto.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.ortho.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.ortho.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.timer.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tikzlibrarypatterns.images.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tikzlibrarytopaths.arcthrough.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tikzlibrarytransformations.mirror.code.tex (limited to 'graphics') diff --git a/graphics/pgf/contrib/tikz-ext/README.md b/graphics/pgf/contrib/tikz-ext/README.md index 23910ccef1..b0e84a76de 100644 --- a/graphics/pgf/contrib/tikz-ext/README.md +++ b/graphics/pgf/contrib/tikz-ext/README.md @@ -14,13 +14,16 @@ This is not a LaTeX package but a collection of libraries for PGF and TikZ. These are - * `transformations.mirror`, - * `paths.arcto`, - * `paths.ortho`, - * `paths.timer`, - * `patterns.images`, - * `topaths.arcthrough` and - * `misc`. + * `ext.calendar-plus`, + * `ext.node-familes`, + * `ext.transformations.mirror`, + * `ext.paths.arcto`, + * `ext.paths.ortho`, + * `ext.paths.timer`, + * `ext.patterns.images`, + * `ext.positioning-plus`, + * `ext.topaths.arcthrough` and + * `ext.misc`. These were developed in response to questions on tex.stackexchange.com. Some of these can be find by searching for my [user id](https://tex.stackexchange.com/search?q=user%3A16595+%22my+library%22). \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-calendar.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-calendar.tex new file mode 100644 index 0000000000..88a3567c1a --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-calendar.tex @@ -0,0 +1,80 @@ +% !TeX spellcheck = en_US +% !TeX root = tikz-ext-manual.tex +% 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. +% + +\section{Calendar: Weeknumbers and more conditionals} +\begin{package}{calendar-ext} + This package adds week numbers and more conditionals to the PGF package |pgfcalendar|. + (Despite the code example above, this package is not set up to work with Con\TeX t.) +\end{package} + +%This package extends the |pgfcalendar| package. + +\begin{multicols}{2} + +\subsection{Extensions} + +The following tests are added. +\begin{itemize} +\itemcalendaroption{Jan} This test is passed by all dates that are in the month of January. +\itemcalendaroption{Feb} as above. +\itemcalendaroption{Mar} as above. +\itemcalendaroption{Apr} as above. +\itemcalendaroption{May} as above. +\itemcalendaroption{Jun} as above. +\itemcalendaroption{Jul} as above. +\itemcalendaroption{Aug} as above. +\itemcalendaroption{Sep} as above. +\itemcalendaroption{Oct} as above. +\itemcalendaroption{Nov} as above. +\itemcalendaroption{Dec} as above. +\itemcalendaroption{leap year}\opt{|=|\meta{year}} + This test checks whether the given year is a leap year. If + \meta{year} is omitted, it checks the year of the current date. +\itemcalendaroption{and}|=|\marg{tests} + This test passes when all \meta{tests} pass. +\itemcalendaroption{not}|=|\marg{tests} + This test passes when \meta{tests} do not pass. +\itemcalendaroption{yesterday}|=|\marg{tests} + This test passes when the previous day passes \meta{tests}. +\itemcalendaroption{week}|=|\meta{num} + This test passes when the current week of the year equals \marg{num}. +\end{itemize} + +The shorthands for |d-| and |m-| are slightly changed so that they are +expandable. This makes it possible to use these shorthands inside of PGFmath. +The shorthands for the week (see section~\ref{calendar:weeknumbering}) +are added. These are +\begin{itemize} +\item |n-| (shortest numerical representation), +\item |n=| (shortest but added horizontal space) and +\item |n0| (leading zero when below 10). +\end{itemize} + +\subsection{Week numbering (ISO~8601)} +\label{calendar:weeknumbering} +\begin{command}{\pgfcalendarjulianyeartoweek\marg{Julian day}\marg{year}\marg{week counter}} + This command calculates the week for the \meta{Julian day} of \meta{year}. + The \meta{week counter} must be a \TeX\space counter. + + The calculation follows the rule of ISO~8601 where the first week has that + year's first Thursday in it. +\end{command} + +Inside of |\pgfcalendar|\indexCommandO\pgfcalendar the command |\pgfcalendarcurrentweek| will be available. +\begin{command}{\pgfcalendarcurrentweek} + This command returns the current week number (always two digits -- use shorthand |n.| + to strip the leading zero). +\end{command} + +Inside of |\ifdate|\indexCommandO\ifdate the command |\pgfcalendarifdateweek| will be available. +\begin{command}{\pgfcalendarifdateweek} + This command returns the week number (always two digits). +\end{command} +\end{multicols} \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-intro.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-intro.tex index 5c90d0f5bf..ac5811ac6e 100644 --- a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-intro.tex +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-intro.tex @@ -1,3 +1,12 @@ +% !TeX spellcheck = en_US +% !TeX root = tikz-ext-manual.tex +% 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. +% \part{Introduction} \begin{multicols}{2} \section{Usage} diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-calendar-plus.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-calendar-plus.tex new file mode 100644 index 0000000000..14c78e9be0 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-calendar-plus.tex @@ -0,0 +1,69 @@ +% !TeX spellcheck = en_US +% !TeX root = tikz-ext-manual.tex +% 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. +% + +\section{Calendar} +\begin{tikzlibrary}{ext.calendar-plus} + This library extends the \tikzname\space library |calendar|\indexLibraryO{calendar}. +\end{tikzlibrary} + +\begin{multicols}{2} + +\subsection{Value-keys and nestable \texttt{if} key} + +The values of following keys are originally stored in some macros that are not +accessible by the user. These are now simple value-keys. +The |@|-protected macros are still available, of course. + +\begin{key}{/tikz/day xshift (initially 3ex)} +\end{key} +\begin{key}{/tikz/day yshift (initially 3.5ex)} +\end{key} +\begin{key}{/tikz/month xshift (initially 9ex)} +\end{key} +\begin{key}{/tikz/month yshift (initially 9ex)} +\end{key} + +It is now also possible to nest |/tikz/if| occurrences. +\begin{key}{/tikz/if=|(|\meta{conditions}|)|\meta{code or options}\opt{|else|\meta{else code or options}}} +\end{key} + +\subsection{Week numbering (ISO~8601)} + +The actual week number algorithm is implemented by the |pgfcalendar-ext| package/module in section~\ref{calendar:weeknumbering}. +\begin{key}{/tikz/week code=\meta{code}} + Works like |/tikz/day code| or |/tikz/month code|, only for weeks.\indexKeyO{day code}\indexKeyO{month code} +\end{key} + +\begin{key}{/tikz/week text=\meta{text}} + Works like |/tikz/day text| or |/tikz/month text|, only for weeks.\indexKeyO{day text}\indexKeyO{month text} +\end{key} + +\begin{stylekey}{/tikz/every week} + Works like |/tikz/every day| or |/tikz/every month|, only for weeks.\indexKeyO{every day}\indexKeyO{every month} +\end{stylekey} + +\begin{stylekey}{/tikz/week label left} + Places the week label to the left of the first day of the month. (For + |week list| and |month list| where a week does not start on a Monday, the + position is chosen ``as if'' the week had started on a Monday -- which is + usually exactly what you want.) + % +\begin{codeexample}[preamble={\usetikzlibrary{ext.calendar-plus}}] +\tikz + \calendar [week list, month label above centered, + dates=2022-07-01 to 2022-07-31, + week label left, + every week/.append style={gray!50!black,font=\sffamily}]; +\end{codeexample} + % +\end{stylekey} + +\end{multicols} +\endinput \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-misc.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-misc.tex index dc9103b699..79cc9c21c3 100644 --- a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-misc.tex +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-misc.tex @@ -8,13 +8,16 @@ % 2. under the GNU Free Documentation License. % -\begin{tikzlibrary}{misc} - This library adds miscelleaneos utilities to PGFmath, PGF or \tikzname. +\section{And a little bit more} +\begin{tikzlibrary}{ext.misc} + This library adds miscellaneous utilities to PGFmath, PGF or \tikzname. \end{tikzlibrary} -\section{PGFmath} +\subsection{PGFmath} -\subsection{Postfix operator \texttt{R}} +\begin{multicols}{2} +\pgfkeys{/codeexample/every codeexample/.append style={width=3cm}} +\subsubsection{Postfix operator \texttt{R}} Similar to |\segments[]| in PSTricks, the postfix operator |R| allows the user to use an arbitrary number of segments of a circle to be used instead of an angle. @@ -31,14 +34,15 @@ The |R| operator can then be used. Multiplies \mvar{x} with $\frac{360}{\meta{num}}$. \end{math-operator} -\subsection{Functions} +\subsubsection{Functions} \begin{math-function}{strrepeat("\mvar{Text}", \mvar{x})} \mathcommand Returns a string with \mvar{Text} repeated \mvar{x} times. \begin{codeexample}[] -\pgfmathparse{strrepeat("foo", 5)} \pgfmathresult +\pgfmathparse{strrepeat("foo", 5)} +\pgfmathresult \end{codeexample} \end{math-function} @@ -48,9 +52,10 @@ The |R| operator can then be used. otherwise |0| (false). \begin{codeexample}[] -\pgfmathparse{isInString("foo", "bar")} \pgfmathresult -\ and\ -\pgfmathparse{isInString("foo", "foobar")} \pgfmathresult +\pgfmathparse{isInString("foo", "bar")} +\pgfmathresult \ and\ +\pgfmathparse{isInString("foo", "foobar")} +\pgfmathresult \end{codeexample} \end{math-function} @@ -59,7 +64,8 @@ The |R| operator can then be used. Returns the concatenation of all given parameters. \begin{codeexample}[] -\pgfmathparse{strcat("blue!", int(7*3), "!green")} \pgfmathresult +\pgfmathparse{strcat("blue!", int(7*3), "!green")} +\pgfmathresult \end{codeexample} \end{math-function} @@ -79,10 +85,8 @@ The |R| operator can then be used. \begin{math-function}{atanXY(\mvar{x},\mvar{y})} \mathcommand Arctangent of $\mvar y\div \mvar x$ in degrees. This also takes into account the quadrant. - This is just a argument-swapped version of |atan2| which makes it easier to use - the |\p| commands of the |calc| library. - \index{atan2@\protect\texttt{atan2} math function}% - \index{Math functions!atan2@\protect\texttt{atan2}}% + This is just a argument-swapped version of |atan2|\indexMathFunctionO{atan2} which makes it easier to use + the |\p| commands of the |calc|\indexLibraryO{calc} library. % \begin{codeexample}[] \pgfmathparse{atanXY(3,4)} \pgfmathresult @@ -96,7 +100,7 @@ The |R| operator can then be used. \end{codeexample} \end{math-function} -\subsection{Functions: using coordinates} +\subsubsection{Functions: using coordinates} The following functions can only be used with PGF and/or \tikzname. Since the arguments are usually plain text (and not numbers) one has to wrap them in |"|. @@ -112,7 +116,10 @@ them in |"|. \begin{math-function}{qdistancebetween("\mvar{p}")}\mathcommand Return the distance (in pt) between the origin and the center of the node \mvar{p}. \end{math-function} -\begin{codeexample}[width=6cm,preamble=\usetikzlibrary{calc,misc,through}] + +\end{multicols} + +\begin{codeexample}[width=6cm,preamble=\usetikzlibrary{calc,ext.misc,through}] \begin{tikzpicture} \path (0,0) coordinate (A) + (0:4) coordinate (B) +(75:4) coordinate (C); \draw (A) -- (B) -- (C) -- cycle; @@ -128,9 +135,11 @@ them in |"|. (intersection of @--[shift=(vecB)]@ and B--A) coordinate (A);} \end{tikzpicture} \end{codeexample} -\section{PGFkeys} +\subsection{PGFkeys} + +\begin{multicols}{2} -\subsection{Conditionals} +\subsubsection{Conditionals} \begin{key}{/utils/if=\meta{cond}\meta{true}\opt{\meta{false}}} This key checks the conditional \meta{cond} and applies the styles \meta{true} @@ -175,7 +184,7 @@ executions. \end{key} -\subsection{Handlers} +\subsubsection{Handlers} While already a lot of values given to keys are evaluated by PGFmath at some point, not all of them are. @@ -192,17 +201,22 @@ not all of them are. As above but uses the |strcat| function. In the example below, one could have used the |/pgf/foreach/evaluate| key from |\foreach|. -\begin{codeexample}[width=6cm,preamble=\usetikzlibrary{misc}] +\begin{codeexample}[width=3.7cm,preamble=\usetikzlibrary{misc}] \tikz\foreach \i in {0,10,...,100} - \draw[line width=+.2cm, color/.pgfmath strcat={"red!",sqrt(\i)*10,"!blue"}] - (0,\i/50) -- +(right:3); +\draw[ + line width=+.2cm, + color/.pgfmath strcat={"red!",sqrt(\i)*10,"!blue"} +] + (0,\i/50) -- +(right:3); \end{codeexample} \end{handler} \begin{handler}{{.List}|=|\meta{\meta{e1}, \meta{e2}, \dots, \meta{en}}} This handler evaluates the given list with |\foreach| and concatenates the element and the result is then given to the used key. -\begin{codeexample}[width=6cm,preamble=\usetikzlibrary{fit,misc}] +\end{handler} +\end{multicols} +\begin{codeexample}[width=6cm,preamble=\usetikzlibrary{fit,ext.misc}] \begin{tikzpicture}[nodes={draw, dashed, inner sep=+10pt}] \foreach \point [count=\cnt] in {(0,0), (0,2), (2,0), (2,2), (3,3), (-1,-1)} \fill \point circle[radius=.1] coordinate (point-\cnt); @@ -211,45 +225,8 @@ not all of them are. \node[blue, fit/.List={(point-1),(point-...),(point-6)}] {}; \end{tikzpicture} \end{codeexample} -\end{handler} -\begin{center} -\begin{codeexample}[width=10cm,preamble=\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{force}] -\tikzset{ - mynode/.style={ - circle, minimum size=10mm, draw, densely dashdotted, thick, - decide color/.expand once=#1}, - decide color/.style 2 args={ - /utils/TeX/if=c#1 - {/utils/TeX/ifnum={#2<5}{bluelight}{bluedark}} - {/utils/TeX/ifnum={#2<8}{light}{dark}}}, - light/.style={fill=gray!20}, bluelight/.style={fill=blue!10}, - dark/.style ={fill=gray!60}, bluedark/.style ={fill=blue!30}} -\tikz\graph[ - spring electrical layout, vertical=c2 to p13, - node distance=1.5cm, typeset=$n_{\tikzgraphnodetext}$, - nodes={mynode=\tikzgraphnodetext}] { - % outer ring - c2 -- {p1, p11, p6}; - p1 -- {p8, c6, p11}; - p8 -- {p3, p10, c6}; - p3 -- {p13, p15, p10}; - p13 -- {p15, c7}; - c7 -- {c3, c4, p15}; - c3 -- {p14, c4}; - p14 -- {p7, c4}; - p7 -- {p9, p2, c4}; - p9 -- {c5, p12, p2}; - c5 -- {c1, p4, p12}; - c1 -- {p6, p4}; - p6 -- {p11, p4}; - % inner ring - p11 -- {c6, p12, p4}; - p5 -- {c6 -- {p10, p12}, p10 -- p15, p15 -- c4, c4 -- p2, p2 -- p12, p12 -- p4}; -}; -\end{codeexample} -\end{center} -\section{PGFfor} +\subsection{PGFfor} Instead of |\foreach \var in {start, start + delta, ..., end}| one can use |\foreach \var[use int=start to end step delta]|. @@ -259,7 +236,7 @@ The values \meta{start}, \meta{end} and \meta{delta} are evaluates by PGFmath at The part |step |\meta{delta} is optional (\meta{delta} = 1). \end{key} -\begin{key}{/pgf/foreach/use float=\meta{start}| o|\meta{end}opt{|step|\meta{delta}}} +\begin{key}{/pgf/foreach/use float=\meta{start}|to|\meta{end}\opt{|step|\meta{delta}}} Same as above, however the results are not truncated. \end{key} diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-node-families.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-node-families.tex new file mode 100644 index 0000000000..04ebb7c7a0 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-node-families.tex @@ -0,0 +1,102 @@ +% !TeX spellcheck = en_US +% !TeX root = tikz-ext-manual.tex +% 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. +% +\section{Node Families} +\begin{tikzlibrary}{ext.node-families} + With this library the user can instruct multiple nodes to have the same + width, height, text width, text height or text width. + This uses the hook \referenceKeyandIndexO{execute at end picture} to write the nodes' + measurements to the \filetype{aux} file. + + Unfortunately, this does not work with the |external| library.\indexLibraryO{external}% + \footnote{Not only would the \texttt{external} library not notice the change of the value between compilations runs, + it also changes the way \texttt{\textbackslash pgfutil@writeout} works which suddenly writes to the \textsc{log} file instead.} +\end{tikzlibrary} + +This library introduces two new shapes called |Circle| and |Rectangle| +that are basically copies of the original shapes |circle|\indexShapeO{circle} and |rectangle|\indexShapeO{rectangle}. +However, their dimension will be set to the same maximum |minimum width| and |minimum height| +when one of the following \meta{name}s are declared. +\begin{key}{/tikz/node family/width=\meta{name} (initially |\{\}|)} +Nodes with the same \meta{name} will have the same \referenceKeyandIndexO[/pgf/]{minimum width}. +An empty \meta{name} disables the evaluation by the library. +\begin{codeexample}[preamble=\usetikzlibrary{positioning,ext.node-families},/tikz/node distance=.5cm] +\tikzexternaldisable % ext.node-families does not work with active externalization +\begin{tikzpicture}[nodes={Rectangle, draw, node family/width=manual}] +\node (a) {Foo}; +\node[below=of a] (b) {Foobar}; +\end{tikzpicture} +\end{codeexample} +\end{key} +\begin{key}{/tikz/node family/height=\meta{name} (initially |\{\}|)} +Nodes with the same \meta{name} will have the same \referenceKeyandIndexO[/pgf/]{minimum height}. +An empty \meta{name} disables the evaluation by the library. +\end{key} +\begin{key}{/tikz/node family/size=\meta{name}} +Sets both |height| and |width|. +\end{key} + +While |node family/width| and |node family/height| only work for the new shapes |Circle| and |Rectangle|, +the following keys~-- when setup, see below~-- work with every shape with one single node part. +Initially though, only |circle|, |rectangle|, |Circle| and |Rectangle| are set up that way. +\begin{key}{/tikz/node family/text height=\meta{name} (initially |\{\}|)} +Nodes with the same \meta{name} will have the same text height. +An empty \meta{name} disables the evaluation by the library. +\end{key} + +\begin{key}{/tikz/node family/text depth=\meta{name} (initially |\{\}|)} +Nodes with the same \meta{name} will have the same text depth. +An empty \meta{name} disables the evaluation by the library. +\end{key} + +\begin{key}{/tikz/node family/text width=\meta{name} (initially |\{\}|)} +Nodes with the same \meta{name} will have the same text width. +An empty \meta{name} disables the evaluation by the library. +\end{key} + +\begin{key}{/tikz/node family/text=\meta{name}} +Sets |text height|, |text depth| and |text width|. +\end{key} + +Since the width of the node's content's box is setup much earlier, +the previous key only extends the width of that box which would make the text +seem as if it where aligned to the left. +With |text width family align| this can changed. +\begin{key}{/tikz/node family/text width align=\meta{alignment}(initially |center|)} +\meta{alignment} is one of |left|, |center| or |right|. + +\begin{codeexample}[preamble=\usetikzlibrary{positioning,ext.node-families},/tikz/node distance=.5cm] +\tikzexternaldisable % ext.node-families does not work with active externalization +\begin{tikzpicture}[nodes={Rectangle, draw, node family={text width=manual, text width align=right}}] +\node (a) {Foo}; +\node[below=of a] (b) {Foobar}; +\end{tikzpicture} +\end{codeexample} +\end{key} + +\begin{key}{/tikz/node family/prefix=\meta{prefix}(initially \expandafter|\string\pgfpictureid-|)} +The family names are prefixed with the value of |/tikz/node family/prefix|. +\end{key} + +\begin{key}{/tikz/node family/setup shape=\meta{shape}} +This adds instructions to the \meta{shape}'s definition which +adjust the text box's dimensions according to the family. + +This should be only used once per shape. +\end{key} +\begin{codeexample}[width=9cm,preamble=\usetikzlibrary{ext.node-families,shapes.geometric}] +\tikzexternaldisable % ext.node-families does not work with active externalization +\begin{tikzpicture}[node family/setup shape=diamond] +\foreach \cnt[count=\Cnt] in {a,...,h} + \node[draw, diamond, node family/text=aTOh] (\cnt) + at (right:\Cnt) {\cnt}; +\draw[help lines] (a.south) -- (h.south) (a.north) -- (h.north) (a.base-|a.west) -- (h.base-|h.east); +\end{tikzpicture} +\end{codeexample} +\endinput \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-paths.arcto.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-paths.arcto.tex index f219f34691..8ed660b3a3 100644 --- a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-paths.arcto.tex +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-paths.arcto.tex @@ -11,12 +11,12 @@ \section{Arc \emph{to} a point} \label{library:paths.arcto} -\begin{tikzlibrary}{paths.arcto} - This library adds new path specifications |arc to| that specifies an arc \emph{to} a point~-- +\begin{tikzlibrary}{ext.paths.arcto} + This library adds the new path operation |arc to| that specifies an arc \emph{to} a point~-- without the user having to specify any angles. \end{tikzlibrary} -\begin{codeexample}[width=.5\linewidth,preamble=\usetikzlibrary{paths.arcto}] +\begin{codeexample}[width=.5\linewidth,preamble=\usetikzlibrary{ext.paths.arcto}] \begin{tikzpicture}[ultra thick,dot/.style={label={#1}}] \coordinate[dot=below left:$a$] (a) at (0,0); \coordinate[dot=above right:$b$] (b) at (2,3); @@ -73,26 +73,29 @@ options that can be used inside of \meta{options}. \begin{key}{/tikz/arc to/rotate=\meta{degree}} Rotates the arc by \meta{degree}. - This only takes effect when |x radius| and |y radius| is different. + This is only noticeable when |x radius| and |y radius| are different. \end{key} \begin{key}{/tikz/arc to/x radius=\meta{value}} - This forwards the \meta{value} to |/tikz/x radius|. + This forwards the \meta{value} to \referenceKeyandIndexO{x radius}. + Its \meta{value} is used for the radius of the arc. \end{key} \begin{key}{/tikz/arc to/y radius=\meta{value}} - This forwards the \meta{value} to |/tikz/y radius|. + This forwards the \meta{value} to \referenceKeyandIndexO{y radius}. + Its \meta{value} is used for the radius of the arc. \end{key} \begin{key}{/tikz/arc to/radius=\meta{value}} This forwards the \meta{value} to both |/tikz/x radius| and |/tikz/y radius|. + Its \meta{value} is used for radius of the arc. \end{key} \begin{stylekey}{/tikz/every arc to} After |/tikz/every arc| this will also be applied before any \meta{options} are set. \end{stylekey} -It should be noted that this uses |\pgfpatharcto| where the \tikzname\space manual warns of: +It should be noted that this uses |\pgfpatharcto| for which the \tikzname\space manual warns:\indexCommandO\pgfpatharcto \begin{quote}\itshape The internal computations necessary for this command are numerically very unstable. In particular, the arc will not always really end at the \meta{target coordinate}, diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-paths.ortho.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-paths.ortho.tex index 32adea7af0..a46f6be023 100644 --- a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-paths.ortho.tex +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-paths.ortho.tex @@ -11,13 +11,13 @@ \section{More Horizontal and Vertical Lines} \label{library:paths.ortho} -\begin{tikzlibrary}{paths.ortho} +\begin{tikzlibrary}{ext.paths.ortho} This library adds new path specifications \verb!|-|!, \verb!-|-! as well as |r-ud|, |r-du|, |r-lr| and |r-rl|. \end{tikzlibrary} \subsection{Zig-Zag} -Similar to the path operations \verb!|-! and \verb!-|! this library adds +Similar to the path operations \verb!|-! and \verb!-|! this library adds\indexPathOperationO{\protect\pgfmanualbar-}\indexPathOperationO{-\protect\pgfmanualbar} the path operations \verb!|-|! and \verb!-|-!. {\catcode`\|=12 \begin{pathoperation}[noindex]{|-|}{\opt{\oarg{options}}\meta{coordinate or cycle}} @@ -38,33 +38,33 @@ the path operations \verb!|-|! and \verb!-|-!. For values $\meta{ratio} < 0$ and $\meta{ratio} > 1$ the Zig-Zag lines will look more like Zig-Zig lines. - \begin{codeexample}[preamble=\usetikzlibrary{paths.ortho}] -\begin{tikzpicture}[very thick] +\begin{codeexample}[preamble=\usetikzlibrary{paths.ortho}] +\begin{tikzpicture}[very thick, rounded corners] \draw[help lines] (-.25, -1.25) grid (2.25, 1.25); \draw (0, 0) -|- (2, 1) -- (2, 0) -|-[ratio=.25] (0,-1) -- cycle; \end{tikzpicture} - \end{codeexample} +\end{codeexample} \end{key} -%TODO: hvvh/distance needs fixing. +%TODO: hvvh/distance needs fixing, maybe? \begin{key}{/tikz/hvvh/distance=\meta{distance}} This sets the distance between the start point and the middle part of the Zig-Zag connection. For values $\meta{distance} < 0$ the distance will be used for the target coordinate. -\begin{codeexample}[width=8cm,preamble=\usetikzlibrary{paths.ortho}] +\begin{codeexample}[width=8cm,preamble=\usetikzlibrary{ext.paths.ortho}] \begin{tikzpicture}[very thick,-latex] \draw[help lines,-] (-.25, -.25) grid (5.25, 3.25); -\draw (0, 0) -|-[distance= .5cm] ++(2, 1); -\draw (0, 1.5) -|-[distance=-.5cm] ++(2, 1); +\draw (0, 0) -|-[distance= .5cm] ++(2, 1); +\draw (0, 2) -|-[distance=-.5cm] ++(2, 1); \tikzset{xshift=3cm} -\draw (2, 1) -|-[distance= .5cm] ++(-2, -1); -\draw (2, 2.5) -|-[distance=-.5cm] ++(-2, -1); +\draw (2, 1) -|-[distance= .5cm] ++(-2, -1); +\draw (2, 3) -|-[distance=-.5cm] ++(-2, -1); \end{tikzpicture} \end{codeexample} \end{key} -\begin{key}{/tikz/hvvh/from center=\opt{\meta{true or false}} (initially false, default true)} +\begin{key}{/tikz/hvvh/from center=\opt{\meta{true or false}} (default true)} When nodes get connected the placement of the middle part of the Zig-Zag and the Zig-Zig (see below) connections will be calculated from the border of these nodes. @@ -82,7 +82,7 @@ these can be configured through the following keys. \begin{key}{/tikz/hvvh/spacing=\meta{number} (initially 4)} Unless $\meta{number} = 0$ is set \begin{itemize} - \item |pos = 0| will be at the start, + \item |pos = 0| will be at the start,\indexKeyO{pos} \item |pos = 1| will be at the end, \item |pos = |$\frac{1}{\meta{number}}$ will be at the first kink, \item |pos = |$\frac{\meta{number}-1}{\meta{number}}$ will be at the second kink and @@ -135,4 +135,51 @@ All distances can be set with on key. \begin{key}{/tikz/udlr/from center=\opt{\meta{true or false}} (initially false, default true)} This is an alias for |/tikz/hvvh/from center|. -\end{key} \ No newline at end of file +\end{key} + +\subsection{Even more Horizontal and Vertical Lines} + +The following keys can be used to access vertical and horizontal line path operations. +\begin{stylekey}{/tikz/horizontal vertical} + This installs \verb!to path = -| (\tikztotarget) \tikztonodes! that can be used with\indexKeyO{to path} + the path operations |to| or |edge|. +\end{stylekey} +\begin{stylekey}{/tikz/vertical horizontal} + This installs \verb!to path = |- (\tikztotarget) \tikztonodes! that can be used with + the path operations |to| or |edge|. +\end{stylekey} +\begin{stylekey}{/tikz/horizontal vertical horizontal} + This installs \verb!to path = -|- (\tikztotarget) \tikztonodes! that can be used with + the path operations |to| or |edge|. +\end{stylekey} +\begin{stylekey}{/tikz/vertical horizontal vertical} + This installs \verb!to path = |-| (\tikztotarget) \tikztonodes! that can be used with + the path operations |to| or |edge|. +\end{stylekey} + +When connecting rectangular nodes, these keys could be useful as well. +They all need to be given to a |to| or |edge| path operation. +\begin{stylekey}{/tikz/only vertical second=\opt{\meta{length}} (default 0pt)} +This draws a vertical line from the start point to the target point so that +it connects to the target point in the center (or at its border in case it is a node). + +The optional \meta{length} can be used to shift the line orthogonally to its direction. +\end{stylekey} +\begin{stylekey}{/tikz/only horizontal second=\opt{\meta{length}} (default 0pt)} +This draws a horizontal line from the start point to the target point so that +it connects to the target point in the center (or at its border in case it is a node). + +The optional \meta{length} can be used to shift the line orthogonally to its direction. +\end{stylekey} +\begin{stylekey}{/tikz/only vertical first=\opt{\meta{length}} (default 0pt)} +This draws a vertical line from the start point to the target point so that +it connects to the start point in the center (or at its border in case it is a node). + +The optional \meta{length} can be used to shift the line orthogonally to its direction. +\end{stylekey} +\begin{stylekey}{/tikz/only horizontal first=\opt{\meta{length}} (default 0pt)} +This draws a horizontal line from the start point to the target point so that +it connects to the start point in the center (or at its border in case it is a node). + +The optional \meta{length} can be used to shift the line orthogonally to its direction. +\end{stylekey} diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-paths.timer.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-paths.timer.tex index d3670726d7..09049bf829 100644 --- a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-paths.timer.tex +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-paths.timer.tex @@ -7,31 +7,11 @@ % 1. under the LaTeX Project Public License and/or % 2. under the GNU Free Documentation License. % -\makeatletter -\newenvironment{pathoperation'}[3][]{ - \begin{pgfmanualentry} - \def\pgfmanualtest{#1}% - \pgfmanualentryheadline{% - \ifx\pgfmanualtest\@empty% - \pgfmanualpdflabel{#2}{}% - \fi% - %\textcolor{gray}{{\ttfamily\char`\\path}\ \ \dots} - %\declare{\texttt{\noligs{#2}}}#3\ \textcolor{gray}{\dots\texttt{;}} - }% - \ifx\pgfmanualtest\@empty% - \index{#2@\protect\texttt{#2} path operation}% - \index{Path operations!#2@\protect\texttt{#2}}% - \fi% - \pgfmanualbody -} -{ - \end{pgfmanualentry} -} -\makeatother + \section{Extending the Path Timers} \label{library:timer} -\begin{tikzlibrary}{paths.timer} +\begin{tikzlibrary}{ext.paths.timer} This library adds timers to the path specifications |rectangle|, |parabola|, |sin| and |cos|. \end{tikzlibrary} @@ -43,15 +23,13 @@ the other paths, nodes, coordinates, pics, etc. are placed on the last coordinat This library allows this. \subsection{Rectangle} -%\index{Path operations!\protect\texttt{rectangle}}% -%\index{\texttt{rectangle} path operation}% -\begin{pathoperation'}{rectangle}{}\end{pathoperation'} +\indexPathOperationO{rectangle} -For the |rectangle| path operator, the timer starts with |pos = 0| (= |at start|) from +For the |rectangle| path operator, the timer starts with |pos = 0| (= |at start|) from\indexKeyO{pos} the starting coordinate in a counter-clockwise direction along the rectangle. The corners will be at positions 0.0, 0.25, 0.5, 0.75 and 1.0. -\begin{codeexample}[width=10cm,preamble=\usetikzlibrary{paths.timer}] +\begin{codeexample}[width=10cm,preamble=\usetikzlibrary{ext.paths.timer}] \begin{tikzpicture}[scale=2, every pin edge/.style={latex-, gray}] \coordinate [label=above right:Target] (A) at (0,0); \coordinate [label=below left:Start] (B) at (1,2); @@ -65,13 +43,12 @@ The corners will be at positions 0.0, 0.25, 0.5, 0.75 and 1.0. \end{codeexample} \subsection{Parabola} -\index{Path operations!\protect\texttt{parabola}}% -\index{\texttt{parabola} path operation}% +\indexPathOperationO{parabola}% For the |parabola| path operator the timer is similar to the |.. controls ..| operator. The position 0.5 will lie at the |bend|. -\begin{codeexample}[width=.3\linewidth,preamble=\usetikzlibrary{paths.timer}] +\begin{codeexample}[width=.3\linewidth,preamble=\usetikzlibrary{ext.paths.timer}] \begin{tikzpicture} \draw[help lines] (-2.25, -1.25) grid (2.25, 3.25); \draw ( 2,-1) parabola bend (0,0) (-1,3); @@ -86,7 +63,7 @@ The position 0.5 will lie at the |bend|. If no |bend| is specified half the positions will collapse into one end of the curve. -\begin{codeexample}[width=.3\linewidth,preamble=\usetikzlibrary{paths.timer}] +\begin{codeexample}[width=.3\linewidth,preamble=\usetikzlibrary{ext.paths.timer}] \begin{tikzpicture}[every pin edge/.style={latex-, shorten <=1pt, gray}] \draw (-2,-2) parabola (1,0) foreach \pos in {0, 1, ..., 10} { @@ -96,14 +73,11 @@ If no |bend| is specified half the positions will collapse into one end of the c \end{codeexample} \subsection{Sine/Cosine} -\index{Path operations!\protect\texttt{sin}}% -\index{Path operations!\protect\texttt{cos}}% -\index{\texttt{sin} path operation}% -\index{\texttt{cos} path operation}% +\indexPathOperationO{sin}\indexPathOperationO{cos}% The |sin| and |cos| path operators also allow placing of nodes along their paths. -\begin{codeexample}[width=.3\linewidth,preamble=\usetikzlibrary{paths.timer}] +\begin{codeexample}[width=.3\linewidth,preamble=\usetikzlibrary{ext.paths.timer}] \begin{tikzpicture}[mark nodes on line/.style={insert path={ foreach \pos in {1, ..., 9} {node[ sloped, fill=white, font=\small, inner sep=+0pt, pos=\pos/10] {\pos}}}}] diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-patterns.images.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-patterns.images.tex index 2c02b157a9..10fa3aca6d 100644 --- a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-patterns.images.tex +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-patterns.images.tex @@ -11,7 +11,7 @@ \section{Using Images as a Pattern} \label{library:patterns.images} -\begin{tikzlibrary}{patterns.images} +\begin{tikzlibrary}{ext.patterns.images} This library allows to use an image to be used as a repeating pattern for a path. \end{tikzlibrary} @@ -29,7 +29,7 @@ This is a two-step process: \begin{key}{/tikz/image as pattern=\meta{options} (default |\{\}|)} -\begin{codeexample}[preamble=\usetikzlibrary{patterns.images}] +\begin{codeexample}[preamble=\usetikzlibrary{ext.patterns.images}] \pgfsetupimageaspattern[width=.5cm]{grid}{example-image-1x1} \tikz \node[star, minimum size=3cm, draw, image as pattern={name=grid,options={left, bottom, y=-.5cm, rotate=45}}] {}; @@ -41,8 +41,8 @@ Specifies the name of the ``image-pattern'' to be used. \end{key} \begin{stylekey}{/tikz/image as pattern/option} -Options that's be used by the internal |\pgftext|, -only keys from |/pgf/text| should be used. +Options that's be used by the internal |\pgftext|,\indexCommandO{\pgftext} +only keys from |/pgf/text| should be used.\indexKeyO[/pgf/]{text} \end{stylekey} \begin{stylekey}{/tikz/image as pattern/options=\meta{style}} diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-positioning-plus.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-positioning-plus.tex new file mode 100644 index 0000000000..a0451a8fd7 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-positioning-plus.tex @@ -0,0 +1,183 @@ +% !TeX spellcheck = en_US +% !TeX root = tikz-ext-manual.tex +% 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. +% +\clearpage +\section{Positioning Plus} +\label{library:positioning-plus} +\tikzsetnextfilename{posplus} +\begin{tikzlibrary}{ext.positioning-plus} + With the help of the |positioning|\indexLibrary{positioning} and the |fit|\indexLibrary{fit} library this extends the placement of nodes. +\end{tikzlibrary} + +\subsection{Useful corner anchors} +The anchors |corner north east|, |corner north west|, |corner south west| and |corner south east| +are defined as ``generic anchors'', i.\,e. they are defined for all shapes. +This is mostly useful for the placement of circular shapes. +\begin{stylekey}{/tikz/corner above left=\opt{\meta{specification}} (default 0pt)} + Similar as \referenceKeyandIndexO{above left} of the \tikzname\space library |positioning| + but uses the |corner north west| anchor. +\end{stylekey} +\begin{stylekey}{/tikz/corner below left=\opt{\meta{specification}} (default 0pt)} + Similar as \referenceKeyandIndexO{below left} of the \tikzname\space library |positioning| + but uses the |corner south west| anchor. +\end{stylekey} +\begin{stylekey}{/tikz/corner above right=\opt{\meta{specification}} (default 0pt)} + Similar as \referenceKeyandIndexO{above right} of the \tikzname\space library |positioning| + but uses the |corner north east| anchor. +\end{stylekey} +\begin{stylekey}{/tikz/corner below right=\opt{\meta{specification}} (default 0pt)} + Similar as \referenceKeyandIndexO{below right} of the \tikzname\space library |positioning| + but uses the |corner south east| anchor. +\end{stylekey} + +\begin{codeexample}[width=.6\linewidth,preamble=\usetikzlibrary{ext.positioning-plus}] +\Huge +\begin{tikzpicture} +\node[name=s,shape=circle,shape example] + {Circle\vrule width 1pt height 2cm}; +\foreach \anchor/\placement in { + north west/above left, north/above, north east/above right, + west/left, center/above, east/right, + mid west/right, mid/above, mid east/left, + base west/left, base/below, base east/right, + south west/below left, south/below, south east/below right, + text/left, 10/right, 130/above} + \draw[shift=(s.\anchor)] plot[mark=x] coordinates{(0,0)} + node[\placement] {\scriptsize\texttt{(s.\anchor)}}; +\draw (s.corner north west) rectangle (s.corner south east); +\foreach \anchor/\placement in { + corner north west/above left, corner north east/above right, + corner south west/below left, corner south east/below right} + \draw[red,shift=(s.\anchor)] plot[mark=x] coordinates{(0,0)} + node[\placement] {\scriptsize\texttt{(s.\anchor)}}; +\end{tikzpicture} +\end{codeexample} + +\subsection{Useful placement keys for vertical and horizontal alignment} +\begin{stylekey}{/tikz/north left=\opt{\meta{specification}} (default 0pt)} + Like \referenceKeyandIndexO{left} but aligns the nodes at their |north| border. + + This is basically the same as |left=of reference.north west, anchor=north east|. + % +\begin{codeexample}[preamble=\usetikzlibrary{ext.positioning-plus}] +\begin{tikzpicture}[nodes=draw] +\node[minimum height=2cm] (a) {}; +\node[minimum height=3cm, north right=of a] {}; +\end{tikzpicture} +\end{codeexample} +\end{stylekey} +\begin{stylekey}{/tikz/north right=\opt{\meta{specification}} (default 0pt)} + Like \referenceKeyandIndexO{right} but aligns the nodes at their |north| border. + + This is basically the same as |left=of reference.north east, anchor=north west|. +\end{stylekey} +\begin{stylekey}{/tikz/south left=\opt{\meta{specification}} (default 0pt)} + Like \referenceKeyandIndexO{left} but aligns the nodes at their |south| border. + + This is basically the same as |left=of reference.south west, anchor=south east|. +\end{stylekey} +\begin{stylekey}{/tikz/south right=\opt{\meta{specification}} (default 0pt)} + Like \referenceKeyandIndexO{right} but aligns the nodes at their |south| border. + + This is basically the same as |left=of reference.south east, anchor=south west|. +\end{stylekey} +\begin{stylekey}{/tikz/west above=\opt{\meta{specification}} (default 0pt)} + Like \referenceKeyandIndexO{above} but aligns the nodes at their |west| border. + + This is basically the same as |left=of reference.north west, anchor=south west|. +\end{stylekey} +\begin{stylekey}{/tikz/west below=\opt{\meta{specification}} (default 0pt)} + Like \referenceKeyandIndexO{below} but aligns the nodes at their |west| border. + + This is basically the same as |left=of reference.south west, anchor=north west|. +\end{stylekey} +\begin{stylekey}{/tikz/east above=\opt{\meta{specification}} (default 0pt)} + Like \referenceKeyandIndexO{above} but aligns the nodes at their |east| border. + + This is basically the same as |left=of reference.north east, anchor=south east|. +\end{stylekey} +\begin{stylekey}{/tikz/east below=\opt{\meta{specification}} (default 0pt)} + Like \referenceKeyandIndexO{below} but aligns the nodes at their |east| border. + + This is basically the same as |left=of reference.south east, anchor=north east|. +\end{stylekey} + +The same exist for the recently introduces corner anchors, too. +\begin{stylekey}{/tikz/corner north left=\opt{\meta{specification}} (default 0pt)} + The same as |/tikz/north left| but uses the new corner anchors. +\end{stylekey} +\begin{stylekey}{/tikz/corner north right=\opt{\meta{specification}} (default 0pt)} + The same as |/tikz/north right| but uses the new corner anchors. +\end{stylekey} +\begin{stylekey}{/tikz/corner south left=\opt{\meta{specification}} (default 0pt)} + The same as |/tikz/south left| but uses the new corner anchors. +\end{stylekey} +\begin{stylekey}{/tikz/corner south right=\opt{\meta{specification}} (default 0pt)} + The same as |/tikz/south right| but uses the new corner anchors. +\end{stylekey} +\begin{stylekey}{/tikz/corner west above=\opt{\meta{specification}} (default 0pt)} + The same as |/tikz/west above| but uses the new corner anchors. +\end{stylekey} +\begin{stylekey}{/tikz/corner west below=\opt{\meta{specification}} (default 0pt)} + The same as |/tikz/west below| but uses the new corner anchors. +\end{stylekey} +\begin{stylekey}{/tikz/corner east above=\opt{\meta{specification}} (default 0pt)} + The same as |/tikz/east above| but uses the new corner anchors. +\end{stylekey} +\begin{stylekey}{/tikz/corner east below=\opt{\meta{specification}} (default 0pt)} + The same as |/tikz/east below| but uses the new corner anchors. +\end{stylekey} + +While the \meta{specification} of all these keys still accept the same form as with \tikzname, +the |ext.positioning-plus| library extends this even more. + +The specification after |of| can contain a list of coordinates +(like the |fit| key of the |fit| library). +This means that the new node will be placed in relation to a rectangular bounding box +that fits around all this nodes in the list. + +If this list is prefixed with \verb!|!, |-| or |+|, +the new node will also have the same height (\verb!|!), +the same width (|-|) or both as this bounding box. + +\begin{codeexample}[preamble=\usetikzlibrary{ext.positioning-plus}] +\begin{tikzpicture}[nodes=draw] +\node (A) {A}; +\node[below=of A] (BCD) {BCD}; +\node[right=of |(A)(BCD)] (c) {}; +\node[below=.5:of -(A)(BCD)] (d) {}; +\draw[help lines] (BCD.south west) -- (c.south east) + (BCD.north east) -- (d.south east); +\end{tikzpicture} +\end{codeexample} + +This functionality is also available without the placement: +\begin{stylekey}{/tikz/fit bounding box=\meta{list of coordinates}} + Creates a rectangular node with the name |fit bounding box| that encompasses + the \meta{list of coordinates}. +\end{stylekey} +\begin{stylekey}{/tikz/span vertical=\meta{list of coordinates}} + Creates a rectangular node with the name |fit bounding box| that encompasses + the \meta{list of coordinates} \emph{and} sets the \referenceKeyandIndexO[/pgf]{minimum height} to + the height of this bounding box. +\end{stylekey} +\begin{stylekey}{/tikz/span horizontal=\meta{list of coordinates}} + Creates a rectangular node with the name |fit bounding box| that encompasses + the \meta{list of coordinates} \emph{and} sets the \referenceKeyandIndexO[/pgf]{minimum width} to + the width of this bounding box. +\end{stylekey} +\begin{stylekey}{/tikz/span=\meta{list of coordinates}} + Is a combination of |/tikz/span vertical| and |/tikz/span horizontal|. +\end{stylekey} + +As you maybe noticed in the example above, the \meta{specification} also allows a prefix +delimited by |:| which the |node distance| will be multiplied to with for the placement.% +\footnote{This is probably more useful when \referenceKeyandIndexO{on grid} is used.} + +\endinput \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-topaths.arcthrough.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-topaths.arcthrough.tex index 10b125a39b..1d9e5ba9df 100644 --- a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-topaths.arcthrough.tex +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-topaths.arcthrough.tex @@ -10,11 +10,11 @@ \section{Arcs through Three Points} \label{library:topaths.arcthrough} -\begin{tikzlibrary}{topaths.arcthrough} +\begin{tikzlibrary}{ext.topaths.arcthrough} This library allows to use an arc defined by three points. \end{tikzlibrary} -\begin{codeexample}[width=10cm,preamble=\usetikzlibrary{topaths.arcthrough}] +\begin{codeexample}[width=10cm,preamble=\usetikzlibrary{ext.topaths.arcthrough}] \begin{tikzpicture} \coordinate[label=above right:$A$] (A) at ( 3, 1); \coordinate[label=above:$B$] (B) at ( 1, 2); @@ -33,6 +33,7 @@ This can only by used for circles in the |canvas| coordinate system. +\begin{multicols}{2} \begin{key}{/tikz/arc through/through=\meta{coordinate} (initially {(0,0)})} The coordinate on the circle that defines~-- together with the starting and target point~-- a circle. @@ -40,7 +41,7 @@ This can only by used for circles in the |canvas| coordinate system. \begin{key}{/tikz/arc through/center suffix=\meta{suffix} (initially {})} The |arc through| will define a coordinate named |arc through center|\meta{suffix} - so that it can referenced later. + so that it can be referenced later. \end{key} \begin{key}{/tikz/arc through/clockwise} @@ -54,7 +55,9 @@ This can only by used for circles in the |canvas| coordinate system. \end{key} \begin{key}{/tikz/arc through=\meta{key-value}} - This key should be used with |to| or |edge|. + This key should be used with |to|\indexPathOperationO{to} or |edge|\indexPathOperationO{edge}. A parameter other than |center suffix|, |clockwise| or |counter clockwise| will be assumed to be the |through| coordinate. \end{key} +\end{multicols} +\endinput \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-trans.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-trans.tex index ef1fb70ac2..b2aa0f8f7f 100644 --- a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-trans.tex +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-trans.tex @@ -1,3 +1,5 @@ +% !TeX spellcheck = en_US +% !TeX root = tikz-ext-manual.tex % Copyright 2022 by Qrrbrbirlbel % % This file may be distributed and/or modified @@ -10,16 +12,16 @@ \section{Mirror, Mirror on the Wall} \label{library:mirror} -\begin{tikzlibrary}{transformations.mirror} +\begin{tikzlibrary}{ext.transformations.mirror} This library adds more transformations to \tikzname. \end{tikzlibrary} -As explained in section~\ref{pgflibrary:transformations}, they are two approaches to setting a mirror transformation. -As with the commands in PGF, we'll be using lowercase |m| for the ``Spiegelungsmatrix'' and uppercase |M| for the built-in approach. +As explained in section~\ref{pgflibrary:transformations}, there are two approaches to setting a mirror transformation. +As with the commands in PGF, we'll be using a lowercase |m| for the reflection matrix and an uppercase |M| for the built-in approach. -\subsection{Using the ``Spiegelungsmatrix''} +\subsection{Using the reflection matrix} -\begin{codeexample}[width=.4\linewidth,preamble=\usetikzlibrary{shapes.geometric,transformations.mirror}] +\begin{codeexample}[width=.4\linewidth,preamble=\usetikzlibrary{shapes.geometric,ext.transformations.mirror}] \begin{tikzpicture}[line join=round, thick, reg poly/.style={ shape=regular polygon, regular polygon sides={#1}}] \node[reg poly=5, minimum size=+2cm, draw, very thick] (a) {}; @@ -32,7 +34,7 @@ As with the commands in PGF, we'll be using lowercase |m| for the ``Spiegelungsm \begin{key}{/tikz/xmirror=\meta{value or coordinate}} Sets up a transformation that mirrors along a horizontal line that goes through point $(\text{\meta{value}}, 0)$ or \meta{coordinate}. -\begin{codeexample}[preamble=\usetikzlibrary{transformations.mirror}] +\begin{codeexample}[preamble=\usetikzlibrary{ext.transformations.mirror}] \begin{tikzpicture} \draw[help lines] (-0.25, -.25) grid (3.25, 1.25); \draw[-latex] (0,0) .. controls (.5,1) .. (1,1); @@ -50,7 +52,7 @@ As with the commands in PGF, we'll be using lowercase |m| for the ``Spiegelungsm \begin{key}{/tikz/mirror x=\meta{coordinate}} Similar to |/tikz/xmirror|, this however uses the |xyz| coordinate system instead of the |canvas| system. -\begin{codeexample}[preamble=\usetikzlibrary{transformations.mirror}] +\begin{codeexample}[preamble=\usetikzlibrary{ext.transformations.mirror}] \begin{tikzpicture}[x=.5cm, y=(45:1cm)] \draw[-latex] (0,0) .. controls (.5,1) .. (1,1); @@ -76,7 +78,7 @@ As with the commands in PGF, we'll be using lowercase |m| for the ``Spiegelungsm \subsection{Using built-in transformations} -\begin{codeexample}[width=.4\linewidth,preamble=\usetikzlibrary{shapes.geometric,transformations.mirror}] +\begin{codeexample}[width=.4\linewidth,preamble=\usetikzlibrary{shapes.geometric,ext.transformations.mirror}] \begin{tikzpicture}[line join=round, thick, reg poly/.style={ shape=regular polygon, regular polygon sides={#1}}] \node[reg poly=5, minimum size=+2cm, draw, very thick] (a) {}; @@ -89,7 +91,7 @@ As with the commands in PGF, we'll be using lowercase |m| for the ``Spiegelungsm \begin{key}{/tikz/xMirror=\meta{value or coordinate}} Sets up a transformation that mirrors along a horizontal line that goes through point $(\text{\meta{value}}, 0)$ or \meta{coordinate}. -\begin{codeexample}[preamble=\usetikzlibrary{transformations.mirror}] +\begin{codeexample}[preamble=\usetikzlibrary{ext.transformations.mirror}] \begin{tikzpicture} \draw[help lines] (-0.25, -.25) grid (3.25, 1.25); \draw[-latex] (0,0) .. controls (.5,1) .. (1,1); @@ -107,7 +109,7 @@ As with the commands in PGF, we'll be using lowercase |m| for the ``Spiegelungsm \begin{key}{/tikz/Mirror x=\meta{coordinate}} Similar to |/tikz/xMirror|, this however uses the |xyz| coordinate system instead of the |canvas| system. -\begin{codeexample}[preamble=\usetikzlibrary{transformations.mirror}] +\begin{codeexample}[preamble=\usetikzlibrary{ext.transformations.mirror}] \begin{tikzpicture}[x=.5cm, y=(45:1cm)] \draw[-latex] (0,0) .. controls (.5,1) .. (1,1); @@ -131,4 +133,4 @@ As with the commands in PGF, we'll be using lowercase |m| for the ``Spiegelungsm When only \meta{point A} is given that line goes through \meta{point A} and the origin. \end{key} -\endinput \ No newline at end of file +\endinput diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-body.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-body.tex index 10deb02792..e4445d392b 100644 --- a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-body.tex +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-body.tex @@ -8,7 +8,7 @@ % 2. under the GNU Free Documentation License. % \newcommand*\tikzextname{Ti\textit kZ-Extensions} -\newcommand*\tikzextversion{0.1} +\newcommand*\tikzextversion{0.2} %\includeonly{ % tikz-ext-manual-en-library-paths.arcto, @@ -40,7 +40,7 @@ These libraries only work with \tikzname. \vspace{1em} -\begin{center} +\begin{center}\tikzsetnextfilename{main-cover} \begin{tikzpicture}[ very thick, scale=2.7, @@ -74,24 +74,64 @@ These libraries only work with \tikzname. \end{tikzpicture} \end{center} -\include{tikz-ext-manual-en-library-paths.arcto} -\include{tikz-ext-manual-en-library-paths.ortho} -\include{tikz-ext-manual-en-library-paths.timer} -\include{tikz-ext-manual-en-library-patterns.images} -\include{tikz-ext-manual-en-library-topaths.arcthrough} -\include{tikz-ext-manual-en-library-trans} +\tikzsetfigurename{calendar-plus} \include{tikz-ext-manual-en-library-calendar-plus} +\tikzsetfigurename{node-families} \include{tikz-ext-manual-en-library-node-families} +\tikzsetfigurename{paths.arcto} \include{tikz-ext-manual-en-library-paths.arcto} +\tikzsetfigurename{paths.ortho} \include{tikz-ext-manual-en-library-paths.ortho} +\tikzsetfigurename{paths.timer} \include{tikz-ext-manual-en-library-paths.timer} +\tikzsetfigurename{patterns.images} \include{tikz-ext-manual-en-library-patterns.images} +\tikzsetfigurename{positioning-plus}\include{tikz-ext-manual-en-library-positioning-plus} +\tikzsetfigurename{topaths.arcthrough}\include{tikz-ext-manual-en-library-topaths.arcthrough} +\tikzsetfigurename{trans} \include{tikz-ext-manual-en-library-trans} \part{PGF Libraries} \label{part:pgf} These libraries (should) work with both PGF and \tikzname. -\include{tikz-ext-manual-en-pgf-trans} +\begin{center}\tikzsetnextfilename{main-graph} +\begin{codeexample}[width=10cm,preamble=\usetikzlibrary{graphs,graphdrawing,ext.misc} \usegdlibrary{force}] +\tikzset{ + mynode/.style={ + circle, minimum size=10mm, draw, densely dashdotted, thick, + decide color/.expand once=#1}, + decide color/.style 2 args={ + /utils/TeX/if=c#1 + {/utils/TeX/ifnum={#2<5}{bluelight}{bluedark}} + {/utils/TeX/ifnum={#2<8}{light}{dark}}}, + light/.style={fill=gray!20}, bluelight/.style={fill=blue!10}, + dark/.style ={fill=gray!60}, bluedark/.style ={fill=blue!30}} +\tikz\graph[ + spring electrical layout, vertical=c2 to p13, + node distance=1.5cm, typeset=$n_{\tikzgraphnodetext}$, + nodes={mynode=\tikzgraphnodetext}] { + % outer ring + c2 -- {p1, p11, p6}; + p1 -- {p8, c6, p11}; + p8 -- {p3, p10, c6}; + p3 -- {p13, p15, p10}; + p13 -- {p15, c7}; + c7 -- {c3, c4, p15}; + c3 -- {p14, c4}; + p14 -- {p7, c4}; + p7 -- {p9, p2, c4}; + p9 -- {c5, p12, p2}; + c5 -- {c1, p4, p12}; + c1 -- {p6, p4}; + p6 -- {p11, p4}; + % inner ring + p11 -- {c6, p12, p4}; + p5 -- {c6 -- {p10, p12}, p10 -- p15, p15 -- c4, c4 -- p2, p2 -- p12, p12 -- p4}; +}; +\end{codeexample} +\end{center} -\part{Miscellaneous} +\tikzsetfigurename{PGF.trans}\include{tikz-ext-manual-en-pgf-trans} + +\part{Utilities} \label{part:misc} -\vfill -\begin{codeexample}[width=6cm, preamble=\usetikzlibrary{misc}] +\vfill\tikzsetnextfilename{main-misc} +\begin{codeexample}[width=6cm, preamble=\usetikzlibrary{ext.misc}] \begin{tikzpicture}[ declare function={bigR(\n)=smallR+.05*\n;}, declare constant={smallR=1; segments=20;}, @@ -118,9 +158,34 @@ These libraries (should) work with both PGF and \tikzname. \end{codeexample} \vfill -\include{tikz-ext-manual-en-library-misc} +\tikzsetfigurename{misc.calendar}\include{tikz-ext-manual-en-calendar} +\tikzsetfigurename{misc.misc}\include{tikz-ext-manual-en-library-misc} %%% END +\newcommand*{\addTikz}[1]{Added \tikzname\space library \texttt{ext.#1}.} +\newcommand*{\addPGF}[1]{Added PGF library \texttt{ext.#1}.} +\part{Changelog \& Index} +\section*{Changelog} +\begin{multicols}{2} +Version 0.2 +\begin{itemize} +\item \addTikz{positioning-plus} +\item \addTikz{node-families} +\end{itemize} + +Version 0.1 +\begin{itemize} +\item \addTikz{calendar-plus} +\item \addTikz{misc} +\item \addTikz{paths.arcto} +\item \addTikz{paths.ortho} +\item \addTikz{paths.timer} +\item \addTikz{patterns.images} +\item \addTikz{topaths.arcthrough} +\item \addTikz{transformations.mirror} +\item \addPGF{transformations.mirror} +\end{itemize} +\end{multicols} \printindex %\typeout{Examples: \the\codeexamplecount}% diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-preamble.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-preamble.tex index a1897bbf70..238c10172f 100644 --- a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-preamble.tex +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-preamble.tex @@ -85,13 +85,16 @@ \makeatother \usetikzlibrary{ - misc, - paths.arcto, - paths.ortho, - paths.timer, - patterns.images, - topaths.arcthrough, - transformations.mirror, + ext.calendar-plus, + ext.misc, + ext.node-families, + ext.paths.arcto, + ext.paths.ortho, + ext.paths.timer, + ext.patterns.images, + ext.positioning-plus, + ext.topaths.arcthrough, + ext.transformations.mirror, % calc, fit, @@ -103,3 +106,263 @@ %% needs Lua! \usetikzlibrary{graphs,graphdrawing} \usegdlibrary{force} + +\makeatletter +\def\endofcodeexample#1{% original from tex/latex/pgf/doc/pgfmanual-en-macros.tex by Till Tantau et al + \endgroup% + \ifpgfmanual@setup@code% + \gdef\pgfmanual@do@this{% + {% + \returntospace% + \commenthandler% + \xdef\code@temp{#1}% removes returns and comments + }% + \edef\pgfmanualmcatcode{\the\catcode`\^^M}% + \catcode`\^^M=9\relax% + \expandafter\scantokens\expandafter{\code@temp}% + \catcode`\^^M=\pgfmanualmcatcode% + }% + \fi% + \ifcode@hidden\else + \ifcode@execute% + \setbox\codeexamplebox=\hbox{% + \ifx\code@render\pgfutil@empty% + {% + {% + \returntospace% + \commenthandler% + \xdef\code@temp{#1}% removes returns and comments + }% + \catcode`\^^M=9% + \colorbox{graphicbackground}{\color{black}\ignorespaces% + \code@pre\expandafter\scantokens\expandafter{\code@temp\ignorespaces}\code@post\ignorespaces}% + }% + \else% + \global\let\code@temp\code@render% + \colorbox{graphicbackground}{\color{black}\ignorespaces% + \code@render}% + \fi% + }% + \ifx\code@animation@list\pgfutil@empty% + \else% + \setbox\codeexampleboxanim=\vbox{% + \rightskip0pt\leftskip0pt plus1filll% + \ifdim\wd\codeexamplebox>\codeexamplewidth% + \else% + \hsize\codeexamplewidth% + \advance\hsize by2cm% + \fi% + \leavevmode\catcode`\^^M=9% + \foreach \pgfmanualtime/\pgfmanualtimehow in\code@animation@list{% + \setbox\codeexampleboxanim=\hbox{\colorbox{animationgraphicbackground}{% + \tikzset{make snapshot of=\pgfmanualtime}% + \scalebox{\pgfmanualanimscale}{\color{black}\ignorespaces% + \code@animation@pre\expandafter\scantokens\expandafter{\code@temp\ignorespaces}\code@animation@post\ignorespaces}% + }}% + \space\raise4pt\hbox to0pt{\vrule width0pt height1em\hbox + to\wd\codeexampleboxanim{\hfil\scriptsize$t{=}\pgfmanualtimehow \mathrm s$\hfil}\hss}% + \lower\ht\codeexampleboxanim\box\codeexampleboxanim\hfil\penalty0\hskip0ptplus-1fil% + }% + }% + \setbox\codeexampleboxanim=\hbox{\hbox{}\hskip-2cm\box\codeexampleboxanim}% + \fi% + \ifdim\wd\codeexamplebox>\codeexamplewidth% + \def\code@start{\par}% + \def\code@flushstart{}\def\code@flushend{}% + \def\code@mid{\parskip2pt\par\noindent}% + \def\code@width{\linewidth-6pt}% + \def\code@end{}% + \else% + \def\code@start{% +% \linewidth=\textwidth% removed this line + \parshape \@ne 0pt \linewidth + \leavevmode% + \hbox\bgroup}% + \def\code@flushstart{\hfill}% + \def\code@flushend{\hbox{}}% + \def\code@mid{\hskip6pt}% + \def\code@width{\linewidth-12pt-\codeexamplewidth}% + \def\code@end{\egroup}% + \fi% + \code@start% + \noindent% + \begin{minipage}[t]{\codeexamplewidth}\raggedright + \hrule width0pt% + \footnotesize\vskip-1em% + \code@flushstart\box\codeexamplebox\code@flushend% + \vskip0pt% + \leavevmode% + \box\codeexampleboxanim% + \vskip-1ex + \leavevmode% + \end{minipage}% + \else% + \def\code@mid{\par} + \def\code@width{\linewidth-6pt} + \def\code@end{} + \fi% + \code@mid% + \ifpgfmanual@multipage@code% + {% + \pgfkeysvalueof{/codeexample/prettyprint/base color}% + \pgfmanualdolisting{#1}% + }% + \else% + \colorbox{codebackground}{% + \pgfkeysvalueof{/codeexample/prettyprint/base color}% + \begin{minipage}[t]{\code@width}% + \pgfmanualdolisting{#1}% + \end{minipage}}% + \fi% + \code@end% + \par% + \medskip + \fi + \endcodeexample\endgroup% +} + +\newenvironment{pathoperation'}[3][]{ + \begin{pgfmanualentry} + \def\pgfmanualtest{#1}% + \pgfmanualentryheadline{% + \ifx\pgfmanualtest\@empty% + \pgfmanualpdflabel{#2}{}% + \fi% + %\textcolor{gray}{{\ttfamily\char`\\path}\ \ \dots} + %\declare{\texttt{\noligs{#2}}}#3\ \textcolor{gray}{\dots\texttt{;}} + }% + \ifx\pgfmanualtest\@empty% + \index{#2@\protect\texttt{#2} path operation}% + \index{Path operations!#2@\protect\texttt{#2}}% + \fi% + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} +\makeatother + +\usepackage{paracol} + +%% normal references +\newcommand*{\indexLibrary}[1]{% + \index{#1@\protect\texttt{#1} library}% + \index{Libraries!#1@\protect\texttt{#1}}% +} +\newcommand*{\indexMathFunction}[1]{% + \index{#1@\protect\texttt{#1} math function}% + \index{Math functions!#1@\protect\texttt{#1}}% +} +\newcommand*{\indexShape}[1]{% + \index{#1@\protect\texttt{#1} shape}% + \index{Shapes!#1@\protect\texttt{#1}}% +} +\newcommand*{\indexHandler}[1]{% + \index{\gobble#1@\protect\texttt{#1} handler}% + \index{Key handlers!#1@\protect\texttt{#1}} +} +\newcommand*{\indexKey}[2][/tikz/]{% + \def\mykey{#1#2}% + \def\mypath{}% + \gdef\myname{}% + \decompose#1#2/\nil +} +\newcommand*{\indexPathOperation}[1]{% + \index{#1@\protect\texttt{#1} path operation}% + \index{Path operations!#1@\protect\texttt{#1}}% +} + +%% references to original +\newcommand*{\indexLibraryO}[1]{% + \index{#1@\originalprefix\protect\texttt{\original{#1}} library\originalsuffix}% + \index{Libraries!#1@\originalprefix\protect\texttt{\original{#1}}\originalsuffix}% +} +\newcommand*{\indexMathFunctionO}[1]{% + \index{#1@\protect\texttt{\original{#1}} math function\originalsuffix}% + \index{Math functions!#1@\protect\texttt{\original{#1}}\originalsuffix}% +} +\newcommand*{\indexShapeO}[1]{% + \index{#1@\originalprefix\protect\texttt{\original{#1}} shape\originalsuffix}% + \index{Shapes!#1@\originalprefix\protect\texttt{\original{#1}}\originalsuffix}% +} +\newcommand*{\indexHandlerO}[1]{% + \index{\gobble#1@\originalprefix\protect\texttt{\original{#1}} handler\originalsuffix}% + \index{Key handlers!#1@\originalprefix\protect\texttt{\original{#1}}\originalsuffix} +} +\newcommand*{\indexKeyO}[2][/tikz/]{%TODO + \begingroup\let\decomposetoodeep\decomposetoodeepO + \def\mykey{#1#2}% + \def\mypath{}% + \gdef\myname{}% + \firsttimetrue + \decomposeO#1#2/\nil + \endgroup +} +\def\decomposetoodeepO#1/#2/\nil{% + % avoid too-deep nesting in index + \index{#1/#2@\originalprefix\protect\texttt{\original{#1/#2}} key\originalsuffix}% + \index{\mypath#1/#2@\originalprefix\protect\texttt{\original{#1/#2}}\originalsuffix}% + \decomposefindlast/#1/#2/\nil% +} +\def\decomposeO/#1/#2\nil{% + \def\test{#2}% + \ifx\test\empty% + % aha. + \index{#1@\originalprefix\protect\texttt{\original{#1}} key\originalsuffix}% + \index{\mypath#1@\originalprefix\protect\texttt{\original{#1}}\originalsuffix}% + \gdef\myname{#1}% + \pgfmanualpdflabel{#1}{} + \else% + \advance\pgfmanualdecomposecount by1\relax% + \ifnum\pgfmanualdecomposecount>2\relax% + \decomposetoodeepO#1/#2\nil% + \else% + \iffirsttime% + \begingroup% + % also make a pdf link anchor with full key path. + \def\hyperlabelwithoutslash##1/\nil{% + \pgfmanualpdflabel{##1}{}% + }% + \hyperlabelwithoutslash/#1/#2\nil% + \endgroup% + \def\mypath{#1@\protect\texttt{/#1/}!}% + \firsttimefalse% + \else% + \expandafter\def\expandafter\mypath\expandafter{\mypath#1@\protect\texttt{#1/}!}% + \fi% + \def\firsttime{}% + \decomposeO/#2\nil% + \fi% + \fi% +} +\newcommand*{\indexPathOperationO}[1]{% + \index{#1@\originalprefix\protect\texttt{\original{#1}} path operation\originalsuffix}% + \index{Path operations!#1@\originalprefix\protect\texttt{\original{#1}}\originalsuffix}% +} + +\newcommand*{\indexCommandO}[1]{% + \removeats{#1}% + \index{\strippedat @\originalprefix\protect\texttt{\original{\protect\string\protect#1}}\originalsuffix}% +} + +\newcommand*{\referenceKeyandIndexO}[2][/tikz/]{\texttt{#1#2}\indexKeyO[#1]{#2}}% + +\colorlet{originalindex}{gray} +\newcommand*{\original}[1]{\textcolor{originalindex}{#1}} +\newcommand*{\originalsuffix}{}%\textsuperscript{\textdagger}}%\normalsize +\newcommand*{\originalprefix}{}%\footnotesize + +%\newcommand*{\original}[1]{\textcolor{originalindex}{#1}} +%\newcommand*{\original}[1]{#1}%\textcolor{originalindex}{#1}} +%\newcommand*{\originalsuffix}{}%\textsuperscript{\color{blue}\tikzname}} +%\DeclareRobustCommand*{\originalprefix}{\smash{\footnotesize\llap{\textbullet\space}}} + +\newcommand*{\filetype}[1]{\textsc{#1}} + +\makeatletter +\def\index@prologue{\section*{Index}\addcontentsline{toc}{section}{Index} + This index contains automatically generated entries as well as {\originalprefix\original{references}\originalsuffix} to + original functionalities of PGF/\tikzname. + \bigskip +} +\makeatother \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-pgf-trans.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-pgf-trans.tex index 3788e0c9a4..b0f0f2906d 100644 --- a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-pgf-trans.tex +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-pgf-trans.tex @@ -11,28 +11,30 @@ \section{Transformations: Mirroring} \label{pgflibrary:transformations} -\begin{pgflibrary}{transformations.mirror} +\begin{purepgflibrary}{ext.transformations.mirror} This library adds mirror transformations to PGF. -\end{pgflibrary} +\end{purepgflibrary} Two approaches to mirror transformation exist: \begin{enumerate} -\item Using the ``Spiegelmatrix`` (see section~\ref{pgflibrary:transformations:spiegelungsmatrix}). +\item Using the reflection matrix (see left column). - This depends on |\pgfpointnormalised| which involves the sine and the cosine functions of PGFmath. + This depends on |\pgfpointnormalised|\indexCommandO\pgfpointnormalised which involves + the sine\indexMathFunctionO{sin} and the cosine\indexMathFunctionO{cos} functions of PGFmath. -\item Using built-in transformations (see section~\ref{pgflibrary:transformations:builtin}). +\item Using built-in transformations (see right column). - This depends on |\pgfmathanglebetween| which involves the arctangent (|atan2|) function of PGFmath. + This depends on |\pgfmathanglebetween|\indexCommandO\pgfmathanglebetween which involves the arctangent (|atan2|\indexMathFunctionO{atan2}) function of PGFmath. \end{enumerate} Which one is better? I don't know. Choose one you're comfortable with. -\subsection{Using the ``Spiegelungsmatrix''} -\label{pgflibrary:transformations:spiegelungsmatrix} +\begin{paracol}{2} -The following commands use the ``Spiegelungsmatrix'' that sets the transformation matrix following +\subsection{Using the reflection matrix} + +The following commands use the reflection matrix that sets the transformation matrix following \begin{equation*} A = \frac{1}{\Vert\vec l\Vert^2} \begin{bmatrix} l_x^2-l_y^2 & 2l_xl_y \\ @@ -40,6 +42,18 @@ The following commands use the ``Spiegelungsmatrix'' that sets the transformatio \end{bmatrix}. \end{equation*} +\switchcolumn% > + +\stepcounter{subsection} +\subsection{Using built-in transformations} + +The following commands use a combination of shifting, rotating, $-1$ scaling, +rotating back and shifting back to reach the mirror transformation. + +The commands are named the same as on the left side, +only the |m| in |mirror| is capitalized. + +\switchcolumn*% < \begin{command}{\pgftransformxmirror\marg{value}} Sets up a transformation that mirrors along a vertical line that goes through point $(\text{\meta{value}}, 0)$. @@ -57,87 +71,90 @@ The following commands use the ``Spiegelungsmatrix'' that sets the transformatio \end{codeexample} \end{command} -\begin{command}{\pgftransformymirror\marg{value}} - Sets up a transformation that mirrors along a horizontal line that goes through point $(0, \text{\meta{value})}$. -\end{command} +\switchcolumn% > + +\begin{command}{\pgftransformxMirror\marg{value}} + Sets up a transformation that mirrors along a vertical line that goes through point $(\text{\meta{value}}, 0)$. -\begin{command}{\pgftransformmirror\marg{point A}\marg{point B}} - Sets up a transformation that mirrors along the line that goes through \meta{point A} and \meta{point B}. - \begin{codeexample}[preamble=\usepgflibrary{transformations.mirror}] \begin{tikzpicture} -\draw[help lines] (-.25, -2.25) grid (2.5, 1.25); +\draw[help lines] (-0.25, -.25) grid (3.25, 1.25); \draw[-latex] (0,0) .. controls (.5,1) .. (1,1); -\draw[dashed] (0, -1) -- (2, 0); -\pgftransformmirror{\pgfpointxy{0}{-1}}{\pgfpointxy{2}{0}} +\draw[dashed] (1.5, -.25) -- (1.5, 1.25); +\pgftransformxMirror{1.5} \draw[-latex] (0,0) .. controls (.5,1) .. (1,1); \end{tikzpicture} \end{codeexample} \end{command} -\begin{command}{\pgfqtransformmirror\marg{point A}} - Sets up a transformation that mirrors along the line that goes through the origin and \meta{point A}. +\switchcolumn*% < + +\begin{command}{\pgftransformymirror\marg{value}} + Sets up a transformation that mirrors along a horizontal line that goes through point $(0, \text{\meta{value})}$. +\end{command} +\begin{command}{\pgftransformmirror\marg{point A}\marg{point B}} + Sets up a transformation that mirrors along the line that goes through \meta{point A} and \meta{point B}. + \begin{codeexample}[preamble=\usepgflibrary{transformations.mirror}] \begin{tikzpicture} -\draw[help lines] (-.25, -.25) grid (2.25, 1.25); +\draw[help lines] (-.25, -2.25) grid (2.5, 1.25); \draw[-latex] (0,0) .. controls (.5,1) .. (1,1); -\draw[dashed] (0, 0) -- (2, 1); -\pgfqtransformmirror{\pgfpointxy{2}{1}} +\draw[dashed] (0, -1) -- (2, 0); +\pgftransformmirror{\pgfpointxy{0}{-1}} + {\pgfpointxy{2}{ 0}} \draw[-latex] (0,0) .. controls (.5,1) .. (1,1); \end{tikzpicture} \end{codeexample} \end{command} +\switchcolumn% > -\subsection{Using built-in transformations} -\label{pgflibrary:transformations:builtin} - -The following commands use a combination of shifting, rotating, $-1$ scaling, rotating back and shifting back to reach the mirror transformation. - -The commands are named the same as above, only the |m| in |mirror| is capitalized. - - -\begin{command}{\pgftransformxMirror\marg{value}} - Sets up a transformation that mirrors along a vertical line that goes through point $(\text{\meta{value}}, 0)$. +\begin{command}{\pgftransformyMirror\marg{value}} + Sets up a transformation that mirrors along a horizontal line that goes through point $(0, \text{\meta{value})}$. +\end{command} +\begin{command}{\pgftransformMirror\marg{point A}\marg{point B}} + Sets up a transformation that mirrors along the line that goes through \meta{point A} and \meta{point B}. + \begin{codeexample}[preamble=\usepgflibrary{transformations.mirror}] \begin{tikzpicture} -\draw[help lines] (-0.25, -.25) grid (3.25, 1.25); +\draw[help lines] (-.25, -2.25) grid (2.5, 1.25); \draw[-latex] (0,0) .. controls (.5,1) .. (1,1); -\draw[dashed] (1.5, -.25) -- (1.5, 1.25); -\pgftransformxMirror{1.5} +\draw[dashed] (0, -1) -- (2, 0); +\pgftransformMirror{\pgfpointxy{0}{-1}} + {\pgfpointxy{2}{ 0}} \draw[-latex] (0,0) .. controls (.5,1) .. (1,1); \end{tikzpicture} \end{codeexample} \end{command} -\begin{command}{\pgftransformyMirror\marg{value}} - Sets up a transformation that mirrors along a horizontal line that goes through point $(0, \text{\meta{value})}$. -\end{command} +\switchcolumn*% < + +\begin{command}{\pgfqtransformmirror\marg{point A}} + Sets up a transformation that mirrors along the line that goes through the origin and \meta{point A}. -\begin{command}{\pgftransformMirror\marg{point A}\marg{point B}} - Sets up a transformation that mirrors along the line that goes through \meta{point A} and \meta{point B}. - \begin{codeexample}[preamble=\usepgflibrary{transformations.mirror}] \begin{tikzpicture} -\draw[help lines] (-.25, -2.25) grid (2.5, 1.25); +\draw[help lines] (-.25, -.25) grid (2.25, 1.25); \draw[-latex] (0,0) .. controls (.5,1) .. (1,1); -\draw[dashed] (0, -1) -- (2, 0); -\pgftransformMirror{\pgfpointxy{0}{-1}}{\pgfpointxy{2}{0}} +\draw[dashed] (0, 0) -- (2, 1); +\pgfqtransformmirror{\pgfpointxy{2}{1}} \draw[-latex] (0,0) .. controls (.5,1) .. (1,1); \end{tikzpicture} \end{codeexample} \end{command} +\switchcolumn + \begin{command}{\pgfqtransformMirror\marg{point A}} Sets up a transformation that mirrors along the line that goes through the origin and \meta{point A}. @@ -154,4 +171,5 @@ The commands are named the same as above, only the |m| in |mirror| is capitalize \end{codeexample} \end{command} -\endinput \ No newline at end of file +\end{paracol} +\endinput diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.pdf b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.pdf index 57ce1debf8..7879c7cd9b 100644 Binary files a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.pdf and b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.pdf differ diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.tex index 1b9754d629..2375904d80 100644 --- a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.tex +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.tex @@ -14,18 +14,20 @@ \input{tikz-ext-manual-en-main-preamble.tex} \usetikzlibrary{external} -\newif\iftikzextmanualexternalize -\tikzextmanualexternalizetrue -\iftikzextmanualexternalize +%\newif\iftikzextmanualexternalize +%\tikzextmanualexternalizetrue +%\iftikzextmanualexternalize \tikzexternalize[ - prefix=doc/tikz/, - mode=graphics if exists, + prefix=tikz/, +% prefix=../../tikz-extensions-tikz/, +% mode=convert with system call, %mode=list and make, %mode=list only,export=true,% simply skips EVERY picture -> good for debugging the text. ] + \tikzexternalenable \tikzifexternalizing{% \pgfkeys{/pdflinks/codeexample links=false}% }{}% -\fi +%\fi \input{tikz-ext-manual-en-main-body.tex} diff --git a/graphics/pgf/contrib/tikz-ext/pgfcalendar-ext.code.tex b/graphics/pgf/contrib/tikz-ext/pgfcalendar-ext.code.tex new file mode 100644 index 0000000000..b32ac9a3a6 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/pgfcalendar-ext.code.tex @@ -0,0 +1,327 @@ +% 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. +% +\pgfqkeys{/pgf/calendar}{ + style/.style={#1}, + yesterday/.value required, + yesterday/.code={% + \begingroup + \pgfutil@tempcnta=\pgfcalendarifdatejulian\relax + \advance\pgfutil@tempcnta by -1\relax + \pgfcalendarjuliantodate{\pgfutil@tempcnta}{\pgfcalendarifdateyear}{\pgfcalendarifdatemonth}{\pgfcalendarifdateday}% + \edef\pgfcalendarifdatejulian{\the\pgfutil@tempcnta}% + \pgfcalendarjuliantoweekday\pgfutil@tempcnta\pgfutil@tempcntb + \edef\pgfcalendarifdateweekday{\the\pgfutil@tempcntb}% + \pgfcalendarjulianyeartoweek\pgfutil@tempcnta\pgfcalendarifdateyear\pgfutil@tempcntb + \edef\pgfcalendarifdateweek{\the\pgfutil@tempcntb}% + \pgfcalendar@launch@ifdate{#1}{% + \def\pgf@cal@temp{\pgfcalendarmatchestrue}% + }{% + \let\pgf@cal@temp\pgfutil@empty + }% + \expandafter + \endgroup\pgf@cal@temp + }, + Jan/.code={\ifnum\pgfcalendarifdatemonth=1 \expandafter\pgfcalendarmatchestrue\fi},Jan/.value forbidden, + Feb/.code={\ifnum\pgfcalendarifdatemonth=2 \expandafter\pgfcalendarmatchestrue\fi},Feb/.value forbidden, + Mar/.code={\ifnum\pgfcalendarifdatemonth=3 \expandafter\pgfcalendarmatchestrue\fi},Mar/.value forbidden, + Apr/.code={\ifnum\pgfcalendarifdatemonth=4 \expandafter\pgfcalendarmatchestrue\fi},Apr/.value forbidden, + May/.code={\ifnum\pgfcalendarifdatemonth=5 \expandafter\pgfcalendarmatchestrue\fi},May/.value forbidden, + Jun/.code={\ifnum\pgfcalendarifdatemonth=6 \expandafter\pgfcalendarmatchestrue\fi},Jun/.value forbidden, + Jul/.code={\ifnum\pgfcalendarifdatemonth=7 \expandafter\pgfcalendarmatchestrue\fi},Jul/.value forbidden, + Aug/.code={\ifnum\pgfcalendarifdatemonth=8 \expandafter\pgfcalendarmatchestrue\fi},Aug/.value forbidden, + Sep/.code={\ifnum\pgfcalendarifdatemonth=9 \expandafter\pgfcalendarmatchestrue\fi},Sep/.value forbidden, + Oct/.code={\ifnum\pgfcalendarifdatemonth=10 \expandafter\pgfcalendarmatchestrue\fi},Oct/.value forbidden, + Nov/.code={\ifnum\pgfcalendarifdatemonth=11 \expandafter\pgfcalendarmatchestrue\fi},Nov/.value forbidden, + Dec/.code={\ifnum\pgfcalendarifdatemonth=12 \expandafter\pgfcalendarmatchestrue\fi},Dec/.value forbidden, + % + difference between/.code args={#1and#2 #3 #4}{% + \pgfcalendardatetojulian{#1}\pgfutil@tempcnta + \pgfcalendardatetojulian{#2}\pgfutil@tempcntb + \advance\pgfutil@tempcntb by -\pgfutil@tempcnta + \ifnum\pgfutil@tempcntb#3#4\relax + \pgfcalendarmatchestrue + \fi}, + weekday before or same/.code args={#1and#2}{% + \pgfcalendarjuliantoweekday{#1}\pgfutil@tempcnta + \pgfcalendarjuliantoweekday{#2}\pgfutil@tempcntb + \ifnum\pgfutil@tempcntb<\pgfutil@tempcnta + \pgfcalendarmatchestrue + \fi + }, + leap year/.code={% + \pgfutil@tempcnta=#1\relax + \divide\pgfutil@tempcnta4 + \multiply\pgfutil@tempcnta4 + \ifnum\pgfutil@tempcnta=#1\relax + \divide\pgfutil@tempcnta100 + \multiply\pgfutil@tempcnta100 + \ifnum\pgfutil@tempcnta=#1\relax + \divide\pgfutil@tempcnta400 + \multiply\pgfutil@tempcnta400 + \ifnum\pgfutil@tempcnta=#1\relax + \pgfcalendarmatchestrue + \fi + \else + \pgfcalendarmatchestrue + \fi + \fi}, + leap year/.default=\pgfcalendarifdateyear, + between days/.code args={#1and#2}{% + \pgfutil@tempcnta=#1\relax + \ifnum\pgfcalendarifdateday<\pgfutil@tempcnta\else + \pgfutil@tempcnta=#2\relax + \ifnum\pgfcalendarifdateday>\pgfutil@tempcnta\else + \pgfcalendarmatchestrue\fi\fi}, + week of month/.code={% + \pgfutil@tempcnta=#1\relax + \multiply\pgfutil@tempcnta7 + \ifnum\pgfcalendarifdateday>\pgfutil@tempcnta\else + \advance\pgfutil@tempcnta-7 + \ifnum\pgfcalendarifdateday>\pgfutil@tempcnta + \pgfcalendarmatchestrue + \fi + \fi}, + week of month'/.code={% + \pgfcalendar@getlastYMX\pgfcalendarifdateyear\pgfcalendarifdatemonth\pgfutil@tempcnta + \advance\pgfutil@tempcnta1 + \pgfutil@tempcntb=#1\relax + \multiply\pgfutil@tempcntb7 + \advance\pgfutil@tempcnta-\pgfutil@tempcntb + \ifnum\pgfcalendarifdateday<\pgfutil@tempcnta\else + \advance\pgfutil@tempcnta+7 + \ifnum\pgfcalendarifdateday<\pgfutil@tempcnta + \pgfcalendarmatchestrue + \fi + \fi}, + first/.code={\pgfutil@in@:{#1}\ifpgfutil@in@ + \pgfcalendar@ifdate@first{}#1\pgf@stop\else + \pgfcalendar@ifdate@first{}1:#1\pgf@stop\fi}, + last/.code={\pgfutil@in@:{#1}\ifpgfutil@in@ + \pgfcalendar@ifdate@first'#1\pgf@stop\else + \pgfcalendar@ifdate@first'1:#1\pgf@stop\fi}, + % logic + not/.value required, + not/.code=% + \begingroup + \let\pgf@cal@tempa\pgfutil@empty + \pgfcalendar@launch@ifdate{#1}{}{\def\pgf@cal@tempa{\pgfcalendarmatchestrue}}% + \expandafter\endgroup\pgf@cal@tempa, + and/.value required, + and/.code=% and = {, , , …} + \begingroup + \pgfcalendarmatchestrue + \pgfqkeys{/pgf/calendar/and}{#1}% + \ifpgfcalendarmatches % is it still true? + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi + {\def\pgf@cal@temp{\pgfcalendarmatchestrue}}% + {\let\pgf@cal@temp\pgfutil@empty}% + \expandafter\endgroup\pgf@cal@temp, + and/.unknown/.code=% only inside the group of and/.code + \ifpgfcalendarmatches + \expandafter\pgfutil@firstofone + \else + \expandafter\pgfutil@gobble + \fi + {% + \begingroup + \pgfcalendar@launch@ifdate{\pgfkeyscurrentname={#1}}% + {\let\pgf@cal@temp\pgfutil@empty}{\def\pgf@cal@temp{\pgfcalendarmatchesfalse}} + \expandafter\endgroup\pgf@cal@temp + }% +} + +\def\pgfcalendar@ifdate@first#1#2:#3\pgf@stop{% + \pgfqkeys{/pgf/calendar}{and={#3, week of month#1={#2}}}} +\def\pgfcalendar@getlastYMX#1#2#3{% #1 = year, #2 = month, #3 := last day + \begingroup + \ifnum#2=2 % stupid February + \pgfcalendarmatchesfalse + \pgfqkeys{/pgf/calendar}{leap year={#1}}% + \ifpgfcalendarmatches + #3=29 + \else + #3=28 + \fi + \else + #3=\ifcase#2\relax\or + 31\or\or31\or30\or31\or30\or31\or31\or30\or31\or30\or31\fi + \fi + \edef\pgf@cal@temp{#3=\the#3\relax} + \expandafter + \endgroup\pgf@cal@temp} + +% +% weeks +% +\def\pgfcalendar@week@setup#1{% + \pgfutil@IfUndefined{pgfcalendar@week@#1}{% + \begingroup + \pgfcalendardatetojulian{#1-01-01}\pgfutil@tempcnta + \pgfcalendarjuliantoweekday\pgfutil@tempcnta\pgfutil@tempcntb + % + % tempcnta holds the julian number for first day of the current year + % tempcntb holds the weekday for the first day of the current year + % + % set tempcnta to the Monday of the week with first day of current year + \advance\pgfutil@tempcnta by -\pgfutil@tempcntb + % + % if the first week starts at Fri, Sat or Sun, next week is the 1st week + \ifnum\pgfutil@tempcntb>3\relax + \advance\pgfutil@tempcnta by 7\relax + \fi + % setup macro for year with {Julian number for day of first week}{weekday of -01-01} + \edef\pgf@cal@temp{\def\expandafter\noexpand\csname pgfcalendar@week@#1\endcsname + {{\the\pgfutil@tempcnta}{\the\pgfutil@tempcntb}}}% + \expandafter\endgroup\pgf@cal@temp + }{}% +} + +\def\pgfcalendarjulianyeartoweek#1#2#3{\pgfcalendarjulianyeartoweek@{#1}{#2}{#3}{\iftrue}} +\def\pgfcalendarjulianyeartoweek@#1#2#3#4{% + % #1 = julian date (count) + % #2 = year + % #3 = count that holds the week at the end + % #4 = \iftrue or \iffalse: whether week 53 needs to be checked (\iffalse when determing week from next year) + \begingroup + \pgfcalendar@week@setup{#2}% + #3=#1\relax + % + % calculate difference of days between current date and start of week 1 + % + \advance#3 by -\expandafter\expandafter\expandafter\pgfutil@firstoftwo\csname pgfcalendar@week@#2\endcsname\relax + \ifnum#3<0\relax % whoops, we are in the week of the previous year + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi + {% if first day of the year is Fri, Sat or Sun + \ifnum\expandafter\expandafter\expandafter\pgfutil@secondoftwo\csname pgfcalendar@week@#2\endcsname>3\relax + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi + {% we need to check the week of the previous year + #3=#2\relax + \advance#3 by -1 + \edef\pgf@cal@temp{\noexpand\pgfcalendarjulianyeartoweek@#1{\the#3}#3\noexpand\iffalse}% + \pgf@cal@temp + }{% yeah, it's weird + \divide#3 by 7 + \advance#3 by 1 + } + }{% + \divide#3 by 7 + \advance#3 by 1 + #4% + \expandafter\pgfutil@firstofone + \else + \expandafter\pgfutil@gobble + \fi + {% + \ifnum#3=53\relax % whoops, we are possibly in the first week of the next year + \expandafter\pgfutil@firstofone + \else + \expandafter\pgfutil@gobble + \fi + {% + \begingroup + % check whether we're already in week 1 of the next year + #3=#2\relax + \advance#3 by 1 + \expandafter\pgfcalendar@week@setup\expandafter{\the#3}% + \ifnum#1<\expandafter\expandafter\expandafter\pgfutil@firstoftwo\csname pgfcalendar@week@\the#3\endcsname\relax + #3=53 + \else + #3=1 + \fi + \expandafter + \endgroup\expandafter#3\the#3\relax + }% + }% + }% + \expandafter + \endgroup\expandafter + #3\the#3\relax +} + +% +% shorthands for weeks (n) +% +% n-: shortest +% n=: shortest but prepends whitespace +% n0: leading zero +% +\expandafter\def\csname pgfcalendar@shorthand@n-\endcsname{% + \if0\pgfcalendarcurrentweek\else\pgfcalendarcurrentweek\fi} +\expandafter\def\csname pgfcalendar@shorthand@n=\endcsname{% + {\pgfutil@tempcnta=\pgfcalendarcurrentweek\relax\ifnum\pgfutil@tempcnta<10\relax\setbox0=\hbox{1}\kern\wd0\relax\fi\the\pgfutil@tempcnta}} +\expandafter\def\csname pgfcalendar@shorthand@n0\endcsname{% + \pgfcalendarcurrentweek} + +% +% Overwriting original \pgfcalendar +% +\long\def\pgfcalendar#1#2#3#4{% + \begingroup% + % Setup local \ifdate + \let\ifdate=\pgfcalendar@local@ifdate% + % Let's start with computing start and end dates... + \def\pgfcalendarprefix{#1}% + \pgfcalendardatetojulian{#2}{\pgfcalendarcurrentjulian}% + \edef\pgfcalendarbeginjulian{\the\pgfcalendarcurrentjulian}% + \edef\pgfcalendarbeginiso{#2}% + \pgfcalendardatetojulian{#3}{\pgfutil@tempcnta}% + \edef\pgfcalendarendjulian{\the\pgfutil@tempcnta}% + \advance\pgfutil@tempcnta by1\relax% + \edef\pgfcalendarendjulianplus{\the\pgfutil@tempcnta}% + \edef\pgfcalendarendiso{#3}% + % + % Start main loop + % + \loop% + \ifnum\pgfcalendarcurrentjulian<\pgfcalendarendjulianplus\relax% + % Setup information about current date + \pgfcalendarjuliantodate{\pgfcalendarcurrentjulian}% + {\pgfcalendarcurrentyear}{\pgfcalendarcurrentmonth}{\pgfcalendarcurrentday}% + \pgfcalendarjuliantoweekday{\pgfcalendarcurrentjulian}{\pgfutil@tempcntb}% + \edef\pgfcalendarcurrentweekday{\the\pgfutil@tempcntb}% + \pgfcalendarjulianyeartoweek{\pgfcalendarcurrentjulian}{\pgfcalendarcurrentyear}{\pgfutil@tempcntb}% + \edef\pgfcalendarcurrentweek{\ifnum\pgfutil@tempcntb<10 0\fi\the\pgfutil@tempcntb}% + % Render: + #4% + % Advance day: + \advance\pgfcalendarcurrentjulian by1\relax% + \repeat% + \endgroup% +} + +% +% Overwriting original \pgfcalendar@local@ifdate +% +\def\pgfcalendar@local@ifdate{% + \let\pgfcalendarifdatejulian=\pgfcalendarcurrentjulian + \let\pgfcalendarifdateyear=\pgfcalendarcurrentyear + \let\pgfcalendarifdatemonth=\pgfcalendarcurrentmonth + \let\pgfcalendarifdateday=\pgfcalendarcurrentday + \let\pgfcalendarifdateweekday=\pgfcalendarcurrentweekday + \let\pgfcalendarifdateweek=\pgfcalendarcurrentweek + \pgfcalendar@launch@ifdate% +} + +\pgfqkeys{/pgf/calendar/week}{.value required,.code=\ifnum#1=\pgfcalendarifdateweek\relax\expandafter\pgfcalendarmatchestrue\fi} + +% Overwriting shorthands of pgfcalendar +\expandafter\def\csname pgfcalendar@shorthand@d-\endcsname{% + \if0\pgfcalendarcurrentday\else\pgfcalendarcurrentday\fi} +\expandafter\def\csname pgfcalendar@shorthand@m-\endcsname{% + \if0\pgfcalendarcurrentmonth\else\pgfcalendarcurrentmonth\fi} + +\endinput \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/pgfcalendar-ext.sty b/graphics/pgf/contrib/tikz-ext/pgfcalendar-ext.sty new file mode 100644 index 0000000000..a0f5ef3bc0 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/pgfcalendar-ext.sty @@ -0,0 +1,11 @@ +% 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. +% + +\RequirePackage{pgfcalendar} +\input{pgfcalendar-ext.code.tex} +\endinput diff --git a/graphics/pgf/contrib/tikz-ext/pgfcalendar-ext.tex b/graphics/pgf/contrib/tikz-ext/pgfcalendar-ext.tex new file mode 100644 index 0000000000..30c44187a4 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/pgfcalendar-ext.tex @@ -0,0 +1,13 @@ +% 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. +% + +\input pgfcalendar.text +\catcode`\@=11 +\input pgfcalendar-ext.code.tex +\catcode`\@=\pgfcalendaratcode +\endinput diff --git a/graphics/pgf/contrib/tikz-ext/pgflibraryext.transformations.mirror.code.tex b/graphics/pgf/contrib/tikz-ext/pgflibraryext.transformations.mirror.code.tex new file mode 100644 index 0000000000..4d962ccb1c --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/pgflibraryext.transformations.mirror.code.tex @@ -0,0 +1,96 @@ +% 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. +% +\def\pgftransformxmirror#1{ + \pgfmathparse{#1}% + \ifpgfmathunitsdeclared + \pgf@xa\pgfmathresult pt\relax + \multiply\pgf@xa2 + \pgftransformcm{-1}{0}{0}{1}{\pgfqpoint{\pgf@xa}{0pt}}% + \else + \pgftransformmirror{\pgfqpointxy{\pgfmathresult}{0}}{\pgfpointadd{\pgfqpointxy{\pgfmathresult}{0}}{\pgfqpointxy{0}{1}}}% + \fi +} +\def\pgftransformymirror#1{ + \pgfmathparse{#1}% + \ifpgfmathunitsdeclared + \pgf@ya\pgfmathresult pt\relax + \multiply\pgf@ya2 + \pgftransformcm{1}{0}{0}{-1}{\pgfqpoint{0pt}{\pgf@ya}}% + \else + \edef\pgf@marshal{\noexpand\pgftransformmirror{\noexpand\pgfqpointxy{0}{\pgfmathresult}}% + {\noexpand\pgfpointadd{\noexpand\pgfqpointxy{0}{\pgfmathresult}}{\noexpand\pgfqpointxy{1}{0}}}}% + \pgf@marshal + \fi} +\def\pgftransformmirror#1#2{% + \pgfextract@process\pgf@tempa{#1}% + \pgfpointnormalised{\pgfpointdiff{\pgf@tempa}{#2}}% + \pgf@xa=\pgf@sys@tonumber\pgf@y\pgf@x + \pgf@xb=\pgf@sys@tonumber\pgf@x\pgf@x + \pgf@yb=\pgf@sys@tonumber\pgf@y\pgf@y + \multiply\pgf@xa2 + \pgf@xc=-\pgf@yb\advance\pgf@xc\pgf@xb + \pgf@yc=-\pgf@xb\advance\pgf@yc\pgf@yb + \edef\pgf@temp{{\the\pgf@xc}{+\the\pgf@xa}{+\the\pgf@xa}{+\the\pgf@yc}}% + \expandafter\pgf@transformcm\pgf@temp{\pgf@tempa}% + \pgftransformshift{\pgfpointscale{-1}{\pgf@tempa}}% +} + +\def\pgfqtransformmirror#1{% + \pgfpointnormalised{#1}% + \pgf@xa=\pgf@sys@tonumber\pgf@y\pgf@x + \pgf@xb=\pgf@sys@tonumber\pgf@x\pgf@x + \pgf@yb=\pgf@sys@tonumber\pgf@y\pgf@y + \multiply\pgf@xa2 + \pgf@xc=-\pgf@yb\advance\pgf@xc\pgf@xb + \pgf@yc=-\pgf@xb\advance\pgf@yc\pgf@yb + \edef\pgf@temp{{\the\pgf@xc}{+\the\pgf@xa}{+\the\pgf@xa}{+\the\pgf@yc}}% + \expandafter\pgf@transformcm\pgf@temp{\pgfpointorigin}% +} + +% Using existant transformation (shift, rotate, yscale=-1, rotate back, shift back) +\def\pgftransformxMirror#1{ + \pgfmathparse{#1}% + \ifpgfmathunitsdeclared + \pgf@xa\pgfmathresult pt\relax + \multiply\pgf@xa2 + \pgftransformcm{-1}{0}{0}{1}{\pgfqpoint{\pgf@xa}{0pt}}% + \else + \pgftransformMirror{\pgfqpointxy{\pgfmathresult}{0}}{\pgfpointadd{\pgfqpointxy{\pgfmathresult}{0}}{\pgfqpointxy{0}{1}}}% + \fi +} +\def\pgftransformyMirror#1{ + \pgfmathparse{#1}% + \ifpgfmathunitsdeclared + \pgf@ya\pgfmathresult pt\relax + \multiply\pgf@ya2 + \pgftransformcm{1}{0}{0}{-1}{\pgfqpoint{0pt}{\pgf@ya}}% + \else + \edef\pgf@marshal{\noexpand\pgftransformMirror{\noexpand\pgfqpointxy{0}{\pgfmathresult}}% + {\noexpand\pgfpointadd{\noexpand\pgfqpointxy{0}{\pgfmathresult}}{\noexpand\pgfqpointxy{1}{0}}}}% + \pgf@marshal + \fi} + +\def\pgftransformMirror#1#2{% + \pgfextract@process\pgf@tempa{#1}% + \pgfmathanglebetweenpoints{\pgf@tempa}{#2}% + \let\pgf@temp\pgfmathresult + \pgftransformshift{\pgf@tempa}% + \pgftransformrotate{\pgf@temp}% + \pgftransformyscale{-1}% + \pgftransformrotate{-\pgf@temp}% + \pgftransformshift{\pgfqpointscale{-1}{\pgf@tempa}}% +} + +\def\pgfqtransformMirror#1{% + \pgfmathanglebetweenpoints{\pgfpointorigin}{#1}% + \let\pgf@temp\pgfmathresult + \pgftransformrotate{\pgf@temp}% + \pgftransformyscale{-1}% + \pgftransformrotate{-\pgf@temp}% +} +\endinput \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/pgflibrarytransformations.mirror.code.tex b/graphics/pgf/contrib/tikz-ext/pgflibrarytransformations.mirror.code.tex deleted file mode 100644 index 4d962ccb1c..0000000000 --- a/graphics/pgf/contrib/tikz-ext/pgflibrarytransformations.mirror.code.tex +++ /dev/null @@ -1,96 +0,0 @@ -% 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. -% -\def\pgftransformxmirror#1{ - \pgfmathparse{#1}% - \ifpgfmathunitsdeclared - \pgf@xa\pgfmathresult pt\relax - \multiply\pgf@xa2 - \pgftransformcm{-1}{0}{0}{1}{\pgfqpoint{\pgf@xa}{0pt}}% - \else - \pgftransformmirror{\pgfqpointxy{\pgfmathresult}{0}}{\pgfpointadd{\pgfqpointxy{\pgfmathresult}{0}}{\pgfqpointxy{0}{1}}}% - \fi -} -\def\pgftransformymirror#1{ - \pgfmathparse{#1}% - \ifpgfmathunitsdeclared - \pgf@ya\pgfmathresult pt\relax - \multiply\pgf@ya2 - \pgftransformcm{1}{0}{0}{-1}{\pgfqpoint{0pt}{\pgf@ya}}% - \else - \edef\pgf@marshal{\noexpand\pgftransformmirror{\noexpand\pgfqpointxy{0}{\pgfmathresult}}% - {\noexpand\pgfpointadd{\noexpand\pgfqpointxy{0}{\pgfmathresult}}{\noexpand\pgfqpointxy{1}{0}}}}% - \pgf@marshal - \fi} -\def\pgftransformmirror#1#2{% - \pgfextract@process\pgf@tempa{#1}% - \pgfpointnormalised{\pgfpointdiff{\pgf@tempa}{#2}}% - \pgf@xa=\pgf@sys@tonumber\pgf@y\pgf@x - \pgf@xb=\pgf@sys@tonumber\pgf@x\pgf@x - \pgf@yb=\pgf@sys@tonumber\pgf@y\pgf@y - \multiply\pgf@xa2 - \pgf@xc=-\pgf@yb\advance\pgf@xc\pgf@xb - \pgf@yc=-\pgf@xb\advance\pgf@yc\pgf@yb - \edef\pgf@temp{{\the\pgf@xc}{+\the\pgf@xa}{+\the\pgf@xa}{+\the\pgf@yc}}% - \expandafter\pgf@transformcm\pgf@temp{\pgf@tempa}% - \pgftransformshift{\pgfpointscale{-1}{\pgf@tempa}}% -} - -\def\pgfqtransformmirror#1{% - \pgfpointnormalised{#1}% - \pgf@xa=\pgf@sys@tonumber\pgf@y\pgf@x - \pgf@xb=\pgf@sys@tonumber\pgf@x\pgf@x - \pgf@yb=\pgf@sys@tonumber\pgf@y\pgf@y - \multiply\pgf@xa2 - \pgf@xc=-\pgf@yb\advance\pgf@xc\pgf@xb - \pgf@yc=-\pgf@xb\advance\pgf@yc\pgf@yb - \edef\pgf@temp{{\the\pgf@xc}{+\the\pgf@xa}{+\the\pgf@xa}{+\the\pgf@yc}}% - \expandafter\pgf@transformcm\pgf@temp{\pgfpointorigin}% -} - -% Using existant transformation (shift, rotate, yscale=-1, rotate back, shift back) -\def\pgftransformxMirror#1{ - \pgfmathparse{#1}% - \ifpgfmathunitsdeclared - \pgf@xa\pgfmathresult pt\relax - \multiply\pgf@xa2 - \pgftransformcm{-1}{0}{0}{1}{\pgfqpoint{\pgf@xa}{0pt}}% - \else - \pgftransformMirror{\pgfqpointxy{\pgfmathresult}{0}}{\pgfpointadd{\pgfqpointxy{\pgfmathresult}{0}}{\pgfqpointxy{0}{1}}}% - \fi -} -\def\pgftransformyMirror#1{ - \pgfmathparse{#1}% - \ifpgfmathunitsdeclared - \pgf@ya\pgfmathresult pt\relax - \multiply\pgf@ya2 - \pgftransformcm{1}{0}{0}{-1}{\pgfqpoint{0pt}{\pgf@ya}}% - \else - \edef\pgf@marshal{\noexpand\pgftransformMirror{\noexpand\pgfqpointxy{0}{\pgfmathresult}}% - {\noexpand\pgfpointadd{\noexpand\pgfqpointxy{0}{\pgfmathresult}}{\noexpand\pgfqpointxy{1}{0}}}}% - \pgf@marshal - \fi} - -\def\pgftransformMirror#1#2{% - \pgfextract@process\pgf@tempa{#1}% - \pgfmathanglebetweenpoints{\pgf@tempa}{#2}% - \let\pgf@temp\pgfmathresult - \pgftransformshift{\pgf@tempa}% - \pgftransformrotate{\pgf@temp}% - \pgftransformyscale{-1}% - \pgftransformrotate{-\pgf@temp}% - \pgftransformshift{\pgfqpointscale{-1}{\pgf@tempa}}% -} - -\def\pgfqtransformMirror#1{% - \pgfmathanglebetweenpoints{\pgfpointorigin}{#1}% - \let\pgf@temp\pgfmathresult - \pgftransformrotate{\pgf@temp}% - \pgftransformyscale{-1}% - \pgftransformrotate{-\pgf@temp}% -} -\endinput \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tikzlibraryext.calendar-plus.code.tex b/graphics/pgf/contrib/tikz-ext/tikzlibraryext.calendar-plus.code.tex new file mode 100644 index 0000000000..d1300ed290 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tikzlibraryext.calendar-plus.code.tex @@ -0,0 +1,93 @@ +% 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. +% + +\usetikzlibrary{calendar} +\pgfutil@usemodule{pgfcalendar-ext} + +% Shift between days + +\def\tikz@lib@cal@xshift{\pgfkeysvalueof{/tikz/day xshift}} +\def\tikz@lib@cal@yshift{\pgfkeysvalueof{/tikz/day yshift}} +\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}} +\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}} +\tikzset{tikz@lib@cal@width/.initial=1} + +% Weeks + +\def\tikzweekcode{\pgfkeysvalueof{/tikz/week code}} +\def\tikzweektext{\pgfkeysvalueof{/tikz/week text}} + +\tikzset{ + week code/.initial={% + \node[every week]{\pgfkeysvalueof{/tikz/week text}};}, + week text/.initial={\%n=}, + every week/.style=, + week label left/.style={ + every week/.append style={ + anchor=base east, + xshift=-1.25*\pgfkeysvalueof{/tikz/day xshift}}, + execute before day scope=% + \ifdate{Monday, equals=\pgfcalendarbeginiso}{\tikzweekcode}{}}} + +% +% Overwriting original \tikz@lib@cal@if@else@code +% +\def\tikz@lib@cal@if@else@code#1#2#3{% + \tikzcalendar@addto\tikz@lib@cal@ifs{\ifdate{#1}{#2}{#3}}% + \tikz@lib@cal@scanner% +} + +% +% Overwriting original \tikz@lib@cal@stop +% +\def\tikz@lib@cal@stop{% + \pgftransformshift{\tikz@node@at}% + \expandafter\pgfcalendar\expandafter{\tikz@fig@name}{\tikz@lib@cal@start}{\tikz@lib@cal@end}% + {% + \tikz@before@day% + \scope% + \tikz@atbegin@day% + \let\tikzcalendar@addto\pgfutil@secondoftwo + \tikz@lib@cal@ifs% + \tikzdaycode% + \tikz@atend@day% + \endscope% + \tikz@after@day% + }% + \endgroup% +} + +\def\tikzcalendar@addto#1#2{\expandafter\def\expandafter#1\expandafter{#1#2}} + +\pgfmathdeclarefunction{weeksinmonthofyear}{3}{% #1 = first weekday, #2 = month, #3 = year + \begingroup + \pgfmathlastdayinmonthofyear@{#2}{#3}% + \pgfmathadd@{#1}{\pgfmathresult}% + \pgfmathdivide@{\pgfmathresult}{7}% + \pgfmathceil@{\pgfmathresult}% + \pgfmathint@{\pgfmathresult}% + \pgfmathsmuggle\pgfmathresult + \endgroup +} +\pgfmathdeclarefunction{lastdayinmonthofyear}{2}{% #1 = month, #2 = year + \begingroup + \pgfcalendar@getlastYMX{#2}{#1}{\pgfutil@tempcnta}% + \edef\pgfmathresult{\the\pgfutil@tempcnta}% + \pgfmathsmuggle\pgfmathresult + \endgroup +} \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tikzlibraryext.misc.code.tex b/graphics/pgf/contrib/tikz-ext/tikzlibraryext.misc.code.tex new file mode 100644 index 0000000000..b68520081c --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tikzlibraryext.misc.code.tex @@ -0,0 +1,251 @@ +% 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. +% +%% full arc +%% https://tex.stackexchange.com/a/144297/16595 +%% The postfix operator R is added to PGFmath, +%% it allows the use of angular segments. +%% full arc = 10 makes it so that +%% 1R = 36° +%% 2R = 72° +%% … +%% 10R = 360° +%% Calling the full arc key with an empty value +%% makes 1R = 1° +\pgfset{full arc/.code=% + \def\pgf@temp{#1}% + \ifx\pgfutil@empty\pgf@temp + \let\pgfmath@fullarc@factor\pgfutil@empty + \else + \pgfmathsetmacro\pgfmath@fullarc@factor{360/(#1)}% + \fi,full arc=} +\pgfmathdeclareoperator{R}{full arc}{1}{postfix}{950} +\pgfmathdeclarefunction{full arc}{1}{% + \begingroup + \pgfmath@x=#1pt\relax + \ifx\pgfmath@fullarc@factor\pgfutil@empty\else + \pgfmath@x\pgfmath@fullarc@factor\pgfmath@x + \fi + \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\ifqrr@pgf@foreach@no@list +\pgfqkeys{/pgf/foreach}{ + use int/.code={% + \qrr@pgf@foreach@no@list@parse@to\pgfmathtruncatemacro#1\pgffor@stop + }, + use float/.code={% + \qrr@pgf@foreach@no@list@parse@to\pgfmathsetmacro#1\pgffor@stop + } +} + +\def\qrr@pgf@foreach@no@list@parse@to#1#2to#3\pgffor@stop{% + \qrr@pgf@foreach@no@listtrue + #1\foreachStart{#2}% + \pgfutil@in@{step}{#3} + \ifpgfutil@in@ + \qrr@pgf@foreach@no@list@parse@step{#1}#3\pgffor@stop + \else + \qrr@pgf@foreach@no@list@parse@step{#1}#3step1\pgffor@stop + \fi + \edef\qrr@pgf@foreach@no@list@list{\foreachStart,\foreachSecond,...,\foreachEnd}% +} +\def\qrr@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}{% + \ifqrr@pgf@foreach@no@list\expandafter\pgfutil@firstoftwo\else + \expandafter\pgfutil@secondoftwo\fi + {\qrr@pgf@foreach@no@listfalse\pgffor@macro@list\qrr@pgf@foreach@no@list@list} + {\pgffor@@vars}}}}}% + +%% Handlers +%% .pgfmath evaluates values given to keys in PGFmath before handing them over. +%% .pgfmath int truncates the result +%% .pgfmath strcat concatenates the given values +\pgfkeys{/handlers/.pgfmath/.code=\pgfmathparse{#1}\expandafter\pgfkeys@exp@call\expandafter{\pgfmathresult}} +\pgfkeys{/handlers/.pgfmath int/.code=\pgfmathint{#1}\expandafter\pgfkeys@exp@call\expandafter{\pgfmathresult}} +\pgfkeys{/handlers/.pgfmath strcat/.code=\pgfmathstrcat{#1}\expandafter\pgfkeys@exp@call\expandafter{\pgfmathresult}} + +%% 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) +\pgfkeys{/handlers/.List/.code={% + \let\pgfkeys@global@temp\pgfutil@empty + \foreach \pgfkeys@temp in{#1}{ + \ifx\pgfkeys@global@temp\pgfutil@empty + \global\let\pgfkeys@global@temp\pgfkeys@temp + \else + \expandafter\pgfutil@g@addto@macro\expandafter\pgfkeys@global@temp\expandafter + {\pgfkeys@temp}% + \fi}% + \expandafter\pgfkeys@exp@call\expandafter{\pgfkeys@global@temp}}} + +%% PGFmath +%% strrepeat("x", 5) = "xxxxx" +\pgfmathdeclarefunction{strrepeat}{2}{% + \begingroup\pgfmathint{#2}\pgfmath@count\pgfmathresult + \let\pgfmathresult\pgfutil@empty + \pgfutil@loop\ifnum\pgfmath@count>0\relax + \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult#1}% + \advance\pgfmath@count-1\relax + \pgfutil@repeat\pgfmath@smuggleone\pgfmathresult\endgroup} + +%% isInString("foo", "foobar") = true (= 1) +%% isInString("boo", "foobar") = false (= 0) +\pgfmathdeclarefunction{isInString}{2}{% + \pgfutil@in@{#1}{#2}% + \ifpgfutil@in@\def\pgfmathresult{1}\else\def\pgfmathresult{0}\fi} + +%% strcat("foo", "bar") = "foobar" (can have more than two parameters) +\pgfutil@IfUndefined{pgfmathstrcat@}{ + \pgfmathdeclarefunction{strcat}{...}{% + \begingroup + \let\pgfmathresult\pgfutil@empty + \pgfmathstrcat@@#1\pgfmath@stop} + \def\pgfmathstrcat@@#1{% + \ifx\pgfmath@stop#1% + \def\pgfmath@next{\pgfmath@smuggleone\pgfmathresult\endgroup} + \else + \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult#1}% + \let\pgfmath@next\pgfmathstrcat@@ + \fi + \pgfmath@next} +}{} + +% http://tex.stackexchange.com/questions/244569/bounding-lines-around-tax-nodes/244619#244619 +\pgfmathdeclarefunction{atanXY}{2}{\pgfmathatantwo@{#2}{#1}} +\pgfmathdeclarefunction{atanYX}{2}{\pgfmathatantwo@{#1}{#2}} + +%% http://tex.stackexchange.com/a/132939/16595 +\tikzset{ + @edges through/.code={{{% three braces to protect \pgfeov + \pgfutil@ifnextchar[{\pgfkeysvalueof{/tikz/@@edges through/.@cmd}} + {\pgfkeysvalueof{/tikz/@@edges through/.@cmd}[]}#1\pgfeov}}}, + @@edges through/.style args={[#1]#2}{/tikz/insert path={edge[#1] (#2) (#2)}}, + edges through/.style={/tikz/@edges through/.list={#1}}} +\tikzset{ + @edges to/.code={{{% three braces to protect \pgfeov + \pgfutil@ifnextchar[{\pgfkeysvalueof{/tikz/@@edges to/.@cmd}} + {\pgfkeysvalueof{/tikz/@@edges to/.@cmd}[]}#1\pgfeov}}}, + @@edges to/.style args={[#1]#2}{/tikz/insert path={edge[#1] (#2)}}, + edges to/.style={/tikz/@edges to/.list={#1}}} +\tikzset{ + @tos to/.code={{{% three braces to protect \pgfeov + \pgfutil@ifnextchar[{\pgfkeysvalueof{/tikz/@@tos to/.@cmd}} + {\pgfkeysvalueof{/tikz/@@tos to/.@cmd}[]}#1\pgfeov}}}, + @@tos to/.style args={[#1]#2}{/tikz/insert path={to[#1] (#2)}}, + tos to/.style={/tikz/@tos to/.list={#1}}} + + +\pgfmathdeclarefunction{distancebetween}{2}{% only coordinates/nodes + \begingroup + \pgfpointdiff{\pgfpointanchor{#1}{center}}{\pgfpointanchor{#2}{center}}% + \edef\pgfmath@temp{{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}}% + \expandafter\pgfmathveclen@\pgfmath@temp + \pgfmath@smuggleone\pgfmathresult + \endgroup} +\pgfmathdeclarefunction{qdistancebetween}{1}{% only coordinates/nodes + \begingroup + \pgfpointdiff{\pgfpointorigin}{\pgfpointanchor{#1}{center}}% + \edef\pgfmath@temp{{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}}% + \expandafter\pgfmathveclen@\pgfmath@temp + \pgfmath@smuggleone\pgfmathresult + \endgroup} + +\pgfmathdeclarefunction{qanglebetween}{1}{% + \pgfmathanglebetweenpoints{\pgfpointorigin}{\pgfpointanchor{#1}{center}}} + +\pgfmathdeclarefunction{anglebetween}{2}{% + \pgfmathanglebetweenpoints{\pgfpointanchor{#1}{center}}{\pgfpointanchor{#2}{center}}} + +\pgfmathdeclarefunction{isEmpty}{1}{% + \begingroup + \edef\pgfmath@temp{#1}% + \pgfutil@ifxempty\pgfmath@temp{\def\pgfmathresult{1}}{\def\pgfmathresult{0}}% + \pgfmath@smuggleone\pgfmathresult + \endgroup} + +\pgfqkeys{/utils}{ + if/.code n args=3{% + \pgfmathparse{#1}% + \ifdim\pgfmathresult pt=0pt + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi + {\pgfkeysalso{#3}}% + {\pgfkeysalso{#2}}}, + IF/.code args={(#1)#2}{% + \pgfmathparse{#1}% + \pgfutil@in@{else}{#2}% + \ifpgfutil@in@ + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi + {\qrr@misc@handle@else#2\pgf@stop}{\qrr@misc@handle@else#2else\pgf@stop}% + }, + TeX/if/.code n args={4}{% + \if#1#2\expandafter\pgfutil@firstoftwo\else\expandafter\pgfutil@secondoftwo\fi + {\pgfkeysalso{#3}}{\pgfkeysalso{#4}}% + }, + TeX/ifnum/.code n args={3}{% + \ifnum#1\relax\expandafter\pgfutil@firstoftwo\else\expandafter\pgfutil@secondoftwo\fi + {\pgfkeysalso{#2}}{\pgfkeysalso{#3}}% + }, + TeX/ifdim/.code n args={3}{% + \ifdim#1\relax\expandafter\pgfutil@firstoftwo\else\expandafter\pgfutil@secondoftwo\fi + {\pgfkeysalso{#2}}{\pgfkeysalso{#3}}% + }, + TeX/ifx/.code n args={4}{% + \ifx#1#2\relax\expandafter\pgfutil@firstoftwo\else\expandafter\pgfutil@secondoftwo\fi + {\pgfkeysalso{#3}}{\pgfkeysalso{#4}}% + }, + TeX/ifempty/.code n args={3}{% + \edef\pgfkeys@temp{#1}% + \pgfutil@ifxempty\pgfkeys@temp{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}% + }, + tex/.search also=/utils/TeX, +} +\def\qrr@misc@handle@else#1else#2\pgf@stop{% + \ifdim\pgfmathresult pt=0pt + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi + {\pgfkeysalso{#2}}% + {\pgfkeysalso{#1}}} + +\pgfset{ + declare constant/.code={% + \let\pgfmathdeclareconstant@@@\pgfutil@empty + \pgfkeysvalueof{/pgf/declare function/execute at begin function}% + \pgfmathdeclareconstant@#1@=@;\pgf@stop + \pgfkeysvalueof{/pgf/declare function/execute at end function}% + \pgfmathdeclareconstant@@@ + }} +\def\pgfmathdeclareconstant@{% + \pgfutil@ifnextchar x\pgfmathdeclareconstant@@\pgfmathdeclareconstant@@ +} +\def\pgfmathdeclareconstant@@#1=#2;#3\pgf@stop{% + \edef\pgfmath@local@temp{#1}% + \pgfutil@ifx\pgfmath@local@temp\pgfmath@local@at{}{% + \pgfutil@g@addto@macro\pgfmathdeclareconstant@@@{\pgfmathdeclarepseudoconstant{#1}{\def\pgfmathresult{#2}}}% + \pgfmathdeclareconstant@#3\pgf@stop + }% +} \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tikzlibraryext.node-families.code.tex b/graphics/pgf/contrib/tikz-ext/tikzlibraryext.node-families.code.tex new file mode 100644 index 0000000000..9cee62be90 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tikzlibraryext.node-families.code.tex @@ -0,0 +1,305 @@ +% 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. +% + +\def\tikz@nf@align@left#1{} +\def\tikz@nf@align@center#1{\kern.5#1} +\def\tikz@nf@align@right#1{\kern#1} + +\pgfqkeys{/tikz/node family}{ + width/.initial=, + height/.initial=, + size/.style=\pgfqkeys{/tikz/node family}{width={#1},height={#1}}, + text depth/.initial=, + text height/.initial=, + text width align/.is choice, + text width align/left/.code=\let\tikz@nf@align@action\tikz@nf@align@left, + text width align/center/.code=\let\tikz@nf@align@action\tikz@nf@align@center, + text width align/right/.code=\let\tikz@nf@align@action\tikz@nf@align@right, + text width align=center, + text width/.initial=, + text/.code=\pgfqkeys{/tikz/node family}{text depth={#1},text height={#1},text width={#1}}, + prefix/.initial=\pgfpictureid-, +} +\tikzset{node family/.code=\pgfqkeys{/tikz/node family}{#1}} + +% #1 = family type + name +\def\tikz@nf@save#1{% + %\errmessage{#1}% + \immediate\write\pgfutil@auxout{% + \noexpand\expandafter\noexpand\gdef\noexpand\csname tikz@nf@#1@previous\endcsname + {\csname tikz@nf@#1@next\endcsname}% + }% + %\expandafter\global\expandafter\let\csname tikz@nf@#1@next\endcsname\relax +} + +% #1 = value to set +% #2 = family type +% #3 = return dimen +\def\tikz@nf@getandset#1#2#3{% + % what's our family's name? + #3=0pt\relax + \pgfkeysgetvalue{/tikz/node family/#2}\tikz@nf@familyname + \pgfutil@ifxempty\tikz@nf@familyname{% no family to deal with + }{% + \edef\tikz@nf@familyname{\pgfkeysvalueof{/tikz/node family/prefix}\tikz@nf@familyname}% + % we need to save the value for the next run + \pgfutil@IfUndefined{tikz@nf@#2@\tikz@nf@familyname @next}{% + % first time: define first value and install hook at end of picture + \expandafter\xdef\csname tikz@nf@#2@\tikz@nf@familyname @next\endcsname{#1}% + \edef\tikz@temp{\noexpand\tikz@nf@save{#2@\tikz@nf@familyname}}% + %\expandafter\AtVeryEndDocument\expandafter{\tikz@temp}% + \expandafter\pgfutil@g@addto@macro\expandafter\tikz@atend@picture\expandafter{\tikz@temp}% + }{% + \ifdim\csname tikz@nf@#2@\tikz@nf@familyname @next\endcsname<#1\relax + \expandafter\xdef\csname tikz@nf@#2@\tikz@nf@familyname @next\endcsname{#1}% + \fi + }% + \pgfutil@IfUndefined{tikz@nf@#2@\tikz@nf@familyname @previous}{% first run, ignore + }{% set previous value + #3=\csname tikz@nf@#2@\tikz@nf@familyname @previous\endcsname\relax + }% + }% +} + +\pgfdeclareshape{Rectangle}{% + \savedanchor\northeast{% + % Calculate x + % + % First, is width < minimum width? + \pgf@x=\the\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/inner xsep}}% + \advance\pgf@x by 2\pgf@xc% + % Qrr: family width + \tikz@nf@getandset{\the\pgf@x}{width}{\pgfutil@tempdima}% + \ifdim\pgf@x<\pgfutil@tempdima + \pgf@x=\pgfutil@tempdima + \fi + % + \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}% + \ifdim\pgf@x<\pgf@xb% + % yes, too small. Enlarge... + \pgf@x=\pgf@xb% + \fi% + % Now, calculate right border: .5\wd\pgfnodeparttextbox + .5 \pgf@x + outer sep + \pgf@x=.5\pgf@x% + \advance\pgf@x by.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}% + \advance\pgf@x by\pgf@xa% + % Calculate y + % + % First, is height+depth < minimum height? + \pgf@y=\ht\pgfnodeparttextbox% + \advance\pgf@y by\dp\pgfnodeparttextbox% + \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/inner ysep}}% + \advance\pgf@y by 2\pgf@yc% + % Qrr: family height + \tikz@nf@getandset{\the\pgf@y}{height}{\pgfutil@tempdima}% + \ifdim\pgf@y<\pgfutil@tempdima + \pgf@y=\pgfutil@tempa + \fi + % + \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}% + \ifdim\pgf@y<\pgf@yb% + % yes, too small. Enlarge... + \pgf@y=\pgf@yb% + \fi% + % Now, calculate upper border: .5\ht-.5\dp + .5 \pgf@y + outer sep + \pgf@y=.5\pgf@y% + \advance\pgf@y by-.5\dp\pgfnodeparttextbox% + \advance\pgf@y by.5\ht\pgfnodeparttextbox% + \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}% + \advance\pgf@y by\pgf@ya% + }% + +\savedanchor\southwest{% + % Calculate x + % + % First, is width < minimum width? + \pgf@x=\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/inner xsep}}% + \advance\pgf@x by 2\pgf@xc% + % Qrr: family width + \tikz@nf@getandset{\the\pgf@x}{width}{\pgfutil@tempdima}% + \ifdim\pgf@x<\pgfutil@tempdima + \pgf@x=\pgfutil@tempdima + \fi + % + \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}% + \ifdim\pgf@x<\pgf@xb% + % yes, too small. Enlarge... + \pgf@x=\pgf@xb% + \fi% + % Now, calculate left border: .5\wd\pgfnodeparttextbox - .5 \pgf@x - outer sep + \pgf@x=-.5\pgf@x% + \advance\pgf@x by.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}% + \advance\pgf@x by-\pgf@xa% + % Calculate y + % + % First, is height+depth < minimum height? + \pgf@y=\ht\pgfnodeparttextbox% + \advance\pgf@y by\dp\pgfnodeparttextbox% + \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/inner ysep}}% + \advance\pgf@y by 2\pgf@yc% + % Qrr: family height + \tikz@nf@getandset{\the\pgf@y}{height}{\pgfutil@tempdima}% + \ifdim\pgf@y<\pgfutil@tempdima + \pgf@y=\pgfutil@tempdima + \fi + % + \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}% + \ifdim\pgf@y<\pgf@yb% + % yes, too small. Enlarge... + \pgf@y=\pgf@yb% + \fi% + % Now, calculate upper border: .5\ht-.5\dp - .5 \pgf@y - outer sep + \pgf@y=-.5\pgf@y% + \advance\pgf@y by-.5\dp\pgfnodeparttextbox% + \advance\pgf@y by.5\ht\pgfnodeparttextbox% + \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}% + \advance\pgf@y by-\pgf@ya% + }% + \inheritbackgroundpath[from=rectangle] + \inheritbeforebackgroundpath[from=rectangle] + \inheritbehindforegroundpath[from=rectangle] + \inheritforegroundpath[from=rectangle] + \inheritbeforeforegroundpath[from=rectangle] + \inheritanchor[from=rectangle]{center} + \inheritanchor[from=rectangle]{mid} + \inheritanchor[from=rectangle]{base} + \inheritanchor[from=rectangle]{north} + \inheritanchor[from=rectangle]{south} + \inheritanchor[from=rectangle]{west} + \inheritanchor[from=rectangle]{mid west} + \inheritanchor[from=rectangle]{base west} + \inheritanchor[from=rectangle]{north west} + \inheritanchor[from=rectangle]{south west} + \inheritanchor[from=rectangle]{east} + \inheritanchor[from=rectangle]{mid east} + \inheritanchor[from=rectangle]{base east} + \inheritanchor[from=rectangle]{north east} + \inheritanchor[from=rectangle]{south east} + \inheritanchorborder[from=rectangle] +} + +\pgfdeclareshape{Circle}{% + \savedanchor\centerpoint{% tex/generic/pgf/modules/pgfmoduleshapes.code.tex + \pgf@x=.5\wd\pgfnodeparttextbox + \pgf@y=.5\ht\pgfnodeparttextbox + \advance\pgf@y by-.5\dp\pgfnodeparttextbox + }% + \saveddimen\radius{% tex/generic/pgf/modules/pgfmoduleshapes.code.tex + % Calculate ``height radius'' + \pgf@ya=.5\ht\pgfnodeparttextbox + \advance\pgf@ya by.5\dp\pgfnodeparttextbox + \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/inner ysep}}% + \advance\pgf@ya by\pgf@yb + % Calculate ``width radius'' + \pgf@xa=.5\wd\pgfnodeparttextbox + \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/inner xsep}}% + \advance\pgf@xa by\pgf@xb + % Calculate length of radius vector: + \pgf@process{\pgfpointnormalised{\pgfqpoint{\pgf@xa}{\pgf@ya}}}% + \ifdim\pgf@x>\pgf@y + \c@pgf@counta=\pgf@x + \ifnum\c@pgf@counta=0\relax + \else + \divide\c@pgf@counta by 255\relax + \pgf@xa=16\pgf@xa\relax + \divide\pgf@xa by\c@pgf@counta + \pgf@xa=16\pgf@xa\relax + \fi + \else + \c@pgf@counta=\pgf@y + \ifnum\c@pgf@counta=0\relax + \else + \divide\c@pgf@counta by 255\relax + \pgf@ya=16\pgf@ya\relax + \divide\pgf@ya by\c@pgf@counta + \pgf@xa=16\pgf@ya\relax + \fi + \fi + \pgf@x=\pgf@xa% + % Qrr: check for families + \tikz@nf@getandset{\the\dimexpr2\pgf@x\relax}{width}{\pgfutil@tempdima}% + \tikz@nf@getandset{\the\dimexpr2\pgf@x\relax}{height}{\pgfutil@tempdimb}% + % Qrr: and adjust like minimum width and minimum height + \ifdim\pgf@x<.5\pgfutil@tempdima + \pgf@x=.5\pgfutil@tempdima + \fi + \ifdim\pgf@x<.5\pgfutil@tempdimb + \pgf@x=.5\pgfutil@tempdimb + \fi + % If necessary, adjust radius so that the size requirements are met: + \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/minimum width}}% + \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/minimum height}}% + \ifdim\pgf@x<.5\pgf@xb + \pgf@x=.5\pgf@xb + \fi + \ifdim\pgf@x<.5\pgf@yb + \pgf@x=.5\pgf@yb + \fi + % Now, add larger of outer separations. + \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}% + \ifdim\pgf@xb<\pgf@yb + \advance\pgf@x by\pgf@yb + \else + \advance\pgf@x by\pgf@xb + \fi + }% + \inheritbackgroundpath[from=circle] + \inheritbeforebackgroundpath[from=circle] + \inheritbehindforegroundpath[from=circle] + \inheritforegroundpath[from=circle] + \inheritbeforeforegroundpath[from=circle] + \inheritanchor[from=circle]{center} + \inheritanchor[from=circle]{mid} + \inheritanchor[from=circle]{base} + \inheritanchor[from=circle]{north} + \inheritanchor[from=circle]{south} + \inheritanchor[from=circle]{west} + \inheritanchor[from=circle]{mid west} + \inheritanchor[from=circle]{base west} + \inheritanchor[from=circle]{north west} + \inheritanchor[from=circle]{south west} + \inheritanchor[from=circle]{east} + \inheritanchor[from=circle]{mid east} + \inheritanchor[from=circle]{base east} + \inheritanchor[from=circle]{north east} + \inheritanchor[from=circle]{south east} + \inheritanchorborder[from=circle] +} + +\def\pgfutil@prefixto@macro#1#2{% + \def\pgf@temp{#2}% + \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter#1% + \expandafter\expandafter\expandafter{\expandafter\pgf@temp#1}% +} + +\pgfqkeys{/tikz/node family}{ + setup shape/.code={% + \expandafter\pgfutil@prefixto@macro\csname pgf@sh@s@#1\endcsname{% + \tikz@nf@getandset{\the\wd\pgfnodeparttextbox}{text width}{\pgfutil@tempdima}% + \ifdim\wd\pgfnodeparttextbox<\pgfutil@tempdima + \pgfutil@tempdimb=\pgfutil@tempdima + \advance\pgfutil@tempdimb-\wd\pgfnodeparttextbox + \setbox\pgfnodeparttextbox=\hbox to \pgfutil@tempdima{\tikz@nf@align@action\pgfutil@tempdimb\box\pgfnodeparttextbox}% + \fi + \tikz@nf@getandset{\the\dp\pgfnodeparttextbox}{text depth}{\pgfutil@tempdima}% + \ifdim\dp\pgfnodeparttextbox<\pgfutil@tempdima + \dp\pgfnodeparttextbox=\pgfutil@tempdima + \fi + \tikz@nf@getandset{\the\ht\pgfnodeparttextbox}{text height}{\pgfutil@tempdima}% + \ifdim\ht\pgfnodeparttextbox<\pgfutil@tempdima + \ht\pgfnodeparttextbox=\pgfutil@tempdima + \fi + }% + }, + setup shape/.list={rectangle,circle,Rectangle,Circle} +} diff --git a/graphics/pgf/contrib/tikz-ext/tikzlibraryext.paths.arcto.code.tex b/graphics/pgf/contrib/tikz-ext/tikzlibraryext.paths.arcto.code.tex new file mode 100644 index 0000000000..213fc1b74a --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tikzlibraryext.paths.arcto.code.tex @@ -0,0 +1,104 @@ +% 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. +% +\tikzset{ + arc to/.code=\pgfqkeys{/tikz/arc to}{#1}, + arc to={ + counter clockwise/.code=\pgfkeyssetvalue{/tikz/arc to/ccw flag}{1}, + clockwise/.code=\pgfkeyssetvalue{/tikz/arc to/ccw flag}{0}, + x radius/.code=\pgfkeyssetvalue{/tikz/x radius}{#1}, + y radius/.code=\pgfkeyssetvalue{/tikz/y radius}{#1}, + radius/.code=\pgfkeyssetvalue{/tikz/x radius}{#1}\pgfkeyssetvalue{/tikz/y radius}{#1}, + large/.code=\pgfkeyssetvalue{/tikz/arc to/large flag}{1}, + small/.code=\pgfkeyssetvalue{/tikz/arc to/large flag}{0}, + % defaults + rotate/.initial=0, counter clockwise, small, + counter clockwise/.value forbidden, + clockwise/.value forbidden, + large/.value forbidden, + small/.value forbidden}} +\def\tikz@arcA rc{\pgfutil@ifnextchar t% + {\tikz@flush@moveto\expandafter\expandafter\expandafter\tikz@arcB@cont\expandafter\pgfutil@gobble\pgfutil@gobble} + {\tikz@flush@moveto\tikz@arc@cont}} +\def\tikz@arcB@cont{% + \pgfutil@ifnextchar[\tikz@@do@arcB{ + \advance\tikz@expandcount by -10\relax% go down quickly + \ifnum\tikz@expandcount<0\relax% + \def\@next{\tikz@@do@arcB[]}% + \else% + \def\@next{\expandafter\tikz@arcB@cont}% + \fi% + \@next}}% +\def\tikz@@do@arcB[#1]{% + \def\tikz@arcB@options{#1}% + \tikz@do@@arcB} +\def\tikz@do@@arcB{% + \pgfutil@ifnextchar n{\tikz@collect@label@onpath\tikz@do@@arcB} + {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@do@@arcB} + {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\tikz@do@@arcB} + {\tikz@scan@one@point\tikz@do@arcB}}}} + +\def\tikz@do@arcB#1{% + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}} + \tikz@make@last@position{#1}% + \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \iftikz@shapeborder + \edef\tikz@moveto@waiting{\tikz@shapeborder@name}% + \fi + \begingroup + \tikzset{every arc/.try,every arc to/.try,arc to/.expand once=\tikz@arcB@options}% + \pgfmathsetmacro\tikz@arc@x{\pgfkeysvalueof{/tikz/x radius}}% + \ifpgfmathunitsdeclared + \pgfmathsetmacro\tikz@arc@y{\pgfkeysvalueof{/tikz/y radius}}% + \ifpgfmathunitsdeclared + \pgfpatharcto{\tikz@arc@x pt}{\tikz@arc@y pt} + {\pgfkeysvalueof{/tikz/arc to/rotate}}{\pgfkeysvalueof{/tikz/arc to/large flag}} + {\pgfkeysvalueof{/tikz/arc to/ccw flag}}{#1}% + \else + \tikzerror{You cannot mix dimensions and dimension values in an arc}% + \fi + \else + \pgfmathsetmacro\tikz@arc@y{\pgfkeysvalueof{/tikz/y radius}}% + \ifpgfmathunitsdeclared + \tikzerror{You cannot mix dimensions and dimension values in an arc}% + \else + \pgf@process{\pgfpointxy{\tikz@arc@x}{0}}% + \pgfmathveclen@{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}% + \let\tikz@arc@x\pgfmathresult + \pgf@process{\pgfpointxy{0}{\tikz@arc@y}}% + \pgfmathveclen@{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}% + \let\tikz@arc@y\pgfmathresult + \pgfpatharcto{+\tikz@arc@x pt}{+\tikz@arc@y pt} + {\pgfkeysvalueof{/tikz/arc to/rotate}}{\pgfkeysvalueof{/tikz/arc to/large flag}} + {\pgfkeysvalueof{/tikz/arc to/ccw flag}}{#1}% + \fi + \fi + \endgroup + % check whether \pgf@marshall starts with \pgfpathlineto + \pgfutil@ifxempty\pgf@marshal{}{% + \edef\tikz@temp{\expandafter\expandafter\expandafter\noexpand\expandafter\pgfutil@firstgobblerest\pgf@marshal\relax}% + \expandafter\let\expandafter\tikz@temp\tikz@temp + \pgfutil@ifx\tikz@temp\pgfpathlineto{}{% + % getting rid of \pgfpatharcaxes inside \pgf@marshal + \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\pgf@marshal + \expandafter\expandafter\expandafter{\expandafter\pgfutil@gobble\pgf@marshal}% + % extracting the other four values needed for the timer + \edef\tikz@timer@start@angle{\expandafter\pgfutil@firstoffour\pgf@marshal}% + \edef\tikz@timer@end@angle{\expandafter\pgfutil@secondoffour\pgf@marshal}% + \pgfextract@process\tikz@timer@zero@axis{\expandafter\pgfutil@thirdoffour\pgf@marshal}% + \pgfextract@process\tikz@timer@ninety@axis{\expandafter\pgfutil@fourthoffour\pgf@marshal}% + % + \let\tikz@timer=\tikz@timer@arc + }% + }% + \tikz@scan@next@command +} +\def\pgfutil@firstoffour#1#2#3#4{#1} +\def\pgfutil@secondoffour#1#2#3#4{#2} +\def\pgfutil@thirdoffour#1#2#3#4{#3} +\def\pgfutil@fourthoffour#1#2#3#4{#4} +\def\pgfutil@firstgobblerest#1#2\relax{#1} \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tikzlibraryext.paths.ortho.code.tex b/graphics/pgf/contrib/tikz-ext/tikzlibraryext.paths.ortho.code.tex new file mode 100644 index 0000000000..a84fae7150 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tikzlibraryext.paths.ortho.code.tex @@ -0,0 +1,683 @@ +% 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. +% + +%% For the operators r-lr, r-rl, r-ud and r-du we need to check after TikZ found r +\let\tikz@orig@rect\tikz@rect +\def\tikz@rect{\pgfutil@ifnextchar e\tikz@orig@rect\qrr@tikz@r} +\def\qrr@tikz@r -{% + \pgfutil@ifnextchar l\qrr@tikz@lr@lineto{% + \pgfutil@ifnextchar r\qrr@tikz@rl@lineto{% + \pgfutil@ifnextchar u\qrr@tikz@ud@lineto{% + \pgfutil@ifnextchar d\qrr@tikz@du@lineto\tikz@expand + }% + }% + }% +} +%% For the operator |-| we need to check after TikZ found |- +\let\tikz@orig@vh@lineto@next\tikz@vh@lineto@next +\def\tikz@vh@lineto@next{% + \pgfutil@ifnextchar|{\expandafter\qrr@tikz@vhv@lineto\pgfutil@gobble}% + {\pgfutil@ifnextchar\tikz@activebar{\expandafter\qrr@tikz@vhv@lineto\pgfutil@gobble}% + {\tikz@orig@vh@lineto@next}}} +%% For the operator -|- we need to check after TikZ found -| +\let\tikz@orig@hv@lineto\tikz@hv@lineto +\def\tikz@hv@lineto{% + \pgfutil@ifnextchar-{\expandafter\qrr@tikz@hvh@lineto\pgfutil@gobble}% + {\tikz@orig@hv@lineto}} + +%% |-|[] and -|-[] are allowed +\def\qrr@tikz@vhv@lineto{\pgfutil@ifnextchar[{\qrr@tikz@collect@hvvh@options\qrr@tikz@vhv@lineto@next}{\qrr@tikz@collect@hvvh@options\qrr@tikz@vhv@lineto@next[]}} +\def\qrr@tikz@hvh@lineto{\pgfutil@ifnextchar[{\qrr@tikz@collect@hvvh@options\qrr@tikz@hvh@lineto@next}{\qrr@tikz@collect@hvvh@options\qrr@tikz@hvh@lineto@next[]}} + +%% r-rl[], r-lr[], etc. +\def\qrr@tikz@rl@lineto rl{\pgfutil@ifnextchar[{\qrr@tikz@collect@hvvh@options\qrr@tikz@rl@lineto@next}{\qrr@tikz@collect@hvvh@options\qrr@tikz@rl@lineto@next[]}} +\def\qrr@tikz@lr@lineto lr{\pgfutil@ifnextchar[{\qrr@tikz@collect@hvvh@options\qrr@tikz@lr@lineto@next}{\qrr@tikz@collect@hvvh@options\qrr@tikz@lr@lineto@next[]}} +\def\qrr@tikz@du@lineto du{\pgfutil@ifnextchar[{\qrr@tikz@collect@hvvh@options\qrr@tikz@du@lineto@next}{\qrr@tikz@collect@hvvh@options\qrr@tikz@du@lineto@next[]}} +\def\qrr@tikz@ud@lineto ud{\pgfutil@ifnextchar[{\qrr@tikz@collect@hvvh@options\qrr@tikz@ud@lineto@next}{\qrr@tikz@collect@hvvh@options\qrr@tikz@ud@lineto@next[]}} + +%% TikZ interjects are done, the rest is independent: + +\newlength\qrr@tikz@udlr@distance +\newlength\qrr@tikz@hvvh@distance +\newif\ifqrr@tikz@hvvh@middle % checks whether spacing = 0 was selected +\newif\ifqrr@tikz@hvvh@fromcenter +\newif\iftikz@ortho@preflush +\tikz@ortho@preflushtrue +\let\tikz@origtotarget\pgfutil@empty + +%%% HVVH/UDLR +\tikzset{% + hvvh/.code={\pgfqkeys{/tikz/hvvh}{#1}},% + udlr/.code={\pgfqkeys{/tikz/udlr}{#1}},% + hvvh/.search also=/tikz,% + udlr/.search also=/tikz,% + hvvh/middle 0 to 1/.style={hvvh/spacing=0},% + hvvh/from center/.is if=qrr@tikz@hvvh@fromcenter,% + udlr/from center/.style={/tikz/hvvh/from center={#1}}, + hvvh/spacing/.code=% spacing = 0 means that the middle part are the pos-itions 0 to 1, + % the first part is -1 to 0, the last part is to 2 + \pgfmathint{#1}\let\qrr@tikz@hvvh@timing@parts\pgfmathresult% in case they are calculations to be done + \ifcase\qrr@tikz@hvvh@timing@parts\relax + \qrr@tikz@hvvh@middletrue + \def\qrr@tikz@hvvh@timing@parts{1}% + \def\qrr@tikz@hvvh@timing@first{0}% + \def\qrr@tikz@hvvh@timing@last{1}% + \def\qrr@tikz@hvvh@timing@subtr{0}% + \def\qrr@tikz@hvvh@timing@factor{1}% + \else % in all other cases n > 0 the kinks are at pos = 1/n and (n - 1)/n + \qrr@tikz@hvvh@middlefalse + \pgfmathreciprocal{#1}\let\qrr@tikz@hvvh@timing@first\pgfmathresult + \pgfmathsetmacro\qrr@tikz@hvvh@timing@last{1-\pgfmathresult}% + \pgfmathreciprocal{#1-2}% + \let\qrr@tikz@hvvh@timing@subtr\pgfmathresult + \pgfmathsetmacro\qrr@tikz@hvvh@timing@factor{1+2*\pgfmathresult}% + \fi,% + hvvh/ratio/.code=\pgfmathsetmacro\qrr@tikz@hvvh@ratio{#1},% + % TODO: not possible to do distance in TikZ coordinate system + hvvh/distance/.code=\pgfmathsetlength\qrr@tikz@hvvh@distance{#1}\let\qrr@tikz@hvvh@ratio\pgfutil@empty,% + udlr/distance/.style={% + /tikz/udlr/ud distance={#1},% + /tikz/udlr/du distance={#1},% + /tikz/udlr/lr distance={#1},% + /tikz/udlr/rl distance={#1}},% + udlr/ud distance/.initial=+.5cm,% + udlr/du distance/.initial=+.5cm,% + udlr/lr distance/.initial=+.5cm,% + udlr/rl distance/.initial=+.5cm,% + hvvh/ratio=.5,% default value + hvvh/spacing=4,% default value +}% + +%BEGIN_FOLD Timer +\def\tikz@timer@hvhline{% + \pgf@process{\tikz@timer@start}\pgf@ya\pgf@y + \pgf@process{\tikz@timer@end}\pgf@yc\pgf@y + \pgf@process{\tikz@timer@middle}\pgf@xb\tikz@time pt% + \ifdim\tikz@time pt<\qrr@tikz@hvvh@timing@first pt% first quarter + \ifqrr@tikz@hvvh@middle + \advance\pgf@xb1pt% + \else + \pgf@xb\qrr@tikz@hvvh@timing@parts\pgf@xb + \fi + \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}{\noexpand\tikz@timer@start}{% + \noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@ya}}}% + \else + \ifdim\tikz@time pt>\qrr@tikz@hvvh@timing@last pt% last quarter + \ifqrr@tikz@hvvh@middle + \advance\pgf@xb-1pt% + \else + \pgf@xb\qrr@tikz@hvvh@timing@parts\pgf@xb + \fi + \advance\pgf@xb\dimexpr-\qrr@tikz@hvvh@timing@parts pt+1pt\relax% + \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}% + {\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@yc}}{\noexpand\tikz@timer@end}}% + \else% middle half + \pgf@xb\qrr@tikz@hvvh@timing@factor\pgf@xb% + \advance\pgf@xb-\qrr@tikz@hvvh@timing@subtr pt% + \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}% + {\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@ya}}{\noexpand\tikz@timer@middle}}% + \fi\fi\tikz@marshal} +\def\tikz@timer@vhvline{% + \pgf@process{\tikz@timer@start}\pgf@xa\pgf@x + \pgf@process{\tikz@timer@end}\pgf@xc\pgf@x + \pgf@process{\tikz@timer@middle}\pgf@xb\tikz@time pt% + \ifdim\tikz@time pt<\qrr@tikz@hvvh@timing@first pt% first quarter + \ifqrr@tikz@hvvh@middle + \advance\pgf@xb1pt% + \else + \pgf@xb\qrr@tikz@hvvh@timing@parts\pgf@xb + \fi + \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}{\noexpand\tikz@timer@start}{% + \noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@y}}}% + \else + \ifdim\tikz@time pt>\qrr@tikz@hvvh@timing@last pt% last quarter + \ifqrr@tikz@hvvh@middle + \advance\pgf@xb-1pt% + \else + \pgf@xb\qrr@tikz@hvvh@timing@parts\pgf@xb + \fi + \advance\pgf@xb by\dimexpr-\qrr@tikz@hvvh@timing@parts pt+1pt\relax% + \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}% + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@y}}{\noexpand\tikz@timer@end}}% + \else% middle half + \pgf@xb=\qrr@tikz@hvvh@timing@factor\pgf@xb + \advance\pgf@xb by-\qrr@tikz@hvvh@timing@subtr pt% + \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}% + {\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@y}}{\noexpand\tikz@timer@middle}}% + \fi\fi\tikz@marshal}% + +%% collect options and nodes, coordinates and pics onpath +\let\tikz@hvvh@currentoption\pgfutil@empty +\def\qrr@tikz@collect@hvvh@options#1[#2]{\edef\tikz@hvvh@currentoption{#2}#1} +\def\qrr@tikz@hvh@lineto@next{% + \pgfutil@ifnextchar n{\tikz@collect@label@onpath\qrr@tikz@hvh@lineto@next} + {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\qrr@tikz@hvh@lineto@next}% + {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\qrr@tikz@hvh@lineto@next}{\tikz@scan@one@point\qrr@tikz@@hvh@lineto}}}}% +\def\qrr@tikz@vhv@lineto@next{% + \pgfutil@ifnextchar n{\tikz@collect@label@onpath\qrr@tikz@vhv@lineto@next} + {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\qrr@tikz@vhv@lineto@next}% + {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\qrr@tikz@vhv@lineto@next}{\tikz@scan@one@point\qrr@tikz@@vhv@lineto}}}}% +\def\qrr@tikz@ud@lineto@next{% + \pgfutil@ifnextchar n{\tikz@collect@label@onpath\qrr@tikz@ud@lineto@next} + {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\qrr@tikz@ud@lineto@next} + {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\qrr@tikz@ud@lineto@next}{\tikz@scan@one@point\qrr@tikz@@ud@lineto}}}}% +\def\qrr@tikz@du@lineto@next{% + \pgfutil@ifnextchar n{\tikz@collect@label@onpath\qrr@tikz@du@lineto@next} + {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\qrr@tikz@du@lineto@next} + {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\qrr@tikz@du@lineto@next}{\tikz@scan@one@point\qrr@tikz@@du@lineto}}}}% +\def\qrr@tikz@lr@lineto@next{% + \pgfutil@ifnextchar n{\tikz@collect@label@onpath\qrr@tikz@lr@lineto@next} + {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\qrr@tikz@lr@lineto@next} + {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\qrr@tikz@lr@lineto@next}{\tikz@scan@one@point\qrr@tikz@@lr@lineto}}}}% +\def\qrr@tikz@rl@lineto@next{% + \pgfutil@ifnextchar n{\tikz@collect@label@onpath\qrr@tikz@rl@lineto@next} + {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\qrr@tikz@rl@lineto@next} + {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\qrr@tikz@rl@lineto@next}{\tikz@scan@one@point\qrr@tikz@@rl@lineto}}}}% + +\def\tikz@do@hvvh#1#2#3#4#5{% +% #1 = first kink +% #2 = second kink +% #3 = end +% #4 = timer +% #5 = tikz@shapeborder@name + \pgfpathlineto{#1}% + \pgfpathlineto{#2}% + \pgfpathlineto{#3}% + \def\tikz@timer@middle{#2}% + \def\tikz@timer@end{#3}% + \let\tikz@timer#4 + \edef\pgf@temp{#5}% + \ifx\pgf@temp\pgfutil@empty + \let\tikz@moveto@waiting\relax + \else + \let\tikz@moveto@waiting\pgf@temp + \fi + \tikz@scan@next@command}% + +%% -|- operator +\def\qrr@tikz@@hvh@lineto#1{% + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \pgf@xb=\tikz@lastx + \pgf@xc=\tikz@lastx + \pgf@yc=\tikz@lasty + \tikz@make@last@position{#1}% + \tikz@flush@moveto@toward{\pgfqpoint{\tikz@lastx}{\pgf@yc}}\pgf@xc\pgf@yc + \begingroup + \pgfqkeys{/tikz/hvvh}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% + \iftikz@shapeborder + \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\pgf@xb}{\tikz@lasty}}}% + \ifqrr@tikz@hvvh@fromcenter + \pgf@xc\pgf@xb + \fi + \pgfutil@ifxempty\qrr@tikz@hvvh@ratio{% + \ifdim\qrr@tikz@hvvh@distance<0pt\relax + \ifqrr@tikz@hvvh@fromcenter + \pgf@xc\tikz@lastx + \else + \pgf@xc\pgf@x + \fi + \fi + \ifdim\pgf@xb>\tikz@lastx + \qrr@tikz@hvvh@distance-\qrr@tikz@hvvh@distance + \fi + }{% + \ifqrr@tikz@hvvh@fromcenter + \qrr@tikz@hvvh@distance\tikz@lastx + \else + \qrr@tikz@hvvh@distance\pgf@x + \fi + \advance\qrr@tikz@hvvh@distance-\pgf@xc + \qrr@tikz@hvvh@distance\qrr@tikz@hvvh@ratio\qrr@tikz@hvvh@distance + }% + \advance\pgf@xc\qrr@tikz@hvvh@distance + \edef\pgf@tempa{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + \edef\pgf@tempb{\noexpand\pgfqpoint{\the\pgf@xc}{\the\tikz@lasty}}% + \edef\pgf@temp{\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \else + \let\tikz@shapeborder@name\pgfutil@empty + \ifqrr@tikz@hvvh@fromcenter + \pgf@xc\pgf@xb + \fi + \pgfutil@ifxempty\qrr@tikz@hvvh@ratio{% + \ifdim\qrr@tikz@hvvh@distance<0pt\relax + \pgf@xc\tikz@lastx + \fi + \ifdim\pgf@xb>\tikz@lastx + \qrr@tikz@hvvh@distance-\qrr@tikz@hvvh@distance + \fi + }{% + \qrr@tikz@hvvh@distance\tikz@lastx + \advance\qrr@tikz@hvvh@distance-\pgf@xc + \qrr@tikz@hvvh@distance\qrr@tikz@hvvh@ratio\qrr@tikz@hvvh@distance + }% + \advance\pgf@xc\qrr@tikz@hvvh@distance + \edef\pgf@tempa{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + \edef\pgf@tempb{\noexpand\pgfqpoint{\the\pgf@xc}{\the\tikz@lasty}}% + \edef\pgf@temp{\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \fi% + \xdef\pgf@marshal{% + \noexpand\tikz@do@hvvh + {\expandafter\noexpand\pgf@tempa}% + {\expandafter\noexpand\pgf@tempb}% + {\expandafter\noexpand\pgf@temp}% + {\noexpand\tikz@timer@hvhline}{\tikz@shapeborder@name}}% + \endgroup + \pgf@marshal}% + +%% |-| operator +\def\qrr@tikz@@vhv@lineto#1{% + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \pgf@xc=\tikz@lastx + \pgf@yb=\tikz@lasty + \pgf@yc=\tikz@lasty + \tikz@make@last@position{#1}% + \tikz@flush@moveto@toward{\pgfqpoint{\pgf@xc}{\tikz@lasty}}\pgf@xc\pgf@yc + \begingroup + \pgfqkeys{/tikz/hvvh}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% + \iftikz@shapeborder + \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\tikz@lastx}{\pgf@yb}}}% + \ifqrr@tikz@hvvh@fromcenter + \pgf@yc\pgf@yb + \fi + \ifx\qrr@tikz@hvvh@ratio\pgfutil@empty + \ifdim\qrr@tikz@hvvh@distance<0pt\relax + \ifqrr@tikz@hvvh@fromcenter + \pgf@yc\tikz@lasty + \else + \pgf@yc\pgf@y + \fi + \fi + \ifdim\pgf@yb>\tikz@lasty + \qrr@tikz@hvvh@distance-\qrr@tikz@hvvh@distance + \fi + \else + \ifqrr@tikz@hvvh@fromcenter + \qrr@tikz@hvvh@distance\tikz@lasty + \else + \qrr@tikz@hvvh@distance\pgf@y + \fi + \advance\qrr@tikz@hvvh@distance-\pgf@yc + \qrr@tikz@hvvh@distance\qrr@tikz@hvvh@ratio\qrr@tikz@hvvh@distance + \fi + \advance\pgf@yc\qrr@tikz@hvvh@distance + \edef\pgf@tempa{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + \edef\pgf@tempb{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\pgf@yc}}% + \edef\pgf@temp{\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \else + \let\tikz@shapeborder@name\pgfutil@empty + \ifqrr@tikz@hvvh@fromcenter + \pgf@yc\pgf@yb + \fi + \ifx\qrr@tikz@hvvh@ratio\pgfutil@empty + \ifdim\qrr@tikz@hvvh@distance<0pt\relax + \pgf@yc\tikz@lasty + \fi + \ifdim\pgf@yb>\tikz@lasty + \qrr@tikz@hvvh@distance-\qrr@tikz@hvvh@distance + \fi + \else + \qrr@tikz@hvvh@distance\tikz@lasty + \advance\qrr@tikz@hvvh@distance-\pgf@yc + \qrr@tikz@hvvh@distance\qrr@tikz@hvvh@ratio\qrr@tikz@hvvh@distance + \fi + \advance\pgf@yc\qrr@tikz@hvvh@distance + \edef\pgf@tempa{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + \edef\pgf@tempb{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\pgf@yc}}% + \edef\pgf@temp{\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \fi% + \xdef\pgf@marshal{% + \noexpand\tikz@do@hvvh + {\expandafter\noexpand\pgf@tempa}% + {\expandafter\noexpand\pgf@tempb}% + {\expandafter\noexpand\pgf@temp}% + {\noexpand\tikz@timer@vhvline}{\tikz@shapeborder@name}}% + \endgroup + \pgf@marshal}% + +%% r-ud operator +\def\qrr@tikz@@ud@lineto#1{% + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \pgf@xc\tikz@lastx + \pgf@yb\tikz@lasty + \advance\tikz@lasty1pt% + \let\pgf@temp\tikz@moveto@waiting + \tikz@flush@moveto@toward{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}\pgf@xc\pgf@yc + \tikz@make@last@position{#1}% + \begingroup + \pgfqkeys{/tikz/udlr}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% + \pgfmathsetlength\qrr@tikz@udlr@distance{\pgfkeysvalueof{/tikz/udlr/ud distance}}% + \iftikz@shapeborder + \advance\pgf@y1pt% + \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\pgf@x}{\pgf@y}}}% + \ifqrr@tikz@hvvh@fromcenter + \pgf@yc\pgf@yb + \else\ifx\pgf@temp\relax + \pgf@yc\pgf@yb + \fi + \fi + \ifdim\pgf@yc<\pgf@y + \ifqrr@tikz@hvvh@fromcenter + \pgf@yc=\tikz@lasty + \else + \pgf@yc=\pgf@y + \fi + \fi + \advance\pgf@yc\qrr@tikz@udlr@distance + \edef\pgf@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \else + \let\tikz@shapeborder@name\pgfutil@empty + \ifx\pgf@temp\relax\else + \ifqrr@tikz@hvvh@fromcenter\else + \pgf@yb\pgf@yc + \fi + \fi + \ifdim\pgf@yb<\tikz@lasty\pgf@yb\tikz@lasty\fi + \advance\pgf@yb\qrr@tikz@udlr@distance + \pgf@yc\pgf@yb + \edef\pgf@temp{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \fi + \xdef\pgf@marshal{% + \noexpand\tikz@do@hvvh + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + {\noexpand\pgfqpoint{\the\tikz@lastx}{\the\pgf@yc}}% + {\expandafter\noexpand\pgf@temp}% + {\noexpand\tikz@timer@vhvline}{\tikz@shapeborder@name}}% + \endgroup + \pgf@marshal}% + +%% r-du operator +\def\qrr@tikz@@du@lineto#1{% + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \pgf@xc\tikz@lastx + \pgf@yb\tikz@lasty + \advance\tikz@lasty-1pt% + \let\pgf@temp\tikz@moveto@waiting + \tikz@flush@moveto@toward{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}\pgf@xc\pgf@yc + \tikz@make@last@position{#1}% + \begingroup + \pgfqkeys{/tikz/udlr}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% + \pgfmathsetlength\qrr@tikz@udlr@distance{\pgfkeysvalueof{/tikz/udlr/du distance}}% + \iftikz@shapeborder + \advance\pgf@y-1pt% + \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\pgf@x}{\pgf@y}}}% + \ifqrr@tikz@hvvh@fromcenter + \pgf@yc\pgf@yb + \else\ifx\pgf@temp\relax + \pgf@yc\pgf@yb + \fi + \fi + \ifdim\pgf@yc>\pgf@y + \ifqrr@tikz@hvvh@fromcenter + \pgf@yc=\tikz@lasty + \else + \pgf@yc=\pgf@y + \fi + \fi + \advance\pgf@yc-\qrr@tikz@udlr@distance + \edef\pgf@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \else + \let\tikz@shapeborder@name\pgfutil@empty + \ifx\pgf@temp\relax\else + \ifqrr@tikz@hvvh@fromcenter\else + \pgf@yb\pgf@yc + \fi + \fi + \ifdim\pgf@yb>\tikz@lasty\pgf@yb\tikz@lasty\fi + \advance\pgf@yb-\qrr@tikz@udlr@distance + \pgf@yc\pgf@yb + \edef\pgf@temp{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \fi + \xdef\pgf@marshal{% + \noexpand\tikz@do@hvvh + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + {\noexpand\pgfqpoint{\the\tikz@lastx}{\the\pgf@yc}}% + {\expandafter\noexpand\pgf@temp}% + {\noexpand\tikz@timer@vhvline}{\tikz@shapeborder@name}}% + \endgroup + \pgf@marshal}% + +%% r-lr operator +\def\qrr@tikz@@lr@lineto#1{% + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \pgf@xb\tikz@lastx + \pgf@yc\tikz@lasty + \advance\tikz@lastx-1pt% + \let\pgf@temp\tikz@moveto@waiting + \tikz@flush@moveto@toward{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}\pgf@xc\pgf@yc + \tikz@make@last@position{#1}% + \begingroup + \pgfqkeys{/tikz/udlr}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% + \pgfmathsetlength\qrr@tikz@udlr@distance{\pgfkeysvalueof{/tikz/udlr/lr distance}}% + \iftikz@shapeborder + \advance\pgf@x-1pt% + \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\pgf@x}{\pgf@y}}}% + \ifqrr@tikz@hvvh@fromcenter + \pgf@xc\pgf@xb + \else\ifx\pgf@temp\relax + \pgf@xc\pgf@xb + \fi + \fi + \ifdim\pgf@xc>\pgf@x + \ifqrr@tikz@hvvh@fromcenter + \pgf@xc=\tikz@lastx + \else + \pgf@xc=\pgf@x + \fi + \fi + \advance\pgf@xc-\qrr@tikz@udlr@distance + \edef\pgf@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \else + \let\tikz@shapeborder@name\pgfutil@empty + \ifx\pgf@temp\relax\else + \ifqrr@tikz@hvvh@fromcenter\else + \pgf@xb\pgf@xc + \fi + \fi + \ifdim\pgf@xb>\tikz@lastx\pgf@xb\tikz@lastx\fi + \advance\pgf@xb-\qrr@tikz@udlr@distance + \pgf@xc\pgf@xb + \edef\pgf@temp{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \fi + \xdef\pgf@marshal{% + \noexpand\tikz@do@hvvh + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\tikz@lasty}}% + {\expandafter\noexpand\pgf@temp}% + {\noexpand\tikz@timer@hvhline}{\tikz@shapeborder@name}}% + \endgroup + \pgf@marshal}% + +%% r-rl operator +\def\qrr@tikz@@rl@lineto#1{% + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \pgf@xb\tikz@lastx + \pgf@yc\tikz@lasty + \advance\tikz@lastx1pt% + \let\pgf@temp\tikz@moveto@waiting + \tikz@flush@moveto@toward{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}\pgf@xc\pgf@yc + \tikz@make@last@position{#1}% + \begingroup + \pgfqkeys{/tikz/udlr}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% + \pgfmathsetlength\qrr@tikz@udlr@distance{\pgfkeysvalueof{/tikz/udlr/rl distance}}% + \iftikz@shapeborder% + \advance\pgf@x1pt% + \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\pgf@x}{\pgf@y}}}% + \ifqrr@tikz@hvvh@fromcenter + \pgf@xc\pgf@xb + \else\ifx\pgf@temp\relax + \pgf@xc\pgf@xb + \fi + \fi + \ifdim\pgf@xc<\pgf@x + \ifqrr@tikz@hvvh@fromcenter + \pgf@xc=\tikz@lastx + \else + \pgf@xc=\pgf@x + \fi + \fi + \advance\pgf@xc\qrr@tikz@udlr@distance + \edef\pgf@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \else + \let\tikz@shapeborder@name\pgfutil@empty% + \ifx\pgf@temp\relax\else + \ifqrr@tikz@hvvh@fromcenter\else + \pgf@xb\pgf@xc + \fi + \fi + \ifdim\pgf@xb<\tikz@lastx\pgf@xb\tikz@lastx\fi + \advance\pgf@xb\qrr@tikz@udlr@distance + \pgf@xc\pgf@xb + \edef\pgf@temp{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \fi + \xdef\pgf@marshal{% + \noexpand\tikz@do@hvvh + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\tikz@lasty}}% + {\expandafter\noexpand\pgf@temp}% + {\noexpand\tikz@timer@hvhline}{\tikz@shapeborder@name}}% + \endgroup + \pgf@marshal}% + +%% a few nice to haves, use with to or edge operator +\let\tikz@origtotarget\pgfutil@empty +\tikzset{ + node as new start/.is if=tikz@ortho@preflush, + node as new start, + horizontal vertical/.style={to path={-| (\tikztotarget) \tikztonodes}}, + vertical horizontal/.style={to path={|- (\tikztotarget) \tikztonodes}}, + horizontal vertical horizontal/.style={to path={-|- (\tikztotarget) \tikztonodes}}, + vertical horizontal vertical/.style={to path={|-| (\tikztotarget) \tikztonodes}}, + only vertical second/.style={to path={ + \pgfextra + \let\tikz@ortho@anchor\pgfutil@empty + \let\tikz@origtotarget\pgfutil@empty + \tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax + \iftikz@shapeborder + \tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax + \ifdim\pgf@y>\tikz@lasty\relax + \edef\tikztostart{\tikztostart.north}% + \iftikz@shapeborder\def\tikz@ortho@anchor{.south}\fi + \else + \edef\tikztostart{\tikztostart.south}% + \iftikz@shapeborder\def\tikz@ortho@anchor{.north}\fi + \fi + \fi + \def\tikz@tempa{#1}% + \ifx\tikz@tempa\pgfutil@empty\else + \let\tikz@origtotarget\tikztotarget + \edef\tikztotarget{[xshift={#1}]\tikztotarget\tikz@ortho@anchor}% + \fi + \endpgfextra + [insert path/.expanded={ + (perpendicular cs: horizontal line through={(\tikztostart)}, + vertical line through={(\tikztotarget)}) -- (\tikztotarget)}] \tikztonodes + \pgfextra + \ifx\tikz@origtotarget\pgfutil@empty\else + \iftikz@ortho@preflush(\tikz@origtotarget)\fi\fi\endpgfextra}}, + only vertical second/.default=, + only horizontal second/.style={to path={ + \pgfextra + \let\tikz@ortho@anchor\pgfutil@empty + \let\tikz@origtotarget\pgfutil@empty + \tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax + \iftikz@shapeborder + \tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax + \ifdim\pgf@x>\tikz@lastx\relax + \edef\tikztostart{\tikztostart.east}% + \iftikz@shapeborder\def\tikz@ortho@anchor{.west}\fi + \else + \edef\tikztostart{\tikztostart.west}% + \iftikz@shapeborder\def\tikz@ortho@anchor{.east}\fi + \fi + \fi + \def\tikz@tempa{#1}% + \ifx\tikz@tempa\pgfutil@empty\else + \let\tikz@origtotarget\tikztotarget + \edef\tikztotarget{[yshift={#1}]\tikztotarget\tikz@ortho@anchor}% + \fi + \endpgfextra + [insert path/.expanded={ + (perpendicular cs: vertical line through={(\tikztostart)}, + horizontal line through={(\tikztotarget)}) -- (\tikztotarget)}] \tikztonodes + \pgfextra + \ifx\tikz@origtotarget\pgfutil@empty\else + \iftikz@ortho@preflush(\tikz@origtotarget)\fi\fi\endpgfextra}}, + only horizontal second/.default=, + only vertical first/.style={to path={ + \pgfextra + \let\tikz@ortho@anchor\pgfutil@empty + \let\tikz@origtotarget\pgfutil@empty + \tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax + \iftikz@shapeborder + \let\tikz@origtotarget\tikztotarget + \tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax + \ifdim\pgf@y>\tikz@lasty\relax + \edef\tikztotarget{\tikztotarget.south}% + \iftikz@shapeborder\def\tikz@ortho@anchor{.north}\fi + \else + \edef\tikztotarget{\tikztotarget.north}% + \iftikz@shapeborder\def\tikz@ortho@anchor{.south}\fi + \fi + \fi + \def\tikz@tempa{#1}% + \ifx\tikz@tempa\pgfutil@empty\else + \edef\tikztostart{[xshift={#1}]\tikztostart\tikz@ortho@anchor}% + \fi + \endpgfextra + [insert path/.expanded={(\tikztostart)}] + -- (perpendicular cs: vertical line through/.expanded={(\tikztostart)}, + horizontal line through={(\tikztotarget)}) + \tikztonodes + \pgfextra + \ifx\tikz@origtotarget\pgfutil@empty\else + \iftikz@ortho@preflush(\tikz@origtotarget)\fi\fi\endpgfextra}}, + only vertical first/.default=, + only horizontal first/.style={to path={ + \pgfextra + \let\tikz@ortho@anchor\pgfutil@empty + \let\tikz@origtotarget\pgfutil@empty + \tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax + \iftikz@shapeborder + \let\tikz@origtotarget\tikztotarget + \tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax + \ifdim\pgf@x>\tikz@lastx\relax + \edef\tikztotarget{\tikztotarget.west}% + \iftikz@shapeborder\def\tikz@ortho@anchor{.east}\fi + \else + \edef\tikztotarget{\tikztotarget.east}% + \iftikz@shapeborder\def\tikz@ortho@anchor{.west}\fi + \fi + \fi + \def\tikz@tempa{#1}% + \ifx\tikz@tempa\pgfutil@empty\else + \edef\tikztostart{[yshift={#1}]\tikztostart\tikz@ortho@anchor}% + \fi + \endpgfextra + [insert path/.expanded={(\tikztostart)}] + -- (perpendicular cs: horizontal line through/.expanded={(\tikztostart)}, + vertical line through={(\tikztotarget)}) + \tikztonodes \pgfextra + \ifx\tikz@origtotarget\pgfutil@empty\else + \iftikz@ortho@preflush(\tikz@origtotarget)\fi\fi\endpgfextra}}, + only horizontal first/.default=, + only vertical first to center/.style={to path={ + \pgfextra + \let\tikz@origtotarget\tikztotarget + \endpgfextra + (\tikztostart) -- (perpendicular cs: vertical line through={(\tikztostart)}, + horizontal line through={(\tikztotarget)}) + \tikztonodes \ifx\tikz@origtotarget\pgfutil@empty\else\iftikz@ortho@preflush(\tikz@origtotarget)\fi\fi}}, + only horizontal first to center/.style={to path={ + \pgfextra + \let\tikz@origtotarget\tikztotarget + \endpgfextra + (\tikztostart) -- (perpendicular cs: horizontal line through={(\tikztostart)}, + vertical line through={(\tikztotarget)}) + \tikztonodes \ifx\tikz@origtotarget\pgfutil@empty\else\iftikz@ortho@preflush(\tikz@origtotarget)\fi\fi}}% +} +\endinput \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tikzlibraryext.paths.timer.code.tex b/graphics/pgf/contrib/tikz-ext/tikzlibraryext.paths.timer.code.tex new file mode 100644 index 0000000000..3a4d30e68f --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tikzlibraryext.paths.timer.code.tex @@ -0,0 +1,188 @@ +% 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. +% +\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}}% + \let\tikz@timer\tikz@timer@rectangle% %% Timer: new timer + \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}}% + \iftikz@snaked + \tikz@path@lineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}% + \fi + \pgfpathclose + \tikz@@movetosave{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}% + \def\pgfstrokehook{}% + \let\tikz@tangent\relax + \tikz@scan@next@command +}% + +\def\tikz@@sine#1{% originally from tikz.code.tex + \let\tikz@tangent\tikz@tangent@lookup + \tikz@flush@moveto + \edef\tikz@timer@start{\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% %% Timer: save start position + \pgf@process{#1}% + \edef\tikz@timer@end{\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% %% Timer: saver target position + \pgf@xc=\pgf@x + \pgf@yc=\pgf@y + \advance\pgf@xc by-\tikz@lastx + \advance\pgf@yc by-\tikz@lasty + \advance\tikz@lastx by\pgf@xc + \advance\tikz@lasty by\pgf@yc + \tikz@lastxsaved=\tikz@lastx + \tikz@lastysaved=\tikz@lasty + \tikz@updatecurrenttrue + \let\tikz@timer=\tikz@timer@sine% %% Timer: new timer + \pgfpathsine{\pgfqpoint{\pgf@xc}{\pgf@yc}}% + \tikz@scan@next@command +} + +\def\tikz@@cosine#1{% originally from tikz.code.tex + \let\tikz@tangent\tikz@tangent@lookup + \tikz@flush@moveto + \edef\tikz@timer@start{\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% %% Timer: save start position + \pgf@process{#1}% + \edef\tikz@timer@end{\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% %% Timer: save target position + \pgf@xc=\pgf@x + \pgf@yc=\pgf@y + \advance\pgf@xc by-\tikz@lastx + \advance\pgf@yc by-\tikz@lasty + \advance\tikz@lastx by\pgf@xc + \advance\tikz@lasty by\pgf@yc + \tikz@lastxsaved=\tikz@lastx + \tikz@lastysaved=\tikz@lasty + \tikz@updatecurrenttrue + \let\tikz@timer=\tikz@timer@cosine% %% Timer: new timer + \pgfpathcosine{\pgfqpoint{\pgf@xc}{\pgf@yc}}% + \tikz@scan@next@command +} + +\def\tikz@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 + \let\pgf@tempa\tikz@timer@start + \let\tikz@timer@start\tikz@timer@end + \let\tikz@timer@end\pgf@tempa + \fi + \multiply\pgfutil@tempdima2 + \edef\tikz@time{\strip@pt\pgfutil@tempdima}% + \tikz@timer@hvline}% + +\def\tikz@parabola@semifinal#1{% + \tikz@flush@moveto + % Save original start: + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% %% Timer: save start position + \pgf@xb=\tikz@lastx + \pgf@yb=\tikz@lasty + \tikz@make@last@position{#1}% + \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% %% Timer: save target position + \pgf@xc=\tikz@lastx + \pgf@yc=\tikz@lasty + \begingroup% now calculate bend: + \let\tikz@after@path\pgfutil@empty + \expandafter\tikzset\expandafter{\tikz@parabola@option}% + \tikz@lastxsaved=\tikz@parabola@bend@factor\tikz@lastx + \tikz@lastysaved=\tikz@parabola@bend@factor\tikz@lasty + \advance\tikz@lastxsaved by\pgf@xb + \advance\tikz@lastysaved by\pgf@yb + \advance\tikz@lastxsaved by-\tikz@parabola@bend@factor\pgf@xb + \advance\tikz@lastysaved by-\tikz@parabola@bend@factor\pgf@yb + \expandafter\tikz@make@last@position\expandafter{\tikz@parabola@bend}% + \edef\tikz@timer@middle{{\the\tikz@lastx}{\the\tikz@lasty}}% %% Timer: save bend postion + % Calculate delta from bend + \advance\pgf@xc by-\tikz@lastx + \advance\pgf@yc by-\tikz@lasty + % Ok, now calculate delta to bend + \advance\tikz@lastx by-\pgf@xb + \advance\tikz@lasty by-\pgf@yb + \edef\tikz@marshall{% + \noexpand\let\noexpand\tikz@timer\noexpand\tikz@timer@parabola + \noexpand\edef\noexpand\tikz@timer@middle{\noexpand\pgfqpoint\tikz@timer@middle}% + \noexpand\pgfpathparabola{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + }% + \expandafter\endgroup% + \tikz@marshall + \expandafter\tikz@scan@next@command\tikz@after@path% +}% + +\def\tikz@timer@parabola{% following calculations, see \def of \pgfpathparabola in pgfcorepathconstruct.code.tex (l. 1261) + \ifdim\tikz@time pt<.5pt\relax % first part + \pgf@process{\tikz@timer@middle}% + \pgf@xc\pgf@x\pgf@yc\pgf@y + \pgf@xb\pgf@x\pgf@yb\pgf@y + \pgf@process{\tikz@timer@start}% + \advance\pgf@xc-\pgf@x\pgf@xc.1125\pgf@xc + \advance\pgf@xc\pgf@x % = start_x + .1125 (middle_x - start_x) + \advance\pgf@yc-\pgf@y\pgf@yc.225\pgf@yc + \advance\pgf@yc\pgf@y % = start_y + .225 (middle_y - start_y) + \advance\pgf@xb\pgf@x\pgf@xb.5\pgf@xb % = .5 (middle_x + start_x) = start_x + .5 (middle_x - start_x) + \pgf@xa=\tikz@time pt% + \pgf@xa=2\pgf@xa % = 2 * \tikz@time + \edef\tikz@marshall{\noexpand\pgftransformcurveattime{\strip@pt\pgf@xa}{\noexpand\tikz@timer@start}% + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% + {\noexpand\tikz@timer@middle}}% + \else % second part + \pgf@process{\tikz@timer@end}% + \pgf@xc\pgf@x + \pgf@xb\pgf@x + \pgf@yb\pgf@y + \pgf@process{\tikz@timer@middle}% + \advance\pgf@xc\pgf@x\pgf@xc.5\pgf@xc % = .5 (end_x + middle_x) = middle_x + .5 (end_x - middle_x) + \advance\pgf@xb-\pgf@x\pgf@xb.8875\pgf@xb + \advance\pgf@xb\pgf@x % = middle_x + .8875 (end_x - middle_x) + \advance\pgf@yb-\pgf@y\pgf@yb.775\pgf@yb + \advance\pgf@yb\pgf@y % = middle_y + .775 (end_y - middle_y) + \pgf@xa=\tikz@time pt% + \advance\pgf@xa-.5pt% + \pgf@xa=2\pgf@xa % = 2 (\tikz@zime - .5) + \edef\tikz@marshall{\noexpand\pgftransformcurveattime{\strip@pt\pgf@xa}{\noexpand\tikz@timer@middle}% + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@y}}% + {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% + {\noexpand\tikz@timer@end}}% + \fi + \tikz@marshall +} + +\def\tikz@timer@sine{% following calculations, see \def of \pgfpathsine in pgfcorepathconstruct.code.tex (l. 1315) + \pgf@process{\tikz@timer@end}% + \pgf@xc\pgf@x\pgf@yc\pgf@y + \pgf@xb\pgf@x\pgf@yb\pgf@y + \pgf@process{\tikz@timer@start}% + \advance\pgf@xc-\pgf@x\pgf@xc.3260\pgf@xc + \advance\pgf@xc\pgf@x % = start_x + .3260 (end_x - start_x) + \advance\pgf@yc-\pgf@y\pgf@yc.5120\pgf@yc + \advance\pgf@yc\pgf@y % = start_y + .5120 (end_y - start_y) + \advance\pgf@xb-\pgf@x\pgf@xb.6380\pgf@xb % = start_x + .6380 (end_x - start_x) + \advance\pgf@xb\pgf@x + \edef\tikz@marshall{\noexpand\pgftransformcurveattime{\tikz@time}{\noexpand\tikz@timer@start}% + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% + {\noexpand\tikz@timer@end}}% + \tikz@marshall +} +\def\tikz@timer@cosine{% following calculations, see \def of \pgfpathcosine in pgfcorepathconstruct.code.tex (l. 1345) + \pgf@process{\tikz@timer@end}% + \pgf@xc\pgf@x\pgf@yc\pgf@y + \pgf@xb\pgf@x\pgf@yb\pgf@y + \pgf@process{\tikz@timer@start}% + \advance\pgf@xb-\pgf@x\pgf@xb.6740\pgf@xb + \advance\pgf@xb\pgf@x % = start_x + .6740 (end_x - start_x) + \advance\pgf@yb-\pgf@y\pgf@yb.4880\pgf@yb + \advance\pgf@yb\pgf@y % = start_y + .4880 (end_y - start_y) + \advance\pgf@xc-\pgf@x\pgf@xc.3620\pgf@xc % = start_x + .3620 (end_x - start_x) + \advance\pgf@xc\pgf@x + \edef\tikz@marshall{\noexpand\pgftransformcurveattime{\tikz@time}{\noexpand\tikz@timer@start}% + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@y}}% + {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% + {\noexpand\tikz@timer@end}}% + \tikz@marshall +} +\endinput \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tikzlibraryext.patterns.images.code.tex b/graphics/pgf/contrib/tikz-ext/tikzlibraryext.patterns.images.code.tex new file mode 100644 index 0000000000..7cad25e42b --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tikzlibraryext.patterns.images.code.tex @@ -0,0 +1,53 @@ +% This is the TikZ library patterns.images +% Load with \usetikzlibrary{patterns.images} +% +% Macro: +% - \pgfSetupImageAsPattern[]{}{} +% +% Keys are: +% - use image as pattern= +% - image as pattern= + +\def\pgfsetupimageaspattern{\pgfutil@ifnextchar[\qrr@pgfsetupimageaspattern{\qrr@pgfsetupimageaspattern[]}} +\def\qrr@pgfsetupimageaspattern[#1]#2#3{% #1 = options + % #2 = image name + % #3 = file name + \pgfdeclareimage[#1]{qrr@pgf@iap@#2}{#3}% + \sbox\pgfutil@tempboxa{\pgfuseimage{qrr@pgf@iap@#2}}% + \expandafter\edef\csname qrr@pgf@iap@#2@\endcsname{{\the\wd\pgfutil@tempboxa}{\the\ht\pgfutil@tempboxa}}% +} +\tikzset{ + image as pattern/name/.initial=, + image as pattern/option/.style=, + image as pattern/options/.style={/tikz/image as pattern/option/.append style={#1}}, + image as pattern/.default=, + image as pattern/.code={ + \tikzset{image as pattern/.cd,#1} + \pgfkeysgetvalue{/tikz/image as pattern/name}\tikz@temp + \pgfutil@ifxempty\tikz@temp{% + \tikzerror{You need to specify a name for the ``image-pattern'' to be used.}% + }{% + \edef\tikz@tempa{\expandafter\expandafter\expandafter\pgfutil@firstoftwo\csname qrr@pgf@iap@\tikz@temp @\endcsname}% + \edef\tikz@tempb{\expandafter\expandafter\expandafter\pgfutil@secondoftwo\csname qrr@pgf@iap@\tikz@temp @\endcsname}% + \pgfkeysalso{/tikz/path picture={% + \pgf@process{\pgfpointanchor{path picture bounding box}{north east}}% + \pgf@xa\pgf@x\pgf@ya\pgf@y + \pgf@process{\pgfpointanchor{path picture bounding box}{south west}}% + \pgf@xb\pgf@x\pgf@yb\pgf@y\pgf@yc\pgf@yb + \pgfutil@loop + {% + \pgfutil@loop + \expandafter\pgftext\expandafter[/tikz/image as pattern/option,at=\pgfqpoint{\pgf@xb}{\pgf@yb}]{\pgfuseimage{qrr@pgf@iap@\tikz@temp}}% + \ifdim\pgf@yb<\pgf@ya + \advance\pgf@yb\tikz@tempb + \pgfutil@repeat + }% + \ifdim\pgf@xb<\pgf@xa + \advance\pgf@xb\tikz@tempa + \pgf@yb\pgf@yc + \pgfutil@repeat + }}% + } + } +} +\endinput diff --git a/graphics/pgf/contrib/tikz-ext/tikzlibraryext.positioning-plus.code.tex b/graphics/pgf/contrib/tikz-ext/tikzlibraryext.positioning-plus.code.tex new file mode 100644 index 0000000000..a29d4ace64 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tikzlibraryext.positioning-plus.code.tex @@ -0,0 +1,262 @@ +% This is the TikZ library positioning-plus +% Load with \usetikzlibrary{positioning-plus} +% +% This small library extends TikZ options like 'above', 'left' or 'below right' +% so that they can be used with an optional prefixed factor seperated by ':' (colon) +% +% The option 'left=.5:of somenode' will place +% a new node .5cm (default 'node distance' is '1cm and 1cm') left to (somenode). +% The option 'above right=.2 and .7:of someothernode' will place +% a new node .2cm above and .7cm right of (someothernode). +% +% Additional the options 'xshift*' and 'yshift*' add an additional shift +% as a factor of 'node distance' +% Inspired by http://tex.stackexchange.com/a/117610/16595 + +\usetikzlibrary{positioning} +\usetikzlibrary{fit} + +\pgfdeclaregenericanchor{corner south east}{% + \pgf@sh@reanchor{#1}{south}% + \pgf@ya\pgf@y + \pgf@process{\pgf@sh@reanchor{#1}{east}}% + \pgf@y\pgf@ya +} +\pgfdeclaregenericanchor{corner north east}{% + \pgf@sh@reanchor{#1}{north}% + \pgf@ya\pgf@y + \pgf@process{\pgf@sh@reanchor{#1}{east}}% + \pgf@y\pgf@ya +} +\pgfdeclaregenericanchor{corner south west}{% + \pgf@sh@reanchor{#1}{south}% + \pgf@ya\pgf@y + \pgf@process{\pgf@sh@reanchor{#1}{west}}% + \pgf@y\pgf@ya +} +\pgfdeclaregenericanchor{corner north west}{% + \pgf@sh@reanchor{#1}{north}% + \pgf@ya\pgf@y + \pgf@process{\pgf@sh@reanchor{#1}{west}}% + \pgf@y\pgf@ya +} + +\tikzset{corner above left/.code=\tikz@lib@place@handle@{#1}{corner south east}{-1}{1}{corner north west}{0.707106781}} +\tikzset{corner above right/.code=\tikz@lib@place@handle@{#1}{corner south west}{1}{1}{corner north east}{0.707106781}} +\tikzset{corner below left/.code=\tikz@lib@place@handle@{#1}{corner north east}{-1}{-1}{corner south west}{0.707106781}} +\tikzset{corner below right/.code=\tikz@lib@place@handle@{#1}{corner north west}{1}{-1}{corner south east}{0.707106781}} + +\tikzset{corner north left/.code =\tikz@lib@place@handle@{#1}{corner north east}{-1}{0}{corner north west}{1}} +\tikzset{corner north right/.code=\tikz@lib@place@handle@{#1}{corner north west}{1}{0}{corner north east}{1}} +\tikzset{corner south left/.code =\tikz@lib@place@handle@{#1}{corner south east}{-1}{0}{corner south west}{1}} +\tikzset{corner south right/.code=\tikz@lib@place@handle@{#1}{corner south west}{1}{0}{corner south east}{1}} + +\tikzset{corner west above/.code =\tikz@lib@place@handle@{#1}{corner south west}{0}{1}{corner north west}{1}} +\tikzset{corner west below/.code=\tikz@lib@place@handle@{#1}{corner north west}{0}{-1}{corner south west}{1}} +\tikzset{corner east above/.code =\tikz@lib@place@handle@{#1}{corner south east}{0}{1}{corner north east}{1}} +\tikzset{corner east below/.code=\tikz@lib@place@handle@{#1}{corner north east}{0}{-1}{corner south east}{1}} + +\tikzset{north left/.code =\tikz@lib@place@handle@{#1}{north east}{-1}{0}{north west}{1}} +\tikzset{north right/.code=\tikz@lib@place@handle@{#1}{north west}{1}{0}{north east}{1}} +\tikzset{south left/.code =\tikz@lib@place@handle@{#1}{south east}{-1}{0}{south west}{1}} +\tikzset{south right/.code=\tikz@lib@place@handle@{#1}{south west}{1}{0}{south east}{1}} + +\tikzset{west above/.code =\tikz@lib@place@handle@{#1}{south west}{0}{1}{north west}{1}} +\tikzset{west below/.code=\tikz@lib@place@handle@{#1}{north west}{0}{-1}{south west}{1}} +\tikzset{east above/.code =\tikz@lib@place@handle@{#1}{south east}{0}{1}{north east}{1}} +\tikzset{east below/.code=\tikz@lib@place@handle@{#1}{north east}{0}{-1}{south east}{1}} + +\newif\ifqrr@tikz@lib@place@postransform +\tikzset{node distance transformation/.is if=qrr@tikz@lib@place@postransform} +\def\tikz@lib@place@handle@@#1#2#3#4{% + \pgfutil@in@{of }{#1}% + \ifpgfutil@in@ + \tikz@lib@place@of#1\tikz@stop{#4}% + \else + \edef\tikz@lib@place@nums{#1}% + \fi + \ifx\tikz@lib@place@nums\pgfutil@empty + % Ok, nothing to do, we have set the anchor and we are happy... + \else + \expandafter\tikz@lib@place@parse@nums\expandafter{\tikz@lib@place@nums}% + \pgf@x=#2\pgf@x + \pgf@y=#3\pgf@y + \ifqrr@tikz@lib@place@postransform + \pgf@pos@transform{\pgf@x}{\pgf@y}% change from original + \fi + \edef\tikz@lib@pos@call{\noexpand\pgftransformshift{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}}% + \fi +} + +\def\tikz@lib@place@handle@#1#2#3#4#5#6{% + \pgfutil@in@{:}{#1}% + \ifpgfutil@in@ + \tikz@lib@place@handle@qrr@#1\tikz@stop + \ifx\pgf@temp\pgfutil@empty + \let\pgf@temp\tikz@node@distance + \fi + \pgfmathsetmacro\pgf@tempa{(\pgf@tempa)*#4}% + \pgfmathsetmacro\pgf@tempb{(\pgf@tempb)*#3}% + \edef\pgf@marshal{\noexpand\tikz@lib@place@handle@{\pgf@temp}{#2}{\pgf@tempb}{\pgf@tempa}{#5}{#6}}% + \pgf@marshal + \else + \def\tikz@anchor{#2}% + \let\tikz@do@auto@anchor=\relax + \edef\tikz@temp{#1}% + \def\tikz@lib@place@single@factor{#6}% + \expandafter\tikz@lib@place@handle@@\expandafter{\tikz@temp}{#3}{#4}{#5}% + \fi +} +\def\tikz@lib@place@handle@qrr@#1:#2\tikz@stop{% + \pgfutil@in@{and}{#1}% + \ifpgfutil@in@ + \tikz@lib@place@handle@qrr@@#1\tikz@stop + \else + \tikz@lib@place@handle@qrr@@#1and#1\tikz@stop + \fi + \def\pgf@temp{#2}% +} +\def\tikz@lib@place@handle@qrr@@#1and#2\tikz@stop{% + \def\pgf@tempa{#1}% + \def\pgf@tempb{#2}% +} +\def\qrr@xyshift@starred#1#2#3{% + \edef\tikz@marshal{\noexpand\pgfutil@in@{and}{\tikz@node@distance}}% + \tikz@marshal + \ifpgfutil@in@ + \expandafter\tikz@lib@place@handle@qrr@@\tikz@node@distance\tikz@stop + \else + \let#3\tikz@node@distance + \fi + \pgfmathparse{(#1)*#3}% + \ifpgfmathunitsdeclared + \if#2x% + \pgftransformshift{\pgfqpoint{\pgfmathresult pt}{0pt}}% + \else + \pgftransformshift{\pgfqpoint{0pt}{\pgfmathresult pt}}% + \fi + \else + \ifx#2x% + \pgf@process{\pgfqpointxy{\pgfmathresult}{0}}% + \else + \pgf@process{\pgfqpointxy{0}{\pgfmathresult}}% + \fi + \pgftransformshift{\pgfqpoint{\pgf@x}{\pgf@y}}% + \fi} +\tikzset{ + xshift*/.code=\qrr@xyshift@starred{#1}x\pgf@tempb, + yshift*/.code=\qrr@xyshift@starred{#1}y\pgf@tempa +} + +\def\pgfutil@firstofmany#1#2\pgf@stop{#1} +\def\pgfutil@secondofmany#1#2\pgf@stop{#2} +\def\tikz@lib@place@of@#1#2#3{% + \def\pgf@tempa{fit bounding box}% + \edef\pgf@temp{\expandafter\pgfutil@firstofmany#2\pgf@stop} + \if\pgf@temp(% + \tikz@lib@place@fit@scan{#2}{0}% + \else\if\pgf@temp|% + \expandafter\tikz@lib@place@fit@scan\expandafter{\pgfutil@secondofmany#2\pgf@stop}{1}% + \else\ifx\pgf@temp\tikz@activebar + \expandafter\tikz@lib@place@fit@scan\expandafter{\pgfutil@secondofmany#2\pgf@stop}{1}% + \else\if\pgf@temp-% + \expandafter\tikz@lib@place@fit@scan\expandafter{\pgfutil@secondofmany#2\pgf@stop}{2}% + \else\if\pgf@temp+% + \expandafter\tikz@lib@place@fit@scan\expandafter{\pgfutil@secondofmany#2\pgf@stop}{3}% + \else + \def\pgf@tempa{#2}% + \fi + \fi + \fi + \fi + \fi + \expandafter\tikz@scan@one@point\expandafter\tikz@lib@place@remember\expandafter(\pgf@tempa)% + \iftikz@shapeborder% + % Ok, this is relative to a border. + \iftikz@lib@ignore@size% + \edef\tikz@node@at{\noexpand\pgfpointanchor{\tikz@shapeborder@name}{center}}% + \def\tikz@anchor{center}% + \else% + \edef\tikz@node@at{\noexpand\pgfpointanchor{\tikz@shapeborder@name}{#3}}% + \fi% + \fi% + \edef\tikz@lib@place@nums{#1}% +} +\def\tikz@lib@place@fit@scan#1#2{% + \pgf@xb=-16000pt\relax% + \pgf@xa=16000pt\relax% + \pgf@yb=-16000pt\relax% + \pgf@ya=16000pt\relax% + \if\pgfutil@firstofmany#1\pgf@stop(% + \tikz@lib@fit@scan#1\pgf@stop% + \else + \tikz@lib@fit@scan(#1)\pgf@stop + \fi + \ifdim\pgf@xa>\pgf@xa + % shouldn't happen + \else + \expandafter\def\csname pgf@sh@ns@fit bounding box\endcsname{rectangle}% + \expandafter\edef\csname pgf@sh@np@fit bounding box\endcsname{% + \def\noexpand\southwest{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}% + \def\noexpand\northeast{\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% + }% + \expandafter\def\csname pgf@sh@nt@fit bounding box\endcsname{{1}{0}{0}{1}{0pt}{0pt}}% + \expandafter\def\csname pgf@sh@pi@fit bounding box\expandafter\endcsname\expandafter{\pgfpictureid}% + \ifcase#2\relax + \or % 1 = vertical + \pgf@y=\pgf@yb% + \advance\pgf@y by-\pgf@ya% + \edef\pgf@marshal{\noexpand\pgfset{minimum height={\the\pgf@y-2*(\noexpand\pgfkeysvalueof{/pgf/outer ysep})}}}% + \pgf@marshal + \or % 2 = horizontal + \pgf@x=\pgf@xb% + \advance\pgf@x by-\pgf@xa% + \edef\pgf@marshal{\noexpand\pgfset{minimum width={\the\pgf@x-2*(\noexpand\pgfkeysvalueof{/pgf/outer xsep})}}}% + \pgf@marshal + \or % 3 = both directions + \pgf@y=\pgf@yb% + \advance\pgf@y by-\pgf@ya% + \pgf@x=\pgf@xb% + \advance\pgf@x by-\pgf@xa% + \edef\pgf@marshal{\noexpand\pgfset{minimum height={\the\pgf@y-2*(\noexpand\pgfkeysvalueof{/pgf/outer ysep})},minimum width={\the\pgf@x-2*(\noexpand\pgfkeysvalueof{/pgf/outer xsep})}}}% + \pgf@marshal + \fi + \fi +} +\tikzset{ + fit bounding box/.code={\tikz@lib@place@fit@scan{#1}{0}}, + span vertical/.code={\tikz@lib@place@fit@scan{#1}{1}}, + span horizontal/.code={\tikz@lib@place@fit@scan{#1}{2}}, + span/.code={\tikz@lib@place@fit@scan{#1}{3}}} + +\pgfmathdeclarefunction{x_node_dist}{0}{% + \begingroup + \edef\pgfmath@temp{\noexpand\pgfutil@in@{and}{\tikz@node@distance}}% + \pgfmath@temp\ifpgfutil@in@ + \expandafter\tikz@lib@place@handle@qrr@@\tikz@node@distance\tikz@stop + \else + \let\pgf@tempb\tikz@node@distance + \fi + \pgfmathparse{\pgf@tempb}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +} +\pgfmathdeclarefunction{y_node_dist}{0}{% + \begingroup + \edef\pgfmath@temp{\noexpand\pgfutil@in@{and}{\tikz@node@distance}}% + \pgfmath@temp\ifpgfutil@in@ + \expandafter\tikz@lib@place@handle@qrr@@\tikz@node@distance\tikz@stop + \else + \let\pgf@tempa\tikz@node@distance + \fi + \pgfmathparse{\pgf@tempa}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +} +%\tikzdeclarecoordinatesystem{node distance}{% +% \tikz@cs@nd#1\tikz@stop} +%\def\tikz@cs@nd#1,#2\tikz@stop{% +% \def\qrr@xyshift@starred@action##1{\pgftransformshift{##1}}% +% \qrr@xyshift@starred{#1}x\pgf@tempb +% \qrr@xyshift@starred{#2}y\pgf@tempa} +\endinput diff --git a/graphics/pgf/contrib/tikz-ext/tikzlibraryext.topaths.arcthrough.code.tex b/graphics/pgf/contrib/tikz-ext/tikzlibraryext.topaths.arcthrough.code.tex new file mode 100644 index 0000000000..d90a2edc78 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tikzlibraryext.topaths.arcthrough.code.tex @@ -0,0 +1,50 @@ +% 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. +% + +\pgfqkeys{/tikz/arc through}{ + .unknown/.code=\pgfkeyssetevalue{/tikz/arc through/through}{\pgfkeyscurrentname}, + through/.initial={(0,0)}, + center suffix/.initial=, + clockwise/.code=% + \def\tikz@arcthrough@clockwise{% + \pgfmathsubtract@{\pgfkeysvalueof{/tikz/end angle}}{360}% + \pgfkeyssetevalue{/tikz/end angle}{+\pgfmathresult}}, + counter clockwise/.code=\let\tikz@arcthrough@clockwise\relax, + clockwise/.value forbidden, counter clockwise/.value forbidden, counter clockwise} +\tikzset{ + arc through/.code={% + \tikzset{every arc through/.try}% + \pgfqkeys{/tikz/arc through}{#1}% + \pgfkeysgetvalue{/tikz/arc through/through}\tikz@temp + \pgfextract@process\pgf@tostart{\tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax}% + \expandafter\pgfextract@process\expandafter\pgf@tothrough\expandafter + {\expandafter\tikz@scan@one@point\expandafter\pgfutil@firstofone\tikz@temp\relax}% + \pgfextract@process\pgf@totarget{\tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax}% + \pgfextract@process\pgf@topointMidA{\pgfpointlineattime{.5}{\pgf@tostart}{\pgf@tothrough}}% + \pgfextract@process\pgf@topointMidB{\pgfpointlineattime{.5}{\pgf@totarget}{\pgf@tothrough}}% + \pgfextract@process\pgf@tocenter{% + \pgfpointintersectionoflines + {\pgf@topointMidA}{\pgfmathrotatepointaround{\pgf@tothrough}{\pgf@topointMidA}{90}}% + {\pgf@topointMidB}{\pgfmathrotatepointaround{\pgf@tothrough}{\pgf@topointMidB}{90}}}% + \pgfcoordinate{arc through center\pgfkeysvalueof{/tikz/arc through/center suffix}}{\pgf@tocenter}% + \pgfpointdiff{\pgf@tocenter}{\pgf@tostart}% + \pgfmathveclen@{\pgfmath@tonumber\pgf@x}{\pgfmath@tonumber\pgf@y}% + \pgfkeyssetevalue{/tikz/x radius}{+\pgfmathresult pt}% + \pgfkeyssetevalue{/tikz/y radius}{+\pgfmathresult pt}% + \pgfmathanglebetweenpoints{\pgf@tocenter}{\pgf@totarget}% + \pgfkeyssetevalue{/tikz/end angle}{+\pgfmathresult}% + \pgfmathanglebetweenpoints{\pgf@tocenter}{\pgf@tostart}% + \ifdim\pgfmathresult pt>\pgfkeysvalueof{/tikz/end angle}pt\relax + \pgfmathsubtract@{\pgfmathresult}{360}% + \fi + \pgfkeyssetevalue{/tikz/start angle}{+\pgfmathresult}% + \tikz@arcthrough@clockwise + \pgfkeyslet{/tikz/delta angle}\pgfutil@empty + \def\tikz@to@path{arc[]\tikztonodes}% + }% +} diff --git a/graphics/pgf/contrib/tikz-ext/tikzlibraryext.transformations.mirror.code.tex b/graphics/pgf/contrib/tikz-ext/tikzlibraryext.transformations.mirror.code.tex new file mode 100644 index 0000000000..c235cd179c --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tikzlibraryext.transformations.mirror.code.tex @@ -0,0 +1,70 @@ +% 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. +% +\usepgflibrary{ext.transformations.mirror} +\tikzset{ + mirror/.code={% + \pgfutil@in@{--}{#1}% + \ifpgfutil@in@ + \tikz@trans@mirror#1\@nil + \else + \tikz@scan@one@point\pgfqtransformmirror#1\relax + \fi}, + ymirror/.code={\pgfutil@ifnextchar(\tikz@trans@ymirror@coordinate\tikz@trans@ymirror@simple#1\@nil}, + xmirror/.code={\pgfutil@ifnextchar(\tikz@trans@xmirror@coordinate\tikz@trans@xmirror@simple#1\@nil}, + mirror x/.code={% + \pgfextract@process\tikz@temp{\tikz@scan@one@point\pgfutil@firstofone#1\relax}% + \pgftransformmirror{\tikz@temp}{\pgfpointadd{\tikz@temp}{\pgfqpointxy{0}{1}}}}, + mirror y/.code={% + \pgfextract@process\tikz@temp{\tikz@scan@one@point\pgfutil@firstofone#1\relax}% + \pgftransformmirror{\tikz@temp}{\pgfpointadd{\tikz@temp}{\pgfqpointxy{1}{0}}}}, + mirror/.value required, + ymirror/.value required, + xmirror/.value required, + mirror x/.value required, + mirror y/.value required} +\def\tikz@trans@mirror#1--#2\@nil{% + \pgftransformmirror{\tikz@scan@one@point\pgfutil@firstofone#1\relax} + {\tikz@scan@one@point\pgfutil@firstofone#2\relax}} +\def\tikz@trans@xmirror@simple#1\@nil{\pgftransformxmirror{#1}} +\def\tikz@trans@ymirror@simple#1\@nil{\pgftransformymirror{#1}} +\def\tikz@trans@xmirror@coordinate#1\@nil{% + \tikz@scan@one@point\pgfutil@firstofone#1\pgftransformxmirror{+\the\pgf@x}} +\def\tikz@trans@ymirror@coordinate#1\@nil{% + \tikz@scan@one@point\pgfutil@firstofone#1\pgftransformymirror{+\the\pgf@y}} + +\tikzset{ + Mirror/.code={% + \pgfutil@in@{--}{#1}% + \ifpgfutil@in@ + \tikz@trans@Mirror#1\@nil + \else + \tikz@scan@one@point\pgfqtransformMirror#1\relax + \fi}, + yMirror/.code={\pgfutil@ifnextchar(\tikz@trans@yMirror@coordinate\tikz@trans@yMirror@simple#1\@nil}, + xMirror/.code={\pgfutil@ifnextchar(\tikz@trans@xMirror@coordinate\tikz@trans@xMirror@simple#1\@nil}, + Mirror x/.code={% + \pgfextract@process\tikz@temp{\tikz@scan@one@point\pgfutil@firstofone#1\relax}% + \pgftransformMirror{\tikz@temp}{\pgfpointadd{\tikz@temp}{\pgfqpointxy{0}{1}}}}, + Mirror y/.code={% + \pgfextract@process\tikz@temp{\tikz@scan@one@point\pgfutil@firstofone#1\relax}% + \pgftransformMirror{\tikz@temp}{\pgfpointadd{\tikz@temp}{\pgfqpointxy{1}{0}}}}, + Mirror/.value required, + yMirror/.value required, + xMirror/.value required, + Mirror x/.value required, + Mirror y/.value required} +\def\tikz@trans@Mirror#1--#2\@nil{% + \pgftransformMirror{\tikz@scan@one@point\pgfutil@firstofone#1\relax} + {\tikz@scan@one@point\pgfutil@firstofone#2\relax}} +\def\tikz@trans@xMirror@simple#1\@nil{\pgftransformxMirror{#1}} +\def\tikz@trans@yMirror@simple#1\@nil{\pgftransformyMirror{#1}} +\def\tikz@trans@xMirror@coordinate#1\@nil{% + \tikz@scan@one@point\pgfutil@firstofone#1\pgftransformxMirror{+\the\pgf@x}} +\def\tikz@trans@yMirror@coordinate#1\@nil{% + \tikz@scan@one@point\pgfutil@firstofone#1\pgftransformyMirror{+\the\pgf@y}} +\endinput diff --git a/graphics/pgf/contrib/tikz-ext/tikzlibrarymisc.code.tex b/graphics/pgf/contrib/tikz-ext/tikzlibrarymisc.code.tex deleted file mode 100644 index b68520081c..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tikzlibrarymisc.code.tex +++ /dev/null @@ -1,251 +0,0 @@ -% 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. -% -%% full arc -%% https://tex.stackexchange.com/a/144297/16595 -%% The postfix operator R is added to PGFmath, -%% it allows the use of angular segments. -%% full arc = 10 makes it so that -%% 1R = 36° -%% 2R = 72° -%% … -%% 10R = 360° -%% Calling the full arc key with an empty value -%% makes 1R = 1° -\pgfset{full arc/.code=% - \def\pgf@temp{#1}% - \ifx\pgfutil@empty\pgf@temp - \let\pgfmath@fullarc@factor\pgfutil@empty - \else - \pgfmathsetmacro\pgfmath@fullarc@factor{360/(#1)}% - \fi,full arc=} -\pgfmathdeclareoperator{R}{full arc}{1}{postfix}{950} -\pgfmathdeclarefunction{full arc}{1}{% - \begingroup - \pgfmath@x=#1pt\relax - \ifx\pgfmath@fullarc@factor\pgfutil@empty\else - \pgfmath@x\pgfmath@fullarc@factor\pgfmath@x - \fi - \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\ifqrr@pgf@foreach@no@list -\pgfqkeys{/pgf/foreach}{ - use int/.code={% - \qrr@pgf@foreach@no@list@parse@to\pgfmathtruncatemacro#1\pgffor@stop - }, - use float/.code={% - \qrr@pgf@foreach@no@list@parse@to\pgfmathsetmacro#1\pgffor@stop - } -} - -\def\qrr@pgf@foreach@no@list@parse@to#1#2to#3\pgffor@stop{% - \qrr@pgf@foreach@no@listtrue - #1\foreachStart{#2}% - \pgfutil@in@{step}{#3} - \ifpgfutil@in@ - \qrr@pgf@foreach@no@list@parse@step{#1}#3\pgffor@stop - \else - \qrr@pgf@foreach@no@list@parse@step{#1}#3step1\pgffor@stop - \fi - \edef\qrr@pgf@foreach@no@list@list{\foreachStart,\foreachSecond,...,\foreachEnd}% -} -\def\qrr@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}{% - \ifqrr@pgf@foreach@no@list\expandafter\pgfutil@firstoftwo\else - \expandafter\pgfutil@secondoftwo\fi - {\qrr@pgf@foreach@no@listfalse\pgffor@macro@list\qrr@pgf@foreach@no@list@list} - {\pgffor@@vars}}}}}% - -%% Handlers -%% .pgfmath evaluates values given to keys in PGFmath before handing them over. -%% .pgfmath int truncates the result -%% .pgfmath strcat concatenates the given values -\pgfkeys{/handlers/.pgfmath/.code=\pgfmathparse{#1}\expandafter\pgfkeys@exp@call\expandafter{\pgfmathresult}} -\pgfkeys{/handlers/.pgfmath int/.code=\pgfmathint{#1}\expandafter\pgfkeys@exp@call\expandafter{\pgfmathresult}} -\pgfkeys{/handlers/.pgfmath strcat/.code=\pgfmathstrcat{#1}\expandafter\pgfkeys@exp@call\expandafter{\pgfmathresult}} - -%% 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) -\pgfkeys{/handlers/.List/.code={% - \let\pgfkeys@global@temp\pgfutil@empty - \foreach \pgfkeys@temp in{#1}{ - \ifx\pgfkeys@global@temp\pgfutil@empty - \global\let\pgfkeys@global@temp\pgfkeys@temp - \else - \expandafter\pgfutil@g@addto@macro\expandafter\pgfkeys@global@temp\expandafter - {\pgfkeys@temp}% - \fi}% - \expandafter\pgfkeys@exp@call\expandafter{\pgfkeys@global@temp}}} - -%% PGFmath -%% strrepeat("x", 5) = "xxxxx" -\pgfmathdeclarefunction{strrepeat}{2}{% - \begingroup\pgfmathint{#2}\pgfmath@count\pgfmathresult - \let\pgfmathresult\pgfutil@empty - \pgfutil@loop\ifnum\pgfmath@count>0\relax - \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult#1}% - \advance\pgfmath@count-1\relax - \pgfutil@repeat\pgfmath@smuggleone\pgfmathresult\endgroup} - -%% isInString("foo", "foobar") = true (= 1) -%% isInString("boo", "foobar") = false (= 0) -\pgfmathdeclarefunction{isInString}{2}{% - \pgfutil@in@{#1}{#2}% - \ifpgfutil@in@\def\pgfmathresult{1}\else\def\pgfmathresult{0}\fi} - -%% strcat("foo", "bar") = "foobar" (can have more than two parameters) -\pgfutil@IfUndefined{pgfmathstrcat@}{ - \pgfmathdeclarefunction{strcat}{...}{% - \begingroup - \let\pgfmathresult\pgfutil@empty - \pgfmathstrcat@@#1\pgfmath@stop} - \def\pgfmathstrcat@@#1{% - \ifx\pgfmath@stop#1% - \def\pgfmath@next{\pgfmath@smuggleone\pgfmathresult\endgroup} - \else - \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult#1}% - \let\pgfmath@next\pgfmathstrcat@@ - \fi - \pgfmath@next} -}{} - -% http://tex.stackexchange.com/questions/244569/bounding-lines-around-tax-nodes/244619#244619 -\pgfmathdeclarefunction{atanXY}{2}{\pgfmathatantwo@{#2}{#1}} -\pgfmathdeclarefunction{atanYX}{2}{\pgfmathatantwo@{#1}{#2}} - -%% http://tex.stackexchange.com/a/132939/16595 -\tikzset{ - @edges through/.code={{{% three braces to protect \pgfeov - \pgfutil@ifnextchar[{\pgfkeysvalueof{/tikz/@@edges through/.@cmd}} - {\pgfkeysvalueof{/tikz/@@edges through/.@cmd}[]}#1\pgfeov}}}, - @@edges through/.style args={[#1]#2}{/tikz/insert path={edge[#1] (#2) (#2)}}, - edges through/.style={/tikz/@edges through/.list={#1}}} -\tikzset{ - @edges to/.code={{{% three braces to protect \pgfeov - \pgfutil@ifnextchar[{\pgfkeysvalueof{/tikz/@@edges to/.@cmd}} - {\pgfkeysvalueof{/tikz/@@edges to/.@cmd}[]}#1\pgfeov}}}, - @@edges to/.style args={[#1]#2}{/tikz/insert path={edge[#1] (#2)}}, - edges to/.style={/tikz/@edges to/.list={#1}}} -\tikzset{ - @tos to/.code={{{% three braces to protect \pgfeov - \pgfutil@ifnextchar[{\pgfkeysvalueof{/tikz/@@tos to/.@cmd}} - {\pgfkeysvalueof{/tikz/@@tos to/.@cmd}[]}#1\pgfeov}}}, - @@tos to/.style args={[#1]#2}{/tikz/insert path={to[#1] (#2)}}, - tos to/.style={/tikz/@tos to/.list={#1}}} - - -\pgfmathdeclarefunction{distancebetween}{2}{% only coordinates/nodes - \begingroup - \pgfpointdiff{\pgfpointanchor{#1}{center}}{\pgfpointanchor{#2}{center}}% - \edef\pgfmath@temp{{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}}% - \expandafter\pgfmathveclen@\pgfmath@temp - \pgfmath@smuggleone\pgfmathresult - \endgroup} -\pgfmathdeclarefunction{qdistancebetween}{1}{% only coordinates/nodes - \begingroup - \pgfpointdiff{\pgfpointorigin}{\pgfpointanchor{#1}{center}}% - \edef\pgfmath@temp{{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}}% - \expandafter\pgfmathveclen@\pgfmath@temp - \pgfmath@smuggleone\pgfmathresult - \endgroup} - -\pgfmathdeclarefunction{qanglebetween}{1}{% - \pgfmathanglebetweenpoints{\pgfpointorigin}{\pgfpointanchor{#1}{center}}} - -\pgfmathdeclarefunction{anglebetween}{2}{% - \pgfmathanglebetweenpoints{\pgfpointanchor{#1}{center}}{\pgfpointanchor{#2}{center}}} - -\pgfmathdeclarefunction{isEmpty}{1}{% - \begingroup - \edef\pgfmath@temp{#1}% - \pgfutil@ifxempty\pgfmath@temp{\def\pgfmathresult{1}}{\def\pgfmathresult{0}}% - \pgfmath@smuggleone\pgfmathresult - \endgroup} - -\pgfqkeys{/utils}{ - if/.code n args=3{% - \pgfmathparse{#1}% - \ifdim\pgfmathresult pt=0pt - \expandafter\pgfutil@firstoftwo - \else - \expandafter\pgfutil@secondoftwo - \fi - {\pgfkeysalso{#3}}% - {\pgfkeysalso{#2}}}, - IF/.code args={(#1)#2}{% - \pgfmathparse{#1}% - \pgfutil@in@{else}{#2}% - \ifpgfutil@in@ - \expandafter\pgfutil@firstoftwo - \else - \expandafter\pgfutil@secondoftwo - \fi - {\qrr@misc@handle@else#2\pgf@stop}{\qrr@misc@handle@else#2else\pgf@stop}% - }, - TeX/if/.code n args={4}{% - \if#1#2\expandafter\pgfutil@firstoftwo\else\expandafter\pgfutil@secondoftwo\fi - {\pgfkeysalso{#3}}{\pgfkeysalso{#4}}% - }, - TeX/ifnum/.code n args={3}{% - \ifnum#1\relax\expandafter\pgfutil@firstoftwo\else\expandafter\pgfutil@secondoftwo\fi - {\pgfkeysalso{#2}}{\pgfkeysalso{#3}}% - }, - TeX/ifdim/.code n args={3}{% - \ifdim#1\relax\expandafter\pgfutil@firstoftwo\else\expandafter\pgfutil@secondoftwo\fi - {\pgfkeysalso{#2}}{\pgfkeysalso{#3}}% - }, - TeX/ifx/.code n args={4}{% - \ifx#1#2\relax\expandafter\pgfutil@firstoftwo\else\expandafter\pgfutil@secondoftwo\fi - {\pgfkeysalso{#3}}{\pgfkeysalso{#4}}% - }, - TeX/ifempty/.code n args={3}{% - \edef\pgfkeys@temp{#1}% - \pgfutil@ifxempty\pgfkeys@temp{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}% - }, - tex/.search also=/utils/TeX, -} -\def\qrr@misc@handle@else#1else#2\pgf@stop{% - \ifdim\pgfmathresult pt=0pt - \expandafter\pgfutil@firstoftwo - \else - \expandafter\pgfutil@secondoftwo - \fi - {\pgfkeysalso{#2}}% - {\pgfkeysalso{#1}}} - -\pgfset{ - declare constant/.code={% - \let\pgfmathdeclareconstant@@@\pgfutil@empty - \pgfkeysvalueof{/pgf/declare function/execute at begin function}% - \pgfmathdeclareconstant@#1@=@;\pgf@stop - \pgfkeysvalueof{/pgf/declare function/execute at end function}% - \pgfmathdeclareconstant@@@ - }} -\def\pgfmathdeclareconstant@{% - \pgfutil@ifnextchar x\pgfmathdeclareconstant@@\pgfmathdeclareconstant@@ -} -\def\pgfmathdeclareconstant@@#1=#2;#3\pgf@stop{% - \edef\pgfmath@local@temp{#1}% - \pgfutil@ifx\pgfmath@local@temp\pgfmath@local@at{}{% - \pgfutil@g@addto@macro\pgfmathdeclareconstant@@@{\pgfmathdeclarepseudoconstant{#1}{\def\pgfmathresult{#2}}}% - \pgfmathdeclareconstant@#3\pgf@stop - }% -} \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.arcto.code.tex b/graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.arcto.code.tex deleted file mode 100644 index 213fc1b74a..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.arcto.code.tex +++ /dev/null @@ -1,104 +0,0 @@ -% 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. -% -\tikzset{ - arc to/.code=\pgfqkeys{/tikz/arc to}{#1}, - arc to={ - counter clockwise/.code=\pgfkeyssetvalue{/tikz/arc to/ccw flag}{1}, - clockwise/.code=\pgfkeyssetvalue{/tikz/arc to/ccw flag}{0}, - x radius/.code=\pgfkeyssetvalue{/tikz/x radius}{#1}, - y radius/.code=\pgfkeyssetvalue{/tikz/y radius}{#1}, - radius/.code=\pgfkeyssetvalue{/tikz/x radius}{#1}\pgfkeyssetvalue{/tikz/y radius}{#1}, - large/.code=\pgfkeyssetvalue{/tikz/arc to/large flag}{1}, - small/.code=\pgfkeyssetvalue{/tikz/arc to/large flag}{0}, - % defaults - rotate/.initial=0, counter clockwise, small, - counter clockwise/.value forbidden, - clockwise/.value forbidden, - large/.value forbidden, - small/.value forbidden}} -\def\tikz@arcA rc{\pgfutil@ifnextchar t% - {\tikz@flush@moveto\expandafter\expandafter\expandafter\tikz@arcB@cont\expandafter\pgfutil@gobble\pgfutil@gobble} - {\tikz@flush@moveto\tikz@arc@cont}} -\def\tikz@arcB@cont{% - \pgfutil@ifnextchar[\tikz@@do@arcB{ - \advance\tikz@expandcount by -10\relax% go down quickly - \ifnum\tikz@expandcount<0\relax% - \def\@next{\tikz@@do@arcB[]}% - \else% - \def\@next{\expandafter\tikz@arcB@cont}% - \fi% - \@next}}% -\def\tikz@@do@arcB[#1]{% - \def\tikz@arcB@options{#1}% - \tikz@do@@arcB} -\def\tikz@do@@arcB{% - \pgfutil@ifnextchar n{\tikz@collect@label@onpath\tikz@do@@arcB} - {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@do@@arcB} - {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\tikz@do@@arcB} - {\tikz@scan@one@point\tikz@do@arcB}}}} - -\def\tikz@do@arcB#1{% - \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}} - \tikz@make@last@position{#1}% - \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \iftikz@shapeborder - \edef\tikz@moveto@waiting{\tikz@shapeborder@name}% - \fi - \begingroup - \tikzset{every arc/.try,every arc to/.try,arc to/.expand once=\tikz@arcB@options}% - \pgfmathsetmacro\tikz@arc@x{\pgfkeysvalueof{/tikz/x radius}}% - \ifpgfmathunitsdeclared - \pgfmathsetmacro\tikz@arc@y{\pgfkeysvalueof{/tikz/y radius}}% - \ifpgfmathunitsdeclared - \pgfpatharcto{\tikz@arc@x pt}{\tikz@arc@y pt} - {\pgfkeysvalueof{/tikz/arc to/rotate}}{\pgfkeysvalueof{/tikz/arc to/large flag}} - {\pgfkeysvalueof{/tikz/arc to/ccw flag}}{#1}% - \else - \tikzerror{You cannot mix dimensions and dimension values in an arc}% - \fi - \else - \pgfmathsetmacro\tikz@arc@y{\pgfkeysvalueof{/tikz/y radius}}% - \ifpgfmathunitsdeclared - \tikzerror{You cannot mix dimensions and dimension values in an arc}% - \else - \pgf@process{\pgfpointxy{\tikz@arc@x}{0}}% - \pgfmathveclen@{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}% - \let\tikz@arc@x\pgfmathresult - \pgf@process{\pgfpointxy{0}{\tikz@arc@y}}% - \pgfmathveclen@{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}% - \let\tikz@arc@y\pgfmathresult - \pgfpatharcto{+\tikz@arc@x pt}{+\tikz@arc@y pt} - {\pgfkeysvalueof{/tikz/arc to/rotate}}{\pgfkeysvalueof{/tikz/arc to/large flag}} - {\pgfkeysvalueof{/tikz/arc to/ccw flag}}{#1}% - \fi - \fi - \endgroup - % check whether \pgf@marshall starts with \pgfpathlineto - \pgfutil@ifxempty\pgf@marshal{}{% - \edef\tikz@temp{\expandafter\expandafter\expandafter\noexpand\expandafter\pgfutil@firstgobblerest\pgf@marshal\relax}% - \expandafter\let\expandafter\tikz@temp\tikz@temp - \pgfutil@ifx\tikz@temp\pgfpathlineto{}{% - % getting rid of \pgfpatharcaxes inside \pgf@marshal - \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\pgf@marshal - \expandafter\expandafter\expandafter{\expandafter\pgfutil@gobble\pgf@marshal}% - % extracting the other four values needed for the timer - \edef\tikz@timer@start@angle{\expandafter\pgfutil@firstoffour\pgf@marshal}% - \edef\tikz@timer@end@angle{\expandafter\pgfutil@secondoffour\pgf@marshal}% - \pgfextract@process\tikz@timer@zero@axis{\expandafter\pgfutil@thirdoffour\pgf@marshal}% - \pgfextract@process\tikz@timer@ninety@axis{\expandafter\pgfutil@fourthoffour\pgf@marshal}% - % - \let\tikz@timer=\tikz@timer@arc - }% - }% - \tikz@scan@next@command -} -\def\pgfutil@firstoffour#1#2#3#4{#1} -\def\pgfutil@secondoffour#1#2#3#4{#2} -\def\pgfutil@thirdoffour#1#2#3#4{#3} -\def\pgfutil@fourthoffour#1#2#3#4{#4} -\def\pgfutil@firstgobblerest#1#2\relax{#1} \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.ortho.code.tex b/graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.ortho.code.tex deleted file mode 100644 index 8f322fbd35..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.ortho.code.tex +++ /dev/null @@ -1,183 +0,0 @@ -% 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. -% - -%% For the operators r-lr, r-rl, r-ud and r-du we need to check after TikZ found r -\let\tikz@orig@rect\tikz@rect -\def\tikz@rect{\pgfutil@ifnextchar e\tikz@orig@rect\qrr@tikz@r} -\def\qrr@tikz@r -{% - \pgfutil@ifnextchar l\qrr@tikz@lr@lineto{% - \pgfutil@ifnextchar r\qrr@tikz@rl@lineto{% - \pgfutil@ifnextchar u\qrr@tikz@ud@lineto{% - \pgfutil@ifnextchar d\qrr@tikz@du@lineto\tikz@expand - }% - }% - }% -} -%% For the operator |-| we need to check after TikZ found |- -\let\tikz@orig@vh@lineto@next\tikz@vh@lineto@next -\def\tikz@vh@lineto@next{% - \pgfutil@ifnextchar|{\expandafter\qrr@tikz@vhv@lineto\pgfutil@gobble}% - {\pgfutil@ifnextchar\tikz@activebar{\expandafter\qrr@tikz@vhv@lineto\pgfutil@gobble}% - {\tikz@orig@vh@lineto@next}}} -%% For the operator -|- we need to check after TikZ found -| -\let\tikz@orig@hv@lineto\tikz@hv@lineto -\def\tikz@hv@lineto{% - \pgfutil@ifnextchar-{\expandafter\qrr@tikz@hvh@lineto\pgfutil@gobble}% - {\tikz@orig@hv@lineto}} - -%% |-|[] and -|-[] are allowed -\def\qrr@tikz@vhv@lineto{\pgfutil@ifnextchar[{\qrr@tikz@collect@hvvh@options\qrr@tikz@vhv@lineto@next}{\qrr@tikz@collect@hvvh@options\qrr@tikz@vhv@lineto@next[]}} -\def\qrr@tikz@hvh@lineto{\pgfutil@ifnextchar[{\qrr@tikz@collect@hvvh@options\qrr@tikz@hvh@lineto@next}{\qrr@tikz@collect@hvvh@options\qrr@tikz@hvh@lineto@next[]}} - -%% r-rl[], r-lr[], etc. -\def\qrr@tikz@rl@lineto rl{\pgfutil@ifnextchar[{\qrr@tikz@collect@hvvh@options\qrr@tikz@rl@lineto@next}{\qrr@tikz@collect@hvvh@options\qrr@tikz@rl@lineto@next[]}} -\def\qrr@tikz@lr@lineto lr{\pgfutil@ifnextchar[{\qrr@tikz@collect@hvvh@options\qrr@tikz@lr@lineto@next}{\qrr@tikz@collect@hvvh@options\qrr@tikz@lr@lineto@next[]}} -\def\qrr@tikz@du@lineto du{\pgfutil@ifnextchar[{\qrr@tikz@collect@hvvh@options\qrr@tikz@du@lineto@next}{\qrr@tikz@collect@hvvh@options\qrr@tikz@du@lineto@next[]}} -\def\qrr@tikz@ud@lineto ud{\pgfutil@ifnextchar[{\qrr@tikz@collect@hvvh@options\qrr@tikz@ud@lineto@next}{\qrr@tikz@collect@hvvh@options\qrr@tikz@ud@lineto@next[]}} - -%% TikZ interjects are done, the rest is independent: -\input tikzlibrarypaths.ortho.tex - -%% a few nice to haves, use with to or edge operator -\let\tikz@origtotarget\pgfutil@empty -\tikzset{ - node as new start/.is if=tikz@ortho@preflush, - node as new start, - horizontal vertical/.style={to path={-| (\tikztotarget) \tikztonodes}}, - vertical horizontal/.style={to path={|- (\tikztotarget) \tikztonodes}}, - horizontal vertical horizontal/.style={to path={-|- (\tikztotarget) \tikztonodes}}, - vertical horizontal vertical/.style={to path={|-| (\tikztotarget) \tikztonodes}}, - only vertical second/.style={to path={ - \pgfextra - \let\tikz@ortho@anchor\pgfutil@empty - \let\tikz@origtotarget\pgfutil@empty - \tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax - \iftikz@shapeborder - \tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax - \ifdim\pgf@y>\tikz@lasty\relax - \edef\tikztostart{\tikztostart.north}% - \iftikz@shapeborder\def\tikz@ortho@anchor{.south}\fi - \else - \edef\tikztostart{\tikztostart.south}% - \iftikz@shapeborder\def\tikz@ortho@anchor{.north}\fi - \fi - \fi - \def\tikz@tempa{#1}% - \ifx\tikz@tempa\pgfutil@empty\else - \let\tikz@origtotarget\tikztotarget - \edef\tikztotarget{[xshift={#1}]\tikztotarget\tikz@ortho@anchor}% - \fi - \endpgfextra - [insert path/.expanded={ - (perpendicular cs: horizontal line through={(\tikztostart)}, - vertical line through={(\tikztotarget)}) -- (\tikztotarget)}] \tikztonodes - \pgfextra - \ifx\tikz@origtotarget\pgfutil@empty\else - \iftikz@ortho@preflush(\tikz@origtotarget)\fi\fi\endpgfextra}}, - only vertical second/.default=, - only horizontal second/.style={to path={ - \pgfextra - \let\tikz@ortho@anchor\pgfutil@empty - \let\tikz@origtotarget\pgfutil@empty - \tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax - \iftikz@shapeborder - \tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax - \ifdim\pgf@x>\tikz@lastx\relax - \edef\tikztostart{\tikztostart.east}% - \iftikz@shapeborder\def\tikz@ortho@anchor{.west}\fi - \else - \edef\tikztostart{\tikztostart.west}% - \iftikz@shapeborder\def\tikz@ortho@anchor{.east}\fi - \fi - \fi - \def\tikz@tempa{#1}% - \ifx\tikz@tempa\pgfutil@empty\else - \let\tikz@origtotarget\tikztotarget - \edef\tikztotarget{[yshift={#1}]\tikztotarget\tikz@ortho@anchor}% - \fi - \endpgfextra - [insert path/.expanded={ - (perpendicular cs: vertical line through={(\tikztostart)}, - horizontal line through={(\tikztotarget)}) -- (\tikztotarget)}] \tikztonodes - \pgfextra - \ifx\tikz@origtotarget\pgfutil@empty\else - \iftikz@ortho@preflush(\tikz@origtotarget)\fi\fi\endpgfextra}}, - only horizontal second/.default=, - only vertical first/.style={to path={ - \pgfextra - \let\tikz@ortho@anchor\pgfutil@empty - \let\tikz@origtotarget\pgfutil@empty - \tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax - \iftikz@shapeborder - \let\tikz@origtotarget\tikztotarget - \tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax - \ifdim\pgf@y>\tikz@lasty\relax - \edef\tikztotarget{\tikztotarget.south}% - \iftikz@shapeborder\def\tikz@ortho@anchor{.north}\fi - \else - \edef\tikztotarget{\tikztotarget.north}% - \iftikz@shapeborder\def\tikz@ortho@anchor{.south}\fi - \fi - \fi - \def\tikz@tempa{#1}% - \ifx\tikz@tempa\pgfutil@empty\else - \edef\tikztostart{[xshift={#1}]\tikztostart\tikz@ortho@anchor}% - \fi - \endpgfextra - [insert path/.expanded={(\tikztostart)}] - -- (perpendicular cs: vertical line through/.expanded={(\tikztostart)}, - horizontal line through={(\tikztotarget)}) - \tikztonodes - \pgfextra - \ifx\tikz@origtotarget\pgfutil@empty\else - \iftikz@ortho@preflush(\tikz@origtotarget)\fi\fi\endpgfextra}}, - only vertical first/.default=, - only horizontal first/.style={to path={ - \pgfextra - \let\tikz@ortho@anchor\pgfutil@empty - \let\tikz@origtotarget\pgfutil@empty - \tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax - \iftikz@shapeborder - \let\tikz@origtotarget\tikztotarget - \tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax - \ifdim\pgf@x>\tikz@lastx\relax - \edef\tikztotarget{\tikztotarget.west}% - \iftikz@shapeborder\def\tikz@ortho@anchor{.east}\fi - \else - \edef\tikztotarget{\tikztotarget.east}% - \iftikz@shapeborder\def\tikz@ortho@anchor{.west}\fi - \fi - \fi - \def\tikz@tempa{#1}% - \ifx\tikz@tempa\pgfutil@empty\else - \edef\tikztostart{[yshift={#1}]\tikztostart\tikz@ortho@anchor}% - \fi - \endpgfextra - [insert path/.expanded={(\tikztostart)}] - -- (perpendicular cs: horizontal line through/.expanded={(\tikztostart)}, - vertical line through={(\tikztotarget)}) - \tikztonodes \pgfextra - \ifx\tikz@origtotarget\pgfutil@empty\else - \iftikz@ortho@preflush(\tikz@origtotarget)\fi\fi\endpgfextra}}, - only horizontal first/.default=, - only vertical first to center/.style={to path={ - \pgfextra - \let\tikz@origtotarget\tikztotarget - \endpgfextra - (\tikztostart) -- (perpendicular cs: vertical line through={(\tikztostart)}, - horizontal line through={(\tikztotarget)}) - \tikztonodes \ifx\tikz@origtotarget\pgfutil@empty\else\iftikz@ortho@preflush(\tikz@origtotarget)\fi\fi}}, - only horizontal first to center/.style={to path={ - \pgfextra - \let\tikz@origtotarget\tikztotarget - \endpgfextra - (\tikztostart) -- (perpendicular cs: horizontal line through={(\tikztostart)}, - vertical line through={(\tikztotarget)}) - \tikztonodes \ifx\tikz@origtotarget\pgfutil@empty\else\iftikz@ortho@preflush(\tikz@origtotarget)\fi\fi}}% -} -\endinput \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.ortho.tex b/graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.ortho.tex deleted file mode 100644 index 2c4aae04c2..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.ortho.tex +++ /dev/null @@ -1,509 +0,0 @@ -% 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. -% - -\newlength\qrr@tikz@udlr@distance -\newlength\qrr@tikz@hvvh@distance -\newif\ifqrr@tikz@hvvh@middle % checks whether spacing = 0 was selected -\newif\ifqrr@tikz@hvvh@fromcenter -\newif\iftikz@ortho@preflush -\tikz@ortho@preflushtrue -\let\tikz@origtotarget\pgfutil@empty - -%%% HVVH/UDLR -\tikzset{% - hvvh/.code={\pgfqkeys{/tikz/hvvh}{#1}},% - udlr/.code={\pgfqkeys{/tikz/udlr}{#1}},% - hvvh/.search also=/tikz,% - udlr/.search also=/tikz,% - hvvh/middle 0 to 1/.style={hvvh/spacing=0},% - hvvh/from center/.is if=qrr@tikz@hvvh@fromcenter,% - udlr/from center/.style={/tikz/hvvh/from center={#1}}, - hvvh/spacing/.code=% spacing = 0 means that the middle part are the pos-itions 0 to 1, - % the first part is -1 to 0, the last part is to 2 - \pgfmathint{#1}\let\qrr@tikz@hvvh@timing@parts\pgfmathresult% in case they are calculations to be done - \ifcase\qrr@tikz@hvvh@timing@parts\relax - \qrr@tikz@hvvh@middletrue - \def\qrr@tikz@hvvh@timing@parts{1}% - \def\qrr@tikz@hvvh@timing@first{0}% - \def\qrr@tikz@hvvh@timing@last{1}% - \def\qrr@tikz@hvvh@timing@subtr{0}% - \def\qrr@tikz@hvvh@timing@factor{1}% - \else % in all other cases n > 0 the kinks are at pos = 1/n and (n - 1)/n - \qrr@tikz@hvvh@middlefalse - \pgfmathreciprocal{#1}\let\qrr@tikz@hvvh@timing@first\pgfmathresult - \pgfmathsetmacro\qrr@tikz@hvvh@timing@last{1-\pgfmathresult}% - \pgfmathreciprocal{#1-2}% - \let\qrr@tikz@hvvh@timing@subtr\pgfmathresult - \pgfmathsetmacro\qrr@tikz@hvvh@timing@factor{1+2*\pgfmathresult}% - \fi,% - hvvh/ratio/.code=\pgfmathsetmacro\qrr@tikz@hvvh@ratio{#1},% - % TODO: not possible to do distance in TikZ coordinate system - hvvh/distance/.code=\pgfmathsetlength\qrr@tikz@hvvh@distance{#1}\let\qrr@tikz@hvvh@ratio\pgfutil@empty,% - udlr/distance/.style={% - /tikz/udlr/ud distance={#1},% - /tikz/udlr/du distance={#1},% - /tikz/udlr/lr distance={#1},% - /tikz/udlr/rl distance={#1}},% - udlr/ud distance/.initial=+.5cm,% - udlr/du distance/.initial=+.5cm,% - udlr/lr distance/.initial=+.5cm,% - udlr/rl distance/.initial=+.5cm,% - hvvh/ratio=.5,% default value - hvvh/spacing=4,% default value -}% - -%BEGIN_FOLD Timer -\def\tikz@timer@hvhline{% - \pgf@process{\tikz@timer@start}\pgf@ya\pgf@y - \pgf@process{\tikz@timer@end}\pgf@yc\pgf@y - \pgf@process{\tikz@timer@middle}\pgf@xb\tikz@time pt% - \ifdim\tikz@time pt<\qrr@tikz@hvvh@timing@first pt% first quarter - \ifqrr@tikz@hvvh@middle - \advance\pgf@xb1pt% - \else - \pgf@xb\qrr@tikz@hvvh@timing@parts\pgf@xb - \fi - \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}{\noexpand\tikz@timer@start}{% - \noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@ya}}}% - \else - \ifdim\tikz@time pt>\qrr@tikz@hvvh@timing@last pt% last quarter - \ifqrr@tikz@hvvh@middle - \advance\pgf@xb-1pt% - \else - \pgf@xb\qrr@tikz@hvvh@timing@parts\pgf@xb - \fi - \advance\pgf@xb\dimexpr-\qrr@tikz@hvvh@timing@parts pt+1pt\relax% - \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}% - {\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@yc}}{\noexpand\tikz@timer@end}}% - \else% middle half - \pgf@xb\qrr@tikz@hvvh@timing@factor\pgf@xb% - \advance\pgf@xb-\qrr@tikz@hvvh@timing@subtr pt% - \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}% - {\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@ya}}{\noexpand\tikz@timer@middle}}% - \fi\fi\tikz@marshal} -\def\tikz@timer@vhvline{% - \pgf@process{\tikz@timer@start}\pgf@xa\pgf@x - \pgf@process{\tikz@timer@end}\pgf@xc\pgf@x - \pgf@process{\tikz@timer@middle}\pgf@xb\tikz@time pt% - \ifdim\tikz@time pt<\qrr@tikz@hvvh@timing@first pt% first quarter - \ifqrr@tikz@hvvh@middle - \advance\pgf@xb1pt% - \else - \pgf@xb\qrr@tikz@hvvh@timing@parts\pgf@xb - \fi - \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}{\noexpand\tikz@timer@start}{% - \noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@y}}}% - \else - \ifdim\tikz@time pt>\qrr@tikz@hvvh@timing@last pt% last quarter - \ifqrr@tikz@hvvh@middle - \advance\pgf@xb-1pt% - \else - \pgf@xb\qrr@tikz@hvvh@timing@parts\pgf@xb - \fi - \advance\pgf@xb by\dimexpr-\qrr@tikz@hvvh@timing@parts pt+1pt\relax% - \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}% - {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@y}}{\noexpand\tikz@timer@end}}% - \else% middle half - \pgf@xb=\qrr@tikz@hvvh@timing@factor\pgf@xb - \advance\pgf@xb by-\qrr@tikz@hvvh@timing@subtr pt% - \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}% - {\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@y}}{\noexpand\tikz@timer@middle}}% - \fi\fi\tikz@marshal}% - -%% collect options and nodes, coordinates and pics onpath -\let\tikz@hvvh@currentoption\pgfutil@empty -\def\qrr@tikz@collect@hvvh@options#1[#2]{\edef\tikz@hvvh@currentoption{#2}#1} -\def\qrr@tikz@hvh@lineto@next{% - \pgfutil@ifnextchar n{\tikz@collect@label@onpath\qrr@tikz@hvh@lineto@next} - {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\qrr@tikz@hvh@lineto@next}% - {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\qrr@tikz@hvh@lineto@next}{\tikz@scan@one@point\qrr@tikz@@hvh@lineto}}}}% -\def\qrr@tikz@vhv@lineto@next{% - \pgfutil@ifnextchar n{\tikz@collect@label@onpath\qrr@tikz@vhv@lineto@next} - {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\qrr@tikz@vhv@lineto@next}% - {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\qrr@tikz@vhv@lineto@next}{\tikz@scan@one@point\qrr@tikz@@vhv@lineto}}}}% -\def\qrr@tikz@ud@lineto@next{% - \pgfutil@ifnextchar n{\tikz@collect@label@onpath\qrr@tikz@ud@lineto@next} - {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\qrr@tikz@ud@lineto@next} - {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\qrr@tikz@ud@lineto@next}{\tikz@scan@one@point\qrr@tikz@@ud@lineto}}}}% -\def\qrr@tikz@du@lineto@next{% - \pgfutil@ifnextchar n{\tikz@collect@label@onpath\qrr@tikz@du@lineto@next} - {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\qrr@tikz@du@lineto@next} - {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\qrr@tikz@du@lineto@next}{\tikz@scan@one@point\qrr@tikz@@du@lineto}}}}% -\def\qrr@tikz@lr@lineto@next{% - \pgfutil@ifnextchar n{\tikz@collect@label@onpath\qrr@tikz@lr@lineto@next} - {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\qrr@tikz@lr@lineto@next} - {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\qrr@tikz@lr@lineto@next}{\tikz@scan@one@point\qrr@tikz@@lr@lineto}}}}% -\def\qrr@tikz@rl@lineto@next{% - \pgfutil@ifnextchar n{\tikz@collect@label@onpath\qrr@tikz@rl@lineto@next} - {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\qrr@tikz@rl@lineto@next} - {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\qrr@tikz@rl@lineto@next}{\tikz@scan@one@point\qrr@tikz@@rl@lineto}}}}% - -\def\tikz@do@hvvh#1#2#3#4#5{% -% #1 = first kink -% #2 = second kink -% #3 = end -% #4 = timer -% #5 = tikz@shapeborder@name - \pgfpathlineto{#1}% - \pgfpathlineto{#2}% - \pgfpathlineto{#3}% - \def\tikz@timer@middle{#2}% - \def\tikz@timer@end{#3}% - \let\tikz@timer#4 - \edef\pgf@temp{#5}% - \ifx\pgf@temp\pgfutil@empty - \let\tikz@moveto@waiting\relax - \else - \let\tikz@moveto@waiting\pgf@temp - \fi - \tikz@scan@next@command}% - -%% -|- operator -\def\qrr@tikz@@hvh@lineto#1{% - \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \pgf@xb=\tikz@lastx - \pgf@xc=\tikz@lastx - \pgf@yc=\tikz@lasty - \tikz@make@last@position{#1}% - \tikz@flush@moveto@toward{\pgfqpoint{\tikz@lastx}{\pgf@yc}}\pgf@xc\pgf@yc - \begingroup - \pgfqkeys{/tikz/hvvh}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% - \iftikz@shapeborder - \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\pgf@xb}{\tikz@lasty}}}% - \ifqrr@tikz@hvvh@fromcenter - \pgf@xc\pgf@xb - \fi - \pgfutil@ifxempty\qrr@tikz@hvvh@ratio{% - \ifdim\qrr@tikz@hvvh@distance<0pt\relax - \ifqrr@tikz@hvvh@fromcenter - \pgf@xc\tikz@lastx - \else - \pgf@xc\pgf@x - \fi - \fi - \ifdim\pgf@xb>\tikz@lastx - \qrr@tikz@hvvh@distance-\qrr@tikz@hvvh@distance - \fi - }{% - \ifqrr@tikz@hvvh@fromcenter - \qrr@tikz@hvvh@distance\tikz@lastx - \else - \qrr@tikz@hvvh@distance\pgf@x - \fi - \advance\qrr@tikz@hvvh@distance-\pgf@xc - \qrr@tikz@hvvh@distance\qrr@tikz@hvvh@ratio\qrr@tikz@hvvh@distance - }% - \advance\pgf@xc\qrr@tikz@hvvh@distance - \edef\pgf@tempa{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% - \edef\pgf@tempb{\noexpand\pgfqpoint{\the\pgf@xc}{\the\tikz@lasty}}% - \edef\pgf@temp{\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% - \else - \let\tikz@shapeborder@name\pgfutil@empty - \ifqrr@tikz@hvvh@fromcenter - \pgf@xc\pgf@xb - \fi - \pgfutil@ifxempty\qrr@tikz@hvvh@ratio{% - \ifdim\qrr@tikz@hvvh@distance<0pt\relax - \pgf@xc\tikz@lastx - \fi - \ifdim\pgf@xb>\tikz@lastx - \qrr@tikz@hvvh@distance-\qrr@tikz@hvvh@distance - \fi - }{% - \qrr@tikz@hvvh@distance\tikz@lastx - \advance\qrr@tikz@hvvh@distance-\pgf@xc - \qrr@tikz@hvvh@distance\qrr@tikz@hvvh@ratio\qrr@tikz@hvvh@distance - }% - \advance\pgf@xc\qrr@tikz@hvvh@distance - \edef\pgf@tempa{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% - \edef\pgf@tempb{\noexpand\pgfqpoint{\the\pgf@xc}{\the\tikz@lasty}}% - \edef\pgf@temp{\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \fi% - \xdef\pgf@marshal{% - \noexpand\tikz@do@hvvh - {\expandafter\noexpand\pgf@tempa}% - {\expandafter\noexpand\pgf@tempb}% - {\expandafter\noexpand\pgf@temp}% - {\noexpand\tikz@timer@hvhline}{\tikz@shapeborder@name}}% - \endgroup - \pgf@marshal}% - -%% |-| operator -\def\qrr@tikz@@vhv@lineto#1{% - \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \pgf@xc=\tikz@lastx - \pgf@yb=\tikz@lasty - \pgf@yc=\tikz@lasty - \tikz@make@last@position{#1}% - \tikz@flush@moveto@toward{\pgfqpoint{\pgf@xc}{\tikz@lasty}}\pgf@xc\pgf@yc - \begingroup - \pgfqkeys{/tikz/hvvh}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% - \iftikz@shapeborder - \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\tikz@lastx}{\pgf@yb}}}% - \ifqrr@tikz@hvvh@fromcenter - \pgf@yc\pgf@yb - \fi - \ifx\qrr@tikz@hvvh@ratio\pgfutil@empty - \ifdim\qrr@tikz@hvvh@distance<0pt\relax - \ifqrr@tikz@hvvh@fromcenter - \pgf@yc\tikz@lasty - \else - \pgf@yc\pgf@y - \fi - \fi - \ifdim\pgf@yb>\tikz@lasty - \qrr@tikz@hvvh@distance-\qrr@tikz@hvvh@distance - \fi - \else - \ifqrr@tikz@hvvh@fromcenter - \qrr@tikz@hvvh@distance\tikz@lasty - \else - \qrr@tikz@hvvh@distance\pgf@y - \fi - \advance\qrr@tikz@hvvh@distance-\pgf@yc - \qrr@tikz@hvvh@distance\qrr@tikz@hvvh@ratio\qrr@tikz@hvvh@distance - \fi - \advance\pgf@yc\qrr@tikz@hvvh@distance - \edef\pgf@tempa{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% - \edef\pgf@tempb{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\pgf@yc}}% - \edef\pgf@temp{\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% - \else - \let\tikz@shapeborder@name\pgfutil@empty - \ifqrr@tikz@hvvh@fromcenter - \pgf@yc\pgf@yb - \fi - \ifx\qrr@tikz@hvvh@ratio\pgfutil@empty - \ifdim\qrr@tikz@hvvh@distance<0pt\relax - \pgf@yc\tikz@lasty - \fi - \ifdim\pgf@yb>\tikz@lasty - \qrr@tikz@hvvh@distance-\qrr@tikz@hvvh@distance - \fi - \else - \qrr@tikz@hvvh@distance\tikz@lasty - \advance\qrr@tikz@hvvh@distance-\pgf@yc - \qrr@tikz@hvvh@distance\qrr@tikz@hvvh@ratio\qrr@tikz@hvvh@distance - \fi - \advance\pgf@yc\qrr@tikz@hvvh@distance - \edef\pgf@tempa{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% - \edef\pgf@tempb{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\pgf@yc}}% - \edef\pgf@temp{\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \fi% - \xdef\pgf@marshal{% - \noexpand\tikz@do@hvvh - {\expandafter\noexpand\pgf@tempa}% - {\expandafter\noexpand\pgf@tempb}% - {\expandafter\noexpand\pgf@temp}% - {\noexpand\tikz@timer@vhvline}{\tikz@shapeborder@name}}% - \endgroup - \pgf@marshal}% - -%% r-ud operator -\def\qrr@tikz@@ud@lineto#1{% - \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \pgf@xc\tikz@lastx - \pgf@yb\tikz@lasty - \advance\tikz@lasty1pt% - \let\pgf@temp\tikz@moveto@waiting - \tikz@flush@moveto@toward{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}\pgf@xc\pgf@yc - \tikz@make@last@position{#1}% - \begingroup - \pgfqkeys{/tikz/udlr}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% - \pgfmathsetlength\qrr@tikz@udlr@distance{\pgfkeysvalueof{/tikz/udlr/ud distance}}% - \iftikz@shapeborder - \advance\pgf@y1pt% - \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\pgf@x}{\pgf@y}}}% - \ifqrr@tikz@hvvh@fromcenter - \pgf@yc\pgf@yb - \else\ifx\pgf@temp\relax - \pgf@yc\pgf@yb - \fi - \fi - \ifdim\pgf@yc<\pgf@y - \ifqrr@tikz@hvvh@fromcenter - \pgf@yc=\tikz@lasty - \else - \pgf@yc=\pgf@y - \fi - \fi - \advance\pgf@yc\qrr@tikz@udlr@distance - \edef\pgf@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% - \else - \let\tikz@shapeborder@name\pgfutil@empty - \ifx\pgf@temp\relax\else - \ifqrr@tikz@hvvh@fromcenter\else - \pgf@yb\pgf@yc - \fi - \fi - \ifdim\pgf@yb<\tikz@lasty\pgf@yb\tikz@lasty\fi - \advance\pgf@yb\qrr@tikz@udlr@distance - \pgf@yc\pgf@yb - \edef\pgf@temp{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \fi - \xdef\pgf@marshal{% - \noexpand\tikz@do@hvvh - {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% - {\noexpand\pgfqpoint{\the\tikz@lastx}{\the\pgf@yc}}% - {\expandafter\noexpand\pgf@temp}% - {\noexpand\tikz@timer@vhvline}{\tikz@shapeborder@name}}% - \endgroup - \pgf@marshal}% - -%% r-du operator -\def\qrr@tikz@@du@lineto#1{% - \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \pgf@xc\tikz@lastx - \pgf@yb\tikz@lasty - \advance\tikz@lasty-1pt% - \let\pgf@temp\tikz@moveto@waiting - \tikz@flush@moveto@toward{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}\pgf@xc\pgf@yc - \tikz@make@last@position{#1}% - \begingroup - \pgfqkeys{/tikz/udlr}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% - \pgfmathsetlength\qrr@tikz@udlr@distance{\pgfkeysvalueof{/tikz/udlr/du distance}}% - \iftikz@shapeborder - \advance\pgf@y-1pt% - \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\pgf@x}{\pgf@y}}}% - \ifqrr@tikz@hvvh@fromcenter - \pgf@yc\pgf@yb - \else\ifx\pgf@temp\relax - \pgf@yc\pgf@yb - \fi - \fi - \ifdim\pgf@yc>\pgf@y - \ifqrr@tikz@hvvh@fromcenter - \pgf@yc=\tikz@lasty - \else - \pgf@yc=\pgf@y - \fi - \fi - \advance\pgf@yc-\qrr@tikz@udlr@distance - \edef\pgf@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% - \else - \let\tikz@shapeborder@name\pgfutil@empty - \ifx\pgf@temp\relax\else - \ifqrr@tikz@hvvh@fromcenter\else - \pgf@yb\pgf@yc - \fi - \fi - \ifdim\pgf@yb>\tikz@lasty\pgf@yb\tikz@lasty\fi - \advance\pgf@yb-\qrr@tikz@udlr@distance - \pgf@yc\pgf@yb - \edef\pgf@temp{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \fi - \xdef\pgf@marshal{% - \noexpand\tikz@do@hvvh - {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% - {\noexpand\pgfqpoint{\the\tikz@lastx}{\the\pgf@yc}}% - {\expandafter\noexpand\pgf@temp}% - {\noexpand\tikz@timer@vhvline}{\tikz@shapeborder@name}}% - \endgroup - \pgf@marshal}% - -%% r-lr operator -\def\qrr@tikz@@lr@lineto#1{% - \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \pgf@xb\tikz@lastx - \pgf@yc\tikz@lasty - \advance\tikz@lastx-1pt% - \let\pgf@temp\tikz@moveto@waiting - \tikz@flush@moveto@toward{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}\pgf@xc\pgf@yc - \tikz@make@last@position{#1}% - \begingroup - \pgfqkeys{/tikz/udlr}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% - \pgfmathsetlength\qrr@tikz@udlr@distance{\pgfkeysvalueof{/tikz/udlr/lr distance}}% - \iftikz@shapeborder - \advance\pgf@x-1pt% - \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\pgf@x}{\pgf@y}}}% - \ifqrr@tikz@hvvh@fromcenter - \pgf@xc\pgf@xb - \else\ifx\pgf@temp\relax - \pgf@xc\pgf@xb - \fi - \fi - \ifdim\pgf@xc>\pgf@x - \ifqrr@tikz@hvvh@fromcenter - \pgf@xc=\tikz@lastx - \else - \pgf@xc=\pgf@x - \fi - \fi - \advance\pgf@xc-\qrr@tikz@udlr@distance - \edef\pgf@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% - \else - \let\tikz@shapeborder@name\pgfutil@empty - \ifx\pgf@temp\relax\else - \ifqrr@tikz@hvvh@fromcenter\else - \pgf@xb\pgf@xc - \fi - \fi - \ifdim\pgf@xb>\tikz@lastx\pgf@xb\tikz@lastx\fi - \advance\pgf@xb-\qrr@tikz@udlr@distance - \pgf@xc\pgf@xb - \edef\pgf@temp{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \fi - \xdef\pgf@marshal{% - \noexpand\tikz@do@hvvh - {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% - {\noexpand\pgfqpoint{\the\pgf@xc}{\the\tikz@lasty}}% - {\expandafter\noexpand\pgf@temp}% - {\noexpand\tikz@timer@hvhline}{\tikz@shapeborder@name}}% - \endgroup - \pgf@marshal}% - -%% r-rl operator -\def\qrr@tikz@@rl@lineto#1{% - \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \pgf@xb\tikz@lastx - \pgf@yc\tikz@lasty - \advance\tikz@lastx1pt% - \let\pgf@temp\tikz@moveto@waiting - \tikz@flush@moveto@toward{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}\pgf@xc\pgf@yc - \tikz@make@last@position{#1}% - \begingroup - \pgfqkeys{/tikz/udlr}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% - \pgfmathsetlength\qrr@tikz@udlr@distance{\pgfkeysvalueof{/tikz/udlr/rl distance}}% - \iftikz@shapeborder% - \advance\pgf@x1pt% - \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\pgf@x}{\pgf@y}}}% - \ifqrr@tikz@hvvh@fromcenter - \pgf@xc\pgf@xb - \else\ifx\pgf@temp\relax - \pgf@xc\pgf@xb - \fi - \fi - \ifdim\pgf@xc<\pgf@x - \ifqrr@tikz@hvvh@fromcenter - \pgf@xc=\tikz@lastx - \else - \pgf@xc=\pgf@x - \fi - \fi - \advance\pgf@xc\qrr@tikz@udlr@distance - \edef\pgf@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% - \else - \let\tikz@shapeborder@name\pgfutil@empty% - \ifx\pgf@temp\relax\else - \ifqrr@tikz@hvvh@fromcenter\else - \pgf@xb\pgf@xc - \fi - \fi - \ifdim\pgf@xb<\tikz@lastx\pgf@xb\tikz@lastx\fi - \advance\pgf@xb\qrr@tikz@udlr@distance - \pgf@xc\pgf@xb - \edef\pgf@temp{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \fi - \xdef\pgf@marshal{% - \noexpand\tikz@do@hvvh - {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% - {\noexpand\pgfqpoint{\the\pgf@xc}{\the\tikz@lasty}}% - {\expandafter\noexpand\pgf@temp}% - {\noexpand\tikz@timer@hvhline}{\tikz@shapeborder@name}}% - \endgroup - \pgf@marshal}% -\endinput diff --git a/graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.timer.code.tex b/graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.timer.code.tex deleted file mode 100644 index 3a4d30e68f..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tikzlibrarypaths.timer.code.tex +++ /dev/null @@ -1,188 +0,0 @@ -% 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. -% -\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}}% - \let\tikz@timer\tikz@timer@rectangle% %% Timer: new timer - \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}}% - \iftikz@snaked - \tikz@path@lineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}% - \fi - \pgfpathclose - \tikz@@movetosave{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}% - \def\pgfstrokehook{}% - \let\tikz@tangent\relax - \tikz@scan@next@command -}% - -\def\tikz@@sine#1{% originally from tikz.code.tex - \let\tikz@tangent\tikz@tangent@lookup - \tikz@flush@moveto - \edef\tikz@timer@start{\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% %% Timer: save start position - \pgf@process{#1}% - \edef\tikz@timer@end{\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% %% Timer: saver target position - \pgf@xc=\pgf@x - \pgf@yc=\pgf@y - \advance\pgf@xc by-\tikz@lastx - \advance\pgf@yc by-\tikz@lasty - \advance\tikz@lastx by\pgf@xc - \advance\tikz@lasty by\pgf@yc - \tikz@lastxsaved=\tikz@lastx - \tikz@lastysaved=\tikz@lasty - \tikz@updatecurrenttrue - \let\tikz@timer=\tikz@timer@sine% %% Timer: new timer - \pgfpathsine{\pgfqpoint{\pgf@xc}{\pgf@yc}}% - \tikz@scan@next@command -} - -\def\tikz@@cosine#1{% originally from tikz.code.tex - \let\tikz@tangent\tikz@tangent@lookup - \tikz@flush@moveto - \edef\tikz@timer@start{\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% %% Timer: save start position - \pgf@process{#1}% - \edef\tikz@timer@end{\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% %% Timer: save target position - \pgf@xc=\pgf@x - \pgf@yc=\pgf@y - \advance\pgf@xc by-\tikz@lastx - \advance\pgf@yc by-\tikz@lasty - \advance\tikz@lastx by\pgf@xc - \advance\tikz@lasty by\pgf@yc - \tikz@lastxsaved=\tikz@lastx - \tikz@lastysaved=\tikz@lasty - \tikz@updatecurrenttrue - \let\tikz@timer=\tikz@timer@cosine% %% Timer: new timer - \pgfpathcosine{\pgfqpoint{\pgf@xc}{\pgf@yc}}% - \tikz@scan@next@command -} - -\def\tikz@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 - \let\pgf@tempa\tikz@timer@start - \let\tikz@timer@start\tikz@timer@end - \let\tikz@timer@end\pgf@tempa - \fi - \multiply\pgfutil@tempdima2 - \edef\tikz@time{\strip@pt\pgfutil@tempdima}% - \tikz@timer@hvline}% - -\def\tikz@parabola@semifinal#1{% - \tikz@flush@moveto - % Save original start: - \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% %% Timer: save start position - \pgf@xb=\tikz@lastx - \pgf@yb=\tikz@lasty - \tikz@make@last@position{#1}% - \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% %% Timer: save target position - \pgf@xc=\tikz@lastx - \pgf@yc=\tikz@lasty - \begingroup% now calculate bend: - \let\tikz@after@path\pgfutil@empty - \expandafter\tikzset\expandafter{\tikz@parabola@option}% - \tikz@lastxsaved=\tikz@parabola@bend@factor\tikz@lastx - \tikz@lastysaved=\tikz@parabola@bend@factor\tikz@lasty - \advance\tikz@lastxsaved by\pgf@xb - \advance\tikz@lastysaved by\pgf@yb - \advance\tikz@lastxsaved by-\tikz@parabola@bend@factor\pgf@xb - \advance\tikz@lastysaved by-\tikz@parabola@bend@factor\pgf@yb - \expandafter\tikz@make@last@position\expandafter{\tikz@parabola@bend}% - \edef\tikz@timer@middle{{\the\tikz@lastx}{\the\tikz@lasty}}% %% Timer: save bend postion - % Calculate delta from bend - \advance\pgf@xc by-\tikz@lastx - \advance\pgf@yc by-\tikz@lasty - % Ok, now calculate delta to bend - \advance\tikz@lastx by-\pgf@xb - \advance\tikz@lasty by-\pgf@yb - \edef\tikz@marshall{% - \noexpand\let\noexpand\tikz@timer\noexpand\tikz@timer@parabola - \noexpand\edef\noexpand\tikz@timer@middle{\noexpand\pgfqpoint\tikz@timer@middle}% - \noexpand\pgfpathparabola{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% - }% - \expandafter\endgroup% - \tikz@marshall - \expandafter\tikz@scan@next@command\tikz@after@path% -}% - -\def\tikz@timer@parabola{% following calculations, see \def of \pgfpathparabola in pgfcorepathconstruct.code.tex (l. 1261) - \ifdim\tikz@time pt<.5pt\relax % first part - \pgf@process{\tikz@timer@middle}% - \pgf@xc\pgf@x\pgf@yc\pgf@y - \pgf@xb\pgf@x\pgf@yb\pgf@y - \pgf@process{\tikz@timer@start}% - \advance\pgf@xc-\pgf@x\pgf@xc.1125\pgf@xc - \advance\pgf@xc\pgf@x % = start_x + .1125 (middle_x - start_x) - \advance\pgf@yc-\pgf@y\pgf@yc.225\pgf@yc - \advance\pgf@yc\pgf@y % = start_y + .225 (middle_y - start_y) - \advance\pgf@xb\pgf@x\pgf@xb.5\pgf@xb % = .5 (middle_x + start_x) = start_x + .5 (middle_x - start_x) - \pgf@xa=\tikz@time pt% - \pgf@xa=2\pgf@xa % = 2 * \tikz@time - \edef\tikz@marshall{\noexpand\pgftransformcurveattime{\strip@pt\pgf@xa}{\noexpand\tikz@timer@start}% - {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% - {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% - {\noexpand\tikz@timer@middle}}% - \else % second part - \pgf@process{\tikz@timer@end}% - \pgf@xc\pgf@x - \pgf@xb\pgf@x - \pgf@yb\pgf@y - \pgf@process{\tikz@timer@middle}% - \advance\pgf@xc\pgf@x\pgf@xc.5\pgf@xc % = .5 (end_x + middle_x) = middle_x + .5 (end_x - middle_x) - \advance\pgf@xb-\pgf@x\pgf@xb.8875\pgf@xb - \advance\pgf@xb\pgf@x % = middle_x + .8875 (end_x - middle_x) - \advance\pgf@yb-\pgf@y\pgf@yb.775\pgf@yb - \advance\pgf@yb\pgf@y % = middle_y + .775 (end_y - middle_y) - \pgf@xa=\tikz@time pt% - \advance\pgf@xa-.5pt% - \pgf@xa=2\pgf@xa % = 2 (\tikz@zime - .5) - \edef\tikz@marshall{\noexpand\pgftransformcurveattime{\strip@pt\pgf@xa}{\noexpand\tikz@timer@middle}% - {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@y}}% - {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% - {\noexpand\tikz@timer@end}}% - \fi - \tikz@marshall -} - -\def\tikz@timer@sine{% following calculations, see \def of \pgfpathsine in pgfcorepathconstruct.code.tex (l. 1315) - \pgf@process{\tikz@timer@end}% - \pgf@xc\pgf@x\pgf@yc\pgf@y - \pgf@xb\pgf@x\pgf@yb\pgf@y - \pgf@process{\tikz@timer@start}% - \advance\pgf@xc-\pgf@x\pgf@xc.3260\pgf@xc - \advance\pgf@xc\pgf@x % = start_x + .3260 (end_x - start_x) - \advance\pgf@yc-\pgf@y\pgf@yc.5120\pgf@yc - \advance\pgf@yc\pgf@y % = start_y + .5120 (end_y - start_y) - \advance\pgf@xb-\pgf@x\pgf@xb.6380\pgf@xb % = start_x + .6380 (end_x - start_x) - \advance\pgf@xb\pgf@x - \edef\tikz@marshall{\noexpand\pgftransformcurveattime{\tikz@time}{\noexpand\tikz@timer@start}% - {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% - {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% - {\noexpand\tikz@timer@end}}% - \tikz@marshall -} -\def\tikz@timer@cosine{% following calculations, see \def of \pgfpathcosine in pgfcorepathconstruct.code.tex (l. 1345) - \pgf@process{\tikz@timer@end}% - \pgf@xc\pgf@x\pgf@yc\pgf@y - \pgf@xb\pgf@x\pgf@yb\pgf@y - \pgf@process{\tikz@timer@start}% - \advance\pgf@xb-\pgf@x\pgf@xb.6740\pgf@xb - \advance\pgf@xb\pgf@x % = start_x + .6740 (end_x - start_x) - \advance\pgf@yb-\pgf@y\pgf@yb.4880\pgf@yb - \advance\pgf@yb\pgf@y % = start_y + .4880 (end_y - start_y) - \advance\pgf@xc-\pgf@x\pgf@xc.3620\pgf@xc % = start_x + .3620 (end_x - start_x) - \advance\pgf@xc\pgf@x - \edef\tikz@marshall{\noexpand\pgftransformcurveattime{\tikz@time}{\noexpand\tikz@timer@start}% - {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@y}}% - {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% - {\noexpand\tikz@timer@end}}% - \tikz@marshall -} -\endinput \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tikzlibrarypatterns.images.code.tex b/graphics/pgf/contrib/tikz-ext/tikzlibrarypatterns.images.code.tex deleted file mode 100644 index 7cad25e42b..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tikzlibrarypatterns.images.code.tex +++ /dev/null @@ -1,53 +0,0 @@ -% This is the TikZ library patterns.images -% Load with \usetikzlibrary{patterns.images} -% -% Macro: -% - \pgfSetupImageAsPattern[]{}{} -% -% Keys are: -% - use image as pattern= -% - image as pattern= - -\def\pgfsetupimageaspattern{\pgfutil@ifnextchar[\qrr@pgfsetupimageaspattern{\qrr@pgfsetupimageaspattern[]}} -\def\qrr@pgfsetupimageaspattern[#1]#2#3{% #1 = options - % #2 = image name - % #3 = file name - \pgfdeclareimage[#1]{qrr@pgf@iap@#2}{#3}% - \sbox\pgfutil@tempboxa{\pgfuseimage{qrr@pgf@iap@#2}}% - \expandafter\edef\csname qrr@pgf@iap@#2@\endcsname{{\the\wd\pgfutil@tempboxa}{\the\ht\pgfutil@tempboxa}}% -} -\tikzset{ - image as pattern/name/.initial=, - image as pattern/option/.style=, - image as pattern/options/.style={/tikz/image as pattern/option/.append style={#1}}, - image as pattern/.default=, - image as pattern/.code={ - \tikzset{image as pattern/.cd,#1} - \pgfkeysgetvalue{/tikz/image as pattern/name}\tikz@temp - \pgfutil@ifxempty\tikz@temp{% - \tikzerror{You need to specify a name for the ``image-pattern'' to be used.}% - }{% - \edef\tikz@tempa{\expandafter\expandafter\expandafter\pgfutil@firstoftwo\csname qrr@pgf@iap@\tikz@temp @\endcsname}% - \edef\tikz@tempb{\expandafter\expandafter\expandafter\pgfutil@secondoftwo\csname qrr@pgf@iap@\tikz@temp @\endcsname}% - \pgfkeysalso{/tikz/path picture={% - \pgf@process{\pgfpointanchor{path picture bounding box}{north east}}% - \pgf@xa\pgf@x\pgf@ya\pgf@y - \pgf@process{\pgfpointanchor{path picture bounding box}{south west}}% - \pgf@xb\pgf@x\pgf@yb\pgf@y\pgf@yc\pgf@yb - \pgfutil@loop - {% - \pgfutil@loop - \expandafter\pgftext\expandafter[/tikz/image as pattern/option,at=\pgfqpoint{\pgf@xb}{\pgf@yb}]{\pgfuseimage{qrr@pgf@iap@\tikz@temp}}% - \ifdim\pgf@yb<\pgf@ya - \advance\pgf@yb\tikz@tempb - \pgfutil@repeat - }% - \ifdim\pgf@xb<\pgf@xa - \advance\pgf@xb\tikz@tempa - \pgf@yb\pgf@yc - \pgfutil@repeat - }}% - } - } -} -\endinput diff --git a/graphics/pgf/contrib/tikz-ext/tikzlibrarytopaths.arcthrough.code.tex b/graphics/pgf/contrib/tikz-ext/tikzlibrarytopaths.arcthrough.code.tex deleted file mode 100644 index d90a2edc78..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tikzlibrarytopaths.arcthrough.code.tex +++ /dev/null @@ -1,50 +0,0 @@ -% 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. -% - -\pgfqkeys{/tikz/arc through}{ - .unknown/.code=\pgfkeyssetevalue{/tikz/arc through/through}{\pgfkeyscurrentname}, - through/.initial={(0,0)}, - center suffix/.initial=, - clockwise/.code=% - \def\tikz@arcthrough@clockwise{% - \pgfmathsubtract@{\pgfkeysvalueof{/tikz/end angle}}{360}% - \pgfkeyssetevalue{/tikz/end angle}{+\pgfmathresult}}, - counter clockwise/.code=\let\tikz@arcthrough@clockwise\relax, - clockwise/.value forbidden, counter clockwise/.value forbidden, counter clockwise} -\tikzset{ - arc through/.code={% - \tikzset{every arc through/.try}% - \pgfqkeys{/tikz/arc through}{#1}% - \pgfkeysgetvalue{/tikz/arc through/through}\tikz@temp - \pgfextract@process\pgf@tostart{\tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax}% - \expandafter\pgfextract@process\expandafter\pgf@tothrough\expandafter - {\expandafter\tikz@scan@one@point\expandafter\pgfutil@firstofone\tikz@temp\relax}% - \pgfextract@process\pgf@totarget{\tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax}% - \pgfextract@process\pgf@topointMidA{\pgfpointlineattime{.5}{\pgf@tostart}{\pgf@tothrough}}% - \pgfextract@process\pgf@topointMidB{\pgfpointlineattime{.5}{\pgf@totarget}{\pgf@tothrough}}% - \pgfextract@process\pgf@tocenter{% - \pgfpointintersectionoflines - {\pgf@topointMidA}{\pgfmathrotatepointaround{\pgf@tothrough}{\pgf@topointMidA}{90}}% - {\pgf@topointMidB}{\pgfmathrotatepointaround{\pgf@tothrough}{\pgf@topointMidB}{90}}}% - \pgfcoordinate{arc through center\pgfkeysvalueof{/tikz/arc through/center suffix}}{\pgf@tocenter}% - \pgfpointdiff{\pgf@tocenter}{\pgf@tostart}% - \pgfmathveclen@{\pgfmath@tonumber\pgf@x}{\pgfmath@tonumber\pgf@y}% - \pgfkeyssetevalue{/tikz/x radius}{+\pgfmathresult pt}% - \pgfkeyssetevalue{/tikz/y radius}{+\pgfmathresult pt}% - \pgfmathanglebetweenpoints{\pgf@tocenter}{\pgf@totarget}% - \pgfkeyssetevalue{/tikz/end angle}{+\pgfmathresult}% - \pgfmathanglebetweenpoints{\pgf@tocenter}{\pgf@tostart}% - \ifdim\pgfmathresult pt>\pgfkeysvalueof{/tikz/end angle}pt\relax - \pgfmathsubtract@{\pgfmathresult}{360}% - \fi - \pgfkeyssetevalue{/tikz/start angle}{+\pgfmathresult}% - \tikz@arcthrough@clockwise - \pgfkeyslet{/tikz/delta angle}\pgfutil@empty - \def\tikz@to@path{arc[]\tikztonodes}% - }% -} diff --git a/graphics/pgf/contrib/tikz-ext/tikzlibrarytransformations.mirror.code.tex b/graphics/pgf/contrib/tikz-ext/tikzlibrarytransformations.mirror.code.tex deleted file mode 100644 index 7b5b02f722..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tikzlibrarytransformations.mirror.code.tex +++ /dev/null @@ -1,70 +0,0 @@ -% 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. -% -\usepgflibrary{transformations.mirror} -\tikzset{ - mirror/.code={% - \pgfutil@in@{--}{#1}% - \ifpgfutil@in@ - \tikz@trans@mirror#1\@nil - \else - \tikz@scan@one@point\pgfqtransformmirror#1\relax - \fi}, - ymirror/.code={\pgfutil@ifnextchar(\tikz@trans@ymirror@coordinate\tikz@trans@ymirror@simple#1\@nil}, - xmirror/.code={\pgfutil@ifnextchar(\tikz@trans@xmirror@coordinate\tikz@trans@xmirror@simple#1\@nil}, - mirror x/.code={% - \pgfextract@process\tikz@temp{\tikz@scan@one@point\pgfutil@firstofone#1\relax}% - \pgftransformmirror{\tikz@temp}{\pgfpointadd{\tikz@temp}{\pgfqpointxy{0}{1}}}}, - mirror y/.code={% - \pgfextract@process\tikz@temp{\tikz@scan@one@point\pgfutil@firstofone#1\relax}% - \pgftransformmirror{\tikz@temp}{\pgfpointadd{\tikz@temp}{\pgfqpointxy{1}{0}}}}, - mirror/.value required, - ymirror/.value required, - xmirror/.value required, - mirror x/.value required, - mirror y/.value required} -\def\tikz@trans@mirror#1--#2\@nil{% - \pgftransformmirror{\tikz@scan@one@point\pgfutil@firstofone#1\relax} - {\tikz@scan@one@point\pgfutil@firstofone#2\relax}} -\def\tikz@trans@xmirror@simple#1\@nil{\pgftransformxmirror{#1}} -\def\tikz@trans@ymirror@simple#1\@nil{\pgftransformymirror{#1}} -\def\tikz@trans@xmirror@coordinate#1\@nil{% - \tikz@scan@one@point\pgfutil@firstofone#1\pgftransformxmirror{+\the\pgf@x}} -\def\tikz@trans@ymirror@coordinate#1\@nil{% - \tikz@scan@one@point\pgfutil@firstofone#1\pgftransformymirror{+\the\pgf@y}} - -\tikzset{ - Mirror/.code={% - \pgfutil@in@{--}{#1}% - \ifpgfutil@in@ - \tikz@trans@Mirror#1\@nil - \else - \tikz@scan@one@point\pgfqtransformMirror#1\relax - \fi}, - yMirror/.code={\pgfutil@ifnextchar(\tikz@trans@yMirror@coordinate\tikz@trans@yMirror@simple#1\@nil}, - xMirror/.code={\pgfutil@ifnextchar(\tikz@trans@xMirror@coordinate\tikz@trans@xMirror@simple#1\@nil}, - Mirror x/.code={% - \pgfextract@process\tikz@temp{\tikz@scan@one@point\pgfutil@firstofone#1\relax}% - \pgftransformMirror{\tikz@temp}{\pgfpointadd{\tikz@temp}{\pgfqpointxy{0}{1}}}}, - Mirror y/.code={% - \pgfextract@process\tikz@temp{\tikz@scan@one@point\pgfutil@firstofone#1\relax}% - \pgftransformMirror{\tikz@temp}{\pgfpointadd{\tikz@temp}{\pgfqpointxy{1}{0}}}}, - Mirror/.value required, - yMirror/.value required, - xMirror/.value required, - Mirror x/.value required, - Mirror y/.value required} -\def\tikz@trans@Mirror#1--#2\@nil{% - \pgftransformMirror{\tikz@scan@one@point\pgfutil@firstofone#1\relax} - {\tikz@scan@one@point\pgfutil@firstofone#2\relax}} -\def\tikz@trans@xMirror@simple#1\@nil{\pgftransformxMirror{#1}} -\def\tikz@trans@yMirror@simple#1\@nil{\pgftransformyMirror{#1}} -\def\tikz@trans@xMirror@coordinate#1\@nil{% - \tikz@scan@one@point\pgfutil@firstofone#1\pgftransformxMirror{+\the\pgf@x}} -\def\tikz@trans@yMirror@coordinate#1\@nil{% - \tikz@scan@one@point\pgfutil@firstofone#1\pgftransformyMirror{+\the\pgf@y}} -\endinput -- cgit v1.2.3