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
|
% \iffalse meta-comment
%
% Copyright 2016--2024 Brian Dunn
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% 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.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% \fi
%
% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{tocdata}
%<package> [2024/01/12 v2.06 Adds author/artist to TOC entries.]
%
%<*driver>
\documentclass{ltxdoc}
\newcommand{\mypackagename}{tocdata}
\newcommand{\quicksummary}{%
Optionally prints author, artist, or other data on a line
of the \acro{TOC}\Slash\acro{LOF}.
}
% \usepackage{lmodern}
\usepackage{erewhon}
\usepackage{cabin}
\usepackage{inconsolata}
% \usepackage{libertine}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp} % provides \degree, \textquotesingle, \textmu
\usepackage{textgreek}
\usepackage{newunicodechar}
\newunicodechar{ff}{ff}
\newunicodechar{fi}{fi}
\newunicodechar{fl}{fl}
\newunicodechar{ffi}{ffi}
\newunicodechar{ffl}{ffl}
% \newunicodechar{°}{\degree}
\newunicodechar{ρ}{\ensuremath{\rho}}
\newunicodechar{⨯}{\texttimes}
\newunicodechar{⁄}{\textfractionsolidus}
% \newunicodechar{®}{\textregistered}
% \newunicodechar{©}{\textcopyright}
\newunicodechar{—}{---}
\newunicodechar{–}{--}
% \newunicodechar{”}{''}
% \newunicodechar{“}{``}
% \newunicodechar{§}{\S}
% \newunicodechar{¶}{\P}
% \newunicodechar{†}{\dag}
\newunicodechar{‡}{\ddag}
\usepackage{metalogo}
\makeatletter
\@ifpackageloaded{erewhon}{
\setlogokern{Te}{-.08em}
\setlogokern{eX}{-0.04em}
\setlogokern{La}{-.25em}
\setlogokern{aT}{-.08em}
\setlogokern{Xe}{-.04em}
\setlogokern{eL}{-.06em}
\setlogodrop{0.27ex}
}{}
\makeatother
\usepackage{microtype}
\usepackage{etoolbox}
\usepackage[log-declarations=false]{xparse}
\usepackage[svgnames]{xcolor}
\definecolor{myurlcolor}{rgb}{0,0,.7}
\definecolor{mylinkcolor}{rgb}{.7,0,0}
\definecolor{codecolor}{rgb}{0,.4,.2}
\definecolor{overviewcolor}{rgb}{0,.2,.4}
\usepackage{dtxdescribe}[2023/01/03]
\usepackage{graphicx}
\graphicspath{{images/}}
\usepackage{enumitem}
\usepackage{array}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage[all,defaultlines=2]{nowidow}
\usepackage[normalem]{ulem}
\usepackage{fancyvrb}
\usepackage{newfloat}
\DeclareFloatingEnvironment[
fileext=loi,
listname={List of Illustrations},
name=Illustration,
placement=tbp,
]{illustration}
\DeclareFloatingEnvironment[
fileext=loq,
listname={List of Quotations},
name=Quotation,
placement=tbp,
]{aquote}
\setlength{\floatsep}{5ex}
\setlength{\textfloatsep}{5ex}
\usepackage{\mypackagename}
\usepackage{titletoc}
% \usepackage{tocloft}
\usepackage{titleps}
\newpagestyle{pageheadfoot}{
\headrule
\sethead{\pkg{\mypackagename}}{}{\thepage}
% \renewcommand{\makefootrule}{\rule[2.5ex]{\linewidth}{.4pt}}
\setfoot{}{}{}
}
\pagestyle{pageheadfoot}
\usepackage{needspace}
\AtBeginDocument{
\hypersetup{%
pdfinfo={%
Title={LaTeX \mypackagename{} package},%
Author={Brian Dunn},%
Subject={LaTeX tocdata package},%
Keywords={LaTeX, tocdata, contents},%
},%
colorlinks,%
linkcolor=mylinkcolor,%
urlcolor=myurlcolor,%
pageanchor=true,
}
\pdfstringdefDisableCommands{
\def\quad{ }
\def\\{ }
\def\pkg#1{#1}
\def\cs#1{\textbackslash#1}
\def\env#1{#1}
\def\,{ }
\def\prog#1{#1}
\def\LuaLaTeX{LuaLaTeX}
\def\XeLaTeX{XeLaTeX}
\def\TeX{TeX}
\def\LaTeX{LaTeX}
\def\Dash{ --- }
\def\dash{ -- }
\def\element#1{#1}
\def\attribute#1{#1}
}
}% AtBeginDocument
\AddToHook{begindocument/before}{% Before .aux file is loaded.
\usepackage{cleveref}% If needed.
}
% from dtxdescribe:
\setlength{\marginparsep}{1em}
\setlength{\marginparpush}{.7ex}
\setlength{\parindent}{2em}
\setlength{\parskip}{0ex}
\setlength{\IndexMin}{40ex}
\setcounter{IndexColumns}{2}
\setcounter{GlossaryColumns}{1}
\DisableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
\DocInput{\mypackagename.dtx}
\end{document}
%</driver>
% \fi
%
% \changes{v0.10}{2016/05/05}{\ 2016/05/05 Initial ver.}
% \changes{v0.11}{2016/07/11}{\ 2016/07/11}
% \changes{v0.11}{2016/07/11}{Minor docs improvements in spelling, grammar, formatting.}
% \changes{v0.12}{2016/12/02}{\ 2016/12/02}
% \changes{v1.00}{2019/01/08}{Improved source formatting.}
% \changes{v1.00}{2019/01/12}{\ 2019/01/12}
% \changes{v2.00}{2019/03/15}{Added part and subsection macros.}
% \changes{v2.00}{2019/03/15}{Added caption authors.}
% \changes{v2.00}{2019/03/15}{Added support for new float types.}
% \changes{v2.00}{2019/03/15}{\ 2019/03/15}
% \changes{v2.01}{2019/03/15}{\ 2019/03/15}
% \changes{v2.02}{2019/03/21}{\ 2019/03/21}
% \changes{v2.03}{2019/07/06}{\ 2019/07/06}
% \changes{v2.04}{2020/07/15}{\ 2020/07/15}
% \changes{v2.05}{2023/01/03}{Docs updated for \pkg{dtxdescribe}.}
% \changes{v2.05}{2023/01/03}{\ 2023/01/03}
% \changes{v2.06}{2024/01/12}{\ 2024/01/12}
% \changes{v2.06}{2024/01/12}{Changed contact info.}
% \GetFileInfo{\mypackagename.sty}
%
% \DoNotIndex{\newcommand,\renewcommand,\addtocounter,\begin,\end,\begingroup,\endgroup}
% \DoNotIndex{\global,\ifbool,\ifthenelse,\isequivalentto,\let}
% \DoNotIndex{\booltrue,\boolfalse}
% \expandafter\DoNotIndex\expandafter{\detokenize{\(,\),\,,\\,\#,\$,\%,\^,\_,\~,\ ,\&,\{,\}}}
%
% ^^A \renewcommand{\listfigurename}{List of }
% \begin{center}
% \thispagestyle{empty}
% \vfill
% ^^A \includegraphics[width=.3\linewidth]{\mypackagename_logo.pdf}
% \vfill
% {\Huge The \pkg{\mypackagename} package}
% \bigskip
%
% \fileversion{} --- \filedate
%
% \bigskip
%
% {\small\textcopyright{} 2016--2024} Brian Dunn\\ \small \url{https://github.com/bdtc/tocdata}
%
% \vspace{.5in}
%
% {\normalsize\textup{\quicksummary}}
%
%
%
% \vfill
%
% \begin{abstract}
% \noindent
% The \pkg{tocdata} package adds information such as an author or artist to
% an entry in the table of contents or list of figures or new float type.
% This new information is placed on a single line along with the caption and page number,
% as is commonly done in collections of literature, poetry, or art work.
%
% \pkg{tocdata} works with the \TOC\ \Slash \LOF\ formatting of
% the default \LaTeX\ classes, \pkg{memoir}, \pkg{koma-script},
% and with \pkg{titletoc}, \pkg{tocloft}, \pkg{tocbasic}, and \pkg{tocstyle}.
% \end{abstract}
%
% \vspace*{\fill}
% \vspace*{\fill}
% \vspace*{\fill}
% \end{center}
%
% \clearpage
%
% \tableofcontents
% ^^A \clearpage
% \listoffigures
% ^^A \listoftables
% \needspace{6\baselineskip}
% \listofillustrations
% \listofaquotes
%
%
% \thispagestyle{pageheadfoot}
%
% \clearpage
%
% \sectionauthor{Introduction}{Brian}{Dunn}
%
% \begin{figure}
% \setlength{\fboxsep}{0pt}
% \centering
% \fbox{\includegraphics[width=2in]{go_problem.png}}
% \captionartist{A Challenge}
% [Problem 1-2, from \textit{Gokyo Shumyo}]
% {Hayashi}{Genbi}
% \end{figure}
%
% \begin{aquote}
% \itshape
% ``Go uses the most elemental materials and concepts --- line and circle,
% wood and stone, black and white --- combining them with simple rules
% to generate subtle strategies and complex tactics that stagger the imagination.''
% \captionauthor{\textit{Go uses the most elemental materials and concepts \dots}}%
% {Iwamoto}{Kaoru}%
% [\textnormal{ --- former \textit{Honinbo} title holder}]
% \end{aquote}
%
% Anthologies may be printed with the author alongside each title in the
% table of contents.
%
% Many commonly-recommended methods for doing this with \LaTeX, such as those linked to in
% section \ref{sec:othermethods}, place the author above or below the title and
% page number, but seldom on the same line.
%
% The \pkg{tocdata} package provides some basic infrastructure to help
% add some information to a line in the table of contents, after the title
% and just before the page number. This function works with the standard
% \LaTeX\ classes, or with either of the \pkg{titletoc} or \pkg{tocloft} packages.
%
% Additionally,
% user-level macros are provided which add the author's name to a chapter or section,
% and add the author's or artist's name and optional additional text to a figure.
% Author and artist names are also added to the index.
%
% As examples of the use of these high-level macros,
% the major section headings of this documentation
% have the author's name applied, and additional figures, illustrations, and quotes
% are supplied as well.
% The results are demonstrated in the table of contents, list of figures,
% list of illustrations, list of quotes, and the index.\footnote{%
% Yes, I \emph{do} recognize the absurdity of placing my own name in the index
% amongst the likes of Churchill, Genbi, Herschel, Kaoru, Newton\,\dots}
%
%
% \clearpage
%
% \setlength{\parindent}{0em}
% \setlength{\parskip}{2ex}
%
% \sectionauthor[Other methods]{Other methods}{Various}{Authors}
% \label{sec:othermethods}
%
% For other methods which place the author on a separate line from the title, see the
% following.
%
% Note that these methods will be preferable if a larger amount of information
% is to be placed for each title, such that it usually would not all fit on one line
% \watchout[Too much text!]
% in the table of contents.
%
% \href
% {http://tex.stackexchange.com/questions/47554/add-authors-name-automatically-while-building-toc}
% {http://tex.stackexchange.com/questions/ \\ \hspace*{1in} 47554/add-authors-name-automatically-while-building-toc}
%
% \href
% {http://tex.stackexchange.com/questions/110218/add-author-before-chapter-title-in-toc}
% {http://tex.stackexchange.com/questions/ \\ \hspace*{1in} 110218/add-author-before-chapter-title-in-toc}
%
% \href
% {http://tex.stackexchange.com/questions/156862/displaying-author-for-each-chapter-in-book}
% {http://tex.stackexchange.com/questions/ \\ \hspace*{1in} 156862/displaying-author-for-each-chapter-in-book}%
%
% \begin{illustration}
% \setlength{\fboxsep}{0pt}
% \centering
% \fbox{\includegraphics[height=3in]{engineer.jpg}}
% \captionartist
% [The Crazy Engineer]
% {The Crazy Engineer}[Illustration from \textit{The Crazy Engineer} \par \textit{McGuffey's Fifth Eclectic Reader}]{H. F.}{Farny}
% \end{illustration}
%
% \clearpage
%
% \begin{figure}
% \centering
% \includegraphics[width=3in]{astronometer_herschel.jpg}
% \captionartist
% {Astronometer\label{fig:astronometer}}
% [Astronometer made to compare the light of certain stars by the intervention of the moon.]
% [Sir]{John}{Herschel}[, 1st Baronet KH FRS]
% \end{figure}
%
% \sectionauthor{How to use \pkg{tocdata}}{Brian}{Dunn}
%
% This section shows how to use the \pkg{tocdata} package.
%
% There are several layers of macros:
% \begin{itemize}
% \item The lowest level provides the basic infrastructure for inserting information
% into the table of contents, along with hooks for the \pkg{titletoc} and \pkg{tocloft} packages.
% \item The intermediate-level macro is \cs{tocdata}, which may be used to manually
% add a piece of data to a \cs{chapter}, \cs{section}, or \cs{caption}.
% \cs{tocdataformat} is also provided to control the appearance of this data in the \acro{TOC}\Slash\acro{LOF}.
% \item At the highest level is a sample implementation of user-level macros which provides
% an easy way to create chapters, sections, and figures with associated authors and artists,
% along with supplemental information for figures, and automatic index entries.
% \end{itemize}
%
%
% \subsection{Basic setup}
%
%
%
% \subsubsection{Preamble}
%
% \pkg{tocdata} may be used with either the \pkg{tocloft} or \pkg{titletoc} package,
% or neither.
%
% In the preamble, use:
% \begin{sourceverb}
% \usepackage{tocdata}
% \usepackage{titletoc}% optional
% \usepackage{tocloft}% optional
% \end{sourceverb}
%
%
% \subsection{Mid-level applications}
%
% Should the user only wish to add a bit of text into the \acro{TOC}\Slash\acro{LOF},
% the \cs{tocdata} macro may be used just before the sectioning or caption command,
% as shown below.
%
% \subsubsection{Font control in the \acro{TOC}\Slash\acro{LOF}}
%
% \DescribeMacro{\tocdataformat} \marg{text}
%
% To control the font and formatting used for the author on the table-of-contents line,
% the default is:
% \begin{sourceverb}
% \newcommand{\tocdataformat}[1]{{\normalfont\textit{\small#1}}}
% \end{sourceverb}
%
% You may change to other font options, add parenetheses, etc.:
% \begin{sourceverb}
% \renewcommand{\tocdataformat}[1]{%
% \normalfont\textsc{\footnotesize\qquad --- (#1)}%
% }
% \end{sourceverb}
%
%
% \subsubsection{Adding \acro{TOC} data per section}
%
% \DescribeMacro{\tocdata} \marg{list extension} \marg{text}
%
% Before each \cs{chapter} or \cs{section} which is to have an author or other data:
%
% \begin{sourceverb}
% \tocdata{toc}{Author's Name}
% \chapter{Chapter Title} -or- \section{Section Title}
% \end{sourceverb}
%
%
% \subsubsection{Adding \acro{LOF} data per figure}
% Before each \cs{caption} which is to have an artist or author:
%
% \begin{sourceverb}
% \tocdata{lof}{Artist's/Author's Name}
% \caption{Figure Title}
% \end{sourceverb}
%
% You may wish to print the artist's name in the figure as well.
%
%
% \subsection{High-level user macros}
%
% Additional macros are given in section \ref{sec:usermacros}.
% These are user-level sectioning and captioning commands which add the
% names to the \acro{TOC} and \acro{LOF},
% and also add the artist's name and optional additional text
% to a figure or other float (as in Figure \ref{fig:quail}),
% and also add the names to the index.
% An optional prefix and suffix may be attached to the names
% (as in Figure \ref{fig:astronometer}),
% and these will be printed at the section heading or caption, but not
% in the \acro{TOC}\Slash\acro{LOF} or in the index.
%
% These macros may be ignored or modified as needed.
%
% \subsubsection{Sectioning commands with authors}
%
% \DescribeMacro{\partauthor}
% \DescribeMacro{\chapterauthor}
% \DescribeMacro{\sectionauthor}
% \DescribeMacro{\subsectionauthor}
% To use these macros, do not use \cs{tocdata} as shown above, but instead use,
% in the place of \cs{part}:
% \begin{sourceverb}
% \partauthor[list entry]{Title}[Prefix]{First}{Last}[Suffix]
% \end{sourceverb}
% Likewise for chapters, sections, and subsections.
%
%
%
% \subsubsection{Figure captions with author \Slash artist names and additional text}
%
% \DescribeMacro{\captionartist}
% \DescribeMacro{\captionauthor}
% For figures, in the place of \cs{caption}, use:
%
% \begin{sourceverb}
% \captionartist[list entry]{Title}[Text][Prefix]{First}{Last}[Suffix]
% -or-
% \captionauthor[list entry]{Title}[Text][Prefix]{First}{Last}[Suffix]
% \end{sourceverb}
%
% By default, \cs{captionartist} prints the artist centered below the figure,
% and \cs{captionauthor} prints the author below and flush right, without
% an extra vertical skip.
%
% If you are using the optional prefix, the optional text must also be given, even if it
% is empty. For example, use:
% \watchout[Optional arguments]
% \begin{sourcedisplay}
% \cs{captionartist}\{Title\}\textcolor{red}{[]}[Sir]\{Isaac\}\{Newton\}
% \end{sourcedisplay}
% (If only one optional argument is given before the first name, it will be
% interpreted as the optional text, not as the optional prefix.)
%
% \DescribeMacro{\captionartist*}
% \DescribeMacro{\captionauthor*}
% If you are using the \pkg{caption} package or another package which
% supports \cs{caption*}, you may use \cs{captionartist*} and \cs{captionauthor*}
% with \pkg{tocdata}.
% The artist \Slash author and supplemental text will still be printed below the figure,
% and an unnumbered caption will be generated, even though a \acro{LOF} entry will not be made.
%
% Should you mistakenly use \cs{captionartist*} or \cs{captionauthor*}
% without the \pkg{caption} package,
% expect to get a caption with a visible star in it.
% \watchout[\pkg{caption} package]
% To fix the problem:\\
% \hspace*{1em} |\usepackage{caption}|
%
% \subsubsection{Formatting in sections and figures}
%
% \DescribeMacro{\tocdatapartprint}
% \DescribeMacro{\tocdatachapterprint}
% \DescribeMacro{\tocdatasectionprint}
% \DescribeMacro{\tocdatasubsectionprint}
% To change the formatting of the author names printed after
% each chapter or section, or to remove them entirely, use
% these macros, as described in section~\ref{sec:usermacros}
% on page~\pageref{sec:usermacros}.
%
% \cs{tocdatachapterprint} and \cs{tocdatasectionprint} by default
% \watchout[redefining]
% depend on \cs{tocdatapartprint}, so if it is redefined the others will
% have to be redefined as well.
%
%
% \DescribeMacro{\tocdataartistprint}
% \DescribeMacro{\tocdataartisttextprint}
% \DescribeMacro{\tocdataauthorprint}
% \DescribeMacro{\tocdataauthortextprint}
% To change the formatting of a figure's artist's name or author's name and optional text,
% use these macros, also described in section \ref{sec:usermacros}.
%
%
% \subsubsection{Text justification}
%
% \changes{v2.02}{2019/03/20}{Docs: Fix macro names.}
% \DescribeMacro{\tdartistjustify}
% \DescribeMacro{\tdartistcenter}
% \DescribeMacro{\tdartistleft}
% \DescribeMacro{\tdartistright}
% \DescribeMacro{\tdartisttextjustify}
% \DescribeMacro{\tdartisttextcenter}
% \DescribeMacro{\tdartisttextleft}
% \DescribeMacro{\tdartisttextright}
% \DescribeMacro{\tdauthorjustify}
% \DescribeMacro{\tdauthorcenter}
% \DescribeMacro{\tdauthorleft}
% \DescribeMacro{\tdauthorright}
% \DescribeMacro{\tdauthortextjustify}
% \DescribeMacro{\tdauthortextcenter}
% \DescribeMacro{\tdauthortextleft}
% \DescribeMacro{\tdauthortextright}
% The text alignment of artists, artists' additional text,
% authors, and authors' additional text may be set using
% these macros.
% All following figures use the selected justification
% until it is changed to another.
%
%
% \StopEventually{\PrintChanges
% \PrintIndex
%
% \clearpage
%
% \tdauthortextright
% \begin{aquote}[tbp]
% \itshape
% ``Now this is not the end.
% It is not even the beginning of the end.
% But it is, perhaps, the end of the beginning.''
% \captionauthor{\textit{Now this is not the end \dots}}
% [(Full name used for demonstration purposes.)][Sir]{Winston Leonard Spencer}{Churchill}
% \end{aquote}
%
% \begin{figure}[tbp]
% \centering
% \setlength{\fboxsep}{2ex}
% {\fontsize{35}{50}\selectfont\textOmega}
% \captionartist{Omega}{Greek}{Alphabet}
% \end{figure}
%
%}
%
% \begin{illustration}[hbp]
% \setlength{\fboxsep}{0pt}
% \centering
% \fbox{\includegraphics[width=3in]{quail.jpg}}
% \captionartist{Quail\label{fig:quail}}
% [Illustration from \textit{About Quail} \par \textit{McGuffey's Fifth Eclectic Reader}]
% {Alexander}{Pope}
% \end{illustration}
%
%
% \clearpage
%
% \sectionauthor{Code}{Brian}{Dunn}
%
% \begin{figure}
% \centering
% \includegraphics[width=3in]{diagram_sunbeam.jpg}
% \captionartist
% {Diagram of a Sunbeam}[]
% [Sir]{Isaac}{Newton}
% \end{figure}
%
% Below, the \pkg{tocdata} code section contains the low-level code used to
% place the data into the table of contents and list of figures, as well as
% the code to control the font used while doing so.
%
% Next are sections used to support the default \LaTeX\ classes,
% as well as \pkg{titletoc} and \pkg{tocloft}.
%
% Finally, the high-level macros are provided. The user may ignore or redefine these
% as desired.
%
%
% \subsection{Requirements}
%
% \changes{v0.12}{2016/12/02}{Added requirement for \pkg{xifthen}.}
% \changes{v1.00}{2019/01/08}{Remove \pkg{xifthen} dependency.}
%
% \begin{macrocode}
\RequirePackage{xparse}
\RequirePackage{etoolbox}
\RequirePackage{xpatch}
% \end{macrocode}
% Require that \pkg{titletoc} and \pkg{tocloft} be loaded
% after \pkg{tocdata}, so that \pkg{tocdata} can patch
% the \LaTeX\ core definitions first.
% \changes{v2.00}{2019/03/12}{Test for early \pkg{titletoc} or \pkg{tocloft}.}
% \changes{v2.03}{2019/07/04}{Added support for \pkg{memoir}.}
% \begin{macrocode}
\@ifpackageloaded{titletoc}{
\PackageError{tocdata}
{%
Load titletoc after tocdata%
}
{%
Move \protect\usepackage{titletoc} after \protect\usepackage{tocdata}.%
}
}{}
\@ifclassloaded{memoir}
{}% memoir
{% not memoir
\@ifpackageloaded{tocloft}{
\PackageError{tocdata}
{%
Load tocloft after tocdata%
}
{%
Move \protect\usepackage{tocloft} after \protect\usepackage{tocdata}.%
}
}{}
}% not memoir
% \end{macrocode}
% Prevent the use of both \pkg{titletoc} and \pkg{tocloft}.
% \changes{v2.00}{2019/03/12}{Test for both \pkg{titletoc} and \pkg{tocloft}.}
% \begin{macrocode}
\AtBeginDocument{
\@ifpackageloaded{titletoc}{
\@ifpackageloaded{tocloft}{
\PackageError{tocdata}
{%
Both titletoc and tocloft are being used.\MessageBreak
Load only one%
}
{%
The tocdata package may use the default LaTeX formatting,\MessageBreak
or either one of titletoc or tocloft.
}
}{}
}{}
}
% \end{macrocode}
% \subsection{\pkg{tocdata} code}
% \begin{macro}{\TD@thistocdata}
% Storage for the data to be added to the end of the \acro{TOC} entry:
% \begin{macrocode}
\newcommand{\TD@thistocdata}{}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\settocdata}
% Written to the |.toc| or |.lof| file, assigns \cs{TD@thistocdata}:
% \begin{macrocode}
\newcommand{\settocdata}[1]{\renewcommand{\TD@thistocdata}{#1}}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\tocdata} \marg{|toc| or |lof|} \marg{text}
%
% To be called by a higher-level macro to assign data to a |.toc| or |.lof| file:
% \begin{macrocode}
\newcommand{\tocdata}[2]{%
\@bsphack\addtocontents{#1}{\protect\settocdata{#2}}\@esphack%
}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\tocdatafont} \marg{text} \qquad
% Provided for compatibility with older documents.
% Instead, use and redefine \cs{tocdataformat} for newer documents.
% \watchout[deprecated]
%
% \begin{macrocode}
\newcommand{\tocdatafont}[1]{{\normalfont\textit{\small#1}}}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\tocdataformat} \marg{text}
%
% Controls the font and formatting for the \acro{TOC} data:
%
% \begin{sourceverb}
% \renewcommand{\tocdataformat}[1]{\textit{#1}}
% \end{sourceverb}
%
% \begin{macrocode}
\def\tocdataformat{\tocdatafont}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\TD@usetocdata}
%
% To be inserted into low-level \acro{TOC}-generation code where the data should appear.
%
% See the example using \pkg{titletoc}, below.
%
% Prints the data, then clears the storage so it is not printed again.
%
% \changes{v2.03}{2019/06/30}{Fix: No action if empty data.}
% \changes{v2.03}{2019/06/30}{Uses \cs{tocdataformat} instead of \cs{tocdatafont}.}
% \begin{macrocode}
\newcommand{\TD@usetocdata}{%
\ifdefvoid{\TD@thistocdata}{}{%
\tocdataformat{\TD@thistocdata}%
\global\def\TD@thistocdata{}%
}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\TD@checktocdatafont} \marg{text}
%
% Used to detect whether the user redefined \cs{tocdatafont},
% in which case a warning is issued to use \cs{tocdataformat} instead.
% \begin{macrocode}
\let\TD@checktocdatafont\tocdatafont
\AtBeginDocument{
\ifdefequal\TD@checktocdatafont\tocdatafont{}{
\PackageWarningNoLine{tocdata}{%
You have redefined \protect\tocdatafont,\MessageBreak
which has been deprecated. Please redefine\MessageBreak
\protect\tocdataformat\space instead}
}
}
% \end{macrocode}
% \end{macro}
% \subsection{Standard \LaTeX\ patches}
%
% \changes{v2.00}{2019/03/12}{Adds support for default \LaTeX\ \TOC\ formattting,
% without using \pkg{titletoc} or \pkg{tocloft}.}
% \changes{v2.03}{2019/06/30}{Fix: Don't try to patch \pkg{lwarp}.}
%
% \begin{macro}{\TD@patchstandardlatex} Patches standard \LaTeX\ \TOC\ formatting.
% \begin{macrocode}
\newcommand*{\TD@patchstandardlatex}{
% \end{macrocode}
%
% \begin{macro}{\@dottedtocline} Patched for \pkg{tocdata}.
% \begin{macrocode}
\xpatchcmd{\@dottedtocline}
{\hfill\nobreak}
{\hfill\TD@usetocdata\nobreak}
{}%
{%
\PackageWarningNoLine{tocdata}{%
Could not patch LaTeX core \protect\@dottedtocline.\MessageBreak
Authors may not appear in TOC, LOF}
}%
% \end{macrocode}
% \end{macro}
% \begin{macro}{\l@part} Patched for \pkg{tocdata}.
% \changes{v2.03}{2019/07/04}{Added support for \pkg{memoir}.}
% \changes{v2.03}{2019/07/06}{Added support for \pkg{koma-script}.}
% \begin{macrocode}
\@ifclassloaded{memoir}{}{%
\@ifpackageloaded{tocbasic}{}{%
\xpatchcmd{\l@part}
{\hfil}
{\hfil\TD@usetocdata}
{}%
{%
\PackageWarningNoLine{tocdata}{%
Could not patch LaTeX core \protect\l@part.\MessageBreak
Authors may not appear in TOC parts}
}%
}}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\l@chapter} Patched for \pkg{tocdata}.
% \changes{v2.03}{2019/07/04}{Added support for \pkg{memoir}.}
% \changes{v2.03}{2019/07/06}{Added support for \pkg{koma-script}.}
% \begin{macrocode}
\@ifclassloaded{memoir}{}{%
\@ifpackageloaded{tocbasic}{}{%
\@ifundefined{chapter}{}{%
\xpatchcmd{\l@chapter}
{\hfil\nobreak}
{\hfil\TD@usetocdata\nobreak}
{}%
{%
\PackageWarningNoLine{tocdata}{%
Could not patch LaTeX core \protect\l@chapter.\MessageBreak
Authors may not appear in TOC chapters}
}%
}}}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\l@section} Patched for \pkg{tocdata}.
% \changes{v2.01}{2019/03/15}{Fix for \LaTeX\ core section \TOC\ entry.}
% \changes{v2.03}{2019/06/30}{Fix: Only patch if \pkg{article}.}
% \begin{macrocode}
\@ifclassloaded{article}{
\xpatchcmd{\l@section}
{\hfil\nobreak}
{\hfil\TD@usetocdata\nobreak}
{}%
{%
\PackageWarningNoLine{tocdata}{%
Could not patch LaTeX core \protect\l@section.\MessageBreak
Authors may not appear in TOC sections}
}%
}{}
% \end{macrocode}
% \end{macro}
%
% \begin{macrocode}
}% TD@patchstandardlatex
% \end{macrocode}
% \end{macro}
%
%
% Patch standard \LaTeX\ if not using \pkg{lwarp}, or if
% \pkg{lwarp} is used in print mode:
% \begin{macrocode}
\@ifpackageloaded{lwarp}{%
\ifbool{warpingprint}{\TD@patchstandardlatex}{}%
}{%
\TD@patchstandardlatex%
}
% \end{macrocode}
% \subsection{\pkg{titletoc} support}
%
% \begin{figure}
% \centering
% \setlength{\fboxsep}{2ex}
%
% {\fontsize{140}{160}\selectfont$\pi$}
% \captionartist{Pi\label{fig:workofart}}{Greek}{Alphabet}
% \end{figure}
%
% \changes{v2.03}{2019/07/04}{Tested to work with \cs{dottedcontents}.}
%
% If \pkg{titletoc} is loaded, patch macros for its use:
% \changes{v2.00}{2019/03/13}{Patches \cs{AtBeginDocument}.}
% \begin{macrocode}
\AtBeginDocument{
\@ifpackageloaded{titletoc}{
% \end{macrocode}
%
% \DescribeMacro{\titlecontents}
% A set of \pkg{titletoc} commands which set up the formatting of the
% \acro{TOC} entries. These are patched \cs{AtBeginDocument},
% after user customizations in the preamble, to include the tocdata just after
% the leader (|titlerule*|), and just before the page number.
%
% These macros also include spacing commands, and thus may need to be
% redefined by the user.
%
% The default macros are patched via the \LaTeX\ core.
% The following are only necessary if \cs{titlecontents} was used.
% Since every combination is tried, but will only succeed if \cs{titlecontents}
% was used, no warnings are printed if the patch fails.
%
% \changes{v2.00}{2019/03/13}{Improved patches for \pkg{titletoc}.}
%
% \begin{macrocode}
\newcommand*{\TD@titletoc@patch}[1]{%
\expandafter\xpatchcmd\csname ttl@savel@#1\endcsname
{\nobreak\hfil\nobreak}
{\nobreak\hfil\TD@usetocdata\nobreak}
{}
{%
\PackageWarningNoLine{tocdata}{%
Could not patch titletoc ttl@savel@#1.\MessageBreak
Authors may not appear in TOC, LOF}
}
\expandafter\xpatchcmd\csname l@#1\endcsname
{\contentspage}
{\TD@usetocdata\contentspage}
{}
{%
\PackageWarningNoLine{tocdata}{%
Could not patch titletoc l@#1.\MessageBreak
Authors may not appear in TOC, LOF}
}
}
\TD@titletoc@patch{part}
\@ifundefined{chapter}{}{\TD@titletoc@patch{chapter}}
\TD@titletoc@patch{section}
\TD@titletoc@patch{subsection}
\TD@titletoc@patch{subsubsection}
\TD@titletoc@patch{paragraph}
\TD@titletoc@patch{subparagraph}
\TD@titletoc@patch{figure}
\TD@titletoc@patch{table}
}% end of titletoc loaded
{% titletoc is not loaded
}% end of \@ifpackageloaded{titletoc}
}% end of \AtBeginDocument
% \end{macrocode}
% \subsection{\pkg{tocloft} and \pkg{memoir} support}
%
% If \pkg{tocloft} is loaded, the following patches are applied.
% \pkg{memoir} emulates \pkg{tocloft}, so it is patched here as well.
% \changes{v2.00}{2019/03/13}{Patches \cs{AtBeginDocument}.}
% \changes{v2.03}{2019/07/04}{Added support for \pkg{memoir}.}
% \begin{macrocode}
\AtBeginDocument{
\@ifclassloaded{memoir}
{
\appto{\cftpartleader}{\TD@usetocdata}
\appto{\cftchapterleader}{\TD@usetocdata}
\appto{\cftsectionleader}{\TD@usetocdata}
\appto{\cftsubsectionleader}{\TD@usetocdata}
\appto{\cftsubsubsectionleader}{\TD@usetocdata}
\appto{\cftparagraphleader}{\TD@usetocdata}
\appto{\cftsubparagraphleader}{\TD@usetocdata}
\appto{\cftfigureleader}{\TD@usetocdata}
\appto{\cfttableleader}{\TD@usetocdata}
\appto{\cftsubfigureleader}{\TD@usetocdata}
\appto{\cftsubtableleader}{\TD@usetocdata}
}% memoir
{% not memoir
\@ifpackageloaded{tocloft}
{
% \end{macrocode}
%
% \DescribeMacro{\cftXleader} A set of commands used by \cs{tocloft} to
% typeset the leader between the title and the page number.
% These are patched to print the tocdata just after the leader.
%
% \changes{v2.00}{2019/03/13}{Improved patches for \pkg{tocloft}.}
% \begin{macrocode}
\appto{\cftpartleader}{\TD@usetocdata}
\if@cfthaschapter
\appto{\cftchapleader}{\TD@usetocdata}
\fi
\appto{\cftsecleader}{\TD@usetocdata}
\appto{\cftsubsecleader}{\TD@usetocdata}
\appto{\cftsubsubsecleader}{\TD@usetocdata}
\appto{\cftparaleader}{\TD@usetocdata}
\appto{\cftsubparaleader}{\TD@usetocdata}
\appto{\cftfigleader}{\TD@usetocdata}
\appto{\cfttableader}{\TD@usetocdata}
\appto{\cftsubfigleader}{\TD@usetocdata}
\appto{\cftsubtableader}{\TD@usetocdata}
% \end{macrocode}
% \begin{macrocode}
}% end of tocloft patches
{}% tocloft not loaded
}% not memoir
}% \AtBeginDocument
% \end{macrocode}
%
%
%
% \subsection{Koma-script \pkg{tocbasic} support}
%
% There is no easy way to patch this\dots
% \cs{TD@usetocdata} is inserted near the end of the following:
%
% \changes{v2.03}{2019/07/06}{Added support for \pkg{tocbasic}.}
% \changes{v2.04}{2020/07/15}{Updated for \pkg{tocbasic} v3.30.}
%
% \begin{macrocode}
\AtBeginDocument{
\@ifpackageloaded{tocbasic}{
\xpatchcmd{\scr@dte@tocline}
{%
\nobreak
\expandafter\let\expandafter\scr@dte@pagenumberwidth
}
{%
\TD@usetocdata% tocdata
\nobreak
\expandafter\let\expandafter\scr@dte@pagenumberwidth
}
{}
{%
\PackageWarningNoLine{tocdata}{%
Could not patch tocbasic \protect\scr@dte@tocline.\MessageBreak
Authors may not appear in TOC, LOF}
}
}{}
}
% \end{macrocode}
%
%
% \subsection{\pkg{tocstyle} support}
%
% \changes{v2.03}{2019/07/06}{Added support for \pkg{tocstyle}.}
%
% \begin{macrocode}
\AtBeginDocument{
\@ifpackageloaded{tocstyle}{
\xpatchcmd\tocstyle@dottedtocline
{%
\ifx\tocstyle@feature@leaders\relax
\leaders\hbox{$\m@th
\mkern \@dotsep mu\hbox{\tocstyle@feature@dothook .}%
\mkern \@dotsep mu$}\hfill
\else
\tocstyle@feature@leaders
\fi%
}
{%
\ifx\tocstyle@feature@leaders\relax
\leaders\hbox{$\m@th
\mkern \@dotsep mu\hbox{\tocstyle@feature@dothook .}%
\mkern \@dotsep mu$}\hfill
\else
\tocstyle@feature@leaders
\fi%
\TD@usetocdata%
}
{}%
{%
\PackageWarningNoLine{tocdata}{%
Could not patch tocstyle \protect\tocstyle@dottedtocline.\MessageBreak
Authors may not appear in TOC, LOF}
}%
}{}
}
% \end{macrocode}
%
%
%
% \clearpage
%
% \subsection{User-level macros}
% \label{sec:usermacros}
%
% \begin{figure}
% \centering
% \includegraphics[width=3in]{newton_astrolabe.jpg}
% \captionartist{Sir Isaac Newton's Astrolabe}[][Sir]{Isaac}{Newton}
% \end{figure}
%
%
% Example user-level macros follow.
%
% These macros are in addition to the standard sectioning and caption commands,
% adding first and last names for the table of contents and list of figures.
% For parts, chapters, sections, and subsections,
% the author's name with optional prefix and suffix
% are also added below the title.
% For figures, \cs{captionauthor} also prints the figure's artist's
% name with optional prefix and suffix just below the figure.
%
% The regular sectioning and caption commands may still be used for anything
% which does not have an author/artist name.
%
%
% \subsubsection{User customization}
%
%
% \begin{macro}{\TDoptionalnameprint} \marg{name}
%
% Adds optional artist's name and the following space.
%
% \changes{v2.03}{2019/07/04}{Name changed from \cs{TD@optionalnameprint}.}
% \begin{macrocode}
\newcommand{\TDoptionalnameprint}[1]
{%
\ifblank{#1}%
{}%
{#1~}%
}
% \end{macrocode}
% \end{macro}
%
%
%
%
% \begin{macro}{\tocdatapartprint} \marg{prefix} \marg{first} \marg{last} \marg{suffix}
%
% User-redefinable macro to print the author's name underneath the part title.
%
% \changes{v0.12}{2016/11/29}{Improved spacing.}
% \changes{v2.00}{2019/03/15}{Added.}
% \changes{v2.03}{2019/07/04}{Removed \cs{unskip}.}
%
% \begin{macrocode}
\newcommand{\tocdatapartprint}[4]
{%
\par\noindent%
{%
\normalfont\normalsize%
\textit{%
\hspace*{4em}--- %
\TDoptionalnameprint{#1}\TDoptionalnameprint{#2}#3#4%
}%
}%
}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\tocdatachapterprint} \marg{prefix} \marg{first} \marg{last} \marg{suffix}
%
% User-redefinable macro to print the author's name underneath the chapter title.
%
% \changes{v2.00}{2019/03/15}{Renamed from \cs{tocdatachapprint}.}
%
% \begin{macrocode}
\@ifundefined{chapter}
{}% if no chapters
{% only of chapters exists in this documentclass:
\let\tocdatachapterprint\tocdatapartprint
}% end of chapters-only
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\tocdatasectionprint} \marg{prefix} \marg{first} \marg{last} \marg{suffix}
%
% User-redefinable macro to print the author's name underneath the section title.
%
% \changes{v2.00}{2019/03/15}{Renamed from \cs{tocdatasecprint}.}
%
% \begin{macrocode}
\let\tocdatasectionprint\tocdatapartprint
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\tocdatasubsectionprint} \marg{prefix} \marg{first} \marg{last} \marg{suffix}
%
% User-redefinable macro to print the author's name underneath the subsection title.
%
% \changes{v2.00}{2019/03/15}{Added.}
% \begin{macrocode}
\let\tocdatasubsectionprint\tocdatapartprint
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\TDartistauthorprint} \marg{1: "artist" or "author"}
% \marg{2: prefix} \marg{3: first} \marg{4: last} \marg{5: suffix}
%
% \changes{v2.00}{2019/03/15}{Improved font control.}
% \changes{v2.03}{2019/07/04}{Name changed from \cs{TD@artistauthorprint}.}
%
% \begin{macrocode}
\newcommand{\TDartistauthorprint}[5]{%
\begin{minipage}{\linewidth}%
\csuse{TD@#1align}%
\footnotesize\normalfont%
\textsc{{\TDoptionalnameprint{#2}\TDoptionalnameprint{#3}#4#5}}%
\end{minipage}%
\par%
\addvspace{2ex}%
}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\tocdataartistprint} \marg{prefix} \marg{first} \marg{last} \marg{suffix}
%
% User-redefinable macro to print the artist's name underneath the figure.
%
% \changes{v0.12}{2016/11/29}{Improved spacing.}
% \changes{v0.12}{2016/11/30}{Added name alignment.}
% \changes{v2.00}{2019/03/14}{Added.}
% \changes{v2.02}{2019/03/20}{Improved spacing.}
%
% \begin{macrocode}
\newcommand{\tocdataartistprint}{%
\par\smallskip%
\TDartistauthorprint{artist}%
}
% \end{macrocode}
% To remove the artist's name, redefine this as a null function taking four arguments:
% \begin{sourceverb}
% \renewcommand{\tocdataartistprint}[4]{}
% \end{sourceverb}
% \end{macro}
%
%
% \begin{macro}{\tocdataauthorprint} \marg{prefix} \marg{first} \marg{last} \marg{suffix}
%
% User-redefinable macro to print the author's name underneath the figure.
%
% \changes{v2.00}{2019/03/14}{Added.}
% \changes{v2.02}{2019/03/20}{Improved spacing.}
%
% \begin{macrocode}
\newcommand{\tocdataauthorprint}{%
\par\smallskip%
\TDartistauthorprint{author}%
}
% \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{\TDartistauthortextprint}
% \marg{"artist" or "author"} \marg{text}
% \changes{v0.12}{2016/11/29}{Improved spacing.}
% \changes{v0.12}{2016/11/29}{Added text alignment.}
% \changes{v2.00}{2019/03/15}{Improved font control.}
% \changes{v2.00}{2019/03/14}{Replaced \cs{tocdatafigtextprint} with
% \cs{tocdataartisttextprint} and \cs{tocdataauthortextprint}.}
% \changes{v2.03}{2019/07/04}{Name changed from \cs{TD@artistauthortextprint}.}
% \begin{macrocode}
\newcommand{\TDartistauthortextprint}[2]{%
\addvspace{2ex}%
\begin{minipage}{\linewidth}%
\csuse{TD@#1textalign}%
\footnotesize\normalfont%
\setlength{\parskip}{1.5ex}%
\setlength{\parindent}{0em}%
#2%
\end{minipage}%
\par%
\addvspace{2ex}%
}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\tocdataartisttextprint} \marg{text}
%
% User-redefinable macro to print the optional text below the artist's name.
%
%
% \begin{macrocode}
\newcommand{\tocdataartisttextprint}{\TDartistauthortextprint{artist}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tocdataauthortextprint} \marg{text}
%
% User-redefinable macro to print the optional text below the author's name.
%
% \begin{macrocode}
\newcommand{\tocdataauthortextprint}{\TDartistauthortextprint{author}}
% \end{macrocode}
% \end{macro}
%
%
%
% \subsubsection{Chapters and sections}
%
%
% With \pkg{book} or \pkg{report} classes,
% a starred \cs{part}'s name is printed on its own page,
% \watchout[\cs{part*}]
% making it difficult to add an author's name. If the author's name
% is appended to the part's name, it also appears in name references as well.
% Thus, if using one of these classes and a starred \cs{part}, the author's name is not
% printed.
% Using an unstarred \cs{part} with an author's name does work as expected.
% The author's name is printed as part of the long name,
% but does not appear in the name reference, which uses the short name.
%
% \begin{macro}{\TD@starredsectionauthorprint} \marg{author's name}
% \changes{v2.03}{2019/07/04}{No author for \cs{part*} in \pkg{book} class.}
% \begin{macrocode}
\@ifclassloaded{article}
{
\newcommand*{\TD@starredsectionauthorprint}[5]{%
\unskip\medskip\csuse{tocdata#1print}{#2}{#3}{#4}{#5}\par%
\bigskip%
}
}
{
\newcommand*{\TD@starredsectionauthorprint}[5]{%
\ifstrequal{#1}{part}%
{%
\PackageWarning{tocdata}{%
The author's name will not be printed for\MessageBreak
the starred \protect\part%
}
}%
{%
\unskip\medskip\csuse{tocdata#1print}{#2}{#3}{#4}{#5}\par%
\bigskip%
}%
}
}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\TD@sectionauthor}
% \marg{1: section type}
% *
% \oarg{3: \TOC\ entry} \marg{4: title}
% \oarg{5: prefix} \marg{6: first} \marg{7: last} \oarg{8: suffix}
%
% \changes{v0.12}{2016/11/28}{Expands first name before index check.}
% \changes{v2.00}{2019/03/15}{Improved page breaks.}
% \changes{v2.00}{2019/03/15}{Factored.}
% \changes{v2.02}{2019/03/21}{Fix: Sectioning name formatting.}
% \changes{v2.03}{2019/06/30}{Fix: Starred sectioning name formatting and labels.}
% \begin{macrocode}
\NewDocumentCommand{\TD@sectionauthor}{m s o m O{} m m O{}}{%
% \end{macrocode}
% The starred version does not create a \acro{TOC} entry,
% so it is simply used as-is:
% \begin{macrocode}
\IfBooleanTF{#2}%
{% star:
\csuse{#1}*{#4}%
\TD@starredsectionauthorprint{#1}{#5}{#6}{#7}{#8}%
}%
% \end{macrocode}
% The un-starred version appears in the \acro{TOC}, so add the author's name:
% \begin{macrocode}
{% no star:
\tocdata{toc}{#6 #7}%
% \end{macrocode}
% Create the section depending on the optional name:
% \begin{macrocode}
\IfValueTF{#3}%
{\csuse{#1}[#3]{#4\nopagebreak\csuse{tocdata#1print}{#5}{#6}{#7}{#8}}}%
{\csuse{#1}[#4]{#4\nopagebreak\csuse{tocdata#1print}{#5}{#6}{#7}{#8}}}%
}% no star
% \end{macrocode}
% Create an index entry depending on whether there is a first name:
% \begin{macrocode}
\ifblank{#6}%
{\index{#7}}%
{\index{#7, #6}}%
}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\partauthor} * \oarg{2: \TOC\ entry} \marg{3: title}
% \oarg{4: prefix} \marg{5: first} \marg{6: last} \oarg{7: suffix}
%
% \changes{v2.00}{2019/03/15}{Added.}
%
% \begin{macrocode}
\newcommand*{\partauthor}{\TD@sectionauthor{part}}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\chapterauthor} * \oarg{2: \TOC\ entry} \marg{3: title}
% \oarg{4: prefix} \marg{5: first} \marg{6: last} \oarg{7: suffix}
%
% \begin{macrocode}
\@ifundefined{chapter}
{}% if no chapters
{% only of chapters exists in this documentclass:
\newcommand*{\chapterauthor}{\TD@sectionauthor{chapter}}
}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\sectionauthor} * \oarg{2: \TOC\ entry} \marg{3: title}
% \oarg{4: prefix} \marg{5: first} \marg{6: last} \oarg{7: suffix}
%
% \begin{macrocode}
\newcommand*{\sectionauthor}{\TD@sectionauthor{section}}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\subsectionauthor} * \oarg{2: \TOC\ entry} \marg{3: title}
% \oarg{4: prefix} \marg{5: first} \marg{6: last} \oarg{7: suffix}
%
% \changes{v2.00}{2019/03/15}{Added.}
%
% \begin{macrocode}
\newcommand*{\subsectionauthor}{\TD@sectionauthor{subsection}}
% \end{macrocode}
% \end{macro}
%
%
%
% \subsubsection{Figure artist name alignment}
%
% \changes{v2.00}{2019/03/14}{Replaced \cs{tdnameX} with
% \cs{tdauthorX} and \cs{tdartistX}.}
%
% \begin{macro}{\TD@artistalign} Sets text alignment for the artist's name.
% \begin{macrocode}
\newcommand{\TD@artistalign}{\centering}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tdartistjustify} Sets justified text alignment for the artist's name.
% \changes{v0.12}{2016/11/30}{etc. Added name alignment.}
% \begin{macrocode}
\newcommand{\tdartistjustify}{%
\renewcommand{\TD@artistalign}{}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tdartistcenter} Sets centered text alignment for the artist's name.
% \begin{macrocode}
\newcommand{\tdartistcenter}{%
\renewcommand{\TD@artistalign}{\centering}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tdartistleft} Sets left text alignment for the artist's name.
% \begin{macrocode}
\newcommand{\tdartistleft}{%
\renewcommand{\TD@artistalign}{\raggedright}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tdartistright} Sets right text alignment for the artist's name.
% \begin{macrocode}
\newcommand{\tdartistright}{%
\renewcommand{\TD@artistalign}{\raggedleft}%
}
% \end{macrocode}
% \end{macro}
%
%
% \subsubsection{Figure author name alignment}
%
% \begin{macro}{\TD@authoralign} Sets text alignment for the author's name.
% \begin{macrocode}
\newcommand{\TD@authoralign}{\raggedleft}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tdauthorjustify} Sets justified text alignment for the author's name.
% \changes{v0.12}{2016/11/30}{etc. Added name alignment.}
% \begin{macrocode}
\newcommand{\tdauthorjustify}{%
\renewcommand{\TD@authoralign}{}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tdauthorcenter} Sets centered text alignment for the author's name.
% \begin{macrocode}
\newcommand{\tdauthorcenter}{%
\renewcommand{\TD@authoralign}{\centering}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tdauthorleft} Sets left text alignment for the author's name.
% \begin{macrocode}
\newcommand{\tdauthorleft}{%
\renewcommand{\TD@authoralign}{\raggedright}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tdauthorright} Sets right text alignment for the author's name.
% \begin{macrocode}
\newcommand{\tdauthorright}{%
\renewcommand{\TD@authoralign}{\raggedleft}%
}
% \end{macrocode}
% \end{macro}
%
%
% \subsubsection{Figure artist text alignment}
%
% \begin{macro}{\TD@artisttextalign} Sets text alignment in the optional text.
% \begin{macrocode}
\newcommand{\TD@artisttextalign}{\centering}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tdartisttextjustify} Sets justified text alignment in the optional text.
% \changes{v0.12}{2016/11/30}{etc. Added text alignment.}
% \begin{macrocode}
\newcommand{\tdartisttextjustify}{%
\renewcommand{\TD@artisttextalign}{}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tdartisttextcenter} Sets centered text alignment in the optional text.
% \begin{macrocode}
\newcommand{\tdartisttextcenter}{%
\renewcommand{\TD@artisttextalign}{\centering}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tdartisttextleft} Sets left text alignment in the optional text.
% \begin{macrocode}
\newcommand{\tdartisttextleft}{%
\renewcommand{\TD@artisttextalign}{\raggedright}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tdartisttextright} Sets right text alignment in the optional text.
% \begin{macrocode}
\newcommand{\tdartisttextright}{%
\renewcommand{\TD@artisttextalign}{\raggedleft}%
}
% \end{macrocode}
% \end{macro}
%
%
% \subsubsection{Figure author text alignment}
%
% \begin{macro}{\TD@authortextalign} Sets text alignment in the optional text.
% \begin{macrocode}
\newcommand{\TD@authortextalign}{\centering}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tdauthortextjustify} Sets justified text alignment in the optional text.
% \changes{v0.12}{2016/11/30}{etc. Added text alignment.}
% \begin{macrocode}
\newcommand{\tdauthortextjustify}{%
\renewcommand{\TD@authortextalign}{}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tdauthortextcenter} Sets centered text alignment in the optional text.
% \begin{macrocode}
\newcommand{\tdauthortextcenter}{%
\renewcommand{\TD@authortextalign}{\centering}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tdauthortextleft} Sets left text alignment in the optional text.
% \begin{macrocode}
\newcommand{\tdauthortextleft}{%
\renewcommand{\TD@authortextalign}{\raggedright}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tdauthortextright} Sets right text alignment in the optional text.
% \begin{macrocode}
\newcommand{\tdauthortextright}{%
\renewcommand{\TD@authortextalign}{\raggedleft}%
}
% \end{macrocode}
% \end{macro}
%
%
%
% \subsubsection{Figure captions with artists and authors}
%
% These macros adds optional supplemental text, which will be printed below the
% artist's name and above the caption, presuming that the caption is generated
% below the figure.
%
% If using the optional prefix, the optional text must also be given, even if it
% \watchout[Optional arguments]
% is empty. For example, use:
% \begin{sourcedisplay}
% \cs{captionartist}\{Title\}\textcolor{red}{[]}[Sir]\{Isaac\}\{Newton\}
% \end{sourcedisplay}
% If only one optional argument is given before the first name, it will be
% interpreted as the optional text, not as the optional prefix.
%
%
% \begin{macro}{\TD@captionartistauthor}
% \marg{1: "artist" or "author"}
% *
% \oarg{3: \LOF\ entry} \marg{4: title}
% \oarg{5: supplemental text} \\
% \oarg{6: prefix} \marg{7: first} \marg{8: last} \oarg{9: suffix}
%
% Factored from \cs{captionartist} and \cs{captionauthor}, below.
%
% \changes{v0.12}{2016/11/28}{Allows paragraphs in add'l text.}
% \changes{v0.12}{2016/11/28}{Expands first name before index check.}
% \changes{v2.00}{2019/03/15}{Factored.}
%
% \begin{macrocode}
\NewDocumentCommand{\TD@captionartistauthor}{m s o m +O{} O{} m m O{}}{%
% \end{macrocode}
%
% Print the artist's name next to the figure:
% \begin{macrocode}
\csuse{tocdata#1print}{#6}{#7}{#8}{#9}%
% \end{macrocode}
% If supplemental text is provided, print it below the author:
% \begin{macrocode}
\ifblank{#5}%
{}%
{\par\csuse{tocdata#1textprint}{#5}}%
% \end{macrocode}
% Remove any existing vertical space and only use \cs{caption}'s built-in spacing:
% \begin{macrocode}
\unskip%
% \end{macrocode}
% If starred, there should be no \acro{TOC} entry, so do not add tocdata.
% Use \cs{caption*} from the \pkg{caption} or similar packages.
% \begin{macrocode}
\IfBooleanTF{#2}%
{% starred
\IfValueTF{#3}{\caption*[#3]{#4}}{\caption*{#4}}%
}% starred
{% not starred
% \end{macrocode}
% No starred, so remember the artist's name for inclusion in the \acro{LOF}:
% \changes{v2.00}{2019/03/14}{Added support for new float types.}
% \begin{macrocode}
\tocdata{\csuse{ext@\@captype}}{#7 #8}%
% \end{macrocode}
% Create the caption depending on the optional name:
% \begin{macrocode}
\IfValueTF{#3}{\caption[#3]{#4}}{\caption{#4}}%
}% not starred
% \end{macrocode}
% Create an index entry depending on whether there is a first name:
% \begin{macrocode}
\ifblank{#7}%
{\index{#8}}%
{\index{#8, #7}}%
}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\captionartist} * \oarg{2: \LOF\ entry} \marg{3: title}
% \oarg{4: supplemental text}
% \oarg{5: prefix} \marg{6: first} \\
% \marg{7: last} \oarg{8: suffix}
%
% \begin{macrocode}
\newcommand*{\captionartist}{\TD@captionartistauthor{artist}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\captionauthor} * \oarg{2: \LOF\ entry} \marg{3: title}
% \oarg{4: supplemental text}
% \oarg{5: prefix} \marg{6: first} \\
% \marg{7: last} \oarg{8: suffix}
%
% \begin{macrocode}
\newcommand*{\captionauthor}{\TD@captionartistauthor{author}}
% \end{macrocode}
% \end{macro}
%
%
% \begin{illustration}
% \setlength{\fboxsep}{0pt}
% \centering
% \fbox{\includegraphics[width=4in]{lacquer_go_board.jpg}}
% \captionartist{Lacquer Go Board}[From the series \textit{Uma Zukushi}.]{Katsushika}{Hokusai}
% \end{illustration}
%
%
%
%
%
%
% ^^A At end:
%
% \clearpage
% ^^A \pagestyle{plain}
% \phantomsection
% \tocdata{toc}{\prog{makeindex}}
% \addcontentsline{toc}{section}{Change History and \indexname}
%
% \pagestyle{plain}
%
% \Finale
\endinput
|