| 1 |
% !TeX root = tcolorbox.tex |
| 2 |
% include file of tcolorbox.tex (manual of the LaTeX package tcolorbox) |
| 3 |
\clearpage |
| 4 |
\section{\tikzname\ Auxiliary Macros}\label{sec:tikzimagefilling}% |
| 5 |
\tcbset{external/prefix=external/filling_}% |
| 6 |
The \mylib{skins} library adds some auxiliary options to the vast option set of |
| 7 |
\tikzname\ \cite{tantau:tikz_and_pgf}. These options can be used in any |tikzpicture|. |
| 8 |
For the following options, the \mylib{skins} library has to be loaded |
| 9 |
by a package option or inside the preamble by: |
| 10 |
\begin{dispListing} |
| 11 |
\tcbuselibrary{skins} |
| 12 |
\end{dispListing} |
| 13 |
|
| 14 |
See \zvref{sec:skins} for the documentation of all other options of the \mylib{skins} library. |
| 15 |
|
| 16 |
\begin{marker} |
| 17 |
Up to version 5.1.1 (2022/06/24) of |tcolorbox|, \tikzname\ image and picture fill extensions |
| 18 |
were documented here. These extensions are now separate \tikzname\ libraries |
| 19 |
and part of the \refPkg{tikzfill} package where they are documented now. |
| 20 |
\end{marker} |
| 21 |
|
| 22 |
|
| 23 |
\subsection{Straightening of the Arcs} |
| 24 |
|
| 25 |
\begin{marker} |
| 26 |
This patch is considered as an experimental feature. |
| 27 |
It changes some of the original \tikzname\ code. This change may break |
| 28 |
with future updates of \tikzname. |
| 29 |
\end{marker} |
| 30 |
|
| 31 |
\begin{docCommand}[doc new=2014-05-05]{tcbpatcharcangular}{} |
| 32 |
The \refPkg{tikz} package provides a nice |rounded corners| option to replace |
| 33 |
all corners by little arcs. |\tcbpatcharcangular| is a patch which |
| 34 |
straightens the arcs. To say it more prosaic, the little arcs are replaced |
| 35 |
by little straight lines. |
| 36 |
|
| 37 |
\begin{dispExample*}{sbs,lefthand ratio=0.66,right=2mm,sidebyside gap=5mm,center lower} |
| 38 |
\begin{tikzpicture} |
| 39 |
\draw[thick,rounded corners=8pt] |
| 40 |
(0,0) -- (0,2) -- (1,3.25) -- (2,2) -- (2,0) |
| 41 |
-- (0,2) -- (2,2) -- (0,0) -- (2,0); |
| 42 |
\tcbpatcharcangular |
| 43 |
\draw[thick,rounded corners=8pt,xshift=2.5cm] |
| 44 |
(0,0) -- (0,2) -- (1,3.25) -- (2,2) -- (2,0) |
| 45 |
-- (0,2) -- (2,2) -- (0,0) -- (2,0); |
| 46 |
\end{tikzpicture} |
| 47 |
\end{dispExample*} |
| 48 |
|
| 49 |
\end{docCommand} |
| 50 |
|
| 51 |
|
| 52 |
\begin{docCommand}[doc new=2014-05-05]{tcbpatcharcround}{} |
| 53 |
This macro reverts \refCom{tcbpatcharcangular}, i.\,e., the patch from |
| 54 |
\refCom{tcbpatcharcangular} is replaced by the original code. |
| 55 |
\end{docCommand} |
| 56 |
|
| 57 |
|
| 58 |
\clearpage |
| 59 |
\subsection{Extracting Node Dimensions} |
| 60 |
The following auxiliary macros are defined by the \mylib{skins} library. |
| 61 |
They allow to determine the width and height of an arbitrary \tikzname\ node. |
| 62 |
To be more specific, they determine the east-to-west and the north-to-south dimensions |
| 63 |
which may be not the maximal dimensions for a non-rectangular node. |
| 64 |
Note that the following dimensions are measured exactly including the line width |
| 65 |
of the border line. If a new rectangle or node with the same dimensions |
| 66 |
and a border is to be drawn, this border width has to be subtracted. |
| 67 |
|
| 68 |
\begin{docCommand}[doc new=2014-09-19]{tcbsettowidthofnode}{\marg{register}\marg{node}} |
| 69 |
Sets the east-to-west dimension of the given \meta{node} |
| 70 |
to the \TeX\ \meta{register}. |
| 71 |
\end{docCommand} |
| 72 |
|
| 73 |
\begin{docCommand}[doc new=2014-09-19]{tcbsetmacrotowidthofnode}{\marg{macro}\marg{node}} |
| 74 |
Defines \meta{macro} as the east-to-west dimension of the given \meta{node}. |
| 75 |
\end{docCommand} |
| 76 |
|
| 77 |
\begin{docCommand}[doc new=2014-09-19]{tcbsettoheightofnode}{\marg{register}\marg{node}} |
| 78 |
Sets the north-to-south dimension of the given \meta{node} |
| 79 |
to the \TeX\ \meta{register}. |
| 80 |
\end{docCommand} |
| 81 |
|
| 82 |
\begin{docCommand}[doc new=2014-09-19]{tcbsetmacrotoheightofnode}{\marg{macro}\marg{node}} |
| 83 |
Defines \meta{macro} as the north-to-south dimension of the given \meta{node}. |
| 84 |
\end{docCommand} |
| 85 |
|
| 86 |
\begin{dispExample} |
| 87 |
\begin{tikzpicture} |
| 88 |
\node[align=center,draw=red,fill=yellow] (A) {This is my\\example node}; |
| 89 |
\tcbsetmacrotowidthofnode\mywidth{A} |
| 90 |
\tcbsetmacrotoheightofnode\myheight{A} |
| 91 |
\path[fill=blue!25!white] % rectangle without border |
| 92 |
([xshift=2mm]A.south east) |
| 93 |
rectangle node{Copy} +(\mywidth,\myheight); |
| 94 |
\node[draw=blue,fill=blue!25!white, % standard border width 0.4pt |
| 95 |
minimum width=\mywidth-0.4pt, % minus width of border |
| 96 |
minimum height=\myheight-0.4pt % minus height of border |
| 97 |
] |
| 98 |
at ([xshift=5cm]A) {Copy 2}; |
| 99 |
\end{tikzpicture} |
| 100 |
\end{dispExample} |
| 101 |
|
| 102 |
|
| 103 |
\subsection{Hyper Nodes} |
| 104 |
The following auxiliary macro is defined by the \mylib{skins} library. |
| 105 |
\enlargethispage*{1cm} |
| 106 |
|
| 107 |
\begin{docCommand}[doc new and updated={2016-02-03}{2023-02-28}]{tcbhypernode}{\marg{macro}\marg{node}} |
| 108 |
% Sets the east-to-west dimension of the given \meta{node} |
| 109 |
% to the \TeX\ \meta{register}. |
| 110 |
Applies a hyperlink creating \meta{macro} from the package \refPkg{hyperref} \cite{rahtz:hyperref} |
| 111 |
to an existing \tikzname\ \meta{node}. \refCom{tcbhypernode} can only |
| 112 |
be used inside a |tikzpicture| environment. |
| 113 |
The last argument of the \meta{macro} is to be omitted and should stand |
| 114 |
for an object (text) which is to be made a hyperlink. |
| 115 |
For example, use |\hyperref[name]| instead of |\hyperref[name]{text}|. |
| 116 |
|
| 117 |
\begin{dispExample} |
| 118 |
% \usepackage{hyperref} |
| 119 |
\begin{tikzpicture} |
| 120 |
\node[align=center,draw=red,fill=red!5] (mybutton) |
| 121 |
{Click me to jump to Section~\ref*{sec:tikzimagefilling}}; |
| 122 |
\tcbhypernode{\hyperref[sec:tikzimagefilling]}{mybutton} |
| 123 |
\end{tikzpicture} |
| 124 |
\end{dispExample} |
| 125 |
|
| 126 |
\end{docCommand} |
| 127 |
|