%%
%% 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) 2025 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:
%% 
%%    https://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.
%% 
%% This work includes all source and generated files
%% described as such in README.md, included herein.
%% 
\documentclass[oneside]{article}

\input{compat.tex} % Included with nameauth; needed only if
% compiling on multiple TeX distros or LaTeX engines.

\usepackage[textwidth=137mm,textheight=237mm,
            right=40mm,marginparwidth=40mm]{geometry}

\usepackage{makeidx} % Must have for defining \seealso macro.
\usepackage{index}

\usepackage[oldargs]{nameauth}[2025/02/04]

\usepackage{fancyvrb}

% Define fancyvrb defaults.
\fvset{gobble=2,numbers=left,fontsize=\small}

\usepackage{xcolor}
\usepackage[colorlinks=true]{hyperref}

%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Set up indexing and put margin paragraphs on the left.
%

\makeindex
\newindex{per}{rdx}{rnd}{Index of Persons}
\renewcommand\NameauthIndex{\index[per]}
\reversemarginpar

%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create name shorthands. Note the use of \noexpand
% in the macro arguments below.
%

\begin{nameauth}
  \< Doug   & Frederick & Douglass & >
  \< Bailey & Betsey    & Bailey   & >
\end{nameauth}

\begin{nameauth}
  \< Wash & George & Washington & >
  \< Bradley & Omar N. & Bradley & >
  \< Aris & & Aristotle & >
  \< Plato & & Plato & >
  \< Aeth & & \AE thelred, II & >
  \< Linc & Abraham & Lincoln & >
  \< MLK & Martin Luther & King, Jr. & >
  \< Soto & Hernando & de Soto & >
  \< Patton & George S. & Patton, Jr. & >
  \< Ike & Dwight D. & Eisenhower & >
\end{nameauth}

\begin{nameauth}
  \< Luth & Martin & \noexpand\textSC{Luther} & >
  \< Cath & Catherine \noexpand\AltCaps{d}e'
          & \noexpand\textSC{Medici} & >
\end{nameauth}

\begin{nameauth}
  \< Jeff & Thomas &
     \noexpand\textSC{Jefferson}\noexpand\GEN{} & >
\end{nameauth}

\begin{nameauth}
  \< Scipio & \noexpand\SCIPi & \noexpand\SCIPii & >
  \< TGrac & \noexpand\TSemp & Gracchus & >
\end{nameauth}

\begin{nameauth}
  \< OScipio & Lucius & \noexpand\CSB & > % O for Oxford
\end{nameauth}

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

\begin{nameauth}
  \< deSmet & Pierre-Jean &
     \noexpand\Fbox{\noexpand\AltCaps{d}e~Smet} & >
\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.
%

%  Sort these names under: US Generals.
\PretagName[Omar N.]{Bradley}{US Generals!Bradley, Omar}
\PretagName[George S.]{Patton, Jr.}{US Generals!Patton, George}

%  Sort these names under: US Presidents.
\PretagName[George]{Washington}{US Presidents!Washington, George}
\PretagName[Dwight D.]{Eisenhower}{US Presidents!Eisenhower, Dwight D.}
\PretagName[Abraham]{Lincoln}{US Presidents!Lincoln, Abraham}

%  Sort these names under: Philosophers.
\PretagName{Aristotle}{Philosophers!Aristotle}
\PretagName{Plato}{Philosophers!Plato}

%  Sort these names under: Black Americans, famous.
\PretagName[Frederick]{Douglass}
  {Black Americans, famous!Douglass, Frederick}
\PretagName[Martin Luther]{King, Jr.}
  {Black Americans, famous!King, Martin Luther, Jr.}

%  Sort these names under: Europeans, historical.
\PretagName{\AE thelred, II}{Europeans, historical!Aethelred 2}
\PretagName[Hernando]{de Soto}
  {Europeans, historical!de Soto, Hernando}


\PretagName{Vlad, Ţepeş}{Vlad Tepes} % for accented names


\PretagName[Konrad]{\noexpand\textSC{Zuse}}{Zuse, Konrad}
\PretagName[Ada]{\noexpand\textIT{Lovelace}}{Lovelace, Ada}
\PretagName[Charles]{\noexpand\textBF{Babbage}}
  {Babbage, Charles}
\PretagName{\noexpand\textUC{Kanade}, Takeo}{Kanade Takeo}


