summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-misc.tex
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-misc.tex')
-rw-r--r--graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-misc.tex101
1 files changed, 39 insertions, 62 deletions
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[<num>]| 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}