summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/nameauth/examples.tex
blob: c9e41e6eab940b968e986ecc725a7e7e9609c36a (plain)
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
%%
%% This is file `examples.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% nameauth.dtx  (with options: `examples')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2020 by Charles P. Schaum <charles[dot]schaum@comcast.net>
%% 
%% This file 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.
%% 

\documentclass[oneside]{article}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Backward compatibility for older distributions of LaTeX.
%
% Include the iftex package only if it exists. If the iftex
% package is older than 2019, include additional packages
% that aid using multiple LaTeX engines.
%
\IfFileExists{iftex.sty}{\usepackage{iftex}}{}
\unless\ifdefined\RequireTUTeX
  \usepackage{ifxetex}
  \usepackage{ifluatex}
  \usepackage{ifpdf}
\fi
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Compatibility for multiple LaTeX engines.
%
\ifxetex
  \usepackage{fontspec}
  \usepackage{polyglossia}
  \setdefaultlanguage{american}
\else
  \ifluatex
    \ifpdf
      \usepackage{fontspec}
      \usepackage{polyglossia}
      \setdefaultlanguage{american}
    \else
      \IfFileExists{utf8-2018.def}{}
      {\usepackage[utf8]{inputenc}}
      \usepackage[TS1,T1]{fontenc}
      \usepackage[american]{babel}
      \usepackage{lmodern}
    \fi
  \else
    \IfFileExists{utf8-2018.def}{}
    {\usepackage[utf8]{inputenc}}
    \usepackage[TS1,T1]{fontenc}
    \usepackage[american]{babel}
    \usepackage{lmodern}
  \fi
\fi
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Remainder of package inclusions
%
\usepackage[textwidth=137mm,textheight=237mm,
            right=25mm,marginparwidth=39mm,nohead]{geometry}
\usepackage{booktabs}
\usepackage{colortbl}
\usepackage{index}
\usepackage{nameauth}[2020/11/23]
\usepackage{verbatim}
\usepackage{xcolor}
\colorlet{grey}{black!7!white}
\usepackage[colorlinks=true]{hyperref}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% We set up indexing, put margin paragraphs on the left,
% and set up the counter for line numbering in verbatim
% environments.
%
\makeindex
\newindex{per}{rdx}{rnd}{Index of Persons}
\renewcommand\NameauthIndex{\index[per]}
\reversemarginpar
\newcounter{VerbLine}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Global definitions of conditionals for examples
% For Scipio Africanus
\newif\ifSkipGens
\newif\ifNoGens
\newif\ifSkipAgnomen
\newif\ifNoAgnomen
% For Thomas Jefferson
\newif\ifGenitive
\newif\ifDoGen
% For George Washington/Mustafa Kemal
\newif\ifNoTag
% For William Shakespeare
\newif\ifSpecialFN
\newif\ifSpecialSN
\newif\ifRevertSN
% For advanced hooks
\newif\ifFbox
\newif\ifFirstCap
\newif\ifInHook
\Fboxtrue
\newif\ifCaps
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Global definitions of macros for examples
% For Scipio Africanus
\newcommand*\SCIPi{\ifNoGens
                    Publius\else Publius Cornelius\fi}
\newcommand*\SCIPii{\ifNoAgnomen
                     Scipio\else Scipio Africanus\fi}
\newcommand*\ScipioOnly{\SkipAgnomentrue\Scipio}
\newcommand*\CSA{\ifNoGens\ifNoAgnomen
                   Scipio\else
                   Scipio Africanus\fi
                 \else\ifNoAgnomen
                   Cornelius Scipio\else
                   Cornelius Scipio Africanus\fi\fi}
\ExcludeName[Publius]{\noexpand\CSA}
% For Thomas Jefferson
\newcommand\JEFF{\ifDoGen\textSC{Jefferson's}\else\textSC{Jefferson}\fi}
% For William Shakespeare
\newcommand*\WM{\ifSpecialFN Wm.\else William\fi}
\newcommand*\SHK{\ifRevertSN \textSC{Shakespeare}\else
                 \ifSpecialSN \noexpand\AltCaps{t}he Bard\else
                 \textSC{Shakespeare}\fi\fi}
\newcommand*\Revert{\RevertSNtrue}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% We include a few macros from ltxdoc.cls and doc.sty.
% These are copyright by the LaTeX dev team.
%
\makeatletter
\DeclareRobustCommand\meta[1]{%
     \ensuremath\langle
     \ifmmode \expandafter \nfss@text \fi
     {%
      \meta@font@select
      \edef\meta@hyphen@restore
        {\hyphenchar\the\font\the\hyphenchar\font}%
      \hyphenchar\font\m@ne
      \language\l@nohyphenation
      #1\/%
      \meta@hyphen@restore
     }\ensuremath\rangle
}
\def\meta@font@select{\itshape}
\def\cmd#1{\cs{\expandafter\cmd@to@cs\string#1}}
\def\cmd@to@cs#1#2{\char\number`#2\relax}
\DeclareRobustCommand\cs[1]{\texttt{\char`\\#1}}
\providecommand\marg[1]{%
  {\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}}
\providecommand\oarg[1]{%
  {\ttfamily[}\meta{#1}{\ttfamily]}}
\providecommand\parg[1]{%
  {\ttfamily(}\meta{#1}{\ttfamily)}}
\makeatother
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% We establish name shorthands. Note the heavy use of \noexpand
% in the macro arguments below. This is intrinsic to the proper
% function of such arguments (advanced alternate formatting).
%
\begin{nameauth}
 \< Adams & John & \noexpand\textSC{Adams} & >
 \< SDJR & Sammy & \noexpand\textSC{Davis}, \noexpand\textSC{Jr}. & >
 \< Dem & & Demetrius, I & >
 \< deSmet & Pierre-Jean & \noexpand\Fbox{\noexpand\AltCaps{d}e~Smet} & >
 \< HAR & & Harun, \noexpand\textSC{\noexpand\AltCaps{a}l-Rashid} & >
 \< Harnack & Adolf & Harnack & >
 \< Jeff & Thomas & \noexpand\JEFF & >
 \< Mencius & & \noexpand\textSC{Mencius} & >
 \< Scipio & \noexpand\SCIPi & \noexpand\SCIPii & >
 \< OScipio & Publius & \noexpand\CSA & >
 \< Shak & \noexpand\WM & \noexpand\SHK & >
 \< Sutorius & Quintus & \noexpand\SUTOR & >
 \< Wash & George & Washington & >
\end{nameauth}
%
% We could add name info database tags (text tags) either
% in the preamble or in the document environment. We will do
% the latter in this example file.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Below we establish sort tags for names. We also can do that
% later on in the body text. Note again the consistent use of
% \noexpand with alternate formatting.
%
\PretagName[John]{\noexpand\textSC{Adams}}{Adams, John}
\PretagName[Sammy]{\noexpand\textSC{Davis}, \noexpand\textSC{Jr}.}{Davis, Sammy, Jr.}
\PretagName{Demetrius, I}{Demetrius 1}
\PretagName[Pierre-Jean]{\noexpand\Fbox{\noexpand\AltCaps{d}e~Smet}}{de~Smet, Pierre-Jean}
\PretagName{Harun, \noexpand\textSC{\noexpand\AltCaps{a}l-Rashid}}{Harun al-Rashid}
\PretagName[Thomas]{\noexpand\JEFF}{Jefferson, Thomas}
\PretagName{\noexpand\textSC{Mencius}}{Mencius}
\PretagName{\noexpand\textSC{Meng}, Ke}{Meng Ke}
\PretagName[\noexpand\SCIPi]{\noexpand\SCIPii}{Scipio Africanus}
\PretagName[Publius]{\noexpand\CSA}{Cornelius Scipio Africanus}
\PretagName[Quintus]{\noexpand\SUTOR}{Naevius Sutorius}
\PretagName[\noexpand\WM]{\noexpand\SHK}{Shakespeare, William}
\PretagName{Vlad, Ţepeş}{Vlad Tepes}
\TagName[John]{\noexpand\textSC{Adams}}{, president}
\TagName{Demetrius, I}{ Soter, king}
\TagName[Thomas]{\noexpand\JEFF}{, president}
\TagName{Vlad, II}{ Dracul}
\TagName{Vlad, III}{ Dracula}
\TagName[Martin]{Van Buren}{, president}
\TagName[Ulysses S.]{Grant}{, president}
\TagName[George]{Washington}{, president}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% We set up line numbering in verbatim environments.
%
\makeatletter
\newcommand*\ClearNum{\def\verbatim@processline{\the\verbatim@line\par}}
\newcommand*\StartNum{\setcounter{VerbLine}{0}\def\verbatim@processline{\stepcounter{VerbLine}\leavevmode\llap{\footnotesize\normalfont\theVerbLine\quad}\the\verbatim@line\par}}
\newcommand*\ContinueNum{\def\verbatim@processline{\stepcounter{VerbLine}\leavevmode\llap{\footnotesize\normalfont\theVerbLine\quad}\the\verbatim@line\par}}
\makeatother
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The default verbatim format is no line numbers.
% We add title, author, and date.
%
\ClearNum
\title{\bfseries Longer Examples}
\author{Charles P. Schaum}
\date{2020/11/23}

\begin{document}
\maketitle

\phantomsection
\pdfbookmark[1]{\contentsname}{toc}
\tableofcontents
\newpage

\section{Particles}

First we use variants with the \meta{Alternate} argument:

\NameAddInfo{Demetrius, I}{ Soter}
\begin{quote}\small
\StartNum
\begin{verbatim}
\NameAddInfo{Demetrius, I}{ Soter}
\PretagName{Demetrius, I}{Demetrius 1}
\TagName{Demetrius, I}{ Soter, king}
\begin{nameauth}
\< Dem & & Demetrius, I & >
\end{nameauth}
\end{verbatim}

 \smallskip
   \begin{tabular}{ll}\toprule
     \cmd{\Dem[I Soter]} & \Dem[I Soter]\\
     \rowcolor{grey}%
     \cmd{\LDem}         & \LDem\\
     \cmd{\Dem}          & \Dem\\\bottomrule
   \end{tabular}
 \end{quote}

\begingroup%
\makeatletter
\renewcommand*\NamesFormat[1]{%
  \begingroup%
  \protected@edef\temp{\endgroup%
    {#1\noexpand\NameQueryInfo
      [\unexpanded\expandafter{\the\@nameauth@toksa}]
      {\unexpanded\expandafter{\the\@nameauth@toksb}}
      [\unexpanded\expandafter{\the\@nameauth@toksc}]%
    }%
  }%
  \temp%
}
\makeatother
For a more automated approach, we use ``text tags'':

\begin{quote}\small
\ContinueNum
\begin{verbatim}
\makeatletter
\makeatletter
\renewcommand*\NamesFormat[1]{%
  \begingroup%
  \protected@edef\temp{\endgroup%
    {#1\noexpand\NameQueryInfo
      [\unexpanded\expandafter{\the\@nameauth@toksa}]
      {\unexpanded\expandafter{\the\@nameauth@toksb}}
      [\unexpanded\expandafter{\the\@nameauth@toksc}]%
    }%
  }%
  \temp%
}
\makeatother
\end{verbatim}

\smallskip
  \begin{tabular}{ll}\toprule
    \cmd{\ForgetThis}\cmd{\Dem} & \ForgetThis\Dem\\
    \rowcolor{grey}%
    \cmd{\LDem}                 & \LDem\\
    \cmd{\Dem}                  & \Dem\\\bottomrule
  \end{tabular}
\end{quote}
\endgroup

\vfil
\noindent And now for something completely different\dots

  We mention the Electric Boogaloo\index{Boogaloo, Electric}
  by \Name{Ollie~\& Jerry}.\\

\noindent The index references made here will put:

  ``Boogaloo, Electric'' in the main index

  and ``\ShowIdxPageref*{Ollie~\& Jerry}'' in the index of names.
\newpage

\section{Roman Names}

 We define all macros and conditionals used in naming macro arguments in the preamble. We use \cmd{\noexpand} in the naming macro arguments to prevent error. Since we do not use \cmd{\CapThis} in the examples below, we skip alternate formatting for simplicity, yet we still recommend it:
 \begin{quote}\small
 \StartNum
 \begin{verbatim}
\newif\ifSkipGens
\newif\ifNoGens
\newif\ifSkipAgnomen
\newif\ifNoAgnomen
\newcommand*\SCIPi{\ifNoGens
                    Publius\else Publius Cornelius\fi}
\newcommand*\SCIPii{\ifNoAgnomen
                     Scipio\else Scipio Africanus\fi}
\newcommand*\ScipioOnly{\SkipAgnomentrue\Scipio}
\begin{nameauth}
  \< Scipio & \noexpand\SCIPi & \noexpand\SCIPii & >
\end{nameauth}
\PretagName[\noexpand\SCIPi]{\noexpand\SCIPii}{Scipio Africanus}\end{verbatim}
 \end{quote}

 We begin a new scope below, redefining the formatting hooks, which affect only names printed in the text. If the local Boolean flags are false, one gets longer name forms. If the flags are true, one gets shorter forms. This approach allows the global state of the flags to be false by default, meaning that one need not remember to set any of them true in the preamble. That results in one less thing to remember, and one less problem to fix.
\begingroup
\renewcommand*\NamesFormat[1]
  {\ifSkipGens\NoGenstrue\fi\ifSkipAgnomen\NoAgnomentrue\fi#1%
  \global\SkipGensfalse\global\SkipAgnomenfalse}
\renewcommand*\MainNameHook[1]
  {\ifSkipGens\NoGenstrue\fi\ifSkipAgnomen\NoAgnomentrue\fi#1%
  \global\SkipGensfalse\global\SkipAgnomenfalse}
 \begin{quote}\small
 \ContinueNum
 \begin{verbatim}
\renewcommand*\NamesFormat[1]
  {\ifSkipGens\NoGenstrue\fi\ifSkipAgnomen\NoAgnomentrue\fi#1%
  \global\SkipGensfalse\global\SkipAgnomenfalse}
\renewcommand*\MainNameHook[1]
  {\ifSkipGens\NoGenstrue\fi\ifSkipAgnomen\NoAgnomentrue\fi#1%
  \global\SkipGensfalse\global\SkipAgnomenfalse}\end{verbatim}
 \end{quote}

 The index always shows the name determined by the global state of \cmd{\NoGens} and \cmd{\NoAgnomen}, which we set up as false, meaning a maximally long name form. In the body text we have:
 \begin{quote}\small
 \ForgetThis\ScipioOnly\ \cmd{\ScipioOnly} was born around 236 \textsc{bc} into the Scipio branch of the Cornelius clan, one of six large patrician clans. \ScipioOnly\ \cmd{\ScipioOnly} rose to military fame during the Second Punic War. Thereafter he was known as \Scipio\ \cmd{\Scipio}.
 \end{quote}

 Below we show more information about popular name forms by way of comparison with scholarly name forms.\medskip

 The \textit{Oxford Classical Dictionary} and other scholarly sources index according to the \textit{nomen}. That approach moves the \textit{nomen} from \meta{FNN} to \meta{SNN}.

 The two methods do not clash \textit{per se} in the text, but they make incompatible index entries. In this case, since we have indexed \ScipioOnly\ under the popular form above, we use \cmd{\ExcludeName} to exclude the scholarly form below.

 In the document preamble we define the following Boolean flags and macros. We use a nested conditional in \meta{SNN}. The default still is to show all names so that they can be indexed that way:
 \begin{quote}\small
 \StartNum
 \begin{verbatim}
\newif\ifSkipGens % These flags remain the same as above.
\newif\ifNoGens
\newif\ifSkipAgnomen
\newif\ifNoAgnomen
\global\def\CSA{\ifNoGens\ifNoAgnomen
                  Scipio\else
                  Scipio Africanus\fi
                \else\ifNoAgnomen
                  Cornelius Scipio\else
                  Cornelius Scipio Africanus\fi\fi}
\ExcludeName[Publius]{\noexpand\CSA}
\begin{nameauth}
  \< OScipio & Publius & \noexpand\CSA & > % O for Oxford
\end{nameauth}
\PretagName[Publius]{\noexpand\CSA}{Cornelius Scipio Africanus}\end{verbatim}
 \end{quote}

 We keep the same formatting macros that we defined above. By the way, these formatting macros could work with regular names as well as Roman names, e.g., \LDem, because they have no side effects.

 The scholarly form of Roman names has a different name pattern, so it is not compatible with the popular version. Nevertheless, we show what the index entries would be in a normal \LaTeX\ document without hyperlinks:
 \begin{quote}\small\IndexActual{@}
   \textbf{Simplified Name Patterns:}\\
   Scholarly: \texttt{\ShowPattern[Publius]{\noexpand\CSA}}\\
   \setbox0\hbox{Scholarly:}\hbox to \wd0{Popular:\hfill} \texttt{\ShowPattern[\noexpand\SCIPi]{\noexpand\SCIPii}}\\

   \textbf{Full Index Entries:}
   \UntagName[Publius]{\noexpand\CSA}
   \UntagName[\noexpand\SCIPi]{\noexpand\SCIPii}\\
   Scholarly:\\ \hbox{}\quad\texttt{\ShowIdxPageref[Publius]{\noexpand\CSA}}\\
   Popular:\\ \hbox{}\quad\texttt{\ShowIdxPageref[\noexpand\SCIPi]{\noexpand\SCIPii}}
   \TagName[Publius]{\noexpand\CSA}{\string|hyperpage}
   \TagName[\noexpand\SCIPi]{\noexpand\SCIPii}{\string|hyperpage}\\

   \textbf{Basic Index Entries:}\\
   \UntagName[Publius]{\noexpand\CSA}
   Scholarly:\\ \hbox{}\quad\ShowIdxPageref*[Publius]{\noexpand\CSA}\\
   Popular:\\ \hbox{}\quad\ShowIdxPageref*[\noexpand\SCIPi]{\noexpand\SCIPii}
 \end{quote}

 Below we compare some differences between the scholarly and popular forms, and how to get equivalent forms in the text while understanding that they would be two separate forms in the index.
 \begin{center}\small
 \begin{tabular}{p{0.51\textwidth}@{\ \ }l}
   \multicolumn{2}{l}{\textbf{First use:}}\\
   scholarly:\dotfill \cmd{\OScipio} & \OScipio\\
   popular:\dotfill \cmd{\Scipio} & \ForgetThis\Scipio\\[2ex]

   \multicolumn{2}{l}{\textbf{Subsequent use:}}\\
   scholarly:\dotfill \cmd{\OScipio} & \OScipio\\
   scholarly:\dotfill \cmd{\SkipGenstrue}\cmd{\OScipio} & \SkipGenstrue\OScipio\\
   popular:\dotfill \cmd{\Scipio} & \SkipGenstrue\Scipio\\[2ex]

   \multicolumn{2}{l}{\textbf{Subsequent use, full, no \textit{agnomen}:}}\\
   scholarly:\dotfill \cmd{\SkipAgnomentrue}\cmd{\LOScipio} & \SkipAgnomentrue\LOScipio\\
   popular:\dotfill \cmd{\SkipAgnomentrue}\cmd{\LScipio} & \SkipAgnomentrue\LScipio\\[2ex]

   \multicolumn{2}{l}{\textbf{Subsequent use, shortest forms:}}\\
   scholarly:\dotfill \cmd{\SkipAgnomentrue}\cmd{\OScipio} & \SkipAgnomentrue\OScipio\\
   \hfill\cmd{\SkipGenstrue}\cmd{\SkipAgnomentrue}\cmd{\OScipio} & \SkipGenstrue\SkipAgnomentrue\OScipio\\
   popular:\dotfill \cmd{\SkipAgnomentrue}\cmd{\Scipio\ } & \SkipAgnomentrue\Scipio\\[2ex]

   \multicolumn{2}{l}{\textbf{Subsequent use, personal name:}}\\
   scholarly:\dotfill \cmd{\SOScipio} & \SOScipio\\
   popular:\dotfill \cmd{\SScipio} & \SScipio\\
   popular:\dotfill \cmd{\SkipGenstrue}\cmd{\SScipio} & \SkipGenstrue\SScipio
 \end{tabular}
 \end{center}
 \endgroup
\newpage

\section{Inflected Name Forms}

\begingroup
Below we use alternate formatting, sort index entries, and set up a cross-reference, then redefine the hook macros locally.
\AltFormatActive
 \renewcommand*\NamesFormat[1]{\ifGenitive\DoGentrue\fi#1\global\Genitivefalse}
 \renewcommand*\MainNameHook[1]{\ifGenitive\DoGentrue\fi\AltOff#1\global\Genitivefalse}
 \begin{quote}\small
 \StartNum
 \begin{verbatim}
\begin{nameauth}
 \< Jeff & Thomas & \noexpand\JEFF & >
\end{nameauth}
\PretagName[Thomas]{\noexpand\JEFF}{Jefferson, Thomas}
\TagName[Thomas]{\noexpand\JEFF}{, president}
\renewcommand*\NamesFormat[1]
  {\ifGenitive\DoGentrue\fi#1\global\Genitivefalse}
\renewcommand*\MainNameHook[1]
  {\ifGenitive\DoGentrue\fi\AltOff#1\global\Genitivefalse}

Consider \Genitivetrue\Jeff\ legacy. More on \Jeff\ later.
\Genitivetrue\Jeff\ reputation has declined in recent decades.
\end{verbatim}

 \smallskip
 Consider \Genitivetrue\Jeff\ legacy. More on \Jeff\ later.
 \Genitivetrue\Jeff\ reputation has declined in recent decades.
 \end{quote}
\AltFormatInactive
\endgroup
\newpage

\section{Example Reference Work}

Below we use alternate formatting, sort index entries, set up a cross-reference, and define a reference article macro:

\AltFormatActive
\PretagName[Greta]{\textSC{Garbo}}{Garbo, Greta}
\PretagName{\textSC{Misora}, Hibari}{Misora Hibari}
\PretagName[Heinz]{\textSC{Rühmann}}{Ruehmann, Heinz}
\PretagName[Heinrich Wilhelm]{\textSC{Rühmann}}%
  {Ruehmann, Heinrich Wilhelm}
\IndexRef[Heinrich Wilhelm]{\textSC{Rühmann}}%
  {\textSC{Rühmann}, Heinz}%
\newcommand{\RefArticle}[3]{%
  \def\check{#2}%
  \ifx\check\empty
    \noindent\ForgetThis#1\ #3
  \else
    \noindent\ForgetThis#1\ #2\ #3
  \fi
}
\begin{quote}\small
\StartNum
\begin{verbatim}
\AltFormatActive
\PretagName[Greta]{\textSC{Garbo}}{Garbo, Greta}
\PretagName{\textSC{Misora}, Hibari}{Misora Hibari}
\PretagName[Heinz]{\textSC{Rühmann}}{Ruehmann, Heinz}
\PretagName[Heinrich Wilhelm]{\textSC{Rühmann}}%
  {Ruehmann, Heinrich Wilhelm}
\IndexRef[Heinrich Wilhelm]{\textSC{Rühmann}}%
  {\textSC{Rühmann}, Heinz}%
\newcommand{\RefArticle}[3]{%
  \def\check{#2}%
  \ifx\check\empty
    \noindent\ForgetThis#1\ #3
  \else
    \noindent\ForgetThis#1\ #2\ #3
  \fi
}
\end{verbatim}
\end{quote}

\cmd{\RefArticle} prints only the first and third arguments if the second is empty, else it prints all three. We determine what those arguments mean by including specific naming macros. That includes using \cmd{\RevComma} for Western names, but not for Eastern ones.

\begin{quote}\small
\ContinueNum
\begin{verbatim}
\RefArticle
  {\RevComma\Name[Greta]{\textSC{Garbo}}}
  {}
  {(18 September 1905\,--\,15 April 1990) was a Swedish
   film actress during the 1920s and 1930s.}

\RefArticle
  {\Name{\textSC{Misora}, Hibari}}
  {}
  {(W: ``\RevName\Name*{\textSC{Misora}, Hibari}'';
   29 May 1937\,--\,24 June 1989) was a Japanese singer
   and actress noted for her positive message.}

\RefArticle
  {\RevComma\Name[Heinrich Wilhelm]{\textSC{Rühmann}}}
  {``\SubvertThis\ForceName\FName[Heinz]{\textSC{Rühmann}}''}
  {(7 March 1902\,--\,3 October 1994) was a German actor
   in over 100 films.}
\AltFormatInactive
\end{verbatim}
\end{quote}

\begin{quote}\small
\RefArticle
  {\RevComma\Name[Greta]{\textSC{Garbo}}}
  {}
  {(18 September 1905\,--\,15 April 1990) was a Swedish
   film actress during the 1920s and 1930s.}

\RefArticle
  {\Name{\textSC{Misora}, Hibari}}
  {}%
  {(W: ``\RevName\Name*{\textSC{Misora}, Hibari}'';
   29 May 1937\,--\,24 June 1989) was a Japanese singer
   and actress noted for her positive message.}

\RefArticle
  {\RevComma\Name[Heinrich Wilhelm]{\textSC{Rühmann}}}
  {``\SubvertThis\ForceName\FName[Heinz]{\textSC{Rühmann}}''}
  {(7 March 1902\,--\,3 October 1994) was a German actor
   in over 100 films.}
\end{quote}

\AltFormatInactive
\newpage

\section{Beamer MWE}
One must use the macros that control and detect names, otherwise name forms will change as one advances the slides:
\begin{quote}\small
\StartNum
\begin{verbatim}
\documentclass{beamer}
\usepackage{nameauth}
\mode<presentation>
\beamerdefaultoverlayspecification{<+->}

\begin{document}

\begin{frame}{Move Text Without Retyping Names}
  \begin{itemize}\footnotesize
  \item<1-> Original\ForgetName[George]{Washington}%
                    \ForgetName[George]{Washington's}\\
            This version of \Name[Ulysses S.]{Grant} changes.
  \begin{enumerate}
  \item<2-> \IfMainName[George]{Washington's}{He}%
            {\Name[George]{Washington}}
            became the first president
            of the United States.
  \item<3-> \IfMainName[George]{Washington}{His}%
            {\SkipIndex\Name*[George]{Washington's}}
            military successes during the Seven Years War
            readied him to command the army
            of the Continental Congress.
  \end{enumerate}
  \item<1-> Reordered\ForgetName[George]{Washington}%
                     \ForgetName[George]{Washington's}\\
            This version of \ForgetThis\Name[Ulysses S.]{Grant}
            does not change.
  \begin{enumerate}
  \item<3-> \IfMainName[George]{Washington}{His}%
            {\SkipIndex\Name*[George]{Washington's}}
            military successes during the Seven Years War
            readied him to command the army
            of the Continental Congress.
  \item<2-> \IfMainName[George]{Washington's}{He}%
            {\Name[George]{Washington}}
            became the first president
            of the United States.
  \end{enumerate}
  \end{itemize}
\end{frame}

\end{document}
\end{verbatim}
\IndexName[George]{Washington}
\IndexName[Ulysses S.]{Grant}
\end{quote}

The overlays, numbered progressively from one to three, begin by deleting name control sequence patterns. Uncontrolled names will change. Name conditionals ensure specific, context-dependent forms based on what name has appeared. These conditionals allow the text to be order-independent.
\newpage

\section{Hooks: Intro}
\label{sec:Hooksi}

Here we show that something more complex than a font switch can occur in \cmd{\NamesFormat}. Below we put the first mention of a name in boldface, along with a marginal notation if possible.
\begin{quote}\small
\StartNum
\begin{verbatim}
\let\OldFormat\NamesFormat
\renewcommand*\NamesFormat[1]{\textbf{#1}\unless\ifinner
   \marginpar{\raggedleft\scriptsize #1}\fi}
\PretagName{Vlad, Ţepeş}{Vlad Tepes} % for accented names
\TagName{Vlad, II}{ Dracul}          % for index information
\TagName{Vlad, III}{ Dracula}
\end{verbatim}

\medskip Within the document after the preamble:
\let\OldFormat\NamesFormat
\renewcommand*\NamesFormat[1]{\textbf{#1}\unless\ifinner
  \marginpar{\raggedleft\scriptsize #1}\fi}
\ContinueNum
\begin{verbatim}\Name{Vlad, III}[III Dracula], known as
\AKA{Vlad III}{Vlad, Ţepeş} (the Impaler)
after his death, was the son of \Name{Vlad, II}[II Dracul],
a member of the Order of the Dragon. Later references to
``\Name*{Vlad, III}'' and ``\Name{Vlad, III}'' appear thus.
\end{verbatim}

\Name{Vlad, III}[III Dracula], known as
\AKA{Vlad III}{Vlad, Ţepeş} (the Impaler)
after his death, was the son of \Name{Vlad, II}[II Dracul],
a member of the Order of the Dragon. Later references to
``\Name*{Vlad, III}'' and ``\Name{Vlad, III}'' appear thus.

\let\NamesFormat\OldFormat
\begin{verbatim}\let\NamesFormat\OldFormat\end{verbatim}
\end{quote}
Now we have reverted to the default \cmd{\NamesFormat} and we get:
\begin{itemize}
  \item \cmd{\ForgetThis}\cmd{\Name\{Vlad, III\}[III Dracula]}\dotfill \ForgetThis\Name{Vlad, III}[III Dracula]
  \item \cmd{\Name*\{Vlad, III\}}\dotfill \Name*{Vlad, III}
  \item \cmd{\Name\{Vlad, III\}}\dotfill \Name{Vlad, III}
\end{itemize}
We also set up the cross-reference \cmd{\IndexRef\{Dracula\}\{Vlad III\}}\IndexRef{Dracula}{Vlad III}.
\newpage

\section{Hooks: Life Dates}
\label{sec:Hooksii}
\begingroup
Here we add name conditionals and ``text tags'' to add information to names when desired. The example \cmd{\NamesFormat} below adds a text tag to the first occurrences of main-matter names.

Below we use the three token registers available in \textsf{nameauth} to use the name conditional macros. In \cmd{\AKA} these token registers are copies of the \textbf{last} three arguments, corresponding to the pseudonym. We assume that we will not be using the \texttt{alwaysformat} option, meaning that we only call this hook once for a first use of \cmd{\AKA}. We also use a different formatting for the naming macros on the one hand and \cmd{\AKA} on the other:

The first use of a name is in small caps. Text tags are in boldface with naming macros, and roman with \cmd{\AKA}. Just because we set up a cross-reference does not mean that we have to use \cmd{\AKA}. We use \cmd{\ForceName} as needed with \cmd{\AKA}. In the document preamble we set up the following:
\begin{quote}\small
\StartNum
\begin{verbatim}
\newif\ifNoTag
\makeatletter
\renewcommand*\NamesFormat[1]{\begingroup%
  \protected@edef\temp{\endgroup\textsc{#1}%
  \unless\ifNoTag
    \if@nameauth@InName
      {\bfseries\noexpand\NameQueryInfo
      [\unexpanded\expandafter{\the\@nameauth@toksa}]
      {\unexpanded\expandafter{\the\@nameauth@toksb}}
      [\unexpanded\expandafter{\the\@nameauth@toksc}]}\fi
    \if@nameauth@InAKA
      {\normalfont\noexpand\NameQueryInfo
      [\unexpanded\expandafter{\the\@nameauth@toksa}]
      {\unexpanded\expandafter{\the\@nameauth@toksb}}
      [\unexpanded\expandafter{\the\@nameauth@toksc}]}\fi
  \fi}\temp\global\NoTagfalse%
}
\makeatother
\let\FrontNamesFormat\NamesFormat
\end{verbatim}
\end{quote}
\makeatletter
\renewcommand*\NamesFormat[1]{\begingroup%
  \protected@edef\temp{\endgroup\textsc{#1}%
  \unless\ifNoTag
    \if@nameauth@InName
      {\bfseries\noexpand\NameQueryInfo
      [\unexpanded\expandafter{\the\@nameauth@toksa}]
      {\unexpanded\expandafter{\the\@nameauth@toksb}}
      [\unexpanded\expandafter{\the\@nameauth@toksc}]}\fi
    \if@nameauth@InAKA
      {\normalfont\noexpand\NameQueryInfo
      [\unexpanded\expandafter{\the\@nameauth@toksa}]
      {\unexpanded\expandafter{\the\@nameauth@toksb}}
      [\unexpanded\expandafter{\the\@nameauth@toksc}]}\fi
  \fi}\temp\global\NoTagfalse}%
\makeatother
\let\FrontNamesFormat\NamesFormat

We print tags in the first use hooks unless \cmd{\NoTag} is set true. This method uses the two \(\epsilon\)-\TeX{} primitives \cmd{\noexpand} and \cmd{\unexpanded} to avoid repetition of \cmd{\expandafter}. Since \textsf{nameauth} depends on \textsf{etoolbox}, we assume \(\epsilon\)-\TeX.

Before we can refer to any text tags, we must create them. Using the approach above, we include a leading space in the text tags. The leading space is needed only when a text tag appears.\footnote{Another way to add that space is to put it in the conditional path of the formatting hook and leave it out of the text tags entirely: \dots\texttt{\{ \}}\cmd{\noexpand}\cmd{\NameQueryInfo}\dots}
We also set up a cross-reference, which we will use regardless of whether we also use \cmd{\AKA}. The cross-reference will be created only once and skipped thereafter:
\begin{quote}\small
\ContinueNum
\begin{verbatim}
\NameAddInfo[George]{Washington}{ (1732--99)}
\NameAddInfo[Mustafa]{Kemal}{ (1881--1938)}
\NameAddInfo{Atatürk}{ (in 1934, a special surname)}
\IndexRef{Atatürk}{Kemal, Mustafa}
\end{verbatim}
\end{quote}
\NameAddInfo[George]{Washington}{ (1732--99)}
\NameAddInfo[Mustafa]{Kemal}{ (1881--1938)}
\NameAddInfo{Atatürk}{ (in 1934, a special surname)}
\IndexRef{Atatürk}{Kemal, Mustafa}
\pagebreak

Now we begin with the first example, which, after all the setup, looks deceptively simple, but highly reusable without extra work:
\begin{quote}\small
\ContinueNum
\begin{verbatim}
\ForgetThis\Wash held office 1789--97.
No tags: \Wash.\\
First use, dates suppressed: \NoTagtrue\ForgetThis\Wash.\\
Subsequent use with format and dates: \ForceName\Wash.
\end{verbatim}

\smallskip
\ForgetThis\Wash\ held office 1789--97.\\
No tags: \Wash.\\
First use, dates suppressed: \NoTagtrue\ForgetThis\Wash.\\
Subsequent use with format and dates: \ForceName\Wash.
\end{quote}

Since we already set up a cross-reference with \cmd{\IndexRef}, we can use just the the naming macros with ``Atatürk'' and get the desired formatting without any page references in the index:

\begin{quote}\small
\ContinueNum
\begin{verbatim}
\Name[Mustafa]{Kemal} was granted the name
\Name{Atatürk}. We mention \Name[Mustafa]{Kemal}
and \Name{Atatürk} again.

First use, no tag:
\NoTagtrue\ForgetThis\Name{Atatürk}.
\end{verbatim}

\smallskip
\Name[Mustafa]{Kemal} was granted the name
\Name{Atatürk}. We mention \Name[Mustafa]{Kemal}
and \Name{Atatürk} again.

First use, no tag:
\NoTagtrue\ForgetThis\Name{Atatürk}.
\end{quote}

Since we set up distinct formatting for \cmd{\AKA} (\cmd{\normalfont} instead of boldface for text tags associated with cross-references), we now simulate the \texttt{formatAKA} package option and use \cmd{\ForceName} with \cmd{\AKA}:
\begin{quote}\small
\ContinueNum
\begin{verbatim}
\makeatletter\@nameauth@AKAFormattrue\makeatother
\ForgetThis\Name[Mustafa]{Kemal} was granted the name
\ForceName\AKA[Mustafa]{Kemal}{Atatürk}. We mention
\Name[Mustafa]{Kemal} and \AKA[Mustafa]{Kemal}{Atatürk} again.

First use, no tag:
\NoTagtrue\ForceName\AKA[Mustafa]{Kemal}{Atatürk}.
\end{verbatim}

\smallskip
\makeatletter\@nameauth@AKAFormattrue\makeatother
\ForgetThis\Name[Mustafa]{Kemal} was granted the name
\ForceName\AKA[Mustafa]{Kemal}{Atatürk}. We mention
\Name[Mustafa]{Kemal} and \AKA[Mustafa]{Kemal}{Atatürk} again.

First use, no tag:
\NoTagtrue\ForceName\AKA[Mustafa]{Kemal}{Atatürk}.
\end{quote}

We show an alternate part of this example on the next page that does not appear in the manual, but works identically to that above.
\newpage

We change the look of the page reference just to see if it works. Since we are in a local scope, note the use of \cmd{\global}:

\begin{quote}\small
\ContinueNum
\begin{verbatim}
\global\def\fett#1{\textbf{\sffamily #1}}
\TagName[Mustafa]{Kemal}{|fett}
\end{verbatim}
\end{quote}
\global\def\fett#1{\textbf{\sffamily #1}}
\TagName[Mustafa]{Kemal}{|fett}

This version does not use $\epsilon$-\TeX primitives. We ``forget'' names as needed and replay the text on the previous page with the new version:

\makeatletter
\renewcommand*\NamesFormat[1]{%
  \let\ex\expandafter%
  \textsc{#1}%
  \if@nameauth@InName
    \ifNoTag
    \else
      \bfseries%
      \ex\ex\ex\ex\ex\ex\ex\NameQueryInfo\ex\ex\ex\ex\ex\ex\ex[%
      \ex\ex\ex\the\ex\ex\ex\@nameauth@toksa\ex\ex\ex]%
      \ex\ex\ex{\ex\the\ex\@nameauth@toksb\ex}%
      \ex[\the\@nameauth@toksc]%
    \fi\fi
  \if@nameauth@InAKA
    \ifNoTag
    \else
      \normalfont%
      \ex\ex\ex\ex\ex\ex\ex\NameQueryInfo\ex\ex\ex\ex\ex\ex\ex[%
      \ex\ex\ex\the\ex\ex\ex\@nameauth@toksa\ex\ex\ex]%
      \ex\ex\ex{\ex\the\ex\@nameauth@toksb\ex}%
      \ex[\the\@nameauth@toksc]%
    \fi\fi
  \global\NoTagfalse}
\makeatother
\begin{quote}\small
\ContinueNum
\begin{verbatim}
\newif\ifNoTag
\makeatletter
\renewcommand*\NamesFormat[1]{%
  \let\ex\expandafter%
  \textsc{#1}%
  \if@nameauth@InName
    \ifNoTag
    \else
      \bfseries%
      \ex\ex\ex\ex\ex\ex\ex\NameQueryInfo\ex\ex\ex\ex\ex\ex\ex[%
      \ex\ex\ex\the\ex\ex\ex\@nameauth@toksa\ex\ex\ex]%
      \ex\ex\ex{\ex\the\ex\@nameauth@toksb\ex}%
      \ex[\the\@nameauth@toksc]%
    \fi\fi
  \if@nameauth@InAKA
    \ifNoTag
    \else
      \normalfont%
      \ex\ex\ex\ex\ex\ex\ex\NameQueryInfo\ex\ex\ex\ex\ex\ex\ex[%
      \ex\ex\ex\the\ex\ex\ex\@nameauth@toksa\ex\ex\ex]%
      \ex\ex\ex{\ex\the\ex\@nameauth@toksb\ex}%
      \ex[\the\@nameauth@toksc]%
    \fi\fi
  \global\NoTagfalse}
\makeatother
\end{verbatim}

\smallskip
With \cmd{\Name}:\\
\ForgetThis\Name[Mustafa]{Kemal} was granted the name
\ForgetThis\Name{Atatürk}. We mention \Name[Mustafa]{Kemal}
and \Name{Atatürk} again.

First use, no tag: \NoTagtrue\ForgetThis\Name{Atatürk}.\bigskip

With \cmd{\AKA}:\\
\makeatletter\@nameauth@AKAFormattrue\makeatother
\ForgetThis\Name[Mustafa]{Kemal} was granted the name
\ForceName\AKA[Mustafa]{Kemal}{Atatürk}. We mention
\Name[Mustafa]{Kemal} and \AKA[Mustafa]{Kemal}{Atatürk} again.

First use, no tag: \NoTagtrue\ForceName\AKA[Mustafa]{Kemal}{Atatürk}.
\end{quote}

Now we end the scope.
\endgroup
\newpage

\section{Hooks: Advanced}
\label{sec:Hooksiii}
\AltFormatActive
In this section we invoke \cmd{\AltFormatActive} and create several scopes containing respective examples. Some macros in this section  normally should be defined in a document preamble. We define them locally and ensure that names do not use them when they are undefined. This is not best practices, but it makes sense for this manual's need for multiple redefinitions.

\begin{center}\bfseries Continental Format: User-Defined\end{center}
\phantomsection
\begingroup
The user must implement this final step. We use \cmd{\AltFormatActive}, then redefine \cmd{\MainNameHook} to have small caps on by default in the index and first uses in the text, then off in subsequent uses in the text:
\begin{quote}\small
\StartNum
\begin{verbatim}
\renewcommand*\MainNameHook{\AltOff}
\let\FrontNameHook\MainNameHook
\end{verbatim}
\end{quote}
\renewcommand*\MainNameHook{\AltOff}
\let\FrontNameHook\MainNameHook

Usually, we set up the names and any related macros in the preamble:
\begin{quote}\small
\ContinueNum
\begin{verbatim}
\begin{nameauth}
  \< Adams   & John  & \noexpand\textSC{Adams}        & >
  \< SDJR    & Sammy & \noexpand\textSC{Davis},
                       \noexpand\textSC{Jr}.          & >
  \< HAR     &       & Harun, \noexpand\textSC%
                       {\noexpand\AltCaps{a}l-Rashid} & >
  \< Mencius &       & \noexpand\textSC{Mencius}      & >
\end{nameauth}
\end{verbatim}
\end{quote}

Likewise in the preamble, we must ensure that these names are sorted properly in the index. When sorting names, be sure to use \cmd{\noexpand} as well:
\begin{quote}\small
\ContinueNum
\begin{verbatim}
\PretagName[John]{\noexpand\textSC{Adams}}{Adams, John}
\PretagName[Sammy]%
  {\noexpand\textSC{Davis}, \noexpand\textSC{Jr}.}%
  {Davis, Sammy, Jr.}
\PretagName{Harun, \noexpand\textSC%
  {\noexpand\AltCaps{a}l-Rashid}}{Harun al-Rashid}
\PretagName{\noexpand\textSC{Mencius}}{Mencius}
\end{verbatim}
\end{quote}

\begin{center}
\small\noindent\begin{tabular}{llll}\toprule
  First & Next & Long & Short \\\midrule
  \cmd{\Adams} & \cmd{\Adams} & \cmd{\LAdams} & \cmd{\SAdams}\\
  \Adams & \Adams & \LAdams & \SAdams\\
  \rowcolor{grey}\cmd{\SDJR} & \cmd{\SDJR} & \cmd{\LSDJR} & \cmd{\SSDJR}\\
  \rowcolor{grey}\SDJR & \SDJR & \LSDJR & \SSDJR\\
  \cmd{\HAR} & \cmd{\HAR} & \cmd{\LHAR} & \cmd{\SHAR}\\
  \HAR & \HAR & \LHAR & \SHAR\\
  \rowcolor{grey}\cmd{\Mencius} & \cmd{\Mencius} & \cmd{\LMencius} & \cmd{\SMencius}\\
  \rowcolor{grey}\Mencius & \Mencius & \LMencius & \SMencius\\\bottomrule
\end{tabular}
\end{center}

\begin{itemize}\small
  \item Punctuation detection works: \ForceName\LSDJR. Also \LSDJR. Then \ForceName\SDJR. Now \SDJR. (We used \cmd{\ForceName} for formatting.)
  \item \cmd{\ForceName}\cmd{\DropAffix}\cmd{\LSDJR} gives \ForceName\DropAffix\LSDJR. Just \cmd{\DropAffix}\cmd{\LSDJR} gives \DropAffix\LSDJR.
  \item \cmd{\RevComma}\cmd{\LAdams} yields \RevComma\LAdams. All the reversing macros work.
  \item \cmd{\ForceName}\cmd{\ForceFN}\cmd{\SHAR} produces \ForceName\ForceFN\SHAR. \cmd{\ForceFN}\cmd{\SHAR} produces \ForceFN\SHAR. If we add \cmd{\CapThis} we get \CapThis\ForceName\ForceFN\SHAR\ and \CapThis\ForceFN\SHAR.
  \item One must include all the macros in the name arguments.
\end{itemize}

\makeatletter\@nameauth@AKAFormattrue\makeatother
With the \texttt{formatAKA} option we refer to \Mencius\ as \AKA{\noexpand\textSC{Mencius}}{\noexpand\textSC{Meng}, Ke} and \AKA{\noexpand\textSC{Mencius}}{\noexpand\textSC{Meng}, Ke}:
\begin{quote}\small
\ContinueNum
\begin{verbatim}
\PretagName{\noexpand\textSC{Meng}, Ke}{Meng Ke}
\AKA{\noexpand\textSC{Mencius}}{\noexpand\textSC{Meng}, Ke}
\end{verbatim}
\end{quote}
\makeatletter\@nameauth@AKAFormatfalse\makeatother
\endgroup

\begin{center}\bfseries Rolling Your Own: Basic\end{center}
\phantomsection
\begingroup
Here we set out on the path to custom formatting by using package features that have been implemented already.  When redesigning formatting hooks, we recommend using \cmd{\AltFormatActive} or the \texttt{altformat} option to enable alternate formatting and prevent \cmd{\CapThis} from breaking custom formatting macros.

We recommend examining the internal package flag \cmd{\@nameauth@DoAlt}, which activates alternate formatting, \cmd{\@nameauth@DoCaps}, which handles capitalization, and finally \cmd{\@nameauth@InHook}, which is true when the formatting hooks are called. If you create your own macros, they will look similar.

Normally we define a macro for use in name arguments in the document preamble in order to ensure that it is always defined:
\begin{quote}\small
\StartNum
\begin{verbatim}
\makeatletter
\newcommand*\Fbox[1]{%
  \if@nameauth@DoAlt\protect\fbox{#1}\else#1\fi
}
\makeatother
\end{verbatim}
\end{quote}
\makeatletter
\newcommand*\Fbox[1]{%
  \if@nameauth@DoAlt\protect\fbox{#1}\else#1\fi
}
\makeatother

Since \cmd{\AltCaps} is part of \textsf{nameauth}, you need not reinvent that wheel. Just use it. The final step is redefining the hooks, which can be as simple as:
\begin{quote}\small
\ContinueNum
\begin{verbatim}
\renewcommand*\MainNameHook{\AltOff}
\let\FrontNameHook\MainNameHook
\end{verbatim}
\end{quote}
\renewcommand*\MainNameHook{\AltOff}
\let\FrontNameHook\MainNameHook

When sorting names, be sure to use \cmd{\noexpand} as shown previously:
\begin{quote}\small
\ContinueNum
\begin{verbatim}
\begin{nameauth}
  \< deSmet & Pierre-Jean &
     \noexpand\Fbox{\noexpand\AltCaps{d}e~Smet} & >
\end{nameauth}

\PretagName[Pierre-Jean]%
  {\noexpand\Fbox{\noexpand\AltCaps{d}e~Smet}}%
  {de~Smet, Pierre-Jean}
\end{verbatim}
\end{quote}

Now we show how the formatting hooks work in the body text. One can check the index to see that it is formatted properly and consistently.

\begin{center}\small
\begin{tabular}{rll}\toprule
  First                         & \cmd{\deSmet}  & \deSmet\\
  \rowcolor{grey}Next  & \cmd{\deSmet}  & \deSmet\\
  Long                          & \cmd{\LdeSmet} & \LdeSmet\\
  \rowcolor{grey}Short & \cmd{\SdeSmet} & \SdeSmet\\
                                & \cmd{\CapThis}\cmd{\deSmet} & \CapThis\deSmet\\
  \rowcolor{grey}      & \cmd{\ForceName}\cmd{\CapThis}\cmd{\deSmet} & \ForceName\CapThis\deSmet\\\bottomrule
\end{tabular}
\end{center}

With \cmd{\CapThis}\cmd{\deSmet}: \CapThis\deSmet. \cmd{\ForceName}\cmd{\CapThis}\cmd{\deSmet}: \ForceName\CapThis\deSmet.\medskip

Some formatting, such as the use of \cmd{\textSC}, is fairly standard. Other formatting, such as \cmd{\Fbox} above, is ornamental and may be handled better with custom features, but those features appear only in the text.
\endgroup

\begin{center}\bfseries Rolling Your Own: Intermediate\end{center}
\phantomsection
\begingroup
``Intermediate'' and ``advanced'' refer to the way that formatting hooks were designed before version 3.1. The user-accessible \cmd{\NameParser} builds a printed name from the internal, locally-scoped macros \cmd{\FNN}, \cmd{\SNN}, \cmd{\rootb} and \cmd{\suffb}.

We create a hook that can ignore the output of \cmd{\@nameauth@Name}, which is the \texttt{\#1} in the hook dispatcher's code \cmd{\bgroup}\meta{Hook}\texttt{\{\#1\}}\cmd{\egroup}:
\begin{quote}\small
  \cmd{\renewcommand*}\meta{FirstHook}\texttt{[1]\{\dots}\cmd{\NameParser}\texttt{\dots\}}
\end{quote}

With the \texttt{altformat} option or \cmd{\AltFormatActive} we can design a subsequent-use hook that deactivates formatting inside of it:
\begin{quote}\small
  \cmd{\renewcommand*}\meta{SubsequentHook}\texttt{[1]\{\dots}\cmd{\AltOff}\cmd{\NameParser}\texttt{\dots\}}
\end{quote}

If we used \cmd{\AltFormatActive*}, where the formatting macros are enabled, but deactivated, then we might want a hook that activates the macros:
\begin{quote}\small
  \cmd{\renewcommand*}\meta{Hook}\texttt{[1]\{\dots}\cmd{\AltOn}\cmd{\NameParser}\texttt{\dots\}}
\end{quote}

\makeatletter
\renewcommand*\NamesFormat[1]{%
  \RevertSNfalse\SpecialFNfalse\SpecialSNfalse#1%
  \unless\ifinner\marginpar{%
    \footnotesize\raggedleft%
    \@nameauth@FullNametrue%
    \@nameauth@FirstNamefalse%
    \@nameauth@EastFNfalse%
    \SpecialFNtrue\SpecialSNfalse%
    \NameParser}%
  \fi\global\RevertSNfalse}
\renewcommand*\MainNameHook[1]{%
  \AltOff\SpecialFNfalse\SpecialSNtrue#1%
  \unless\ifinner
    \unless\ifRevertSN
      \marginpar{%
      \footnotesize\raggedleft%
      \@nameauth@FullNamefalse%
      \@nameauth@FirstNamefalse%
      \@nameauth@EastFNfalse%
      \SpecialFNfalse\SpecialSNfalse%
      \NameParser}%
    \fi
  \fi\global\RevertSNfalse}
\makeatother
We begin in the document preamble by defining a series of conditionals and macros whose default expansion produces the index entry, yet whose other expansions occur only in the formatting hooks. Then we create a name that is composed only of macros, using \cmd{\noexpand} with \cmd{\WM} and \cmd{\SHK}. We use \cmd{\PretagName} to sort the names. \cmd{\Revert} is used to print a last name without a margin note.
\begin{quote}\small
\StartNum
\begin{verbatim}
\newif\ifSpecialFN
\newif\ifSpecialSN
\newif\ifRevertSN
\newcommand*\WM{\ifSpecialFN Wm.\else William\fi}
\newcommand*\SHK{\ifRevertSN \textSC{Shakespeare}\else
                 \ifSpecialSN \noexpand\AltCaps{t}he Bard\else
                 \textSC{Shakespeare}\fi\fi}
\newcommand*\Revert{\RevertSNtrue}

\begin{nameauth}
  \< Shak & \noexpand\WM & \noexpand\SHK & >
\end{nameauth}

\PretagName[\noexpand\WM]{\noexpand\SHK}{Shakespeare, William}
\PretagName[Robert]{\textSC{Burns}}{Burns, Robert}
\end{verbatim}
\end{quote}

Below we define the two formatting hooks that structure the ways in which these macros can expand when printed in the text. \cmd{\NamesFormat} allows only the canonical name via \cmd{\RevertSNfalse}, \cmd{\SpecialFNfalse}, and \cmd{\SpecialSNfalse}. We print the canonical name in the body text. If allowed, we print a margin paragraph with an alternate full name using \cmd{\NameParser} and two flags. Both hooks set \cmd{\RevertSNfalse} so that \cmd{\Revert} works on a per-name basis. The subsequent-use hook disables formatting with \cmd{\AltOff}, but it allows variant forms.

\begin{quote}\small
\ContinueNum
\begin{verbatim}
\makeatletter
\renewcommand*\NamesFormat[1]{%
  \RevertSNfalse\SpecialFNfalse\SpecialSNfalse#1%
  \unless\ifinner\marginpar{%
    \footnotesize\raggedleft%
    \@nameauth@FullNametrue%
    \@nameauth@FirstNamefalse%
    \@nameauth@EastFNfalse%
    \SpecialFNtrue\SpecialSNfalse%
    \NameParser}%
  \fi\global\RevertSNfalse}
\renewcommand*\MainNameHook[1]{%
  \AltOff\SpecialFNfalse\SpecialSNtrue#1%
  \unless\ifinner
    \unless\ifRevertSN
      \marginpar{%
      \footnotesize\raggedleft%
      \@nameauth@FullNamefalse%
      \@nameauth@FirstNamefalse%
      \@nameauth@EastFNfalse%
      \SpecialFNfalse\SpecialSNfalse%
      \NameParser}%
    \fi
  \fi\global\RevertSNfalse}
\makeatother
\end{verbatim}

\smallskip
\Shak\ \cmd{\Shak} is the national poet of England in much the same way that \Name[Robert]{\textSC{Burns}} \cmd{\Name[Robert]\{}\cmd{\textSC\{Burns\}\}} is that of Scotland. With the latter's rise of influence in the 1800s, \Revert\Shak\ \cmd{\Revert}\cmd{\Shak} became known as ``\Shak'' \cmd{\Shak}.
\end{quote}
\endgroup

\begin{center}\bfseries Rolling Your Own: Advanced\end{center}
\phantomsection
\begingroup
Here is how formatting hooks were designed before version 3.0. Updating older hooks may be helpful, but is not necessary. We do not use the internal package macros. We only use \cmd{\NameParser} in the hooks to produce output. We still recommend using \cmd{\AltFormatActive} to mitigate errors. In the preamble, three flags replace package internals.\footnote{The internal flag \texttt{\textbackslash @nameauth@DoAlt} activates formatting, \cmd{\CapThis} sets \texttt{\textbackslash @nameauth@DoCaps} true, and \texttt{\textbackslash @nameauth@InHook} is set by the hook dispatcher.}
Setting \texttt{\textbackslash Fboxtrue} is equivalent to using \cmd{\AltFormatActive}:
\begin{quote}\small
\StartNum
\begin{verbatim}
\newif\ifFbox%     Replaces \@nameauth@DoAlt
\newif\ifFirstCap% Replaces \@nameauth@DoCaps
\newif\ifInHook%   Replaces \@nameauth@InHook
\Fboxtrue
\end{verbatim}
\end{quote}

\newcommand*\Fbox[1]{\ifFbox\protect\fbox{#1}\else#1\fi}
Also in the preamble, the formatting macro is like what we have seen, except it refers to \texttt{\textbackslash ifFbox}:\footnote{We define \cmd{\Fbox} locally because it has multiple definitions, but are very careful where we use names with it.}
\begin{quote}\small
\ContinueNum
\begin{verbatim}
\newcommand*\Fbox[1]{%
  \ifFbox\protect\fbox{#1}\else#1\fi
}
\end{verbatim}
\end{quote}

\renewcommand*\AltCaps[1]{%
  \ifInHook
    \ifFirstCap\MakeUppercase{#1}\else#1\fi
  \else
    #1%
  \fi
}
Our new \cmd{\AltCaps} works like the built-in version, except it does not use the internal macros and flags:
 \begin{quote}\small
 \ContinueNum
 \begin{verbatim}
\renewcommand*\AltCaps[1]{%
  \ifInHook
    \ifFirstCap\MakeUppercase{#1}\else#1\fi
  \else
    #1%
  \fi
}
\end{verbatim}
\end{quote}

\renewcommand*\CapThis{\FirstCaptrue}
\renewcommand*\NamesFormat[1]
  {\InHooktrue\NameParser\global\FirstCapfalse}
\renewcommand*\MainNameHook[1]
  {\Fboxfalse\InHooktrue\NameParser\global\FirstCapfalse}
\let\FrontNamesFormat\Namesformat
\let\FrontNameHook\MainNameHook
Here we redefine \cmd{\CapThis} to use our flag instead of the internal flag:
\begin{quote}\small
\ContinueNum
\begin{verbatim}
\renewcommand*\CapThis{\FirstCaptrue}
\end{verbatim}
\end{quote}

We have to reproduce the logic and macros that the package would have provided. That means defining everything, including \cmd{\NamesFormat}, from scratch:
\begin{quote}\small
\ContinueNum
\begin{verbatim}
\renewcommand*\NamesFormat[1]
  {\InHooktrue\NameParser\global\FirstCapfalse}
\end{verbatim}
\end{quote}

Changes to \texttt{\textbackslash ifInHook} (default false) and \texttt{\textbackslash ifFbox} (default true) are local to the scope in which the hook macros are called. \texttt{\textbackslash ifFirstCap} must be set globally. Below we reproduce the logic of \cmd{\AltOff} before \cmd{\NameParser}:
\begin{quote}\small
\ContinueNum
\begin{verbatim}
\renewcommand*\MainNameHook[1]
{\Fboxfalse\InHooktrue\NameParser\global\FirstCapfalse}
\end{verbatim}
\end{quote}

We avoid spurious index entries in the front matter by using the same hooks.
\begin{quote}\small
\ContinueNum
\begin{verbatim}
\let\FrontNamesFormat\Namesformat
\let\FrontNameHook\MainNameHook
\end{verbatim}
\end{quote}

Because we use \cmd{\noexpand}, our ``old-style'' macros will index the following names under the same entry as the ``new-style'' macros.
\begin{center}\small
\begin{tabular}{rll}\toprule
  First                         & \cmd{\deSmet}  & \ForgetThis\deSmet\\
  \rowcolor{grey}Next  & \cmd{\deSmet}  & \deSmet\\
  Long                          & \cmd{\LdeSmet} & \LdeSmet\\
  \rowcolor{grey}Short & \cmd{\SdeSmet} & \SdeSmet\\
                                & \cmd{\CapThis}\cmd{\deSmet} & \CapThis\deSmet\\
  \rowcolor{grey}      & \cmd{\ForceName}\cmd{\CapThis}\cmd{\deSmet} & \ForceName\CapThis\deSmet\\\bottomrule
\end{tabular}
\end{center}

With \cmd{\CapThis}\cmd{\deSmet}: \CapThis\deSmet. \cmd{\ForceName}\cmd{\CapThis}\cmd{\deSmet}: \ForceName\CapThis\deSmet.\medskip

We can reuse new-style names with old-style macros, shown below in abbreviated fashion. We keep the flags \texttt{\textbackslash ifFirstCap} and \texttt{\textbackslash ifInHook}. We also keep the redefined \cmd{\AltCaps}, \cmd{\CapThis}, and \cmd{\NamesFormat}. We then add:
\Capstrue
\renewcommand*\textSC[1]{%
  \ifCaps\textsc{#1}\else#1\fi
}
\renewcommand*\MainNameHook[1]
{%
  \Capsfalse\InHooktrue\NameParser%
  \global\FirstCapfalse%
}
\let\FrontNameHook\MainNameHook
\begin{quote}\small
\StartNum
\begin{verbatim}
\newif\ifCaps
\Capstrue
\renewcommand*\textSC[1]{%
  \ifCaps\textsc{#1}\else#1\fi
}
\renewcommand*\MainNameHook[1]
{%
  \Capsfalse\InHooktrue\NameParser%
  \global\FirstCapfalse%
}
\let\FrontNameHook\MainNameHook
\end{verbatim}
\end{quote}

The names below have the same declarations and index entries as they did above. They look and work the same but use different back-end macros:
\begin{center}
\small\noindent\begin{tabular}{llll}\toprule
  First & Next & Long & Short \\\midrule
  \ForgetThis\Adams & \Adams & \LAdams & \SAdams\\
  \rowcolor{grey}\ForgetThis\SDJR & \SDJR & \LSDJR & \SSDJR\\
  \ForgetThis\HAR & \HAR & \LHAR & \SHAR\\
  \rowcolor{grey}\ForgetThis\Mencius & \Mencius & \LMencius & \SMencius\\\bottomrule
\end{tabular}
\end{center}

\begin{itemize}\small
  \item Punctuation detection works: \ForceName\LSDJR. Also \LSDJR. Then \ForceName\SDJR. Now \SDJR. (We used \cmd{\ForceName} for formatting.)
  \item \cmd{\ForceName}\cmd{\DropAffix}\cmd{\LSDJR} gives \ForceName\DropAffix\LSDJR. Just \cmd{\DropAffix}\cmd{\LSDJR} gives \DropAffix\LSDJR.
  \item \cmd{\RevComma}\cmd{\LAdams} yields \RevComma\LAdams. All the reversing macros work.
  \item \cmd{\ForceName}\cmd{\ForceFN}\cmd{\SHAR} produces \ForceName\ForceFN\SHAR. \cmd{\ForceFN}\cmd{\SHAR} produces \ForceFN\SHAR. If we add \cmd{\CapThis} we get \CapThis\ForceName\ForceFN\SHAR\ and \CapThis\ForceFN\SHAR.
\end{itemize}

We now close the scope of this current example and resume normal formatting.
\endgroup
\AltFormatInactive
\newpage

\section{Customization}

Assuming that redefining hooks and adding control sequences is insufficient, one could redesign the core name macros partially or wholly, then hook those modifications into the \textsf{nameauth} package without needing to patch the style file itself.

All these macros are set by default to \cmd{\@nameauth@Name}, the internal name parser. \cmd{\Name}, or an unmodified shorthand, calls \cmd{\NameauthName}. \cmd{\Name*}, or an L-shorthand, sets \cmd{\@nameauth@FullNametrue}, then calls \cmd{\NameauthLName}. \cmd{\FName}, or an S-shorthand, sets \cmd{\@nameauth@FirstNametrue}, then calls \cmd{\NameauthFName}. One should not modify \cmd{\Name} and \cmd{\FName} directly.

We use features of \textsf{xargs}. Below we introduce formatting that is additional to, inter-operative with, yet distinct from the formatting hooks:
\begin{quote}\small
\StartNum
\begin{verbatim}
\makeatletter
\newcommandx*\MyName[3][1=\@empty, 3=\@empty]{%
  \global\@nameauth@toksa\expandafter{#1}%
  \global\@nameauth@toksb\expandafter{#2}%
  \global\@nameauth@toksc\expandafter{#3}%
  \hbox to 4em{Normal: \hfill}%
  \fcolorbox{black}{gray!25!white}{\@nameauth@Name[#1]{#2}[#3]}%
}
\newcommandx*\MyLName[3][1=\@empty, 3=\@empty]{%
  \global\@nameauth@toksa\expandafter{#1}%
  \global\@nameauth@toksb\expandafter{#2}%
  \global\@nameauth@toksc\expandafter{#3}%
  \hbox to 4em{Long: \hfill}%
  \fcolorbox{black}{green!25!white}{\@nameauth@Name[#1]{#2}[#3]}%
}
\newcommandx*\MyFName[3][1=\@empty, 3=\@empty]{%
  \global\@nameauth@toksa\expandafter{#1}%
  \global\@nameauth@toksb\expandafter{#2}%
  \global\@nameauth@toksc\expandafter{#3}%
  \hbox to 4em{Short: \hfill}%
  \fcolorbox{black}{yellow!25!white}{\@nameauth@Name[#1]{#2}[#3]}%
}
\makeatother
\renewcommand*\NamesFormat[1]
  {\hbox to 9em{\hfil\scshape#1\hfil}}
\renewcommand*\MainNameHook[1]{\hbox to 9em{\hfil#1\hfil}}
\renewcommand*\NameauthName{\MyName}
\renewcommand*\NameauthLName{\MyLName}
\renewcommand*\NameauthFName{\MyFName}
\end{verbatim}

\makeatletter
\newcommandx*\MyName[3][1=\@empty, 3=\@empty]{%
  \global\@nameauth@toksa\expandafter{#1}%
  \global\@nameauth@toksb\expandafter{#2}%
  \global\@nameauth@toksc\expandafter{#3}%
  \hbox to 4em{Normal: \hfill}%
  \fcolorbox{black}{gray!25!white}{\@nameauth@Name[#1]{#2}[#3]}%
}
\newcommandx*\MyLName[3][1=\@empty, 3=\@empty]{%
  \global\@nameauth@toksa\expandafter{#1}%
  \global\@nameauth@toksb\expandafter{#2}%
  \global\@nameauth@toksc\expandafter{#3}%
  \hbox to 4em{Long: \hfill}%
  \fcolorbox{black}{green!25!white}{\@nameauth@Name[#1]{#2}[#3]}%
}
\newcommandx*\MyFName[3][1=\@empty, 3=\@empty]{%
  \global\@nameauth@toksa\expandafter{#1}%
  \global\@nameauth@toksb\expandafter{#2}%
  \global\@nameauth@toksc\expandafter{#3}%
  \hbox to 4em{Short: \hfill}%
  \fcolorbox{black}{yellow!25!white}{\@nameauth@Name[#1]{#2}[#3]}%
}
\makeatother
\renewcommand*\NamesFormat[1]{\hbox to 9em{\hfil\scshape#1\hfil}}
\renewcommand*\MainNameHook[1]{\hbox to 9em{\hfil#1\hfil}}
\renewcommand*\NameauthName{\MyName}%
\renewcommand*\NameauthLName{\MyLName}%
\renewcommand*\NameauthFName{\MyFName}

\smallskip
\cmd{\ForgetName[Adolf]\{Harnack\}}\ForgetName[Adolf]{Harnack}\\[1ex]
\begin{tabular}{@{}rl}
  \cmd{\Harnack} & \Harnack\\
  \cmd{\LHarnack[Adolf von]} & \LHarnack[Adolf von]\\
  \cmd{\Harnack} & \Harnack\\
  \cmd{\SHarnack} & \SHarnack\\
\end{tabular}
\end{quote}
\newpage

\section{\protect\LaTeX\ Engines}

We use \texttt{american} for the language; one should use one's own. We use Latin Modern. We could load \textsf{tikz} using \texttt{\textbackslash ifDoTikZ} to avoid crashing some \texttt{dvi} viewers in a \texttt{dvi}-only workflow.

\begin{quote}\small
\StartNum
\begin{verbatim}
\IfFileExists{iftex.sty}{\usepackage{iftex}}{}
\unless\ifdefined\RequireTUTeX
  \usepackage{ifxetex}
  \usepackage{ifluatex}
  \usepackage{ifpdf}
\fi

\newif\ifDoTikZ                        % If dvi-only workflow
\ifxetex
  \usepackage{fontspec}
  \usepackage{polyglossia}
  \setdefaultlanguage{american}        % Use own language
  \usepackage{tikz}
  \DoTikZtrue                          % If dvi-only workflow
\else
  \ifluatex
    \ifpdf
      \usepackage{fontspec}
      \usepackage{polyglossia}
      \setdefaultlanguage{american}    % Use own language
      \usepackage{tikz}
      \DoTikZtrue                      % If dvi-only workflow
    \else
      \IfFileExists{utf8-2018.def}{}
      {\usepackage[utf8]{inputenc}}
      \usepackage[TS1,T1]{fontenc}
      \usepackage[american]{babel}     % Use own language
      \usepackage{lmodern}
      % Perhaps add \usepackage{tikz}
    \fi
  \else
    \IfFileExists{utf8-2018.def}{}
    {\usepackage[utf8]{inputenc}}
    \usepackage[TS1,T1]{fontenc}
    \usepackage[american]{babel}       % Use own language
    \usepackage{lmodern}
    \ifpdf
      \usepackage{tikz}                % If dvi-only workflow
      \DoTikZtrue                      % If dvi-only workflow
    \fi
  \fi
\fi
\end{verbatim}
\end{quote}
\newpage

In the body text we can use something like the test below for:

\begin{center}\fbox{\ifxetex doing \texttt{pdf} things\else \ifpdf doing \texttt{pdf} things\else doing \texttt{dvi} things\fi\fi}\end{center}

\begin{quote}\small
\begin{verbatim}
\ifxetex
  doing \texttt{pdf} things
\else
  \ifpdf
    doing \texttt{pdf} things
  \else
    doing \texttt{dvi} things
  \fi
\fi\end{verbatim}
\end{quote}

The following equivalent conditional statements can help a macro or just the body text to work under multiple engines:
\begin{quote}\small
\StartNum
\begin{verbatim}
\ifxetex xelatex%
\else
  \ifluatex
    \ifpdf lualatex (pdf)%
    \else lualatex (dvi)%
    \fi
  \else
    \ifpdf pdflatex%
    \else latex (dvi)%
    \fi
  \fi
\fi
\end{verbatim}

\StartNum
\begin{verbatim}
\unless\ifxetex
  \unless\ifluatex
    \ifpdf pdflatex%
    \else latex (dvi)%
    \fi
  \else
    \ifpdf lualatex (pdf)%
    \else lualatex (dvi)%
    \fi
  \fi
\else xelatex%
\fi
\end{verbatim}
\end{quote}
\newpage

\phantomsection
\addcontentsline{toc}{section}{Index of Persons}
\printindex[per]

\renewcommand\indexname{Index of Subjects}
\phantomsection
\addcontentsline{toc}{section}{Index of Subjects}
\printindex

\end{document}