%%
%% This is file `nameauth.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% nameauth.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2024 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.
%% 
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesPackage{nameauth}
    [2024/02/09 4.0 Name authority mechanism for consistency in text and index]
\newif\if@nameauth@InAKA
\newif\if@nameauth@InName
\newif\if@nameauth@Lock
\newif\if@nameauth@BigLock
\newif\if@nameauth@InHook
\newif\if@nameauth@JustIndex
\newif\if@nameauth@Forget
\newif\if@nameauth@Subvert
\newif\ifNameauthWestern
\newif\ifNameauthObsolete
\newif\if@nameauth@AlwaysComma
\newif\if@nameauth@ShowComma
\newif\if@nameauth@NoComma
\newif\if@nameauth@AllCaps
\newif\if@nameauth@AllThis
\newif\if@nameauth@RevAll
\newif\if@nameauth@RevThis
\newif\if@nameauth@RevAllComma
\newif\if@nameauth@RevThisComma
\newif\if@nameauth@Punct
\newif\if@nameauth@NBSP
\newif\if@nameauth@NBSPX
\newif\if@nameauth@FullName
\newif\if@nameauth@FirstName
\newif\if@nameauth@AltAKA
\newif\if@nameauth@ShortSNN
\newif\if@nameauth@EastFN
\newif\if@nameauth@LongIdxDebug
\newif\if@nameauth@DoIndex
\newif\if@nameauth@SkipIndex
\newif\if@nameauth@Pretag
\newif\if@nameauth@Verbose
\newif\if@nameauth@Xref
\newif\if@nameauth@SeeAlso
\newif\if@nameauth@MainFormat
\newif\if@nameauth@AKAFormat
\newif\if@nameauth@FirstFormat
\newif\if@nameauth@AlwaysFormat
\newif\if@nameauth@DoCaps
\newif\if@nameauth@UTF
\newif\if@nameauth@Accent
\newif\if@nameauth@AltFormat
\newif\if@nameauth@DoAlt
\newif\if@nameauth@LocalNames
\newif\if@nameauth@GlobalScope
\newif\if@nameauth@OldAKA
\newif\if@nameauth@OldSee
\newif\if@nameauth@OldReset
\newif\if@nameauth@OldPass
\newif\if@nameauth@OldToks
\newif\if@nameauth@OldArgs
\newtoks\@nameauth@toksa
\newtoks\@nameauth@toksb
\newtoks\@nameauth@toksc
\newtoks\@nameauth@etoksb
\newtoks\@nameauth@etoksc
\newtoks\@nameauth@etoksd
\newcommand*\NamesFormat{}
\newcommand*\MainNameHook{}
\newcommand*\FrontNamesFormat{}
\newcommand*\FrontNameHook{}
\newcommand*\NameauthName{\@nameauth@Name}
\newcommand*\NameauthLName{\@nameauth@Name}
\newcommand*\NameauthFName{\@nameauth@Name}
\newcommand*\NameauthIndex{\index}
\let\NameauthPattern\@empty
\def\@nameauth@Actual{@}
\newcommand*\@nameauth@Exclude{!}
\def\@nameauth@space{ }
\DeclareOption{nocomma}{\@nameauth@AlwaysCommafalse}
\DeclareOption{comma}{\@nameauth@AlwaysCommatrue}
\DeclareOption{normalcaps}{\@nameauth@AllCapsfalse}
\DeclareOption{allcaps}{\@nameauth@AllCapstrue}
\DeclareOption{notreversed}%
  {\@nameauth@RevAllfalse\@nameauth@RevAllCommafalse}
\DeclareOption{allreversed}%
  {\@nameauth@RevAlltrue\@nameauth@RevAllCommafalse}
\DeclareOption{allrevcomma}%
  {\@nameauth@RevAllfalse\@nameauth@RevAllCommatrue}
\DeclareOption{index}{\@nameauth@DoIndextrue}
\DeclareOption{noindex}{\@nameauth@DoIndexfalse}
\DeclareOption{pretag}{\@nameauth@Pretagtrue}
\DeclareOption{nopretag}{\@nameauth@Pretagfalse}
\DeclareOption{verbose}{\@nameauth@Verbosetrue}
\DeclareOption{mainmatter}{\@nameauth@MainFormattrue}
\DeclareOption{frontmatter}{\@nameauth@MainFormatfalse}
\DeclareOption{alwaysformat}{\@nameauth@AlwaysFormattrue}
\DeclareOption{formatAKA}{\@nameauth@AKAFormattrue}
\DeclareOption{noformat}{\renewcommand*\NamesFormat{}}
\DeclareOption{smallcaps}{\renewcommand*\NamesFormat{\scshape}}
\DeclareOption{italic}{\renewcommand*\NamesFormat{\itshape}}
\DeclareOption{boldface}{\renewcommand*\NamesFormat{\bfseries}}
\DeclareOption{altformat}{%
  \@nameauth@AltFormattrue\@nameauth@DoAlttrue}
\DeclareOption{globaltest}{\@nameauth@GlobalScopetrue}
\DeclareOption{oldAKA}{\@nameauth@OldAKAtrue}
\DeclareOption{oldreset}{\@nameauth@OldResettrue}
\DeclareOption{oldpass}{\@nameauth@OldPasstrue}
\DeclareOption{oldtoks}{\@nameauth@OldTokstrue}
\DeclareOption{oldsee}{\@nameauth@OldSeetrue}
\DeclareOption{oldargs}{\@nameauth@OldArgstrue}
\ExecuteOptions
  {nocomma,mainmatter,index,pretag,
   normalcaps,notreversed,noformat}
\ProcessOptions\relax
\RequirePackage{etoolbox}
\RequirePackage{trimspaces}
\RequirePackage{xparse}
\if@nameauth@OldArgs
  \RequirePackage{xargs}
  \RequirePackage{suffix}
\fi
\newcommand*\@nameauth@Clean[1]
  {\expandafter\zap@space\detokenize{#1} \@empty}
\newcommand*\@nameauth@MakeCS[1]
{%
  \unless\ifcsname#1\endcsname
    \unless\if@nameauth@InAKA\csgdef{#1}{}\fi
  \fi
}
\newcommand*\@nameauth@Root[1]{\@nameauth@@Root#1,\\}
\def\@nameauth@@Root#1,#2\\{\trim@spaces{#1}}
\newcommand*\@nameauth@TrimTag[1]{\@nameauth@@TrimTag#1|\\}
\def\@nameauth@@TrimTag#1|#2\\{#1}
\newcommand*\@nameauth@Suffix[1]{\@nameauth@@Suffix#1,,\\}
\def\@nameauth@@Suffix#1,#2,#3\\{%
  \ifx\\#2\\\@empty\else\trim@spaces{#2}\fi
}
\newcommand*\@nameauth@GetSuff[1]{\@nameauth@@GetSuff#1,,\\}
\def\@nameauth@@GetSuff#1,#2,#3\\{#2}
\newcommand*\@nameauth@TestToks[1]
{%
  \toks@\expandafter{\@car#1\@nil}%
  \edef\@nameauth@one{\the\toks@}%
  \toks@\expandafter{\@carß\@nil}%
  \edef\@nameauth@two{\the\toks@}%
  \ifx\@nameauth@one\@nameauth@two
    \@nameauth@UTFtrue%
  \else
    \@nameauth@UTFfalse%
  \fi
}
\newcommand*\@nameauth@UTFtest[1]
{%
  \def\@nameauth@testarg{#1}%
  \ifdefined\Umathchar
    \@nameauth@UTFfalse%
  \else
    \ifdefined\UTFviii@two@octets
      \if@nameauth@Accent
        \@nameauth@UTFtrue\@nameauth@Accentfalse%
      \else
        \expandafter\@nameauth@TestToks
          \expandafter{\@nameauth@testarg}%
      \fi
    \else
      \@nameauth@UTFfalse%
    \fi
  \fi
}
\newcommand*\@nameauth@UTFtestS[1]
{%
  \expandafter\def\expandafter\@nameauth@testarg%
    \expandafter{\@nameauth@GetSuff{#1}}%
  \expandafter\toks@%
    \expandafter\expandafter\expandafter{\@nameauth@testarg}%
  \expandafter\def\expandafter\@nameauth@test@rg%
    \expandafter{\the\toks@}%
  \ifdefined\Umathchar
    \@nameauth@UTFfalse%
  \else
    \ifdefined\UTFviii@two@octets
      \if@nameauth@Accent
        \@nameauth@UTFtrue\@nameauth@Accentfalse%
      \else
        \expandafter\@nameauth@TestToks%
          \expandafter{\@nameauth@test@rg}%
      \fi
    \else
      \@nameauth@UTFfalse%
    \fi
  \fi
}
\newcommand*\@nameauth@Cap[1]{\@nameauth@C@p#1\\}
\def\@nameauth@C@p#1#2\\{%
  \expandafter\trim@spaces\expandafter{\MakeUppercase{#1}#2}%
}
\newcommand*\@nameauth@CapUTF[1]{\@nameauth@C@pUTF#1\\}
\def\@nameauth@C@pUTF#1#2#3\\{%
  \expandafter\trim@spaces\expandafter{\MakeUppercase{#1#2}#3}%
}
\newcommand*\@nameauth@CapArgs[3]
{%
  \ifdefined\@nameauth@InParser
    \unless\if@nameauth@AltFormat
      \let\carga\arga%
      \let\crootb\rootb%
      \let\csuffb\suffb%
      \let\cargc\argc%
      \unless\ifx\arga\@empty
        \def\test{#1}%
        \expandafter\@nameauth@UTFtest\expandafter{\test}%
        \if@nameauth@UTF
          \expandafter\def\expandafter\carga\expandafter{%
            \expandafter\@nameauth@CapUTF\expandafter{\test}}%
        \else
          \expandafter\def\expandafter\carga\expandafter{%
            \expandafter\@nameauth@Cap\expandafter{\test}}%
        \fi
      \fi
      \def\test{#2}%
      \expandafter\@nameauth@UTFtest\expandafter{\test}%
      \if@nameauth@UTF
        \expandafter\def\expandafter\crootb\expandafter{%
          \expandafter\@nameauth@CapUTF\expandafter{\rootb}}%
      \else
        \expandafter\def\expandafter\crootb\expandafter{%
          \expandafter\@nameauth@Cap\expandafter{\rootb}}%
      \fi
      \unless\ifx\suffb\@empty
        \def\test{#2}%
        \expandafter\@nameauth@UTFtestS\expandafter{\test}%
        \protected@edef\test{\@nameauth@GetSuff{#2}}%
        \if@nameauth@UTF
          \protected@edef\test{\@nameauth@Suffix{#2}}%
          \expandafter\def\expandafter\csuffb\expandafter{%
            \expandafter\@nameauth@CapUTF\expandafter{\test}}%
        \else
          \edef\@nameauth@test{\@nameauth@Suffix{#2}}%
          \expandafter\def\expandafter\csuffb\expandafter{%
            \expandafter\@nameauth@Cap\expandafter{\test}}%
        \fi
      \fi
      \unless\ifx\argc\@empty
        \def\test{#3}%
        \expandafter\@nameauth@UTFtest\expandafter{\test}%
        \if@nameauth@UTF
          \expandafter\def\expandafter\cargc\expandafter{%
            \expandafter\@nameauth@CapUTF\expandafter{\test}}%
        \else
          \expandafter\def\expandafter\cargc\expandafter{%
            \expandafter\@nameauth@Cap\expandafter{\test}}%
        \fi
      \fi
      \let\arga\carga%
      \let\rootb\crootb%
      \let\suffb\csuffb%
      \let\argc\cargc%
    \fi
  \fi
}
\newcommand*\@nameauth@TestDot[1]
{%
  \def\@nameauth@TestD@t##1.\@End##2\\{\@nameauth@TestPunct{##2}}%
  \def\@nameauth@TestPunct##1%
  {%
    \ifx\@nameauth@TestPunct##1\@nameauth@TestPunct
    \else
      \global\@nameauth@Puncttrue%
    \fi
  }%
  \global\@nameauth@Punctfalse%
  \@nameauth@TestD@t#1\@End.\@End\\%
}
\newcommand*\@nameauth@CheckDot
  {\futurelet\@nameauth@token\@nameauth@EvalDot}
\newcommand*\@nameauth@EvalDot
{%
  \let\@nameauth@stop=.%
  \ifx\@nameauth@token\@nameauth@stop
    \expandafter\@gobble \fi
}
\newcommand*\@nameauth@AddPunct
{%
  \ifdefined\@nameauth@InParser
    \def\Space{ }%
    \def\SpaceW{ }%
    \if@nameauth@NBSP \edef\Space{\nobreakspace}\fi
    \if@nameauth@NBSPX \edef\SpaceW{\nobreakspace}\fi
    \unless\ifx\arga\@empty
      \if@nameauth@AlwaysComma
        \def\Space{, }%
        \if@nameauth@NBSP\edef\Space{,\nobreakspace}\fi
      \fi
      \if@nameauth@ShowComma
        \def\Space{, }%
        \if@nameauth@NBSP\edef\Space{,\nobreakspace}\fi
      \fi
      \if@nameauth@NoComma
        \def\Space{ }%
        \if@nameauth@NBSP\edef\Space{\nobreakspace}\fi
      \fi
    \fi
  \fi
}
\newcommand*\@nameauth@LoadArgs[3]
{%
  \protected@edef\@nameauth@A{\trim@spaces{#1}}%
  \protected@edef\@nameauth@B{\@nameauth@Root{#2}}%
  \protected@edef\@nameauth@SB{\@nameauth@Suffix{#2}}%
  \protected@edef\@nameauth@C{\trim@spaces{#3}}%
  \def\@nameauth@csb{\@nameauth@Clean{#2}}%
  \def\@nameauth@csbc{\@nameauth@Clean{#2,#3}}%
  \def\@nameauth@csab{\@nameauth@Clean{#1!#2}}%
}
\newcommand\@nameauth@Choice[3]
{%
  \ifx\@nameauth@A\@empty
    \ifx\@nameauth@C\@empty
      \let\NameauthPattern\@nameauth@csb%
      \NameauthWesternfalse \NameauthObsoletefalse%
      #1%
    \else
      \ifx\@nameauth@SB\@empty
        \let\NameauthPattern\@nameauth@csbc%
        \NameauthWesternfalse \NameauthObsoletetrue%
        #2%
      \else
        \let\NameauthPattern\@nameauth@csb%
        \NameauthWesternfalse \NameauthObsoletefalse%
        #1%
      \fi
    \fi
  \else
    \let\NameauthPattern\@nameauth@csab%
    \NameauthWesterntrue \NameauthObsoletefalse%
    #3%
  \fi
}
\newcommand*\@nameauth@Flags
{%
  \if@nameauth@OldReset
    \if@nameauth@InAKA\@nameauth@AltAKAfalse\fi
    \@nameauth@SkipIndexfalse%
    \if@nameauth@InName
      \@nameauth@Forgetfalse%
      \@nameauth@Subvertfalse%
    \fi
    \@nameauth@NBSPfalse%
    \@nameauth@NBSPXfalse%
    \@nameauth@DoCapsfalse%
    \@nameauth@Accentfalse%
    \@nameauth@AllThisfalse%
    \@nameauth@ShowCommafalse%
    \@nameauth@NoCommafalse%
    \@nameauth@RevThisfalse%
    \@nameauth@RevThisCommafalse%
    \@nameauth@ShortSNNfalse%
    \@nameauth@EastFNfalse%
  \else
    \if@nameauth@InAKA\global\@nameauth@AltAKAfalse\fi
    \global\@nameauth@SkipIndexfalse%
    \global\@nameauth@Forgetfalse%
    \global\@nameauth@Subvertfalse%
    \global\@nameauth@NBSPfalse%
    \global\@nameauth@NBSPXfalse%
    \global\@nameauth@DoCapsfalse%
    \global\@nameauth@Accentfalse%
    \global\@nameauth@AllThisfalse%
    \global\@nameauth@ShowCommafalse%
    \global\@nameauth@NoCommafalse%
    \global\@nameauth@RevThisfalse%
    \global\@nameauth@RevThisCommafalse%
    \global\@nameauth@ShortSNNfalse%
    \global\@nameauth@EastFNfalse%
  \fi
}
\newcommand*\@nameauth@Error[2]
{%
  \edef\@nameauth@msga{#2 SNN arg empty}%
  \edef\@nameauth@msgb{#2 SNN arg malformed}%
  \protected@edef\@nameauth@testname{\trim@spaces{#1}}%
  \protected@edef\@nameauth@testroot{\@nameauth@Root{#1}}%
  \ifx\@nameauth@testname\@empty
    \PackageError{nameauth}{\@nameauth@msga}%
  \fi
  \ifx\@nameauth@testroot\@empty
      \PackageError{nameauth}{\@nameauth@msgb}%
  \fi
}
\newcommand*\@nameauth@IdxPageref[3]
{%
  \if@nameauth@SkipIndex
    \PackageWarning{nameauth}
    {\string\SkipIndex precedes \string\ShowIdxPageref; check}%
    \unless\if@nameauth@OldReset
      \@nameauth@SkipIndexfalse%
    \fi
  \fi
  \begingroup%
    \def\NameauthIndex##1{##1}%
    \@nameauth@DoIndextrue%
    \@nameauth@Choice{}{}{}%
    \csundef{\NameauthPattern!PN}%
    \unless\if@nameauth@LongIdxDebug
      \csundef{\NameauthPattern!PRE}%
      \csundef{\NameauthPattern!TAG}%
    \fi
    \IndexName[#1]{#2}[#3]%
  \endgroup%
  \global\@nameauth@LongIdxDebugfalse%
}
\NewDocumentCommand{\@nameauth@Name}{O{} m O{}}
{%
  \if@nameauth@BigLock \@nameauth@Locktrue\fi
  \unless\if@nameauth@Lock
    \@nameauth@Locktrue%
    \@nameauth@InNametrue%
    \@nameauth@Error{#2}{macro \string\@nameauth@name}%
    \if@nameauth@JustIndex
      \IndexName[#1]{#2}[#3]%
      \if@nameauth@OldPass
        \@nameauth@JustIndexfalse%
      \else
        \if@nameauth@OldReset
          \@nameauth@FullNamefalse%
          \@nameauth@FirstNamefalse%
          \@nameauth@JustIndexfalse%
        \else
          \global\@nameauth@FullNamefalse%
          \global\@nameauth@FirstNamefalse%
          \global\@nameauth@JustIndexfalse%
        \fi
      \fi
    \else
      \if@nameauth@Subvert \SubvertName[#1]{#2}[#3]\fi
      \if@nameauth@Forget \ForgetName[#1]{#2}[#3]\fi
      \leavevmode\hbox{}%
      \unless\if@nameauth@SkipIndex \IndexName[#1]{#2}[#3]\fi
      \if@nameauth@MainFormat
        \@nameauth@Parse{#1}{#2}{#3}{!MN}%
      \else
        \@nameauth@Parse{#1}{#2}{#3}{!NF}%
      \fi
      \unless\if@nameauth@SkipIndex \IndexName[#1]{#2}[#3]\fi
      \@nameauth@Flags%
    \fi
    \@nameauth@Lockfalse%
    \@nameauth@InNamefalse%
  \fi
  \if@nameauth@Punct\expandafter\@nameauth@CheckDot\fi
}
\newcommand\@nameauth@Parse[4]
{%
  \if@nameauth@BigLock \@nameauth@Lockfalse\fi
  \if@nameauth@Lock
    \if@nameauth@OldToks
      \@nameauth@toksa\expandafter{#1}%
      \@nameauth@toksb\expandafter{#2}%
      \@nameauth@toksc\expandafter{#3}%
    \else
      \global\@nameauth@toksa\expandafter{#1}%
      \global\@nameauth@toksb\expandafter{#2}%
      \global\@nameauth@toksc\expandafter{#3}%
    \fi
      \if@nameauth@AllCaps     \@nameauth@AllThistrue\fi
      \if@nameauth@RevAll      \@nameauth@RevThistrue\fi
      \if@nameauth@RevAllComma \@nameauth@RevThisCommatrue\fi
    \begingroup%
      \def\@nameauth@InParser{}%
      \@nameauth@LoadArgs{#1}{#2}{#3}%
      \let\arga\@nameauth@A%
      \let\rootb\@nameauth@B%
      \let\suffb\@nameauth@SB%
      \let\argc\@nameauth@C%
      \if@nameauth@DoCaps
        \@nameauth@CapArgs{#1}{#2}{#3}%
      \fi
      \if@nameauth@AllThis
        \protected@edef\rootb%
          {\MakeUppercase{\@nameauth@Root{#2}}}%
      \fi
      \@nameauth@AddPunct%
      \let\SNN\rootb%
      \@nameauth@Choice
      {%
        \ifx\argc\@empty
          \let\FNN\suffb%
        \else
          \let\FNN\argc%
        \fi
        \@nameauth@NonWest{\@nameauth@csb#4}%
        \@nameauth@MakeCS{\@nameauth@csb#4}%
      }%
      {%
        \let\FNN\argc%
        \@nameauth@NonWest{\@nameauth@csbc#4}%
        \@nameauth@MakeCS{\@nameauth@csbc#4}%
      }%
      {%
        \ifx\argc\@empty
          \let\FNN\arga%
        \else
          \let\FNN\argc%
        \fi
        \unless\ifx\suffb\@empty
          \def\SNN{\rootb\Space\suffb}%
          \if@nameauth@ShortSNN
            \let\SNN\rootb%
          \fi
        \fi
        \@nameauth@West{\@nameauth@csab#4}%
        \@nameauth@MakeCS{\@nameauth@csab#4}%
      }%
    \endgroup%
    \if@nameauth@OldReset
      \@nameauth@FullNamefalse%
      \@nameauth@FirstNamefalse%
      \@nameauth@FirstFormatfalse%
    \else
      \global\@nameauth@FullNamefalse%
      \global\@nameauth@FirstNamefalse%
      \global\@nameauth@FirstFormatfalse%
    \fi
  \fi
}
\newcommand*\@nameauth@NonWest[1]
{%
  \ifdefined\@nameauth@InParser
    \@nameauth@Form{#1}%
    \ifx\FNN\@empty
      \@nameauth@Hook{\SNN}%
    \else
      \if@nameauth@FullName
        \if@nameauth@RevThis
          \@nameauth@Hook{\FNN\Space\SNN}%
        \else
          \@nameauth@Hook{\SNN\Space\FNN}%
        \fi
      \else
        \if@nameauth@FirstName
          \if@nameauth@EastFN
            \@nameauth@Hook{\FNN}%
          \else
            \@nameauth@Hook{\SNN}%
          \fi
        \else
          \@nameauth@Hook{\SNN}%
        \fi
      \fi
    \fi
  \fi
}
\newcommand*\@nameauth@West[1]
{%
  \ifdefined\@nameauth@InParser
    \@nameauth@Form{#1}%
    \edef\RevSpace{,\SpaceW}%
    \if@nameauth@FullName
      \if@nameauth@RevThis
        \@nameauth@Hook{\SNN\SpaceW\FNN}%
      \else
        \if@nameauth@RevThisComma
          \@nameauth@Hook{\SNN\RevSpace\FNN}%
        \else
          \@nameauth@Hook{\FNN\SpaceW\SNN}%
        \fi
      \fi
    \else
      \if@nameauth@FirstName
        \@nameauth@Hook{\FNN}%
      \else
        \@nameauth@Hook{\rootb}%
      \fi
    \fi
  \fi
}
\newcommand*\@nameauth@Form[1]
{%
  \ifdefined\@nameauth@InParser
    \unless\ifcsname#1\endcsname
      \@nameauth@FirstFormattrue%
      \@nameauth@FullNametrue%
      \@nameauth@FirstNamefalse%
    \else
      \if@nameauth@AlwaysFormat\@nameauth@FirstFormattrue\fi
    \fi
    \unless\if@nameauth@InAKA
      \if@nameauth@FirstName\@nameauth@FullNamefalse\fi
    \else
      \if@nameauth@AltAKA
        \if@nameauth@OldAKA\@nameauth@EastFNtrue\fi
        \@nameauth@FullNamefalse%
        \@nameauth@FirstNametrue%
      \else
        \@nameauth@FullNametrue%
        \@nameauth@FirstNamefalse%
      \fi
      \unless\if@nameauth@AlwaysFormat
        \unless\if@nameauth@AKAFormat
          \@nameauth@FirstFormatfalse%
        \fi
      \fi
    \fi
  \fi
}
\newcommand*\@nameauth@Hook[1]
{%
  \ifdefined\@nameauth@InParser
    \@nameauth@InHooktrue%
    \protected@edef\test{#1}%
    \expandafter\@nameauth@TestDot\expandafter{\test}%
    \if@nameauth@MainFormat
      \if@nameauth@FirstFormat
        \bgroup\NamesFormat{#1}\egroup%
      \else
        \bgroup\MainNameHook{#1}\egroup%
      \fi
    \else
      \if@nameauth@FirstFormat
        \bgroup\FrontNamesFormat{#1}\egroup%
      \else
        \bgroup\FrontNameHook{#1}\egroup%
      \fi
    \fi
  \fi
}
\newcommand*\@nameauth@Index[2]
{%
  \if@nameauth@DoIndex
    \ifcsname#1!TAG\endcsname
      \protected@edef\@nameauth@Tag{\csname#1!TAG\endcsname}%
      \expandafter\def\expandafter\@nameauth@ShortTag\expandafter{%
        \expandafter\@nameauth@TrimTag\expandafter{\@nameauth@Tag}}%
      \ifcsname#1!PRE\endcsname
        \protected@edef\@nameauth@Pre{\csname#1!PRE\endcsname}%
        \if@nameauth@Xref
          \protected@edef\@nameauth@IdxEntry
            {\@nameauth@Pre#2\@nameauth@ShortTag}%
        \else
          \protected@edef\@nameauth@IdxEntry
            {\@nameauth@Pre#2\@nameauth@Tag}%
        \fi
      \else
        \if@nameauth@Xref
          \protected@edef\@nameauth@IdxEntry
            {#2\@nameauth@ShortTag}%
        \else
          \protected@edef\@nameauth@IdxEntry
            {#2\@nameauth@Tag}%
        \fi
      \fi
    \else
      \ifcsname#1!PRE\endcsname
        \protected@edef\@nameauth@Pre{\csname#1!PRE\endcsname}%
        \protected@edef\@nameauth@IdxEntry{\@nameauth@Pre#2}%
      \else
        \protected@edef\@nameauth@IdxEntry{#2}%
      \fi
    \fi
    \expandafter\NameauthIndex\expandafter{\@nameauth@IdxEntry}%
  \fi
}
\newcommand*\ShowComma{\@nameauth@ShowCommatrue}
\newcommand*\NoComma{\@nameauth@NoCommatrue}
\newcommand*\CapThis{\@nameauth@DoCapstrue}
\newcommand*\AccentCapThis
  {\@nameauth@Accenttrue\@nameauth@DoCapstrue}
\newcommand*\CapName{\@nameauth@AllThistrue}
\newcommand*\RevName{\@nameauth@RevThistrue}
\newcommand*\ForceFN{\@nameauth@EastFNtrue}
\newcommand*\RevComma{\@nameauth@RevThisCommatrue}
\newcommand*\DropAffix{\@nameauth@ShortSNNtrue}
\newcommand*\KeepAffix{\@nameauth@NBSPtrue}
\newcommand*\KeepName
  {\@nameauth@NBSPtrue\@nameauth@NBSPXtrue}
\newcommand*\SkipIndex{\@nameauth@SkipIndextrue}
\newcommand*\JustIndex{\@nameauth@JustIndextrue}
\newcommand*\SeeAlso{\@nameauth@SeeAlsotrue}
\newcommand*\ForceName{\@nameauth@FirstFormattrue}
\newcommand*\ForgetThis{\@nameauth@Forgettrue}
\newcommand*\SubvertThis{\@nameauth@Subverttrue}
\newcommand*\AllCapsInactive{\@nameauth@AllCapsfalse}
\newcommand*\AllCapsActive{\@nameauth@AllCapstrue}
\newcommand*\ReverseInactive{\@nameauth@RevAllfalse}
\newcommand*\ReverseActive{\@nameauth@RevAlltrue}
\newcommand*\ReverseCommaInactive{\@nameauth@RevAllCommafalse}
\newcommand*\ReverseCommaActive{\@nameauth@RevAllCommatrue}
\newcommand*\IndexActual[1]{\def\@nameauth@Actual{#1}}
\newcommand*\IndexInactive{\@nameauth@DoIndexfalse}
\newcommand*\IndexActive{\@nameauth@DoIndextrue}
\newcommand*\IndexWarnVerbose{\@nameauth@Verbosetrue}
\newcommand*\IndexWarnTerse{\@nameauth@Verbosefalse}
\newcommand*\IndexProtect
  {\@nameauth@DoIndexfalse\@nameauth@BigLocktrue}
\newcommand*\NamesInactive{\@nameauth@MainFormatfalse}
\newcommand*\NamesActive{\@nameauth@MainFormattrue}
\NewDocumentCommand{\AltFormatActive}{s}
{%
  \global\@nameauth@AltFormattrue%
  \IfBooleanTF{#1}
    {\global\@nameauth@DoAltfalse}
    {\global\@nameauth@DoAlttrue}%
}
\newcommand*\AltFormatInactive
  {\global\@nameauth@AltFormatfalse\global\@nameauth@DoAltfalse}
\newcommand*\AltOn
{%
  \if@nameauth@InHook
    \if@nameauth@AltFormat\@nameauth@DoAlttrue\fi
  \fi
}
\newcommand*\AltOff
{%
  \if@nameauth@InHook
    \if@nameauth@AltFormat\@nameauth@DoAltfalse\fi
  \fi
}
\newcommand*\AltCaps[1]
{%
  \if@nameauth@InHook
    \if@nameauth@DoCaps\MakeUppercase{#1}\else#1\fi
  \else
    #1%
  \fi
}
\newcommand*\textSC[1]
  {\if@nameauth@DoAlt\textsc{#1}\else#1\fi}
\newcommand*\textUC[1]
  {\if@nameauth@DoAlt\MakeUppercase{#1}\else#1\fi}
\newcommand*\textIT[1]
  {\if@nameauth@DoAlt\textit{#1}\else#1\fi}
\newcommand*\textBF[1]
  {\if@nameauth@DoAlt\textbf{#1}\else#1\fi}
\newcommand*\LocalNameTest{\global\@nameauth@GlobalScopefalse}
\newcommand*\GlobalNameTest{\global\@nameauth@GlobalScopetrue}
\newcommand*\LocalNames{\global\@nameauth@LocalNamestrue}
\newcommand*\GlobalNames{\global\@nameauth@LocalNamesfalse}
\newcommand*\NameParser
{%
  \if@nameauth@InHook
    \let\SNN\rootb%
    \@nameauth@Choice
    {%
      \ifx\argc\@empty \let\FNN\suffb \else \let\FNN\argc \fi
      \ifx\FNN\@empty
        \SNN%
      \else
        \if@nameauth@FullName
          \if@nameauth@RevThis \FNN\Space\SNN \else \SNN\Space\FNN%
          \fi
        \else
          \if@nameauth@FirstName
            \if@nameauth@EastFN \FNN \else \SNN \fi
          \else
            \SNN%
          \fi
        \fi
      \fi
    }%
    {%
      \let\FNN\argc%
      \if@nameauth@FullName%
        \if@nameauth@RevThis \FNN\Space\SNN \else \SNN\Space\FNN \fi
      \else
        \if@nameauth@FirstName
          \if@nameauth@EastFN \FNN \else \SNN \fi
        \else
          \SNN%
        \fi
      \fi
    }%
    {%
      \ifx\argc\@empty \let\FNN\arga \else \let\FNN\argc \fi
      \unless\ifx\suffb\@empty
        \def\SNN{\rootb\Space\suffb}%
        \if@nameauth@ShortSNN \let\SNN\rootb \fi
      \fi
      \if@nameauth@FullName
        \if@nameauth@RevThis
          \SNN\SpaceW\FNN%
        \else
          \if@nameauth@RevThisComma
            \SNN\RevSpace\FNN%
          \else
            \FNN\SpaceW\SNN%
          \fi
        \fi
      \else
        \if@nameauth@FirstName \FNN \else \let\SNN\rootb \SNN \fi
      \fi
    }%
  \fi
}
\NewDocumentCommand{\Name}{s}
{%
  \IfBooleanTF{#1}
    {\@nameauth@FullNametrue\NameauthLName}
    {\NameauthName}%
}
\NewDocumentCommand{\FName}{s}
  {\@nameauth@FirstNametrue\NameauthFName}
\newenvironment{nameauth}
{%
  \begingroup%
  \let\ex\expandafter%
  \csdef{<}##1&##2&##3&##4>{%
    \protected@edef\@arga@{\trim@spaces{##1}}%
    \protected@edef\@larga@{L\trim@spaces{##1}}%
    \protected@edef\@sarga@{S\trim@spaces{##1}}%
    \protected@edef\@testb@{\trim@spaces{##2}}%
    \protected@edef\@testd@{\trim@spaces{##4}}%
    \@nameauth@etoksb\ex{##2}%
    \@nameauth@etoksc\ex{##3}%
    \@nameauth@etoksd\ex{##4}%
    \ifx\@arga@\@empty
      \PackageError{nameauth}%
      {environment nameauth: Macro name missing;
      \expandafter\detokenize\expandafter{##3}}%
    \fi
    \@nameauth@Error{##3}{macro: \ex\zap@space\string\ \@empty##1}%
    \ifcsname\@arga@\endcsname
      \PackageWarning{nameauth}
      {Environment nameauth: shorthand macro already exists}%
    \fi
    \ifx\@testd@\@empty
      \ifx\@testb@\@empty
        \ex\csgdef\ex{\ex\@arga@\ex}%
          \ex{\ex\NameauthName\ex{\the\@nameauth@etoksc}}%
        \ex\csgdef\ex{\ex\@larga@\ex}%
          \ex{\ex\@nameauth@FullNametrue%
          \ex\NameauthLName\ex{\the\@nameauth@etoksc}}%
        \ex\csgdef\ex{\ex\@sarga@\ex}%
          \ex{\ex\@nameauth@FirstNametrue%
          \ex\NameauthFName\ex{\the\@nameauth@etoksc}}%
      \else
        \ex\ex\ex\csgdef\ex\ex\ex{\ex\ex\ex\@arga@\ex\ex\ex}%
          \ex\ex\ex{\ex\ex\ex\NameauthName%
          \ex\ex\ex[\ex\the\ex\@nameauth@etoksb\ex]%
          \ex{\the\@nameauth@etoksc}}%
        \ex\ex\ex\csgdef\ex\ex\ex{\ex\ex\ex\@larga@\ex\ex\ex}%
          \ex\ex\ex{\ex\ex\ex\@nameauth@FullNametrue%
          \ex\ex\ex\NameauthLName%
          \ex\ex\ex[\ex\the\ex\@nameauth@etoksb\ex]%
          \ex{\the\@nameauth@etoksc}}%
        \ex\ex\ex\csgdef\ex\ex\ex{\ex\ex\ex\@sarga@\ex\ex\ex}%
          \ex\ex\ex{\ex\ex\ex\@nameauth@FirstNametrue%
          \ex\ex\ex\NameauthFName%
          \ex\ex\ex[\ex\the\ex\@nameauth@etoksb\ex]%
          \ex{\the\@nameauth@etoksc}}%
      \fi
    \else
      \ifx\@testb@\@empty
        \ex\ex\ex\csgdef\ex\ex\ex{\ex\ex\ex\@arga@\ex\ex\ex}%
          \ex\ex\ex{\ex\ex\ex\NameauthName%
          \ex\ex\ex{\ex\the\ex\@nameauth@etoksc\ex}%
          \ex[\the\@nameauth@etoksd]}%
        \ex\ex\ex\csgdef\ex\ex\ex{\ex\ex\ex\@larga@\ex\ex\ex}%
          \ex\ex\ex{\ex\ex\ex\@nameauth@FullNametrue%
          \ex\ex\ex\NameauthLName%
          \ex\ex\ex{\ex\the\ex\@nameauth@etoksc\ex}%
          \ex[\the\@nameauth@etoksd]}%
        \ex\ex\ex\csgdef\ex\ex\ex{\ex\ex\ex\@sarga@\ex\ex\ex}%
          \ex\ex\ex{\ex\ex\ex\@nameauth@FirstNametrue%
          \ex\ex\ex\NameauthFName%
          \ex\ex\ex{\ex\the\ex\@nameauth@etoksc\ex}%
          \ex[\the\@nameauth@etoksd]}%
      \else
        \ex\ex\ex\ex\ex\ex\ex\csgdef\ex\ex\ex\ex\ex\ex\ex{%
          \ex\ex\ex\ex\ex\ex\ex\@arga@\ex\ex\ex\ex\ex\ex\ex}%
          \ex\ex\ex\ex\ex\ex\ex{\ex\ex\ex\ex\ex\ex\ex\NameauthName%
          \ex\ex\ex\ex\ex\ex\ex[\ex\ex\ex\the%
          \ex\ex\ex\@nameauth@etoksb\ex\ex\ex]%
          \ex\ex\ex{\ex\the\ex\@nameauth@etoksc\ex}%
          \ex[\the\@nameauth@etoksd]}%
        \ex\ex\ex\ex\ex\ex\ex\csgdef\ex\ex\ex\ex\ex\ex\ex{%
          \ex\ex\ex\ex\ex\ex\ex\@larga@\ex\ex\ex\ex\ex\ex\ex}%
          \ex\ex\ex\ex\ex\ex\ex{%
          \ex\ex\ex\ex\ex\ex\ex\@nameauth@FullNametrue%
          \ex\ex\ex\ex\ex\ex\ex\NameauthLName%
          \ex\ex\ex\ex\ex\ex\ex[\ex\ex\ex\the\ex\ex\ex%
          \@nameauth@etoksb\ex\ex\ex]%
          \ex\ex\ex{\ex\the\ex\@nameauth@etoksc\ex}%
          \ex[\the\@nameauth@etoksd]}%
        \ex\ex\ex\ex\ex\ex\ex\csgdef\ex\ex\ex\ex\ex\ex\ex{%
          \ex\ex\ex\ex\ex\ex\ex\@sarga@\ex\ex\ex\ex\ex\ex\ex}%
          \ex\ex\ex\ex\ex\ex\ex{%
          \ex\ex\ex\ex\ex\ex\ex\@nameauth@FirstNametrue%
          \ex\ex\ex\ex\ex\ex\ex\NameauthFName%
          \ex\ex\ex\ex\ex\ex\ex[\ex\ex\ex\the\ex\ex\ex%
          \@nameauth@etoksb\ex\ex\ex]%
          \ex\ex\ex{\ex\the\ex\@nameauth@etoksc\ex}%
          \ex[\the\@nameauth@etoksd]}%
      \fi
    \fi\ignorespaces%
  }\ignorespaces%
}
{\endgroup\ignorespaces}
\NewDocumentCommand{\ShowPattern}{O{} m O{}}
{%
    \@nameauth@Error{#2}{macro: \string\ShowPattern}%
    \@nameauth@LoadArgs{#1}{#2}{#3}%
    \@nameauth@Choice{}{}{}\NameauthPattern%
}
\NewDocumentCommand{\ShowIdxPageref}{s O{} m O{}}
{%
  \IfBooleanTF {#1}%
  {%
    \@nameauth@Error{#3}{macro: \string\ShowIdxPageref*}%
    \@nameauth@LoadArgs{#2}{#3}{#4}%
    \@nameauth@IdxPageref{#2}{#3}{#4}%
  }%
  {%
    \@nameauth@Error{#3}{macro: \string\ShowIdxPageref}%
    \@nameauth@LoadArgs{#2}{#3}{#4}%
    \global\@nameauth@LongIdxDebugtrue%
    \@nameauth@IdxPageref{#2}{#3}{#4}%
  }%
}
\NewDocumentCommand{\ShowNameInfo}{O{} m O{}}
{%
  \@nameauth@Error{#2}{macro: \string\ShowNameInfo}%
  \@nameauth@LoadArgs{#1}{#2}{#3}%
  \@nameauth@Choice
  {%
    (SNN: \expandafter\detokenize\expandafter{\@nameauth@B})%
    \unless\ifx\@nameauth@SB\@empty
      \ (Affix*:
      \expandafter\detokenize\expandafter{\@nameauth@SB})%
    \fi
    \unless\ifx\@nameauth@C\@empty
      \ (Alt:
      \expandafter\detokenize\expandafter{\@nameauth@C})%
    \fi
  }%
  {%
    (SNN: \expandafter\detokenize\expandafter{\@nameauth@B})%
    \unless\ifx\@nameauth@C\@empty
      \ (Alt*:
      \expandafter\detokenize\expandafter{\@nameauth@C})%
    \fi
  }%
  {%
    (FNN: \expandafter\detokenize\expandafter{\@nameauth@A})
    (SNN: \expandafter\detokenize\expandafter{\@nameauth@B})%
    \unless\ifx\@nameauth@SB\@empty
      \ (Affix:
      \expandafter\detokenize\expandafter{\@nameauth@SB})%
    \fi
    \unless\ifx\@nameauth@C\@empty
      \ (Alt:
      \expandafter\detokenize\expandafter{\@nameauth@C})%
    \fi
  }%
}
\NewDocumentCommand{\ShowNameState}{O{} m O{}}
{%
  \begingroup%
  \@nameauth@Error{#2}{macro: \string\NamePatterns}%
  \@nameauth@LoadArgs{#1}{#2}{#3}%
  \@nameauth@Choice
    {\def\@nameauth@nametype{nw}}
    {\def\@nameauth@nametype{nw,os}}
    {\def\@nameauth@nametype{w}}
  \ifcsname\NameauthPattern!MN\endcsname
    \def\@nameauth@mainname{main}%
  \fi
  \ifcsname\NameauthPattern!NF\endcsname
    \def\@nameauth@frontname{front}%
  \fi
  \ifcsname\NameauthPattern!PN\endcsname
    \edef\@nameauth@testex
      {\csname\NameauthPattern!PN\endcsname}%
    \ifx\@nameauth@testex\@nameauth@Exclude
      \def\@nameauth@excl{excl}%
    \else
      \def\@nameauth@xref{xref}%
    \fi
  \fi
  \ifcsname\NameauthPattern!PRE\endcsname
    \def\@nameauth@pre{pretag}%
  \fi
  \ifcsname\NameauthPattern!TAG\endcsname
    \def\@nameauth@tag{idxtag}%
  \fi
  \ifcsname\NameauthPattern!DB\endcsname
    \def\@nameauth@db{namedb}%
  \fi
  \ifdefined \@nameauth@mainname \def\@nameauth@namecs{}\fi
  \ifdefined \@nameauth@frontname \def\@nameauth@namecs{}\fi
  \ifdefined \@nameauth@xref
    \ifdefined \@nameauth@excl
      \PackageWarning{nameauth}
      {Both xref and exclusion exist for \NameauthPattern}%
    \fi
  \fi
  \ifdefined \@nameauth@namecs
    \def\@nameauth@idxstate{2}%
    \ifdefined \@nameauth@xref
      \def\@nameauth@idxstate{4}%
    \fi
    \ifdefined \@nameauth@excl
      \def\@nameauth@idxstate{6}%
    \fi
   \else
    \def\@nameauth@idxstate{1}%
    \ifdefined \@nameauth@xref
      \def\@nameauth@idxstate{3}%
    \fi
    \ifdefined \@nameauth@excl
      \def\@nameauth@idxstate{5}%
    \fi
  \fi
  Pattern: {\NameauthPattern}
  Type: {\@nameauth@nametype}
  Index state: {\@nameauth@idxstate}
  Systems:%
  \ifdefined \@nameauth@mainname\ \@nameauth@mainname \fi
  \ifdefined \@nameauth@frontname\ \@nameauth@frontname \fi
  \ifdefined \@nameauth@xref\ \@nameauth@xref \fi
  \ifdefined \@nameauth@excl\ \@nameauth@excl \fi
  \ifdefined \@nameauth@pre\ \@nameauth@pre \fi
  \ifdefined \@nameauth@tag\ \@nameauth@tag \fi
  \ifdefined \@nameauth@db\ \@nameauth@db \fi
  \endgroup%
}
\NewDocumentCommand{\IndexName}{O{} m O{}}
{%
  \@nameauth@LoadArgs{#1}{#2}{#3}%
  \@nameauth@Error{#2}{macro \string\IndexName}%
  \if@nameauth@SkipIndex
    \PackageWarning{nameauth}
      {\string\SkipIndex precedes \string\IndexName; check for issues}%
    \unless\if@nameauth@OldReset
      \@nameauth@SkipIndexfalse%
    \fi
  \fi
  \unless\if@nameauth@OldReset
    \if@nameauth@SeeAlso
      \global\@nameauth@SeeAlsofalse%
      \PackageWarning{nameauth}{\string\SeeAlso was reset}%
    \fi
  \fi
  \@nameauth@Choice
  {%
    \def\@nameauth@Temp{\expandafter\detokenize\expandafter{#2}}%
    \ifcsname\@nameauth@csb!PN\endcsname
      \if@nameauth@Verbose
        \edef\@nameauth@testex
          {\csname\@nameauth@csb!PN\endcsname}%
        \ifx\@nameauth@testex\@nameauth@Exclude
          \PackageWarning{nameauth}
            {\string\IndexName: exclusion exists \@nameauth@Temp}%
        \else
          \PackageWarning{nameauth}
            {\string\IndexName: xref exists \@nameauth@Temp}%
        \fi
      \fi
    \else
      \ifx\@nameauth@SB\@empty
        \@nameauth@Index{\@nameauth@csb}{\@nameauth@B}%
      \else
        \@nameauth@Index{\@nameauth@csb}
          {\@nameauth@B\@nameauth@space\@nameauth@SB}%
      \fi
    \fi
  }%
  {%
    \def\@nameauth@Temp{\expandafter\detokenize\expandafter{#2 #3}}%
    \ifcsname\@nameauth@csbc!PN\endcsname
      \if@nameauth@Verbose
        \edef\@nameauth@testex
          {\csname\@nameauth@csbc!PN\endcsname}%
        \ifx\@nameauth@testex\@nameauth@Exclude
          \PackageWarning{nameauth}
            {\string\IndexName: exclusion exists \@nameauth@Temp}%
        \else
          \PackageWarning{nameauth}
            {\string\IndexName: xref exists \@nameauth@Temp}%
        \fi
      \fi
    \else
      \@nameauth@Index{\@nameauth@csbc}
        {\@nameauth@B\@nameauth@space\@nameauth@C}%
    \fi
  }%
  {%
    \def\@nameauth@Temp{\expandafter\detokenize\expandafter{#1 #2}}%
    \ifcsname\@nameauth@csab!PN\endcsname
      \if@nameauth@Verbose
        \edef\@nameauth@testex
          {\csname\@nameauth@csab!PN\endcsname}%
        \ifx\@nameauth@testex\@nameauth@Exclude
          \PackageWarning{nameauth}
            {\string\IndexName: exclusion exists \@nameauth@Temp}%
        \else
          \PackageWarning{nameauth}
            {\string\IndexName: xref exists \@nameauth@Temp}%
        \fi
      \fi
    \else
      \ifx\@nameauth@SB\@empty
        \@nameauth@Index{\@nameauth@csab}
          {\@nameauth@B,\@nameauth@space\@nameauth@A}%
      \else
        \@nameauth@Index{\@nameauth@csab}
          {\@nameauth@B,\@nameauth@space%
           \@nameauth@A,\@nameauth@space\@nameauth@SB}%
      \fi
    \fi
  }%
}
\NewDocumentCommand{\IndexRef}{O{} m O{} m}
{%
  \@nameauth@LoadArgs{#1}{#2}{#3}%
  \protected@edef\@nameauth@Target{#4}%
  \@nameauth@Error{#2}{macro \string\IndexRef}%
  \@nameauth@Xreftrue%
  \if@nameauth@SkipIndex
    \PackageWarning{nameauth}
    {\string\SkipIndex preceded \string\IndexRef; check for issues}%
    \unless\if@nameauth@OldReset
      \@nameauth@SkipIndexfalse%
    \fi
  \fi
  \@nameauth@Choice
  {%
    \def\@nameauth@Temp{\expandafter\detokenize\expandafter{#2}}%
    \ifcsname\@nameauth@csb!PN\endcsname
      \if@nameauth@Verbose
        \edef\@nameauth@testex
          {\csname\@nameauth@csb!PN\endcsname}%
        \ifx\@nameauth@testex\@nameauth@Exclude
          \PackageWarning{nameauth}
          {\string\IndexRef: exclusion exists \@nameauth@Temp}%
        \else
          \PackageWarning{nameauth}
          {\string\IndexRef: xref exists \@nameauth@Temp}%
        \fi
      \fi
    \else
      \ifx\@nameauth@SB\@empty
        \if@nameauth@SeeAlso
          \@nameauth@Index{\@nameauth@csb}
            {\@nameauth@B|seealso{\@nameauth@Target}}%
          \csgdef{\@nameauth@csb!PN}{}%
        \else
          \unless\if@nameauth@OldSee
            \unless\ifcsname\@nameauth@csb!MN\endcsname
              \unless\ifcsname\@nameauth@csb!NF\endcsname
                \@nameauth@Index{\@nameauth@csb}
                  {\@nameauth@B|see{\@nameauth@Target}}%
                \csgdef{\@nameauth@csb!PN}{}%
              \else
                \PackageWarning{nameauth}
                {\string\IndexRef: extant name;
                 no xref \@nameauth@Temp}%
              \fi
            \else
              \PackageWarning{nameauth}
              {\string\IndexRef: extant name;
               no xref \@nameauth@Temp}%
            \fi
          \else
            \if@nameauth@Verbose
              \PackageWarning{nameauth}
              {\string\IndexRef: non-strict xref \@nameauth@Temp}%
            \fi
            \@nameauth@Index{\@nameauth@csb}
              {\@nameauth@B|see{\@nameauth@Target}}%
            \csgdef{\@nameauth@csb!PN}{}%
          \fi
        \fi
      \else
        \if@nameauth@SeeAlso
          \@nameauth@Index{\@nameauth@csb}
            {\@nameauth@B\@nameauth@space%
             \@nameauth@SB|seealso{\@nameauth@Target}}%
          \csgdef{\@nameauth@csb!PN}{}%
        \else
          \unless\if@nameauth@OldSee
            \unless\ifcsname\@nameauth@csb!MN\endcsname
              \unless\ifcsname\@nameauth@csb!NF\endcsname
                \@nameauth@Index{\@nameauth@csb}
                  {\@nameauth@B\@nameauth@space%
                   \@nameauth@SB|see{\@nameauth@Target}}%
                \csgdef{\@nameauth@csb!PN}{}%
              \else
                \PackageWarning{nameauth}
                {\string\IndexRef: extant name;
                 no xref \@nameauth@Temp}%
              \fi
            \else
              \PackageWarning{nameauth}
              {\string\IndexRef: extant name;
               no xref \@nameauth@Temp}%
            \fi
          \else
            \if@nameauth@Verbose
              \PackageWarning{nameauth}
              {\string\IndexRef: non-strict xref \@nameauth@Temp}%
            \fi
            \@nameauth@Index{\@nameauth@csb}
              {\@nameauth@B\@nameauth@space%
               \@nameauth@SB|see{\@nameauth@Target}}%
            \csgdef{\@nameauth@csb!PN}{}%
          \fi
        \fi
      \fi
    \fi
  }%
  {%
    \def\@nameauth@Temp{\expandafter\detokenize\expandafter{#2 #3}}%
    \ifcsname\@nameauth@csbc!PN\endcsname
      \if@nameauth@Verbose
        \edef\@nameauth@testex
          {\csname\@nameauth@csbc!PN\endcsname}%
        \ifx\@nameauth@testex\@nameauth@Exclude
          \PackageWarning{nameauth}
          {\string\IndexRef: exclusion exists \@nameauth@Temp}%
        \else
          \PackageWarning{nameauth}
          {\string\IndexRef: xref exists \@nameauth@Temp}%
        \fi
      \fi
    \else
      \if@nameauth@SeeAlso
        \@nameauth@Index{\@nameauth@csbc}
          {\@nameauth@B\@nameauth@space%
           \@nameauth@C|seealso{\@nameauth@Target}}%
        \csgdef{\@nameauth@csbc!PN}{}%
      \else
        \unless\if@nameauth@OldSee
          \unless\ifcsname\@nameauth@csbc!MN\endcsname
            \unless\ifcsname\@nameauth@csbc!NF\endcsname
              \@nameauth@Index{\@nameauth@csbc}
                {\@nameauth@B\@nameauth@space%
                 \@nameauth@C|see{\@nameauth@Target}}%
              \csgdef{\@nameauth@csbc!PN}{}%
            \else
              \PackageWarning{nameauth}
              {\string\IndexRef: extant name;
               no xref \@nameauth@Temp}%
            \fi
          \else
            \PackageWarning{nameauth}
            {\string\IndexRef: extant name;
             no xref \@nameauth@Temp}%
          \fi
        \else
          \if@nameauth@Verbose
            \PackageWarning{nameauth}
            {\string\IndexRef: non-strict xref \@nameauth@Temp}%
          \fi
          \@nameauth@Index{\@nameauth@csbc}
            {\@nameauth@B\@nameauth@space%
             \@nameauth@C|see{\@nameauth@Target}}%
          \csgdef{\@nameauth@csbc!PN}{}%
        \fi
      \fi
    \fi
  }%
  {%
    \def\@nameauth@Temp{\expandafter\detokenize\expandafter{#1 #2}}%
    \ifcsname\@nameauth@csab!PN\endcsname
      \if@nameauth@Verbose
        \edef\@nameauth@testex
          {\csname\@nameauth@csab!PN\endcsname}%
        \ifx\@nameauth@testex\@nameauth@Exclude
          \PackageWarning{nameauth}
          {\string\IndexRef: exclusion exists \@nameauth@Temp}%
        \else
          \PackageWarning{nameauth}
          {\string\IndexRef: xref exists \@nameauth@Temp}%
        \fi
      \fi
    \else
      \ifx\@nameauth@SB\@empty
        \if@nameauth@SeeAlso
          \@nameauth@Index{\@nameauth@csab}
            {\@nameauth@B,\@nameauth@space%
             \@nameauth@A|seealso{\@nameauth@Target}}%
          \csgdef{\@nameauth@csab!PN}{}%
        \else
          \unless\if@nameauth@OldSee
            \unless\ifcsname\@nameauth@csab!MN\endcsname
              \unless\ifcsname\@nameauth@csab!NF\endcsname
                \@nameauth@Index{\@nameauth@csab}
                  {\@nameauth@B,\@nameauth@space%
                   \@nameauth@A|see{\@nameauth@Target}}%
                \csgdef{\@nameauth@csab!PN}{}%
              \else
                \PackageWarning{nameauth}
                {\string\IndexRef: extant name;
                 no xref \@nameauth@Temp}%
              \fi
            \else
              \PackageWarning{nameauth}
              {\string\IndexRef: extant name;
               no xref \@nameauth@Temp}%
            \fi
          \else
            \if@nameauth@Verbose
              \PackageWarning{nameauth}
              {\string\IndexRef: non-strict xref \@nameauth@Temp}%
            \fi
            \@nameauth@Index{\@nameauth@csab}
              {\@nameauth@B,\@nameauth@space%
               \@nameauth@A|see{\@nameauth@Target}}%
            \csgdef{\@nameauth@csab!PN}{}%
          \fi
        \fi
      \else
        \if@nameauth@SeeAlso
          \@nameauth@Index{\@nameauth@csab}
            {\@nameauth@B,\@nameauth@space%
             \@nameauth@A,\@nameauth@space%
             \@nameauth@SB|seealso{\@nameauth@Target}}%
          \csgdef{\@nameauth@csab!PN}{}%
        \else
          \unless\if@nameauth@OldSee
            \unless\ifcsname\@nameauth@csab!MN\endcsname
              \unless\ifcsname\@nameauth@csab!NF\endcsname
                \@nameauth@Index{\@nameauth@csab}
                  {\@nameauth@B,\@nameauth@space%
                   \@nameauth@A,\@nameauth@space%
                   \@nameauth@SB|see{\@nameauth@Target}}%
                \csgdef{\@nameauth@csab!PN}{}%
              \else
                \PackageWarning{nameauth}
                {\string\IndexRef: extant name;
                 no xref \@nameauth@Temp}%
              \fi
            \else
              \PackageWarning{nameauth}
              {\string\IndexRef: extant name;
               no xref \@nameauth@Temp}%
            \fi
          \else
            \if@nameauth@Verbose
              \PackageWarning{nameauth}
              {\string\IndexRef: non-strict xref \@nameauth@Temp}%
            \fi
            \@nameauth@Index{\@nameauth@csab}
              {\@nameauth@B,\@nameauth@space%
               \@nameauth@A,\@nameauth@space%
               \@nameauth@SB|see{\@nameauth@Target}}%
            \csgdef{\@nameauth@csab!PN}{}%
          \fi
        \fi
      \fi
    \fi
  }%
  \@nameauth@Xreffalse%
  \if@nameauth@OldReset
    \@nameauth@SeeAlsofalse%
  \else
    \global\@nameauth@SeeAlsofalse%
  \fi
}
\NewDocumentCommand{\ExcludeName}{O{} m O{}}
{%
  \@nameauth@LoadArgs{#1}{#2}{#3}%
  \@nameauth@Error{#2}{macro \string\ExcludeName}%
  \@nameauth@Choice
    {\def\@nameauth@Temp{\expandafter\detokenize\expandafter{#2}}}
    {\def\@nameauth@Temp{\expandafter\detokenize\expandafter{#2 #3}}}
    {\def\@nameauth@Temp{\expandafter\detokenize\expandafter{#1 #2}}}%
  \if@nameauth@Verbose
    \ifcsname\NameauthPattern!MN\endcsname
      \PackageWarning{nameauth}
      {\string\ExcludeName: extant name \@nameauth@Temp}%
    \fi
    \ifcsname\NameauthPattern!NF\endcsname
      \PackageWarning{nameauth}
      {\string\ExcludeName: extant name \@nameauth@Temp}%
    \fi
  \fi
  \ifcsname\NameauthPattern!PN\endcsname
    \if@nameauth@Verbose
      \edef\@nameauth@testex
        {\csname\NameauthPattern!PN\endcsname}%
      \ifx\@nameauth@testex\@nameauth@Exclude
        \PackageWarning{nameauth}
        {\string\ExcludeName: exclusion exists \@nameauth@Temp}%
      \else
        \PackageWarning{nameauth}
        {\string\ExcludeName: xref exists \@nameauth@Temp}%
      \fi
    \fi
   \else
    \csxdef{\NameauthPattern!PN}{\@nameauth@Exclude}%
  \fi
}
\NewDocumentCommand{\IncludeName}{s O{} m O{}}
{%
  \IfBooleanTF {#1}%
  {%
    \@nameauth@LoadArgs{#2}{#3}{#4}%
    \@nameauth@Error{#3}{macro \string\IncludeName*}%
    \@nameauth@Choice{}{}{}%
    \global\csundef{\NameauthPattern!PN}%
  }%
  {%
    \@nameauth@LoadArgs{#2}{#3}{#4}%
    \@nameauth@Error{#3}{macro \string\IncludeName}%
    \@nameauth@Choice
      {\def\@nameauth@Temp{\expandafter\detokenize\expandafter{#3}}}
      {\def\@nameauth@Temp{\expandafter\detokenize\expandafter{#3 #4}}}
      {\def\@nameauth@Temp{\expandafter\detokenize\expandafter{#2 #3}}}%
    \ifcsname\NameauthPattern!PN\endcsname
      \edef\@nameauth@testex
        {\csname\NameauthPattern!PN\endcsname}%
      \ifx\@nameauth@testex\@nameauth@Exclude
        \global\csundef{\NameauthPattern!PN}%
      \else
        \if@nameauth@Verbose
          \PackageWarning{nameauth}
          {\string\IncludeName: extant xref \@nameauth@Temp}%
        \fi
      \fi
    \fi
  }%
}
\NewDocumentCommand{\PretagName}{O{} m O{} m}
{%
  \@nameauth@LoadArgs{#1}{#2}{#3}%
  \@nameauth@Error{#2}{macro \string\PretagName}%
  \if@nameauth@Pretag
  \@nameauth@Choice
    {\def\@nameauth@Temp{\expandafter\detokenize\expandafter{#2}}}
    {\def\@nameauth@Temp{\expandafter\detokenize\expandafter{#2 #3}}}
    {\def\@nameauth@Temp{\expandafter\detokenize\expandafter{#1 #2}}}%
    \if@nameauth@Verbose
      \edef\@nameauth@testex
        {\csname\NameauthPattern!PN\endcsname}%
      \ifx\@nameauth@testex\@nameauth@Exclude
        \PackageWarning{nameauth}
        {\string\PretagName: tag exclusion \@nameauth@Temp}%
      \else
        \PackageWarning{nameauth}
        {\string\PretagName: tag xref \@nameauth@Temp}%
      \fi
    \fi
    \csgdef{\NameauthPattern!PRE}{#4\@nameauth@Actual}%
  \else
    \PackageWarning{nameauth}
      {\string\PretagName: deactivated}%
  \fi
}
\NewDocumentCommand{\TagName}{O{} m O{} m}
{%
  \@nameauth@LoadArgs{#1}{#2}{#3}%
  \@nameauth@Error{#2}{macro \string\TagName}%
  \@nameauth@Choice
    {\def\@nameauth@Temp{\expandafter\detokenize\expandafter{#2}}}
    {\def\@nameauth@Temp{\expandafter\detokenize\expandafter{#2 #3}}}
    {\def\@nameauth@Temp{\expandafter\detokenize\expandafter{#1 #2}}}%
  \ifcsname\NameauthPattern!PN\endcsname
    \if@nameauth@Verbose
      \edef\@nameauth@testex
        {\csname\NameauthPattern!PN\endcsname}%
      \ifx\@nameauth@testex\@nameauth@Exclude
        \PackageWarning{nameauth}
        {\string\TagName: no tag, exclusion \@nameauth@Temp}%
      \else
        \PackageWarning{nameauth}
        {\string\TagName: no tag, xref \@nameauth@Temp}%
      \fi
    \fi
  \else
    \csgdef{\NameauthPattern!TAG}{#4}%
  \fi
}
\NewDocumentCommand{\UntagName}{O{} m O{}}
{%
  \@nameauth@LoadArgs{#1}{#2}{#3}%
  \@nameauth@Error{#2}{macro \string\UntagName}%
  \@nameauth@Choice{}{}{}%
  \global\csundef{\NameauthPattern!TAG}%
}
\NewDocumentCommand{\NameAddInfo}{O{} m O{} +m}
{%
  \@nameauth@LoadArgs{#1}{#2}{#3}%
  \@nameauth@Error{#2}{macro \string\NameAddInfo}%
  \@nameauth@Choice{}{}{}%
  \csgdef{\NameauthPattern!DB}{#4}%
}
\NewDocumentCommand{\NameQueryInfo}{O{} m O{}}
{%
  \unless\if@nameauth@BigLock
    \@nameauth@LoadArgs{#1}{#2}{#3}%
    \@nameauth@Error{#2}{macro \string\NameQueryInfo}%
    \@nameauth@Choice{}{}{}%
    \ifcsname\NameauthPattern!DB\endcsname
      \csname\NameauthPattern!DB\endcsname%
    \fi
  \fi
}
\NewDocumentCommand{\NameClearInfo}{O{} m O{}}
{%
  \@nameauth@LoadArgs{#1}{#2}{#3}%
  \@nameauth@Error{#2}{macro \string\NameClearInfo}%
  \@nameauth@Choice{}{}{}%
  \global\csundef{\NameauthPattern!DB}%
}
\NewDocumentCommand{\IfMainName}{O{} m O{} +m +m}
{%
  \@nameauth@LoadArgs{#1}{#2}{#3}%
  \@nameauth@Error{#2}{macro \string\IfMainName}%
  \@nameauth@Choice{}{}{}%
  \ifcsname\NameauthPattern!MN\endcsname
    \if@nameauth@GlobalScope #4\else {#4}\fi
  \else
    \if@nameauth@GlobalScope #5\else {#5}\fi
  \fi
}%
\NewDocumentCommand{\IfFrontName}{O{} m O{} +m +m}
{%
  \@nameauth@LoadArgs{#1}{#2}{#3}%
  \@nameauth@Error{#2}{macro \string\IfFrontName}%
  \@nameauth@Choice{}{}{}%
  \ifcsname\NameauthPattern!NF\endcsname
    \if@nameauth@GlobalScope #4\else {#4}\fi
  \else
    \if@nameauth@GlobalScope #5\else {#5}\fi
  \fi
}
\NewDocumentCommand{\IfAKA}{O{} m O{} +m +m +m}
{%
  \@nameauth@LoadArgs{#1}{#2}{#3}%
  \@nameauth@Error{#2}{macro \string\IfAKA}%
  \@nameauth@Choice{}{}{}%
  \ifcsname\NameauthPattern!PN\endcsname
    \edef\@nameauth@testex
      {\csname\NameauthPattern!PN\endcsname}%
    \ifx\@nameauth@testex\@nameauth@Exclude
      \if@nameauth@GlobalScope #6\else {#6}\fi
    \else
      \if@nameauth@GlobalScope #4\else {#4}\fi
    \fi
  \else
    \if@nameauth@GlobalScope #5\else {#5}\fi
  \fi
}
\NewDocumentCommand{\ForgetName}{O{} m O{}}
{%
  \@nameauth@LoadArgs{#1}{#2}{#3}%
  \@nameauth@Error{#2}{macro \string\ForgetName}%
  \@nameauth@Choice{}{}{}%
  \if@nameauth@LocalNames
    \if@nameauth@MainFormat
      \global\csundef{\NameauthPattern!MN}%
    \else
      \global\csundef{\NameauthPattern!NF}%
    \fi
  \else
    \global\csundef{\NameauthPattern!MN}%
    \global\csundef{\NameauthPattern!NF}%
  \fi
}
\NewDocumentCommand{\SubvertName}{O{} m O{}}
{%
  \@nameauth@LoadArgs{#1}{#2}{#3}%
  \@nameauth@Error{#2}{macro \string\SubvertName}%
  \@nameauth@Choice{}{}{}%
  \if@nameauth@LocalNames
    \if@nameauth@MainFormat
      \csgdef{\NameauthPattern!MN}{}%
    \else
      \csgdef{\NameauthPattern!NF}{}%
    \fi
  \else
    \csgdef{\NameauthPattern!MN}{}%
    \csgdef{\NameauthPattern!NF}{}%
  \fi
}
\NewDocumentCommand{\AKA}{s O{} m O{} m O{}}
{%
  \if@nameauth@BigLock
    \@nameauth@Locktrue%
  \fi
  \IfBooleanTF {#1}{\@nameauth@AltAKAtrue}{}%
  \unless\if@nameauth@Lock
    \@nameauth@Locktrue%
    \@nameauth@InAKAtrue%
    \if@nameauth@OldReset
      \@nameauth@JustIndexfalse%
    \else
      \global\@nameauth@JustIndexfalse%
    \fi
    \@nameauth@Error{#3}{macro \string\AKA}%
    \@nameauth@Error{#5}{macro \string\AKA}%
    \leavevmode\hbox{}%
    \protected@edef\@nameauth@Ai{\trim@spaces{#2}}%
    \protected@edef\@nameauth@Bi{\@nameauth@Root{#3}}%
    \protected@edef\@nameauth@Si{\@nameauth@Suffix{#3}}%
    \@nameauth@Parse{#4}{#5}{#6}{!PN}%
    \unless\if@nameauth@SkipIndex
      \ifx\@nameauth@Ai\@empty
        \ifx\@nameauth@Si\@empty
          \IndexRef[#4]{#5}[#6]{\@nameauth@Bi}%
        \else
          \IndexRef[#4]{#5}[#6]
          {\@nameauth@Bi\@nameauth@space\@nameauth@Si}%
        \fi
      \else
        \ifx\@nameauth@Si\@empty
          \IndexRef[#4]{#5}[#6]
          {\@nameauth@Bi,\@nameauth@space\@nameauth@Ai}%
        \else
          \IndexRef[#4]{#5}[#6]
          {\@nameauth@Bi,\@nameauth@space
           \@nameauth@Ai,\@nameauth@space\@nameauth@Si}%
        \fi
      \fi
    \fi
    \@nameauth@Flags%
    \@nameauth@Lockfalse%
    \@nameauth@InAKAfalse%
  \fi
  \if@nameauth@Punct\expandafter\@nameauth@CheckDot\fi
}
\NewDocumentCommand{\PName}{s O{} m O{} m O{}}
{%
  \IfBooleanTF {#1}{\@nameauth@FullNametrue}{}%
  \if@nameauth@OldReset
    \@nameauth@JustIndexfalse%
  \else
    \global\@nameauth@JustIndexfalse%
  \fi
  \if@nameauth@SkipIndex
    \unless\if@nameauth@OldReset
      \global\@nameauth@SeeAlsofalse%
    \fi
    \NameauthName[#2]{#3} (\SkipIndex\AKA[#2]{#3}[#4]{#5}[#6])%
  \else
    \if@nameauth@SeeAlso
      \@nameauth@SeeAlsofalse\NameauthName[#2]{#3}
      \@nameauth@SeeAlsotrue(\AKA[#2]{#3}[#4]{#5}[#6])%
    \else
      \NameauthName[#2]{#3}
      (\AKA[#2]{#3}[#4]{#5}[#6])%
    \fi
  \fi
  \if@nameauth@SkipIndex
    \PackageWarning{nameauth}
    {\string\SkipIndex still active after \string\PName; check}%
  \fi
}
\endinput
%%
%% End of file `nameauth.sty'.
