1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
|
% Copyright 2011, 2012 by Florêncio Neves
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% The preamble of this file contains parts of the files
% pgfmanual-en-main.tex and pgfmanual-en-macros.tex of the pgf package,
% copyright 2006 by Till Tantau and distributed under LPPL and/or GNU
% GPL.
\documentclass{ltxdoc}
\def\xcolorversion{2.00}
\usepackage[version=latest]{pgf}
\usepackage{xkeyval,calc,listings,tikz,fp}
\usepackage{hyperref}
\hypersetup{%
colorlinks=true, % use true to enable colors below:
linkcolor=blue,%red,
filecolor=blue,%magenta,
pagecolor=blue,%red,
urlcolor=blue,%cyan,
citecolor=blue,
pdfborder=0 0 0,
}
% We need lots of libraries...
\usetikzlibrary{
arrows,
calc,
fit,
patterns,
plotmarks,
shapes.geometric,
shapes.misc,
shapes.symbols,
shapes.arrows,
shapes.callouts,
shapes.multipart,
shapes.gates.logic.US,
shapes.gates.logic.IEC,
circuits.logic.US,
circuits.logic.IEC,
circuits.logic.CDH,
circuits.ee.IEC,
datavisualization,
datavisualization.formats.functions,
er,
automata,
backgrounds,
chains,
topaths,
trees,
petri,
mindmap,
matrix,
calendar,
folding,
fadings,
shadings,
spy,
through,
turtle,
positioning,
scopes,
decorations.fractals,
decorations.shapes,
decorations.text,
decorations.pathmorphing,
decorations.pathreplacing,
decorations.footprints,
decorations.markings,
shadows,
lindenmayersystems,
intersections,
fixedpointarithmetic,
fpu,
svg.path,
external,
}
\iffalse
% \iftrue
\tikzexternalize[
mode=list only,export=true,% simply skips EVERY picture -> good for debugging the text.
]
{pgfmanual}
\tikzifexternalizing{%
\pgfkeys{/pdflinks/codeexample links=false}%
}{}%
\fi
\usepackage[a4paper,left=2.25cm,right=2.25cm,top=2.5cm,bottom=2.5cm,nohead]{geometry}
\usepackage{amsmath,amssymb}
\usepackage{xxcolor}
\usepackage{pifont}
\usepackage{makeidx}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\graphicspath{{../../images/}} % TODOsp: under windows this would go up 2 directories, but the file is only one directory up
% \makeindex
\providecommand\href[2]{\texttt{#1}}
\providecommand\hypertarget[2]{\texttt{#1}}
\providecommand\hyperlink[2]{\texttt{#1}}
\colorlet{examplefill}{yellow!80!black}
\definecolor{graphicbackground}{rgb}{0.96,0.96,0.8}
\definecolor{codebackground}{rgb}{0.8,0.8,1}
\newenvironment{pgfmanualentry}{\list{}{\leftmargin=2em\itemindent-\leftmargin\def\makelabel##1{\hss##1}}}{\endlist}
\newcommand\pgfmanualentryheadline[1]{\itemsep=0pt\parskip=0pt\item\strut{#1}\par\topsep=0pt}
\newcommand\pgfmanualbody{\parskip3pt}
\newenvironment{pgflayout}[1]{
\begin{pgfmanualentry}
\pgfmanualentryheadline{\texttt{\string\pgfpagesuselayout\char`\{\declare{#1}\char`\}}\oarg{options}}
\index{#1@\protect\texttt{#1} layout}%
\index{Page layouts!#1@\protect\texttt{#1}}%
\pgfmanualpdflabel{#1}{}%
\pgfmanualbody
}
{
\end{pgfmanualentry}
}
\newenvironment{command}[1]{
\begin{pgfmanualentry}
\extractcommand#1\@@
\pgfmanualbody
}
{
\end{pgfmanualentry}
}
\newenvironment{commandlist}[1]{%
\begin{pgfmanualentry}
\foreach \xx in {#1} {%
\expandafter\extractcommand\xx\@@
}%
\pgfmanualbody
}{%
\end{pgfmanualentry}
}%
% \begin{internallist}[register]{\pgf@xa}
% \end{internallist}
%
% \begin{internallist}[register]{\pgf@xa,\pgf@xb}
% \end{internallist}
\newenvironment{internallist}[2][register]{%
\begin{pgfmanualentry}
\foreach \xx in {#2} {%
\expandafter\extractinternalcommand\expandafter{\xx}{#1}%
}%
\pgfmanualbody
}{%
\end{pgfmanualentry}
}%
\def\extractinternalcommand#1#2{%
\pgfmanualentryheadline{Internal #2 \declare{\texttt{\string#1}}}%
\removeats{#1}%
\index{Internals!\strippedat @\protect\myprintocmmand{\strippedat}}%
\index{\strippedat @\protect\myprintocmmand{\strippedat}}%
\pgfmanualpdflabel{\textbackslash\strippedat}{}%
}
%% MW: START MATH MACROS
\def\mvar#1{{\ifmmode\textrm{\textit{#1}}\else\rmfamily\textit{#1}\fi}}
\makeatletter
\def\extractmathfunctionname#1{\extractmathfunctionname@#1(,)\tmpa\tmpb}
\def\extractmathfunctionname@#1(#2)#3\tmpb{\def\mathname{#1}}
\makeatother
\newenvironment{math-function}[1]{
\def\mathdefaultname{#1}
\extractmathfunctionname{#1}
\edef\mathurl{{math:\mathname}}\expandafter\hypertarget\expandafter{\mathurl}{}%
\begin{pgfmanualentry}
\pgfmanualentryheadline{\texttt{#1}}%
\index{\mathname @\protect\texttt{\mathname} math function}%
\index{Math functions!\mathname @\protect\texttt{\mathname}}%
\pgfmanualbody
}
{
\end{pgfmanualentry}
}
\def\pgfmanualemptytext{}
\def\pgfmanualvbarvbar{\char`\|\char`\|}
\newenvironment{math-operator}[4][]{%
\begin{pgfmanualentry}
\csname math#3operator\endcsname{#2}{#4}
\def\mathtest{#4}%
\ifx\mathtest\pgfmanualemptytext%
\def\mathtype{(#3 operator)}
\else%
\def\mathtype{(#3 operator; uses the \texttt{#4} function)}
\fi%
\pgfmanualentryheadline{\mathexample\hfill\mathtype}%
\def\mathtest{#1}%
\ifx\mathtest\pgfmanualemptytext%
\index{#2@\protect\texttt{#2} #3 math operator}%
\index{Math operators!#2@\protect\texttt{#2}}%
\fi%
\pgfmanualbody
}
{\end{pgfmanualentry}}
\newenvironment{math-operators}[5][]{%
\begin{pgfmanualentry}
\csname math#4operator\endcsname{#2}{#3}
\def\mathtest{#5}%
\ifx\mathtest\pgfmanualemptytext%
\def\mathtype{(#4 operators)}
\else%
\def\mathtype{(#4 operators; use the \texttt{#5} function)}
\fi%
\pgfmanualentryheadline{\mathexample\hfill\mathtype}%
\def\mathtest{#1}%
\ifx\mathtest\pgfmanualemptytext%
\index{#2#3@\protect\texttt{#2\protect\ #3} #4 math operators}%
\index{Math operators!#2#3@\protect\texttt{#2\protect\ #3}}%
\fi%
\pgfmanualbody
}
{\end{pgfmanualentry}}
\def\mathinfixoperator#1#2{%
\def\mathoperator{\texttt{#1}}%
\def\mathexample{\mvar{x}\space\texttt{#1}\space\mvar{y}}%
}
\def\mathprefixoperator#1#2{%
\def\mathoperator{\texttt{#1}}%
\def\mathexample{\texttt{#1}\mvar{x}}%
}
\def\mathpostfixoperator#1#2{%
\def\mathoperator{\texttt{#1}}
\def\mathexample{\mvar{x}\texttt{#1}}%
}
\def\mathgroupoperator#1#2{%
\def\mathoperator{\texttt{#1\ #2}}%
\def\mathexample{\texttt{#1}\mvar{x}\texttt{#2}}%
}
\expandafter\let\csname matharray accessoperator\endcsname=\mathgroupoperator
\expandafter\let\csname matharrayoperator\endcsname=\mathgroupoperator
\def\mathconditionaloperator#1#2{%
\def\mathoperator{#1\space#2}
\def\mathexample{\mvar{x}\ \texttt{#1}\ \mvar{y}\ {\texttt{#2}}\ \mvar{z}}
}
\newcommand\mathcommand[1][\mathdefaultname]{%
\expandafter\makemathcommand#1(\empty)\stop%
\expandafter\extractcommand\mathcommandname\@@%
\medskip
}
\makeatletter
\def\makemathcommand#1(#2)#3\stop{%
\expandafter\def\expandafter\mathcommandname\expandafter{\csname pgfmath#1\endcsname}%
\ifx#2\empty%
\else%
\@makemathcommand#2,\stop,
\fi}
\def\@makemathcommand#1,{%
\ifx#1\stop%
\else%
\expandafter\def\expandafter\mathcommandname\expandafter{\mathcommandname{\ttfamily\char`\{#1\char`\}}}%
\expandafter\@makemathcommand%
\fi}
\makeatother
\def\calcname{\textsc{calc}}
%% MW: END MATH MACROS
\def\extractcommand#1#2\@@{%
\pgfmanualentryheadline{\declare{\texttt{\string#1}}#2}%
\removeats{#1}%
\index{\strippedat @\protect\myprintocmmand{\strippedat}}
\pgfmanualpdflabel{\textbackslash\strippedat}{}%
}
% \begin{environment}{{name}\marg{arguments}}
\renewenvironment{environment}[1]{
\begin{pgfmanualentry}
\extractenvironement#1\@@
\pgfmanualbody
}
{
\end{pgfmanualentry}
}
\def\extractenvironement#1#2\@@{%
\pgfmanualentryheadline{{\ttfamily\char`\\begin\char`\{\declare{#1}\char`\}}#2}%
\pgfmanualentryheadline{{\ttfamily\ \ }\meta{environment contents}}%
\pgfmanualentryheadline{{\ttfamily\char`\\end\char`\{\declare{#1}\char`\}}}%
\index{#1@\protect\texttt{#1} environment}%
\index{Environments!#1@\protect\texttt{#1}}
\pgfmanualpdflabel{#1}{}%
}
\newenvironment{plainenvironment}[1]{
\begin{pgfmanualentry}
\extractplainenvironement#1\@@
\pgfmanualbody
}
{
\end{pgfmanualentry}
}
\def\extractplainenvironement#1#2\@@{%
\pgfmanualentryheadline{{\ttfamily\declare{\char`\\#1}}#2}%
\pgfmanualentryheadline{{\ttfamily\ \ }\meta{environment contents}}%
\pgfmanualentryheadline{{\ttfamily\declare{\char`\\end#1}}}%
\index{#1@\protect\texttt{#1} environment}%
\index{Environments!#1@\protect\texttt{#1}}%
}
\newenvironment{contextenvironment}[1]{
\begin{pgfmanualentry}
\extractcontextenvironement#1\@@
\pgfmanualbody
}
{
\end{pgfmanualentry}
}
\def\extractcontextenvironement#1#2\@@{%
\pgfmanualentryheadline{{\ttfamily\declare{\char`\\start#1}}#2}%
\pgfmanualentryheadline{{\ttfamily\ \ }\meta{environment contents}}%
\pgfmanualentryheadline{{\ttfamily\declare{\char`\\stop#1}}}%
\index{#1@\protect\texttt{#1} environment}%
\index{Environments!#1@\protect\texttt{#1}}}
\newenvironment{shape}[1]{
\begin{pgfmanualentry}
\pgfmanualentryheadline{Shape {\ttfamily\declare{#1}}}%
\index{#1@\protect\texttt{#1} shape}%
\index{Shapes!#1@\protect\texttt{#1}}
\pgfmanualpdflabel{#1}{}%
\pgfmanualbody
}
{
\end{pgfmanualentry}
}
\newenvironment{shading}[1]{
\begin{pgfmanualentry}
\pgfmanualentryheadline{Shading {\ttfamily\declare{#1}}}%
\index{#1@\protect\texttt{#1} shading}%
\index{Shadings!#1@\protect\texttt{#1}}
\pgfmanualpdflabel{#1}{}%
\pgfmanualbody
}
{
\end{pgfmanualentry}
}
\newenvironment{dataformat}[1]{
\begin{pgfmanualentry}
\pgfmanualentryheadline{Format {\ttfamily\declare{#1}}}%
\index{#1@\protect\texttt{#1} format}%
\index{Formats!#1@\protect\texttt{#1}}
\pgfmanualpdflabel{#1}{}%
\pgfmanualbody
}
{
\end{pgfmanualentry}
}
\newenvironment{handler}[1]{
\begin{pgfmanualentry}
\extracthandler#1\@nil%
\pgfmanualbody
}
{
\end{pgfmanualentry}
}
\def\gobble#1{}
\def\extracthandler#1#2\@nil{%
\pgfmanualentryheadline{Key handler \meta{key}{\ttfamily/\declare{#1}}#2}%
\index{\gobble#1@\protect\texttt{#1} handler}%
\index{Key handlers!#1@\protect\texttt{#1}}
\pgfmanualpdflabel{/handlers/#1}%
}
\makeatletter
\newenvironment{stylekey}[1]{
\begin{pgfmanualentry}
\def\extrakeytext{style, }
\extractkey#1\@nil%
\pgfmanualbody
}
{
\end{pgfmanualentry}
}
\def\choicesep{$\vert$}%
\def\choicearg#1{\texttt{#1}}
\newif\iffirstchoice
% \mchoice{choice1,choice2,choice3}
\newcommand\mchoice[1]{%
\begingroup
\firstchoicetrue
\foreach \mchoice@ in {#1} {%
\iffirstchoice
\global\firstchoicefalse
\else
\choicesep
\fi
\choicearg{\mchoice@}%
}%
\endgroup
}%
% \begin{key}{/path/x=value}
% \begin{key}{/path/x=value (initially XXX)}
% \begin{key}{/path/x=value (default XXX)}
\newenvironment{key}[1]{
\begin{pgfmanualentry}
\def\extrakeytext{}
% \def\altpath{\emph{\color{gray}or}}%
\extractkey#1\@nil%
\pgfmanualbody
}
{
\end{pgfmanualentry}
}
% \insertpathifneeded{a key}{/pgf} -> assign mykey={/pgf/a key}
% \insertpathifneeded{/tikz/a key}{/pgf} -> assign mykey={/tikz/a key}
%
% #1: the key
% #2: a default path (or empty)
\def\insertpathifneeded#1#2{%
\def\insertpathifneeded@@{#2}%
\ifx\insertpathifneeded@@\empty
\def\mykey{#1}%
\else
\insertpathifneeded@#2\@nil
\ifpgfutil@in@
\def\mykey{#2/#1}%
\else
\def\mykey{#1}%
\fi
\fi
}%
\def\insertpathifneeded@#1#2\@nil{%
\def\insertpathifneeded@@{#1}%
\def\insertpathifneeded@@@{/}%
\ifx\insertpathifneeded@@\insertpathifneeded@@@
\pgfutil@in@true
\else
\pgfutil@in@false
\fi
}%
% \begin{keylist}[default path]
% {/path/option 1=value,/path/option 2=value2}
% \end{keylist}
\newenvironment{keylist}[2][]{%
\begin{pgfmanualentry}
\def\extrakeytext{}%
\foreach \xx in {#2} {%
\expandafter\insertpathifneeded\expandafter{\xx}{#1}%
\expandafter\extractkey\mykey\@nil%
}%
\pgfmanualbody
}{%
\end{pgfmanualentry}
}%
\def\extractkey#1\@nil{%
\pgfutil@in@={#1}%
\ifpgfutil@in@%
\extractkeyequal#1\@nil
\else%
\pgfutil@in@{(initial}{#1}%
\ifpgfutil@in@%
\extractequalinitial#1\@nil%
\else
\pgfmanualentryheadline{{\ttfamily\declare{#1}}\hfill(\extrakeytext no value)}%
\def\mykey{#1}%
\def\mypath{}%
\def\myname{}%
\firsttimetrue%
\decompose#1/\nil%
\fi
\fi%
}
\def\extractkeyequal#1=#2\@nil{%
\pgfutil@in@{(default}{#2}%
\ifpgfutil@in@%
\extractdefault{#1}#2\@nil%
\else%
\pgfutil@in@{(initial}{#2}%
\ifpgfutil@in@%
\extractinitial{#1}#2\@nil%
\else
\pgfmanualentryheadline{{\ttfamily\declare{#1}=}#2\hfill(\extrakeytext no default)}%
\fi%
\fi%
\def\mykey{#1}%
\def\mypath{}%
\def\myname{}%
\firsttimetrue%
\decompose#1/\nil%
}
\def\extractdefault#1#2(default #3)\@nil{%
\pgfmanualentryheadline{{\ttfamily\declare{#1}\opt{=}}\opt{#2}\hfill (\extrakeytext default {\ttfamily#3})}%
}
\def\extractinitial#1#2(initially #3)\@nil{%
\pgfmanualentryheadline{{\ttfamily\declare{#1}=}#2\hfill (\extrakeytext no default, initially {\ttfamily#3})}%
}
\def\extractequalinitial#1 (initially #2)\@nil{%
\pgfmanualentryheadline{{\ttfamily\declare{#1}}\hfill (\extrakeytext initially {\ttfamily#2})}%
\def\mykey{#1}%
\def\mypath{}%
\def\myname{}%
\firsttimetrue%
\decompose#1/\nil%
}
% Introduces a key alias '/#1/<name of current key>'
% to be used inside of \begin{key} ... \end{key}
\def\keyalias#1{\vspace{-3pt}\item{\small alias {\ttfamily/#1/\myname}}\vspace{-2pt}\par
\pgfmanualpdflabel{/#1/\myname}{}%
}
\newif\iffirsttime
\makeatother
\def\decompose/#1/#2\nil{%
\def\test{#2}%
\ifx\test\empty%
% aha.
\index{#1@\protect\texttt{#1} key}%
\index{\mypath#1@\protect\texttt{#1}}%
\def\myname{#1}%
\else%
\iffirsttime
\begingroup
% also make a pdf link anchor with full key path.
\def\hyperlabelwithoutslash##1/\nil{%
\pgfmanualpdflabel{##1}{}%
}%
\hyperlabelwithoutslash/#1/#2\nil
\endgroup
\def\mypath{#1@\protect\texttt{/#1/}!}%
\firsttimefalse
\else
\expandafter\def\expandafter\mypath\expandafter{\mypath#1@\protect\texttt{#1/}!}%
\fi
\def\firsttime{}
\decompose/#2\nil%
\fi%
}
\def\indexkey#1{%
\def\mypath{}%
\decompose#1/\nil%
}
\newenvironment{predefinedmethod}[1]{
\begin{pgfmanualentry}
\extractpredefinedmethod#1\@nil
\pgfmanualbody
}
{
\end{pgfmanualentry}
}
\def\extractpredefinedmethod#1(#2)\@nil{%
\pgfmanualentryheadline{Method \declare{\ttfamily #1}\texttt(#2\texttt) \hfill(predefined for all classes)}
\index{#1@\protect\texttt{#1} method}%
\index{Methods!#1@\protect\texttt{#1}}
\pgfmanualpdflabel{#1}{}%
}
\newenvironment{ooclass}[1]{
\begin{pgfmanualentry}
\def\currentclass{#1}
\pgfmanualentryheadline{Class \declare{\texttt{#1}}}
\index{#1@\protect\texttt{#1} class}%
\index{Class #1@Class \protect\texttt{#1}}%
\index{Classes!#1@\protect\texttt{#1}}
\pgfmanualpdflabel{#1}{}%
\pgfmanualbody
}
{
\end{pgfmanualentry}
}
\newenvironment{method}[1]{
\begin{pgfmanualentry}
\extractmethod#1\@nil
\pgfmanualbody
}
{
\end{pgfmanualentry}
}
\def\extractmethod#1(#2)\@nil{%
\def\test{#1}
\ifx\test\currentclass
\pgfmanualentryheadline{Constructor \declare{\ttfamily #1}\texttt(#2\texttt)}
\else
\pgfmanualentryheadline{Method \declare{\ttfamily #1}\texttt(#2\texttt)}
\fi
\index{#1@\protect\texttt{#1} method}%
\index{Methods!#1@\protect\texttt{#1}}
\index{Class \currentclass!#1@\protect\texttt{#1}}%
\pgfmanualpdflabel{#1}{}%
}
\newenvironment{attribute}[1]{
\begin{pgfmanualentry}
\extractattribute#1\@nil
\pgfmanualbody
}
{
\end{pgfmanualentry}
}
\def\extractattribute#1=#2;\@nil{%
\def\test{#2}%
\ifx\test\@empty
\pgfmanualentryheadline{Private attribute \declare{\ttfamily #1} \hfill (initially empty)}
\else
\pgfmanualentryheadline{Private attribute \declare{\ttfamily #1} \hfill (initially {\ttfamily #2})}
\fi
\index{#1@\protect\texttt{#1} attribute}%
\index{Attributes!#1@\protect\texttt{#1}}
\index{Class \currentclass!#1@\protect\texttt{#1}}%
\pgfmanualpdflabel{#1}{}%
}
\newenvironment{predefinednode}[1]{
\begin{pgfmanualentry}
\pgfmanualentryheadline{Predefined node {\ttfamily\declare{#1}}}%
\index{#1@\protect\texttt{#1} node}%
\index{Predefined node!#1@\protect\texttt{#1}}
\pgfmanualpdflabel{#1}{}%
\pgfmanualbody
}
{
\end{pgfmanualentry}
}
\newenvironment{coordinatesystem}[1]{
\begin{pgfmanualentry}
\pgfmanualentryheadline{Coordinate system {\ttfamily\declare{#1}}}%
\index{#1@\protect\texttt{#1} coordinate system}%
\index{Coordinate systems!#1@\protect\texttt{#1}}
\pgfmanualpdflabel{#1}{}%
\pgfmanualbody
}
{
\end{pgfmanualentry}
}
\newenvironment{snake}[1]{
\begin{pgfmanualentry}
\pgfmanualentryheadline{Snake {\ttfamily\declare{#1}}}%
\index{#1@\protect\texttt{#1} snake}%
\index{Snakes!#1@\protect\texttt{#1}}
\pgfmanualbody
}
{
\end{pgfmanualentry}
}
\newenvironment{decoration}[1]{
\begin{pgfmanualentry}
\pgfmanualentryheadline{Decoration {\ttfamily\declare{#1}}}%
\index{#1@\protect\texttt{#1} decoration}%
\index{Decorations!#1@\protect\texttt{#1}}
\pgfmanualbody
}
{
\end{pgfmanualentry}
}
\def\pgfmanualbar{\char`\|}
\makeatletter
\newenvironment{pathoperation}[3][]{
\begin{pgfmanualentry}
\pgfmanualentryheadline{\textcolor{gray}{{\ttfamily\char`\\path}\
\ \dots}
\declare{\texttt{#2}}#3\ \textcolor{gray}{\dots\texttt{;}}}%
\def\pgfmanualtest{#1}%
\ifx\pgfmanualtest\@empty%
\index{#2@\protect\texttt{#2} path operation}%
\index{Path operations!#2@\protect\texttt{#2}}%
\pgfmanualpdflabel{#2}{}%
\fi%
\pgfmanualbody
}
{
\end{pgfmanualentry}
}
\newenvironment{datavisualizationoperation}[3][]{
\begin{pgfmanualentry}
\pgfmanualentryheadline{\textcolor{gray}{{\ttfamily\char`\\datavisualization}\
\ \dots}
\declare{\texttt{#2}}#3\ \textcolor{gray}{\dots\texttt{;}}}%
\def\pgfmanualtest{#1}%
\ifx\pgfmanualtest\@empty%
\index{#2@\protect\texttt{#2} (data visualization)}%
\index{Data visualization!#2@\protect\texttt{#2}}%
\pgfmanualpdflabel{#2}{}%
\fi%
\pgfmanualbody
}
{
\end{pgfmanualentry}
}
\makeatother
\def\extractcommand#1#2\@@{%
\pgfmanualentryheadline{\declare{\texttt{\string#1}}#2}%
\removeats{#1}%
\index{\strippedat @\protect\myprintocmmand{\strippedat}}
\pgfmanualpdflabel{\textbackslash\strippedat}{}%
}
\def\doublebs{\texttt{\char`\\\char`\\}}
\newenvironment{package}[1]{
\begin{pgfmanualentry}
\pgfmanualentryheadline{{\ttfamily\char`\\usepackage\char`\{\declare{#1}\char`\}\space\space \char`\%\space\space \LaTeX}}
\index{#1@\protect\texttt{#1} package}%
\index{Packages and files!#1@\protect\texttt{#1}}%
\pgfmanualentryheadline{{\ttfamily\char`\\input \declare{#1}.tex\space\space\space \char`\%\space\space plain \TeX}}
\pgfmanualentryheadline{{\ttfamily\char`\\usemodule[\declare{#1}]\space\space \char`\%\space\space Con\TeX t}}
\pgfmanualbody
}
{
\end{pgfmanualentry}
}
\newenvironment{pgfmodule}[1]{
\begin{pgfmanualentry}
\pgfmanualentryheadline{{\ttfamily\char`\\usepgfmodule\char`\{\declare{#1}\char`\}\space\space\space
\char`\%\space\space \LaTeX\space and plain \TeX\space and pure pgf}}
\index{#1@\protect\texttt{#1} module}%
\index{Modules!#1@\protect\texttt{#1}}%
\pgfmanualentryheadline{{\ttfamily\char`\\usepgfmodule[\declare{#1}]\space\space \char`\%\space\space Con\TeX t\space and pure pgf}}
\pgfmanualbody
\pgfmanualpdflabel{#1}{}%
}
{
\end{pgfmanualentry}
}
\newenvironment{pgflibrary}[1]{
\begin{pgfmanualentry}
\pgfmanualentryheadline{{\ttfamily\char`\\usepgflibrary\char`\{\declare{#1}\char`\}\space\space\space
\char`\%\space\space \LaTeX\space and plain \TeX\space and pure pgf}}
\index{#1@\protect\texttt{#1} library}%
\index{Libraries!#1@\protect\texttt{#1}}%
\pgfmanualentryheadline{{\ttfamily\char`\\usepgflibrary[\declare{#1}]\space\space \char`\%\space\space Con\TeX t\space and pure pgf}}
\pgfmanualentryheadline{{\ttfamily\char`\\usetikzlibrary\char`\{\declare{#1}\char`\}\space\space
\char`\%\space\space \LaTeX\space and plain \TeX\space when using \tikzname}}
\pgfmanualentryheadline{{\ttfamily\char`\\usetikzlibrary[\declare{#1}]\space
\char`\%\space\space Con\TeX t\space when using \tikzname}}
\pgfmanualbody
\pgfmanualpdflabel{#1}{}%
}
{
\end{pgfmanualentry}
}
\newenvironment{tikzlibrary}[1]{
\begin{pgfmanualentry}
\pgfmanualentryheadline{{\ttfamily\char`\\usetikzlibrary\char`\{\declare{#1}\char`\}\space\space \char`\%\space\space \LaTeX\space and plain \TeX}}
\index{#1@\protect\texttt{#1} library}%
\index{Libraries!#1@\protect\texttt{#1}}%
\pgfmanualentryheadline{{\ttfamily\char`\\usetikzlibrary[\declare{#1}]\space \char`\%\space\space Con\TeX t}}
\pgfmanualbody
\pgfmanualpdflabel{#1}{}%
}
{
\end{pgfmanualentry}
}
\newenvironment{filedescription}[1]{
\begin{pgfmanualentry}
\pgfmanualentryheadline{File {\ttfamily\declare{#1}}}%
\index{#1@\protect\texttt{#1} file}%
\index{Packages and files!#1@\protect\texttt{#1}}%
\pgfmanualbody
}
{
\end{pgfmanualentry}
}
\newenvironment{packageoption}[1]{
\begin{pgfmanualentry}
\pgfmanualentryheadline{{\ttfamily\char`\\usepackage[\declare{#1}]\char`\{pgf\char`\}}}
\index{#1@\protect\texttt{#1} package option}%
\index{Package options for \textsc{pgf}!#1@\protect\texttt{#1}}%
\pgfmanualbody
}
{
\end{pgfmanualentry}
}
\newcommand\opt[1]{{\color{black!50!green}#1}}
\newcommand\ooarg[1]{{\ttfamily[}\meta{#1}{\ttfamily]}}
\def\opt{\afterassignment\pgfmanualopt\let\next=}
\def\pgfmanualopt{\ifx\next\bgroup\bgroup\color{black!50!green}\else{\color{black!50!green}\next}\fi}
\def\beamer{\textsc{beamer}}
\def\pdf{\textsc{pdf}}
\def\eps{\texttt{eps}}
\def\pgfname{\textsc{pgf}}
\def\tikzname{Ti\emph{k}Z}
\def\pstricks{\textsc{pstricks}}
\def\prosper{\textsc{prosper}}
\def\seminar{\textsc{seminar}}
\def\texpower{\textsc{texpower}}
\def\foils{\textsc{foils}}
{
\makeatletter
\global\let\myempty=\@empty
\global\let\mygobble=\@gobble
\catcode`\@=12
\gdef\getridofats#1@#2\relax{%
\def\getridtest{#2}%
\ifx\getridtest\myempty%
\expandafter\def\expandafter\strippedat\expandafter{\strippedat#1}
\else%
\expandafter\def\expandafter\strippedat\expandafter{\strippedat#1\protect\printanat}
\getridofats#2\relax%
\fi%
}
\gdef\removeats#1{%
\let\strippedat\myempty%
\edef\strippedtext{\stripcommand#1}%
\expandafter\getridofats\strippedtext @\relax%
}
\gdef\stripcommand#1{\expandafter\mygobble\string#1}
}
\def\printanat{\char`\@}
\def\declare{\afterassignment\pgfmanualdeclare\let\next=}
\def\pgfmanualdeclare{\ifx\next\bgroup\bgroup\color{red!75!black}\else{\color{red!75!black}\next}\fi}
\let\textoken=\command
\let\endtextoken=\endcommand
\def\myprintocmmand#1{\texttt{\char`\\#1}}
\def\example{\par\smallskip\noindent\textit{Example: }}
\def\themeauthor{\par\smallskip\noindent\textit{Theme author: }}
\def\indexoption#1{%
\index{#1@\protect\texttt{#1} option}%
\index{Graphic options and styles!#1@\protect\texttt{#1}}%
}
\def\itemcalendaroption#1{\item \declare{\texttt{#1}}%
\index{#1@\protect\texttt{#1} date test}%
\index{Date tests!#1@\protect\texttt{#1}}%
}
\def\class#1{\list{}{\leftmargin=2em\itemindent-\leftmargin\def\makelabel##1{\hss##1}}%
\extractclass#1@\par\topsep=0pt}
\def\endclass{\endlist}
\def\extractclass#1#2@{%
\item{{{\ttfamily\char`\\documentclass}#2{\ttfamily\char`\{\declare{#1}\char`\}}}}%
\index{#1@\protect\texttt{#1} class}%
\index{Classes!#1@\protect\texttt{#1}}}
\def\partname{Part}
\makeatletter
\def\index@prologue{\section*{Index}\addcontentsline{toc}{section}{Index}
This index only contains automatically generated entries. A good
index should also contain carefully selected keywords. This index is
not a good index.
\bigskip
}
\c@IndexColumns=2
\def\theindex{\@restonecoltrue
\columnseprule \z@ \columnsep 29\p@
\twocolumn[\index@prologue]%
\parindent -30pt
\columnsep 15pt
\parskip 0pt plus 1pt
\leftskip 30pt
\rightskip 0pt plus 2cm
\small
\def\@idxitem{\par}%
\let\item\@idxitem \ignorespaces}
\def\endtheindex{\onecolumn}
\def\noindexing{\let\index=\@gobble}
\newcommand\symarrow[1]{
\index{#1@\protect\texttt{#1} arrow tip}%
\index{Arrow tips!#1@\protect\texttt{#1}}
\texttt{#1}& yields thick
\begin{tikzpicture}[arrows={#1-#1},thick,baseline]
\useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
\draw (0pt,.5ex) -- (1cm,.5ex);
\end{tikzpicture} and thin
\begin{tikzpicture}[arrows={#1-#1},thin,baseline]
\useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
\draw (0pt,.5ex) -- (1cm,.5ex);
\end{tikzpicture}
}
\newcommand\symarrowdouble[1]{
\index{#1@\protect\texttt{#1} arrow tip}%
\index{Arrow tips!#1@\protect\texttt{#1}}
\texttt{#1}& yields thick
\begin{tikzpicture}[arrows={#1-#1},thick,baseline]
\useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
\draw (0pt,.5ex) -- (1cm,.5ex);
\end{tikzpicture}
and thin
\begin{tikzpicture}[arrows={#1-#1},thin,baseline]
\useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
\draw (0pt,.5ex) -- (1cm,.5ex);
\end{tikzpicture}, double
\begin{tikzpicture}[arrows={#1-#1},thick,baseline]
\useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
\draw[double,double equal sign distance] (0pt,.5ex) -- (1cm,.5ex);
\end{tikzpicture} and
\begin{tikzpicture}[arrows={#1-#1},thin,baseline]
\useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
\draw[double,double equal sign distance] (0pt,.5ex) -- (1cm,.5ex);
\end{tikzpicture}
}
\newcommand\sarrow[2]{
\index{#1@\protect\texttt{#1} arrow tip}%
\index{Arrow tips!#1@\protect\texttt{#1}}
\index{#2@\protect\texttt{#2} arrow tip}%
\index{Arrow tips!#2@\protect\texttt{#2}}
\texttt{#1-#2}& yields thick
\begin{tikzpicture}[arrows={#1-#2},thick,baseline]
\useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
\draw (0pt,.5ex) -- (1cm,.5ex);
\end{tikzpicture} and thin
\begin{tikzpicture}[arrows={#1-#2},thin,baseline]
\useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
\draw (0pt,.5ex) -- (1cm,.5ex);
\end{tikzpicture}
}
\newcommand\sarrowdouble[2]{
\index{#1@\protect\texttt{#1} arrow tip}%
\index{Arrow tips!#1@\protect\texttt{#1}}
\index{#2@\protect\texttt{#2} arrow tip}%
\index{Arrow tips!#2@\protect\texttt{#2}}
\texttt{#1-#2}& yields thick
\begin{tikzpicture}[arrows={#1-#2},thick,baseline]
\useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
\draw (0pt,.5ex) -- (1cm,.5ex);
\end{tikzpicture} and thin
\begin{tikzpicture}[arrows={#1-#2},thin,baseline]
\useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
\draw (0pt,.5ex) -- (1cm,.5ex);
\end{tikzpicture}, double
\begin{tikzpicture}[arrows={#1-#2},thick,baseline]
\useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
\draw[double,double equal sign distance] (0pt,.5ex) -- (1cm,.5ex);
\end{tikzpicture} and
\begin{tikzpicture}[arrows={#1-#2},thin,baseline]
\useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
\draw[double,double equal sign distance] (0pt,.5ex) -- (1cm,.5ex);
\end{tikzpicture}
}
\newcommand\carrow[1]{
\index{#1@\protect\texttt{#1} arrow tip}%
\index{Arrow tips!#1@\protect\texttt{#1}}
\texttt{#1}& yields for line width 1ex
\begin{tikzpicture}[arrows={#1-#1},line width=1ex,baseline]
\useasboundingbox (0pt,-0.5ex) rectangle (1.5cm,2ex);
\draw (0pt,.5ex) -- (1.5cm,.5ex);
\end{tikzpicture}
}
\def\myvbar{\char`\|}
\newcommand\plotmarkentry[1]{%
\index{#1@\protect\texttt{#1} plot mark}%
\index{Plot marks!#1@\protect\texttt{#1}}
\texttt{\char`\\pgfuseplotmark\char`\{\declare{#1}\char`\}} &
\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)};\\
}
\newcommand\plotmarkentrytikz[1]{%
\index{#1@\protect\texttt{#1} plot mark}%
\index{Plot marks!#1@\protect\texttt{#1}}
\texttt{mark=\declare{#1}} & \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)};\\
}
\ifx\scantokens\@undefined
\PackageError{pgfmanual-macros}{You need to use extended latex
(elatex) or (pdfelatex) to process this document}{}
\fi
\begingroup
\catcode`|=0
\catcode`[= 1
\catcode`]=2
\catcode`\{=12
\catcode `\}=12
\catcode`\\=12 |gdef|find@example#1\end{codeexample}[|endofcodeexample[#1]]
|endgroup
% define \returntospace.
%
% It should define NEWLINE as {}, spaces and tabs as \space.
\begingroup
\catcode`\^=7
\catcode`\^^M=13
\catcode`\^^I=13
\catcode`\ =13%
\gdef\returntospace{\catcode`\ =13\def {\space}\catcode`\^^I=13\def^^I{\space}}
\gdef\showreturn{\show^^M}
\endgroup
\begingroup
\catcode`\%=13
\catcode`\^^M=13
\gdef\commenthandler{\catcode`\%=13\def%{\@gobble@till@return}}
\gdef\@gobble@till@return#1^^M{}
\gdef\@gobble@till@return@ignore#1^^M{\ignorespaces}
\gdef\typesetcomment{\catcode`\%=13\def%{\@typeset@till@return}}
\gdef\@typeset@till@return#1^^M{{\def%{\char`\%}\textsl{\char`\%#1}}\par}
\endgroup
% Define tab-implementation functions
% \codeexample@tabinit@replacementchars@
% and
% \codeexample@tabinit@catcode@
%
% They should ONLY be used in case that tab replacement is active.
%
% This here is merely a preparation step.
%
% Idea:
% \codeexample@tabinit@catcode@ will make TAB active
% and
% \codeexample@tabinit@replacementchars@ will insert as many spaces as
% /codeexample/tabsize contains.
{
\catcode`\^^I=13
% ATTENTION: do NOT use tabs in these definitions!!
\gdef\codeexample@tabinit@replacementchars@{%
\begingroup
\count0=\pgfkeysvalueof{/codeexample/tabsize}\relax
\toks0={}%
\loop
\ifnum\count0>0
\advance\count0 by-1
\toks0=\expandafter{\the\toks0\ }%
\repeat
\xdef\codeexample@tabinit@replacementchars@@{\the\toks0}%
\endgroup
\let^^I=\codeexample@tabinit@replacementchars@@
}%
\gdef\codeexample@tabinit@catcode@{\catcode`\^^I=13}%
}%
% Called after any options have been set. It assigns
% \codeexample@tabinit@catcode
% and
% \codeexample@tabinit@replacementchars
% which are used inside of
% \begin{codeexample}
% ...
% \end{codeexample}
%
% \codeexample@tabinit@catcode is either \relax or it makes tab
% active.
%
% \codeexample@tabinit@replacementchars is either \relax or it inserts
% a proper replacement sequence for tabs (as many spaces as
% configured)
\def\codeexample@tabinit{%
\ifnum\pgfkeysvalueof{/codeexample/tabsize}=0\relax
\let\codeexample@tabinit@replacementchars=\relax
\let\codeexample@tabinit@catcode=\relax
\else
\let\codeexample@tabinit@catcode=\codeexample@tabinit@catcode@
\let\codeexample@tabinit@replacementchars=\codeexample@tabinit@replacementchars@
\fi
}
\pgfqkeys{/codeexample}{%
width/.code= {\setlength\codeexamplewidth{#1}},
graphic/.code= {\colorlet{graphicbackground}{#1}},
code/.code= {\colorlet{codebackground}{#1}},
execute code/.is if=code@execute,
code only/.code= {\code@executefalse},
pre/.store in=\code@pre,
post/.store in=\code@post,
% #1 is the *complete* environment contents as it shall be
% typeset. In particular, the catcodes are NOT the normal ones.
typeset listing/.code= {#1},
render instead/.store in=\code@render,
vbox/.code= {\def\code@pre{\vbox\bgroup\setlength{\hsize}{\linewidth-6pt}}\def\code@post{\egroup}},
ignorespaces/.code= {\let\@gobble@till@return=\@gobble@till@return@ignore},
leave comments/.code= {\def\code@catcode@hook{\catcode`\%=12}\let\commenthandler=\relax\let\typesetcomment=\relax},
tabsize/.initial=0,% FIXME : this here is merely used for indentation. It is just a TAB REPLACEMENT.
every codeexample/.style={width=4cm+7pt},
}
\let\code@pre\pgfutil@empty
\let\code@post\pgfutil@empty
\let\code@render\pgfutil@empty
\def\code@catcode@hook{}
\newdimen\codeexamplewidth
\newif\ifcode@execute
\newbox\codeexamplebox
\def\codeexample[#1]{%
\begingroup%
\code@executetrue
\pgfqkeys{/codeexample}{every codeexample,#1}%
\codeexample@tabinit% assigns \codeexample@tabinit@[catcode,replacementchars]
\parindent0pt
\begingroup%
\par%
\medskip%
\let\do\@makeother%
\dospecials%
\obeylines%
\@vobeyspaces%
\catcode`\%=13%
\catcode`\^^M=13%
\code@catcode@hook%
\codeexample@tabinit@catcode
\relax%
\find@example}
\def\endofcodeexample#1{%
\endgroup%
\ifcode@execute%
\setbox\codeexamplebox=\hbox{%
\ifx\code@render\pgfutil@empty%
{%
{%
\returntospace%
\commenthandler%
\xdef\code@temp{#1}% removes returns and comments
}%
\catcode`\^^M=9%
\colorbox{graphicbackground}{\color{black}\ignorespaces%
\code@pre\expandafter\scantokens\expandafter{\code@temp\ignorespaces}\code@post\ignorespaces}%
}%
\else%
\colorbox{graphicbackground}{\color{black}\ignorespaces%
\code@render}%
\fi%
}%
\ifdim\wd\codeexamplebox>\codeexamplewidth%
\def\code@start{\par}%
\def\code@flushstart{}\def\code@flushend{}%
\def\code@mid{\parskip2pt\par\noindent}%
\def\code@width{\linewidth-6pt}%
\def\code@end{}%
\else%
\def\code@start{%
\linewidth=\textwidth%
\parshape \@ne 0pt \linewidth
\leavevmode%
\hbox\bgroup}%
\def\code@flushstart{\hfill}%
\def\code@flushend{\hbox{}}%
\def\code@mid{\hskip6pt}%
\def\code@width{\linewidth-12pt-\codeexamplewidth}%
\def\code@end{\egroup}%
\fi%
\code@start%
\noindent%
\begin{minipage}[t]{\codeexamplewidth}\raggedright
\hrule width0pt%
\footnotesize\vskip-1em%
\code@flushstart\box\codeexamplebox\code@flushend%
\vskip-1ex
\leavevmode%
\end{minipage}%
\else%
\def\code@mid{\par}
\def\code@width{\linewidth-6pt}
\def\code@end{}
\fi%
\code@mid%
\colorbox{codebackground}{%
\begin{minipage}[t]{\code@width}%
{%
\let\do\@makeother
\dospecials
\frenchspacing\@vobeyspaces
\normalfont\ttfamily\footnotesize
\typesetcomment%
\codeexample@tabinit@replacementchars
\@tempswafalse
\def\par{%
\if@tempswa
\leavevmode \null \@@par\penalty\interlinepenalty
\else
\@tempswatrue
\ifhmode\@@par\penalty\interlinepenalty\fi
\fi}%
\obeylines
\everypar \expandafter{\the\everypar \unpenalty}%
\pgfkeysvalueof{/codeexample/typeset listing/.@cmd}{#1}\pgfeov
}
\end{minipage}}%
\code@end%
\par%
\medskip
\end{codeexample}
}
\def\endcodeexample{\endgroup}
\makeatother
\usepackage{pgfmanual}
\makeatletter
% \pgfautoxrefs will be defined by 'make dist'
\pgfutil@ifundefined{pgfautoxrefs}{%
\def\pgfmanualpdflabel#1#2{#2}% NO-OP
\def\pgfmanualpdfref#1#2{#2}%
\pgfkeys{
/pdflinks/codeexample links=false,% DISABLED.
}%
}{}
\makeatother
\makeatletter
\renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.8em}}
\renewcommand*\l@subsubsection{\@dottedtocline{3}{4.3em}{3.2em}}
\makeatother
% \includeonly{pgfmanual-en-library-profiler}
% Global styles:
\tikzset{
every plot/.style={prefix=plots/pgf-},
shape example/.style={
color=black!30,
draw,
fill=yellow!30,
line width=.5cm,
inner xsep=2.5cm,
inner ysep=0.5cm}
}
\usepackage{tikz-cd}
\usepackage{multicol,longtable}
\hypersetup{pdftitle={The tikz-cd package},
pdfauthor={Florêncio Neves},
pdfkeywords={commutative diagrams, latex, tikz, pgf},
colorlinks
}
\title{The \texttt{tikz-cd} package}
\author{\normalsize Florêncio Neves\footnote{\emph{E-mail:} \href{mailto:florencioneves@gmail.com}{\texttt{florencioneves@gmail.com}}}}
\date{\normalsize Version 0.2b, of March 18, 2012}
\tikzset{commutative diagrams/background color=graphicbackground}
\newcommand{\displayarrow}[2][]{\texttt{#2} & yelds \tikz[baseline=-2.5pt] \draw[#2-#2, line width=0.0929ex, #1] (0,0) -- (1,0);}
\newcommand{\displayarrowstyle}[2][]{\texttt{#2} #1 & yelds \tikz[baseline=-2.5pt] \draw[commutative diagrams/.cd, #2] (0,0) -- (0.6,0);}
\begin{document}
\maketitle
The general-purpose drawing package Ti\emph{k}Z can be used to typeset
commutative diagrams and other kinds of mathematical pictures,
generating high-quality results (see for example \cite{lenders} or
\cite{milne}). This package facilitates the creation of such diagrams
by providing a convenient set of macros and reasonable default
settings. Familiarity with Ti\emph{k}Z is helpful, but not necessary,
as the examples contained here cover the most often encountered
situations.
This package also includes an arrow tip library that match closely the
arrows present in the Computer Modern typeface.
\textsc{pgf} version 2.10 is required.
\tableofcontents
\section{Basic usage}
\label{sec:basic-usage}
Commutative diagrams are created with the |tikzcd| environment. Its
content describes a matrix, like the |\matrix| command in \tikzname{}
or the |align| environment in \LaTeX. Everything is typeset in math
mode, but you will probably want use \texttt{tikzcd} inside an
|equation| environment or inside |\[| \dots |\]|, so that the diagram is
placed on a new line and centered.
\subsection{Inserting arrows}
\label{sec:inserting-arrows}
Inside the |tikzcd| environment, the command |\arrow| is provided to
produce arrows. In its simplest form, it takes one argument, a string
containing the characters |r|, |l|, |u| or |d|, standing for right, left,
up and down, that determine the arrow target. A label can be
placed on an arrow by providing a second argument.
\begin{codeexample}[]
\begin{tikzcd}
A \arrow{rd} \arrow{r}{\phi} & B \\
& C
\end{tikzcd}
\end{codeexample}
You can control the appearance of the arrow by placing an argument
inside square braces before the direction parameter. It may contain
any option that can be passed to \tikzname{}'s
|\path| command. Similarly, a label can be modified by an argument in
square braces right before it. It may contain anything that can be
passed to \tikzname's |node| operator.
\begin{codeexample}[]
\begin{tikzcd}
A \arrow{r}{\psi} \arrow[color=red]{d}
& B \arrow{d}[color=red]{\psi} \\
C \arrow[color=red]{r}[color=blue]{\eta}
& D
\end{tikzcd}
\end{codeexample}
An arrow can actually have an arbitrary number of labels, each one
specified by juxtaposing |{|\meta{text}|}| or
|[|\meta{options}|]{|\meta{text}|}| to the |\arrow| command.
\begin{codeexample}[]
\begin{tikzcd}
A \arrow{r}[near start]{\phi}[swap]{\psi}[near end]{\eta} & B
\end{tikzcd}
\end{codeexample}
To save some typing, the command |\ar| is provided as a shorthand to
|\arrow|. There are also commands |\rar|, |\lar|, |\uar|, |\dar|,
|\urar|, |\ular|, |\drar| and |\dlar| that act like |\arrow{r}|,
|\arrow{l}|, \dots, |\arrow{ur}|, and so forth. They can take an optional
argument in square braces to modify the arrow, followed by label
specifiers of the form |{|\meta{text}|}| or
|[|\meta{options}|]{|\meta{text}|}|.
Thus, the diagram above can be rewritten as follows.
\begin{codeexample}[]
\begin{tikzcd}
A \rar{\psi} \dar[color=red]
& B \dar[][color=red]{\psi} \\
C \rar[color=red][color=blue]{\eta}
& D
\end{tikzcd}
\end{codeexample}
We provide one more example, reproduced from X\raisebox{-0.3ex}{Y}-pic
user's guide.
\begin{codeexample}[]
\begin{tikzcd}
T
\arrow[bend left]{drr}{x}
\arrow[bend right]{ddr}{y}
\arrow[dotted]{dr}[description]{(x,y)} & & \\
& X \times_Z Y \arrow{r}{p} \arrow{d}{q} & X \arrow{d}{f} \\
& Y \arrow{r}{g} & Z
\end{tikzcd}
\end{codeexample}
\subsection{Changing arrow tips}
\label{sec:changing-arrow-tips}
For each arrow-producing command present in \AmS-\LaTeX, there is a
corresponding option (without a ``|\|'') that can be passed to
|\arrow| to produce that kind of arrow. Notice the use of
|hookrightarrow| and |dashrightarrow| in the example below.
\begin{codeexample}[]
\begin{tikzcd}
X \arrow[hookrightarrow]{r} \arrow[dashrightarrow]{rd}
& \bar{X} \arrow{d}\\
& Y
\end{tikzcd}
\end{codeexample}
Of course, a similar effect could be achieved by directly using
\tikzname's arrow tip selection scheme (e.g., using the option
|right hook->|). However, the method more above is more appropriate, as it
abstracts the choice of an actual arrow tip design (see also the key
\texttt{commutative diagrams/arrow style} below), and is probably also
better from the mnemonic standpoint.
The following list shows all arrow styles available.
{\tikzset{commutative diagrams/.cd, background color=white}
\begin{quote}
\begin{tabular}{ll}
\displayarrowstyle{rightarrow}\\
\displayarrowstyle{Rightarrow}\\
\displayarrowstyle{leftarrow}\\
\displayarrowstyle{Leftarrow}\\
\displayarrowstyle{leftrightarrow}\\
\displayarrowstyle{Leftrightarrow}\\
\displayarrowstyle{equals}\\
\displayarrowstyle[(or \texttt{maps to})]{mapsto}\\
\displayarrowstyle[(or \texttt{hook})]{hookrightarrow}\\
\displayarrowstyle{hookleftarrow}\\
\displayarrowstyle{rightharpoonup}\\
\displayarrowstyle{rightharpoondown}\\
\displayarrowstyle{leftharpoonup}\\
\displayarrowstyle{leftharpoondown}\\
\displayarrowstyle[(or \texttt{dashed})]{dashrightarrow}\\
\displayarrowstyle{dashleftarrow}\\
\displayarrowstyle[(or \texttt{tail})]{rightarrowtail}\\
\displayarrowstyle{leftarrowtail}\\
\displayarrowstyle[(or \texttt{two heads})]{twoheadrightarrow}\\
\displayarrowstyle{twoheadleftarrow}\\
\displayarrowstyle[(or \texttt{squiggly})]{rightsquigarrow}\\
\displayarrowstyle{leftsquigarrow}\\
\displayarrowstyle{leftrightsquigarrow}
\end{tabular}
\end{quote}
}
Some of the styles above have two names. In these cases, the second
one behaves a little differently from the first, in that it can be
superimposed with other arrow styles.
\begin{codeexample}[]
\begin{tikzcd}
A \arrow[tail, two heads, dashed]{r} & B
\end{tikzcd}
\end{codeexample}
\section{Controlling the appearance of diagrams}
\label{sec:chang-appe-diagr}
This section lists all customization keys defined by this package.
Options can be made take effect in different scopes:
\begin{enumerate}
\item Globally, using the command |\tikzset|. This can be done in the
document preamble, or in the body, to affect all diagrams
appearing thereafter.
\item For the current diagram, by placing options in the optional
argument to the |tikzcd| environment. Such options are applied to
the |tikzpicture| environment generated by |tikzcd| (cf.\ \S\ref{sec:intern-arrow-comm}). Thus you can,
for instance, use the |execute at end picuture| option in this
situation to have arbitrary \tikzname{} code executed after a
diagram is drawn.
\item For the current arrow or label, by placing options in one of the
optional arguments of |\arrow|.
\end{enumerate}
Of course, not all options make sense in all contexts. For example,
setting |row sep=1cm| globally with |\tikzset| will have no effect on
diagrams, since the |row sep| option is re-set at the beginning of
each diagram. To make all diagrams have |row sep| set to 1\,cm, you
can use
\begin{quote}
|\tikzset{commutative diagrams/row sep/normal=1cm}|,
\end{quote}
as detailed below.
All keys provided by this package are located in the path
|/tikz/commutative diagrams|. Methods 2 and 3 above will search
in this path by default. If a key is not found there, an attempt is
made to find it in |/tikz|. When
using method 1, it is convenient to change the default search path by using
\begin{quote}
|\tikzset{commutative diagrams/.cd, |\meta{options}|}|.
\end{quote}
\subsection{General options}
\label{sec:general-options}
\begin{stylekey}{/tikz/commutative diagrams/every diagram}
This style is applied to every |tikzcd| environment. Initially, it
contains the following:
\begin{quote}\ttfamily{}
/tikz/commutative diagrams/.cd,\\
|/tikz/cells={nodes={shape={asymmetrical rectangle}}}|,\\
row sep=normal,\\
column sep=normal,\\
/tikz/baseline=0pt
\end{quote}
\end{stylekey}
The |baseline=0pt| setting is used to make equation numbers be placed
correctly. The \texttt{asymmetrical rectangle} shape, used in the
matrix nodes, is described in \S\ref{sec:asymm-rect-shape}.
\begin{key}{/tikz/commutative diagrams/diagrams=\meta{options}}
This key appends \meta{options} to the style
|/tikz/commutative diagrams/every diagram|.
\end{key}
\begin{key}{/tikz/commutative diagrams/row sep=\meta{size} (initially normal)}
This key acts as a ``frontend'' to \tikzname's |/tikz/row sep| key. If
the key
\begin{quote}
|/tikz/commutative diagrams/row sep/|\meta{size}
\end{quote}
stores a
\meta{value}, then it is read and |/tikz/row sep|=\meta{value} is
set. If the key above is not initialized, then \meta{size} is
presumably a dimension, and |/tikz/row sep|=\meta{size} is set.
The values of \meta{size} initially available, and their values, are
the following:
\begin{center}
\begin{tabular}{cccccc}
|tiny| & |small| & |scriptsize| & |normal| & |large| & |huge| \\
1.25\,ex & 2.5\,ex & 3.75\,ex & 5\,ex & 7.5\,ex & 10\,ex
\end{tabular}
\end{center}
\end{key}
To change, say, the |normal| size (which is applied by default) to 1\,cm, you
can use the code
\begin{quote}
|\tikzset{commutative diagrams/row sep/normal=1cm}|.
\end{quote}
You can also create new sizes, but |pgfkeys| requires new keys to be
explicitly initialized. For example, to create a size |my size|, meaning
1\,cm, you should use
\begin{quote}
|\tikzset{commutative diagrams/row sep/my size/.initial=1cm}|.
\end{quote}
\begin{key}{/tikz/commutative diagrams/column sep=\meta{size} (initially normal)}
This works analogously to the |row sep| key above. The sizes available
initially are the following:
\begin{center}
\begin{tabular}{cccccc}
|tiny| & |small| & |scriptsize| & |normal| & |large| & |huge| \\
1.5\,ex & 3\,ex & 4.5\,ex & 6\,ex & 9\,ex & 12\,ex
\end{tabular}
\end{center}
\end{key}
In the examples below, the triangular diagrams would look too wide or
too tall if the column or row separation were not set appropriately.
\begin{codeexample}[]
\begin{tikzcd}[column sep=small]
& A \arrow{dl}\arrow{dr} & \\
B \arrow{rr} & & C
\end{tikzcd}
\end{codeexample}
\begin{codeexample}[]
\begin{tikzcd}[row sep=tiny]
& B \arrow{dd} \\
A \arrow{ur}\arrow{dr} & \\
& C
\end{tikzcd}
\end{codeexample}
\begin{key}{/tikz/commutative diagrams/math mode=\meta{boolean}
(initially true)}
This keys determines whether the contents of a diagram is typeset in
math mode or not. If set globally or diagram-wise, it affects both
the diagram entries and arrow labels. If used with |\arrow|, it affect
only its labels.
\end{key}
\begin{key}{/tikz/commutative diagrams/background color=\meta{color} (initially white)}
This key stores the name of a color, and is read by
styles that fill the background, such as |description| and |crossing over|.
It does not cause the background of diagrams to be filled.
\end{key}
\subsection{Options for arrows}
\label{sec:options-arrows}
Besides the options and styles provided by this package, there are
several options defined by \tikzname{} that are useful for arrows, such
as |dashed|, |dotted| and its relatives, |line width=|\meta{dimension}, |color=|\meta{color},
|bend right|, |bend left|, |in=|\meta{angle}, |out=|\meta{angle},
|loop|, etc. See the \pgfname{} manual~\cite{pgfman}.
\begin{stylekey}{/tikz/commutative diagrams/every arrow}
This style is applied to every |\arrow|. Initially, it contains the
following:
\begin{quote}\ttfamily{}
/tikz/commutative diagrams/.cd,\\
/tikz/draw,\\
/tikz/commutative diagrams/default arrow
\end{quote}
\end{stylekey}
The style |default arrow| is similar to |rightarrow|, but performs some
additional initialization, such as setting the line width.
\begin{key}{/tikz/commutative diagrams/arrows=\meta{options}}
This key appends \meta{options} to the style
|/tikz/commutative diagrams/every arrow|.
\end{key}
\begin{key}{/tikz/commutative diagrams/arrow style=\meta{style} (initially computer
modern)}
Setting this key causes the several arrow-tip-specifying styles
listed in \S\ref{sec:changing-arrow-tips} to be (re)defined. In
particular, it makes the style
|/tikz/commutative diagrams/default arrow|,
which is automatically applied to every arrow, to be defined.
Currently, \meta{style} can be one of |computer modern| or |tikz|. The |tikz| style uses the arrow tips defined in \tikzname's |arrows|
library, and it honors the option |/tikz/>|.
The |computer modern| style sets the parameter |/tikz/line width| in
accordance to the current font size. The |tikz| arrow style,
however, does not change it, allowing you to directly control the
thickness of arrows.
\end{key}
If you are using a font different from Computer Modern, you may find
better results by selecting the |tikz| arrow style, setting |/tikz/>| to
the value that best matches your font, and adjusting |/tikz/line width|
if necessary. The following example, if not particularly elegant,
should be instructive.
\begin{codeexample}[]
\tikzset{
commutative diagrams/.cd,
arrow style=tikz,
diagrams={>=open triangle 45, line width=1pt}}
\begin{tikzcd}
A \arrow{r} \arrow{d} & B \arrow{d}\\
C \arrow{r} & D
\end{tikzcd}
\end{codeexample}
\begin{key}{/tikz/commutative diagrams/start anchor=\meta{anchor}
(default \normalfont empty)}
This style specifies at which anchor of the current node an arrow
should start. The default behavior is not to specify an anchor,
causing the arrow to start at the point in the boundary of the
current node closest to the destination, as explained in
\pgfname{} manual~\cite{pgfman}.
\end{key}
\begin{key}{/tikz/commutative diagrams/end anchor=\meta{anchor}
(default \normalfont empty)}
This style works analogously, but refers to the target node of the arrow.
\end{key}
See the picture on \S\ref{sec:asymm-rect-shape} for some of the
possible values for \meta{anchor}. The picture below illustrates the
use of \texttt{end anchor} and \texttt{start anchor}.
\begin{codeexample}[]
\begin{tikzcd}
A \rar[start anchor=north east, end anchor=north west]{\psi}
\rar[start anchor=south east, end anchor=south west, swap]{\phi}
& B
\end{tikzcd}
\end{codeexample}
\begin{stylekey}{/tikz/commutative diagrams/crossing over}
This style makes a thicker line, with color
|/tikz/commutative diagrams/background color|, to be drawn under the
current arrow, simulating the effect of its passing over other
arrows.
\begin{codeexample}[]
\begin{tikzcd}
A \arrow{dr} & B \arrow[crossing over]{dl} \\
C & D
\end{tikzcd}
\end{codeexample}
\end{stylekey}
Note that, since arrows are drawn in the order they are read, some
arrows may need to run ``backwards'' to achieve the desired result.
The following picture, from \cite{lenders}, illustrates this.
\begin{codeexample}[]
\begin{tikzcd}[row sep=scriptsize, column sep=scriptsize]
& f^* E_V \arrow{dl}\arrow{rr}\arrow{dd} & & E_V \arrow{dl}\arrow{dd} \\
f^* E \arrow[crossing over]{rr}\arrow{dd} & & E \\
& U \arrow{dl}\arrow{rr} & & V \arrow{dl} \\
M \arrow{rr} & & N\arrow[crossing over, leftarrow]{uu} \\
\end{tikzcd}
\end{codeexample}
\begin{key}{/tikz/commutative diagram/crossing over clearance=\meta{dimension}
(initially 6pt)}
This key specifies the width of the background-colored line drawn
under a |crossing over| arrow.
\end{key}
\subsection{Options for labels}
\label{sec:options-labels}
Besides the options provided by this package and listed below, there
are many options provided by \tikzname{} that are useful for
labels, such as |above|, |below|, |left|,
|right|, |swap| (which makes the label be placed in the opposite side
to the default), |sloped|, |pos=|\meta{fraction}, |near start|,
|near end|, |inner sep=|\meta{dimension}, |font=|\meta{font
command}, |text width=|\meta{dimension}, etc. See \pgfname{} manual~\cite{pgfman}.
\begin{stylekey}{/tikz/commutative diagrams/every label}
This style works as if it were applied to the optional argument
corresponding to each label attached to an arrow. Initially is set
to the following:
\begin{quote}\ttfamily{}
/tikz/commutative diagrams/.cd,\\
/tikz/auto,\\
/tikz/font=|\scriptsize|,\\
/tikz/inner sep=0.5ex
\end{quote}
\end{stylekey}
The style |auto| makes the label be placed to the left of the
arrow, understanding ``front'' as the direction the arrow points at.
The dimension |inner sep| controls the distance between the
arrow and the label.
\begin{key}{/tikz/commutative diagrams/labels=\meta{options}}
This key appends \meta{options} to the style
\texttt{/tikz/commutative diagrams/every label}.
\end{key}
\begin{stylekey}{/tikz/commutative diagrams/description}
This style causes the label to be placed on the arrow, with the
background filled.
\begin{codeexample}[]
\begin{tikzcd}
A \arrow{r}[description]{\phi} & B
\end{tikzcd}
\end{codeexample}
\end{stylekey}
\begin{key}{/tikz/commutative diagrams/description
clearance=\meta{dimension} (initially 1.5pt)}
This key determines the size of the border around a label when the
|description| style above is applied. Its value is used to set the
key |/tikz/inner sep|.
\end{key}
\section{Further topics}
\label{sec:further}
This sections provides further details on the functioning of
this package, with the aim of showing how a more or less arbitrary use of
\tikzname{} features can be made inside it.
\subsection{Internals of \texttt{tikzcd} and the arrow commands}
\label{sec:intern-arrow-comm}
The |tikzcd| environment works by substituting code of the form
\begin{quote}
|\begin{tikzcd}[|\meta{options}|]|
\meta{contents}
|\end{tikzcd}|
\end{quote}
with roughly the following:
\begin{quote}
|\begin{tikzpicture}[commutative diagrams/every diagram,|
\meta{options}|]|\\
| \matrix[matrix of |[|math|]| nodes] {|\\
| |\meta{contents} |\\|\\
| };|\\
| |\meta{paths}\\
|\end{tikzpicture}|
\end{quote}
Note that the next-row command |\\| for the last row is inserted by
|tikzcd|, and therefore does not need to be present in
\meta{contents}. The |\matrix| is supplied the option \texttt{matrix
of nodes} or \texttt{matrix of math nodes} as specified by the
option \texttt{commutative diagrams/math mode}. Also, not shown above
are a number of initialization procedures, such as defining the
commands |\arrow|, |\ar|, |\rar|, |\lar|, |\dar|, |\uar|, |\urar|,
|\ular|, |\drar|, |\dlar|.
Initially, \meta{paths} is empty. The command
|\arrow[|\meta{options}|]{|\meta{direction}|}| does nothing at the
point it is inserted, and causes the following code to be added to
\meta{paths}:
\begin{quote}
|\path[commutative diagrams/every arrow, |\meta{options}|] (|%
\meta{current node}|) to |\meta{labels}| (|\meta{target~node}|);|
\end{quote}
Here, \meta{current node} is the node corresponding to the matrix cell
where the command |\arrow| is present, and \meta{target node} is determined by
\meta{direction} as explained in \S\ref{sec:inserting-arrows}. The
abbreviated commands |\rar|, |\dar|, etc., generate the same kind of
code.
Initially, \meta{labels} is the empty string. A label specifier of
the form |{|\meta{label text}|}| or |[|\meta{label
options}|]{|\meta{label text}|}| immediately following the
\meta{direction} argument or a previous label specifier causes the
string
\begin{quote}
|node [commutative diagrams/every label, |\meta{label options}|] {|[|$|]\meta{label text}[|$|]|}|
\end{quote}
to be appended to \meta{labels}. Dollars signs surround \meta{label
text} depending on the setting \texttt{commutative diagrams/math
mode}. For the abbreviated form |\rar| (and similarly for |\dar|,
|\lar|, etc.), the following are valid usages:
\begin{quote}
|\rar{|\meta{label text}|}|\meta{more labels},\\
|\rar[|\meta{options}|]{|\meta{label text}|}|\meta{more labels}, or\\
|\rar[|\meta{options}|][|\meta{label options}|]{|\meta{label
text}|}|\meta{more labels}.
\end{quote}
Their effects are entirely analogous.
\subsection{Tweaking \texttt{to} paths}
\label{sec:tweaking-to-paths}
Recall that the |to| path operation used in the paths created by
|\arrow| can take a number of options, as described in \S{}14.14
and \S{}51 of the \pgfname{} manual~\cite{pgfman}. In particular, the
option |/tikz/to path| determines the path that is actually drawn, and
can be used to do all sorts of tweaking.
\begin{codeexample}[]
\begin{tikzcd}
A \arrow[dashed, to path=|- (\tikztotarget)]{dr}
\arrow[to path={..controls +(1.5,0.5) and +(-1,0.8).. (\tikztotarget)}]{dr}
& \\
& B \arrow[loop right]{}
\end{tikzcd}
\end{codeexample}
In the next example, empty labels are used to create nodes for later
reference, and in the third |\arrow| command the |to path| key is used
in a way that, in the terminology of the previous section,
\meta{current node} and \meta{target node} are completely ignored.
\begin{codeexample}[]
\begin{tikzcd}
A \arrow[bend left=50]{r}[name=U,below]{}
\arrow[bend right=50]{r}[name=D]{} &
B \arrow[Rightarrow,to path=(U) -- (D)]{}
\end{tikzcd}
\end{codeexample}
\subsection{The \texttt{asymmetrical rectangle} shape}
\label{sec:asymm-rect-shape}
The shape \texttt{asymmetrical rectangle}, defined by this package, is
very similar to the \texttt{rectangle} shape, except that its
\texttt{center} anchor is not located at the geometric center of the
shape, but rather right above the \texttt{base} anchor, at a distance
that can be specified by the following key:
\begin{key}{/tikz/commutative diagrams/center shift=\meta{dimension} (initially 0.575ex)}
\end{key}
The picture below shows some of the available anchors. All anchors
provided by \texttt{rectangle} are available and behave exactly the
same, except for \texttt{center}, \texttt{west}, \texttt{east}, and
the numerical anchors. The anchors \texttt{real center}, \texttt{real
west} and \texttt{real east} agree with \texttt{rectangle}'s
\texttt{center}, \texttt{west} and \texttt{east}.
\begin{center}
\begin{tikzpicture}\Huge
\node[name=s,shape=asymmetrical rectangle,shape example]
{Asymmetrical rectangle\vrule width 1pt height 2cm}; \foreach
\anchor/\placement in {north west/above left, north/above, north
east/above right, west/left, center/above, east/right, real
west/left, real center/above, real east/right, base west/left,
base/below, base east/right, south west/below left, south/below,
south east/below right, text/left, 10/right, 130/above,
230/below, -10/below} \draw[shift=(s.\anchor)] plot[mark=x]
coordinates{(0,0)} node[\placement] {\scriptsize\texttt{\anchor}};
\end{tikzpicture}
\end{center}
This shape is used in the matrix cells inside the \texttt{tikzcd}
environment to ensure arrows between nodes in the same row are drawn
horizontally. Roughly speaking, when \tikzname{} draws a path between
two nodes, it chooses endpoints lying on their borders in such a way
that the path points towards the \texttt{center} of those nodes. With
the \texttt{rectangle} shape, the anchor \texttt{center} lies halfway
between two nonadjacent vertices and therefore its position depends on
the height and depth of the text.
\subsection{Drawing diagrams directly with Ti\emph{k}Z}
\label{sec:draw-diagr-directly}
If the tools provided by this package prove not flexible enough for
some application, you can use the methods described in \cite{lenders}
and \cite{milne} to draw diagrams directly with \tikzname. In this
case, you can still use the styles provided here in order to achieve
uniformity with diagrams drawn with |tikzcd|. The pictures below show
how this can be done (the second one is adapted from \cite{milne}).
\begin{codeexample}[]
\begin{tikzpicture}[commutative diagrams/every diagram]
\matrix[matrix of math nodes, name=m] {
X & \bar X \\
& Y \\};
\path[commutative diagrams/.cd, every arrow, every label]
(m-1-1) edge[commutative diagrams/hook] (m-1-2)
edge[commutative diagrams/dashed] (m-2-2)
(m-1-2) edge (m-2-2);
\end{tikzpicture}
\end{codeexample}
\begin{codeexample}[]
\begin{tikzpicture}[commutative diagrams/every diagram]
\node (P0) at (90:2.8cm) {$X\otimes (Y\otimes (Z\otimes T))$};
\node (P1) at (90+72:2.5cm) {$X\otimes ((Y\otimes Z)\otimes T))$} ;
\node (P2) at (90+2*72:2.5cm) {\makebox[5ex][r]{$(X\otimes (Y\otimes Z))\otimes T$}};
\node (P3) at (90+3*72:2.5cm) {\makebox[5ex][l]{$((X\otimes Y)\otimes Z)\otimes T$}};
\node (P4) at (90+4*72:2.5cm) {$(X\otimes Y)\otimes (Z\otimes T)$};
\path[commutative diagrams/.cd, every arrow, every label]
(P0) edge node[swap] {$1\otimes\phi$} (P1)
(P1) edge node[swap] {$\phi$} (P2)
(P2) edge node {$\phi\otimes 1$} (P3)
(P4) edge node {$\phi$} (P3)
(P0) edge node {$\phi$} (P4);
\end{tikzpicture}
\end{codeexample}
\section{Computer Modern arrow tips}
\label{sec:comp-modern-arrow}
The naming scheme of the Computer Modern-like arrow tips provided by
this package parallels that of \pgfname's |arrows| library, documented
in \S{}23 of \pgfname{} manual~\cite{pgfman}. To match the Computer Modern
typeface at size 10\,pt, line width should be set to 0.4\,pt; for
larger font sizes, scale this parameter accordingly, or use the esoteric
figure 0.0929\,ex.
Notice that by using the mechanism explained in
\S\ref{sec:changing-arrow-tips}, it is not necessary, and in fact not
advisable, to directly use the arrow tips listed in this section
when creating diagrams with |tikzcd|.
Incidentally, \tikzname's original |to| arrow tip seems to be based on
the pre-1992 version of Computer Modern which, in spite of the
author's wish \cite{knuth}, can still be found in many systems.
\TeX{}Live, for instance, distributed the old version up until 2007 or
2008. Therefore, an up-to-date \TeX{} distribution may be necessary
to get matching arrows in formulas and diagrams.
\begin{description}
\item[Basic arrow tips]\ \\
\begin{tabular}{ll}
\displayarrow{cm to}\\
\displayarrow{cm to reversed}\\
\displayarrow[line width=0.66pt]{cm bold to} (with a line 50\% thicker)\\
\texttt{cm \char`\|} & yelds \tikz[baseline=-2.5pt] \draw[cm |-cm |, line width=0.0929ex] (0,0) -- (1,0);\\
\displayarrow{cm o}\\
\displayarrow{cm *}\\
\displayarrow{cm cap}\\
\end{tabular}
\item[Arrow tips for double lines]\ \\
\begin{tabular}{ll}
\displayarrow[/tikz/double distance=3.643\pgflinewidth]{cm implies}\\
\displayarrow[/tikz/double distance=3.643\pgflinewidth]{cm implies cap}
\end{tabular}
\item[Hooks]\ \\
\begin{tabular}{ll}
\displayarrow{cm left hook}\\
\displayarrow{cm right hook}\\
\end{tabular}
\item[Double arrow tips]\ \\
\begin{tabular}{ll}
\displayarrow{cm double to}\\
\displayarrow{cm double to reversed}\\
\end{tabular}
\item[Partial arrow tips]\ \\
\begin{tabular}{ll}
\displayarrow{cm left to}\\
\displayarrow{cm left to reversed}\\
\displayarrow{cm right to}\\
\displayarrow{cm right to reversed}\\
\end{tabular}
\end{description}
% \section{Some examples}
% \label{sec:some-examples}
% \begin{codeexample}[]
% \begin{tikzcd}[row sep=small]
% H^i(A) \rar & H^i(B) \rar & H^i(C) \arrow[out=0, in=180]{dll}\\
% H^{i+1}(A) \rar & H^{i+1}(B) \rar & H^{i+1}(C)
% \end{tikzcd}
% \end{codeexample}
\section{Change history}
\label{sec:change-history}
\begin{description}
\item[Version 0.2b] (March 2012) Added \texttt{asymetrical rectangle} shape.
\item[Version 0.2a] (December 2011)
\begin{itemize}
\item Option |/tikz/commutative diagrams/path operation| removed
in favor of direct use of |/tikz/to path|.
\item Double lines with |tikz| arrow style now use \texttt{double
equal sign distance}.
\end{itemize}
\item[Version 0.2] (October 2011) Several changes.
\item[Version 0.1] (September 2011) Preliminary release.
\end{description}
\begin{thebibliography}{9}
\bibitem{knuth}
Donald Knuth,
\emph{Important message to all users of \TeX}.
Available at \url{http://www-cs-staff.stanford.edu/~uno/cm.html}
\bibitem{lenders}
Felix Lenders,
\emph{Commutative diagrams using TikZ}.
Available at \url{http://www.felixl.de/commu.pdf}.
\bibitem{milne}
James Milne,
\emph{Guide to commutative diagrams}.
Available at \url{http://www.jmilne.org/not/CDGuide.html}.
\bibitem{pgfman}
Till Tantau,
\emph{The \tikzname{} and \pgfname{} packages: Manual for version 2.10}.
Available at \url{http://sourceforge.net/projects/pgf}.
\end{thebibliography}
\end{document}
%%% Local Variables:
%%% mode: tex
%%% mode: auto-fill
%%% End:
|