\PretagName[Martin]{\noexpand\textSC{Luther}}{Luther, Martin}
\PretagName[Catherine \noexpand\AltCaps{d}e']
           {\noexpand\textSC{Medici}}{Medici, Catherine de}


\PretagName[Thomas]{\noexpand\textSC{Jefferson}\noexpand\GEN{}}
  {Jefferson, Thomas}


\PretagName[Greta]{\noexpand\textSC{Garbo}}{Garbo, Greta}
\PretagName{\noexpand\textSC{Misora}, Hibari}{Misora Hibari}
\PretagName[Heinz]{\noexpand\textSC{R\"uhmann}}{Ruehmann, Heinz}
\PretagName[Heinrich Wilhelm]{\noexpand\textSC{R\"uhmann}}
  {Ruehmann, Heinrich Wilhelm}


\PretagName[\noexpand\SCIPi]{\noexpand\SCIPii}
  {Scipio Africanus}
\PretagName[\noexpand\TSemp]{Gracchus}
  {Gracchus, Tiberius Sempronius}


\PretagName[Lucius]{\noexpand\CSB}{Cornelius Scipio Barbatus}


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


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

%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Below we establish some index tags for names.
%

\TagName{Vlad, II}{ Dracul}
\TagName{Vlad, III}{ Dracula}
\IndexRef{Dracula}{Vlad III}


\TagName[Thomas]{\noexpand\textSC{Jefferson}\noexpand\GEN{}}
  {, pres.}


\TagName[\noexpand\TSemp]{Gracchus}{, consul}


\TagName[Lucius]{\noexpand\CSB}{, consul}

%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%

\title{\bfseries Some \textsf{nameauth} Examples}
\author{Charles P. Schaum}
\date{2025/02/04}

\begin{document}
\maketitle

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

%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%

\section{Minimal Example}

\textbf{Group 1}
\begin{enumerate}
  \item[\textbf{1.}] \Doug\ rose to eminence by sheer force
    of character and talents that neither slavery nor caste
    proscription could crush.
  \item[\textbf{2.}] \Doug's early life is perhaps the most
    complete indictment of the slave system ever presented at
    the bar of public opinion.
  \item[\textbf{3.}] \Doug\ was born in February, 1817. His
    earliest memories centered around the cabin of his
    grandmother, \Bailey.
\end{enumerate}

\medskip\noindent\textbf{Group 2}
\ForgetName[Frederick]{Douglass}
\ForgetName[Betsey]{Bailey}
\begin{enumerate}
  \item[\textbf{2.}] \Doug's early life is perhaps the most
    complete indictment of the slave system ever presented at
    the bar of public opinion.
  \item[\textbf{3.}] \Doug\ was born in February, 1817. His
    earliest memories centered around the cabin of his
    grandmother, \Bailey.
  \item[\textbf{1.}] \Doug\ rose to eminence by sheer force
    of character and talents that neither slavery nor caste
    proscription could crush.
\end{enumerate}

%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%

\section{Roman Names I}

Here we modify a few details from the manual in order to make
all the name examples work well together.

\newcommand\nri{}
\newcommand\nrii{}

\begin{nameauth}
  \< Senecai  & Lucius Annaeus & Seneca\nri  & >
  \< Senecaii & Lucius Annaeus & Seneca\nrii & >
\end{nameauth}

\renewcommand*\NamesFormat[1]
  {#1\NameQueryInfo{}}

\PretagName[Lucius Annaeus]{Seneca\nri}{Seneca, Lucius Annaeus 1}
\PretagName[Lucius Annaeus]{Seneca\nrii}{Seneca, Lucius Annaeus 2}
\TagName[Lucius Annaeus]{Seneca\nri}{ (the Elder)}
\TagName[Lucius Annaeus]{Seneca\nrii}{ (the Younger)}
\NameAddInfo[Lucius Annaeus]{Seneca\nri}{ the Elder}
\NameAddInfo[Lucius Annaeus]{Seneca\nrii}{ the Younger}

We can differentiate between
\Senecai\ and \Senecaii;
\Senecai \NameQueryInfo{} and \Senecaii \NameQueryInfo{}.

Their full index entries are:\\
\ShowIdxPageref[Lucius Annaeus]{Seneca\nri}\\
\ShowIdxPageref[Lucius Annaeus]{Seneca\nrii}
\index{Roman names, student}


\begin{nameauth}
  \< CatoY & Marcus Porcius & Cato, the Younger & >
  \< CatoYi & Marcus Porcius & Cato the Younger & >
\end{nameauth}
\ExcludeName[Marcus Porcius]{Cato, the Younger}
\makeatletter
\NameAddInfo[Marcus Porcius]{Cato, the Younger}
  {\if@nameauth@InHook\ (Uticensis, 94--45 \textsc{bc})%
   \else Uticensis\fi}
\makeatother

\JustIndex\CatoYi
\CatoY\ is known as \CatoY\ \ForceAffix\CatoY, to distinguish him
from his great-grandfather. His names include \SCatoY[Marcus]
(\textit{praenomen}), \SCatoY[Porcius] (\textit{nomen}, one of the
Porcia clan), and \CatoY, the \textit{cognomen} by which he is best
known. His other \textit{agnomen}, \NameQueryInfo{}, means he was
born in Utica.
\JustIndex\CatoYi He is indexed as: \ShowIdxPageref*{}
\index{Roman names, student}


\begin{nameauth}
  \< CatoE & Marcus Porcius & Cato, the Elder & >
  \< CatoEi & Marcus & Porcius Cato the Elder & >
\end{nameauth}
\ExcludeName[Marcus Porcius]{Cato, the Elder}

\JustIndex\CatoEi
\DropAffix\CatoE\ (234--149 \textsc{bc}) is known as
\CatoE{} \ForceAffix\CatoE, among other sobriquets.
His \textit{praenomen} is \SCatoE[Marcus]. His
\textit{nomen} is \SCatoE[Porcius], a member of the
Porcia clan. His \textit{cognomen} is \CatoE.
\JustIndex\CatoEi
Index: \ShowIdxPageref*{}
\index{Roman names, scholar}

%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%

\section{Multiple Indexes}

The Electric Boogaloo\index{Boogaloo, Electric} %  main index
was created by \Name{Ollie~\& Jerry}.           %  name index
\index{indexes, multiple}

%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%

\section{Index Categories}

\subsection{Famous Black Americans}

\Name[Frederick]{Douglass} rose to eminence by sheer force of
character and talents that neither slavery nor caste
proscription could crush. Circumstances made
\Name[Frederick]{Douglass} a slave, but they could not prevent
him from becoming a freeman and a leader among mankind.\\

We also celebrate \MLK, then \MLK.

\subsection{Patres Patriae}

We mention President \Wash; again, \Wash.
Family and close friends called him \SWash.\\

\TagName[George]{Washington}{!as general}
We can reminisce about \LWash[General].
\UntagName[George]{Washington}

When speaking of \Linc, we can refer to \LLinc[Abe].

\subsection{Philosophers}

Among philosophers we consider \Plato\ and \Aris.

\subsection{Historical Figures}

We ponder about \Aeth, then \Aeth.
We note \Soto, then just \Soto.
\CapThis\Soto{} starts a sentence.

\subsection{Further Discussion}

\TagName[George]{Washington}{!as general}
\TagName[Dwight D.]{Eisenhower}{!as general}
\LWash, \LIke, \LBradley, and \LPatton
  were high-ranking generals.\\
\SeeAlso\IndexRef[George]{Washington}{Eisenhower}
\SeeAlso\IndexRef[Dwight D.]{Eisenhower}{Washington}
\IncludeName*[George]{Washington}
\IncludeName*[Dwight D.]{Eisenhower}

\UntagName[George]{Washington}
\UntagName[Dwight D.]{Eisenhower}
\Wash\ and \Ike\ also were US presidents.

\ForgetName[Omar N.]{Bradley}
\ForgetName[George S.]{Patton, Jr.}
\TagName[Omar N.]{Bradley}{!colleagues of}
\TagName[George S.]{Patton, Jr.}{!colleagues of}
\IndexRef[Omar N.]{Bradley}{Eisenhower, Patton}
\IndexRef[George S.]{Patton, Jr.}{Bradley, Eisenhower}

%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%

\section{More Complex Hooks}

% First save main- and front-matter hooks. Then change
% first-use hooks for both main matter and front matter.
\let\OldFormat\NamesFormat
\let\OldFrontNames\FrontNamesFormat

\renewcommand*\NamesFormat[1]{\textbf{#1}\unless\ifinner
   \marginpar{\raggedleft\scriptsize #1}\fi}
\renewcommand*\FrontNamesFormat[1]{\textit{#1}\unless\ifinner
   \marginpar{\raggedleft\scriptsize #1}\fi}
\index{complex hooks, intro}

\subsection{New Format, Front Matter}
\NamesInactive

The new format (front matter):\NamesInactive

\Name{Vlad, III}[III Dracula], known as
\IndexRef{Vlad, {\c T}epe{\c s}}{Vlad III}%
\SubvertThis\Name*{Vlad, {\c T}epe{\c s}}
(\Name*{Vlad, {\c T}epe{\c s}}[the Impaler])
after his death, was the son of \Name{Vlad, II}[II Dracul],
a member of the Order of the Dragon. Later instances of
``\Name*{Vlad, III}'' and ``\Name{Vlad, III}'' appear thus.

The new format (main matter):\NamesActive

\Name{Vlad, III}[III Dracula], known as
\IndexRef{Vlad, {\c T}epe{\c s}}{Vlad III}%
\SubvertThis\Name*{Vlad, {\c T}epe{\c s}}
(\Name*{Vlad, {\c T}epe{\c s}}[the Impaler])
after his death, was the son of \Name{Vlad, II}[II Dracul],
a member of the Order of the Dragon. Later instances of
``\Name*{Vlad, III}'' and ``\Name{Vlad, III}'' appear thus.

\let\NamesFormat\OldFormat
\let\FrontNamesFormat\OldFrontNames

We are back in the old format.

in the front matter we see: \NamesInactive
\ForgetThis\Name{Vlad, III}[III Dracula],
\Name*{Vlad, III}, and  \Name{Vlad, III}.

in the main matter we see: \NamesActive
\ForgetThis\Name{Vlad, III}[III Dracula],
\Name*{Vlad, III}, and  \Name{Vlad, III}.

%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%

\section{Template Test}

Here we demonstrate that fetching information by using the name pattern is better than reading the internal token registers. This is due to expansion sometimes happening in the basic interface.

We set up the following test for our three templates, with indexing suppressed:

\begin{itemize}
  \item If we see the outcome, ``Test\dots passed'', we have success.
  \item If we see the outcome, ``Test\dots'', we have failure.
\end{itemize}

\subsection{Test Setup}

\begingroup

\IndexInactive
\begin{VerbatimOut}{\jobname.tmp}
  \NameAddInfo{Testi}{\dots passed}
  \NameAddInfo{\noexpand\testname}{\dots passed}
  \newcommand\testname{Testii}
  \begin{nameauth}
    \< Testi & & Testi & >
    \< Testii & & \noexpand\testname & >
  \end{nameauth}
\end{VerbatimOut}

\VerbatimInput[gobble=0]{\jobname.tmp}

\input{\jobname.tmp}

\subsection{Recommended Hook}

We display the name, followed by the tag produced with the most recent name pattern vis: \Verb+\NameQueryInfo{}+ taking a null argument.

\begin{VerbatimOut}{\jobname.tmp}
  \renewcommand*\NamesFormat[1]
    {#1\NameQueryInfo{}}
\end{VerbatimOut}

\VerbatimInput[gobble=0]{\jobname.tmp}
\input{\jobname.tmp}

\begin{tabular}{ll}
  \Verb+\ForgetThis\Name{Testi}+ & \ForgetThis\Name{Testi} \\
  \Verb+\ForgetThis\Testi+ & \ForgetThis\Testi \\
  \Verb+\ForgetThis\Name{\noexpand\testname}+ &
  \ForgetThis\Name{\noexpand\testname} \\
  \Verb+\ForgetThis\Testii+ & \ForgetThis\Testii \\
\end{tabular}

\subsection{Alternate Hook A}

If we try to use the internal token registers, we have to get more complicated, and it does not always work:

\begin{VerbatimOut}{\jobname.tmp}
  \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{VerbatimOut}

\VerbatimInput[gobble=0]{\jobname.tmp}
\input{\jobname.tmp}

\begin{tabular}{ll}
  \Verb+\ForgetThis\Name{Testi}+ & \ForgetThis\Name{Testi} \\
  \Verb+\ForgetThis\Testi+ & \ForgetThis\Testi \\
  \Verb+\ForgetThis\Name{\noexpand\testname}+ &
  \ForgetThis\Name{\noexpand\testname} \\
  \Verb+\ForgetThis\Testii+ & \ForgetThis\Testii \\
\end{tabular}


\subsection{Alternate Hook B}

This is an ``older'' way of using the internal token registers. It has similar problems with consistency:

\begin{VerbatimOut}{\jobname.tmp}
  \let\ex\expandafter
  \makeatletter
  \renewcommand*\NamesFormat[1]{%
    #1%
    \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@etoksc]%
  }
  \makeatother
\end{VerbatimOut}

\VerbatimInput[gobble=0]{\jobname.tmp}
\input{\jobname.tmp}

\begin{tabular}{ll}
  \Verb+\ForgetThis\Name{Testi}+ & \ForgetThis\Name{Testi} \\
  \Verb+\ForgetThis\Testi+ & \ForgetThis\Testi \\
  \Verb+\ForgetThis\Name{\noexpand\testname}+ &
  \ForgetThis\Name{\noexpand\testname} \\
  \Verb+\ForgetThis\Testii+ & \ForgetThis\Testii \\
\end{tabular}

\endgroup

%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%

\section{Life Dates in Hooks}

% Add name tags to names.
\NameAddInfo[George]{Washington}{ (1732--99)}
\NameAddInfo[Mustafa]{Kemal}{ (1881--1938)}
\NameAddInfo{Atat\"urk}{ (in 1934, a special surname)}

% Ensure that Atat\"urk is a cross-reference that
% has no page entries in the index.
\IndexRef{Atat\"urk}{Kemal, Mustafa}

% Manually suppress name tag in ``first'' instance
\newif\ifNoTag

% Redesign formatting hook to usually print a tag
% only in ``first'' instance. On exit, It resets
% the flag that suppresses tags, making that flag
% work only once per name use.

\renewcommand*\NamesFormat[1]
{%
  #1\unless\ifNoTag\NameQueryInfo{}\fi
  \global\NoTagfalse%
}

\ForgetThis\Name[George]{Washington} held office as
the first US president from 1789 to 1797.
\Name[George]{Washington} was the only president whose
term in office was completely in the eighteenth century.

If we need to trigger the first use hook at some point,
we can suppress dates and get an automatic long instance via:
\NoTagtrue\ForgetThis\Name[George]{Washington}.

Or we can trigger the first-use hook in a subsequent name use
and still have dates: \ForceName\Name[George]{Washington}.

We can add name info tags to names used only as cross-
references. For example, \Name[Mustafa]{Kemal} was granted
the name \Name{Atat\"urk}.

We mention \Name[Mustafa]{Kemal}
and \Name{Atat\"urk} again. Likewise, we can trigger a
first use, but with no name tag tag:
\NoTagtrue\ForgetThis\Name{Atat\"urk}.

%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%

\section{Alternate Formatting}

\AltFormatActive
\renewcommand*\NamesFormat{}
\renewcommand*\MainNameHook{\AltOff}

\noindent
\ForgetThis\Name[Konrad]{\noexpand\textSC{Zuse}};
\Name[Konrad]{\noexpand\textSC{Zuse}}\\
\ForgetThis\Name[Ada]{\noexpand\textIT{Lovelace}};
\Name[Ada]{\noexpand\textIT{Lovelace}}\\
\ForgetThis\Name[Charles]{\noexpand\textBF{Babbage}};
\Name[Charles]{\noexpand\textBF{Babbage}}\\
\ForgetThis\Name{\noexpand\textUC{Kanade}, Takeo};
\Name{\noexpand\textUC{Kanade}, Takeo}
\index{formatting, alternate}

\renewcommand*\MainNameHook{\sffamily\AltOff}

\ForgetThis\Luth\ was a leading figure in the Protestant
Reformation. \Luth\ believed that one is declared
righteous in a forensic sense by divine grace through faith
created by the Holy Spirit via the Gospel and the Sacraments.

\ForgetThis\Cath\ was not only Queen of France in her own right,
but she also guided the reigns of her three sons.
\CapThis\LCath[\noexpand\AltCaps{d}e']
was blamed for the St.\ Bartholomew's Day massacre that saw the
murder of thousands of Huguenots.
\index{formatting, alternate}

%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%

\section{Grammatical Inflections in Names}

\newif\ifGenitive
\newif\ifDoGenitive

\newcommand*\GEN{\ifDoGenitive\textSC{'s}\fi}

\renewcommand*\NamesFormat[1]
  {\ifGenitive\DoGenitivetrue\fi#1\global\Genitivefalse}
\renewcommand*\MainNameHook[1]
  {\ifGenitive\DoGenitivetrue\fi\AltOff#1\global\Genitivefalse}

Consider \Genitivetrue\Jeff\ legacy as the author of the
colonies' Declaration of Independence and his impact as third
president of the United States. \Jeff\ was a complex historical
figure whose actions defy a consistent moral compass both in
public policy and in personal affairs.
\index{inflections, grammatical}

%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%

\section{Sample Reference Work I}

% Make a cross-reference from a variant name form to the
% form of the head-words

\IndexRef[Heinrich Wilhelm]{\noexpand\textSC{R\"uhmann}}
  {\noexpand\textSC{R\"uhmann}, Heinz}

% Define the formatting hooks. Since we use the `altformat'
% option, alternate formatting is turned off in later
% name uses.

\renewcommand*\NamesFormat{}
\renewcommand*\MainNameHook{\AltOff}

% Typeset head-words with a slanted font.

\newcommand{\RefArticle}[3]
{%
  \def\Check{#2}%
  \ifx\Check\empty
    \noindent\ForgetThis\textsl{#1}\ #3
  \else
    \noindent\ForgetThis\textsl{#1}\ #2\ #3
  \fi\medskip
}

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

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

\RefArticle
  {\RevComma\Name[Heinz]{\noexpand\textSC{R\"uhmann}}}
  {(\SubvertThis\ForceName
    \FName[Heinrich Wilhelm]{\noexpand\textSC{R\"uhmann}};}
  {7 March 1902\,--\,3 October 1994) was a German actor
   in over 100 films.
   \Name[Heinz]{\noexpand\textSC{R\"uhmann}}\dots}

%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%

\section{Roman Names II}

\subsection{General Reference}

% Global Boolean flags need to be defined only once.
\newif\ifNoPraenomen
\newif\ifNoCognomen
\newif\ifNoGens
\newif\ifNoAgnomen

% Local Boolean flags need to be defined only once.
\newif\ifXPrae
\newif\ifXCogn
\newif\ifXGens
\newif\ifXAgno

% Name variant macros need to be defined uniquely for each
% name. First is Scipio. Second is Gracchus.

\newcommand*\SCIPi
{%
  \ifXGens Publius\else
    \ifXPrae Cornelius\else
      Publius Cornelius%
    \fi
  \fi
}

\newcommand*\SCIPii
{%
  \ifXAgno Scipio\else
    Scipio Africanus%
  \fi
}

\newcommand*\TSemp
{%
  \ifXGens Tiberius\else
    \ifXPrae Sempronius\else
      Tiberius Sempronius%
    \fi
  \fi
}

% We add the name tag.
\NameAddInfo[\noexpand\TSemp]{Gracchus}
  { (consul, 177 \textsc{bc})}

% Although it is helpful to set everything up
% In the preamble, it is not absolutely necessary.
% Here we define the simpler set of formatting hooks
% for Scipio, although the complex hooks will work
% for both equally as well.

\renewcommand*\NamesFormat[1]
{%
  \ifNoPraenomen\XPraetrue\fi%
  \ifNoGens\XGenstrue\fi%
  \ifNoCognomen\XCogntrue\fi%
  \ifNoAgnomen\XAgnotrue\fi%
  #1\NameQueryInfo{}%
  \global\NoPraenomenfalse%
  \global\NoGensfalse%
  \global\NoCognomenfalse%
  \global\NoAgnomenfalse%
}

\renewcommand*\MainNameHook[1]
{%
  \ifNoPraenomen\XPraetrue\fi%
  \ifNoGens\XGenstrue\fi%
  \ifNoCognomen\XCogntrue\fi%
  \ifNoAgnomen\XAgnotrue\fi%
  #1%
  \global\NoPraenomenfalse%
  \global\NoGensfalse%
  \global\NoCognomenfalse%
  \global\NoAgnomenfalse%
}

\index{Roman names, student}
\NoAgnomentrue\Scipio\ was born around 236 \textsc{bc}
into the Scipiones branch of the Cornelii clan.
\NoAgnomentrue\Scipio\ rose to military fame during the
Second Punic War. Thereafter he was known as \Scipio.
He flourished during the Egyptian reigns of
\Name{Ptolemy, IV}[IV Philopator] and
\Name{Ptolemy, V}[V Epiphanes], and the Syrian
reigns of \Name{Seleucus, III}[III Ceraunus] and
\Name{Antiochus, III}[III the Great].

\TGrac\ served as tribune of the plebs in 184 \textsc{bc}.
\TGrac\ was elected praetor for 180 \textsc{bc},
after which he was appointed governor of Hispania Citerior,
serving with the rank of proconsul. In 177 \textsc{bc},
he was elected consul, again in 163 \textsc{bc}.

\subsection{Scholarly Work}

% Name variant macros need to be defined
% uniquely for each name.

\newcommand*\CSB
{%
  \ifXGens
    \ifXAgno Scipio\else
      Scipio Barbatus\fi
  \else
    \ifXCogn Cornelius\else
      \ifXAgno Cornelius Scipio\else
        Cornelius Scipio Barbatus%
      \fi
    \fi
  \fi
}

\index{Roman names, scholar}
\OScipio\ was born around 337 \textsc{bc} into the
Scipiones branch of the Cornelii clan, one of the large
patrician clans. \NoGenstrue\NoAgnomentrue\OScipio\ was
one of the two elected consuls in 298 \textsc{bc}
and served during the Third Samnite War.

%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%

\section{Reference Work II}

% Boolean flags; the first sets up headwords and the second
% indicates that a Non-Western form should not be reversed.
\newif\ifHeadword
\newif\ifAncientName

% Sorting and tagging the names:

% Adding name information:
\NameAddInfo{Aristotle}{ (384--322 \textsc{bc})}
\NameAddInfo[Charles]{\noexpand\textBF{Babbage}}{ (1791--1871)}
\NameAddInfo{\noexpand\textUC{Kanade}, Takeo}{ (1945-- )}
\NameAddInfo[Ada]{\noexpand\textIT{Lovelace}}
 { (Augusta Ada King, Countess of Lovelace
   [née Byron]; 1815--52)}

% Redefining the formatting hooks:
\makeatletter
\renewcommand\NamesFormat[1]
{%
  \ifHeadword
    \ifNameauthWestern
      \@nameauth@RevThisCommatrue%
      \bfseries \NameParser%
      \normalfont\NameQueryInfo{}%
    \else
      \begingroup%
        \bfseries \NameParser%
        \unless\ifAncientName
          \normalfont; W:\AltOff\space
          \@nameauth@RevThistrue \NameParser%
        \fi
        \normalfont\NameQueryInfo{}%
      \endgroup%
    \fi
  \else
    \NameParser%
  \fi
  \global\Headwordfalse%
  \global\AncientNamefalse%
}
\makeatother
\renewcommand\MainNameHook{\AltOff}

% Define related macros:
\newcommand\Headword{\Headwordtrue\ForgetThis}
\renewcommand{\RefArticle}[2]
{%
  \noindent\Headword #1 #2
  \medskip
}
\index{reference work}

\RefArticle{\AncientNametrue\Name{Aristotle}}{was the first to offer
a system of logic, most notably syllogistic logic, that would
become the basis for discrete states and circuitry of
digital computers. \Name{Aristotle}\dots}

\RefArticle{\Name[Charles]{\noexpand\textBF{Babbage}}}{designed and
built the Difference Engine and began work on the Analytical
Engine. \Name[Charles]{\noexpand\textBF{Babbage}}\dots}

\RefArticle{\Name{\noexpand\textUC{Kanade}, Takeo}}{is one of the
foremost pioneers in the field of computer vision.
\Name{\noexpand\textUC{Kanade}, Takeo}\dots}

\RefArticle{\Name[Ada]{\noexpand\textIT{Lovelace}}}{collaborated with
\Name*[Charles]{\noexpand\textBF{Babbage}}* and wrote what some
consider to be the first computer program for the Analytical
Engine. \Name[Ada]{\noexpand\textIT{Lovelace}}\dots}
\index{reference work}

%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%

\section{Marginalia}

% Global Boolean flags need to be defined only once.
\newif\ifSpecialFN
\newif\ifSpecialSN
\newif\ifRevertSN

% Name variant macros need to be defined
% uniquely for each name.

% For a long name, we want to use ``William'' in the text
% and ``Wm.'' in the margin.

\newcommand*\WM
{%
  \ifSpecialFN Wm.\else
  William\fi
}

% The first surname use will be ``Shakespeare'', but ``the
% Bard'' thereafter. We allow for alternate caps.
% We can get ``Shakespeare'' thereafter by toggling a flag.

\newcommand*\SHK
{%
  \ifRevertSN
    \textSC{Shakespeare}\else
    \ifSpecialSN
      \noexpand\AltCaps{t}he Bard\else
      \textSC{Shakespeare}%
    \fi
  \fi
}

% Here is how we toggle that flag.

\newcommand*\Revert{\RevertSNtrue}

% The ``first-use'' hook prints a name, then tries
% to insert a margin note using a different name form
% and the user-accessible parser. Finally it resets
% the reversion flag, which is only effective in the
% ``subsequent-use'' hook. Note how macros in the
% name arguments take the role of what the internal
% Boolean flags might otherwise handle.

\makeatletter
\renewcommand*\NamesFormat[1]
{%
  \RevertSNfalse\SpecialFNfalse\SpecialSNfalse%
  #1%
  \unless\ifinner
    \marginpar
    {%
      \footnotesize\raggedleft%
      \SpecialFNtrue\SpecialSNfalse%
      \NameParser%
    }%
  \fi
  \global\RevertSNfalse%
}

\renewcommand*\MainNameHook[1]
{%
  \AltOff\SpecialFNfalse\SpecialSNtrue%
  #1%
  \unless\ifinner
    \unless\ifRevertSN
      \marginpar
      {%
        \footnotesize\raggedleft%
        \SpecialFNfalse\SpecialSNfalse%
        \NameParser%
      }%
    \fi
  \fi
  \global\RevertSNfalse%
}
\makeatother

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

%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%

\section{Customization Using Internals}

\makeatletter
\newcommand*\Fbox[1]{%
  \if@nameauth@DoAlt\protect\fbox{#1}\else#1\fi
}
\makeatother

\renewcommand*\NamesFormat{}
\renewcommand*\FrontNamesFormat{}
\renewcommand*\MainNameHook{\AltOff}
\renewcommand*\FrontNameHook{\AltOff}

\index{customization, easy}
\deSmet\ was a Jesuit missionary who arrived in North
America in 1821 at the age of twenty, after a year of seminary
education. \CapThis\deSmet\ was ordained in 1827 and worked
among American Indian nations after 1837. We can show the forms
\LdeSmet\ and \SdeSmet.

%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%

\section{Customization Using Separate Macros}

We do not show this section in the manual because it starts to go farther afield of the main focus of \textsf{nameauth}. Nevertheless, we show it for completeness.

\newif\ifFbox     % Replaces \if@nameauth@DoAlt  \AltOn \AltOff
\newif\ifFirstCap % Replaces \if@nameauth@DoCaps \AltCaps
\newif\ifInHook   % Replaces \if@nameauth@InHook hook dispatcher
\Fboxtrue         % Replaces \AltFormatActive

% Alternate formatting macro definition
\renewcommand*\Fbox[1]{%
  \ifFbox\protect\fbox{#1}\else#1\fi
}

% Redefinition of \AltCaps and \CapThis
\renewcommand*\AltCaps[1]{%
  \ifInHook
    \ifFirstCap\MakeUppercase{#1}\else#1\fi
  \else
    #1%
  \fi
}
\renewcommand*\CapThis{\FirstCaptrue}

\renewcommand*\NamesFormat[1]
  {\InHooktrue\NameParser\global\FirstCapfalse}

\renewcommand*\MainNameHook[1]
  {\Fboxfalse\InHooktrue\NameParser\global\FirstCapfalse}

\let\FrontNamesFormat\Namesformat
\let\FrontNameHook\MainNameHook

\index{customization, complicated}
\ForgetThis\deSmet\ was a Jesuit missionary who arrived in North
America in 1821 at the age of twenty, after a year of seminary
education. \CapThis\deSmet\ was ordained in 1827 and worked
among American Indian nations after 1837. We can show the forms
\LdeSmet\ and \SdeSmet.

\newif\ifCaps      % Replaces \if@nameauth@DoAlt
\Capstrue          % Replaces \AltFormatActive

% Alternate formatting macro definition
\renewcommand*\textSC[1]{\ifCaps\textsc{#1}\else#1\fi}

% Redefinition of \AltCaps and \CapThis
\renewcommand*\AltCaps[1]{%
  \ifInHook
    \ifFirstCap\MakeUppercase{#1}\else#1\fi
  \else
    #1%
  \fi
}
\renewcommand*\CapThis{\FirstCaptrue}

\renewcommand*\NamesFormat[1]
  {\InHooktrue#1\global\FirstCapfalse}

\renewcommand*\MainNameHook[1]
  {\Capsfalse\InHooktrue#1\global\FirstCapfalse}

\let\FrontNamesFormat\Namesformat
\let\FrontNameHook\MainNameHook

\ForgetThis\Luth\ was a leading figure in the Protestant
Reformation. \Luth\ believed that one is declared
righteous in a forensic sense by divine grace through faith
created by the Holy Spirit via the Gospel and the Sacraments.

\ForgetThis\Cath\ was not only Queen of France in her own right,
but she also guided the reigns of her three sons.
\CapThis\LCath[\noexpand\AltCaps{d}e']
was blamed for the St.\ Bartholomew's Day massacre that saw the
murder of thousands of Huguenots.

\renewcommand*\NamesFormat{}
\newcommand*\FrontNamesFormat{}
\renewcommand*\MainNameHook{}
\renewcommand*\FrontNameHook{}

%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%

\section{Full Customization}

We do not go into this much detail in the manual because it starts to go farther afield of the main focus of \textsf{nameauth}. Nevertheless, we show it for completeness.

\subsection[With xparse]{With \textsf{xparse}}

\makeatletter

% Change the general-case name macro to show
% a name in a framed, colored box.

\NewDocumentCommand{\MyName}{O{} m O{}}
  {\fcolorbox{black}{gray!25!white}{\@nameauth@Name[#1]{#2}[#3]}}

% Likewise change the macro for when names are forced long.
\NewDocumentCommand{\MyLName}{O{} m O{}}
  {\fcolorbox{black}{green!25!white}{\@nameauth@Name[#1]{#2}[#3]}}

% Likewise change the macro when personal names are desired.
\NewDocumentCommand{\MyFName}{O{} m O{}}
  {\fcolorbox{black}{yellow!25!white}{\@nameauth@Name[#1]{#2}[#3]}}
\makeatother

% Change the formatting hooks, but do not use alternate.
% formatting, which is separate from that above.
\renewcommand*\NamesFormat[1]{\scshape#1}
\renewcommand*\MainNameHook[1]{#1}

% Change the naming macro hooks.
\renewcommand*\NameauthName{\MyName}
\renewcommand*\NameauthLName{\MyLName}
\renewcommand*\NameauthFName{\MyFName}

\index{customization, insane}
\ForgetThis\Name[Adolf]{Harnack} was a theologian who stressed
the Fatherhood of God and the brotherhood of man.
\Name[Adolf]{Harnack} flourished in the early twentieth
century; \Name*[Adolf von]{Harnack}; \FName[Adolf]{Harnack}.
\AltFormatInactive

\makeatletter
\renewcommand*\NameauthName{\@nameauth@Name}
\renewcommand*\NameauthLName{\@nameauth@Name}
\renewcommand*\NameauthFName{\@nameauth@Name}
\makeatother

\renewcommand*\NamesFormat{}
\renewcommand*\MainNameHook{}

\subsection[With xargs]{With \textsf{xargs}}

\makeatletter
% Change the general-case name macro to show
% a name in a framed, colored box.

\renewcommandx\MyName[3][1=\empty, 3=\empty]
  {\fcolorbox{black}{gray!25!white}{\@nameauth@Name[#1]{#2}[#3]}}

% Likewise change the macro for when names are forced long.
\renewcommandx\MyLName[3][1=\empty, 3=\empty]
  {\fcolorbox{black}{green!25!white}{\@nameauth@Name[#1]{#2}[#3]}}

% Likewise change the macro when personal names are desired.
\renewcommandx\MyFName[3][1=\empty, 3=\empty]
  {\fcolorbox{black}{yellow!25!white}{\@nameauth@Name[#1]{#2}[#3]}}
\makeatother

% Change the formatting hooks, but do not use alternate.
% formatting, which is separate from that above.
\renewcommand*\NamesFormat[1]{\scshape#1}
\renewcommand*\MainNameHook[1]{#1}

% Change the naming macro hooks.
\renewcommand*\NameauthName{\MyName}
\renewcommand*\NameauthLName{\MyLName}
\renewcommand*\NameauthFName{\MyFName}

\index{customization, insane}
\ForgetThis\Name[Adolf]{Harnack} was a theologian who stressed
the Fatherhood of God and the brotherhood of man.
\Name[Adolf]{Harnack} flourished in the early twentieth
century; \Name*[Adolf von]{Harnack}; \FName[Adolf]{Harnack}.
\AltFormatInactive

\makeatletter
\renewcommand*\NameauthName{\@nameauth@Name}
\renewcommand*\NameauthLName{\@nameauth@Name}
\renewcommand*\NameauthFName{\@nameauth@Name}
\makeatother

\renewcommand*\NamesFormat{}
\renewcommand*\MainNameHook{}

%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%

\section{\protect\LaTeX\ Engines}

\subsection{\protect\texttt{compat.tex}}

One can define \Verb+\nolangs+ before loading the file below to inhibit
the default language loading. We use Latin Modern for the font to get
a consistent look. Below we list the salient cross-engine points from
\texttt{compat.tex}, included with \textsf{nameauth}.
\index{\protect\LaTeX\ engines}

\begin{quote}\small
  \VerbatimInput[gobble=0, firstline=24]{compat.tex}
\end{quote}

\subsection{Check Engine Tests}

In the body text we can use something like the test below for:\quad
\fbox{\ifxetex doing \texttt{pdf} things\else
  \ifpdf doing \texttt{pdf} things\else
    doing \texttt{dvi} things\fi
  \fi}

\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
\begin{Verbatim}
  \ifxetex xelatex%
  \else
    \ifluatex
      \ifpdf lualatex (pdf)%
      \else lualatex (dvi)%
      \fi
    \else
      \ifpdf pdflatex%
      \else latex (dvi)%
      \fi
    \fi
  \fi
\end{Verbatim}

\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}

%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%

\section{Miscellaneous Tests: Spaces}

Here we test to see if any unwanted spaces exist in macros that take
name arguments. If everything is OK, one should see two vertical bars
\texttt{||} where no output in the text is produced, or no spaces
between an enclosed name and the bars. This section also tests if most
possible argument combinations work in most macros that take name arguments.

\subsection{Western Name with Suffix}

\begin{quote}
\Verb+\Name[FNNa]{SNNa, Affix}[Alternate]+\dotfill
  |\Name[FNNa]{SNNa, Affix}[Alternate]|\\
\Verb+\Name*[FNNa]{SNNa, Affix}+\dotfill
  |\Name*[FNNa]{SNNa, Affix}|\\
\Verb+\DropAffix\Name*[FNNa]{SNNa, Affix}[Alternate]+\dotfill
  |\DropAffix\Name*[FNNa]{SNNa, Affix}[Alternate]|\\
\Verb+\DropAffix\Name*[FNNa]{SNNa, Affix}+\dotfill
  |\DropAffix\Name*[FNNa]{SNNa, Affix}|\\
\Verb+\Name[FNNa]{SNNa, Affix}[Alternate]+\dotfill
  |\Name[FNNa]{SNNa, Affix}[Alternate]|\\
\Verb+\Name[FNNa]{SNNa, Affix}+\dotfill
  |\Name[FNNa]{SNNa, Affix}|\\
\Verb+\FName[FNNa]{SNNa, Affix}[Alternate]+\dotfill
  |\FName[FNNa]{SNNa, Affix}[Alternate]|\\
\Verb+\FName[FNNa]{SNNa, Affix}+\dotfill
  |\FName[FNNa]{SNNa, Affix}|
\end{quote}

\subsection{Western Name without Suffix}

\begin{quote}
\Verb+\Name[FNNb]{SNNb}[Alternate]+\dotfill
  |\Name[FNNb]{SNNb}[Alternate]|\\
\Verb+\Name*[FNNb]{SNNb}+\dotfill
  |\Name*[FNNb]{SNNb}|\\
\Verb+\Name[FNNb]{SNNb}[Alternate]+\dotfill
  |\Name[FNNb]{SNNb}[Alternate]|\\
\Verb+\Name[FNNb]{SNNb}+\dotfill
  |\Name[FNNb]{SNNb}|\\
\Verb+\FName[FNNb]{SNNb}[Alternate]+\dotfill
  |\FName[FNNb]{SNNb}[Alternate]|\\
\Verb+\FName[FNNb]{SNNb}+\dotfill
  |\FName[FNNb]{SNNb}|
\end{quote}

\subsection{Non-Western Name, Current Syntax}

\begin{quote}
\Verb+\Name{SNNc, Affix}[Alternate]+\dotfill
  |\Name{SNNc, Affix}[Alternate]|\\
\Verb+\Name*{SNNc, Affix}+\dotfill
  |\Name*{SNNc, Affix}|\\
\Verb+\Name{SNNc, Affix}[Alternate]+\dotfill
  |\Name{SNNc, Affix}[Alternate]|\\
\Verb+\Name{SNNc, Affix}+\dotfill
  |\Name{SNNc, Affix}|\\
\Verb+\FName{SNNc, Affix}[Alternate]+\dotfill
  |\FName{SNNc, Affix}[Alternate]|\\
\Verb+\FName{SNNc, Affix}+\dotfill
  |\FName{SNNc, Affix}|\\
\Verb+\ForceFN\FName{SNNc, Affix}[Alternate]+\dotfill
  |\ForceFN\FName{SNNc, Affix}[Alternate]|\\
\Verb+\ForceFN\FName{SNNc, Affix}+\dotfill
  |\ForceFN\FName{SNNc, Affix}|
\end{quote}

\subsection{Non-Western Name, Obsolete Syntax}

\begin{quote}
\Verb+\Name{SNNd}[Alternate]+\dotfill
  |\Name{SNNd}[Alternate]|\\
\Verb+\Name*{SNNd}[Alternate]+\dotfill
  |\Name*{SNNd}[Alternate]|\\
\Verb+\Name{SNNd}[Alternate]+\dotfill
  |\Name{SNNd}[Alternate]|\\
\Verb+\FName{SNNd}[Alternate]+\dotfill
  |\FName{SNNd}[Alternate]|\\
\Verb+\ForceFN\FName{SNNd}[Alternate]+\dotfill
  |\ForceFN\FName{SNNd}[Alternate]|
\end{quote}

\subsection{Working with All Forms}

\subsubsection{Index Names and Xrefs}

\begin{quote}
\Verb+\IndexName[FNNe]{SNNe, Affix}[Alternate]+\dotfill
  |\IndexName[FNNe]{SNNe, Affix}[Alternate]|\\
\Verb+\IndexName[FNNe]{SNNe, Affix}+\dotfill
  |\IndexName[FNNe]{SNNe, Affix}|\\
\Verb+\IndexName{SNNf, Affix}[Alternate]+\dotfill
  |\IndexName{SNNf, Affix}[Alternate]|\\
\Verb+\IndexName{SNNf, Affix}+\dotfill
  |\IndexName{SNNf, Affix}|\\
\Verb+\IndexName{SNNf}[Alternate]+\dotfill
  |\IndexName{SNNf}[Alternate]|
\end{quote}

\begin{quote}
\Verb+\IndexRef[FNNg]{SNNg, Affix}[Alternate]{Target}+\dotfill
  |\IndexRef[FNNg]{SNNg, Affix}[Alternate]{Target}|\\
\Verb+\IndexRef[FNNg]{SNNg, Affix}{Target}+\dotfill
  |\IndexRef[FNNg]{SNNg, Affix}{Target}|\\
\Verb+\IndexRef{SNNh, Affix}[Alternate]{Target}+\dotfill
  |\IndexRef{SNNh, Affix}[Alternate]{Target}|\\
\Verb+\IndexRef{SNNh, Affix}{Target}+\dotfill
  |\IndexRef{SNNh, Affix}{Target}|\\
\Verb+\IndexRef{SNNh}[Alternate]{Target}+\dotfill
  |\IndexRef{SNNh}[Alternate]{Target}|
\end{quote}

\subsubsection{Excluding and Including}

\begin{quote}
\Verb+\ExcludeName[FNNi]{SNNi, Affix}[Alternate]+\dotfill
  |\ExcludeName[FNNi]{SNNi, Affix}[Alternate]|\\
\Verb+\ExcludeName[FNNi]{SNNi, Affix}+\dotfill
  |\ExcludeName[FNNi]{SNNi, Affix}|\\
\Verb+\ExcludeName{SNNj, Affix}[Alternate]+\dotfill
  |\ExcludeName{SNNj, Affix}[Alternate]|\\
\Verb+\ExcludeName{SNNj, Affix}+\dotfill
  |\ExcludeName{SNNj, Affix}|\\
\Verb+\ExcludeName{SNNj}[Alternate]+\dotfill
  |\ExcludeName{SNNj}[Alternate]|
\end{quote}

\begin{quote}
\Verb+\IncludeName[FNNi]{SNNi, Affix}[Alternate]+\dotfill
  |\IncludeName[FNNi]{SNNi, Affix}[Alternate]|\\
\Verb+\IncludeName[FNNi]{SNNi, Affix}+\dotfill
  |\IncludeName[FNNi]{SNNi, Affix}|\\
\Verb+\IncludeName{SNNj, Affix}[Alternate]+\dotfill
  |\IncludeName{SNNj, Affix}[Alternate]|\\
\Verb+\IncludeName{SNNj, Affix}+\dotfill
  |\IncludeName{SNNj, Affix}|\\
\Verb+\IncludeName{SNNj}[Alternate]+\dotfill
  |\IncludeName{SNNj}[Alternate]|
\end{quote}

\begin{quote}
\Verb+\IncludeName*[FNNi]{SNNi, Affix}[Alternate]+\dotfill
  |\IncludeName*[FNNi]{SNNi, Affix}[Alternate]|\\
\Verb+\IncludeName*[FNNi]{SNNi, Affix}+\dotfill
  |\IncludeName*[FNNi]{SNNi, Affix}|\\
\Verb+\IncludeName*{SNNj, Affix}[Alternate]+\dotfill
  |\IncludeName*{SNNj, Affix}[Alternate]|\\
\Verb+\IncludeName*{SNNj, Affix}+\dotfill
  |\IncludeName*{SNNj, Affix}|\\
\Verb+\IncludeName*{SNNj}[Alternate]+\dotfill
  |\IncludeName*{SNNj}[Alternate]|
\end{quote}

\subsubsection{Index Sorting}

\begin{quote}
\Verb+\PretagName[FNNk]{SNNk, Affix}[Alternate]{Sorta}+\dotfill
  |\PretagName[FNNk]{SNNk, Affix}[Alternate]{Sorta}|\\
\Verb+\PretagName[FNNl]{SNNl, Affix}{Sortb}+\dotfill
  |\PretagName[FNNl]{SNNl, Affix}{Sortb}|\\
\Verb+\PretagName{SNNm, Affix}[Alternate]{Sortc}+\dotfill
  |\PretagName{SNNm, Affix}[Alternate]{Sortc}|\\
\Verb+\PretagName{SNNn, Affix}{Sortd}+\dotfill
  |\PretagName{SNNn, Affix}{Sortd}|\\
\Verb+\PretagName{SNNo}[Alternate]{Sorte}+\dotfill
  |\PretagName{SNNo}[Alternate]{Sorte}|
\end{quote}

\subsubsection{Index Tagging and Untagging}

\begin{quote}
\Verb+\TagName[FNNa]{SNNa, Affix}[Alternate]{Tag}+\dotfill
  |\TagName[FNNa]{SNNa, Affix}[Alternate]{Tag}|\\
\Verb+\TagName[FNNa]{SNNa, Affix}{Tag}+\dotfill
  |\TagName[FNNa]{SNNa, Affix}{Tag}|\\
\Verb+\TagName[FNNb]{SNNb}[Alternate]{Tag}+\dotfill
  |\TagName[FNNb]{SNNb}[Alternate]{Tag}|\\
\Verb+\TagName[FNNb]{SNNb}{Tag}+\dotfill
  |\TagName[FNNb]{SNNb, Affix}{Tag}|\\
\Verb+\TagName{SNNc, Affix}[Alternate]{Tag}+\dotfill
  |\TagName{SNNc, Affix}[Alternate]{Tag}|\\
\Verb+\TagName{SNNc, Affix}{Tag}+\dotfill
  |\TagName{SNNc, Affix}{Tag}|\\
\Verb+\TagName{SNNd}[Alternate]{Tag}+\dotfill
  |\TagName{SNNd}[Alternate]{Tag}|
\end{quote}

\begin{quote}
\Verb+\UntagName[FNNa]{SNNa, Affix}[Alternate]+\dotfill
  |\UntagName[FNNa]{SNNa, Affix}[Alternate]|\\
\Verb+\UntagName[FNNa]{SNNa, Affix}+\dotfill
  |\UntagName[FNNa]{SNNa, Affix}|\\
\Verb+\UntagName[FNNb]{SNNb}[Alternate]+\dotfill
  |\UntagName[FNNb]{SNNb}[Alternate]|\\
\Verb+\UntagName[FNNb]{SNNb}+\dotfill
  |\UntagName[FNNb]{SNNb, Affix}|\\
\Verb+\UntagName{SNNc, Affix}[Alternate]+\dotfill
  |\UntagName{SNNc, Affix}[Alternate]|\\
\Verb+\UntagName{SNNc, Affix}+\dotfill
  |\UntagName{SNNc, Affix}|\\
\Verb+\UntagName{SNNd}[Alternate]+\dotfill
  |\UntagName{SNNd}[Alternate]|
\end{quote}

\subsubsection{Name Info}

\begin{quote}
\Verb+\NameAddInfo[FNNa]{SNNa, Affix}[Alternate]{Info1}+\dotfill
  |\NameAddInfo[FNNa]{SNNa, Affixa}[Alternate]{Info1}|\\
\Verb+\NameAddInfo[FNNa]{SNNa, Affix}{Info2}+\dotfill
  |\NameAddInfo[FNNa]{SNNa, Affix}{Info2}|\\
\Verb+\NameAddInfo[FNNb]{SNNb}[Alternate]{Info3}+\dotfill
  |\NameAddInfo[FNNb]{SNNb}[Alternate]{Info3}|\\
\Verb+\NameAddInfo[FNNb]{SNNb}{Info4}+\dotfill
  |\NameAddInfo[FNNb]{SNNb}{Info4}|\\
\Verb+\NameAddInfo{SNNc, Affix}[Alternate]{Info5}+\dotfill
  |\NameAddInfo{SNNc, Affix}[Alternate]{Info5}|\\
\Verb+\NameAddInfo{SNNc, Affix}{Info6}+\dotfill
  |\NameAddInfo{SNNc, Affix}{Info6}|\\
\Verb+\NameAddInfo{SNNd}[Alternate]{Info7}+\dotfill
  |\NameAddInfo{SNNd}[Alternate]{Info7}|
\end{quote}

\begin{quote}
\Verb+\NameQueryInfo[FNNa]{SNNa, Affix}[Alternate]+\dotfill
  |\NameQueryInfo[FNNa]{SNNa, Affix}[Alternate]|\\
\Verb+\NameQueryInfo[FNNa]{SNNa, Affix}+\dotfill
  |\NameQueryInfo[FNNa]{SNNa, Affix}|\\
\Verb+\NameQueryInfo[FNNb]{SNNb}[Alternate]+\dotfill
  |\NameQueryInfo[FNNb]{SNNb}[Alternate]|\\
\Verb+\NameQueryInfo[FNNb]{SNNb}+\dotfill
  |\NameQueryInfo[FNNb]{SNNb}|\\
\Verb+\NameQueryInfo{SNNc, Affix}[Alternate]+\dotfill
  |\NameQueryInfo{SNNc, Affix}[Alternate]|\\
\Verb+\NameQueryInfo{SNNc, Affix}+\dotfill
  |\NameQueryInfo{SNNc, Affix}|\\
\Verb+\NameQueryInfo{SNNd}[Alternate]+\dotfill
  |\NameQueryInfo{SNNd}[Alternate]|
\end{quote}

\begin{quote}
\Verb+\NameClearInfo[FNNa]{SNNa, Affix}[Alternate]+\dotfill
  |\NameClearInfo[FNNa]{SNNa, Affix}[Alternate]|\\
\Verb+\NameClearInfo[FNNa]{SNNa, Affix}+\dotfill
  |\NameClearInfo[FNNa]{SNNa, Affix}|\\
\Verb+\NameClearInfo[FNNb]{SNNb}[Alternate]+\dotfill
  |\NameClearInfo[FNNb]{SNNb}[Alternate]|\\
\Verb+\NameClearInfo[FNNb]{SNNb}+\dotfill
  |\NameClearInfo[FNNb]{SNNb}|\\
\Verb+\NameClearInfo{SNNc, Affix}[Alternate]+\dotfill
  |\NameClearInfo{SNNc, Affix}[Alternate]|\\
\Verb+\NameClearInfo{SNNc, Affix}+\dotfill
  |\NameClearInfo{SNNc, Affix}|\\
\Verb+\NameClearInfo{SNNd}[Alternate]+\dotfill
  |\NameClearInfo{SNNd}[Alternate]|
\end{quote}

\subsubsection{Forgetting, Global}

\begin{quote}
\Verb+\ForgetName[FNNa]{SNNa, Affix}[Alternate]+\dotfill
  |\ForgetName[FNNa]{SNNa, Affix}[Alternate]|\\
\Verb+\ForgetName[FNNa]{SNNa, Affix}+\dotfill
  |\ForgetName[FNNa]{SNNa, Affix}|\\
\Verb+\ForgetName[FNNb]{SNNb}[Alternate]+\dotfill
  |\ForgetName[FNNb]{SNNb}[Alternate]|\\
\Verb+\ForgetName[FNNb]{SNNb}+\dotfill
  |\ForgetName[FNNb]{SNNb}|\\
\Verb+\ForgetName{SNNc, Affix}[Alternate]+\dotfill
  |\ForgetName{SNNc, Affix}[Alternate]|\\
\Verb+\ForgetName{SNNc, Affix}+\dotfill
  |\ForgetName{SNNc, Affix}|\\
\Verb+\ForgetName{SNNd}[Alternate]+\dotfill
  |\ForgetName{SNNd}[Alternate]|
\end{quote}

\subsubsection{Subverting, Local}

\begin{quote}
\Verb+\LocalNames+\LocalNames\\
\Verb+\SubvertName[FNNa]{SNNa, Affix}[Alternate]+\dotfill
  |\SubvertName[FNNa]{SNNa, Affix}[Alternate]|\\
\Verb+\SubvertName[FNNb]{SNNb}[Alternate]+\dotfill
  |\SubvertName[FNNb]{SNNb}[Alternate]|\\
\Verb+\SubvertName{SNNc, Affix}[Alternate]+\dotfill
  |\SubvertName{SNNc, Affix}[Alternate]|\\
\Verb+\SubvertName{SNNd}[Alternate]+\dotfill
  |\SubvertName{SNNd}[Alternate]|\\
\Verb+\GlobalNames+\GlobalNames
\end{quote}

\subsubsection{Name Conditionals}

\begin{quote}
\Verb+\IfMainName[FNNa]{SNNa, Affix}{Y}{N}+\dotfill
  |\IfMainName[FNNa]{SNNa, Affix}{Y}{N}|\\
\Verb+\IfMainName[FNNb]{SNNb}{Y}{N}+\dotfill
  |\IfMainName[FNNb]{SNNb}{Y}{N}|\\
\Verb+\IfMainName{SNNc, Affix}{Y}{N}+\dotfill
  |\IfMainName{SNNc, Affix}{Y}{N}|\\
\Verb+\IfMainName{SNNd}[Alternate]{Y}{N}+\dotfill
  |\IfMainName{SNNd}[Alternate]{Y}{N}|
\end{quote}

\begin{quote}
\Verb+\IfFrontName[FNNa]{SNNa, Affix}[Alternate]{Y}{N}+\dotfill
  |\IfFrontName[FNNa]{SNNa, Affix}[Alternate]{Y}{N}|\\
\Verb+\IfFrontName[FNNb]{SNNb}[Alternate]{Y}{N}+\dotfill
  |\IfFrontName[FNNb]{SNNb}[Alternate]{Y}{N}|\\
\Verb+\IfFrontName{SNNc, Affix}[Alternate]{Y}{N}+\dotfill
  |\IfFrontName{SNNc, Affix}[Alternate]{Y}{N}|\\
\Verb+\IfFrontName{SNNd}[Alternate]{Y}{N}+\dotfill
  |\IfFrontName{SNNd}[Alternate]{Y}{N}|
\end{quote}

\begin{quote}
\Verb+\SeeAlso\IndexRef[FNNp]{SNNp, Affix}{Target}+\dotfill
  |\SeeAlso\IndexRef[FNNp]{SNNp, Affix}{Target}|\\
\Verb+\ExcludeName{SNNq, Affix}+\dotfill
  |\ExcludeName{SNNq, Affix}|\\
\Verb+\IfAKA[FNNp]{SNNp, Affix}[Alternate]{Y}{N}{X}+\dotfill
  |\IfAKA[FNNp]{SNNp, Affix}[Alternate]{Y}{N}{X}|\\
\Verb+\IfAKA[FNNp]{SNNp, Affix}{Y}{N}{X}+\dotfill
  |\IfAKA[FNNp]{SNNp, Affix}{Y}{N}{X}|\\
\Verb+\IfAKA{SNNq, Affix}[Alternate]{Y}{N}{X}+\dotfill
  |\IfAKA{SNNq, Affix}[Alternate]{Y}{N}{X}|\\
\Verb+\IfAKA{SNNq, Affix}{Y}{N}{X}+\dotfill
  |\IfAKA{SNNq, Affix}{Y}{N}{X}|\\
\Verb+\IfAKA{SNNr}[Alternate]{Y}{N}{X}+\dotfill
  |\IfAKA{SNNr}[Alternate]{Y}{N}{X}|
\end{quote}

\subsubsection{Pseudonym Syntax: The Horror}

\begin{quote}
\Verb+\AKA[FNN1]{SNN1, Affix1}%+\\
\Verb+  [FNN2]{SNN2, Affix2}[Alternate2]+\dotfill
  |\AKA[FNN1]{SNN1, Affix1}[FNN2]{SNN2, Affix2}[Alternate2]|\\
\Verb+\AKA[FNN1]{SNN1, Affix1}%+\\
\Verb+  [FNN2]{SNN2, Affix2}+\dotfill
  |\AKA[FNN1]{SNN1, Affix1}[FNN2]{SNN2, Affix2}|\\
\Verb+\DropAffix\AKA[FNN1]{SNN1, Affix1}%+\\
\Verb+  [FNN2]{SNN2, Affix2}+\dotfill
  |\DropAffix\AKA[FNN1]{SNN1, Affix1}[FNN2]{SNN2, Affix2}|\\
\Verb+\AKA*[FNN1]{SNN1, Affix1}%+\\
\Verb+  [FNN2]{SNN2, Affix2}[Alternate2]+\dotfill
  |\AKA*[FNN1]{SNN1, Affix1}[FNN2]{SNN2, Affix2}[Alternate2]|\\
\Verb+\AKA*[FNN1]{SNN1, Affix1}%+\\
\Verb+  [FNN2]{SNN2, Affix2}+\dotfill
  |\AKA*[FNN1]{SNN1, Affix1}[FNN2]{SNN2, Affix2}|
\end{quote}

\begin{quote}
\Verb+\AKA[FNN1]{SNN1, Affix1}%+\\
\Verb+  {SNN3, Affix3}[Alternate3]+\dotfill
  |\AKA[FNN1]{SNN1, Affix1}{SNN3, Affix3}[Alternate3]|\\
\Verb+\AKA[FNN1]{SNN1, Affix1}%+\\
\Verb+  {SNN3, Affix3}+\dotfill
  |\AKA[FNN1]{SNN1, Affix1}{SNN3, Affix3}|\\
\Verb+\AKA*[FNN1]{SNN1, Affix1}%+\\
\Verb+  {SNN3, Affix3}+\dotfill
  |\AKA*[FNN1]{SNN1, Affix1}{SNN3, Affix3}|\\
\Verb+\ForceFN\AKA*[FNN1]{SNN1, Affix1}%+\\
\Verb+  {SNN3, Affix3}[Alternate3]+\dotfill
  |\ForceFN\AKA*[FNN1]{SNN1, Affix1}{SNN3, Affix3}[Alternate3]|\\
\Verb+\ForceFN\AKA*[FNN1]{SNN1, Affix1}%+\\
\Verb+  {SNN3, Affix3}+\dotfill
  |\ForceFN\AKA*[FNN1]{SNN1, Affix1}{SNN3, Affix3}|
\end{quote}

\begin{quote}
\Verb+\AKA[FNN1]{SNN1, Affix1}{SNN4}[Alternate4]+\dotfill
  |\AKA[FNN1]{SNN1, Affix1}{SNN4}[Alternate4]|\\
\Verb+\AKA*[FNN1]{SNN1, Affix1}{SNN4}[Alternate4]+\dotfill
  |\AKA*[FNN1]{SNN1, Affix1}{SNN4}[Alternate4]|\\
\Verb+\ForceFN\AKA*[FNN1]{SNN1, Affix1}{SNN4}[Alternate4]+\dotfill
  |\ForceFN\AKA*[FNN1]{SNN1, Affix1}{SNN4}[Alternate4]|
\end{quote}

\begin{quote}
\Verb+\AKA{SNN5, Affix5}%+\\
\Verb+  [FNN6]{SNN6, Affix6}[Alternate6]+\dotfill
  |\AKA{SNN5, Affix5}[FNN6]{SNN6, Affix6}[Alternate6]|\\
\Verb+\AKA{SNN5, Affix5}{SNN7, Affix7}+\dotfill
  |\AKA{SNN5, Affix5}{SNN7, Affix7}|\\
\Verb+\AKA{SNN5, Affix5}{SNN8}[Alternate8]+\dotfill
  |\AKA{SNN5, Affix5}{SNN8}[Alternate8]|\\
\end{quote}

\subsection{Reference Targets for Completeness}

\begin{quote}
\Verb+\IndexName{Target}+\dotfill|\IndexName{Target}|\\
\Verb+\IndexName[FNN1]{SNN1, Affix1}+\dotfill
  |\IndexName[FNN1]{SNN1, Affix1}|\\
\Verb+\IndexName{SNN5, Affix5}+\dotfill
  |\IndexName{SNN5, Affix5}|
\end{quote}

%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%

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

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

\end{document}
