Debian Codegraph @

texmf-dist/source/latex/hf-tikz/hf-tikz.dtx

raw
1 % \iffalse meta-comment
2 %<*internal>
3 \iffalse
4 %</internal>
5 %<*readme>
6 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
7 * hf-tikz --- A simple way to highlight formulas and formula parts.
8 *
9 * E-mail: claudio dot fiandrino at gmail dot com
10 *
11 * Released under the LaTeX Project Public License v1.3c or later
12 *
13 * See http://www.latex-project.org/lppl.txt
14 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
15
16 The package provides a way to highlight formulas and formula parts
17 in both documents and presentations thanks to TikZ.
18 %</readme>
19 %<*internal>
20 \fi
21 \def\nameofplainTeX{plain}
22 \ifx\fmtname\nameofplainTeX\else
23 \expandafter\begingroup
24 \fi
25 %</internal>
26 %<*install>
27 \input docstrip.tex
28 \keepsilent
29 \askforoverwritefalse
30 \preamble
31 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
32 * hf-tikz --- A simple way to highlight formulas and formula parts.
33 *
34 * E-mail: claudio dot fiandrino at gmail dot com
35 *
36 * Released under the LaTeX Project Public License v1.3c or later
37 *
38 * See http://www.latex-project.org/lppl.txt
39 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
40 \endpreamble
41 \postamble
42
43 Copyright (C) 2012-2014 by Claudio Fiandrino <[email protected]>
44
45 This work may be distributed and/or modified under the
46 conditions of the LaTeX Project Public License (LPPL), either
47 version 1.3c of this license or (at your option) any later
48 version. The latest version of this license is in the file:
49
50 http://www.latex-project.org/lppl.txt
51
52 This work is "maintained" (as per LPPL maintenance status) by
53 Claudio Fiandrino.
54
55 This work consists of the file hf-tikz.dtx
56 and the derived files hf-tikz.ins and
57 hf-tikz.pdf
58 hf-tikz.sty.
59 \endpostamble
60 \usedir{tex/latex/hf-tikz}
61 \generate{
62 \file{\jobname.sty}{\from{\jobname.dtx}{package}}
63 }
64 %</install>
65 %<install>\endbatchfile
66 %<*internal>
67 \generate{
68 \file{\jobname.ins}{\from{\jobname.dtx}{install}}
69 }
70 \nopreamble\nopostamble
71 \generate{
72 \file{README.txt}{\from{\jobname.dtx}{readme}}
73 }
74 \ifx\fmtname\nameofplainTeX
75 \expandafter\endbatchfile
76 \else
77 \expandafter\endgroup
78 \fi
79 %</internal>
80 %<*package>
81 \NeedsTeXFormat{LaTeX2e}
82 \ProvidesPackage{hf-tikz}[2014/07/25 v0.3a A simple way to highlight formulas and formula parts.]
83 %</package>
84 %<*driver>
85 \documentclass{ltxdoc}
86 \usepackage[T1]{fontenc}
87 \usepackage{csquotes}
88 \usepackage{lmodern}
89 \usepackage{amsmath,amssymb}
90 \usepackage[width=14cm]{geometry}
91 \usepackage{charter,pxfonts}
92 \usepackage[customcolors,shade,markings]{\jobname}
93 \usetikzlibrary{calc}
94 \usepackage{hypdoc}
95 \newcommand{\library}[1]{\textcolor{red!80!black}{\texttt{#1}}}
96 \newcommand{\packoption}[2]{\textcolor{blue!60!cyan}{\texttt{#1}} \texttt{(initial:~#2)}}
97 \newcommand{\smkey}[1]{\textcolor{blue!60!cyan}{\texttt{#1}}}
98 \newcommand{\smoption}[1]{\textcolor{orange!30!red}{\texttt{#1}}}
99 \newcommand{\hftikz}{\textsf{hf-tikz}}
100 \EnableCrossrefs
101 \CodelineIndex
102 \RecordChanges
103 \begin{document}
104 \DocInput{\jobname.dtx}
105 \end{document}
106 %</driver>
107 % \fi
108 %
109 % \CheckSum{482}
110 %
111 % \CharacterTable
112 % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
113 % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
114 % Digits \0\1\2\3\4\5\6\7\8\9
115 % Exclamation \! Double quote \" Hash (number) \#
116 % Dollar \$ Percent \% Ampersand \&
117 % Acute accent \' Left paren \( Right paren \)
118 % Asterisk \* Plus \+ Comma \,
119 % Minus \- Point \. Solidus \/
120 % Colon \: Semicolon \; Less than \<
121 % Equals \= Greater than \> Question mark \?
122 % Commercial at \@ Left bracket \[ Backslash \\
123 % Right bracket \] Circumflex \^ Underscore \_
124 % Grave accent \` Left brace \{ Vertical bar \|
125 % Right brace \} Tilde \~}
126 %
127 % \changes{v0.1}{2012/08/17}{Initial version}
128 % \changes{v0.1a}{2012/12/18}{Fixed bug \pgfpointorigin}
129 % \changes{v0.2}{2013/01/13}{Added norndcorners and warning second run}
130 % \changes{v0.3}{2013/03/01}{Key interface and markings option}
131 % \changes{v0.3}{2014/07/25}{Documentation}
132 %
133 % \GetFileInfo{hf-tikz.sty}
134 %
135 % \title{The \textsf{hf-tikz} package\thanks{This document
136 % corresponds to \textsf{hf-tikz}~\fileversion,
137 % dated \filedate.}}
138 % \author{Claudio Fiandrino\thanks{e-mail: \texttt{claudio dot fiandrino at gmail dot com}}}
139 % \maketitle
140 % \begin{abstract}
141 % This package provides a way to \emph{highlight} formulas in both documents and presentations thanks to Ti\emph{k}Z.
142 % The idea originated in \href{http://tex.stackexchange.com/questions/52598/beamer-highlighting-aligned-math-with-overlay}{this question} on \href{http://tex.stackexchange.com}{TeX.StackExchange}
143 % and it is based on the \texttt{tikzmark} macro from \href{http://tex.stackexchange.com/users/86/andrew-stacey}{Andrew Stacey} and
144 %\href{http://tex.stackexchange.com/users/4301/peter-grill}{Peter Grill}.
145 %
146 % \end{abstract}
147 % \tableofcontents
148 %
149 % \section{Introduction and requirements}
150 % The aim of the package is to provide a simple way to highlight formulas. \hftikz\ is not the first package that tries to accomplish this task, but, despite \href{http://www.ctan.org/pkg/empheq}{empheq}, it provides not only a way to highlight formulas in standard document, but also inside a presentation though Beamer overlay-aware specifications. In addition, with respect to \href{http://www.ctan.org/pkg/empheq}{empheq}, \hftikz\ even allows to highlight just a part of a formula.
151 %
152 % The package uses Ti\emph{k}Z and it is based on the \texttt{tikzmark} macro from \href{http://tex.stackexchange.com/users/86/andrew-stacey}{Andrew Stacey} and
153 %\href{http://tex.stackexchange.com/users/4301/peter-grill}{Peter Grill} (see \href{http://tex.stackexchange.com/questions/51582/background-coloring-with-overlay-specification-in-algorithm2e-beamer-package}{this answer} and \href{http://tex.stackexchange.com/questions/50015/tikzmark-to-have-different-behaviour-if-first-run-and-mark-locations-not-yet-av}{this question}): among the numerous versions present on \href{http://tex.stackexchange.com}{TeX.SX}, the one the package implements is taken from \href{http://tex.stackexchange.com/questions/57537/issues-and-potentiality-of-the-tikzmark-macro-dynamic-box-adaptation#57655}{this answer}. Indeed, as explained later, the concept of \emph{extendible markers} helps a lot in customizing the box dimension.
154 %
155 % The packages loaded by \hftikz\ are:
156 % \begin{itemize}
157 % \item Ti\emph{k}Z and the libraries \library{shadings} and \library{decorations.markings} (this library is not always loaded, see subsection \ref{subsec:markings});
158 % \item \textsf{xparse};
159 % \item \textsf{etoolbox}.
160 % \end{itemize}
161 %
162 %
163 % \section{Using the package}
164 % \subsection{The basic commands}
165 % Formulas can be highlighted by inserting a pair of delimiters before and
166 % after the part to be highlighted. Two compilation runs are always necessary: the first one to compute the position of the delimiters (also called markers in this manual) and the second one to actually place the box.
167 % \DescribeMacro{\tikzmarkin}^^A
168 % The starting delimiter should be introduced with the \cs{tikzmarkin} macro: it may assume a different syntax upon
169 % being in \texttt{beamer} mode or not as it will be pointed out in subsection \ref{subsec:beamer}.
170 %
171 % \DescribeMacro{\tikzmarkend}^^A
172 % The end delimiter should be introduced by means of the \cs{tikzmarkend} macro: despite \cs{tikzmarkin},
173 % this macro keeps the same syntax in \texttt{beamer} mode too.
174 %
175 % An example of the basic use is:
176 % \begin{verbatim}
177 % \[x+\tikzmarkin{a}y\tikzmarkend{a}=400\]
178 % \end{verbatim}
179 % which produces:
180 % \[x+\tikzmarkin{a}y\tikzmarkend{a}=400\]
181 %
182 % Notice that the delimiter labels, also called \texttt{marker-id}s, should characterize \emph{uniquely} the part highlighted. Reusing the same name more than once will lead to undesired results. Along this documentation there are examples that illustrates some guidelines to provide names consistenly.
183 %
184 % In presence of fractions, sums, integrals and other operators, the standard command is not appropriate. Consider the following example:
185 % \begin{verbatim}
186 % \[\tikzmarkin{a-1}x+\dfrac{z}{y}=400\tikzmarkend{a-1}\]
187 % \end{verbatim}
188 % It leads to:
189 % \[\tikzmarkin{a-1}x+\dfrac{z}{y}=400\tikzmarkend{a-1}\]
190 % In this case, the user must specify manually which are the \emph{shift-offsets} that delimits the box:
191 % \begin{verbatim}
192 % \begin{equation}
193 % \tikzmarkin{right delim frac}(0.1,-0.4)(-0.1,0.5)
194 % x+\dfrac{z}{y}=400
195 % \tikzmarkend{right delim frac}
196 % \end{equation}
197 % \end{verbatim}
198 % and this fixes the problem:
199 % \begin{equation}
200 % \tikzmarkin{right delim frac}(0.1,-0.4)(-0.1,0.5)
201 % x+\dfrac{z}{y}=400
202 % \tikzmarkend{right delim frac}
203 % \end{equation}
204 %
205 % The \emph{shift-offsets} should be introduced using the following syntax:
206 % \begin{verbatim}
207 % \tikzmarkin{marker-id}(below right offset)(above left offset)
208 % \end{verbatim}
209 %
210 % The following image explains pretty well the difference between the default setting and the \emph{shift-offsets} used in the previous example:
211 % \bigskip
212 % \begin{center}
213 % \tikzmarkin{r}(0.1,-0.4)(-0.1,0.5)\tikz[baseline=-0.5ex]\node[opacity=0]{\ensuremath{x+\dfrac{z}{y}=400}};\tikzmarkend{r}
214 % $
215 % \qquad
216 % x+\dfrac{z}{y}=400
217 % \qquad
218 % $
219 % \tikzmarkin{f}\tikz[baseline=-0.5ex]\node[opacity=0]{\ensuremath{x+\dfrac{z}{y}=400}};\tikzmarkend{f}
220 % \end{center}
221 % \begin{tikzpicture}[remember picture,overlay]
222 % \foreach \coord in {pic cs:r,pic cs:f}
223 % \draw plot[mark=x] coordinates{(\coord)} node[left]{\scriptsize{\texttt{\coord}}};
224 %
225 % \draw plot[mark=x] coordinates{($(pic cs:r)+(0.1,-0.4)$)} node[below]{\scriptsize{\texttt{(0.1,-0.4)}}};
226 % \draw plot[mark=x] coordinates{(r)} node[above]{\scriptsize{\texttt{(-0.1,0.5)}}};
227 %
228 % \draw plot[mark=x] coordinates{($(pic cs:f)+(0.1,-0.18)$)} node[below]{\scriptsize{\texttt{default setting}}};
229 % \draw plot[mark=x] coordinates{(f)} node[above]{\scriptsize{\texttt{default setting}}};
230 % \end{tikzpicture}
231 %
232 % Manual shifts allow to customize the box dimension on the base of user's needs: they should be introduced inside round braces as coordinate points. Coordinates, indeed, provide more degree of freedom from the user's point of view whereas other solutions are more restrictive. Markers, therefore, are \emph{extensible}. Notice that with the aformentioned syntax, it is not possible to use the markers separately, but they should be declared in pair.
233 %
234 % From version 0.3, it is also possible to exploit a key-based interface to set the \emph{shift-offsets}; for example, the previous example, could have been done as follows:
235 % \begin{verbatim}
236 % \begin{equation}
237 % \tikzmarkin[below right offset={0.1,-0.4},above left offset={-0.1,0.5}]
238 % {right delim frac 2}
239 % x+\dfrac{z}{y}=400
240 % \tikzmarkend{right delim frac 2}
241 % \end{equation}
242 % \end{verbatim}
243 % leads to:
244 % \begin{equation}
245 % \tikzmarkin[below right offset={0.1,-0.4},above left offset={-0.1,0.5}]{right delim frac 2}
246 % x+\dfrac{z}{y}=400
247 % \tikzmarkend{right delim frac 2}
248 % \end{equation}
249 %
250 % The list of keys available to customize the \emph{shift-offsets} are:
251 % \begin{itemize}
252 % \item \packoption{left}{-0.1/-0.075}: this key sets the left offset (the second value is active when the \smoption{fill} option is passed to the package);
253 %
254 % \item \packoption{right}{0.1/0.075}: this key sets the right offset (the second value is active when the \smoption{fill} option is passed to the package);
255 %
256 % \item \packoption{above}{0.35}: this key sets the above offset;
257 %
258 % \item \packoption{below}{-0.18}: this key sets the below offset;
259 %
260 % \item \packoption{below right}{0.1/0.075,0.35}: this key sets contemporarely the below and the right offsets;
261 %
262 % \item \packoption{above left}{-0.1/-0.075,0.35}: this key sets contemporarely the above and the left offsets.
263 %
264 % \end{itemize}
265 %
266 % All the keys, not only the ones devoted to the \emph{shift-offsets}, should be introduced in the first optional argument only if the \smoption{beamer} option is not loaded. In the other case, the first argument of \verb|\tikzmarkin| concerns the overly-specification definition. Furthermore, the keys provided in the optional argument have a local scope. On the contrary, when they are set by means of \verb|\tikzset{}|, they are applied to the whole document. For example:
267 % \begin{verbatim}
268 % \tikzset{above left offset={-0.1,0.325},below right offset={0.1,-0.4}}
269 % \end{verbatim}
270 %
271 % \subsection{An advanced example}
272 % This example shows how to insert an annotation aligned with a sentence: it requires the \library{calc} library from Ti\emph{k}Z. The colors have been set accordingly to the explanation provided in subsection \ref{subsec:customcolors}.
273 % \hfsetfillcolor{red!10}
274 % \hfsetbordercolor{red}
275 % \begin{equation*}
276 % \left.\begin{array}{cc}
277 % -2\cdot \tikzmarkin{col}(0.05,-0.3)(-0.05,0.4)2=& -4 \\
278 % -2\cdot 1=& -2 \\
279 % -2\cdot 0\tikzmarkend{col}=& 0
280 % \end{array}\right\} \text{\small Product increases by 2 each time.}
281 % \end{equation*}
282
283 % \begin{tikzpicture}[remember picture,overlay]
284 % \coordinate (col-aa) at ($(col)+(1.825,-1.8)$);
285 % \node[align=left,right] at (col-aa) {\small{Annotation}};
286 % \path[-stealth,red,draw] (col-aa) -| ($(col)+(0.14,-1.55)$);
287 % \end{tikzpicture}
288 % \linebreak
289 %
290 % The code is:
291 % \begin{verbatim}
292 % \begin{equation*}
293 % \left.\begin{array}{cc}
294 % -2\cdot \tikzmarkin{col}(0.05,-0.3)(-0.05,0.4)2=& -4 \\
295 % -2\cdot 1=& -2 \\
296 % -2\cdot 0\tikzmarkend{col}=& 0
297 % \end{array}\right\} \text{\small Product increases by 2 each time.}
298 % \end{equation*}
299 %
300 % % To insert the annotation
301 % \begin{tikzpicture}[remember picture,overlay]
302 % % adjust the shift from "col" to move the position of the annotation
303 % \coordinate (col-aa) at ($(col)+(1.825,-1.8)$);
304 % \node[align=left,right] at (col-aa) {\small{Annotation}};
305 % \path[-stealth,red,draw] (col-aa) -| ($(col)+(0.14,-1.55)$);
306 % \end{tikzpicture}
307 % \end{verbatim}
308 %
309 % Note that when a formula is highlighted, the \texttt{marker-id} can be used to subsequently add elements on the image, i.e. annotations.
310 %
311 % From the version 0.3, it exists simpler manner to add annotations that requires the option \smoption{markings} to be enabled. Under such an hypothesis, the previous example can be done as follows (the annotation has been put a little bit close to the highlighted area intentionally):
312 % \begin{equation*}
313 % \left.\begin{array}{cc}
314 % -2\cdot \tikzmarkin[mark at=0.93]{col 1}(0.05,-0.2)(-0.05,0.4)2=& -4 \\
315 % -2\cdot 1=& -2 \\
316 % -2\cdot 0\tikzmarkend{col 1}=& 0
317 % \end{array}\right\} \text{\small Product increases by 2 each time.}
318 % \end{equation*}
319
320 % \begin{tikzpicture}[remember picture,overlay]
321 % \coordinate (col-aa) at ($(col 1)+(1.3,-1.8)$);
322 % \node[align=left,right] at (col-aa) {\small{Annotation}};
323 % \path[-stealth,red,draw,use marker id] (col-aa) -| (0,0);
324 % \end{tikzpicture}
325 % \linebreak
326 %
327 % The code:
328 % \begin{verbatim}
329 % \begin{equation*}
330 % \left.\begin{array}{cc}
331 % -2\cdot \tikzmarkin[mark at=0.93]{col 1}(0.05,-0.2)(-0.05,0.4)2=& -4 \\
332 % -2\cdot 1=& -2 \\
333 % -2\cdot 0\tikzmarkend{col 1}=& 0
334 % \end{array}\right\} \text{\small Product increases by 2 each time.}
335 % \end{equation*}
336
337 % \begin{tikzpicture}[remember picture,overlay]
338 % \coordinate (col-aa) at ($(col 1)+(1.3,-1.8)$);
339 % \node[align=left,right] at (col-aa) {\small{Annotation}};
340 % \path[-stealth,red,draw,use marker id] (col-aa) -| (0,0);
341 % \end{tikzpicture}
342 % \end{verbatim}
343 %
344 % Thus, it is sufficient to mark the box delimiting the highlighted area with the option \smkey{mark at}. Then, it is possible to access this coordinate by means of \smkey{use marker id}. Further details are provided in subsection \ref{subsec:markings}.
345 %
346 % \section{The options}
347 % \subsection{The \texttt{beamer} mode}\label{subsec:beamer}
348 % \DescribeMacro{beamer}^^A
349 % The call:
350 % \begin{verbatim}
351 % \usepackage[beamer]{hf-tikz}
352 % \end{verbatim}
353 % let the package to enter in \texttt{beamer} mode and the \cs{tikzmarkin} macro becomes \emph{overlay-aware}. As a resutl, overlay specifications can be introduced as first argument. For example:
354 % \begin{verbatim}
355 % \begin{align}
356 % \tikzmarkin<1->{a1}a_i\tikzmarkend{a1} + b_j = 10 \\
357 % \tikzmarkin<3>{c}c_j + d_j +
358 % \tikzmarkin<2>{b}a_i\tikzmarkend{b}
359 % >= 30\tikzmarkend{c}
360 % \end{align}
361 % \end{verbatim}
362 % Here it follows a list of examples in which overlay-specifications can be defined:
363 % \begin{itemize}
364 % \item a single number: \texttt{<1>};
365 % \item multiple numbers separated by commas and delimited by braces: \texttt{<\{1,2,3\}>};
366 % \item a single number followed by a dash: \texttt{<1->}.
367 % \end{itemize}
368 %
369 % \subsection{Customize colors}\label{subsec:customcolors}
370 % \DescribeMacro{customcolors}^^A
371 % This option allows to customize both the fill and the border color. While using this option, two commands become available:
372 % \begin{itemize}
373 % \item \cs{hfsetfillcolor}
374 % \item \cs{hfsetbordercolor}
375 % \end{itemize}
376 % These commands can be used at any time in the document. For example:
377 % \begin{verbatim}
378 % \hfsetfillcolor{red!10}
379 % \hfsetbordercolor{red}
380 % \[
381 % \tikzmarkin{z}(0.2,-0.4)(-0.2,0.6)
382 % \dfrac{100}{x}
383 % \tikzmarkend{z}
384 % \]
385 % \end{verbatim}
386 % produces:
387 % \hfsetfillcolor{red!10}
388 % \hfsetbordercolor{red}
389 % \[\tikzmarkin{z}(0.2,-0.4)(-0.2,0.6)\dfrac{100}{x}\tikzmarkend{z}\]
390 % Then:
391 % \begin{verbatim}
392 % \hfsetfillcolor{blue!10}
393 % \hfsetbordercolor{blue}
394 % \[\tikzmarkin{z1}x+y=400\tikzmarkend{z1}\]
395 % \end{verbatim}
396 % gives:
397 % \hfsetfillcolor{blue!10}
398 % \hfsetbordercolor{blue}
399 % \[\tikzmarkin{z1}x+y=400\tikzmarkend{z1}\]
400 %
401 % From the version 0.3, it is also possible to customize the fill and the border color by means of the following keys:
402 % \begin{itemize}
403 % \item \packoption{set fill color}{fancybrown}: this key sets the fill color;
404 % \item \packoption{set border color}{fancyviolet}: this key sets the border color.
405 % \end{itemize}
406 %
407 % An example:
408 % \begin{verbatim}
409 % \[
410 % \tikzmarkin[set fill color=green!50!lime!30,
411 % set border color=green!40!black]{z-a}(0.2,-0.4)(-0.2,0.6)
412 % \dfrac{100}{x}
413 % \tikzmarkend{z-a}
414 % \]
415 % \end{verbatim}
416 % The result:
417 % \[\tikzmarkin[set fill color=green!50!lime!30,set border color=green!40!black]{z-a}(0.2,-0.4)(-0.2,0.6)\dfrac{100}{x}\tikzmarkend{z-a}\]
418 %
419 % Notice that:
420 % \begin{itemize}
421 % \item the color definition can also be done via \cs{tikzset}; in this case its application is global in the document
422 % \begin{verbatim}
423 % \tikzset{set fill color=orange!30,set border color=orange}
424 % \end{verbatim}
425 % \item global definitions defined via \cs{tikzset} or \cs{hfsetfillcolor} and \cs{hfsetbordercolor} can always be overridden by local ones; that is:
426 % \end{itemize}
427 % \begin{verbatim}
428 % \tikzset{set fill color=orange!30,set border color=orange}
429 % \[
430 % \tikzmarkin[set fill color=green!50!lime!30,
431 % set border color=green!40!black]{label}(0.2,-0.4)(-0.2,0.6)
432 % \dfrac{100}{x}
433 % \tikzmarkend{z-a}
434 % \]
435 % \end{verbatim}
436 % still gives:
437 % \tikzset{set fill color=orange!30,set border color=orange}
438 % \[
439 % \tikzmarkin[set fill color=green!50!lime!30,set border color=green!40!black]{lab}(0.2,-0.4)(-0.2,0.6)
440 % \dfrac{100}{x}
441 % \tikzmarkend{lab}
442 % \]
443 %
444 % \subsection{Using shadings}
445 % \DescribeMacro{shade}^^A
446 % \hfsetfillcolor{blue!10}
447 % \hfsetbordercolor{blue}
448 % The option \smoption{shade} activates the possibility of introducing shaded backgrounds besides any fill color definition currently set up. Available shadings are:
449 % \begin{itemize}
450 % \item vertical shading;
451 % \item horizontal shading;
452 % \item radial shading.
453 % \end{itemize}
454 %
455 % \subsubsection*{Example with vertical shading}
456 % Code:
457 % \begin{verbatim}
458 % \[
459 % \tikzmarkin[top color=white, bottom color=blue!20]{vshade}
460 % x+y=400
461 % \tikzmarkend{vshade}
462 % \]
463 % \end{verbatim}
464 % Result:
465 % \[\tikzmarkin[top color=white, bottom color=blue!20]{vshade}x+y=400\tikzmarkend{vshade}\]
466 %
467 % \subsubsection*{Example with horizontal shading}
468 % Code:
469 % \begin{verbatim}
470 % \[
471 % \tikzmarkin[left color=white, right color=blue!20]{hoshade}
472 % x+y=400
473 % \tikzmarkend{hoshade}
474 % \]
475 % \end{verbatim}
476 % Result:
477 % \[\tikzmarkin[left color=white, right color=blue!20]{hoshade}x+y=400\tikzmarkend{hoshade}\]
478 %
479 % % \subsubsection*{Example with radial shading}
480 % Code:
481 % \begin{verbatim}
482 % \[
483 % \tikzmarkin[outer color=white, inner color=blue!20]{rshade}
484 % x+y=400
485 % \tikzmarkend{rshade}
486 % \]
487 % \end{verbatim}
488 % Result:
489 % \[\tikzmarkin[outer color=white, inner color=blue!20]{rshade}x+y=400\tikzmarkend{rshade}\]
490 %
491 % \subsection{Avoiding the background color}
492 % \DescribeMacro{nofill}^^A
493 % Using the \smoption{nofill} option allows very simply to not introduce the background color.
494 % When the option is active, you can not change this behaviour inside the document. Another way to remove the background color, is to set the fill color by means of \cs{hfsetfillcolor} to be of the same color of the page.
495 % \subsection{Disable rounded corners}
496 % \DescribeMacro{norndcorners}^^A
497 % To disable the rounded corners, it exists two ways actually. The first one, which is a global approach, is the option \smoption{norndcorners}: as any of the other package options, it should be provided during the package load.
498 %
499 % It exists a second way that disables the rounded corners only locally; this approach needs the \smkey{disable rounded corners} key to be set to \verb|true|.
500 %
501 % For example:
502 % \begin{verbatim}
503 % \[
504 % \tikzmarkin[disable rounded corners=true]{mark 1}
505 % x+y=400
506 % \tikzmarkend{mark 1}
507 % \]
508 % \end{verbatim}
509 % The result:
510 % \[\tikzmarkin[disable rounded corners=true]{mark 1}x+y=400\tikzmarkend{mark 1}\]
511 %
512 % \subsection{The \texttt{markings} option}\label{subsec:markings}
513 % \DescribeMacro{markings}^^A
514 % Loading the package with the \smoption{markings} option allows to mark positions on the box delimiting the highlighted area. This can be achieved by setting the key \smkey{mark at}\verb|=<pos>| where \verb|<pos>=[0,1]|; the positions can be later accessed with the key \smkey{use marker id}\verb|=<id-num>| where \verb|<id-num>| is the progressive identifier of the positions previously marked.
515 %
516 % For example:
517 % \tikzset{set fill color=orange!30,set border color=orange}
518 % \[
519 % \tikzmarkin[show markers,mark at=0,]{marker 1}
520 % x+y=400
521 % \tikzmarkend{marker 1}
522 % \tikz[remember picture,overlay]{
523 % \draw[use marker id,blue,xscale=-1](0,0)arc(270:90:1.5mm);
524 % }
525 % \]
526 % is realized by means of:
527 % \begin{verbatim}
528 % \tikzset{set fill color=orange!30,set border color=orange}
529 % \[
530 % \tikzmarkin[show markers,mark at=0,]{marker 1}
531 % x+y=400
532 % \tikzmarkend{marker 1}
533 % \tikz[remember picture,overlay]{
534 % \draw[use marker id,blue,xscale=-1](0,0)arc(270:90:1.5mm);
535 % }
536 % \]
537 % \end{verbatim}
538 %
539 % Actually, it is possible to mark more than one point:
540 % \[
541 % \tikzmarkin[show markers,mark at=0,mark at=0.55]{marker 2}
542 % x+y=400
543 % \tikzmarkend{marker 2}
544 % \tikz[remember picture,overlay]\draw[use marker id=1,blue,xscale=-1](0,0)arc(270:90:1.5mm);
545 % \tikz[remember picture,overlay]\draw[use marker id=2,blue](0,0)arc(270:90:1.5mm);
546 % \]
547 % by referring them in the same order in which they have been marked:
548 % \begin{verbatim}
549 % \[
550 % \tikzmarkin[show markers,mark at=0,mark at=0.55]{marker 2}
551 % x+y=400
552 % \tikzmarkend{marker 2}
553 % \tikz[remember picture,overlay]{
554 % \draw[use marker id=1,blue,xscale=-1](0,0)arc(270:90:1.5mm);
555 % }
556 % \tikz[remember picture,overlay]{
557 % \draw[use marker id=2,blue](0,0)arc(270:90:1.5mm);
558 % }
559 % \]
560 % \end{verbatim}
561 %
562 % The markers can become visible when the \smkey{show markers} key is activated. By default, they are invisible, but during the working process it may be useful to know their location. In addition, the markers can be customized:
563 % \begin{itemize}
564 % \item \packoption{marker size}{1pt}: this key sets the radius of the marker;
565 % \item \packoption{marker color}{blue}: this key sets the color of the marker.
566 % \end{itemize}
567 %
568 % The options necessitates of the \library{decorations.markings} of Ti\textit{k}Z: this library, however, is not always loaded, but just in case the \hftikz\ \smoption{markings} option is active.
569 %
570 % \section{Efficient use of Ti\textit{k}Z styles}
571 % Ti\textit{k}Z are very powerful and their use is recommended also with \hftikz. For example, an intelligent way to proceed if two different highlighting colors have to be used is as follows:
572 %\begin{verbatim}
573 %\tikzset{offset definition/.style={
574 % above left offset={-0.1,0.6},
575 % below right offset={0.1,-0.45},
576 % },
577 % h1/.style={
578 % offset definition,
579 % set fill color=green!50!lime!60,
580 % set border color=green!40!black,
581 % },
582 % h2/.style={
583 % offset definition,
584 % set fill color=blue!20!cyan!60,
585 % set border color=blue!60!cyan,
586 % }
587 %}
588 %\end{verbatim}
589 %\tikzset{offset definition/.style={
590 % above left offset={-0.1,0.6},
591 % below right offset={0.1,-0.45},
592 % },
593 % h1/.style={
594 % offset definition,
595 % set fill color=green!50!lime!60,
596 % set border color=green!40!black,
597 % },
598 % h2/.style={
599 % offset definition,
600 % set fill color=blue!20!cyan!60,
601 % set border color=blue!60!cyan,
602 % }
603 %}
604 % Their use in the document is:
605 % \begin{verbatim}
606 % \[\tikzmarkin[h1]{st-a}x + \dfrac{y}{z} = 400\tikzmarkend{st-a}\]
607 % \[\tikzmarkin[h2]{st-b}x + \dfrac{y}{z} = 400\tikzmarkend{st-b}\]
608 % \end{verbatim}
609 % which gives as result:
610 % \[\tikzmarkin[h1]{st-a}x + \dfrac{y}{z} = 400\tikzmarkend{st-a}\]
611 % and
612 % \[\tikzmarkin[h2]{st-b}x + \dfrac{y}{z} = 400\tikzmarkend{st-b}\]
613 %
614 % \StopEventually{\PrintChanges}
615 %
616 % \section{Implementation}
617 %
618 % \iffalse
619 %<*package>
620 % \fi
621 %
622 % \begin{macrocode}
623 \RequirePackage{tikz}
624 \usetikzlibrary{shadings}
625 \RequirePackage{xparse}
626 \RequirePackage{etoolbox}
627 % \end{macrocode}
628 %
629 % This warning is arised after the first compilation run to inform that a second run is necessary for the final result. The code
630 % has been inspired by \href{http://tex.stackexchange.com/a/82072/13304}{this answer on TeX.SX}.
631 %
632 % \begin{macrocode}
633 \AtEndDocument{%
634 \let\oldpgfsyspdfmark\pgfsyspdfmark
635 \def\pgfsyspdfmark#1#2#3{%
636 \expandafter\let\expandafter\tmp\csname pgf@sys@pdf@mark@pos@#1\endcsname
637 \oldpgfsyspdfmark{#1}{#2}{#3}%
638 \expandafter\ifx\csname pgf@sys@pdf@mark@pos@#1\endcsname\tmp\else
639 \let\oldsavepointas\savepointas
640 \def\savepointas##1##2{%
641 \immediate\write\@auxout{hf-TikZ Warning: Mark '##1' changed. Rerun to get mark in right position.}%
642 }
643 \fi
644 }}
645 % \end{macrocode}
646 %
647 % \subsection{Options definition}
648 % This subsection is devoted to define options and default colors.
649 %
650 % \begin{macrocode}
651 %% Colors
652
653 % Pre-defined colors
654 \definecolor{fancybrown}{RGB}{255,216,197}
655 \definecolor{fancyviolet}{RGB}{197,122,197}
656
657 \newcommand{\fcol}{fancybrown}
658 \newcommand{\bcol}{fancyviolet}
659
660 %% Package option
661
662 \newbool{fill}
663 \booltrue{fill}
664 \DeclareOption{nofill}{\boolfalse{fill}}
665
666 \DeclareOption{customcolors}{
667 \def\hfsetfillcolor#1{\renewcommand{\fcol}{#1}}
668 \def\hfsetbordercolor#1{\renewcommand{\bcol}{#1}}
669 \pgfkeys{/tikz/.cd,
670 set fill color/.code={\renewcommand{\fcol}{#1}},
671 set border color/.code={\renewcommand{\bcol}{#1}}
672 }
673 }
674
675 \newbool{shade}
676 \boolfalse{shade}
677 \DeclareOption{shade}{\booltrue{shade}}
678
679 \newbool{beamer}
680 \boolfalse{beamer}
681 \DeclareOption{beamer}{\booltrue{beamer}}
682
683 \newbool{norndcorners}
684 \boolfalse{norndcorners}
685 \DeclareOption{norndcorners}{\booltrue{norndcorners}}
686
687 \newbool{markings}
688 \boolfalse{markings}
689 \DeclareOption{markings}{\booltrue{markings}}
690
691 \ProcessOptions
692 % \end{macrocode}
693 %
694 % It follows the definition of the keys devoted to disable the rounded corners.
695 %
696 % \begin{macrocode}
697 \pgfkeys{/tikz/.cd,%
698 not use rounded corners/.is choice,%
699 not use rounded corners/true/.style={rounded corners=0pt},%
700 not use rounded corners/false/.style={rounded corners},%
701 }%
702
703 \tikzset{disable rounded corners/.estyle={%
704 not use rounded corners=#1,%
705 },%
706 disable rounded corners/.default=false,%
707 }%
708
709 % \end{macrocode}
710 %
711 % Offsets keys' definition: for compatibility reasons, the initial values change according to the presence of the \smoption{fill} option.
712 %
713 % \begin{macrocode}
714
715 \ifbool{fill}{%
716 \pgfkeys{/tikz/.cd,%
717 left offset/.initial=-0.1,
718 right offset/.initial=0.1,
719 above offset/.initial=0.35,
720 below offset/.initial=-0.18,
721 }
722 }{
723 \pgfkeys{/tikz/.cd,%
724 left offset/.initial=-0.075,
725 right offset/.initial=0.075,
726 above offset/.initial=0.35,
727 below offset/.initial=-0.18,
728 }
729 }
730
731
732 \pgfkeys{/tikz/.cd,%
733 left offset/.get=\leftoff,
734 left offset/.store in=\leftoff,
735 right offset/.get=\rightoff,
736 right offset/.store in=\rightoff,
737 above offset/.get=\aboveoff,
738 above offset/.store in=\aboveoff,
739 below offset/.get=\belowoff,
740 below offset/.store in=\belowoff,
741 below right offset/.initial={\rightoff,\belowoff},
742 below right offset/.get=\belowrightoff,
743 below right offset/.store in=\belowrightoff,
744 above left offset/.initial={\leftoff,\aboveoff},
745 above left offset/.get=\aboveleftoff,
746 above left offset/.store in=\aboveleftoff,
747 }%
748 % \end{macrocode}
749 %
750 % Keys and style definition of the markings: they are activated when the \smoption{markings} option is present. This is a feature request from Bodo Manthey and the implementation has been inspired by Jake's \href{http://tex.stackexchange.com/a/25940/13304}{answer on TeX.SX}: thanks to both.
751 %
752 % \begin{macrocode}
753 \ifbool{markings}{
754 \usetikzlibrary{decorations.markings}
755 \newif\ifshowmarkers
756 \pgfkeys{/tikz/show markers/.is if=showmarkers}
757 \pgfkeys{/tikz/show markers=false}
758
759 \pgfkeys{/tikz/.cd,%
760 marker color/.initial=blue,
761 marker color/.get=\colmarker,
762 marker color/.store in=\colmarker,
763 marker size/.initial=1pt,
764 marker size/.get=\sizemarker,
765 marker size/.store in=\sizemarker,
766 }
767
768 \tikzset{
769 mark at/.style={
770 decoration={
771 markings,
772 mark=
773 at position #1
774 with
775 {
776 \coordinate (marker point-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (0pt,0pt);
777 \coordinate (marker unit vector-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (1,0pt);
778 \coordinate (marker orthogonal unit vector-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (0pt,1);
779 \ifshowmarkers% conditional to make them appear just when invoked
780 \draw[draw=none,fill=\colmarker,radius=\sizemarker] (0,0) circle ;
781 \else
782 \relax
783 \fi
784 }
785 },
786 postaction=decorate
787 },
788 use marker id/.style={
789 shift=(marker point-#1),
790 x=(marker unit vector-#1),
791 y=(marker orthogonal unit vector-#1)
792 },
793 use marker id/.default=1,
794 }
795 }
796 % \end{macrocode}
797 % \subsection{General settings}
798 % This subsection is devoted to illustrate the code used for defining the settings used by the highlighting commands.
799 % \begin{macrocode}
800 %% Settings
801
802 \ifbool{beamer}{%true
803 \newcounter{jumping}
804 \resetcounteronoverlays{jumping}
805
806 \def\jump@setbb#1#2#3{%
807 \@ifundefined{jump@#1@maxbb}{%
808 \expandafter\gdef\csname jump@#1@maxbb\endcsname{#3}%
809 }{%
810 \csname jump@#1@maxbb\endcsname
811 \pgf@xa=\pgf@x
812 \pgf@ya=\pgf@y
813 #3
814 \pgfmathsetlength\pgf@x{max(\pgf@x,\pgf@xa)}%
815 \pgfmathsetlength\pgf@y{max(\pgf@y,\pgf@ya)}%
816 \expandafter\xdef\csname jump@#1@maxbb\endcsname{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}%
817 }
818 \@ifundefined{jump@#1@minbb}{%
819 \expandafter\gdef\csname jump@#1@minbb\endcsname{#2}%
820 }{%
821 \csname jump@#1@minbb\endcsname
822 \pgf@xa=\pgf@x
823 \pgf@ya=\pgf@y
824 #2
825 \pgfmathsetlength\pgf@x{min(\pgf@x,\pgf@xa)}%
826 \pgfmathsetlength\pgf@y{min(\pgf@y,\pgf@ya)}%
827 \expandafter\xdef\csname jump@#1@minbb\endcsname{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}%
828 }
829 }
830
831 \tikzset{%
832 remember picture with id/.style={%
833 remember picture,
834 overlay,
835 save picture id=#1,
836 },
837 save picture id/.code={%
838 \edef\pgf@temp{#1}%
839 \immediate\write\pgfutil@auxout{%
840 \noexpand\savepointas{\pgf@temp}{\pgfpictureid}}%
841 },
842 if picture id/.code args={#1#2#3}{%
843 \@ifundefined{save@pt@#1}{%
844 \pgfkeysalso{#3}%
845 }{
846 \pgfkeysalso{#2}%
847 }
848 },
849 onslide/.code args={<#1>#2}{%
850 \only<#1>{\pgfkeysalso{#2}}%
851 },
852 alt/.code args={<#1>#2#3}{%
853 \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}%
854 },
855 stop jumping/.style={
856 execute at end picture={%
857 \stepcounter{jumping}%
858 \immediate\write\pgfutil@auxout{%
859 \noexpand\jump@setbb{\the\value{jumping}}{\noexpand\pgfpoint{\the\pgf@picminx}{\the\pgf@picminy}}{\noexpand\pgfpoint{\the\pgf@picmaxx}{\the\pgf@picmaxy}}
860 },
861 \csname jump@\the\value{jumping}@maxbb\endcsname
862 \path (\the\pgf@x,\the\pgf@y);
863 \csname jump@\the\value{jumping}@minbb\endcsname
864 \path (\the\pgf@x,\the\pgf@y);
865 },
866 }
867 }
868 }{% false
869 \tikzset{%
870 remember picture with id/.style={%
871 remember picture,
872 overlay,
873 save picture id=#1,
874 },
875 save picture id/.code={%
876 \edef\pgf@temp{#1}%
877 \immediate\write\pgfutil@auxout{%
878 \noexpand\savepointas{\pgf@temp}{\pgfpictureid}}%
879 },
880 if picture id/.code args={#1#2#3}{%
881 \@ifundefined{save@pt@#1}{%
882 \pgfkeysalso{#3}%
883 }{
884 \pgfkeysalso{#2}%
885 }
886 }
887 }
888 }
889
890 \def\savepointas#1#2{%
891 \expandafter\gdef\csname save@pt@#1\endcsname{#2}%
892 }
893
894 \def\tmk@labeldef#1,#2\@nil{%
895 \def\tmk@label{#1}%
896 \def\tmk@def{#2}%
897 }
898
899 \tikzdeclarecoordinatesystem{pic}{%
900 \pgfutil@in@,{#1}%
901 \ifpgfutil@in@%
902 \tmk@labeldef#1\@nil
903 \else
904 \tmk@labeldef#1,(0pt,0pt)\@nil
905 \fi
906 \@ifundefined{save@pt@\tmk@label}{%
907 \tikz@scan@one@point\pgfutil@firstofone\tmk@def
908 }{%
909 \pgfsys@getposition{\csname save@pt@\tmk@label\endcsname}\save@orig@pic%
910 \pgfsys@getposition{\pgfpictureid}\save@this@pic%
911 \pgf@process{\pgfpointorigin\save@this@pic}%
912 \pgf@xa=\pgf@x
913 \pgf@ya=\pgf@y
914 \pgf@process{\pgfpointorigin\save@orig@pic}%
915 \advance\pgf@x by -\pgf@xa
916 \advance\pgf@y by -\pgf@ya
917 }%
918 }
919 % \end{macrocode}
920 % \subsection{The highlighting commands}
921 % In this subsection the definitions of the highlighing commands are shown when the \texttt{beamer} mode is active and when it is not. Thanks to \textsf{etoolbox} it is possible to perform a check on the active options. Then the commands are declared.
922 % \begin{macrocode}
923 \ifbool{norndcorners}{%true-norndcorners
924 \ifbool{beamer}{%true-beamer
925 \ifbool{fill}{%true-fill
926 \ifbool{shade}{%true-shade
927 \NewDocumentCommand{\tikzmarkin}{r<> o m D(){\belowrightoff} D(){\aboveleftoff}}{%
928 \IfNoValueTF{#2}{%true-val
929 \only<#1>{\tikz[remember picture,overlay]
930 \draw[line width=1pt,rectangle,fill=\fcol,draw=\bcol]
931 (pic cs:#3) ++(#4) rectangle (#5) node [anchor=base] (#3){}
932 ;}
933 }{%false-val
934 \only<#1>{\tikz[remember picture,overlay]
935 \draw[line width=1pt,rectangle,fill=\fcol,draw=\bcol,#2]
936 (pic cs:#3) ++(#4) rectangle (#5) node [anchor=base] (#3){}
937 ;}}
938 }
939 }{%false-shade
940 \NewDocumentCommand{\tikzmarkin}{r<> o m D(){\belowrightoff} D(){\aboveleftoff}}{%
941 \IfNoValueTF{#2}{%true-val
942 \only<#1>{\tikz[remember picture,overlay]
943 \draw[line width=1pt,rectangle,fill=\fcol,draw=\bcol]
944 (pic cs:#3) ++(#4) rectangle (#5) node [anchor=base] (#3){}
945 ;}
946 }{%false-val
947 \only<#1>{\tikz[remember picture,overlay]
948 \draw[line width=1pt,rectangle,fill=\fcol,draw=\bcol,#2]
949 (pic cs:#3) ++(#4) rectangle (#5) node [anchor=base] (#3){}
950 ;}}
951 }
952 }
953 }{%false-fill
954 \NewDocumentCommand{\tikzmarkin}{r<> o m D(){\belowrightoff} D(){\aboveleftoff}}{%
955 \IfNoValueTF{#2}{%true-val
956 \only<#1>{\tikz[remember picture,overlay]
957 \draw[line width=1pt,rectangle,draw=\bcol]
958 (pic cs:#3) ++(#4) rectangle (#5) node [anchor=base] (#3){}
959 ;}
960 }{%false-val
961 \only<#1>{\tikz[remember picture,overlay]
962 \draw[line width=1pt,rectangle,draw=\bcol,#2]
963 (pic cs:#3) ++(#4) rectangle (#5) node [anchor=base] (#3){}
964 ;}}
965 }
966 }
967 }{%false-beamer
968 \ifbool{fill}{%true-fill
969 \ifbool{shade}{%true-shade
970 \NewDocumentCommand{\tikzmarkin}{o m D(){\belowrightoff} D(){\aboveleftoff}}{%
971 \IfNoValueTF{#1}{%true-val
972 \tikz[remember picture,overlay]
973 \draw[line width=1pt,rectangle,fill=\fcol,draw=\bcol]
974 (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){}
975 ;
976 }{%false-val
977 \tikz[remember picture,overlay]
978 \draw[line width=1pt,rectangle,fill=\fcol,draw=\bcol,#1]
979 (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){}
980 ;}}
981 }{%false-shade
982 \NewDocumentCommand{\tikzmarkin}{o m D(){\belowrightoff} D(){\aboveleftoff}}{%
983 \IfNoValueTF{#1}{%true-val
984 \tikz[remember picture,overlay]
985 \draw[line width=1pt,rectangle,fill=\fcol,draw=\bcol]
986 (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){}
987 ;
988 }{%false-val
989 \tikz[remember picture,overlay]
990 \draw[line width=1pt,rectangle,fill=\fcol,draw=\bcol,#1]
991 (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){}
992 ;}}
993 }
994 }{%false-fill
995 \NewDocumentCommand{\tikzmarkin}{o m D(){\belowrightoff} D(){\aboveleftoff}}{%
996 \IfNoValueTF{#1}{%true-val
997 \tikz[remember picture,overlay]
998 \draw[line width=1pt,rectangle,draw=\bcol]
999 (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){}
1000 ;
1001 }{%false-val
1002 \tikz[remember picture,overlay]
1003 \draw[line width=1pt,rectangle,draw=\bcol,#1]
1004 (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){}
1005 ;}}
1006 % \NewDocumentCommand{\tikzmarkin}{m D(){0.075,-0.18} D(){-0.075,0.35}}{%
1007 % \tikz[remember picture,overlay]
1008 % \draw[line width=1pt,rectangle,draw=\bcol]
1009 % (pic cs:#1) ++(#2) rectangle (#3) node [anchor=base] (#1){}
1010 % ;}
1011 }
1012 }
1013 }{%false-norndcorners
1014 \ifbool{beamer}{%true-beamer
1015 \ifbool{fill}{%true-fill
1016 \ifbool{shade}{%true-shade
1017 \NewDocumentCommand{\tikzmarkin}{r<> o m D(){\belowrightoff} D(){\aboveleftoff}}{%
1018 \IfNoValueTF{#2}{%true-val
1019 \only<#1>{\tikz[remember picture,overlay]
1020 \draw[line width=1pt,rectangle,disable rounded corners,fill=\fcol,draw=\bcol]
1021 (pic cs:#3) ++(#4) rectangle (#5) node [anchor=base] (#3){}
1022 ;}
1023 }{%false-val
1024 \only<#1>{\tikz[remember picture,overlay]
1025 \draw[line width=1pt,rectangle,disable rounded corners,fill=\fcol,draw=\bcol,#2]
1026 (pic cs:#3) ++(#4) rectangle (#5) node [anchor=base] (#3){}
1027 ;}}
1028 }
1029 }{%false-shade
1030 \NewDocumentCommand{\tikzmarkin}{r<> o m D(){\belowrightoff} D(){\aboveleftoff}}{%
1031 \IfNoValueTF{#2}{%true-val
1032 \only<#1>{\tikz[remember picture,overlay]
1033 \draw[line width=1pt,rectangle,disable rounded corners,fill=\fcol,draw=\bcol]
1034 (pic cs:#3) ++(#4) rectangle (#5) node [anchor=base] (#3){}
1035 ;}
1036 }{%false-val
1037 \only<#1>{\tikz[remember picture,overlay]
1038 \draw[line width=1pt,rectangle,disable rounded corners,fill=\fcol,draw=\bcol,#2]
1039 (pic cs:#3) ++(#4) rectangle (#5) node [anchor=base] (#3){}
1040 ;}}
1041 }
1042 }
1043 }{%false-fill
1044 \NewDocumentCommand{\tikzmarkin}{r<> o m D(){\belowrightoff} D(){\aboveleftoff}}{%
1045 \IfNoValueTF{#2}{%true-val
1046 \only<#1>{\tikz[remember picture,overlay]
1047 \draw[line width=1pt,rectangle,disable rounded corners,draw=\bcol]
1048 (pic cs:#3) ++(#4) rectangle (#5) node [anchor=base] (#3){}
1049 ;}
1050 }{%false-val
1051 \only<#1>{\tikz[remember picture,overlay]
1052 \draw[line width=1pt,rectangle,disable rounded corners,draw=\bcol,#2]
1053 (pic cs:#3) ++(#4) rectangle (#5) node [anchor=base] (#3){}
1054 ;}}
1055 }
1056 }
1057 }{%false-beamer
1058 \ifbool{fill}{%true-fill
1059 \ifbool{shade}{%true-shade
1060 \NewDocumentCommand{\tikzmarkin}{o m D(){\belowrightoff} D(){\aboveleftoff}}{%
1061 \IfNoValueTF{#1}{%true-val
1062 \tikz[remember picture,overlay]
1063 \draw[line width=1pt,rectangle,disable rounded corners,fill=\fcol,draw=\bcol]
1064 (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){}
1065 ;
1066 }{%false-val
1067 \tikz[remember picture,overlay]
1068 \draw[line width=1pt,rectangle,disable rounded corners,fill=\fcol,draw=\bcol,#1]
1069 (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){}
1070 ;}}
1071 }{%false-shade
1072 \NewDocumentCommand{\tikzmarkin}{o m D(){\belowrightoff} D(){\aboveleftoff}}{%
1073 \IfNoValueTF{#1}{%true-val
1074 \tikz[remember picture,overlay]
1075 \draw[line width=1pt,rectangle,disable rounded corners,fill=\fcol,draw=\bcol]
1076 (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){}
1077 ;
1078 }{%false-val
1079 \tikz[remember picture,overlay]
1080 \draw[line width=1pt,rectangle,disable rounded corners,fill=\fcol,draw=\bcol,#1]
1081 (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){}
1082 ;}}
1083 }
1084 }{%false-fill
1085 \NewDocumentCommand{\tikzmarkin}{o m D(){\belowrightoff} D(){\aboveleftoff}}{%
1086 \IfNoValueTF{#1}{%true-val
1087 \tikz[remember picture,overlay]
1088 \draw[line width=1pt,rectangle,disable rounded corners,draw=\bcol]
1089 (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){}
1090 ;
1091 }{%false-val
1092 \tikz[remember picture,overlay]
1093 \draw[line width=1pt,rectangle,disable rounded corners,draw=\bcol,#1]
1094 (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){}
1095 ;}}
1096 }
1097 }
1098 }
1099
1100 \newcommand\tikzmarkend[2][]{%
1101 \tikz[remember picture with id=#2] #1;}
1102 % \end{macrocode}
1103 % \iffalse
1104 %</package>
1105 % \fi
1106 %
1107 % \Finale
1108 \endinput