summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/tikz-ext/tikz-ext-manual-en-library-misc.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-10-23 20:36:18 +0000
committerKarl Berry <karl@freefriends.org>2022-10-23 20:36:18 +0000
commit02b6a167032c7f09e9336401ffe1f2501b881e1d (patch)
tree550df44acc7aae00d6700b7bfa5d5e04084d9b99 /Master/texmf-dist/doc/latex/tikz-ext/tikz-ext-manual-en-library-misc.tex
parent082beda64173443df9fd678021fcf187a4b053ad (diff)
tikz-ext (23oct22)
git-svn-id: svn://tug.org/texlive/trunk@64788 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/tikz-ext/tikz-ext-manual-en-library-misc.tex')
-rw-r--r--Master/texmf-dist/doc/latex/tikz-ext/tikz-ext-manual-en-library-misc.tex113
1 files changed, 78 insertions, 35 deletions
diff --git a/Master/texmf-dist/doc/latex/tikz-ext/tikz-ext-manual-en-library-misc.tex b/Master/texmf-dist/doc/latex/tikz-ext/tikz-ext-manual-en-library-misc.tex
index 163097e6a13..44228a5445c 100644
--- a/Master/texmf-dist/doc/latex/tikz-ext/tikz-ext-manual-en-library-misc.tex
+++ b/Master/texmf-dist/doc/latex/tikz-ext/tikz-ext-manual-en-library-misc.tex
@@ -136,14 +136,38 @@ them in |"|.
(intersection of @--[shift=(vecB)]@ and B--A) coordinate (A);}
\end{tikzpicture}
\end{codeexample}
-\pagebreak
+
+\subsection{\pgfname for}
+
+Instead of |\foreach \var in {start, start + delta, ..., end}| one can use
+|\foreach \var[use int=start to end step delta]|.
+
+\begin{key}{/pgf/foreach/use int=\meta{start}|to|\meta{end}\opt{|step|\meta{delta}}}
+The values \meta{start}, \meta{end} and \meta{delta} are evaluates by \pgfname math at initialization.
+The part |step |\meta{delta} is optional (\meta{delta} = 1).
+\end{key}
+
+\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}
+
+%TODO: edges to and edges through
+%\pagebreak
+
\subsection{\pgfname keys}
-%
+\begin{pgfkeyslibrary}{ext.pgfkeys-plus}
+ This extends \pgfname keys and adds helpful |/utils| keys as well as handlers.
+ This library gets loaded by the |ext.misc| library.%
+ \footnote{\texttt{\string\usepgfkeyslibrary} is an upcoming feature of \pgfname/\tikzname.
+ For now, you need to load \texttt{ext.misc}
+ or manually \texttt{\string\input} the file \texttt{pgfkeyslibraryext.pgfkeys-plus.code.tex}
+ with \texttt{@} being a letter.}
+\end{pgfkeyslibrary}
+
\begin{multicols}{2}
-%
\subsubsection{Conditionals}
-\begin{key}{/utils/if=\meta{cond}\meta{true}\opt{\meta{false}}}
+\begin{key}{/utils/if=\marg{cond}\marg{true}\opt{\marg{false}}}
This key checks the conditional \meta{cond} and applies the styles \meta{true}
if \meta{cond} is true, otherwise \meta{false}.
\meta{cond} can be anything that \pgfname math understands.
@@ -155,7 +179,7 @@ them in |"|.
The following keys use \TeX' macros |\if|, |\ifx|, |\ifnum| and |\ifdim| for faster
executions.
-\begin{key}{/utils/TeX/if=\meta{token A}\meta{token B}\meta{true}\opt{\meta{false}}}
+\begin{key}{/utils/TeX/if=\meta{token A}\meta{token B}\marg{true}\opt{\marg{false}}}
This key checks via |\if| if \meta{token A} matches \meta{token B}
and applies the styles \meta{true} if it does, otherwise \meta{false}.
@@ -163,28 +187,31 @@ executions.
actually optional.
\end{key}
-\begin{key}{/utils/TeX/ifx=\meta{token A}\meta{token B}\meta{true}\opt{\meta{false}}}
- As above.
+\begin{key}{/utils/TeX/ifx=\meta{token A}\meta{token B}\marg{true}\opt{\marg{false}}}
+ As above but via |\ifx|.
\end{key}
-\begin{key}{/utils/TeX/ifnum=\meta{num cond}\meta{true}\\opt{\meta{false}}}
+\begin{key}{/utils/TeX/ifnum=\marg{num cond}\marg{true}\opt{\marg{false}}}
This key checks |\ifnum|\meta{num cond}
and applies the styles \meta{true} if true, otherwise \meta{false}.
A delimiting |\relax| will be inserted after \meta{num cond}.
- As a side effect on how \pgfname keys parses argument, the \meta{false} argument is
+ As a side effect on how \pgfname keys parses arguments, the \meta{false} argument is
actually optional.
\end{key}
\begin{key}{/utils/TeX/ifdim=\meta{dim cond}\meta{true}\opt{\meta{false}}}
- As above.
+ As above but with |\ifdim|.
\end{key}
\begin{key}{/utils/TeX/ifempty=\meta{Text}\meta{true}\opt{\meta{false}}}
This checks whether \meta{Text} is empty and applies styles \meta{true} if true,
otherwise \meta{false}.
\end{key}
-
+\begin{key}{/utils/TeX/ifxempty=\meta{Text}\meta{true}\opt{\meta{false}}}
+ This checks whether fully expanded \meta{Text} is empty and applies styles \meta{true} if true,
+ otherwise \meta{false}.
+\end{key}
\subsubsection{Handlers}
@@ -193,27 +220,58 @@ not all of them are.
\begin{handler}{{.pgfmath}|=|\meta{eval}}
This handler evaluates \meta{eval} before it is handed to the key.
+
+ This handler works almost the same as the |.evaluated|\indexHandlerO{.evaluated}
+ handler but it does its evaluation in a group so that the result will
+ not overwrite any other results.
\end{handler}
\begin{handler}{{.pgfmath int}|=|\meta{eval}}
As above but truncates the result.
\end{handler}
-\begin{handler}{{.pgfmath strcat}|=|\meta{eval}}
- As above but uses the |strcat| function.
+\begin{handler}{{.pgfmath wrap}|=|\marg{wrapper}\marg{eval}}
+ This feeds the result of \meta{eval} as |#1| to \meta{wrapper}.
- In the example below, one could have used the |/pgf/foreach/evaluate| key from |\foreach|.
-\begin{codeexample}[width=3.7cm,preamble=\usetikzlibrary{misc}]
+ In the example below, one could have used the \referenceKeyandIndexO[/pgf/foreach/]{evaluate}
+ key from the |\foreach| loop.
+\begin{codeexample}[width=3.7cm,preamble=\usetikzlibrary{ext.pgfkeys-plus}]
\tikz\foreach \i in {0,10,...,100}
\draw[
- line width=+.2cm,
- color/.pgfmath strcat={"red!",sqrt(\i)*10,"!blue"}
+ line width=+.25cm,
+ % needs ## because its inside the \foreach body
+ color/.pgfmath wrap={red!##1!blue}{sqrt(\i)*10}
]
- (0,\i/50) -- +(right:3);
+ (0,\i/40) -- +(right:3);
\end{codeexample}
\end{handler}
-\begin{handler}{{.List}|=|\meta{\meta{e1}, \meta{e2}, \dots, \meta{en}}}
+\begin{handler}{{.pgfmath if}|=|\marg{cond}\marg{true}\opt{\marg{false}}}
+ Evaluates \meta{cond} with \pgfname Math and returns \meta{true} or \meta{false} to the used key respectively.
+\end{handler}
+\begin{handler}{{.if}|=|\meta{token A}\meta{token B}\marg{true}\opt{\marg{false}}}
+ Checks via |\if| if \meta{token A} matches \meta{token B}
+ and applies the value \meta{true} if it does, otherwise \meta{false}.
+\end{handler}
+\begin{handler}{{.ifx}|=|\meta{token A}\meta{token B}\marg{true}\opt{\marg{false}}}
+ As above but via |\ifx|.
+\end{handler}
+\begin{handler}{{.ifnum}|=|\marg{ifnum cond}\marg{true}\opt{\marg{false}}}
+ Checks via |\ifnum| if \meta{ifnum cond}
+ and applies the value \meta{true} if it does, otherwise \meta{false}.
+\end{handler}
+\begin{handler}{{.ifdim}|=|\marg{ifdim cond}\marg{true}\opt{\marg{false}}}
+ As above but via |\ifdim|.
+\end{handler}
+\begin{handler}{{.ifxempty}|=|\marg{Text}\marg{true}\opt{\marg{false}}}
+ Checks whether a fully expanded \meta{Text} is empty
+ and applies the value \meta{true} if it does, otherwise \meta{false}.
+\end{handler}
+\begin{handler}{{.ifempty}|=|\marg{Text}\marg{true}\opt{\marg{false}}}
+ Checks whether \meta{Text} is empty
+ and applies the value \meta{true} if it does, otherwise \meta{false}.
+\end{handler}
+\begin{handler}{{.List}|=|\marg{\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.
\end{handler}
@@ -221,26 +279,11 @@ not all of them are.
\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);
+ \node[circle, fill, inner sep=1pt, text=white] (point-\cnt) at \point {\cnt};
\node[gray, fit/.List={(point-1),(point-...),(point-4)}] {};
\node[red, fit/.List={(point-1),(point-...),(point-5)}] {};
\node[blue, fit/.List={(point-1),(point-...),(point-6)}] {};
\end{tikzpicture}
\end{codeexample}
-\subsection{\pgfname for}
-
-Instead of |\foreach \var in {start, start + delta, ..., end}| one can use
-|\foreach \var[use int=start to end step delta]|.
-
-\begin{key}{/pgf/foreach/use int=\meta{start}|to|\meta{end}\opt{|step|\meta{delta}}}
-The values \meta{start}, \meta{end} and \meta{delta} are evaluates by \pgfname math at initialization.
-The part |step |\meta{delta} is optional (\meta{delta} = 1).
-\end{key}
-
-\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}
-
-%TODO: edges to and edges through
\endinput \ No newline at end of file