Debian Codegraph @

texmf-dist/doc/latex/tikz-ext/tikz-ext-manual-en-library-layers.tex

raw
1 % !TeX root = tikz-ext-manual.tex
2 % !TeX spellcheck = en_US
3 % Copyright 2022 by Qrrbrbirlbel
4 %
5 % This file may be distributed and/or modified
6 %
7 % 1. under the LaTeX Project Public License and/or
8 % 2. under the GNU Free Documentation License.
9 %
10
11 \section{Layers}
12 \begin{tikzlibrary}{ext.layers}
13 This library extends \tikzname's functionalities to put nodes, edges, matrices and pics
14 on a separate layer without having to use the \referenceEnvironmentandIndexO{pgfonlayer} environment.
15
16 \textbf{Consider this library experimental.}
17 If you can, avoid it and use the |pgfonlayer| environment
18 or change the drawing order.
19 \end{tikzlibrary}
20
21 \begin{multicols}{2}
22 %\subsection{Internal keys}
23 \begin{key}{/\tikzext/layers/patch=\mchoice{node, matrix, pic, edge, all}}
24 \keycompat{tikz-ext/layers}
25 Since this library is experimental, its functionality needs to be activated explicitly.
26 Patches exist for
27 \begin{itemize}
28 \item |node|,
29 \item |matrix|,
30 \item |pic|%
31 \footnote{Only the normal \referenceKeyandIndexO[/tikz/pics/]{code}
32 can be placed on different layers.
33 Both \referenceKeyandIndexO[/tikz/pics/]{background code}
34 and \referenceKeyandIndexO[/tikz/pics/]{foreground code}
35 will not be affected.},
36 \item |edge| or
37 \item |all| which applies all the patches at once.
38 \end{itemize}
39 \end{key}
40 %
41 %These keys only work when a patch is applied.
42 %These will be used internally.
43 %\begin{key}{/\tikzext/layers/on layer=\meta{layer}}
44 %\keycompat{tikz-ext/layers}
45 %Places an object on the \pgfname\ layer \meta{layer}.
46 %\end{key}
47 %\begin{key}{/\tikzext/layers/in box=\meta{box}}
48 %\keycompat{tikz-ext/layers}
49 %Places an object in the \TeX\ box \meta{box}.
50 %\end{key}
51
52 %\subsection{User-level keys}
53 \newcolumn
54 \begin{key}{/\tikzext/node on layer=\meta{layer}}
55 \keycompat{tikz}
56 If the |node| patch is applied, this key places a node on layer \meta{layer}.
57 \end{key}
58 %\begin{key}{/\tikzext/node in box=\meta{box}}
59 %\keycompat{tikz}
60 %If the |node| patch is applied, this key places a node in box \meta{box}.
61 %\end{key}
62
63 \begin{key}{/\tikzext/matrix on layer=\meta{layer}}
64 \keycompat{tikz}
65 If the |matrix| patch is applied, this key places the matrix on layer \meta{layer}.
66 \end{key}
67 %\begin{key}{/\tikzext/matrix in box=\meta{box}}
68 %\keycompat{tikz}
69 %If the |matrix| patch is applied, this key places the matrix in box \meta{box}.
70 %\end{key}
71
72 \begin{key}{/\tikzext/edge on layer=\meta{layer}}
73 \keycompat{tikz}
74 If the |edge| patch is applied, this key places the edge on layer \meta{layer}.
75 \end{key}
76 %\begin{key}{/\tikzext/edge in box=\meta{box}}
77 %\keycompat{tikz}
78 %If the |edge| patch is applied, this key places the edge in box \meta{box}.
79 %\end{key}
80
81 \begin{key}{/\tikzext/pic on layer=\meta{layer}}
82 \keycompat{tikz}
83 If the |pic| patch is applied, this key places the main code of a pic on layer \meta{layer}.
84 \end{key}
85 %\begin{key}{/\tikzext/pic in box=\meta{box}}
86 %\keycompat{tikz}
87 %If the |pic| patch is applied, this key places the main code of a pic in box \meta{box}.
88 %\end{key}
89 \end{multicols}
90 \begin{codeexample}[width=.5\linewidth,preamble=\usetikzlibrary{ext.layers}]
91 \pgfdeclarelayer{front}
92 \begin{tikzpicture}[ext/layers/patch=node]
93 \pgfsetlayers{main,front}
94 \draw (0, -1) -- node[
95 ext/node on layer=front,
96 draw, fill=white, sloped
97 ] {On Top} (2,1);
98 \draw[red] (0, 1) -- (2, -1);
99 \end{tikzpicture}
100 \end{codeexample}