summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-node-families.tex
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-node-families.tex')
-rw-r--r--graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-node-families.tex102
1 files changed, 102 insertions, 0 deletions
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