From 31705256b876f83730b07d6ba8dbb46889ffc05c Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Sat, 11 Feb 2012 00:49:56 +0000
Subject: nameauth (10feb12)

git-svn-id: svn://tug.org/texlive/trunk@25353 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/nameauth/nameauth.sty | 366 +++++++++++++++-------
 1 file changed, 249 insertions(+), 117 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/nameauth/nameauth.sty')

diff --git a/Master/texmf-dist/tex/latex/nameauth/nameauth.sty b/Master/texmf-dist/tex/latex/nameauth/nameauth.sty
index e9cc3c63513..bf32bf5af36 100644
--- a/Master/texmf-dist/tex/latex/nameauth/nameauth.sty
+++ b/Master/texmf-dist/tex/latex/nameauth/nameauth.sty
@@ -22,11 +22,11 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}[2005/12/01]
 \ProvidesPackage{nameauth}
-    [2012/02/06 v0.86 name authority macros to aid consistent display and indexing of names]
+    [2012/02/10 v0.9 name authority macros to aid consistent display and indexing of names]
 \newif\if@nameauth@DoFormat
 \newif\if@nameauth@DoComma
+\newif\if@nameauth@Comma
 \newif\if@nameauth@Punct
-\newif\if@nameauth@dtx
 \DeclareOption{mainmatter}{\@nameauth@DoFormattrue}
 \DeclareOption{frontmatter}{\@nameauth@DoFormatfalse}
 \DeclareOption{smallcaps}{\newcommand{\NamesFormat}{\scshape}}
@@ -39,18 +39,24 @@
 \ProcessOptions\relax
 \RequirePackage{etoolbox}
 \RequirePackage{xparse}
