Debian Codegraph @

texmf-dist/tex/latex/pgf/doc/pgfmanual-en-macros.tex

raw
1 % Copyright 2019 by Till Tantau
2 %
3 % This file may be distributed and/or modified
4 %
5 % 1. under the LaTeX Project Public License and/or
6 % 2. under the GNU Free Documentation License.
7 %
8 % See the file doc/generic/pgf/licenses/LICENSE for more details.
9
10 % $Header$
11
12
13 \newcount\pgfmanualtargetcount
14
15 \colorlet{examplefill}{yellow!80!black}
16 \definecolor{graphicbackground}{rgb}{0.96,0.96,0.8}
17 \definecolor{codebackground}{rgb}{0.9,0.9,1}
18 \definecolor{animationgraphicbackground}{rgb}{0.96,0.96,0.8}
19
20 \newenvironment{pgfmanualentry}{\list{}{\leftmargin=2em\itemindent-\leftmargin\def\makelabel##1{\hss##1}}}{\endlist}
21 \newcounter{pgfmanualentry}
22 \newcommand\pgfmanualentryheadline[1]{%
23 \itemsep=0pt\parskip=0pt{\raggedright\item\refstepcounter{pgfmanualentry}\strut{#1}\par}\topsep=0pt}
24 \newcommand\pgfmanualbody{\parskip3pt}
25
26 \let\origtexttt=\texttt
27 \def\texttt#1{{\def\textunderscore{\char`\_}\def\textbraceleft{\char`\{}\def\textbraceright{\char`\}}\origtexttt{#1}}}
28 \def\exclamationmarktext{!}
29 \def\atmarktext{@}
30
31 {
32 \catcode`\|=12
33 \gdef\pgfmanualnormalbar{|}
34 \catcode`\|=13
35 \AtBeginDocument{\gdef|{\ifmmode\pgfmanualnormalbar\else\expandafter\verb\expandafter|\fi}}
36 }
37
38
39
40 \newenvironment{pgflayout}[1]{
41 \begin{pgfmanualentry}
42 \pgfmanualentryheadline{%
43 \pgfmanualpdflabel{#1}{}%
44 \texttt{\string\pgfpagesuselayout\char`\{\declare{#1}\char`\}}\oarg{options}%
45 }
46 \index{#1@\protect\texttt{#1} layout}%
47 \index{Page layouts!#1@\protect\texttt{#1}}%
48 \pgfmanualbody
49 }
50 {
51 \end{pgfmanualentry}
52 }
53
54
55 \newenvironment{sysanimateattribute}[1]{
56 \begin{pgfmanualentry}
57 \pgfmanualentryheadline{%
58 \pgfmanualpdflabel{#1}{}%
59 \texttt{\string\pgfsysanimate\char`\{\declare{#1}\char`\}}%
60 }
61 \index{#1@\protect\texttt{#1} system layer animation attribute}%
62 \index{Animation attributes (system layer)!#1@\protect\texttt{#1}}%
63 \pgfmanualbody
64 }
65 {
66 \end{pgfmanualentry}
67 }
68
69
70 \newenvironment{animateattribute}[1]{
71 \begin{pgfmanualentry}
72 \pgfmanualentryheadline{%
73 \pgfmanualpdflabel{#1}{}%
74 \texttt{\string\pgfanimateattribute\char`\{\declare{#1}\char`\}\marg{options}}%
75 }
76 \index{#1@\protect\texttt{#1} basic layer animation attribute}%
77 \index{Animation attributes (basic layer)!#1@\protect\texttt{#1}}%
78 \pgfmanualbody
79 }
80 {
81 \end{pgfmanualentry}
82 }
83
84
85 \newenvironment{tikzanimateattribute}[1]{
86 \begin{pgfmanualentry}
87 \pgfmanualentryheadline{%
88 \foreach \attr in{#1} {\expandafter\pgfmanualpdflabel\expandafter{\attr}{}}%
89 \textbf{Animation attribute} \foreach \attr[count=\i]
90 in{#1}{{\ifnum\i>1 \textbf,\fi} \texttt{:\declare{\attr}}}%
91 }
92 \foreach\attr in{#1}{%
93 \edef\indexcall{%
94 \noexpand\index{\attr@\noexpand\protect\noexpand\texttt{\attr} animation attribute}%
95 \noexpand\index{Animation attributes!\attr@\noexpand\protect\noexpand\texttt{\attr}}%
96 }%
97 \indexcall%
98 }%
99 \pgfmanualbody
100 }
101 {
102 \end{pgfmanualentry}
103 }
104
105
106 \newenvironment{command}[1]{
107 \begin{pgfmanualentry}
108 \extractcommand#1\@@
109 \pgfmanualbody
110 }
111 {
112 \end{pgfmanualentry}
113 }
114
115 \makeatletter
116
117 \def\includeluadocumentationof#1{
118 \directlua{require 'pgf.manual.DocumentParser'}
119 \directlua{pgf.manual.DocumentParser.include '#1'}
120 }
121
122 \newenvironment{luageneric}[4]{
123 \pgfmanualentry
124 \pgfmanualentryheadline{#4 \texttt{#1\declare{#2}}#3}
125 \index{#2@\protect\texttt{#2} (Lua)}%
126 \def\temp{#1}
127 \ifx\temp\pgfutil@empty\else
128 \index{#1@\protect\texttt{#1}!#2@\protect\texttt{#2} (Lua)}%
129 \fi
130 \pgfmanualbody
131 }{\endpgfmanualentry}
132
133 \newenvironment{luatable}[3]{
134 \medskip
135 \luageneric{#1}{#2}{ (declared in \texttt{#3})}{\textbf{Lua table}}
136 }{\endluageneric}
137
138 \newenvironment{luafield}[1]{
139 \pgfmanualentry
140 \pgfmanualentryheadline{Field \texttt{\declare{#1}}}
141 \pgfmanualbody
142 }{\endpgfmanualentry}
143
144
145 \newenvironment{lualibrary}[1]{
146 \pgfmanualentry
147 \pgfmanualentryheadline{%
148 \pgfmanualpdflabel{#1}{}%
149 \textbf{Graph Drawing Library} \texttt{\declare{#1}}%
150 }
151 \index{#1@\protect\texttt{#1} graph drawing library}%
152 \index{Libraries!#1@\protect\texttt{#1}}%
153 \index{Graph drawing libraries!#1@\protect\texttt{#1}}%
154 \vskip.25em
155 {\ttfamily\char`\\usegdlibrary\char`\{\declare{#1}\char`\}\space\space \char`\%\space\space \LaTeX\space and plain \TeX}\\
156 {\ttfamily\char`\\usegdlibrary[\declare{#1}]\space \char`\%\space\space Con\TeX t}\smallskip\par
157 \pgfmanualbody
158 }{\endpgfmanualentry}
159
160 \newenvironment{luadeclare}[4]{
161 \pgfmanualentry
162 \def\manual@temp@default{#3}%
163 \def\manual@temp@initial{#4}%
164 \def\manual@temp@{#3#4}%
165 \pgfmanualentryheadline{%
166 \pgfmanualpdflabel{#1}{}%
167 {\ttfamily/graph
168 drawing/\declare{#1}\opt{=}}\opt{#2}\hfill%
169 \ifx\manual@temp@\pgfutil@empty\else%
170 (\ifx\manual@temp@default\pgfutil@empty\else%
171 default {\ttfamily #3}\ifx\manual@temp@initial\pgfutil@empty\else, \fi%
172 \fi%
173 \ifx\manual@temp@initial\pgfutil@empty\else%
174 initially {\ttfamily #4}%
175 \fi%
176 )\fi%
177 }%
178 \index{#1@\protect\texttt{#1} key}%
179 \pgfmanualbody
180 \gdef\myname{#1}%
181 % \keyalias{tikz}
182 % \keyalias{tikz/graphs}
183 }{\endpgfmanualentry}
184
185 \newenvironment{luadeclarestyle}[4]{
186 \pgfmanualentry
187 \def\manual@temp@para{#2}%
188 \def\manual@temp@default{#3}%
189 \def\manual@temp@initial{#4}%
190 \def\manual@temp@{#3#4}%
191 \pgfmanualentryheadline{%
192 \pgfmanualpdflabel{#1}{}%
193 {\ttfamily/graph drawing/\declare{#1}}\ifx\manual@temp@para\pgfutil@empty\else\opt{\texttt=}\opt{#2}\fi\hfill%
194 (style\ifx\manual@temp@\pgfutil@empty\else, %
195 \ifx\manual@temp@default\pgfutil@empty\else%
196 default {\ttfamily #3}\ifx\manual@temp@initial\pgfutil@empty\else, \fi%
197 \fi%
198 \ifx\manual@temp@initial\pgfutil@empty\else%
199 initially {\ttfamily #4}%
200 \fi%
201 \fi)%
202 }%
203 \index{#1@\protect\texttt{#1} key}%
204 \pgfmanualbody%
205 \gdef\myname{#1}%
206 % \keyalias{tikz}
207 % \keyalias{tikz/graphs}
208 }{\endpgfmanualentry}
209
210 \newenvironment{luanamespace}[2]{
211 \luageneric{#1}{#2}{}{\textbf{Lua namespace}}
212 }{\endluageneric}
213
214 \newenvironment{luafiledescription}[1]{}{}
215
216 \newenvironment{luacommand}[4]{
217 \hypertarget{pgf/lua/#1}{\luageneric{#2}{#3}{\texttt{(#4)}}{\texttt{function}}}
218 }{\endluageneric}
219
220 \newenvironment{luaparameters}{\par\emph{Parameters:}%
221 \parametercount=0\relax%
222 \let\item=\parameteritem%
223 \let\list=\restorelist%
224 }
225 {\par
226 }
227
228 \newenvironment{luareturns}{\par\emph{Returns:}%
229 \parametercount=0\relax%
230 \let\item=\parameteritem%
231 \let\list=\restorelist%
232 }
233 {\par
234 }
235
236 \newcount\parametercount
237
238 \newenvironment{parameterdescription}{\unskip%
239 \parametercount=0\relax%
240 \let\item=\parameteritem%
241 \let\list=\restorelist%
242 }
243 {\par
244 }
245 \let\saveditemcommand=\item
246 \let\savedlistcommand=\list
247 \def\denselist#1#2{\savedlistcommand{#1}{#2}\parskip0pt\itemsep0pt}
248 \def\restorelist{\let\item=\saveditemcommand\denselist}
249 \def\parameteritem{\pgfutil@ifnextchar[\parameteritem@{}}%}
250 \def\parameteritem@[#1]{\advance\parametercount by1\relax\hskip0.15em plus 1em\emph{\the\parametercount.}\kern1ex\def\test{#1}\ifx\test\pgfutil@empty\else#1\kern.5em\fi}
251
252 \newenvironment{commandlist}[1]{%
253 \begin{pgfmanualentry}
254 \foreach \xx in {#1} {%
255 \expandafter\extractcommand\xx\@@
256 }%
257 \pgfmanualbody
258 }{%
259 \end{pgfmanualentry}
260 }%
261
262 % \begin{internallist}[register]{\pgf@xa}
263 % \end{internallist}
264 %
265 % \begin{internallist}[register]{\pgf@xa,\pgf@xb}
266 % \end{internallist}
267 \newenvironment{internallist}[2][register]{%
268 \begin{pgfmanualentry}
269 \foreach \xx in {#2} {%
270 \expandafter\extractinternalcommand\expandafter{\xx}{#1}%
271 }%
272 \pgfmanualbody
273 }{%
274 \end{pgfmanualentry}
275 }%
276 \def\extractinternalcommand#1#2{%
277 \removeats{#1}%
278 \pgfmanualentryheadline{%
279 \pgfmanualpdflabel{\textbackslash\strippedat}{}%
280 Internal #2 \declare{\texttt{\string#1}}}%
281 \index{Internals!\strippedat @\protect\myprintocmmand{\strippedat}}%
282 \index{\strippedat @\protect\myprintocmmand{\strippedat}}%
283 }
284
285 %% MW: START MATH MACROS
286 \def\mvar#1{{\ifmmode\textrm{\textit{#1}}\else\rmfamily\textit{#1}\fi}}
287
288 \makeatletter
289
290 \def\extractmathfunctionname#1{\extractmathfunctionname@#1(,)\tmpa\tmpb}
291 \def\extractmathfunctionname@#1(#2)#3\tmpb{\def\mathname{#1}}
292
293 \makeatother
294
295 \newenvironment{math-function}[1]{
296 \def\mathdefaultname{#1}
297 \extractmathfunctionname{#1}
298 \edef\mathurl{{math:\mathname}}\expandafter\hypertarget\expandafter{\mathurl}{}%
299 \begin{pgfmanualentry}
300 \pgfmanualentryheadline{\texttt{#1}}%
301 \index{\mathname @\protect\texttt{\mathname} math function}%
302 \index{Math functions!\mathname @\protect\texttt{\mathname}}%
303 \pgfmanualbody
304 }
305 {
306 \end{pgfmanualentry}
307 }
308
309 \def\pgfmanualemptytext{}
310 \def\pgfmanualvbarvbar{\char`\|\char`\|}
311
312 \newenvironment{math-operator}[4][]{%
313 \begin{pgfmanualentry}
314 \csname math#3operator\endcsname{#2}{#4}
315 \def\mathtest{#4}%
316 \ifx\mathtest\pgfmanualemptytext%
317 \def\mathtype{(#3 operator)}
318 \else%
319 \def\mathtype{(#3 operator; uses the \texttt{#4} function)}
320 \fi%
321 \pgfmanualentryheadline{\mathexample\hfill\mathtype}%
322 \def\mathtest{#1}%
323 \ifx\mathtest\pgfmanualemptytext%
324 \index{#2@\protect\texttt{#2} #3 math operator}%
325 \index{Math operators!#2@\protect\texttt{#2}}%
326 \fi%
327 \pgfmanualbody
328 }
329 {\end{pgfmanualentry}}
330
331 \newenvironment{math-operators}[5][]{%
332 \begin{pgfmanualentry}
333 \csname math#4operator\endcsname{#2}{#3}
334 \def\mathtest{#5}%
335 \ifx\mathtest\pgfmanualemptytext%
336 \def\mathtype{(#4 operators)}
337 \else%
338 \def\mathtype{(#4 operators; use the \texttt{#5} function)}
339 \fi%
340 \pgfmanualentryheadline{\mathexample\hfill\mathtype}%
341 \def\mathtest{#1}%
342 \ifx\mathtest\pgfmanualemptytext%
343 \index{#2#3@\protect\texttt{#2\protect\ #3} #4 math operators}%
344 \index{Math operators!#2#3@\protect\texttt{#2\protect\ #3}}%
345 \fi%
346 \pgfmanualbody
347 }
348 {\end{pgfmanualentry}}
349
350 \def\mathinfixoperator#1#2{%
351 \def\mathoperator{\texttt{#1}}%
352 \def\mathexample{\mvar{x}\space\texttt{#1}\space\mvar{y}}%
353 }
354
355 \def\mathprefixoperator#1#2{%
356 \def\mathoperator{\texttt{#1}}%
357 \def\mathexample{\texttt{#1}\mvar{x}}%
358 }
359
360 \def\mathpostfixoperator#1#2{%
361 \def\mathoperator{\texttt{#1}}
362 \def\mathexample{\mvar{x}\texttt{#1}}%
363 }
364
365 \def\mathgroupoperator#1#2{%
366 \def\mathoperator{\texttt{#1\ #2}}%
367 \def\mathexample{\texttt{#1}\mvar{x}\texttt{#2}}%
368 }
369
370 \expandafter\let\csname matharray accessoperator\endcsname=\mathgroupoperator
371 \expandafter\let\csname matharrayoperator\endcsname=\mathgroupoperator
372
373 \def\mathconditionaloperator#1#2{%
374 \def\mathoperator{#1\space#2}
375 \def\mathexample{\mvar{x}\ \texttt{#1}\ \mvar{y}\ {\texttt{#2}}\ \mvar{z}}
376 }
377
378 \newcommand\mathcommand[1][\mathdefaultname]{%
379 \expandafter\makemathcommand#1(\empty)\stop%
380 \expandafter\extractcommand\mathcommandname\@@%
381 \medskip
382 }
383 \makeatletter
384
385 \def\makemathcommand#1(#2)#3\stop{%
386 \expandafter\def\expandafter\mathcommandname\expandafter{\csname pgfmath#1\endcsname}%
387 \ifx#2\empty%
388 \else%
389 \@makemathcommand#2,\stop,
390 \fi}
391 \def\@makemathcommand#1,{%
392 \ifx#1\stop%
393 \else%
394 \expandafter\def\expandafter\mathcommandname\expandafter{\mathcommandname{\ttfamily\char`\{#1\char`\}}}%
395 \expandafter\@makemathcommand%
396 \fi}
397 \makeatother
398
399 \def\calcname{\textsc{calc}}
400
401 \newenvironment{math-keyword}[1]{
402 \extracttikzmathkeyword#1@
403 \begin{pgfmanualentry}
404 \pgfmanualentryheadline{\texttt{\color{red}\mathname}\mathrest}%
405 \index{\mathname @\protect\texttt{\mathname} tikz math function}%
406 \index{TikZ math functions!\mathname @\protect\texttt{\mathname}}%
407 \pgfmanualbody
408 }
409 {
410 \end{pgfmanualentry}
411 }
412
413 \def\extracttikzmathkeyword#1#2@{%
414 \def\mathname{#1}%
415 \def\mathrest{#2}%
416 }
417
418 %% MW: END MATH MACROS
419
420
421 \def\extractcommand#1#2\@@{%
422 \removeats{#1}%
423 \pgfmanualentryheadline{%
424 \pgfmanualpdflabel{\textbackslash\strippedat}{}%
425 \declare{\expandafter\texttt\expandafter{\string#1}}#2%
426 }%
427 \index{\strippedat @\protect\myprintocmmand{\strippedat}}
428 }
429
430 \def\luaextractcommand#1#2\relax{%
431 \declare{\texttt{\string#1}}#2\par%
432 % \removeats{#1}%
433 % \index{\strippedat @\protect\myprintocmmand{\strippedat}}
434 % \pgfmanualpdflabel{\textbackslash\strippedat}{}%
435 }
436
437
438 % \begin{environment}{{name}\marg{arguments}}
439 \renewenvironment{environment}[1]{
440 \begin{pgfmanualentry}
441 \extractenvironement#1\@@
442 \pgfmanualbody
443 }
444 {
445 \end{pgfmanualentry}
446 }
447
448 \def\extractenvironement#1#2\@@{%
449 \pgfmanualentryheadline{%
450 \pgfmanualpdflabel{#1}{}%
451 {\ttfamily\char`\\begin\char`\{\declare{#1}\char`\}}#2%
452 }%
453 \pgfmanualentryheadline{{\ttfamily\ \ }\meta{environment contents}}%
454 \pgfmanualentryheadline{{\ttfamily\char`\\end\char`\{\declare{#1}\char`\}}}%
455 \index{#1@\protect\texttt{#1} environment}%
456 \index{Environments!#1@\protect\texttt{#1}}
457 }
458
459
460 \newenvironment{plainenvironment}[1]{
461 \begin{pgfmanualentry}
462 \extractplainenvironement#1\@@
463 \pgfmanualbody
464 }
465 {
466 \end{pgfmanualentry}
467 }
468
469 \def\extractplainenvironement#1#2\@@{%
470 \pgfmanualentryheadline{{\ttfamily\declare{\char`\\#1}}#2}%
471 \pgfmanualentryheadline{{\ttfamily\ \ }\meta{environment contents}}%
472 \pgfmanualentryheadline{{\ttfamily\declare{\char`\\end#1}}}%
473 \index{#1@\protect\texttt{#1} environment}%
474 \index{Environments!#1@\protect\texttt{#1}}%
475 }
476
477
478 \newenvironment{contextenvironment}[1]{
479 \begin{pgfmanualentry}
480 \extractcontextenvironement#1\@@
481 \pgfmanualbody
482 }
483 {
484 \end{pgfmanualentry}
485 }
486
487 \def\extractcontextenvironement#1#2\@@{%
488 \pgfmanualentryheadline{{\ttfamily\declare{\char`\\start#1}}#2}%
489 \pgfmanualentryheadline{{\ttfamily\ \ }\meta{environment contents}}%
490 \pgfmanualentryheadline{{\ttfamily\declare{\char`\\stop#1}}}%
491 \index{#1@\protect\texttt{#1} environment}%
492 \index{Environments!#1@\protect\texttt{#1}}}
493
494
495 \newenvironment{shape}[1]{
496 \begin{pgfmanualentry}
497 \pgfmanualentryheadline{%
498 \pgfmanualpdflabel{#1}{}%
499 \textbf{Shape} {\ttfamily\declare{#1}}%
500 }%
501 \index{#1@\protect\texttt{#1} shape}%
502 \index{Shapes!#1@\protect\texttt{#1}}
503 \pgfmanualbody
504 }
505 {
506 \end{pgfmanualentry}
507 }
508
509 \newenvironment{pictype}[2]{
510 \begin{pgfmanualentry}
511 \pgfmanualentryheadline{%
512 \pgfmanualpdflabel{#1}{}%
513 \textbf{Pic type} {\ttfamily\declare{#1}#2}%
514 }%
515 \index{#1@\protect\texttt{#1} pic type}%
516 \index{Pic Types!#1@\protect\texttt{#1}}
517 \pgfmanualbody
518 }
519 {
520 \end{pgfmanualentry}
521 }
522
523 \newenvironment{shading}[1]{
524 \begin{pgfmanualentry}
525 \pgfmanualentryheadline{%
526 \pgfmanualpdflabel{#1}{}%
527 \textbf{Shading} {\ttfamily\declare{#1}}}%
528 \index{#1@\protect\texttt{#1} shading}%
529 \index{Shadings!#1@\protect\texttt{#1}}
530 \pgfmanualbody
531 }
532 {
533 \end{pgfmanualentry}
534 }
535
536
537 \newenvironment{graph}[1]{
538 \begin{pgfmanualentry}
539 \pgfmanualentryheadline{%
540 \pgfmanualpdflabel{#1}{}%
541 \textbf{Graph} {\ttfamily\declare{#1}}}%
542 \index{#1@\protect\texttt{#1} graph}%
543 \index{Graphs!#1@\protect\texttt{#1}}
544 \pgfmanualbody
545 }
546 {
547 \end{pgfmanualentry}
548 }
549
550 \newenvironment{gdalgorithm}[2]{
551 \begin{pgfmanualentry}
552 \pgfmanualentryheadline{%
553 \pgfmanualpdflabel{#1}{}%
554 \textbf{Layout} {\ttfamily/graph drawing/\declare{#1}\opt{=}}\opt{\meta{options}}}%
555 \index{#1@\protect\texttt{#1} layout}%
556 \index{Layouts!#1@\protect\texttt{#1}}%
557 \foreach \algo in {#2}
558 {\edef\marshal{\noexpand\index{#2@\noexpand\protect\noexpand\texttt{#2} algorithm}}\marshal}%
559 \index{Graph drawing layouts!#1@\protect\texttt{#1}}
560 \item{\small alias {\ttfamily/tikz/#1}}\par
561 \item{\small alias {\ttfamily/tikz/graphs/#1}}\par
562 \item{\small Employs {\ttfamily algorithm=#2}}\par
563 \pgfmanualbody
564 }
565 {
566 \end{pgfmanualentry}
567 }
568
569 \newenvironment{dataformat}[1]{
570 \begin{pgfmanualentry}
571 \pgfmanualentryheadline{%
572 \pgfmanualpdflabel{#1}{}%
573 \textbf{Format} {\ttfamily\declare{#1}}}%
574 \index{#1@\protect\texttt{#1} format}%
575 \index{Formats!#1@\protect\texttt{#1}}
576 \pgfmanualbody
577 }
578 {
579 \end{pgfmanualentry}
580 }
581
582 \newenvironment{stylesheet}[1]{
583 \begin{pgfmanualentry}
584 \pgfmanualentryheadline{%
585 \pgfmanualpdflabel{#1}{}%
586 \textbf{Style sheet} {\ttfamily\declare{#1}}}%
587 \index{#1@\protect\texttt{#1} style sheet}%
588 \index{Style sheets!#1@\protect\texttt{#1}}
589 \pgfmanualbody
590 }
591 {
592 \end{pgfmanualentry}
593 }
594
595 \newenvironment{handler}[1]{
596 \begin{pgfmanualentry}
597 \extracthandler#1\@nil%
598 \pgfmanualbody
599 }
600 {
601 \end{pgfmanualentry}
602 }
603
604 \def\gobble#1{}
605 \def\extracthandler#1#2\@nil{%
606 \pgfmanualentryheadline{%
607 \pgfmanualpdflabel{/handlers/#1}{}%
608 \textbf{Key handler} \meta{key}{\ttfamily/\declare{#1}}#2}%
609 \index{\gobble#1@\protect\texttt{#1} handler}%
610 \index{Key handlers!#1@\protect\texttt{#1}}
611 }
612
613
614 \makeatletter
615
616
617 \newenvironment{stylekey}[1]{
618 \begin{pgfmanualentry}
619 \def\extrakeytext{style, }
620 \extractkey#1\@nil%
621 \pgfmanualbody
622 }
623 {
624 \end{pgfmanualentry}
625 }
626
627 \def\choicesep{$\vert$}%
628 \def\choicearg#1{\texttt{#1}}
629
630 \newif\iffirstchoice
631
632 % \mchoice{choice1,choice2,choice3}
633 \newcommand\mchoice[1]{%
634 \begingroup
635 \firstchoicetrue
636 \foreach \mchoice@ in {#1} {%
637 \iffirstchoice
638 \global\firstchoicefalse
639 \else
640 \choicesep
641 \fi
642 \choicearg{\mchoice@}%
643 }%
644 \endgroup
645 }%
646
647 % \begin{key}{/path/x=value}
648 % \begin{key}{/path/x=value (initially XXX)}
649 % \begin{key}{/path/x=value (default XXX)}
650 % \begin{key}{/path/x=value (default XXX, initially XXX)}
651 \newenvironment{key}[1]{
652 \begin{pgfmanualentry}
653 \def\extrakeytext{}
654 %\def\altpath{\emph{\color{gray}or}}%
655 \extractkey#1\@nil%
656 \pgfmanualbody
657 }
658 {
659 \end{pgfmanualentry}
660 }
661
662 % \insertpathifneeded{a key}{/pgf} -> assign mykey={/pgf/a key}
663 % \insertpathifneeded{/tikz/a key}{/pgf} -> assign mykey={/tikz/a key}
664 %
665 % #1: the key
666 % #2: a default path (or empty)
667 \def\insertpathifneeded#1#2{%
668 \def\insertpathifneeded@@{#2}%
669 \ifx\insertpathifneeded@@\empty
670 \def\mykey{#1}%
671 \else
672 \insertpathifneeded@#2\@nil
673 \ifpgfutil@in@
674 \def\mykey{#2/#1}%
675 \else
676 \def\mykey{#1}%
677 \fi
678 \fi
679 }%
680 \def\insertpathifneeded@#1#2\@nil{%
681 \def\insertpathifneeded@@{#1}%
682 \def\insertpathifneeded@@@{/}%
683 \ifx\insertpathifneeded@@\insertpathifneeded@@@
684 \pgfutil@in@true
685 \else
686 \pgfutil@in@false
687 \fi
688 }%
689
690 % \begin{keylist}[default path]
691 % {/path/option 1=value,/path/option 2=value2}
692 % \end{keylist}
693 \newenvironment{keylist}[2][]{%
694 \begin{pgfmanualentry}
695 \def\extrakeytext{}%
696 \foreach \xx in {#2} {%
697 \expandafter\insertpathifneeded\expandafter{\xx}{#1}%
698 \expandafter\extractkey\mykey\@nil%
699 }%
700 \pgfmanualbody
701 }{%
702 \end{pgfmanualentry}
703 }%
704
705 \def\extractkey#1\@nil{%
706 \pgfutil@in@={#1}%
707 \ifpgfutil@in@%
708 \extractkeyequal#1\@nil
709 \else%
710 \pgfutil@in@{(initial}{#1}%
711 \ifpgfutil@in@%
712 \extractequalinitial#1\@nil%
713 \else
714 \pgfmanualentryheadline{%
715 \def\mykey{#1}%
716 \def\mypath{}%
717 \gdef\myname{}%
718 \firsttimetrue%
719 \pgfmanualdecomposecount=0\relax%
720 \decompose#1/\nil%
721 {\ttfamily\declare{#1}}\hfill(\extrakeytext no value)}%
722 \fi
723 \fi%
724 }
725
726 \def\extractkeyequal#1=#2\@nil{%
727 \pgfutil@in@{(default}{#2}%
728 \ifpgfutil@in@%
729 \pgfutil@in@{, initial}{#2}%
730 \ifpgfutil@in@
731 \extractdefaultinitial{#1}#2\@nil
732 \else
733 \extractdefault{#1}#2\@nil
734 \fi
735 \else%
736 \pgfutil@in@{(initial}{#2}%
737 \ifpgfutil@in@%
738 \extractinitial{#1}#2\@nil%
739 \else
740 \pgfmanualentryheadline{%
741 \def\mykey{#1}%
742 \def\mypath{}%
743 \gdef\myname{}%
744 \firsttimetrue%
745 \pgfmanualdecomposecount=0\relax%
746 \decompose#1/\nil%
747 {\ttfamily\declare{#1}=}#2\hfill(\extrakeytext no default)}%
748 \fi%
749 \fi%
750 }
751
752 \def\extractdefault#1#2(default #3)\@nil{%
753 \pgfmanualentryheadline{%
754 \def\mykey{#1}%
755 \def\mypath{}%
756 \gdef\myname{}%
757 \firsttimetrue%
758 \pgfmanualdecomposecount=0\relax%
759 \decompose#1/\nil%
760 {\ttfamily\declare{#1}\opt{=}}\opt{#2}\hfill (\extrakeytext default {\ttfamily#3})}%
761 }
762
763 \def\extractinitial#1#2(initially #3)\@nil{%
764 \pgfmanualentryheadline{%
765 \def\mykey{#1}%
766 \def\mypath{}%
767 \gdef\myname{}%
768 \firsttimetrue%
769 \pgfmanualdecomposecount=0\relax%
770 \decompose#1/\nil%
771 {\ttfamily\declare{#1}=}#2\hfill (\extrakeytext no default, initially {\ttfamily#3})}%
772 }
773
774 \def\extractdefaultinitial#1#2(default #3, initially #4)\@nil{%
775 \pgfmanualentryheadline{%
776 \def\mykey{#1}%
777 \def\mypath{}%
778 \gdef\myname{}%
779 \firsttimetrue%
780 \pgfmanualdecomposecount=0\relax
781 \decompose#1/\nil
782 {\ttfamily\declare{#1}\opt{=}}\opt{#2}\hfill
783 (\extrakeytext default {\ttfamily#3}, initially {\ttfamily#4})}%
784 }
785
786 \def\extractequalinitial#1 (initially #2)\@nil{%
787 \pgfmanualentryheadline{%
788 \def\mykey{#1}%
789 \def\mypath{}%
790 \gdef\myname{}%
791 \firsttimetrue%
792 \pgfmanualdecomposecount=0\relax%
793 \decompose#1/\nil%
794 {\ttfamily\declare{#1}}\hfill (\extrakeytext initially {\ttfamily#2})}%
795 }
796
797 % Introduces a key alias '/#1/<name of current key>'
798 % to be used inside of \begin{key} ... \end{key}
799 \def\keyalias#1{\vspace{-3pt}\item{\small alias {\ttfamily/#1/\myname}}\vspace{-2pt}\par
800 \pgfmanualpdflabel{/#1/\myname}{}%
801 }
802
803 \newif\iffirsttime
804 \newcount\pgfmanualdecomposecount
805
806 \makeatother
807
808 \def\decompose/#1/#2\nil{%
809 \def\test{#2}%
810 \ifx\test\empty%
811 % aha.
812 \index{#1@\protect\texttt{#1} key}%
813 \index{\mypath#1@\protect\texttt{#1}}%
814 \gdef\myname{#1}%
815 \pgfmanualpdflabel{#1}{}
816 \else%
817 \advance\pgfmanualdecomposecount by1\relax%
818 \ifnum\pgfmanualdecomposecount>2\relax%
819 \decomposetoodeep#1/#2\nil%
820 \else%
821 \iffirsttime%
822 \begingroup%
823 % also make a pdf link anchor with full key path.
824 \def\hyperlabelwithoutslash##1/\nil{%
825 \pgfmanualpdflabel{##1}{}%
826 }%
827 \hyperlabelwithoutslash/#1/#2\nil%
828 \endgroup%
829 \def\mypath{#1@\protect\texttt{/#1/}!}%
830 \firsttimefalse%
831 \else%
832 \expandafter\def\expandafter\mypath\expandafter{\mypath#1@\protect\texttt{#1/}!}%
833 \fi%
834 \def\firsttime{}%
835 \decompose/#2\nil%
836 \fi%
837 \fi%
838 }
839
840 \def\decomposetoodeep#1/#2/\nil{%
841 % avoid too-deep nesting in index
842 \index{#1/#2@\protect\texttt{#1/#2} key}%
843 \index{\mypath#1/#2@\protect\texttt{#1/#2}}%
844 \decomposefindlast/#1/#2/\nil%
845 }
846 \makeatletter
847 \def\decomposefindlast/#1/#2\nil{%
848 \def\test{#2}%
849 \ifx\test\pgfutil@empty%
850 \gdef\myname{#1}%
851 \else%
852 \decomposefindlast/#2\nil%
853 \fi%
854 }
855 \makeatother
856 \def\indexkey#1{%
857 \def\mypath{}%
858 \decompose#1/\nil%
859 }
860
861 \newenvironment{predefinedmethod}[1]{
862 \begin{pgfmanualentry}
863 \extractpredefinedmethod#1\@nil
864 \pgfmanualbody
865 }
866 {
867 \end{pgfmanualentry}
868 }
869 \def\extractpredefinedmethod#1(#2)\@nil{%
870 \pgfmanualentryheadline{%
871 \pgfmanualpdflabel{#1}{}%
872 Method \declare{\ttfamily #1}\texttt(#2\texttt) \hfill(predefined for all classes)}
873 \index{#1@\protect\texttt{#1} method}%
874 \index{Methods!#1@\protect\texttt{#1}}
875 }
876
877
878 \newenvironment{ooclass}[1]{
879 \begin{pgfmanualentry}
880 \def\currentclass{#1}
881 \pgfmanualentryheadline{%
882 \pgfmanualpdflabel{#1}{}%
883 \textbf{Class} \declare{\texttt{#1}}}
884 \index{#1@\protect\texttt{#1} class}%
885 \index{Class #1@Class \protect\texttt{#1}}%
886 \index{Classes!#1@\protect\texttt{#1}}
887 \pgfmanualbody
888 }
889 {
890 \end{pgfmanualentry}
891 }
892
893 \newenvironment{method}[1]{
894 \begin{pgfmanualentry}
895 \extractmethod#1\@nil
896 \pgfmanualbody
897 }
898 {
899 \end{pgfmanualentry}
900 }
901 \def\extractmethod#1(#2)\@nil{%
902 \def\test{#1}
903 \ifx\test\currentclass
904 \pgfmanualentryheadline{%
905 \pgfmanualpdflabel{#1}{}%
906 Constructor \declare{\ttfamily #1}\texttt(#2\texttt)}
907 \else
908 \pgfmanualentryheadline{%
909 \pgfmanualpdflabel{#1}{}%
910 Method \declare{\ttfamily #1}\texttt(#2\texttt)}
911 \fi
912 \index{#1@\protect\texttt{#1} method}%
913 \index{Methods!#1@\protect\texttt{#1}}
914 \index{Class \currentclass!#1@\protect\texttt{#1}}%
915 }
916
917 \newenvironment{classattribute}[1]{
918 \begin{pgfmanualentry}
919 \extractattribute#1\@nil
920 \pgfmanualbody
921 }
922 {
923 \end{pgfmanualentry}
924 }
925 \def\extractattribute#1=#2;\@nil{%
926 \def\test{#2}%
927 \ifx\test\@empty
928 \pgfmanualentryheadline{%
929 \pgfmanualpdflabel{#1}{}%
930 Private attribute \declare{\ttfamily #1} \hfill (initially empty)}
931 \else
932 \pgfmanualentryheadline{%
933 \pgfmanualpdflabel{#1}{}%
934 Private attribute \declare{\ttfamily #1} \hfill (initially {\ttfamily #2})}
935 \fi
936 \index{#1@\protect\texttt{#1} attribute}%
937 \index{Attributes!#1@\protect\texttt{#1}}
938 \index{Class \currentclass!#1@\protect\texttt{#1}}%
939 }
940
941
942
943 \newenvironment{predefinednode}[1]{
944 \begin{pgfmanualentry}
945 \pgfmanualentryheadline{%
946 \pgfmanualpdflabel{#1}{}%
947 \textbf{Predefined node} {\ttfamily\declare{#1}}}%
948 \index{#1@\protect\texttt{#1} node}%
949 \index{Predefined node!#1@\protect\texttt{#1}}
950 \pgfmanualbody
951 }
952 {
953 \end{pgfmanualentry}
954 }
955
956 \newenvironment{coordinatesystem}[1]{
957 \begin{pgfmanualentry}
958 \pgfmanualentryheadline{%
959 \pgfmanualpdflabel{#1}{}%
960 \textbf{Coordinate system} {\ttfamily\declare{#1}}}%
961 \index{#1@\protect\texttt{#1} coordinate system}%
962 \index{Coordinate systems!#1@\protect\texttt{#1}}
963 \pgfmanualbody
964 }
965 {
966 \end{pgfmanualentry}
967 }
968
969 \newenvironment{snake}[1]{
970 \begin{pgfmanualentry}
971 \pgfmanualentryheadline{\textbf{Snake} {\ttfamily\declare{#1}}}%
972 \index{#1@\protect\texttt{#1} snake}%
973 \index{Snakes!#1@\protect\texttt{#1}}
974 \pgfmanualbody
975 }
976 {
977 \end{pgfmanualentry}
978 }
979
980 \newenvironment{decoration}[1]{
981 \begin{pgfmanualentry}
982 \pgfmanualentryheadline{\textbf{Decoration} {\ttfamily\declare{#1}}}%
983 \index{#1@\protect\texttt{#1} decoration}%
984 \index{Decorations!#1@\protect\texttt{#1}}
985 \pgfmanualbody
986 }
987 {
988 \end{pgfmanualentry}
989 }
990
991
992 \def\pgfmanualbar{\char`\|}
993 \makeatletter
994 \newenvironment{pathoperation}[3][]{
995 \begin{pgfmanualentry}
996 \def\pgfmanualtest{#1}%
997 \pgfmanualentryheadline{%
998 \ifx\pgfmanualtest\@empty%
999 \pgfmanualpdflabel{#2}{}%
1000 \fi%
1001 \textcolor{gray}{{\ttfamily\char`\\path}\
1002 \ \dots}
1003 \declare{\texttt{\noligs{#2}}}#3\ \textcolor{gray}{\dots\texttt{;}}}%
1004 \ifx\pgfmanualtest\@empty%
1005 \index{#2@\protect\texttt{#2} path operation}%
1006 \index{Path operations!#2@\protect\texttt{#2}}%
1007 \fi%
1008 \pgfmanualbody
1009 }
1010 {
1011 \end{pgfmanualentry}
1012 }
1013 \newenvironment{datavisualizationoperation}[3][]{
1014 \begin{pgfmanualentry}
1015 \def\pgfmanualtest{#1}%
1016 \pgfmanualentryheadline{%
1017 \ifx\pgfmanualtest\@empty%
1018 \pgfmanualpdflabel{#2}{}%
1019 \fi%
1020 \textcolor{gray}{{\ttfamily\char`\\datavisualization}\
1021 \ \dots}
1022 \declare{\texttt{\noligs{#2}}}#3\ \textcolor{gray}{\dots\texttt{;}}}%
1023 \ifx\pgfmanualtest\@empty%
1024 \index{#2@\protect\texttt{#2} (data visualization)}%
1025 \index{Data visualization!#2@\protect\texttt{#2}}%
1026 \fi%
1027 \pgfmanualbody
1028 }
1029 {
1030 \end{pgfmanualentry}
1031 }
1032 \makeatother
1033
1034 \def\doublebs{\texttt{\char`\\\char`\\}}
1035
1036
1037 \newenvironment{package}[1]{
1038 \begin{pgfmanualentry}
1039 \pgfmanualentryheadline{%
1040 \pgfmanualpdflabel{#1}{}%
1041 {\ttfamily\char`\\usepackage\char`\{\declare{#1}\char`\}\space\space \char`\%\space\space \LaTeX}}
1042 \index{#1@\protect\texttt{#1} package}%
1043 \index{Packages and files!#1@\protect\texttt{#1}}%
1044 \pgfmanualentryheadline{{\ttfamily\char`\\input \declare{#1}.tex\space\space\space \char`\%\space\space plain \TeX}}
1045 \pgfmanualentryheadline{{\ttfamily\char`\\usemodule[\declare{#1}]\space\space \char`\%\space\space Con\TeX t}}
1046 \pgfmanualbody
1047 }
1048 {
1049 \end{pgfmanualentry}
1050 }
1051
1052
1053 \newenvironment{pgfmodule}[1]{
1054 \begin{pgfmanualentry}
1055 \pgfmanualentryheadline{%
1056 \pgfmanualpdflabel{#1}{}%
1057 {\ttfamily\char`\\usepgfmodule\char`\{\declare{#1}\char`\}\space\space\space
1058 \char`\%\space\space \LaTeX\space and plain \TeX\space and pure pgf}}
1059 \index{#1@\protect\texttt{#1} module}%
1060 \index{Modules!#1@\protect\texttt{#1}}%
1061 \pgfmanualentryheadline{{\ttfamily\char`\\usepgfmodule[\declare{#1}]\space\space \char`\%\space\space Con\TeX t\space and pure pgf}}
1062 \pgfmanualbody
1063 }
1064 {
1065 \end{pgfmanualentry}
1066 }
1067
1068 \newenvironment{pgflibrary}[1]{
1069 \begin{pgfmanualentry}
1070 \pgfmanualentryheadline{%
1071 \pgfmanualpdflabel{#1}{}%
1072 \textbf{\tikzname\ Library} \texttt{\declare{#1}}}
1073 \index{#1@\protect\texttt{#1} library}%
1074 \index{Libraries!#1@\protect\texttt{#1}}%
1075 \vskip.25em%
1076 {{\ttfamily\char`\\usepgflibrary\char`\{\declare{#1}\char`\}\space\space\space
1077 \char`\%\space\space \LaTeX\space and plain \TeX\space and pure pgf}}\\
1078 {{\ttfamily\char`\\usepgflibrary[\declare{#1}]\space\space \char`\%\space\space Con\TeX t\space and pure pgf}}\\
1079 {{\ttfamily\char`\\usetikzlibrary\char`\{\declare{#1}\char`\}\space\space
1080 \char`\%\space\space \LaTeX\space and plain \TeX\space when using \tikzname}}\\
1081 {{\ttfamily\char`\\usetikzlibrary[\declare{#1}]\space
1082 \char`\%\space\space Con\TeX t\space when using \tikzname}}\\[.5em]
1083 \pgfmanualbody
1084 }
1085 {
1086 \end{pgfmanualentry}
1087 }
1088
1089 \newenvironment{purepgflibrary}[1]{
1090 \begin{pgfmanualentry}
1091 \pgfmanualentryheadline{%
1092 \pgfmanualpdflabel{#1}{}%
1093 \textbf{{\small PGF} Library} \texttt{\declare{#1}}}
1094 \index{#1@\protect\texttt{#1} library}%
1095 \index{Libraries!#1@\protect\texttt{#1}}%
1096 \vskip.25em%
1097 {{\ttfamily\char`\\usepgflibrary\char`\{\declare{#1}\char`\}\space\space\space
1098 \char`\%\space\space \LaTeX\space and plain \TeX}}\\
1099 {{\ttfamily\char`\\usepgflibrary[\declare{#1}]\space\space \char`\%\space\space Con\TeX t}}\\[.5em]
1100 \pgfmanualbody
1101 }
1102 {
1103 \end{pgfmanualentry}
1104 }
1105
1106 \newenvironment{tikzlibrary}[1]{
1107 \begin{pgfmanualentry}
1108 \pgfmanualentryheadline{%
1109 \pgfmanualpdflabel{#1}{}%
1110 \textbf{\tikzname\ Library} \texttt{\declare{#1}}}
1111 \index{#1@\protect\texttt{#1} library}%
1112 \index{Libraries!#1@\protect\texttt{#1}}%
1113 \vskip.25em%
1114 {{\ttfamily\char`\\usetikzlibrary\char`\{\declare{#1}\char`\}\space\space \char`\%\space\space \LaTeX\space and plain \TeX}}\\
1115 {{\ttfamily\char`\\usetikzlibrary[\declare{#1}]\space \char`\%\space\space Con\TeX t}}\\[.5em]
1116 \pgfmanualbody
1117 }
1118 {
1119 \end{pgfmanualentry}
1120 }
1121
1122 \newenvironment{pgfkeyslibrary}[1]{%
1123 \begin{pgfmanualentry}%
1124 \pgfmanualentryheadline{%
1125 \pgfmanualpdflabel{#1}{}%
1126 \textbf{pgfkeys Library} \texttt{\declare{#1}}}%
1127 \index{#1@\protect\texttt{#1} pgfkeys library}%
1128 \index{pgfkeys Libraries!#1@\protect\texttt{#1}}%
1129 \vskip.25em
1130 {{\ttfamily\char`\\usepgfkeyslibrary\char`\{\declare{#1}\char`\}\space\space \char`\%\space\space \LaTeX\space and plain \TeX}}\\
1131 {{\ttfamily\char`\\usepgfkeyslibrary[\declare{#1}]\space \char`\%\space\space Con\TeX t}}\\[.5em]%
1132 \pgfmanualbody
1133 }%
1134 {%
1135 \end{pgfmanualentry}%
1136 }
1137
1138
1139 \newenvironment{filedescription}[1]{
1140 \begin{pgfmanualentry}
1141 \pgfmanualentryheadline{File {\ttfamily\declare{#1}}}%
1142 \index{#1@\protect\texttt{#1} file}%
1143 \index{Packages and files!#1@\protect\texttt{#1}}%
1144 \pgfmanualbody
1145 }
1146 {
1147 \end{pgfmanualentry}
1148 }
1149
1150
1151 \newenvironment{packageoption}[1]{
1152 \begin{pgfmanualentry}
1153 \pgfmanualentryheadline{{\ttfamily\char`\\usepackage[\declare{#1}]\char`\{pgf\char`\}}}
1154 \index{#1@\protect\texttt{#1} package option}%
1155 \index{Package options for \textsc{pgf}!#1@\protect\texttt{#1}}%
1156 \pgfmanualbody
1157 }
1158 {
1159 \end{pgfmanualentry}
1160 }
1161
1162
1163
1164 \newcommand\opt[1]{{\color{black!50!green}#1}}
1165 \newcommand\ooarg[1]{{\ttfamily[}\meta{#1}{\ttfamily]}}
1166
1167 \def\opt{\afterassignment\pgfmanualopt\let\next=}
1168 \def\pgfmanualopt{\ifx\next\bgroup\bgroup\color{black!50!green}\else{\color{black!50!green}\next}\fi}
1169
1170
1171
1172 \def\beamer{\textsc{beamer}}
1173 \def\pdf{\textsc{pdf}}
1174 \def\eps{\texttt{eps}}
1175 \def\pgfname{\textsc{pgf}}
1176 \def\tikzname{Ti\emph{k}Z}
1177 \def\pstricks{\textsc{pstricks}}
1178 \def\prosper{\textsc{prosper}}
1179 \def\seminar{\textsc{seminar}}
1180 \def\texpower{\textsc{texpower}}
1181 \def\foils{\textsc{foils}}
1182
1183 {
1184 \makeatletter
1185 \global\let\myempty=\@empty
1186 \global\let\mygobble=\@gobble
1187 \catcode`\@=12
1188 \gdef\getridofats#1@#2\relax{%
1189 \def\getridtest{#2}%
1190 \ifx\getridtest\myempty%
1191 \expandafter\def\expandafter\strippedat\expandafter{\strippedat#1}
1192 \else%
1193 \expandafter\def\expandafter\strippedat\expandafter{\strippedat#1\protect\printanat}
1194 \getridofats#2\relax%
1195 \fi%
1196 }
1197
1198 \gdef\removeats#1{%
1199 \let\strippedat\myempty%
1200 \edef\strippedtext{\stripcommand#1}%
1201 \expandafter\getridofats\strippedtext @\relax%
1202 }
1203
1204 \gdef\stripcommand#1{\expandafter\mygobble\string#1}
1205 }
1206
1207 \def\printanat{\char`\@}
1208
1209 \def\declare{\afterassignment\pgfmanualdeclare\let\next=}
1210 \def\pgfmanualdeclare{\ifx\next\bgroup\bgroup\color{red!75!black}\else{\color{red!75!black}\next}\fi}
1211
1212
1213 \let\textoken=\command
1214 \let\endtextoken=\endcommand
1215
1216 \def\myprintocmmand#1{\texttt{\char`\\#1}}
1217
1218 \def\example{\par\smallskip\noindent\textit{Example: }}
1219 \def\themeauthor{\par\smallskip\noindent\textit{Theme author: }}
1220
1221
1222 \def\indexoption#1{%
1223 \index{#1@\protect\texttt{#1} option}%
1224 \index{Graphic options and styles!#1@\protect\texttt{#1}}%
1225 }
1226
1227 \def\itemcalendaroption#1{\item \declare{\texttt{#1}}%
1228 \index{#1@\protect\texttt{#1} date test}%
1229 \index{Date tests!#1@\protect\texttt{#1}}%
1230 }
1231
1232
1233
1234 \def\class#1{\list{}{\leftmargin=2em\itemindent-\leftmargin\def\makelabel##1{\hss##1}}%
1235 \extractclass#1@\par\topsep=0pt}
1236 \def\endclass{\endlist}
1237 \def\extractclass#1#2@{%
1238 \item{{{\ttfamily\char`\\documentclass}#2{\ttfamily\char`\{\declare{#1}\char`\}}}}%
1239 \index{#1@\protect\texttt{#1} class}%
1240 \index{Classes!#1@\protect\texttt{#1}}}
1241
1242 \def\partname{Part}
1243
1244 \makeatletter
1245 \def\index@prologue{\section*{Index}\addcontentsline{toc}{section}{Index}
1246 This index only contains automatically generated entries. A good
1247 index should also contain carefully selected keywords. This index is
1248 not a good index.
1249 \bigskip
1250 }
1251 \c@IndexColumns=2
1252 \def\theindex{\@restonecoltrue
1253 \columnseprule \z@ \columnsep 29\p@
1254 \twocolumn[\index@prologue]%
1255 \parindent -30pt
1256 \columnsep 15pt
1257 \parskip 0pt plus 1pt
1258 \leftskip 30pt
1259 \rightskip 0pt plus 2cm
1260 \small
1261 \def\@idxitem{\par}%
1262 \let\item\@idxitem \ignorespaces}
1263 \def\endtheindex{\onecolumn}
1264 \def\noindexing{\let\index=\@gobble}
1265
1266
1267 \newenvironment{arrowtipsimple}[1]{
1268 \begin{pgfmanualentry}
1269 \pgfmanualentryheadline{\textbf{Arrow Tip Kind} {\ttfamily#1}}
1270 \index{#1@\protect\texttt{#1} arrow tip}%
1271 \index{Arrow tips!#1@\protect\texttt{#1}}%
1272 \def\currentarrowtype{#1}
1273 \pgfmanualbody}
1274 {
1275 \end{pgfmanualentry}
1276 }
1277
1278 \newenvironment{arrowtip}[4]{
1279 \begin{pgfmanualentry}
1280 \pgfmanualentryheadline{\textbf{Arrow Tip Kind} {\ttfamily#1}}
1281 \index{#1@\protect\texttt{#1} arrow tip}%
1282 \index{Arrow tips!#1@\protect\texttt{#1}}%
1283 \pgfmanualbody
1284 \def\currentarrowtype{#1}
1285 \begin{minipage}[t]{10.25cm}
1286 #2
1287 \end{minipage}\hskip5mm\begin{minipage}[t]{4.75cm}
1288 \leavevmode\vskip-2em
1289 \tikz{
1290 \draw [black!50,line width=5mm,-{#1[#3,color=black]}] (-4,0) -- (0,0);
1291 \foreach \action in {#4}
1292 { \expandafter\processaction\action\relax }
1293 }
1294 \end{minipage}\par\smallskip
1295 }
1296 {
1297 \end{pgfmanualentry}
1298 }
1299
1300 \newenvironment{arrowcap}[5]{
1301 \begin{pgfmanualentry}
1302 \pgfmanualentryheadline{\textbf{Arrow Tip Kind} {\ttfamily#1}}
1303 \index{#1@\protect\texttt{#1} arrow tip}%
1304 \index{Arrow tips!#1@\protect\texttt{#1}}%
1305 \pgfmanualbody
1306 \def\currentarrowtype{#1}
1307 \begin{minipage}[t]{10.25cm}
1308 #2
1309 \end{minipage}\hskip5mm\begin{minipage}[t]{4.75cm}
1310 \leavevmode\vskip-2em
1311 \tikz{
1312 \path [tips, line width=10mm,-{#1[#3,color=black]}] (-4,0) -- (0,0);
1313 \draw [line width=10mm,black!50] (-3,0) -- (#5,0);
1314 \foreach \action in {#4}
1315 { \expandafter\processaction\action\relax }
1316 }
1317 \end{minipage}\par\smallskip
1318 }
1319 {
1320 \end{pgfmanualentry}
1321 }
1322
1323 \newenvironment{pattern}[1]{
1324 \begin{pgfmanualentry}
1325 \pgfmanualentryheadline{\textbf{Pattern} {\ttfamily#1}}
1326 \index{#1@\protect\texttt{#1} pattern}%
1327 \index{Patterns!#1@\protect\texttt{#1}}%
1328 \pgfmanualbody
1329 }
1330 {
1331 \end{pgfmanualentry}
1332 }
1333
1334 \def\processaction#1=#2\relax{
1335 \expandafter\let\expandafter\pgf@temp\csname manual@action@#1\endcsname
1336 \ifx\pgf@temp\relax\else
1337 \pgf@temp#2/0/\relax
1338 \fi
1339 }
1340 \def\manual@action@length#1/#2/#3\relax{%
1341 \draw [red,|<->|,semithick,xshift=#2] ([yshift=4pt]current bounding
1342 box.north -| -#1,0) coordinate (last length) -- node
1343 [above=-2pt] {|length|} ++(#1,0);
1344 }
1345 \def\manual@action@width#1/#2/#3\relax{%
1346 \draw [overlay, red,|<->|,semithick] (.5,-#1/2) -- node [below,sloped] {|width|} (.5,#1/2);
1347 }
1348 \def\manual@action@inset#1/#2/#3\relax{%
1349 \draw [red,|<->|,semithick,xshift=#2] ([yshift=-4pt]current bounding
1350 box.south -| last length) -- node [below] {|inset|} ++(#1,0);
1351 }
1352
1353 \newenvironment{arrowexamples}
1354 {\begin{tabbing}
1355 \hbox to \dimexpr\linewidth-5.5cm\relax{\emph{Appearance of the below at line width} \hfil} \=
1356 \hbox to 1.9cm{\emph{0.4pt}\hfil} \= \hbox to 2cm{\emph{0.8pt}\hfil} \= \emph{1.6pt} \\
1357 }
1358 {\end{tabbing}\vskip-1em}
1359
1360 \newenvironment{arrowcapexamples}
1361 {\begin{tabbing}
1362 \hbox to \dimexpr\linewidth-5.5cm\relax{\emph{Appearance of the below at line width} \hfil} \=
1363 \hbox to 1.9cm{\emph{1ex}\hfil} \= \hbox to 2cm{\emph{1em}\hfil} \\
1364 }
1365 {\end{tabbing}\vskip-1em}
1366
1367 \def\arrowcapexample#1[#2]{\def\temp{#1}\ifx\temp\pgfutil@empty\arrowcapexample@\currentarrowtype[{#2}]\else\arrowcapexample@#1[{#2}]\fi}
1368 \def\arrowcapexample@#1[#2]{%
1369 {\sfcode`\.1000\small\texttt{#1[#2]}} \>
1370 \kern-.5ex\tikz [baseline,>={#1[#2]}] \draw [line
1371 width=1ex,->] (0,.5ex) -- (2em,.5ex); \>
1372 \kern-.5em\tikz [baseline,>={#1[#2]}] \draw [line
1373 width=1em,->] (0,.5ex) -- (2em,.5ex); \\
1374 }
1375
1376 \def\arrowexample#1[#2]{\def\temp{#1}\ifx\temp\pgfutil@empty\arrowexample@\currentarrowtype[{#2}]\else\arrowexample@#1[{#2}]\fi}
1377 \def\arrowexample@#1[#2]{%
1378 {\sfcode`\.1000\small\texttt{#1[#2]}} \>
1379 \tikz [baseline,>={#1[#2]}] \draw [line
1380 width=0.4pt,->] (0,.5ex) -- (2em,.5ex); thin \>
1381 \tikz [baseline,>={#1[#2]}] \draw [line
1382 width=0.8pt,->] (0,.5ex) -- (2em,.5ex); \textbf{thick} \>
1383 \tikz [baseline,>={#1[#2]}] \draw [line
1384 width=1.6pt,->] (0,.5ex) -- (3em,.5ex); \\
1385 }
1386 \def\arrowexampledup[#1]{\arrowexample[{#1] \currentarrowtype[}]}
1387 \def\arrowexampledupdot[#1]{\arrowexample[{#1] . \currentarrowtype[}]}
1388
1389 \def\arrowexampledouble#1[#2]{\def\temp{#1}\ifx\temp\pgfutil@empty\arrowexampledouble@\currentarrowtype[{#2}]\else\arrowexampledouble@#1[{#2}]\fi}
1390 \def\arrowexampledouble@#1[#2]{%
1391 {\sfcode`\.1000\small\texttt{#1[#2]} on double line} \>
1392 \tikz [baseline,>={#1[#2]}]
1393 \draw [double equal sign distance,line width=0.4pt,->] (0,.5ex) -- (2em,.5ex); thin \>
1394 \tikz [baseline,>={#1[#2]}]
1395 \draw [double equal sign distance,line width=0.8pt,->] (0,.5ex) -- (2em,.5ex); \textbf{thick} \>
1396 \tikz [baseline,>={#1[#2]}]
1397 \draw [double equal sign distance, line width=1.6pt,->] (0,.5ex) -- (3em,.5ex); \\
1398 }
1399
1400
1401
1402 \newcommand\symarrow[1]{%
1403 \index{#1@\protect\texttt{#1} arrow tip}%
1404 \index{Arrow tips!#1@\protect\texttt{#1}}%
1405 \texttt{#1}& yields thick
1406 \begin{tikzpicture}[arrows={#1-#1},thick,baseline]
1407 \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex);
1408 \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ;
1409 \draw (0pt,.5ex) -- (1cm,.5ex);
1410 \end{tikzpicture} and thin
1411 \begin{tikzpicture}[arrows={#1-#1},thin,baseline]
1412 \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex);
1413 \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ;
1414 \draw (0pt,.5ex) -- (1cm,.5ex);
1415 \end{tikzpicture}
1416 }
1417 \newcommand\symarrowdouble[1]{%
1418 \index{#1@\protect\texttt{#1} arrow tip}%
1419 \index{Arrow tips!#1@\protect\texttt{#1}}%
1420 \texttt{#1}& yields thick
1421 \begin{tikzpicture}[arrows={#1-#1},thick,baseline]
1422 \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex);
1423 \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ;
1424 \draw (0pt,.5ex) -- (1cm,.5ex);
1425 \end{tikzpicture}
1426 and thin
1427 \begin{tikzpicture}[arrows={#1-#1},thin,baseline]
1428 \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex);
1429 \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ;
1430 \draw (0pt,.5ex) -- (1cm,.5ex);
1431 \end{tikzpicture}, double
1432 \begin{tikzpicture}[arrows={#1-#1},thick,baseline]
1433 \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex);
1434 \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ;
1435 \draw[double,double equal sign distance] (0pt,.5ex) -- (1cm,.5ex);
1436 \end{tikzpicture} and
1437 \begin{tikzpicture}[arrows={#1-#1},thin,baseline]
1438 \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex);
1439 \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ;
1440 \draw[double,double equal sign distance] (0pt,.5ex) -- (1cm,.5ex);
1441 \end{tikzpicture}
1442 }
1443
1444 \newcommand\sarrow[2]{%
1445 \index{#1@\protect\texttt{#1} arrow tip}%
1446 \index{Arrow tips!#1@\protect\texttt{#1}}%
1447 \index{#2@\protect\texttt{#2} arrow tip}%
1448 \index{Arrow tips!#2@\protect\texttt{#2}}%
1449 \texttt{#1-#2}& yields thick
1450 \begin{tikzpicture}[arrows={#1-#2},thick,baseline]
1451 \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex);
1452 \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ;
1453 \draw (0pt,.5ex) -- (1cm,.5ex);
1454 \end{tikzpicture} and thin
1455 \begin{tikzpicture}[arrows={#1-#2},thin,baseline]
1456 \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex);
1457 \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ;
1458 \draw (0pt,.5ex) -- (1cm,.5ex);
1459 \end{tikzpicture}
1460 }
1461
1462 \newcommand\sarrowdouble[2]{%
1463 \index{#1@\protect\texttt{#1} arrow tip}%
1464 \index{Arrow tips!#1@\protect\texttt{#1}}%
1465 \index{#2@\protect\texttt{#2} arrow tip}%
1466 \index{Arrow tips!#2@\protect\texttt{#2}}%
1467 \texttt{#1-#2}& yields thick
1468 \begin{tikzpicture}[arrows={#1-#2},thick,baseline]
1469 \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex);
1470 \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ;
1471 \draw (0pt,.5ex) -- (1cm,.5ex);
1472 \end{tikzpicture} and thin
1473 \begin{tikzpicture}[arrows={#1-#2},thin,baseline]
1474 \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex);
1475 \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ;
1476 \draw (0pt,.5ex) -- (1cm,.5ex);
1477 \end{tikzpicture}, double
1478 \begin{tikzpicture}[arrows={#1-#2},thick,baseline]
1479 \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex);
1480 \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ;
1481 \draw[double,double equal sign distance] (0pt,.5ex) -- (1cm,.5ex);
1482 \end{tikzpicture} and
1483 \begin{tikzpicture}[arrows={#1-#2},thin,baseline]
1484 \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex);
1485 \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ;
1486 \draw[double,double equal sign distance] (0pt,.5ex) -- (1cm,.5ex);
1487 \end{tikzpicture}
1488 }
1489
1490 \newcommand\carrow[1]{%
1491 \index{#1@\protect\texttt{#1} arrow tip}%
1492 \index{Arrow tips!#1@\protect\texttt{#1}}%
1493 \texttt{#1}& yields for line width 1ex
1494 \begin{tikzpicture}[arrows={#1-#1},line width=1ex,baseline]
1495 \useasboundingbox (-1mm,-0.5ex) rectangle (1.6cm,2ex);
1496 \fill [black!15] (1.5cm,-.5ex) rectangle (1.6cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ;
1497 \draw (0pt,.5ex) -- (1.5cm,.5ex);
1498 \end{tikzpicture}
1499 }
1500 \def\myvbar{\char`\|}
1501 \newcommand\plotmarkentry[1]{%
1502 \index{#1@\protect\texttt{#1} plot mark}%
1503 \index{Plot marks!#1@\protect\texttt{#1}}
1504 \texttt{\char`\\pgfuseplotmark\char`\{\declare{\noligs{#1}}\char`\}} &
1505 \tikz\draw[color=black!25] plot[mark=#1,mark options={fill=examplefill,draw=black}] coordinates{(0,0) (.5,0.2) (1,0) (1.5,0.2)};\\
1506 }
1507 \newcommand\plotmarkentrytikz[1]{%
1508 \index{#1@\protect\texttt{#1} plot mark}%
1509 \index{Plot marks!#1@\protect\texttt{#1}}
1510 \texttt{mark=\declare{\noligs{#1}}} & \tikz\draw[color=black!25]
1511 plot[mark=#1,mark options={fill=examplefill,draw=black}]
1512 coordinates {(0,0) (.5,0.2) (1,0) (1.5,0.2)};\\
1513 }
1514
1515
1516
1517 \ifx\scantokens\@undefined
1518 \PackageError{pgfmanual-macros}{You need to use extended latex
1519 (elatex) or (pdfelatex) to process this document}{}
1520 \fi
1521
1522 \begingroup
1523 \catcode`|=0
1524 \catcode`[= 1
1525 \catcode`]=2
1526 \catcode`\{=12
1527 \catcode `\}=12
1528 \catcode`\\=12 |gdef|find@example#1\end{codeexample}[|endofcodeexample[#1]]
1529 |endgroup
1530
1531 % define \returntospace.
1532 %
1533 % It should define NEWLINE as {}, spaces and tabs as \space.
1534 \begingroup
1535 \catcode`\^=7
1536 \catcode`\^^M=13
1537 \catcode`\^^I=13
1538 \catcode`\ =13%
1539 \gdef\returntospace{\catcode`\ =13\def {\space}\catcode`\^^I=13\def^^I{\space}}
1540 \gdef\showreturn{\show^^M}
1541 \endgroup
1542
1543 \begingroup
1544 \catcode`\%=13
1545 \catcode`\^^M=13
1546 \gdef\commenthandler{\catcode`\%=13\def%{\@gobble@till@return}}
1547 \gdef\@gobble@till@return#1^^M{}
1548 \gdef\@gobble@till@return@ignore#1^^M{\ignorespaces}
1549 \gdef\typesetcomment{\catcode`\%=13\def%{\@typeset@till@return}}
1550 \gdef\@typeset@till@return#1^^M{{\def%{\char`\%}\textsl{\char`\%#1}}\par}
1551 \endgroup
1552
1553 % Define tab-implementation functions
1554 % \codeexample@tabinit@replacementchars@
1555 % and
1556 % \codeexample@tabinit@catcode@
1557 %
1558 % They should ONLY be used in case that tab replacement is active.
1559 %
1560 % This here is merely a preparation step.
1561 %
1562 % Idea:
1563 % \codeexample@tabinit@catcode@ will make TAB active
1564 % and
1565 % \codeexample@tabinit@replacementchars@ will insert as many spaces as
1566 % /codeexample/tabsize contains.
1567 {
1568 \catcode`\^^I=13
1569 % ATTENTION: do NOT use tabs in these definitions!!
1570 \gdef\codeexample@tabinit@replacementchars@{%
1571 \begingroup
1572 \count0=\pgfkeysvalueof{/codeexample/tabsize}\relax
1573 \toks0={}%
1574 \loop
1575 \ifnum\count0>0
1576 \advance\count0 by-1
1577 \toks0=\expandafter{\the\toks0\ }%
1578 \repeat
1579 \xdef\codeexample@tabinit@replacementchars@@{\the\toks0}%
1580 \endgroup
1581 \let^^I=\codeexample@tabinit@replacementchars@@
1582 }%
1583 \gdef\codeexample@tabinit@catcode@{\catcode`\^^I=13}%
1584 }%
1585
1586 % Called after any options have been set. It assigns
1587 % \codeexample@tabinit@catcode
1588 % and
1589 % \codeexample@tabinit@replacementchars
1590 % which are used inside of
1591 %\begin{codeexample}
1592 % ...
1593 %\end{codeexample}
1594 %
1595 % \codeexample@tabinit@catcode is either \relax or it makes tab
1596 % active.
1597 %
1598 % \codeexample@tabinit@replacementchars is either \relax or it inserts
1599 % a proper replacement sequence for tabs (as many spaces as
1600 % configured)
1601 \def\codeexample@tabinit{%
1602 \ifnum\pgfkeysvalueof{/codeexample/tabsize}=0\relax
1603 \let\codeexample@tabinit@replacementchars=\relax
1604 \let\codeexample@tabinit@catcode=\relax
1605 \else
1606 \let\codeexample@tabinit@catcode=\codeexample@tabinit@catcode@
1607 \let\codeexample@tabinit@replacementchars=\codeexample@tabinit@replacementchars@
1608 \fi
1609 }
1610
1611 \newif\ifpgfmanualtikzsyntaxhilighting
1612
1613 \pgfqkeys{/codeexample}{%
1614 width/.code= {\setlength\codeexamplewidth{#1}},
1615 graphic/.code= {\colorlet{graphicbackground}{#1}},
1616 code/.code= {\colorlet{codebackground}{#1}},
1617 execute code/.is if=code@execute,
1618 hidden/.is if=code@hidden,
1619 code only/.code= {\code@executefalse},
1620 setup code/.code= {\pgfmanual@setup@codetrue\code@executefalse},
1621 multipage/.code= {\code@executefalse\pgfmanual@multipage@codetrue},
1622 pre/.store in=\code@pre,
1623 post/.store in=\code@post,
1624 % #1 is the *complete* environment contents as it shall be
1625 % typeset. In particular, the catcodes are NOT the normal ones.
1626 typeset listing/.code= {#1},
1627 render instead/.store in=\code@render,
1628 vbox/.code= {\def\code@pre{\vbox\bgroup\setlength{\hsize}{\linewidth-6pt}}\def\code@post{\egroup}},
1629 ignorespaces/.code= {\let\@gobble@till@return=\@gobble@till@return@ignore},
1630 leave comments/.code= {\def\code@catcode@hook{\catcode`\%=12}\let\commenthandler=\relax\let\typesetcomment=\relax},
1631 tabsize/.initial=0,% FIXME : this here is merely used for indentation. It is just a TAB REPLACEMENT.
1632 every codeexample/.style={width=4cm+7pt, tikz syntax=true},
1633 from file/.code={\codeexamplefromfiletrue\def\codeexamplesource{#1}},
1634 tikz syntax/.is if=pgfmanualtikzsyntaxhilighting,
1635 animation list/.store in=\code@animation@list,
1636 animation pre/.store in=\code@animation@pre,
1637 animation post/.store in=\code@animation@post,
1638 animation scale/.store in=\pgfmanualanimscale,
1639 animation bb/.style={
1640 animation pre={
1641 \tikzset{
1642 every picture/.style={
1643 execute at begin picture={
1644 \useasboundingbox[clip] #1;}
1645 }
1646 }
1647 }
1648 },
1649 preamble/.store in=\code@preamble,
1650 }
1651
1652 \def\pgfmanualanimscale{.5}
1653
1654 \newread\examplesource
1655
1656
1657 % Opening, reading and closing the results file
1658
1659 \def\opensource#1{
1660 \immediate\openin\examplesource=#1
1661 }
1662 \def\do@codeexamplefromfile{%
1663 \immediate\openin\examplesource\expandafter{\codeexamplesource}%
1664 \def\examplelines{}%
1665 \readexamplelines
1666 \closein\examplesource
1667 \expandafter\endofcodeexample\expandafter{\examplelines}%
1668 }
1669
1670 \def\readexamplelines{
1671 \ifeof\examplesource%
1672 \else
1673 \immediate\read\examplesource to \exampleline
1674 \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\examplelines\expandafter\expandafter\expandafter{\expandafter\examplelines\exampleline}
1675 \expandafter\readexamplelines%
1676 \fi
1677 }
1678
1679 \let\code@animation@pre\pgfutil@empty
1680 \let\code@animation@post\pgfutil@empty
1681 \let\code@animation@list\pgfutil@empty
1682
1683 \let\code@pre\pgfutil@empty
1684 \let\code@post\pgfutil@empty
1685 \let\code@render\pgfutil@empty
1686 \let\code@preamble\pgfutil@empty
1687 \def\code@catcode@hook{}
1688
1689 \newif\ifpgfmanual@multipage@code
1690 \newif\ifpgfmanual@setup@code
1691 \newif\ifcodeexamplefromfile
1692 \newdimen\codeexamplewidth
1693 \newif\ifcode@execute
1694 \newif\ifcode@hidden
1695 \newbox\codeexamplebox
1696 \def\codeexample[#1]{%
1697 \global\let\pgfmanual@do@this\relax%
1698 \aftergroup\pgfmanual@do@this%
1699 \begingroup%
1700 \code@executetrue
1701 \pgfqkeys{/codeexample}{every codeexample,#1}%
1702 \pgfmanualswitchoncolors%
1703 \ifcodeexamplefromfile\begingroup\fi
1704 \codeexample@tabinit% assigns \codeexample@tabinit@[catcode,replacementchars]
1705 \parindent0pt
1706 \begingroup%
1707 \par% this \par is not inside \ifcode@hidden because we want to switch to vmode
1708 \ifcode@hidden\else
1709 \medskip%
1710 \fi
1711 \let\do\@makeother%
1712 \dospecials%
1713 \obeylines%
1714 \@vobeyspaces%
1715 \catcode`\%=13%
1716 \catcode`\^^M=13%
1717 \code@catcode@hook%
1718 \codeexample@tabinit@catcode
1719 \relax%
1720 \ifcodeexamplefromfile%
1721 \expandafter\do@codeexamplefromfile%
1722 \else%
1723 \expandafter\find@example%
1724 \fi}
1725 \def\endofcodeexample#1{%
1726 \endgroup%
1727 \ifpgfmanual@setup@code%
1728 \gdef\pgfmanual@do@this{%
1729 {%
1730 \returntospace%
1731 \commenthandler%
1732 % ensures the active ^^M is protected thus won't be expanded in the
1733 % following \xdef\code@temp{#1}
1734 \obeylines%
1735 \xdef\code@temp{#1}% removes returns and comments
1736 }%
1737 \edef\pgfmanualmcatcode{\the\catcode`\^^M}%
1738 \catcode`\^^M=9\relax%
1739 \expandafter\scantokens\expandafter{\code@temp}%
1740 \catcode`\^^M=\pgfmanualmcatcode%
1741 }%
1742 \fi%
1743 \ifcode@hidden\else
1744 \ifcode@execute%
1745 \setbox\codeexamplebox=\hbox{%
1746 \ifx\code@render\pgfutil@empty%
1747 {%
1748 {%
1749 \returntospace%
1750 \commenthandler%
1751 % ensures the active ^^M is protected thus won't be expanded in the
1752 % following \xdef\code@temp{#1}
1753 \obeylines%
1754 \xdef\code@temp{#1}% removes returns and comments
1755 }%
1756 \catcode`\^^M=9%
1757 \colorbox{graphicbackground}{\color{black}\ignorespaces%
1758 \code@pre\expandafter\scantokens\expandafter{\code@temp\ignorespaces}\code@post\ignorespaces}%
1759 }%
1760 \else%
1761 \global\let\code@temp\code@render%
1762 \colorbox{graphicbackground}{\color{black}\ignorespaces%
1763 \code@render}%
1764 \fi%
1765 }%
1766 \ifx\code@animation@list\pgfutil@empty%
1767 \else%
1768 \setbox\codeexampleboxanim=\vbox{%
1769 \rightskip0pt\leftskip0pt plus1filll%
1770 \ifdim\wd\codeexamplebox>\codeexamplewidth%
1771 \else%
1772 \hsize\codeexamplewidth%
1773 \advance\hsize by2cm%
1774 \fi%
1775 \leavevmode\catcode`\^^M=9%
1776 \foreach \pgfmanualtime/\pgfmanualtimehow in\code@animation@list{%
1777 \setbox\codeexampleboxanim=\hbox{\colorbox{animationgraphicbackground}{%
1778 \tikzset{make snapshot of=\pgfmanualtime}%
1779 \scalebox{\pgfmanualanimscale}{\color{black}\ignorespaces%
1780 \code@animation@pre\expandafter\scantokens\expandafter{\code@temp\ignorespaces}\code@animation@post\ignorespaces}%
1781 }}%
1782 \space\raise4pt\hbox to0pt{\vrule width0pt height1em\hbox
1783 to\wd\codeexampleboxanim{\hfil\scriptsize$t{=}\pgfmanualtimehow \mathrm s$\hfil}\hss}%
1784 \lower\ht\codeexampleboxanim\box\codeexampleboxanim\hfil\penalty0\hskip0ptplus-1fil%
1785 }%
1786 }%
1787 \setbox\codeexampleboxanim=\hbox{\hbox{}\hskip-2cm\box\codeexampleboxanim}%
1788 \fi%
1789 \ifdim\wd\codeexamplebox>\codeexamplewidth%
1790 \def\code@start{\par}%
1791 \def\code@flushstart{}\def\code@flushend{}%
1792 \def\code@mid{\parskip2pt\par\noindent}%
1793 \def\code@width{\linewidth-6pt}%
1794 \def\code@end{}%
1795 \else%
1796 \def\code@start{%
1797 \linewidth=\textwidth%
1798 \parshape \@ne 0pt \linewidth
1799 \leavevmode%
1800 \hbox\bgroup}%
1801 \def\code@flushstart{\hfill}%
1802 \def\code@flushend{\hbox{}}%
1803 \def\code@mid{\hskip6pt}%
1804 \def\code@width{\linewidth-12pt-\codeexamplewidth}%
1805 \def\code@end{\egroup}%
1806 \fi%
1807 \code@start%
1808 \noindent%
1809 \begin{minipage}[t]{\codeexamplewidth}\raggedright
1810 \hrule width0pt%
1811 \footnotesize\vskip-1em%
1812 \code@flushstart\box\codeexamplebox\code@flushend%
1813 \vskip0pt%
1814 \leavevmode%
1815 \box\codeexampleboxanim%
1816 \vskip-1ex
1817 \leavevmode%
1818 \end{minipage}%
1819 \else%
1820 \def\code@mid{\par}
1821 \def\code@width{\linewidth-6pt}
1822 \def\code@end{}
1823 \fi%
1824 \code@mid%
1825 \ifpgfmanual@multipage@code%
1826 {%
1827 \pgfkeysvalueof{/codeexample/prettyprint/base color}%
1828 \pgfmanualdolisting{#1}%
1829 }%
1830 \else%
1831 \colorbox{codebackground}{%
1832 \pgfkeysvalueof{/codeexample/prettyprint/base color}%
1833 \begin{minipage}[t]{\code@width}%
1834 \pgfmanualdolisting{#1}%
1835 \end{minipage}}%
1836 \fi%
1837 \code@end%
1838 \par%
1839 \medskip
1840 \fi
1841 \endcodeexample\endgroup%
1842 }
1843
1844 \def\endcodeexample{\endgroup}
1845 \newbox\codeexampleboxanim
1846
1847 \def\pgfmanualdolisting#1{%
1848 {%
1849 \let\do\@makeother
1850 \dospecials
1851 \frenchspacing\@vobeyspaces
1852 \normalfont\ttfamily\footnotesize
1853 \typesetcomment%
1854 \codeexample@tabinit@replacementchars
1855 \@tempswafalse
1856 \def\par{%
1857 \if@tempswa
1858 \leavevmode \null \@@par\penalty\interlinepenalty
1859 \else
1860 \@tempswatrue
1861 \ifhmode\@@par\penalty\interlinepenalty\fi
1862 \fi}%
1863 \obeylines
1864 \everypar \expandafter{\the\everypar \unpenalty}%
1865 \ifx\code@preamble\pgfutil@empty\else
1866 \pgfutil@tempdima=\hsize
1867 \vbox{\hsize=\pgfutil@tempdima
1868 \raggedright\scriptsize\detokenize\expandafter{\code@preamble}}%
1869 \fi
1870 \pgfkeysvalueof{/codeexample/typeset listing/.@cmd}{#1}\pgfeov
1871 }%
1872 }
1873
1874 \makeatother
1875
1876 \usepackage{pgfmanual}
1877
1878
1879 % autoxref is now always on
1880
1881 % \makeatletter
1882 % % \pgfautoxrefs will be defined by 'make dist'
1883 % \pgfutil@ifundefined{pgfautoxrefs}{%
1884 % \renewcommand\pgfmanualpdflabel[3][]{#3}% NO-OP
1885 % \def\pgfmanualpdfref#1#2{#2}%
1886 % \pgfkeys{
1887 % /pdflinks/codeexample links=false,% DISABLED.
1888 % }%
1889 % }{}
1890 % \makeatother
1891
1892 \newdimen\pgfmanualcslinkpreskip
1893
1894 % Styling of the pretty printer
1895 \pgfkeys{
1896 /codeexample/syntax hilighting/.style={
1897 /codeexample/prettyprint/key name/.code={\textcolor{keycolor}{\pgfmanualpdfref{##1}{\noligs{##1}}}},
1898 /codeexample/prettyprint/key name with handler/.code 2 args={\textcolor{keycolor}{\pgfmanualpdfref{##1}{\noligs{##1}}}/\textcolor{blue!70!black}{\pgfmanualpdfref{/handlers/##2}{\noligs{##2}}}},
1899 /codeexample/prettyprint/key value display only/.code={\textcolor{keycolor}{{\itshape{\let\pgfmanualwordstartup\relax\pgfmanualprettyprintcode{##1}}}}},
1900 /codeexample/prettyprint/cs/.code={\textcolor{cscolor}{\pgfmanualcslinkpreskip4.25pt\pgfmanualpdfref{##1}{\noligs{##1}}}},
1901 /codeexample/prettyprint/cs with args/.code 2 args={\textcolor{black}{\pgfmanualcslinkpreskip4.25pt\pgfmanualpdfref{##1}{\noligs{##1}}}\{\textcolor{black}{\pgfmanualprettyprintcode{##2}}\pgfmanualclosebrace},
1902 /codeexample/prettyprint/cs arguments/pgfkeys/.initial=1,
1903 /codeexample/prettyprint/cs/pgfkeys/.code 2 args={\textcolor{black}{\pgfmanualcslinkpreskip4.25pt\pgfmanualpdfref{##1}{\noligs{##1}}}\{\textcolor{black}{\pgfmanualprettyprintpgfkeys{##2}}\pgfmanualclosebrace},
1904 /codeexample/prettyprint/cs arguments/begin/.initial=1,
1905 /codeexample/prettyprint/cs/begin/.code 2 args={\textcolor{black}{##1}\{\textcolor{cscolor}{\pgfmanualpdfref{##2}{\noligs{##2}}}\pgfmanualclosebrace},
1906 /codeexample/prettyprint/cs arguments/end/.initial=1,
1907 /codeexample/prettyprint/cs/end/.code 2 args={\textcolor{black}{##1}\{\textcolor{cscolor}{\pgfmanualpdfref{##2}{\noligs{##2}}}\pgfmanualclosebrace},
1908 /codeexample/prettyprint/word/.code={\pgfmanualwordstartup{\begingroup\pgfkeyssetvalue{/pdflinks/search key prefixes in}{}\pgfmanualpdfref{##1}{\noligs{##1}}\endgroup}},
1909 /codeexample/prettyprint/point/.code={\textcolor{pointcolor}{\noligs{##1}}},%
1910 /codeexample/prettyprint/point with cs/.code 2 args={\textcolor{pointcolor}{(\pgfmanualpdfref{##1}{\noligs{##1}}:\noligs{##2}}},%
1911 /codeexample/prettyprint/comment font=\itshape,
1912 /codeexample/prettyprint/base color/.initial=\color{basecolor},
1913 /pdflinks/render hyperlink/.code={%
1914 {\setbox0=\hbox{##1}%
1915 \rlap{{\color{linkcolor}\dimen0\wd0\advance\dimen0by-\pgfmanualcslinkpreskip\hskip\pgfmanualcslinkpreskip\vrule width\dimen0 height-1pt depth1.6pt}}%
1916 \box0%
1917 }%
1918 }
1919 },/codeexample/syntax hilighting
1920 }
1921
1922 \colorlet{keycolor}{black}
1923 \colorlet{cscolor}{black}
1924 \colorlet{pointcolor}{black}
1925 \colorlet{basecolor}{black}
1926 \colorlet{linkcolor}{black!8}
1927
1928 \def\pgfmanualswitchoncolors{%
1929 \colorlet{keycolor}{green!50!black}%
1930 \colorlet{cscolor}{blue!70!black}
1931 \colorlet{pointcolor}{violet}
1932 \colorlet{basecolor}{black!55}
1933 \colorlet{linkcolor}{white}
1934 }
1935
1936 \makeatletter
1937
1938 \def\pgfmanualwordstartup{\textcolor{black}}
1939
1940 \def\noligs#1{\pgfmanualnoligs#1\kern0pt--\pgf@stop}%
1941 \def\pgfmanualnoligs#1--{%
1942 \pgfutil@ifnextchar\pgf@stop{#1\pgfutil@gobble}{#1-\kern0pt-\kern0pt\pgfmanualnoligs}%
1943 }
1944 \makeatother
1945
1946
1947 %%% Local Variables:
1948 %%% mode: latex
1949 %%% TeX-master: "beameruserguide"
1950 %%% End: