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
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
|
% \iffalse meta-comment
%
% Copyright (C) 2014-2018 by Dominik Siegel
%
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.2 of this license or (at your option) any later
% version. The latest version of this license is in:
%
% http://www.latex-project.org/lppl.txt
%
% and version 1.2 or later is part of all distributions of
% LaTeX version 1999/12/01 or later.
%%
%% To produce the documentation, do the following
%%
%% latex chemschemex.dtx
%
% <package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
% <package>\ProvidesPackage{chemschemex}
% <package>[2018/01/20 v1.2]
%
%<*driver>
\documentclass{ltxdoc}
\usepackage{chemschemex}
\usepackage{caption}
\usepackage{float}
\newfloat{example}{htbp}{los}%
\floatname{example}{Example}%
\captionsetup{font={footnotesize},textfont={sf},labelfont={sf,bf}}
\usepackage{sectsty}
\usepackage[hidelinks]{hyperref}
\usepackage{fancyvrb}
\allsectionsfont{\sffamily}
\GetFileInfo{chemschemex.dtx}
\EnableCrossrefs
\CodelineIndex
\OnlyDescription
\RecordChanges
\newstruct[{R=H},{R=Me},{R=Ph}]{maleimid}{maleimid}{Maleimid}{}
\newstruct{cp}{cyclopentadiene}{Cyclopentadiene}{cp}
\newstruct[{R=H},{R=Me},{R=Ph}]{product}{}{}{}
\date{2018/01/20}
\begin{document}
\DocInput{chemschemex.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{0}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
% Digits \0\1\2\3\4\5\6\7\8\9
% Exclamation \! Double quote \" Hash (number) \#
% Dollar \$ Percent \% Ampersand \&
% Acute accent \' Left paren \( Right paren \)
% Asterisk \* Plus \+ Comma \,
% Minus \- Point \. Solidus \/
% Colon \: Semicolon \; Less than \<
% Equals \= Greater than \> Question mark \?
% Commercial at \@ Left bracket \[ Backslash \\
% Right bracket \] Circumflex \^ Underscore \_
% Grave accent \` Left brace \{ Vertical bar \|
% Right brace \} Tilde \~}
%
% \changes{v1.0}{2014/07/15}{Initial version}
% \changes{v1.1}{2017/04/02}{Bug within the \textbackslash Struct command fixed}
% \changes{v1.1.1}{2017/04/03}{No code changes, documentation attached}
% \changes{v1.2}{2018/01/20}{Dependency on etextools (causes some compatibility issues) removed}
%
% \GetFileInfo{chemschemex.sty}
%
%
% \title{The \CSX{} package\thanks{This document corresponds to \CSX{}~\fileversion{}, dated \filedate.}}
%
% \author{Dominik Siegel \\ \texttt{dominik.siegel@yahoo.de}}
% \newcommand{\CSX}{\textsf{chemschemex}}
% \newcommand{\FL}{\textsf{fancylabel}}
% \newcommand{\TikZ}{\textsf{Ti\emph{k}Z}}
%
% \maketitle
%
% \begin{abstract}
% The \CSX{} package provides a comfortable method for the typesetting of (chemical) schemes based on \TikZ{} code, including an automatical structure referencing.
% \end{abstract}
%
% \begin{example}
% \begin{minipage}[c]{0.49\linewidth}
% \begin{Chemscheme}
% \struct{maleimid}
% \RightArrow{\struct{cp}}{DEE}
% \struct[80\,\%]{product}
% \end{Chemscheme}
% \end{minipage}
% \begin{minipage}[c]{0.5\linewidth}
%\begin{verbatim}
%\begin{Chemscheme}
% \struct{maleimid}
% \RightArrow{\struct{cp}}{DEE}
% \struct[80\,\%]{product}
%\end{Chemscheme}
%\end{verbatim}
% \end{minipage}
% \caption{Chemical scheme (left) produced by a simple code (right).}\label{fig.intro.1}
% \end{example}
%
% \tableofcontents
%
% \section{Introduction and motivation}
% While \LaTeX{} is a powerful tool for mathematical or physical issues the typesetting of chemistry derived problems is still a little bit annoying. When I wrote my thesis in organic chemistry I missed a package which produces chemical schemes as easy as you include a graphic into your document. I simply wanted to draw my structures in \textsc{ChemDraw}, inlcude them into my document and label them.
%
% The packages \textsf{chemscheme} and \textsf{chemnum} offer a possibility to rerender image files for this purpose. Nevertheless, they only modify a scheme that already exists. This means, that arrows, margins, alignments and other parameters cannot be defined or changed globally in your document.
%
% By using the \TikZ{} and the \FL{} package (which has actually been written as slave of this package) the \CSX{} package meets all these requirements (see example \ref{fig.intro.1}).
%
%
%
% \section{Usage}
% \noindent\DescribeMacro{\usepackage}
% |\usepackage[<options>]{chemschemex}|\vspace{0.5em}
%
% \noindent The command above will load the \CSX{} package. It requires the packages \textsf{xkeyval}, \textsf{etextools}, \textsf{xargs}, \textsf{ifthen}, \textsf{suffix}, \TikZ{}, \textsf{graphicx}, and \FL{}. I strongly recommend to read the documentation of the \FL{} package because all referencing functions are provided by this package. It contains a lot of useful options that are not described in this documentation.
%
%
% \newpage
% \section{User commands}
%
% \subsection{Basic commands}
% \noindent\DescribeMacro{\customstruct}
% |\customstruct[<TikZ-capt>][<TikZ-obj>]{<capt>}{<obj>}|\vspace{0.5em}
%
% \noindent The |\customstruct| command typesets the object \textcolor{red}{|<obj>|} in the first row of a \TikZ{} matrix and the caption \textcolor{blue}{|<capt>|} in the second row. The caption is supposed to be given as comma-separated list of label(s) and text. The two optional arguments |<TikZ-capt>| and |<TikZ-obj>| can be used to pass options to \TikZ{} elements (for further information see section \ref{custom}). All the following structure commands are based on |\customstruct|.
%
% \begin{minipage}{0.27\linewidth}
% \begin{Chemscheme}
% \customstruct[nodes={draw=blue}]
% [draw=red]
% {{{label1:},{text}},{{ll2:},{a longer text}}}
% {object e.g. image}
% \end{Chemscheme}
% \end{minipage}
% \begin{minipage}{0.6\linewidth}
% \begin{verbatim}
% \customstruct[nodes={draw=blue}][draw=red]
% {{{label1:},{text}},
% {{ll2:},{a longer text}}}
% {object e.g. image}
% \end{verbatim}
% \end{minipage}
%
%
% \vspace{3ex}\noindent\DescribeMacro{\CSXimage}
% |\CSXimage[<img-opt>]{<img>}|\vspace{0.5em}
%
% \noindent The |\CSXimage| command includes the image |<img>| using the global options |<global-img-opt>| defined by the |image| option (see section \ref{image}) and the options given by |<img-opt>|. This command is used in all the following structure commands and expands to |\includegraphics[<global-img-opt>,<img-opt>]{<img>}|.
%
%
%
% \subsection{Structure commands}
% \vspace{3ex}\noindent\DescribeMacro{\struct}
% |\struct[<capt>][<fam>][<img-opt>][<TikZ-capt>][<TikZ-obj>]{<img>}|\vspace{0.5em}
%
% \noindent The |\struct| command inlcudes the image |<img>|, sets a fancylabel (therefore it uses |<img>| as marker and |<fam>| as family, default: |<fam>|=|CSX|; the use of families is described in the \FL{} package) and prints it. If a |<caption>| is given, it will also print the caption behind the label. The macro |\CSXlabelsep| can be changed with the |labelseparator| option.
%
% \begin{minipage}{0.2\linewidth}
% \struct[text]{maleimid}
% \end{minipage}
% \begin{minipage}{0.79\linewidth}
% \begin{verbatim}
% \struct[text]{maleimid}
% expands to:
% \customstruct{{{\fancylabel[CSX]{maleimid}\CSXlabelsep},{}}}
% {\CSXimage{maleimid}}
% \end{verbatim}
% \end{minipage}
%
%
% \newpage
% \vspace{3ex}\noindent\DescribeMacro{\structalt}
% |\structalt[<capt>][<fam>][<img-opt>][<TikZ-capt>][<TikZ-obj>]{<img>}{<alt-img>}|\vspace{0.5em}
%
% \noindent The |\structalt| command includes an image |<alt-img>| but the labeling corresponds to |<img>|.
%
% \begin{minipage}{0.2\linewidth}
% \structalt{product}{product_num}
% \end{minipage}
% \begin{minipage}{0.7\linewidth}
% \begin{verbatim}
% \structalt{product}{product_num}
% expands to:
% \customstruct{{{\fancylabel[CSX]{product}},{}}}
% {\CSXimage{product_num}}
% \end{verbatim}
% \end{minipage}
%
%
% \vspace{3ex}\noindent\DescribeMacro{\struct*}
% \noindent\DescribeMacro{\structalt*}
% |\struct*[<capt>][<fam>][<img-opt>][<TikZ-capt>][<TikZ-obj>]{<img>}|\\
% |\structalt*[<capt>][<fam>][<img-opt>][<TikZ-capt>][<TikZ-obj>]{<img>}{<alt-img>}|\vspace{0.5em}
%
% \noindent The |\struct*| and |\structalt*| commands do the same as the corresponding nonstarred versions but use |\fancylabel*| instead of |\fancylabel|. This means, that a label for this structure will be defined but not printed.
%
% \begin{minipage}{0.2\linewidth}
% \struct*{maleimid}
% \end{minipage}
% \begin{minipage}{0.7\linewidth}
% \begin{verbatim}
% \struct*{maleimid}
% expands to:
% \customstruct{{{\fancylabel*[CSX]{maleimid}},{}}}
% {\CSXimage{maleimid}}
% \end{verbatim}
% \end{minipage}
%
%
% \vspace{3ex}\noindent\DescribeMacro{\struct-}
% |\struct-[<capt>][<img-opt>][<TikZ-capt>][<TikZ-obj>]{<img>}|\vspace{0.5em}
%
% \noindent The |\struct-| command includes an image |<img>| without any labeling.
%
% \begin{minipage}{0.2\linewidth}
% \struct-[text]{maleimid}
% \end{minipage}
% \begin{minipage}{0.7\linewidth}
% \begin{verbatim}
% \struct-[text]{maleimid}
% expands to:
% \customstruct{{{},{text}}}
% {\CSXimage{maleimid}}
% \end{verbatim}
% \end{minipage}
%
%
%
%
% \vspace{3ex}\noindent\DescribeMacro{\newstruct}
% |\newstruct[<sublabels>]{<img>}{<structname>}{<Structname>}{<abbr>}|\vspace{0.5em}
%
% \noindent If you want to use substructures you have to define them in the preamble. The optional argument |<sublabels>| is a comma-separated list of subcaptions. Whenever you want to refer to them you just have to use their numbers. In this example the first entry (|R=H|) gets the number 1, the second entry (|R=Me|) gets the number 2 and so on. If you use a structure without substructures it is not necessary to use |\newstruct|. However, the |\newstruct| command defines the name (and Name) und abbreviation of the structure what allows you to use the commands |\structname|, |\Structname| and |\structabbr| for this structure.\vspace{2ex}
%
% \begin{minipage}{0.9\linewidth}
% \begin{verbatim}
%\newstruct[{R=H},{R=Me},{R=Ph}]{product}{}{}{}
% \end{verbatim}
% \end{minipage}
%
% \vspace{3ex}\noindent\textbf{Note:} All of the following structure commands assume that |\newstruct| has been used for the filename |<img>| before.
%
% \vspace{3ex}\noindent\DescribeMacro{\Struct}
% |\Struct[<fam>][<img-opt>][<TikZ-capt>][<TikZ-obj>]{<sublabels>}{<img>}|\vspace{0.5em}
%
% \noindent To use the |\Struct| command, the structure and its substructure have to be defined by the |\newstruct| command. It inlcudes the image |<img>|, sets the sublabels given in the comma-separated list of |<sublabels>| and prints each sublabel with the subcaption previously given to the |\newstruct| command (one line per sublabel).
%
% \begin{minipage}{0.2\linewidth}
% \Struct{1,2,3}{product}
% \end{minipage}
% \begin{minipage}{0.7\linewidth}
% \begin{verbatim}
% \Struct{1,2,3}{product}
% expands to:
% \customstruct{{{\fancysublabel[CSX]{product}{1}\CSXlabelsep},{R=H}},
% {{\fancysublabel[CSX]{product}{2}\CSXlabelsep},{R=Me}},
% {{\fancysublabel[CSX]{product}{3}\CSXlabelsep},{R=Ph}}}
% {\CSXimage{product}}
% \end{verbatim}
% \end{minipage}
%
% \vspace{3ex}\noindent\DescribeMacro{\Struct*}
% |\Struct*[<fam>][<img-opt>][<TikZ-capt>][<TikZ-obj>]{<sublabels>}{<img>}|\vspace{0.5em}
%
% \noindent To use the |\Struct*| command, the structure and its substructure have to be defined by the |\newstruct| command. It inlcudes the image |<filename>|, sets the sublabels given in the comma-separated list of |<sublabels>| and prints each sublabel without its subcaption previously given to the |\newstruct| command.
%
% \begin{minipage}{0.2\linewidth}
% \Struct*{1,3}{product}
% \end{minipage}
% \begin{minipage}{0.7\linewidth}
% \begin{verbatim}
% \Struct*{1,3}{product}
% expands to:
% \customstruct{{{\fancysublabel[CSX]{product}{1,3}},{}}}
% {\CSXimage{product}}
% \end{verbatim}
% \end{minipage}
%
%
% \vspace{3ex}\noindent\DescribeMacro{\Structalt}
% |\Structalt[<fam>][<img-opt>][<TikZ-capt>][<TikZ-obj>]{<sublabels>}{<img>}{<alt-img>}|\vspace{0.5em}
%
% \noindent Works like the |\Struct| command but includes the image |<alt-img>|. Labeling corresponds to |<img>|.
%
%
% \vspace{3ex}\noindent\DescribeMacro{\Structalt*}
% |\Structalt*[<fam>][<img-opt>][<TikZ-capt>][<TikZ-obj>]{<sublabels>}{<img>}{<alt-img>}|\vspace{0.5em}
%
% \noindent Works like the |\Struct*| command but includes the image |<alt-img>|. Labeling corresponds to |<img>|.
%
%
% \vspace{3ex}\noindent\DescribeMacro{\structname}
% |\structname{<img>}|\vspace{0.5em}
%
% \noindent Prints the name of the structure |<img>| that has been previously defined by the |\newstruct| command. This command is recommended for the chemical name without a leading capital letter (inside a sentence).
%
%
% \vspace{3ex}\noindent\DescribeMacro{\Structname}
% |\Structname{<img>}|\vspace{0.5em}
%
% \noindent Prints the name of the structure |<img>| that has been previously defined by the |\newstruct| command. This command is recommended for the chemical name with a leading capital letter (at the beginning of a sentence).
%
%
% \vspace{3ex}\noindent\DescribeMacro{\structabbr}
% |\structabbr{<img>}|\vspace{0.5em}
%
% \noindent Prints the abbreviation of the structure |<img>| that has been previously defined by the |\newstruct| command.
%
%
%
%
% \subsection{The Chemscheme environment}
%
% \noindent\DescribeEnv{Chemscheme}
% |\begin{Chemscheme}...structure code...\end{Chemscheme}|\vspace{0.5em}
%
% \noindent If a structure command appears outside a |Chemscheme| environment each command will typeset the image and caption in its own matrix. This causes no kind of adjustment.
%
% \begin{minipage}{0.3\linewidth}
% \struct{cp}
% \struct[long caption]{maleimid}
% \end{minipage}
% \begin{minipage}{0.59\linewidth}
% \begin{verbatim}
% \struct{cp}
% \struct[long caption]{maleimid}
% \end{verbatim}
% \end{minipage}
%
% \noindent But if structure commands appear inside a |Chemscheme| environment all images and captions are printed in one matrix. This causes adjustment of the image (by default center) and the caption row (by default top) according to the \TikZ{} style |CSXmatrix|.
%
%
% \begin{minipage}{0.3\linewidth}
% \begin{Chemscheme}
% \struct{cp}
% \struct[long caption]{maleimid}
% \end{Chemscheme}
% \end{minipage}
% \begin{minipage}{0.59\linewidth}
% \begin{verbatim}
% \begin{Chemscheme}
% \struct{cp}
% \struct[long caption]{maleimid}
% \end{Chemscheme}
% \end{verbatim}
% \end{minipage}
%
%
% \vspace{3ex}\noindent\DescribeMacro{\ChemschemeNextRow}
% |\ChemschemeNextRow[<row-sep>]|\vspace{0.5em}
%
% \noindent If you want to use the matrix adjustment over multiple lines you can produce a 'linebreak' using the |\ChemschemeNextRow| command. The optional argument |<row-sep>| allows you to define the space between the rows.
%
% \begin{minipage}[c]{0.49\linewidth}
% \begin{Chemscheme}
% \struct{maleimid}
% \RightArrow{\struct{cp}}{DEE}
% \struct[80\,\%]{product}
% \ChemschemeNextRow[10pt]
% \struct[80\,\%]{product}
% \LeftArrow{\struct{cp}}{DEE}
% \struct{maleimid}
% \end{Chemscheme}
% \end{minipage}
% \begin{minipage}[c]{0.5\linewidth}
%\begin{verbatim}
%\begin{Chemscheme}
% \struct{maleimid}
% \RightArrow{\struct{cp}}{DEE}
% \struct[80\,\%]{product}
% \ChemschemeNextRow[10pt]
% \struct[80\,\%]{product}
% \LeftArrow{\struct{cp}}{DEE}
% \struct{maleimid}
%\end{Chemscheme}
%\end{verbatim}
% \end{minipage}
%
% \begin{minipage}[c]{0.49\linewidth}
% \begin{Chemscheme}
% \struct{maleimid}
% \RightArrow{\struct{cp}}{DEE}
% \struct[80\,\%]{product}
% \end{Chemscheme}
% \begin{Chemscheme}
% \struct[80\,\%]{product}
% \LeftArrow{\struct{cp}}{DEE}
% \struct{maleimid}
% \end{Chemscheme}
% \end{minipage}
% \begin{minipage}[c]{0.5\linewidth}
%\begin{verbatim}
%\begin{Chemscheme}
% \struct{maleimid}
% \RightArrow{\struct{cp}}{DEE}
% \struct[80\,\%]{product}
%\end{Chemscheme}
%\begin{Chemscheme}
% \struct[80\,\%]{product}
% \LeftArrow{\struct{cp}}{DEE}
% \struct{maleimid}
%\end{Chemscheme}
%\end{verbatim}
% \end{minipage}
%
%
%
% \vspace{3ex}\noindent\DescribeMacro{\CSXcommands}
% |\CSXcommands{<TikZ-code>}|\vspace{0.5em}
%
% \noindent The |CSXcommands| macro allows you to draw any \TikZ{} element(s) after the typesetting of the structure matrix.
%
% \hspace{-30pt}\begin{minipage}[c]{0.39\linewidth}
% \begin{Chemscheme}
% \struct{maleimid}
% \RightArrow{\struct{cp}}{DEE}
% \Struct{1,2}{product}
% \CSXcommands{\draw[->,CSXallarrows,draw=red]
% (Scheme\theCSXscheme Caption3Entry1.west) to
% ([xshift=-8pt]Scheme\theCSXscheme Caption3Entry1.west) to
% node[auto,swap,CSXlabelfont,red]{a}
% ([xshift=-8pt]Scheme\theCSXscheme Caption3Entry2.west) to
% (Scheme\theCSXscheme Caption3Entry2.west);}
% \end{Chemscheme}
% \end{minipage}
% \begin{minipage}[c]{0.6\linewidth}
%\begin{verbatim}
%\begin{Chemscheme}
% \struct{maleimid}
% \RightArrow{\struct{cp}}{DEE}
% \Struct{1,2}{product}
% \CSXcommands{
% \draw[->,CSXallarrows,draw=red]
% (Scheme\theCSXscheme Caption3Entry1.west) to
% ([xshift=-8pt]Scheme\theCSXscheme Caption3Entry1.west) to
% node[auto,swap,CSXlabelfont,red]{a}
% ([xshift=-8pt]Scheme\theCSXscheme Caption3Entry2.west) to
% (Scheme\theCSXscheme Caption3Entry2.west);
% }
%\end{Chemscheme}
%\end{verbatim}
% \end{minipage}
%
%
%
% \newpage
% \subsection{Ref commands}
% \noindent\DescribeMacro{\structref}
% \noindent\DescribeMacro{\structref*}
% \noindent\DescribeMacro{\structsubref}
% \noindent\DescribeMacro{\structsubref-}
% \noindent\DescribeMacro{\structsubref*}
% |\structref[<fam>]{<img>}|\\
% |\structref*[<fam>]{<img>}|\\
% |\structsubref[<fam>]{<img>}{<sublabels>}|\\
% |\structsubref-[<fam>]{<img>}{<sublabels>}|\\
% |\structsubref*[<fam>]{<img>}{<sublabels>}|\vspace{0.5em}
%
% \noindent The \CSX{} package defines ref commands that actually do exactly what their analogs from the \FL{} package do, but with |CSX| as default family.\footnote{For further information please have a look into the \textsf{fancylabel} package documentation.}
%
%
%
% \vspace{3ex}\noindent\DescribeMacro{\CSXstructref}
% \noindent The |\CSXstructref| macro allows you to change the style of all referencing commands that are shown above. The definition is shown below and may be changed as required.
%\begin{verbatim}
% \newcommand{\CSXstructref}[1]{%
% % #1=fancyref command
% \textbf{#1}%
% }
%\end{verbatim}
%
%
% \subsection{Arrows and simples}
%
% \noindent\DescribeMacro{\customarrow}
% |\customarrow[<length>]{<style>}{<upper-capt>}{<lower-capt>}|\vspace{0.5em}
%
% \noindent The basic command for arrows is the |\customarrow| command. If the optional argument |<length>| is used, the arrow will have this length. Otherwise the arrow is stretched to the length of the widest caption advanced by the length globally defined via the |arrowadvance| option. The style argument |<style>| allows you to pass options to the \TikZ{} |\draw| command.\vspace{1em}
%
% \begin{minipage}{0.25\linewidth}
% \customarrow{->,line width=1pt}{this is a long caption}{short}
% \end{minipage}
% \begin{minipage}{0.74\linewidth}
% \begin{verbatim}
% \customarrow{->,line width=1pt}
% {this is a long caption}
% {short}
% \end{verbatim}
% \end{minipage}
%
% \begin{minipage}{0.25\linewidth}
% \customarrow[60pt]{->,CSXarrowupper/.append style={red}}{this is a long caption}{short}
% \end{minipage}
% \begin{minipage}{0.74\linewidth}
% \begin{verbatim}
% \customarrow[60pt]
% {->,CSXarrowupper/.append style={red}}
% {this is a long caption}
% {short}
% \end{verbatim}
% \end{minipage}
%
%
% \noindent\DescribeMacro{\RightArrow}
% \noindent\DescribeMacro{\<arrow-cmd>}
% |\RightArrow[<length>]{<upper-capt>}{<lower-capt>}|\\
% |\<arrow-cmd>[<length>]{<upper-capt>}{<lower-capt>}|\vspace{0.5em}
%
% \noindent The table below shows a couple of arrows that are based on the |\customarrow| command. You might define some other arrows using the |\CSXdeclarearrow| command.
%
% {
% \newcommand{\CSXarrowtablex}[2][60pt]{
% \CSXarrowtable[#1]{#2}
% \CSXarrowtable[#1]{C#2}
% \CSXarrowtable[#1]{S#2}
% \CSXarrowtable[#1]{DS#2}
% }
% \newcommand{\CSXarrowtable}[2][60pt]{
% \csname #2\endcsname[#1]{}{\textbackslash #2}
% }
% \def\CSXarrowadvance{0pt}
% \tikzset{%
% CSXarrowfont/.style={%
% font={\tiny\sffamily},%
% },%
% CSXmatrix/.style={%
% column sep=20pt,%
% row sep=5pt,%
% }%
% }
% \begin{Chemscheme}
% \CSXarrowtablex{RightArrow}\ChemschemeNextRow
% \CSXarrowtablex{RightArrowDashed}
% \end{Chemscheme}
%
% \noindent All shown arrows have a normal, a crossed out (leading |C|), a striked out (leading |S|) and a double striked out (leading |DS|) version of the solid and the dashed (appending |Dashed|) arrow.
%
% \begin{Chemscheme}
% \CSXarrowtable{RightArrow}
% \CSXarrowtable{LeftArrow}
% \CSXarrowtable{LeftRightArrow}\ChemschemeNextRow
% \CSXarrowtable{DoubleRightArrow}
% \CSXarrowtable{DoubleLeftArrow}
% \CSXarrowtable{DoubleLeftRightArrow}\ChemschemeNextRow
% \CSXarrowtable{RightupHarpoon}
% \CSXarrowtable{RightdownHarpoon}
% \CSXarrowtable{LeftupHarpoon}
% \CSXarrowtable{LeftdownHarpoon}\ChemschemeNextRow
% \CSXarrowtable{LeftupRightupHarpoon}
% \CSXarrowtable{LeftupRightdownHarpoon}
% \CSXarrowtable{LeftdownRightupHarpoon}
% \CSXarrowtable{LeftdownRightdownHarpoon}\ChemschemeNextRow
% \CSXarrowtable{Equilibrium}
% \CSXarrowtable{RightEquilibrium}
% \CSXarrowtable{RRightEquilibrium}
% \CSXarrowtable{LeftEquilibrium}
% \CSXarrowtable{LLeftEquilibrium}\ChemschemeNextRow
% \CSXarrowtable{TwoRightArrow}
% \CSXarrowtable{TTwoRightArrow}
% \CSXarrowtable{TwoLeftArrow}
% \CSXarrowtable{TTwoLeftArrow}\ChemschemeNextRow
% \CSXarrowtable{ThreeRightArrow}
% \CSXarrowtable{TThreeRightArrow}
% \CSXarrowtable{ThreeLeftArrow}
% \CSXarrowtable{TThreeLeftArrow}
% \end{Chemscheme}
% }
%
%
% \vspace{3ex}\noindent\DescribeMacro{\CSXdeclarearrow}
% |\CSXdeclarearrow{<arrow-cmd>}{<style>}|\vspace{0.5em}
%
% \noindent You can use the |\CSXdeclarearrow| command to declare arrows based on the customstruct command. The definition of |\RightArrow| is:
%
% \begin{verbatim}
% \CSXdeclarearrow{\RightArrow}{CSXnormalarrows,CSXRightArrow}
% \end{verbatim}
%
% \noindent Considering the default setting of |CSXnormalarrows| and |CSXRightArrow| this means:
%
% \begin{verbatim}
% \CSXdeclarearrow{\RightArrow}{line width=0.7pt,->}
% \end{verbatim}
%
%
% \noindent\DescribeMacro{\structplus}
% \noindent\DescribeMacro{\structminus}
% |\structplus|\\
% |\structminus|\vspace{0.5em}
%
% \noindent The simples (this is how I call arrow-like elements without a upper or lower caption) |\structplus| and |\structminus| can be used like any structure or arrow command:
%
% \begin{minipage}{0.59\linewidth}
% \begin{Chemscheme}
% \struct{maleimid}
% \structplus
% \struct{cp}
% \RightArrow{}{DEE}
% \struct{product}
% \end{Chemscheme}
% \end{minipage}
% \begin{minipage}{0.35\linewidth}
% \begin{verbatim}
% \begin{Chemscheme}
% \struct{maleimid}
% \structplus
% \struct{cp}
% \RightArrow{}{DEE}
% \struct{product}
% \end{Chemscheme}
% \end{verbatim}
% \end{minipage}
%
%
%
%
% \section{Options}
% \subsection{The image option}\label{image}
% \noindent\DescribeMacro{image=}
% |\usepackage[image={<global-img-opt>}]{chemschemex}|\vspace{0.5em}
%
% \noindent All structure commands except |\customstruct| internally use the |\CSXimage| command to include pictures with |\includegraphics|. The |image| option allows you to define options that will be passed to any image that is inserted via |\CSXimage|. The default value is |image={scale=0.7}|.
%
%
% \subsection{The labelseparator option}
% \noindent\DescribeMacro{labelseparator=}
% |\usepackage[labelseparator=<value>]{chemschemex}|\vspace{0.5em}
%
% \noindent The |<value>| given by the |labelseparator| option is set behind every |\fancylabel| inside a structure command if some text follows. The value is saved in |\CSXlabelsep|. The default value is |labelseparator={:\,}|.
%
%\begin{Chemscheme}
% \struct[text]{maleimid}
% \CSXcommands{%
% \draw[<-,draw=red]([xshift=-2pt]Scheme\theCSXscheme Caption1Entry1.one split south)%
% to ([xshift=-2pt,yshift=-10pt]Scheme\theCSXscheme Caption1Entry1.one split south) node[yshift=-3pt,font={\tiny\sffamily}]{\textcolor{red}{labelseparator}};
% }
%\end{Chemscheme}
%
%
%
%
% \subsection{The arrowadvance option}
% \noindent\DescribeMacro{arrowadvance=}
% |\usepackage[arrowadvance=<length>]{chemschemex}|\vspace{0.5em}
%
% \noindent Every arrow with undefined length argument will be as long as its widest caption plus the length given by the |arrowadvance| option. This is also the minimal length of an arrow (when no captions are given). The default value is |arrowadvance=10pt|.
%
%
%
%
% \section{Customization and advanced examples}
% \subsection{Predefined \TikZ{} styles}\label{custom}
%
% \noindent There are a lot of \TikZ{} styles that are already defined by the \CSX{} package. The following two examples show the code that is generated by \CSX{} and hopefully help you to understand the function of each style. Some of them can be changed (\textcolor{green!75!black}{green}), some of them must not be changed (\textcolor{red}{red}) to prevent strange results or even errors. If you want to change fonts please use the \textcolor{blue}{blue} coloured styles instead of appending |font=| to any style since this will cause wrong calculations. The \textcolor{orange}{orange} entries are styles that are optional arguments of |\customstruct|.
%
% \begin{minipage}{0.16\linewidth}
% \customstruct{{{text}}}{\CSXimage{maleimid}}
% \end{minipage}
% \begin{minipage}{0.7\linewidth}
% \begin{verbatim}
% \customstruct{{{text}}}{\CSXimage{maleimid}}
% \end{verbatim}
% \end{minipage}
%
% \newcommand{\textred}[1]{\textcolor{red}{#1}}
% \newcommand{\textblue}[1]{\textcolor{blue}{#1}}
% \newcommand{\textorange}[1]{\textcolor{orange}{#1}}
% \newcommand{\textgreen}[1]{\textcolor{green!75!black}{#1}}
% \begin{Verbatim}[gobble=1,fontsize=\small,commandchars=!*~]
%\begin{tikzpicture}[!textgreen*CSX~]
% \matrix [!textgreen*CSXmatrix~]{
% % Image row
% \node[!textorange*<TikZ-obj>~]
% (Scheme1Image1)
% {\CSXimage{maleimid}};\\
% % Caption row
% \node(Scheme1Caption1)
% {\tikz[!textgreen*CSXcaption~,!textorange*<TikZ-capt>~]
% {\node[!textblue*CSXtextfont~,!textred*CSXsettextwidth~,!textgreen*CSXcaptionTextOnly~]
% (Scheme1Caption1Entry1)
% {text};
% }
% };\\
% };
%\end{tikzpicture}
% \end{Verbatim}
%
%
%
% \vspace{3ex}\begin{minipage}{0.42\linewidth}
% \begin{Chemscheme}
% \customstruct{{{text}}}{\CSXimage{maleimid}}
% \RightArrow{\customstruct{{{1},{}}}{\CSXimage{cp}}}{DEE}
% \customstruct{{{label 1},{text 1}},
% {{label 2},{text 2}},
% {text 3}}
% {\CSXimage{product}}
% \end{Chemscheme}
% \end{minipage}
% \begin{minipage}{0.56\linewidth}
% \begin{verbatim}
% \begin{Chemscheme}
% \customstruct{{{text}}}{\CSXimage{maleimid}}
% \RightArrow{\customstruct{{{1},{}}}
% {\CSXimage{cp}}}{DEE}
% \customstruct{{{label 1},{text 1}},
% {{label 2},{text 2}},
% {text 3}}
% {\CSXimage{product}}
% \end{Chemscheme}
% \end{verbatim}
% \end{minipage}
%
% \begin{Verbatim}[gobble=1,fontsize=\small,commandchars=!*~]
%\begin{tikzpicture}[!textgreen*CSX~]
% \matrix [!textgreen*CSXmatrix~]{
% % Image row
% \node[!textorange*<TikZ-obj>~]
% (Scheme1Image1)
% {\CSXimage{maleimid}};&
% \node(Scheme1Image2)
% {\hbox to <arrowlength>{}};&
% \node[!textorange*<TikZ-obj>~]
% (Scheme1Image3)
% {\CSXimage{product}};\\
% % Caption row
% \node(Scheme1Caption1)
% {\tikz[!textgreen*CSXcaption~,!textorange*<TikZ-capt>~]
% {\node[!textblue*CSXtextfont~,!textred*CSXsettextwidth~,!textgreen*CSXcaptionTextOnly~]
% (Scheme1Caption1Entry1)
% {text};
% }
% };&
% \node(Scheme1Caption2)
% {};&
% \node(Scheme1Caption3)
% {\tikz[!textgreen*CSXcaption~,!textorange*<TikZ-capt>~]
% {\node[!textblue*CSXlabelfont~,!textred*CSXsetlabelwidth~,!textgreen*CSXcaptionLabelandText~,
% rectangle split,rectangle split horizontal,
% rectangle split parts=2,rectangle split part align=base,
% every two node part/.style={!textblue*CSXtextfont~,!textred*CSXsettextwidth~}]
% (Scheme1Caption3Entry1)
% {label 1\nodepart{two}text 1};
% \node[!textblue*CSXlabelfont~,!textred*CSXsetlabelwidth~,!textgreen*CSXcaptionLabelandText~,
% rectangle split,rectangle split horizontal,
% rectangle split parts=2,rectangle split part align=base,
% every two node part/.style={!textblue*CSXtextfont~,!textred*CSXsettextwidth~}
% below left=of Scheme1Caption3Entry1.one split south,
% anchor=one split north]
% (Scheme1Caption3Entry2)
% {label 2\nodepart{two}text 2};
% \node[!textblue*CSXtextfont~,!textred*CSXsettextwidth~,!textgreen*CSXcaptionTextOnly~%
% below=of Scheme1Caption3Entry2.south]
% (Scheme1Caption3Entry3)
% {text 3};
% }
% };\\
% };
% \draw[!textgreen*CSXallarrows~,CSXRightArrow,text width=(<arrowlength>-\CSXarrowadvance)]
% ([CSXshiftA]Scheme1Image2.west) to
% node(Scheme1Image2Upper)
% [!textblue*CSXarrowfont~,!textgreen*CSXarrowupper~,auto]
% {\tikz[remember picture,!textgreen*CSXStructInArrow~]
% {\node[!textorange*<TikZ-obj>~]
% (Scheme1Image2UpperImage1)
% {\CSXimage{cp}};
% \node[below=of Scheme1Image2UpperImage1]
% (Scheme1Image2UpperCaption1)
% {\tikz[CSXcaption,!textorange*<TikZ-capt>~]
% {\node[!textblue*CSXlabelfont~,!textred*CSXsetlabelwidth~,
% !textgreen*CSXcaptionLabelandText~,rectangle split,
% rectangle split horizontal,
% rectangle split parts=2,
% rectangle split part align=base,
% every two node part/.style={
% !textblue*CSXtextfont~,
% !textred*CSXsettextwidth~
% }]
% (Scheme1Image2UpperCaption1Entry1)
% {1\nodepart{two}};
% }
% };
% }
% }
% node(Scheme1Image2Lower)
% [!textblue*CSXarrowfont~,!textgreen*CSXarrowlower~,auto,swap]
% {DEE}
% ([CSXshiftB]Scheme1Image2.east);
%\end{tikzpicture}
% \end{Verbatim}
%
% \subsection{Style adjustment -- some examples}
%
% \noindent As already mentioned above, please use the styles \textblue{|CSXlabelfont|} and \textblue{|CSXtextfont|} for any changes of the node font. This is necessary to ensure correct measurements. For local font adjustment of captions in structure commands use the optional argument \textorange{|<TikZ-capt>|}.
%
% \begin{minipage}{0.15\linewidth}
% \struct[text]{maleimid}
% \end{minipage}
% \begin{minipage}{0.75\linewidth}
% \begin{Verbatim}[gobble=1,fontsize=\small]
%\struct[text]{maleimid}
% \end{Verbatim}
% \end{minipage}
%
% \begin{minipage}{0.15\linewidth}
% \struct[text][][][CSXlabelfont/.style={red,font={\large}}]{maleimid}
% \end{minipage}
% \begin{minipage}{0.75\linewidth}
% \begin{Verbatim}[gobble=1,fontsize=\small]
%\struct[text]
% []
% []
% [CSXlabelfont/.style={red,font={\large}}]
% {maleimid}
% \end{Verbatim}
% \end{minipage}
%
% \begin{minipage}{0.15\linewidth}
% \struct[text][][][nodes={draw=green},CSXtextfont/.style={blue,font={\large}}]{maleimid}
% \end{minipage}
% \begin{minipage}{0.75\linewidth}
% \begin{Verbatim}[gobble=1,fontsize=\small]
%\struct[text]
% []
% []
% [nodes={draw=green},
% CSXtextfont/.style={blue,font={\large}}]
% {maleimid}
% \end{Verbatim}
% \end{minipage}
%
% \begin{minipage}{0.15\linewidth}
% \struct[][][scale=1.5][][draw=red]{maleimid}
% \end{minipage}
% \begin{minipage}{0.75\linewidth}
% \begin{Verbatim}[gobble=1,fontsize=\small]
%\struct[][][scale=1.5][][draw=red]{maleimid}
% \end{Verbatim}
% \end{minipage}
%
%
% \subsection{Chemical mechanisms}
% \noindent For more complex chemical mechanisms you can either use the matrix provided by the |Chemscheme| environment or the internal commands |\CSXimage| and |\fancylabel|:
%
% {
%\tikzset{
% CSXmatrix/.append style={
% column sep=30pt,
% }
%}
% \begin{Chemscheme}
% \struct{R2-CH=CH-R1}
% \struct{Ru=CH2}
% \struct{R1-CH=CH2}\ChemschemeNextRow[20pt]
% \struct{CH2=CH-R2}
% \struct{Ru=CH-R1}
% \struct{C2H4}
% \CSXcommands{
% \draw[->,draw=blue] (Scheme\theCSXscheme Image4)
% to [bend right=90,distance=22pt] (Scheme\theCSXscheme Image1);
% \draw[->,draw=red] (Scheme\theCSXscheme Image5)
% to [bend right=-90,distance=22pt] (Scheme\theCSXscheme Image2);
% \draw[->,draw=orange] (Scheme\theCSXscheme Image2)
% to [bend right=-90,distance=22pt] (Scheme\theCSXscheme Image5);
% \draw[->,draw=green!75!black] (Scheme\theCSXscheme Image3)
% to [bend right=90,distance=22pt] (Scheme\theCSXscheme Image6);
% }
% \end{Chemscheme}
% }
%
% \begin{Verbatim}[gobble=1,fontsize=\small,commandchars=?*~]
%\tikzset{CSXmatrix/.append style={column sep=30pt}}
%\begin{Chemscheme}
% \struct{R2-CH=CH-R1}
% \struct{Ru=CH2}
% \struct{R1-CH=CH2}\ChemschemeNextRow[20pt]
% \struct{CH2=CH-R2}
% \struct{Ru=CH-R1}
% \struct{C2H4}
% \CSXcommands{
% \draw[->,?textblue*draw=blue~] (Scheme\theCSXscheme Image4)
% to [bend right=90,distance=22pt] (Scheme\theCSXscheme Image1);
% \draw[->,?textred*draw=red~] (Scheme\theCSXscheme Image5)
% to [bend right=-90,distance=22pt] (Scheme\theCSXscheme Image2);
% \draw[->,?textorange*draw=orange~] (Scheme\theCSXscheme Image2)
% to [bend right=-90,distance=22pt] (Scheme\theCSXscheme Image5);
% \draw[->,?textgreen*draw=green!75!black~] (Scheme\theCSXscheme Image3)
% to [bend right=90,distance=22pt] (Scheme\theCSXscheme Image6);
% }
%\end{Chemscheme}
% \end{Verbatim}
%
% \tikz[node distance=1pt,mycaption/.style={CSXlabelfont}]{
% \node (n) at (0,2){\CSXimage{Ru=CH2}};
% \node (ncapt) [mycaption,below=of n] {\fancylabel[CSX]{Ru=CH2}};
% \node (s) at (0,-2){\CSXimage{Ru=CH-R1}};
% \node (scapt) [mycaption,below=of s] {\fancylabel[CSX]{Ru=CH-R1}};
% \node (nw) at (-4,1){\CSXimage{R2-CH=CH-R1}};
% \node (nwcapt) [mycaption,below=of nw] {\fancylabel[CSX]{R2-CH=CH-R1}};
% \node (sw) at (-4,-1){\CSXimage{CH2=CH-R2}};
% \node (swcapt) [mycaption,below=of sw] {\fancylabel[CSX]{CH2=CH-R2}};
% \node (ne) at (4,1){\CSXimage{R1-CH=CH2}};
% \node (necapt) [mycaption,below=of ne] {\fancylabel[CSX]{R1-CH=CH2}};
% \node (se) at (4,-1){\CSXimage{C2H4}};
% \node (ecapt) [mycaption,below=of se] {\fancylabel[CSX]{C2H4}};
% \node (w) at (-2.5,0) {};
% \node (e) at (2.5,0) {};
% \draw [->] (s) to [out=180,in=270] (w) to [out=90,in=180] (n);
% \draw [->] (n) to [out=0,in=90] (e) to [out=270,in=0] (s);
% \draw [->] (sw) to [out=0,in=270] (w) to [out=90,in=0] (nw);
% \draw [->] (ne) to [out=180,in=90] (e) to [out=270,in=180] (se);
% }
%
% \begin{Verbatim}[gobble=1,fontsize=\small,commandchars=?*~]
% \tikz[node distance=1pt,mycaption/.style={CSXlabelfont}]{
% \node (n) at (0,2){\CSXimage{Ru=CH2}};
% \node (ncapt) [mycaption,below=of n] {\fancylabel[CSX]{Ru=CH2}};
% \node (s) at (0,-2){\CSXimage{Ru=CH-R1}};
% \node (scapt) [mycaption,below=of s] {\fancylabel[CSX]{Ru=CH-R1}};
% \node (nw) at (-4,1){\CSXimage{R2-CH=CH-R1}};
% \node (nwcapt) [mycaption,below=of nw] {\fancylabel[CSX]{R2-CH=CH-R1}};
% \node (sw) at (-4,-1){\CSXimage{CH2=CH-R2}};
% \node (swcapt) [mycaption,below=of sw] {\fancylabel[CSX]{CH2=CH-R2}};
% \node (ne) at (4,1){\CSXimage{R1-CH=CH2}};
% \node (necapt) [mycaption,below=of ne] {\fancylabel[CSX]{R1-CH=CH2}};
% \node (se) at (4,-1){\CSXimage{C2H4}};
% \node (ecapt) [mycaption,below=of se] {\fancylabel[CSX]{C2H4}};
% \node (w) at (-2.5,0) {};
% \node (e) at (2.5,0) {};
% \draw [->] (s) to [out=180,in=270] (w) to [out=90,in=180] (n);
% \draw [->] (n) to [out=0,in=90] (e) to [out=270,in=0] (s);
% \draw [->] (sw) to [out=0,in=270] (w) to [out=90,in=0] (nw);
% \draw [->] (ne) to [out=180,in=90] (e) to [out=270,in=180] (se);
% }
% \end{Verbatim}
%
% \section{Change history}
% \begin{itemize}
% \item[2014/07/15] Initial version
% \item[2017/04/03] Bug within the \textbackslash Struct command fixed
% \item[2018/01/20] Dependencies changed (\textsf{xifthen} instead of \textsf{ifthen}, \textsf{etoolbox} instead of \textsf{etextools}). Loading \textsf{etextools} caused compatibility issues with some other packages.
% \end{itemize}
%
% \StopEventually{}
%
% \section{The implementation}
% \subsection{Identification}
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesPackage{chemschemex}[2018/01/20 v1.2 Typeset chemical schemes]
% \end{macrocode}
%
% \subsection{Loading packages and define counter formats}
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesPackage{chemschemex}[2017/04/03 v1.1.1 Typeset chemical schemes]
\RequirePackage{xkeyval}
\RequirePackage{etoolbox}
\RequirePackage{xargs}
\RequirePackage{xifthen}
\RequirePackage{suffix}
\RequirePackage{fancylabel}
\fancyref@DefineFamily{}{CSX}
\def\fancylabelformatCSX{\arabic{fancylabel}}
\def\fancysublabelformatCSX{\arabic{fancylabel}\alph{fancysublabel}}
\def\fancyonlysublabelformatCSX{\alph{fancysublabel}}
\RequirePackage{graphicx}
\RequirePackage{tikz}
\usetikzlibrary{%
shapes.multipart,%
decorations,%
decorations.markings,%
positioning,%
arrows.meta%
}
% \end{macrocode}
%
% \subsection{The options}
% \begin{macro}{image=}
% \begin{macrocode}
\define@key{chemschemex}{image}{%
% #1=additional options
% #2=filename of the image
\newcommand{\CSXimage}[2][]{%
\includegraphics[#1,##1]{##2}%
}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{labelseparator=}
% \begin{macrocode}
\define@key{chemschemex}{labelseparator}{%
\def\CSXlabelsep{#1}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{arrowadvance=}
% \begin{macrocode}
\define@key{chemschemex}{arrowadvance}{%
\def\CSXarrowadvance{#1}%
}
% \end{macrocode}
% \end{macro}
% \begin{macrocode}
\presetkeys{chemschemex}{%
image={scale=0.7},%
labelseparator={:\,},%
arrowadvance={10pt},%
}{}
\ProcessOptionsX<chemschemex>
% \end{macrocode}
% \subsection{TikZ styles}
% \begin{macrocode}
% TikZ styles that must not be changed
\tikzset{%
CSXsettextwidth/.style={%
text width=(%
% if
(\CSXtextwidth - \CSXimagewidth - \CSXmaxlabelwidth)>0%
% then
?(\CSXimagewidth - \CSXmaxlabelwidth)%
% else
:(\CSXtextwidth+0.00001)%
),%
},%
CSXsetlabelwidth/.style={%
text width=(%
% if
(\CSXlabelwidth)>0%
% then
?(\CSXlabelwidth+0.00001)%
% else
:(0.00001)%
),%
},%
CSXshiftA/.style={},%
CSXshiftB/.style={},%
CSXshiftcompensation/.style={},%
}
% TikZ styles that can be changed
\tikzset{%
% TikZ
CSX/.style={%
remember picture%
},%
% Matrix
CSXmatrix/.style={%
column sep=10pt,%
row sep=4pt,%
nodes={%
inner xsep=0pt,%
inner ysep=1pt,%
outer sep=0pt%
},%
every odd row/.style={anchor=center},%
every even row/.style={anchor=north},%
},%
% Structure caption
CSXcaption/.style={%
node distance=0pt,%
},%
CSXcaptionLabelandText/.style={%
align=right,%
every two node part/.style={%
align=justify%
},%
},%
CSXcaptionTextOnly/.style={%
align=justify%
},%
% Fonts
CSXlabelfont/.style={%
font={\footnotesize\sffamily\bfseries}%
},%
CSXtextfont/.style={%
font={\footnotesize\sffamily}%
},%
CSXarrowfont/.style={%
font={\footnotesize\sffamily}%
},%
CSXsimple/.style={%
x=3pt,%
y=3pt,%
line width=0.7pt%
},%
% Arrows
CSXarrowupper/.style={%
align=flush center,%
},%
CSXarrowlower/.style={%
align=flush center%
},%
CSXStructInArrow/.style={%
node distance=1pt,%
text width=,%
inner sep=0pt,%
outer sep=0pt%
},%
CSXallarrows/.style={%
x=1pt,y=1pt,%
line width=0.7,%
inner ysep=3,%
>=Classical TikZ Rightarrow,%
},%
CSXdoublearrows/.style={%
double distance=1.5,%
>=Implies%
},%
CSXharpoonup/.style={%
>={Classical TikZ Rightarrow[harpoon]}%
},%
CSXharpoondown/.style={%
>={Classical TikZ Rightarrow[harpoon,swap]}%
},%
CSXRightArrow/.style={%
->%
},%
CSXRightupHarpoon/.style={%
->[harpoon]%
},%
CSXRightdownHarpoon/.style={%
->[{harpoon,swap}]%
},%
CSXLeftArrow/.style={%
<-%
},%
CSXLeftupHarpoon/.style={%
<[{harpoon,swap}]-%
},%
CSXLeftdownHarpoon/.style={%
<[harpoon]-%
},%
CSXLeftRightArrow/.style={%
<->%
},%
CSXLeftupRightupHarpoon/.style={%
<[{harpoon,swap}]->[harpoon]%
},%
CSXLeftupRightdownHarpoon/.style={%
<[{harpoon,swap}]->[{harpoon,swap}]%
},%
CSXLeftdownRightupHarpoon/.style={%
<[{harpoon}]->[{harpoon}]%
},%
CSXLeftdownRightdownHarpoon/.style={%
<[{harpoon}]->[{harpoon,swap}]%
},%
CSXequilibrium/.style={%
inner ysep/.expanded=(1+\pgfkeysvalueof{/pgf/inner ysep}),%
CSXshiftA/.style={yshift=1},%
CSXshiftB/.style={yshift=1},%
CSXshiftcompensation/.style={yshift=-1},%
postaction=decorate,%
decoration={%
markings,%
mark=at position 0.5 with{%
\draw([yshift=-1]\CSXnodename .east) to%
([yshift=-1]\CSXnodename .west);%
}%
}%
},%
CSXRightequilibrium/.style={%
inner ysep/.expanded=(1+\pgfkeysvalueof{/pgf/inner ysep}),%
CSXshiftA/.style={yshift=1},%
CSXshiftB/.style={yshift=1},%
CSXshiftcompensation/.style={yshift=-1},%
postaction=decorate,%
decoration={%
markings,%
mark=at position 0.5 with{%
\draw([yshift=-1,xshift=-0.25\CSXarrowlength]\CSXnodename .east) to%
([yshift=-1,xshift=0.25\CSXarrowlength]\CSXnodename .west);%
}%
}%
},%
CSXLeftequilibrium/.style={%
inner ysep/.expanded=(1+\pgfkeysvalueof{/pgf/inner ysep}),%
CSXshiftA/.style={yshift=1,xshift=0.25\CSXarrowlength},%
CSXshiftB/.style={yshift=1,xshift=-0.25\CSXarrowlength},%
CSXshiftcompensation/.style={yshift=-1},%
postaction=decorate,%
decoration={%
markings,%
mark=at position 0.5 with{%
\draw([yshift=-1]\CSXnodename .east) to%
([yshift=-1]\CSXnodename .west);%
}%
}%
},%
CSXslashtwoarrow/.style={%
inner ysep/.expanded=(1.5+\pgfkeysvalueof{/pgf/inner ysep}),%
CSXshiftA/.style={yshift=1.5,xshift=5},%
CSXshiftB/.style={yshift=1.5},%
CSXshiftcompensation/.style={yshift=-1.5,xshift=-2.5},%
postaction=decorate,%
decoration={%
markings,%
mark=at position 0.5 with{%
\draw([yshift=-1.5]\CSXnodename .west) to%
([yshift=-1.5,xshift=-5]\CSXnodename .east);%
}%
}%
},%
CSXbackslashtwoarrow/.style={%
inner ysep/.expanded=(1.5+\pgfkeysvalueof{/pgf/inner ysep}),%
CSXshiftA/.style={yshift=1.5},%
CSXshiftB/.style={yshift=1.5,xshift=-5},%
CSXshiftcompensation/.style={yshift=-1.5,xshift=2.5},%
postaction=decorate,%
decoration={%
markings,%
mark=at position 0.5 with{%
\draw([yshift=-1.5,xshift=5]\CSXnodename .west) to%
([yshift=-1.5]\CSXnodename .east);%
}%
}%
},%
CSXslashthreearrow/.style={%
inner ysep/.expanded=(3+\pgfkeysvalueof{/pgf/inner ysep}),%
CSXshiftA/.style={xshift=5},%
CSXshiftB/.style={xshift=-5},%
CSXshiftcompensation/.style={x=1.4,y=1.4},%
postaction=decorate,%
decoration={%
markings,%
mark=at position 0.5 with{%
\draw([yshift=3,xshift=10]\CSXnodename .west) to%
([yshift=3]\CSXnodename .east);%
\draw([yshift=-3]\CSXnodename .west) to%
([yshift=-3,xshift=-10]\CSXnodename .east);%
}%
}%
},%
CSXbackslashthreearrow/.style={%
inner ysep/.expanded=(3+\pgfkeysvalueof{/pgf/inner ysep}),%
CSXshiftA/.style={xshift=5},%
CSXshiftB/.style={xshift=-5},%
CSXshiftcompensation/.style={x=1.4,y=1.4},%
postaction=decorate,%
decoration={%
markings,%
mark=at position 0.5 with{%
\draw([yshift=3]\CSXnodename .west) to%
([yshift=3,xshift=-10]\CSXnodename .east);%
\draw([yshift=-3,xshift=10]\CSXnodename .west) to%
([yshift=-3]\CSXnodename .east);%
}%
}%
},%
CSXCrossArrow/.style={%
inner ysep/.expanded=1.5+\pgfkeysvalueof{/pgf/inner ysep},%
postaction=decorate,%
decoration={%
markings,%
mark=at position 0.5 with{%
\draw[-,solid,CSXshiftcompensation](-3,-3)--(3,3);%
\draw[-,solid,CSXshiftcompensation](3,-3)--(-3,3);%
}%
}%
},%
CSXStrikeArrow/.style={%
inner ysep/.expanded=2+\pgfkeysvalueof{/pgf/inner ysep},%
postaction=decorate,%
decoration={%
markings,%
mark=at position 0.5 with{%
\draw[-,solid,CSXshiftcompensation](-2,-3.5)--(2, 3.5);%
}%
}%
},%
CSXDStrikeArrow/.style={%
inner ysep/.expanded=2+\pgfkeysvalueof{/pgf/inner ysep},%
postaction=decorate,%
decoration={%
markings,%
mark=at position 0.5 with{%
\draw[-,solid,xshift=-2,CSXshiftcompensation](-2,-3.5)--(2, 3.5);%
\draw[-,solid,xshift=2,CSXshiftcompensation](-2,-3.5)--(2, 3.5);%
}%
}%
}%
}
% \end{macrocode}
% \subsection{Booleans, Lengths and Counters}
% \begin{macrocode}
% Booleans
\newif\ifCSX@scheme\CSX@schemefalse % Is true, if the struct appears in a Chemscheme environment
\newif\ifCSX@generate@@@caption@ % Is needed to get label and text out of the caption passed to customstruct
\newif\ifCSX@generate@@@caption@LastEntryWasTextOnly % Is needed to detect text-only caption entries
% Lengths
\newlength{\CSXimagewidth}\setlength{\CSXimagewidth}{0pt}
\newlength{\CSXlabelwidth}\setlength{\CSXlabelwidth}{0pt}
\newlength{\CSXmaxlabelwidth}\setlength{\CSXmaxlabelwidth}{0pt}
\newlength{\CSXtextwidth}\setlength{\CSXtextwidth}{0pt}
\newlength{\CSXmaxtextwidth}\setlength{\CSXmaxtextwidth}{0pt}
\newlength{\CSXarrowlength}\setlength{\CSXarrowlength}{0pt}
% Counters
\newcounter{CSXscheme}\setcounter{CSXscheme}{1}
\newcounter{CSXstruct}\setcounter{CSXstruct}{0}
\newcounter{CSXstructinarrow}\setcounter{CSXstructinarrow}{0}
\newcounter{CSXcaption}\setcounter{CSXcaption}{0}
% \end{macrocode}
% \subsection{User macros}
% \begin{macro}{\newstruct}
% \begin{macrocode}
\def\CSX@structlist@filenamesorted{}
\newcommand{\newstruct}[5][]{%
% #1=comma-separated list of subcaptions
% #2=filename
% #3=structname
% #4=Structname
% #5=abbreviation
\@ifundefined{CSX@newstruct@#2@structname}{%
\global\@namedef{CSX@newstruct@#2@structname}{#3}%
\global\@namedef{CSX@newstruct@#2@Structname}{#4}%
\global\@namedef{CSX@newstruct@#2@abbreviation}{#5}%
\ifthenelse{\equal{#1}{}}{}{%
\setcounter{CSXcaption}{0}% No need to define a new counter, just use the CSXcaption
\fancyref@foreach{\CSX@newsubstruct}{#2}{#1}%
}%
\AtBeginDocument{%
\immediate\write\@auxout{%
\string\fancyref@addtolist%
{\string{#2\string}}%
{\string\CSX@structlist@filenamesorted}%
}%
}%
}{%
\PackageError{chemschemex}{Multiple definitions of '#2' by %
\string\newstruct}{}%
}%
}
\@onlypreamble\newstruct
% \end{macrocode}
% \end{macro}
% \begin{macro}{\structname}
% \begin{macrocode}
\DeclareRobustCommand{\structname}[1]{%
\@ifundefined{CSX@newstruct@#1@structname}{%
???%
\PackageWarning{chemschemex}{No structure '#1' defined by \string\newstruct}%
}{%
\ifthenelse{\equal{\@nameuse{CSX@newstruct@#1@structname}}{}}{%
???%
\PackageWarning{chemschemex}{structname of structure '#1' is empty.}%
}{%
\@nameuse{CSX@newstruct@#1@structname}%
}%
}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\Structname}
% \begin{macrocode}
\DeclareRobustCommand{\Structname}[1]{%
\@ifundefined{CSX@newstruct@#1@Structname}{%
???%
\PackageWarning{chemschemex}{No structure '#1' defined by \string\newstruct}%
}{%
\ifthenelse{\equal{\@nameuse{CSX@newstruct@#1@Structname}}{}}{%
???%
\PackageWarning{chemschemex}{Structname of structure '#1' is empty.}%
}{%
\@nameuse{CSX@newstruct@#1@Structname}%
}%
}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\structabbr}
% \begin{macrocode}
\DeclareRobustCommand{\structabbr}[1]{%
\@ifundefined{CSX@newstruct@#1@abbreviation}{%
???%
\PackageWarning{chemschemex}{No structure '#1' defined by \string\newstruct}%
}{%
\ifthenelse{\equal{\@nameuse{CSX@newstruct@#1@abbreviation}}{}}{%
???%
\PackageWarning{chemschemex}{structabbr of structure '#1' is empty.}%
}{%
\@nameuse{CSX@newstruct@#1@abbreviation}%
}%
}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\customstruct}
% \begin{macrocode}
\newcommandx\customstruct[4][1={},2={}]{%
% #1=TikZ option for caption
% #2=TikZ option for image
% #3=caption
% #4=image
\customstruct@outarrow[#1][#2]{#3}{#4}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\struct}
% \begin{macrocode}
\newcommandx\struct[6][1={},2=CSX,3={},4={},5={},usedefault]{%
% #1=caption
% #2=family
% #3=image options
% #4=TikZ option for caption
% #5=TikZ option for image
% #6=filename
\@struct{#1}{#2}{#6}%
\customstruct[#4][#5]{\@@struct}{\CSXimage[#3]{#6}}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\structalt}
% \begin{macrocode}
\newcommandx\structalt[7][1={},2=CSX,3={},4={},5={},usedefault]{%
% #1=caption
% #2=family
% #3=image options
% #4=TikZ option for caption
% #5=TikZ option for image
% #6=filename of the referenced image
% #7=filename of the image shown instead of #6
\@struct{#1}{#2}{#6}%
\customstruct[#4][#5]{\@@struct}{\CSXimage[#3]{#7}}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\struct*}
% \begin{macrocode}
\WithSuffix\newcommandx\struct*[6][1={},2=CSX,3={},4={},5={},usedefault]{%
% #1=caption
% #2=family
% #3=image options
% #4=TikZ option for caption
% #5=TikZ option for image
% #6=filename
\@struct*{#1}{#2}{#6}%
\customstruct[#4][#5]{\@@struct}{\CSXimage[#3]{#6}}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\structalt*}
% \begin{macrocode}
\WithSuffix\newcommandx\structalt*[7][1={},2=CSX,3={},4={},5={},usedefault]{%
% #1=caption
% #2=family
% #3=image options
% #4=TikZ option for caption
% #5=TikZ option for image
% #6=filename of the referenced image
% #7=filename of the image shown instead of #6
\@struct*{#1}{#2}{#6}%
\customstruct[#4][#5]{\@@struct}{\CSXimage[#3]{#7}}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\struct-}
% \begin{macrocode}
\WithSuffix\newcommandx\struct-[5][1={},2={},3={},4={},usedefault]{%
% #1=caption
% #2=image options
% #3=TikZ option for caption
% #4=TikZ option for image
% #5=filename
\customstruct[#3][#4]{{{},{#1}}}{\CSXimage[#2]{#5}}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\Struct}
% \begin{macrocode}
\newcommandx\Struct[6][1=CSX,2={},3={},4={},usedefault]{%
% #1=family
% #2=image options
% #3=TikZ option for caption
% #4=TikZ option for image
% #5=list of sublabels previously defined with \newstruct
% #6=filename
\@Struct{#1}{#5}{#6}%
\customstruct[#3][#4]{\@@struct}{\CSXimage[#2]{#6}}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\Structalt}
% \begin{macrocode}
\newcommandx\Structalt[7][1=CSX,2={},3={},4={},usedefault]{%
% #1=family
% #2=image options
% #3=TikZ option for caption
% #4=TikZ option for image
% #5=list of sublabels previously defined with \newstruct
% #6=filename of the referenced image
% #7=filename of the image shown instead of #6
\@Struct{#1}{#5}{#6}%
\customstruct[#3][#4]{\@@struct}{\CSXimage[#2]{#7}}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\Struct*}
% \begin{macrocode}
\WithSuffix\newcommandx\Struct*[6][1=CSX,2={},3={},4={},usedefault]{%
% #1=family
% #2=image options
% #3=TikZ option for caption
% #4=TikZ option for image
% #5=list of sublabels previously defined with \newstruct
% #6=filename
\@Struct*{#1}{#5}{#6}%
\customstruct[#3][#4]{\@@struct}{\CSXimage[#2]{#6}}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\Structalt*}
% \begin{macrocode}
\WithSuffix\newcommandx\Structalt*[7][1=CSX,2={},3={},4={},usedefault]{%
% #1=family
% #2=image options
% #3=TikZ option for caption
% #4=TikZ option for image
% #5=list of sublabels previously defined with \newstruct
% #6=filename of the referenced image
% #7=filename of the image shown instead of #6
\@Struct*{#1}{#5}{#6}%
\customstruct[#3][#4]{\@@struct}{\CSXimage[#2]{#7}}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\structplus}
% \begin{macrocode}
\newcommand{\structplus}{%
\customstruct{}{\tikz[CSXsimple]{\draw[-](1,0)to(-1,0);\draw[-](0,1)to(0,-1);}}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\structminus}
% \begin{macrocode}
\newcommand{\structminus}{%
\customstruct{}{\tikz[CSXsimple]{\draw[-](1,0)to(-1,0);}}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ChemschemeNextRow}
% \begin{macrocode}
\def\ChemschemeNextRow@list{}%
\newcommand{\ChemschemeNextRow}[1][]{%
% #1=vertical margin
\edef\ChemschemeNextRow@helper{\noexpand\fancyref@addtolist{\theCSXstruct}{\noexpand\ChemschemeNextRow@list}}%
\ChemschemeNextRow@helper%
\expandafter\def\csname ChemschemeNextRow@\theCSXstruct\endcsname{#1}%
\ignorespaces%
}
% \end{macrocode}
% \end{macro}
% \begin{environment}{Chemscheme}
% \begin{macrocode}
\newenvironment{Chemscheme}{%
\CSX@schemetrue%
\ignorespaces%
}{%
\CSX@print%
\CSX@schemefalse%
}
% \end{macrocode}
% \end{environment}
% \begin{macro}{\structref}
% \begin{macrocode}
\DeclareRobustCommand\structref[2][CSX]{%
% #1=family
% #2=label
\CSXstructref{\fancyref[#1]{#2}}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\structref*}
% \begin{macrocode}
\WithSuffix\DeclareRobustCommand\structref*[2][CSX]{%
% #1=family
% #2=label
\CSXstructref{\fancyref*[#1]{#2}}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\structsubref}
% \begin{macrocode}
\DeclareRobustCommand\structsubref[3][CSX]{%
% #1=family
% #2=label
% #3=sublabel
\CSXstructref{\fancysubref[#1]{#2}{#3}}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\structsubref-}
% \begin{macrocode}
\WithSuffix\DeclareRobustCommand\structsubref-[3][CSX]{%
% #1=family
% #2=label
% #3=sublabel
\CSXstructref{\fancysubref-[#1]{#2}{#3}}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\structsubref*}
% \begin{macrocode}
\WithSuffix\DeclareRobustCommand\structsubref*[3][CSX]{%
% #1=family
% #2=label
% #3=sublabel
\CSXstructref{\fancysubref*[#1]{#2}{#3}}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\CSXstructref}
% \begin{macrocode}
\newcommand{\CSXstructref}[1]{%
% #1=fancyref command
\textbf{#1}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\CSXcommands}
% \begin{macrocode}
\newcommand{\CSXcommands}[1]{%
\gappto\CSX@commands{#1}%
\ignorespaces%
}
\def\CSX@commands{}%
% \end{macrocode}
% \end{macro}
% \subsection{Helper macros}
% \begin{macro}{\CSX@newsubstruct}
% \begin{macrocode}
\newcommand{\CSX@newsubstruct}[2]{%
% #1=label
% #2=caption
\stepcounter{CSXcaption}%
\xdef\chemschemes@getcountervalue{%
\theCSXcaption%
}%
\expandafter\xdef\csname CSX@newstruct@#1@subcaption@%
\chemschemes@getcountervalue\endcsname{#2}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\CSX@customarrow@widestcaption}
% \begin{macrocode}
\newcommand{\CSX@customarrow@widestcaption}[2]{%
% #1=label
% #2=style
\pgfmathwidth{"%
\noexpand\tikz[minimum width=0pt,inner sep=0pt,outer sep=0pt]{%
\noexpand\node[\expandonce{#2}]{\noexpand#1};%
}%
"}%
\pgfmathsetlength{\CSXlabelwidth}{\pgfmathresult}%
\ifnum\CSXlabelwidth>\CSXarrowlength%
\pgfmathsetlength{\CSXarrowlength}{\pgfmathresult}%
\edef\CSX@arrowlength{\pgfmathresult}%
\fi%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\CSX@savebox@set}
% \begin{macrocode}
\def\CSX@savebox@set#1#2{%
% #1=boxname
% #2=box content
\@ifundefined{#1}{%
\edef\CSX@savebox@set@helper{\noexpand\newsavebox{\csname #1\endcsname}}\CSX@savebox@set@helper%
}{}
\global\sbox{\csname #1\endcsname}{#2}%
\usebox{\csname #1\endcsname}%
}%
% \end{macrocode}
% \end{macro}
% \begin{macro}{CSX@savebox@show}
% \begin{macrocode}
\def\CSX@savebox@show#1#2{%
% #1=boxname
% #2=box content
\usebox{\@nameuse{#1}}%
}%
% \end{macrocode}
% \end{macro}
% \begin{macro}{\customarrow}
% \begin{macrocode}
\newcommand{\customarrow}[4][\the\CSXarrowlength]{%
% #1=length
% #2=arrow style
% #3=upper text
% #4=lower text
\stepcounter{CSXstruct}%
% Measure upper und lower text
\setlength{\CSXarrowlength}{0pt}%
\def\CSX@nodename{Scheme\theCSXscheme Image\theCSXstruct}%
\def\CSXcustomarrow@uppertext{%
\let\customstruct\customstruct@inarrow%
\def\customstruct@inarrow@nodename{\CSX@nodename Upper}%
#3%
\let\customstruct\customstruct@outarrow%
}%
\def\CSXcustomarrow@lowertext{%
\let\customstruct\customstruct@inarrow%
\def\customstruct@inarrow@nodename{\CSX@nodename Lower}%
#4%
\let\customstruct\customstruct@outarrow%
}%
\let\CSX@savebox\CSX@savebox@set%
\edef\CSX@arrowlength{0}%
\CSX@customarrow@widestcaption{\CSXcustomarrow@uppertext}{CSXarrowfont,CSXarrowupper}%
\CSX@customarrow@widestcaption{\CSXcustomarrow@lowertext}{CSXarrowfont,CSXarrowlower}%
\let\CSX@savebox\CSX@savebox@show%
% Set matrix entries
\pgfmathsetlength{\CSXarrowlength}{\CSX@arrowlength + \CSXarrowadvance}%
\edef\customarrow@temp{%
% Reserve space in matrix
\noexpand\node(\CSX@nodename)%
{\noexpand\hbox to #1{}};%
% Add arrow command
\noexpand\CSXcommands{%
\noexpand\pgfmathsetlength{\noexpand\CSXarrowlength}{#1}%
\noexpand\def\noexpand\CSXnodename{\CSX@nodename}%
\noexpand\draw [text width=(#1-\CSXarrowadvance),#2]%
([CSXshiftA]\noexpand\CSXnodename .west) to%
node (\noexpand\CSXnodename Upper)%
[CSXshiftcompensation,CSXarrowfont,CSXarrowupper,auto]%
{\expandonce\CSXcustomarrow@uppertext}%
node (\noexpand\CSXnodename Lower)%
[CSXshiftcompensation,CSXarrowfont,CSXarrowlower,auto,swap]%
{\expandonce\CSXcustomarrow@lowertext}%
([CSXshiftB]\noexpand\CSXnodename .east);%
}%
}%
\edef\customarrow@helper{%
\noexpand\expandafter\noexpand\gdef\noexpand\csname CSX@list@image@\theCSXstruct\endcsname{%
\expandonce\customarrow@temp%
}%
}\customarrow@helper%
\expandafter\gdef\csname CSX@list@caption@\theCSXstruct\endcsname{%
\node(Scheme\theCSXscheme Caption\theCSXstruct){};%
}%
\ifCSX@scheme%
% Inside Chemscheme environment
\else%
% Outside Chemscheme environment
\CSX@print%
\fi%
\ignorespaces%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\CSXdeclarearrow}
% \begin{macrocode}
\newcommand{\CSXdeclarearrow}[2]{%
% #1=macro name
% #2=TikZ style
\newcommand{#1}[3][\the\CSXarrowlength]{%
% ##1=length
% ##2=upper caption
% ##3=lower caption
\customarrow[##1]{#2}{##2}{##3}%
}
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\CSXdeclarearrowbundle}
% \begin{macrocode}
\newcommand{\CSXdeclarearrowbundle}[2]{%
% #1=macro name
% #2=TikZ style
% normal
\CSX@declarearrowbundle{#1}{#2}%
% dashed
\CSX@declarearrowbundle{#1Dashed}{#2,dashed}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\CSX@declarearrowbundle}
% \begin{macrocode}
\newcommand{\CSX@declarearrowbundle}[2]{%
% #1=macro name
% #2=TikZ style
\edef\CSX@declarearrowbundle@helper{%
% normal arrow
\noexpand\CSXdeclarearrow{\csname #1\endcsname}{#2}%
% crossed out arrow
\noexpand\CSXdeclarearrow{\csname C#1\endcsname}{#2,CSXCrossArrow}%
% striked out arrow
\noexpand\CSXdeclarearrow{\csname S#1\endcsname}{#2,CSXStrikeArrow}%
% Double striked out arrow
\noexpand\CSXdeclarearrow{\csname DS#1\endcsname}{#2,CSXDStrikeArrow}%
}\CSX@declarearrowbundle@helper%
}
% Normal arrows
\CSXdeclarearrowbundle{RightArrow}{CSXallarrows,CSXRightArrow}
\CSXdeclarearrowbundle{LeftArrow}{CSXallarrows,CSXLeftArrow}
\CSXdeclarearrowbundle{LeftRightArrow}{CSXallarrows,CSXLeftRightArrow}
% Double arrow
\CSXdeclarearrowbundle{DoubleRightArrow}{CSXallarrows,CSXdoublearrows,CSXRightArrow}
\CSXdeclarearrowbundle{DoubleLeftArrow}{CSXallarrows,CSXdoublearrows,CSXLeftArrow}
\CSXdeclarearrowbundle{DoubleLeftRightArrow}{CSXallarrows,CSXdoublearrows,CSXLeftRightArrow}
% Single harpoons
\CSXdeclarearrowbundle{RightupHarpoon}{CSXallarrows,CSXRightupHarpoon}
\CSXdeclarearrowbundle{RightdownHarpoon}{CSXallarrows,CSXRightdownHarpoon}
\CSXdeclarearrowbundle{LeftupHarpoon}{CSXallarrows,CSXLeftupHarpoon}
\CSXdeclarearrowbundle{LeftdownHarpoon}{CSXallarrows,CSXLeftdownHarpoon}
\CSXdeclarearrowbundle{LeftupRightupHarpoon}{CSXallarrows,CSXLeftupRightupHarpoon}
\CSXdeclarearrowbundle{LeftupRightdownHarpoon}{CSXallarrows,CSXLeftupRightdownHarpoon}
\CSXdeclarearrowbundle{LeftdownRightupHarpoon}{CSXallarrows,CSXLeftdownRightupHarpoon}
\CSXdeclarearrowbundle{LeftdownRightdownHarpoon}{CSXallarrows,CSXLeftdownRightdownHarpoon}
% Equilibrium
\CSXdeclarearrowbundle{Equilibrium}{CSXallarrows,CSXequilibrium,CSXRightupHarpoon}
\CSXdeclarearrowbundle{RightEquilibrium}{CSXallarrows,CSXRightequilibrium,CSXRightupHarpoon}
\CSXdeclarearrowbundle{LeftEquilibrium}{CSXallarrows,CSXLeftequilibrium,CSXRightupHarpoon}
\CSXdeclarearrowbundle{RRightEquilibrium}{CSXallarrows,CSXLeftequilibrium,CSXLeftupHarpoon}
\CSXdeclarearrowbundle{LLeftEquilibrium}{CSXallarrows,CSXRightequilibrium,CSXLeftupHarpoon}
% Two Arrows
\CSXdeclarearrowbundle{TwoRightArrow}{CSXallarrows,CSXslashtwoarrow,CSXRightArrow}
\CSXdeclarearrowbundle{TTwoRightArrow}{CSXallarrows,CSXbackslashtwoarrow,CSXRightArrow}
\CSXdeclarearrowbundle{TwoLeftArrow}{CSXallarrows,CSXslashtwoarrow,CSXLeftArrow}
\CSXdeclarearrowbundle{TTwoLeftArrow}{CSXallarrows,CSXbackslashtwoarrow,CSXLeftArrow}
% Three Arrows
\CSXdeclarearrowbundle{ThreeRightArrow}{CSXallarrows,CSXslashthreearrow,CSXRightArrow}
\CSXdeclarearrowbundle{TThreeRightArrow}{CSXallarrows,CSXbackslashthreearrow,CSXRightArrow}
\CSXdeclarearrowbundle{ThreeLeftArrow}{CSXallarrows,CSXslashthreearrow,CSXLeftArrow}
\CSXdeclarearrowbundle{TThreeLeftArrow}{CSXallarrows,CSXbackslashthreearrow,CSXLeftArrow}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\@struct}
% \begin{macrocode}
\newcommand{\@struct}[3]{%
% #1=caption
% #2=family
% #3=filename
\ifthenelse{\equal{#1}{}}{%
\def\@@struct{{{\fancylabel[#2]{#3}},{}}}%
}{%
\def\@@struct{{{\protecting{\def\fancylabelShowLabelEvent{\CSXlabelsep}}\fancylabel[#2]{#3}},{#1}}}%
}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\@struct*}
% \begin{macrocode}
\WithSuffix\newcommand\@struct*[3]{%
% #1=caption
% #2=family
% #3=filename
\def\@@struct{{{\fancylabel*[#2]{#3}},{#1}}}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\@Struct}
% \begin{macrocode}
\newcommand\@Struct[3]{%
% #1=family
% #2=list of sublabels previously defined with \newstruct
% #3=filename
% Use the sort-function of the fancylabel package to sort the label-list
\def\@@struct{}%
\def\fancyref@@@@@sort{fancyref@PrevRun@#1@#3@\fancyref@@sort@value}%
\def\fancyref@sort@list{}%
\def\fancyref@sort@labellist@unsorted{}%
\fancyref@sort{#2}%
\edef\@Struct@helper{%
\noexpand\fancyref@addtolist{\fancyref@sort@labellist@unsorted}{\noexpand\fancyref@sort@list}%
}\@Struct@helper%
\edef\CSX@sorted@list{\fancyref@sort@list}%
% Generate the caption
\edef\@@Struct##1##2{%
% ##1=
% ##2=sublabel
\noexpand\@ifundefined{CSX@newstruct@#3@subcaption@##2}{%
\noexpand\PackageError{chemschemex}{Substructure '##2' not defined as %
substructure of '#3'. %
For the definition of substructures %
use the command \string\newstruct.}{}%
}{%
\noexpand\fancyref@addtolist{%
{{\noexpand\protecting{\noexpand\def\noexpand\fancylabelShowLabelEvent{\noexpand\CSXlabelsep}}%
\noexpand\fancysublabel[#1]{#3}{##2}},%
{\noexpand\@nameuse{CSX@newstruct@#3@subcaption@##2}}}}%
{\noexpand\@@struct}%
}%
}%
\edef\@Struct@helper{%
\noexpand\fancyref@foreach{\noexpand\@@Struct}{}{\CSX@sorted@list}%
}\@Struct@helper%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\@Struct*}
% \begin{macrocode}
\WithSuffix\newcommand\@Struct*[3]{%
% #1=family
% #2=list of sublabels previously defined with \newstruct
% #3=filename
\def\@@struct{{{\fancysublabel[#1]{#3}{#2}},{}}}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\customstruct@outarrow}
% \begin{macrocode}
\newcommandx\customstruct@outarrow[4][1={},2={}]{%
% #1=TikZ option for caption
% #2=TikZ option for image
% #3=caption
% #4=image
\stepcounter{CSXstruct}%
% Set Image
\edef\customstruct@outarrow@temp{%
\noexpand\node[\expandonce{#2}](Scheme\theCSXscheme Image\theCSXstruct){\expandonce{#4}};%
}%
\edef\customstruct@outarrow@helper{%
\noexpand\expandafter\noexpand\gdef\noexpand\csname CSX@list@image@\theCSXstruct\endcsname{%
\expandonce\customstruct@outarrow@temp%
}%
}\customstruct@outarrow@helper%
% Generate caption
\CSXgeneratecaption{#3}{#4}{Scheme\theCSXscheme Caption\theCSXstruct}{#1}%
% Set caption
\edef\customstruct@outarrow@temp{%
\noexpand\node(Scheme\theCSXscheme Caption\theCSXstruct){%
\noexpand\tikz[CSXcaption,\expandonce{#1}]{%
\expandonce\CSXcaption%
}%
};%
}%
\edef\customstruct@outarrow@helper{%
\noexpand\expandafter\noexpand\gdef\noexpand\csname CSX@list@caption@\theCSXstruct\endcsname{%
\expandonce\customstruct@outarrow@temp%
}%
}\customstruct@outarrow@helper%
\ifCSX@scheme%
% Inside Chemscheme environment
\else%
% Outside Chemscheme environment
\CSX@print%
\fi%
\ignorespaces%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\customstruct@inarrow}
% \begin{macrocode}
\newcommandx\customstruct@inarrow[4][1={},2={}]{%
% #1=TikZ option for caption
% #2=TikZ option for image
% #3=caption
% #4=image
\stepcounter{CSXstructinarrow}%
\CSXgeneratecaption{#3}{#4}{\customstruct@inarrow@nodename Caption\theCSXstructinarrow}{#1}%
\ifthenelse{\CSXmaxlabelwidth=0 \AND \CSXmaxtextwidth=0}{%
\edef\customstruct@inarrow@temp{%
\noexpand\tikz[remember picture,CSXStructInArrow]{%
\noexpand\node [\expandonce{#2}]%
(\customstruct@inarrow@nodename Image\theCSXstructinarrow)%
{\expandonce{#4}};%
}%
}%
}{%
\edef\customstruct@inarrow@temp{%
\noexpand\tikz[remember picture,CSXStructInArrow,%
baseline=(\CSX@generate@caption@captionname Entry\theCSXcaption .base)]{%
\noexpand\node [\expandonce{#2}]%
(\customstruct@inarrow@nodename Image\theCSXstructinarrow)%
{\expandonce{#4}};%
\noexpand\node [below=of \customstruct@inarrow@nodename Image\theCSXstructinarrow]%
(\customstruct@inarrow@nodename Caption\theCSXstructinarrow)%
{\noexpand\tikz[CSXcaption,\expandonce{#1}]{\expandonce\CSXcaption}};%
}%
}%
}%
\CSX@savebox{CSX@savebox@\theCSXstructinarrow}{%
\customstruct@inarrow@temp%
}%
\ignorespaces%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\CSXgeneratecaption}
% \begin{macrocode}
\newcommand{\CSXgeneratecaption}[4]{%
% #1=list of labels and text: {{label1},{text1}},{{label2},{text2}},...
% #2=Image
% #3=caption name
% #4=caption style
\setcounter{CSXcaption}{0}%
\setlength{\CSXmaxlabelwidth}{0pt}%
\setlength{\CSXmaxtextwidth}{0pt}%
\def\CSXcaption{}%
\def\CSX@generate@caption@image{#2}%
\def\CSX@generate@caption@captionname{#3}%
\def\CSX@generate@caption@captionstyle{CSXcaption,#4}%
\CSX@generate@@@caption@true%
\ifthenelse{\equal{#1}{}}{}{%
\protected@edef\CSXgeneratecaption@helper{\noexpand\fancyref@foreach{\noexpand\CSX@generate@@caption}{}{#1}}%
\CSXgeneratecaption@helper%
}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\CSX@generate@@caption}
% \begin{macrocode}
\newcommand{\CSX@generate@@caption}[2]{%
% #1=
% #2=label and text: {label1},{text1}
\edef\CSX@generate@@@caption@lastCSXcaption{\theCSXcaption}%
\stepcounter{CSXcaption}%
\fancyref@foreach{\CSX@generate@@@caption}{}{#2}%
% Execute text-only event
\ifCSX@generate@@@caption@\else%
\CSX@generate@@@caption@TextOnly%
{\CSX@generate@caption@image}%
{\CSX@generate@caption@captionname Entry\theCSXcaption}%
{\CSX@generate@caption@captionname Entry\CSX@generate@@@caption@lastCSXcaption}%
{\CSX@generate@@@caption@label}%
\CSX@generate@@@caption@true%
\fi%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\CSX@generate@@@caption}
% \begin{macrocode}
\newcommand{\CSX@generate@@@caption}[2]{%
% #1=
% #2=label or text: label1 or text1
\ifCSX@generate@@@caption@%
% Label
\def\CSX@generate@@@caption@label{#2}%
\CSX@generate@@@caption@false%
\else%
% Text and execute label-and-text event
\def\CSX@generate@@@caption@text{#2}%
\CSX@generate@@@caption@LabelAndText%
{\CSX@generate@caption@image}%
{\CSX@generate@caption@captionname Entry\theCSXcaption}%
{\CSX@generate@caption@captionname Entry\CSX@generate@@@caption@lastCSXcaption}%
{\CSX@generate@@@caption@label}%
{\CSX@generate@@@caption@text}%
\CSX@generate@@@caption@true%
\def\CSX@generate@@@caption@label{}%
\def\CSX@generate@@@caption@text{}%
\fi%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\CSX@setimagewidth}
% \begin{macrocode}
\newcommand{\CSX@setimagewidth}[1]{%
% #1=image
\pgfmathwidth{"%
\noexpand\tikz[minimum width=0pt,inner sep=0pt,outer sep=0pt]{%
\noexpand\node{\noexpand#1};%
}%
"}%
\edef\CSX@imagewidth{\pgfmathresult}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\CSX@setmaxlabelwidth}
% \begin{macrocode}
\newcommand{\CSX@setmaxlabelwidth}[1]{%
% #1=label
\pgfmathwidth{"%
\noexpand\tikz[\expandonce\CSX@generate@caption@captionstyle ,minimum width=0pt,inner sep=0pt,outer sep=0pt]{%
\noexpand\node[CSXlabelfont]{\noexpand#1};%
}%
"}%
\pgfmathsetlength{\CSXlabelwidth}{\pgfmathresult}%
\edef\CSX@labelwidth{\pgfmathresult}%
\ifnum\CSXlabelwidth<\CSXmaxlabelwidth%
\else%
\pgfmathsetlength{\CSXmaxlabelwidth}{\pgfmathresult}%
\edef\CSX@maxlabelwidth{\pgfmathresult}%
\fi%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\CSX@settextwidth}
% \begin{macrocode}
\newcommand{\CSX@settextwidth}[1]{%
% #1=text
\pgfmathwidth{"%
\noexpand\tikz[\expandonce\CSX@generate@caption@captionstyle ,minimum width=0pt,inner sep=0pt,outer sep=0pt]{%
\noexpand\node[CSXtextfont]{\noexpand#1};%
}%
"}%
\pgfmathsetlength{\CSXtextwidth}{\pgfmathresult}%
\edef\CSX@textwidth{\pgfmathresult}%
\ifnum\CSXtextwidth<\CSXmaxtextwidth%
\else%
\pgfmathsetlength{\CSXmaxtextwidth}{\pgfmathresult}%
\edef\CSX@maxtextwidth{\pgfmathresult}%
\fi%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\CSX@setvphantom}
% \begin{macrocode}
\newcommand{\CSX@setvphantom}{%
\ifdim\CSXlabelwidth=0pt%
\ifdim\CSXtextwidth=0pt%
\def\CSX@vphantom{}%
\else%
\def\CSX@vphantom{font/.expand once={\tikz@textfont\vphantom{Ag}}}%
\fi%
\else%
\def\CSX@vphantom{font/.expand once={\tikz@textfont\vphantom{Ag}}}%
\fi%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\CSX@generate@@@caption@LabelAndText}
% \begin{macrocode}
\newcommand{\CSX@generate@@@caption@LabelAndText}[5]{%
% #1=image command
% #2=node name
% #3=last node name
% #4=label
% #5=text
% Get the image width
\CSX@setimagewidth{#1}%
% Get the widest label
\CSX@setmaxlabelwidth{#4}%
% Measure the text width
\def\CSX@textwidth{0}%
\CSX@settextwidth{#5}%
\CSX@setvphantom%
% Typeset caption
\edef\CSX@generate@@@caption@tempentry{%
\noexpand\gappto\noexpand\CSXcaption{%
% Set \CSXimagewidth
\noexpand\pgfmathsetlength{\noexpand\CSXimagewidth}%
{\CSX@imagewidth}%
% Set \CSXlabelwidth
\noexpand\pgfmathsetlength{\noexpand\CSXlabelwidth}%
{\CSX@labelwidth}%
% Set \CSXmaxlabelwidth
\noexpand\pgfmathsetlength{\noexpand\CSXmaxlabelwidth}%
{\CSX@maxlabelwidth}%
% Set \CSXtextwidth
\noexpand\pgfmathsetlength{\noexpand\CSXtextwidth}%
{\CSX@textwidth}%
% Set \CSXmaxtextwidth
\noexpand\pgfmathsetlength{\noexpand\CSXmaxtextwidth}%
{\CSX@maxtextwidth}%
% Print node
\noexpand\node(#2)[%
CSXlabelfont,%
\expandonce\CSX@vphantom,%
CSXsetlabelwidth,%
CSXcaptionLabelandText,%
rectangle split,%
rectangle split horizontal,%
rectangle split parts=2,%
rectangle split part align=base,%
every two node part/.append style={%
CSXtextfont,%
CSXsettextwidth,%
},%
\ifCSX@generate@@@caption@LastEntryWasTextOnly%
\ifnum\theCSXcaption>1%
below=of #3.south,%
\fi%
\else%
\ifnum\theCSXcaption>1%
below left=of #3.one split south,%
\fi%
anchor=one split north%
\fi%
]{%
\expandonce#4%
\noexpand\nodepart{two}%
\expandonce#5%
};%
}%
}\CSX@generate@@@caption@tempentry%
\CSX@generate@@@caption@LastEntryWasTextOnlyfalse%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\CSX@generate@@@caption@TextOnly}
% \begin{macrocode}
\newcommand{\CSX@generate@@@caption@TextOnly}[4]{%
% #1=image command
% #2=node name
% #3=last node name
% #4=label
% Get the image width
\CSX@setimagewidth{#1}%
% Get the widest label
\CSX@setmaxlabelwidth{}%
% Measure the text width
\def\CSX@textwidth{0}%
\CSX@settextwidth{#4}%
\CSX@setvphantom%
% Typeset caption
\edef\CSX@generate@@@caption@tempentry{%
\noexpand\gappto\noexpand\CSXcaption{%
% Set \CSXimagewidth
\noexpand\pgfmathsetlength{\noexpand\CSXimagewidth}%
{\CSX@imagewidth}%
% Set \CSXmaxlabelwidth
\noexpand\pgfmathsetlength{\noexpand\CSXmaxlabelwidth}%
{\CSX@maxlabelwidth}%
% Set \CSXtextwidth
\noexpand\pgfmathsetlength{\noexpand\CSXtextwidth}%
{\CSX@textwidth}%
% Set \CSXmaxtextwidth
\noexpand\pgfmathsetlength{\noexpand\CSXmaxtextwidth}%
{\CSX@maxtextwidth}%
% Print node
\noexpand\node(#2)[%
CSXtextfont,%
\expandonce\CSX@vphantom,%
CSXsettextwidth,%
CSXcaptionTextOnly,%
\ifnum\theCSXcaption>1%
below=of #3.south,%
\fi%
]{%
\expandonce#4%
};%
}%
}\CSX@generate@@@caption@tempentry%
\CSX@generate@@@caption@LastEntryWasTextOnlytrue%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\CSX@print}
% \begin{macrocode}
\newcommand{\CSX@print}{%
\ifnum\theCSXstruct=0%
\PackageWarning{chemschemex}{Empty Chemscheme environment detected.}
\else%
\let\CSX@printlist\empty%
\CSX@@print%
\fi%
\setcounter{CSXstructinarrow}{0}%
% Print scheme
\begin{tikzpicture}[CSX]%
\matrix [CSXmatrix]{%
\CSX@printlist%
};%
\CSX@commands%
\end{tikzpicture}%
\stepcounter{CSXscheme}%
\setcounter{CSXstruct}{0}%
\setcounter{CSXstructinarrow}{0}%
\gdef\CSX@printlist{}%
\gdef\CSX@commands{}%
\gdef\ChemschemeNextRow@list{}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\CSX@@print}
% \begin{macrocode}
\newcommand{\CSX@@print}{%
% #1=
% #2=row (integer)
\def\lastx{1}%
\ChemschemeNextRow%
\foreach \x [remember=\xplus as \lastx,%
evaluate=\x as \xplus using int(\x+1)]%
in \ChemschemeNextRow@list {%
\ifthenelse{\x < \lastx}{}{%
% Create Image row
\foreach \y in {\lastx,...,\x}{%
\CSX@@@print{\csname CSX@list@image@\y\endcsname}%
}%
\gappto\CSX@printlist{\pgfmatrixendrow}%
% Create Caption row
\foreach \y in {\lastx,...,\x}{%
\CSX@@@print{\csname CSX@list@caption@\y\endcsname}%
}%
\edef\CSX@print@tempentry{%
\noexpand\gappto\noexpand\CSX@printlist{%
\noexpand\pgfmatrixendrow[\csname ChemschemeNextRow@\x\endcsname]%
}%
}\CSX@print@tempentry%
}%
}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\CSX@@@print}
% \begin{macrocode}
\newcommand{\CSX@@@print}[2]{%
% #1=image
\ifnum\y<\x%
\def\CSX@@@print@nextcell{\pgfmatrixnextcell}%
\else%
\def\CSX@@@print@nextcell{}%
\fi%
\edef\CSX@print@tempentry{%
\noexpand\gappto\noexpand\CSX@printlist{%
\noexpand#1%
\expandonce\CSX@@@print@nextcell%
}%
}\CSX@print@tempentry%
}
% \end{macrocode}
% \end{macro}
%
%
\endinput
% \Finale
|