-\@ifclassloaded{ltxdoc}
-  {\@nameauth@dtxtrue}
-  {\@nameauth@dtxfalse}%
 \newcommand*{\@nameauth@CleanName}[1]{\expandafter\zap@space\detokenize{#1} \@empty}
-\def\@nameauth@Root#1,#2*{#1}%
-\def\@nameauth@Suffix#1,#2*{\ifx#2\@empty\else\@nameauth@Truncate#2\fi}
-\def\@nameauth@Truncate#1,{#1}
-\newcommand{\@nameauth@NoComma}[1]{%
-     {\@nameauth@Root#1,*\@nameauth@Suffix#1,*}%
+\newcommand*{\@nameauth@Root}[1]{%
+     \@nameauth@TrimRoot#1\relax%
 }
-\newcommand*{\@nameauth@Zapsuffix}[1]{%
-     {\@nameauth@Root#1,*}%
+\def\@nameauth@TrimRoot#1,#2\relax{#1}
+\newcommand*{\@nameauth@Suffix}[1]{%
+     \@nameauth@TrimSuffix#1\relax%
+}
+\def\@nameauth@TrimSuffix#1,#2\relax{#2}
+\newcommand*{\@nameauth@CheckComma}[1]{%
+     \@nameauth@CheckSuffix#1,\relax%
+}
+\def\@nameauth@CheckSuffix#1,#2\relax{%
+     \def\Test{#2}%
+     \ifx\Test\@empty\@nameauth@Commafalse\else\@nameauth@Commatrue\fi%
+}
+\newcommand*{\@nameauth@NoComma}[1]{%
+     \@nameauth@Root{#1}\@nameauth@Suffix{#1}%
 }
 \def\@nameauth@CheckDot{\futurelet\@token\@nameauth@EvalDot}
 \def\@nameauth@EvalDot{\let\@period=.\ifx\@token\@period\expandafter\@gobble \fi}
@@ -63,189 +69,303 @@
 \DeclareDocumentCommand\@nameauth@FmtName{s m}%
 {%
      \@nameauth@TestDot{#2}%
-     \if@nameauth@DoComma%
-          \IfBooleanTF{#1}{#2}{\bgroup\NamesFormat{#2}\egroup}%
-     \else
-          \IfBooleanTF{#1}%
-               {\@nameauth@NoComma{#2}}%
-               {\bgroup\NamesFormat{\@nameauth@NoComma{#2}}\egroup}%
-     \fi
+     \IfBooleanTF{#1}%
+          {#2}%
+          {\bgroup\NamesFormat{#2}\egroup}%
 }
 \DeclareDocumentCommand\Name{s o m o}%
 {%
-     \if@nameauth@DoComma\edef\Surnames{#3}%
-     \else\edef\Surnames{\@nameauth@NoComma{#3}}\fi%
+     \def\Surnames{#3}%
+     \if@nameauth@DoComma\else%
+          \@nameauth@CheckComma{#3}%
+          \if@nameauth@Comma%
+               \edef\Surnames{\@nameauth@Root{#3}\@nameauth@Suffix{#3}}%
+          \fi%
+     \fi%
      \IfValueTF{#2}%
      {\IfValueTF{#4}{\edef\Forenames{#4}}{\edef\Forenames{#2}}%
      \ifcsname\@nameauth@CleanName{#2#3!PN!}\endcsname%
-          \@nameauth@FmtName*{#2 #3}%
+          \expandafter\@nameauth@FmtName\expandafter*\expandafter{%
+               \expandafter\Forenames\expandafter\space\Surnames}%
           \PackageWarning{nameauth}%
-          {You cannot create a page reference from the pen name: #2 #3.}%
+          {You cannot create a page reference from the xref: #2 #3.}%
      \else%
           \if@nameauth@DoFormat%
                \ifcsname\@nameauth@CleanName{#2#3!MN!}\endcsname%
                \IfBooleanTF{#1}%
-                    {\@nameauth@FmtName*{\Forenames{} #3}%
-                         \if@nameauth@dtx\index{#3=\Surnames, #2}%
-                         \else\index{#3@\Surnames, #2}\fi}%
-                    {\@nameauth@FmtName*{\@nameauth@Zapsuffix{#3}}%
-                         \if@nameauth@dtx\index{#3=\Surnames, #2}%
-                         \else\index{#3@\Surnames, #2}\fi}%
+                    {\expandafter\@nameauth@FmtName\expandafter*\expandafter{%
+                         \expandafter\Forenames\expandafter\space\Surnames}%
+                         \index{\Surnames, #2}}%
+                    {\@nameauth@FmtName*{\@nameauth@Root{#3,}}%
+                         \index{\Surnames, #2}}%
                \else%
                     \csgdef{\@nameauth@CleanName{#2#3!MN!}}{}%
-                    \@nameauth@FmtName{\Forenames{} #3}%
-                         \if@nameauth@dtx\index{#3=\Surnames, #2}%
-                         \else\index{#3@\Surnames, #2}\fi%
+                    \expandafter\@nameauth@FmtName\expandafter{%
+                         \expandafter\Forenames\expandafter\space\Surnames}%
+                         \index{\Surnames, #2}%
                \fi%
           \else%
                \ifcsname\@nameauth@CleanName{#2#3!NF!}\endcsname%
                \IfBooleanTF{#1}%
-                    {\@nameauth@FmtName*{\Forenames{} #3}%
-                         \if@nameauth@dtx\index{#3=\Surnames, #2}%
-                         \else\index{#3@\Surnames, #2}\fi}%
-                    {\@nameauth@FmtName*{\@nameauth@Zapsuffix{#3}}%
-                         \if@nameauth@dtx\index{#3=\Surnames, #2}%
-                         \else\index{#3@\Surnames, #2}\fi}%
+                    {\expandafter\@nameauth@FmtName\expandafter*\expandafter{%
+                         \expandafter\Forenames\expandafter\space\Surnames}%
+                         \index{\Surnames, #2}}%
+                    {\@nameauth@FmtName*{\@nameauth@Root{#3,}}%
+                         \index{\Surnames, #2}}%
                \else%
                     \csgdef{\@nameauth@CleanName{#2#3!NF!}}{}%
-                    \@nameauth@FmtName*{\Forenames{} #3}%
-                         \if@nameauth@dtx\index{#3=\Surnames, #2}%
-                         \else\index{#3@\Surnames, #2}\fi%
+                    \expandafter\@nameauth@FmtName\expandafter*\expandafter{%
+                         \expandafter\Forenames\expandafter\space\Surnames}%
+                         \index{\Surnames, #2}%
                \fi%
           \fi%
      \fi}%
      {\IfValueTF{#4}
           {\ifcsname\@nameauth@CleanName{#3#4!PN!}\endcsname%
-               \@nameauth@FmtName*{#3 #4}%
+               \expandafter\@nameauth@FmtName\expandafter*%
+                    \expandafter{\Surnames\space#4}%
                \PackageWarning{nameauth}%
-               {You cannot create a page reference from the pen name: #3 #4.}%
+               {You cannot create a page reference from the xref: #3 #4.}%
           \else%
                \if@nameauth@DoFormat%
                     \ifcsname\@nameauth@CleanName{#3#4!MN!}\endcsname%
                     \IfBooleanTF{#1}%
-                         {\@nameauth@FmtName*{#3 #4}%
-                              \if@nameauth@dtx\index{#3=\Surnames{} #4}%
-                              \else\index{#3@\Surnames{} #4}\fi}%
-                         {\@nameauth@FmtName*{\@nameauth@Zapsuffix{#3}}%
-                              \if@nameauth@dtx\index{#3=\Surnames{} #4}%
-                              \else\index{#3@\Surnames{} #4}\fi}%
+                         {\expandafter\@nameauth@FmtName\expandafter*%
+                              \expandafter{\Surnames\space#4}%
+                              \index{\Surnames\space#4}}%
+                         {\@nameauth@FmtName*{\@nameauth@Root{#3,}}%
+                              \index{\Surnames\space#4}}%
                     \else%
                          \csgdef{\@nameauth@CleanName{#3#4!MN!}}{}%
-                         \@nameauth@FmtName{#3 #4}%
-                              \if@nameauth@dtx\index{#3=\Surnames{} #4}%
-                              \else\index{#3@\Surnames{} #4}\fi%
+                         \expandafter\@nameauth@FmtName\expandafter{%
+                              \Surnames\space#4}%
+                              \index{\Surnames\space#4}%
                      \fi%
                \else%
                     \ifcsname\@nameauth@CleanName{#3#4!NF!}\endcsname%
                     \IfBooleanTF{#1}%
-                         {\@nameauth@FmtName*{#3 #4}%
-                              \if@nameauth@dtx\index{#3=\Surnames{} #4}%
-                              \else\index{#3@\Surnames{} #4}\fi}%
-                         {\@nameauth@FmtName*{\@nameauth@Zapsuffix{#3}}%
-                              \if@nameauth@dtx\index{#3=\Surnames{} #4}%
-                              \else\index{#3@\Surnames{} #4}\fi}%
+                         {\expandafter\@nameauth@FmtName\expandafter*%
+                              \expandafter{\Surnames\space#4}%
+                              \index{\Surnames\space#4}}%
+                         {\@nameauth@FmtName*{\@nameauth@Root{#3,}}%
+                              \index{\Surnames\space#4}}%
                     \else%
                          \csgdef{\@nameauth@CleanName{#3#4!NF!}}{}%
-                         \@nameauth@FmtName*{#3 #4}%
-                              \if@nameauth@dtx\index{#3=\Surnames{} #4}%
-                              \else\index{#3@\Surnames{} #4}\fi%
+                         \expandafter\@nameauth@FmtName\expandafter*%
+                              \expandafter{\Surnames\space#4}%
+                              \index{\Surnames\space#4}%
                      \fi%
                \fi%
           \fi}%
           {\ifcsname\@nameauth@CleanName{#3!PN!}\endcsname%
-               \@nameauth@FmtName*{#3}%
+               \expandafter\@nameauth@FmtName\expandafter*%
+                    \expandafter{\Surnames}%
                \PackageWarning{nameauth}%
-               {You cannot create a page reference from the pen name: #3.}%
+               {You cannot create a page reference from the xref: #3.}%
           \else%
                \if@nameauth@DoFormat%
                     \ifcsname\@nameauth@CleanName{#3!MN!}\endcsname%
                     \IfBooleanTF{#1}%
-                         {\@nameauth@FmtName*{#3}%
-                              \if@nameauth@dtx\index{#3=\Surnames}%
-                              \else\index{#3@\Surnames}\fi}%
-                         {\@nameauth@FmtName*{\@nameauth@Zapsuffix{#3}}%
-                              \if@nameauth@dtx\index{#3=\Surnames}%
-                              \else\index{#3@\Surnames}\fi}%
+                         {\expandafter\@nameauth@FmtName\expandafter*%
+                              \expandafter{\Surnames}%
+                              \index{\Surnames}}%
+                         {\@nameauth@FmtName*{\@nameauth@Root{#3,}}%
+                              \index{\Surnames}}%
                     \else%
                          \csgdef{\@nameauth@CleanName{#3!MN!}}{}%
-                         \@nameauth@FmtName{#3}%
-                              \if@nameauth@dtx\index{#3=\Surnames}%
-                              \else\index{#3@\Surnames}\fi%
+                         \expandafter\@nameauth@FmtName\expandafter{\Surnames}%
+                              \index{\Surnames}%
                      \fi%
                \else%
                     \ifcsname\@nameauth@CleanName{#3!NF!}\endcsname%
                     \IfBooleanTF{#1}%
-                         {\@nameauth@FmtName*{#3}%
-                              \if@nameauth@dtx\index{#3=\Surnames}%
-                              \else\index{#3@\Surnames}\fi}%
-                         {\@nameauth@FmtName*{\@nameauth@Zapsuffix{#3}}%
-                              \if@nameauth@dtx\index{#3=\Surnames}%
-                              \else\index{#3@\Surnames}\fi}%
+                         {\expandafter\@nameauth@FmtName\expandafter*%
+                              \expandafter{\Surnames}%
+                              \index{\Surnames}}%
+                         {\@nameauth@FmtName*{\@nameauth@Root{#3,}}%
+                              \index{\Surnames}}%
                      \else%
                          \csgdef{\@nameauth@CleanName{#3!NF!}}{}%
-                         \@nameauth@FmtName*{#3}%
-                              \if@nameauth@dtx\index{#3=\Surnames}%
-                              \else\index{#3@\Surnames}\fi%
+                         \expandafter\@nameauth@FmtName\expandafter*%
+                              \expandafter{\Surnames}%
+                              \index{\Surnames}%
                     \fi%
                \fi%
           \fi}%
      }%
      \if@nameauth@Punct\expandafter\@nameauth@CheckDot\fi%
 }
-\DeclareDocumentCommand\PName{s o m o m}%
+\DeclareDocumentCommand\FName{o m o}%
 {%
-     \IfBooleanTF{#1}{\Name*[#2]{#3}}{\Name[#2]{#3}}%
-     {\space}(\AKA[#2]{#3}[#4]{#5})%
+     \def\Surnames{#2}%
+     \if@nameauth@DoComma\else%
+          \@nameauth@CheckComma{#2}%
+          \if@nameauth@Comma%
+               \edef\Surnames{\@nameauth@Root{#2}\@nameauth@Suffix{#2}}%
+          \fi%
+     \fi%
+    \IfValueTF{#1}%
+     {\IfValueTF{#3}{\edef\Forenames{#3}}{\edef\Forenames{#1}}%
+     \ifcsname\@nameauth@CleanName{#1#2!PN!}\endcsname%
+          \expandafter\@nameauth@FmtName\expandafter*%
+               \expandafter{\Forenames}%
+          \PackageWarning{nameauth}%
+          {You cannot create a page reference from the xref: #1 #2.}%
+     \else%
+          \if@nameauth@DoFormat%
+               \ifcsname\@nameauth@CleanName{#1#2!MN!}\endcsname%
+                    \expandafter\@nameauth@FmtName\expandafter*%
+                         \expandafter{\Forenames}%
+                    \index{\Surnames, #1}%
+               \else%
+                    \csgdef{\@nameauth@CleanName{#1#2!MN!}}{}%
+                    \expandafter\@nameauth@FmtName\expandafter{%
+                        \expandafter\Forenames\expandafter\space\Surnames}%
+                    \index{\Surnames, #1}%
+               \fi%
+          \else%
+               \ifcsname\@nameauth@CleanName{#1#2!NF!}\endcsname%
+                   \expandafter\@nameauth@FmtName\expandafter*%
+                         \expandafter{\Forenames}%
+                   \index{\Surnames, #1}%
+               \else%
+                    \csgdef{\@nameauth@CleanName{#1#2!NF!}}{}%
+                    \expandafter\@nameauth@FmtName\expandafter*\expandafter{%
+                         \Forenames\expandafter\space\Surnames}%
+                    \index{\Surnames, #1}%
+               \fi%
+          \fi%
+     \fi}%
+     {\IfValueTF{#3}
+          {\ifcsname\@nameauth@CleanName{#2#3!PN!}\endcsname%
+               \expandafter\@nameauth@FmtName\expandafter*%
+                    \expandafter{\Surnames\space#3}%
+               \PackageWarning{nameauth}%
+               {You cannot create a page reference from the xref: #2 #3.}%
+          \else%
+               \if@nameauth@DoFormat%
+                    \ifcsname\@nameauth@CleanName{#2#3!MN!}\endcsname%
+                         \@nameauth@FmtName*{\@nameauth@Root{#2,}}%
+                         \index{\Surnames\space#3}%
+                    \else%
+                         \csgdef{\@nameauth@CleanName{#2#3!MN!}}{}%
+                         \expandafter\@nameauth@FmtName\expandafter{\Surnames\space#3}%
+                         \index{\Surnames\space#3}%
+                     \fi%
+               \else%
+                    \ifcsname\@nameauth@CleanName{#2#3!NF!}\endcsname%
+                         \@nameauth@FmtName*{\@nameauth@Root{#2,}}%
+                         \index{\Surnames\space#3}%
+                    \else%
+                         \csgdef{\@nameauth@CleanName{#2#3!NF!}}{}%
+                              \expandafter\@nameauth@FmtName\expandafter*%
+                         \expandafter{\Surnames\space#3}%
+                         \index{\Surnames\space#3}%
+                     \fi%
+               \fi%
+          \fi}%
+          {\ifcsname\@nameauth@CleanName{#2!PN!}\endcsname%
+               \expandafter\@nameauth@FmtName\expandafter*%
+                    \expandafter{\Surnames}%
+               \PackageWarning{nameauth}%
+               {You cannot create a page reference from the xref: #2.}%
+          \else%
+               \if@nameauth@DoFormat%
+                    \ifcsname\@nameauth@CleanName{#2!MN!}\endcsname%
+                         \@nameauth@FmtName*{\@nameauth@Root{#2,}}%
+                         \index{\Surnames}%
+                    \else%
+                         \csgdef{\@nameauth@CleanName{#2!MN!}}{}%
+                         \expandafter\@nameauth@FmtName\expandafter{\Surnames}%
+                         \index{\Surnames}%
+                     \fi%
+               \else%
+                    \ifcsname\@nameauth@CleanName{#2!NF!}\endcsname%
+                         \@nameauth@FmtName*{\@nameauth@Root{#2,}}%
+                         \index{\Surnames}%
+                     \else%
+                         \csgdef{\@nameauth@CleanName{#2!NF!}}{}%
+                         \expandafter\@nameauth@FmtName\expandafter*%
+                              \expandafter{\Surnames}%
+                         \index{\Surnames}%
+                    \fi%
+               \fi%
+          \fi}%
+     }%
+     \if@nameauth@Punct\expandafter\@nameauth@CheckDot\fi%
 }
-\DeclareDocumentCommand\AKA{o m o m}%
+\DeclareDocumentCommand\AKA{s o m o m o}%
 {%
-     \if@nameauth@DoComma%
-          \edef\Surnamesi{#2}\edef\Surnamesii{#4}%
-          \else\edef\Surnamesi{\@nameauth@NoComma{#2}}%
-          \edef\Surnamesii{\@nameauth@NoComma{#4}}%
+     \def\Surnamesi{#3}%
+     \def\Surnamesii{#5}%
+     \if@nameauth@DoComma\else%
+          \@nameauth@CheckComma{#3}%
+          \if@nameauth@Comma%
+               \edef\Surnamesi{\@nameauth@Root{#3}\@nameauth@Suffix{#3}}%
+          \fi%
+          \@nameauth@CheckComma{#5}%
+          \if@nameauth@Comma%
+               \edef\Surnamesii{\@nameauth@Root{#5}\@nameauth@Suffix{#5}}%
+          \fi%
      \fi%
-     \IfValueTF{#3}%
-     {\@nameauth@FmtName*{#3 #4}%
-          \ifcsname\@nameauth@CleanName{#3#4!PN!}\endcsname\relax\else%
-               \csgdef{\@nameauth@CleanName{#3#4!PN!}}{}%
-               \IfValueTF{#1}%
-                    {\if@nameauth@dtx\index{#4=\Surnamesii, #3|see{\Surnamesi, #1}}%
-                    \else\index{#4@\Surnamesii, #3|see{\Surnamesi, #1}}\fi}%
-                    {\if@nameauth@dtx\index{#4=\Surnamesii, #3|see{\Surnamesi}}%
-                    \else\index{#4@\Surnamesii, #3|see{\Surnamesi}}\fi}%
+     \IfValueTF{#4}%
+     {\IfValueTF{#6}{\edef\Forenames{#6}}{\edef\Forenames{#4}}%
+          \expandafter\@nameauth@FmtName\expandafter*\expandafter{%
+               \expandafter\Forenames\expandafter\space\Surnamesii}%
+          \ifcsname\@nameauth@CleanName{#4#5!PN!}\endcsname\relax\else%
+               \csgdef{\@nameauth@CleanName{#4#5!PN!}}{}%
+               \IfValueTF{#2}%
+                    {\index{\Surnamesii, #4|see{\Surnamesi, #2}}}%
+                    {\index{\Surnamesii, #4|see{\Surnamesi}}}%
           \fi}%
-     {\@nameauth@FmtName*{#4}%
-          \ifcsname\@nameauth@CleanName{#4!PN!}\endcsname\relax\else%
-               \csgdef{\@nameauth@CleanName{#4!PN!}}{}%
-               \IfValueTF{#1}%
-                    {\if@nameauth@dtx\index{#4=\Surnamesii|see{\Surnamesi, #1}}%
-                    \else\index{#4@\Surnamesii|see{\Surnamesi, #1}}\fi}%
-                    {\if@nameauth@dtx\index{#4=\Surnamesii|see{\Surnamesi}}%
-                    \else\index{#4@\Surnamesii|see{\Surnamesi}}\fi}%
+     {\IfValueTF{#6}%
+          {\IfBooleanTF{#1}%
+               {\@nameauth@FmtName*{#6}}%
+               {\expandafter\@nameauth@FmtName\expandafter*\expandafter{\Surnamesii #6}}%
+          \ifcsname\@nameauth@CleanName{#5#6!PN!}\endcsname\relax\else%
+               \csgdef{\@nameauth@CleanName{#5#6!PN!}}{}%
+               \IfValueTF{#2}%
+                    {\index{\Surnamesii\space#6|see{\Surnamesi, #2}}}%
+                    {\index{\Surnamesii\space#6|see{\Surnamesi}}}%
           \fi}%
+          {\expandafter\@nameauth@FmtName\expandafter*\expandafter{\Surnamesii}%
+          \ifcsname\@nameauth@CleanName{#5!PN!}\endcsname\relax\else%
+               \csgdef{\@nameauth@CleanName{#5!PN!}}{}%
+               \IfValueTF{#2}%
+                    {\index{\Surnamesii|see{\Surnamesi, #2}}}%
+                    {\index{\Surnamesii|see{\Surnamesi}}}%
+               \fi}%
+     }%
      \if@nameauth@Punct\expandafter\@nameauth@CheckDot\fi%
 }
+\DeclareDocumentCommand\PName{s o m o m o}%
+{%
+     \IfBooleanTF{#1}{\Name*[#2]{#3}}{\Name[#2]{#3}}%
+     {\space}(\AKA[#2]{#3}[#4]{#5}[#6])%
+}
 \DeclareDocumentCommand\IndexName{o m o}%
 {%
-     \if@nameauth@DoComma\edef\Surnames{#2}%
-     \else\edef\Surnames{\@nameauth@NoComma{#2}}\fi%
+     \def\Surnames{#2}%
+     \if@nameauth@DoComma\else%
+          \@nameauth@CheckComma{#2}%
+          \if@nameauth@Comma%
+               \edef\Surnames{\@nameauth@Root{#2}\@nameauth@Suffix{#2}}%
+          \fi%
+     \fi%
      \IfValueTF{#1}%
           {\ifcsname\@nameauth@CleanName{#1#2!PN!}\endcsname%
                \else%
-                    \if@nameauth@dtx\index{#2=\Surnames, #1}%
-                    \else\index{#2@\Surnames, #1}\fi%
-          \fi}%
+                    \index{\Surnames, #1}%
+               \fi}%
           {\IfValueTF{#3}
                {\ifcsname\@nameauth@CleanName{#2#3!PN!}\endcsname%
                \else%
-                    \if@nameauth@dtx\index{#2=\Surnames{} #3}%
-                    \else\index{#2@\Surnames{} #3}\fi%
-          \fi}%
+                    \index{\Surnames\space#3}%
+               \fi}%
                {\ifcsname\@nameauth@CleanName{#2!PN!}\endcsname%
                \else%
-                    \if@nameauth@dtx\index{#2=\Surnames}%
-                    \else\index{#2@\Surnames}\fi%
-               \fi}
+                    \index{\Surnames}%
+               \fi}%
           }%
 }
 \DeclareDocumentCommand\ForgetName{o m o}%
@@ -260,6 +380,18 @@
                \csundef{\@nameauth@CleanName{#2!NF!}}}%
           }%
 }
+\DeclareDocumentCommand\SubvertName{o m o}%
+{%
+     \IfValueTF{#1}%
+          {\csgdef{\@nameauth@CleanName{#1#2!MN!}}%
+          \csgdef{\@nameauth@CleanName{#1#2!NF!}}}%
+          {\IfValueTF{#3}%
+               {\csgdef{\@nameauth@CleanName{#2#3!MN!}}%
+               \csgdef{\@nameauth@CleanName{#2#3!NF!}}}%
+               {\csgdef{\@nameauth@CleanName{#2!MN!}}%
+               \csgdef{\@nameauth@CleanName{#2!NF!}}}%
+          }%
+}
 \newcommand{\NamesInactive}{\@nameauth@DoFormatfalse}
 \newcommand{\NamesActive}{\@nameauth@DoFormattrue}
 \endinput
-- 
cgit v1.2.3

