%%
%% 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) 2011 by Charles P. Schaum <charles dot schaum at att dot net>
%% 
%% This file may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.2 of this license
%% or (at your option) any later version.  The latest version of this
%% license is in:
%% 
%%    http://www.latex-project.org/lppl.txt
%% 
%% and version 1.2 or later is part of all distributions of LaTeX version
%% 1999/12/01 or later.
%% 
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesPackage{nameauth}
    [2012/01/19 v0.75 name authority macros to aid consistent display and indexing of names]
\newif\if@nameauth@DoFormat
\newif\if@nameauth@Punct
\DeclareOption{mainmatter}{\@nameauth@DoFormattrue}
\DeclareOption{frontmatter}{\@nameauth@DoFormatfalse}
\DeclareOption{smallcaps}{\newcommand{\NamesFormat}{\scshape}}
\DeclareOption{italic}{\renewcommand{\NamesFormat}{\itshape}}
\DeclareOption{boldface}{\renewcommand{\NamesFormat}{\bfseries}}
\DeclareOption{noformat}{\renewcommand{\NamesFormat}{}}
\ExecuteOptions{smallcaps,mainmatter}
\ProcessOptions\relax
\RequirePackage{etoolbox}
\RequirePackage{xparse}
\newcommand*{\@CleanName}[1]{\expandafter\zap@space\detokenize{#1} \@empty}
\newcommand{\@Zapsuffix}[1]{%
\def\@@Zapsuff##1,##2*{##1}%
{\@@Zapsuff#1,*}%
}
\def\@CheckDot{\futurelet\@token\@EvalDot}
\def\@EvalDot{\let\@period=.\ifx\@token\@period\expandafter\@gobble \fi}
\newcommand*{\@TestDot}[1]{%
\def\TestDot##1.\TestEnd##2\TestStop{\TestPunct{##2}}%
\def\TestPunct##1{\ifx\TestPunct##1\TestPunct\else\@nameauth@Puncttrue\fi}%
\@nameauth@Punctfalse%
\TestDot#1\TestEnd.\TestEnd\TestStop%
}
\DeclareDocumentCommand\@FmtName{s m}%
{%
\@TestDot{#2}%
\IfBooleanTF{#1}{#2}{\bgroup\NamesFormat{#2}\egroup}%
}
\DeclareDocumentCommand\@FName{o m o}%
{%
     \IfValueTF{#1}%
     {\IfValueTF{#3}{\def\@ForeNames{#3}}{\def\@ForeNames{#1}}%
     \ifcsname\@CleanName{#1#2!PN!}\endcsname%
          \@FmtName*{#1 #2}%
          \PackageWarning{nameauth}%
          {You cannot create a page reference from the pen name: #1 #2.}%
     \else%
          \if@nameauth@DoFormat%
               \ifcsname\@CleanName{#1#2!MN!}\endcsname%
                    \@FmtName*{\@ForeNames{\space}#2}\index{#2,{\space}#1}%
               \else%
                    \csgdef{\@CleanName{#1#2!MN!}}{}%
                    \@FmtName{\@ForeNames{\space}#2}\index{#2,{\space}#1}%
               \fi%
          \else%
               \ifcsname\@CleanName{#1#2!NF!}\endcsname%
                    \@FmtName*{\@ForeNames{\space}#2}\index{#2,{\space}#1}%
               \else%
                    \csgdef{\@CleanName{#1#2!NF!}}{}%
                    \@FmtName*{\@ForeNames{\space}#2}\index{#2,{\space}#1}%
               \fi%
          \fi%
     \fi}%
     {\IfValueTF{#3}
          {\ifcsname\@CleanName{#2#3!PN!}\endcsname%
               \@FmtName*{#2 #3}%
               \PackageWarning{nameauth}%
               {You cannot create a page reference from the pen name: #2 #3.}%
          \else%
               \if@nameauth@DoFormat%
                    \ifcsname\@CleanName{#2#3!MN!}\endcsname%
                         \@FmtName*{#2 #3}\index{#2 #3}%
                    \else%
                         \csgdef{\@CleanName{#2#3!MN!}}{}%
                         \@FmtName{#2 #3}\index{#2 #3}%
                    \fi%
               \else%
                    \ifcsname\@CleanName{#2#3!NF!}\endcsname%
                         \@FmtName*{#2 #3}\index{#2 #3}%
                    \else%
                         \csgdef{\@CleanName{#2#3!NF!}}{}%
                         \@FmtName*{#2 #3}\index{#2 #3}%
                    \fi%
               \fi%
          \fi}%
          {\ifcsname\@CleanName{#2!PN!}\endcsname%
               \@FmtName*{#2}%
               \PackageWarning{nameauth}%
               {You cannot create a page reference from the pen name: #2.}%
          \else%
               \if@nameauth@DoFormat%
                    \ifcsname\@CleanName{#2!MN!}\endcsname%
                         \@FmtName*{#2}\index{#2}%
                    \else%
                         \csgdef{\@CleanName{#2!MN!}}{}%
                         \@FmtName{#2}\index{#2}%
                    \fi%
               \else%
                    \ifcsname\@CleanName{#2!NF!}\endcsname%
                         \@FmtName*{#2}\index{#2}%
                    \else%
                         \csgdef{\@CleanName{#2!NF!}}{}%
                         \@FmtName*{#2}\index{#2}%
                    \fi%
               \fi%
          \fi}%
     }%
}
\DeclareDocumentCommand\@LName{o m o}%
{%
     \IfValueTF{#1}%
     {\IfValueTF{#3}{\def\@ForeNames{#3}}{\def\@ForeNames{#1}}%
     \ifcsname\@CleanName{#1#2!PN!}\endcsname%
          \@FmtName*{#1 #2}%
          \PackageWarning{nameauth}%
          {You cannot create a page reference from the pen name: #1 #2.}%
     \else%
          \if@nameauth@DoFormat%
               \ifcsname\@CleanName{#1#2!MN!}\endcsname%
                    \@FmtName*{\@Zapsuffix{#2}}\index{#2,{\space}#1}%
               \else%
                    \csgdef{\@CleanName{#1#2!MN!}}{}%
                    \@FmtName{\@ForeNames{\space}#2}\index{#2,{\space}#1}%
               \fi%
          \else%
               \ifcsname\@CleanName{#1#2!NF!}\endcsname%
                    \@FmtName*{\@Zapsuffix{#2}}\index{#2,{\space}#1}%
               \else%
                    \csgdef{\@CleanName{#1#2!NF!}}{}%
                    \@FmtName*{\@ForeNames{\space}#2}\index{#2,{\space}#1}%
               \fi%
          \fi%
     \fi}%
     {\IfValueTF{#3}
          {\ifcsname\@CleanName{#2#3!PN!}\endcsname%
               \@FmtName*{#2 #3}%
               \PackageWarning{nameauth}%
               {You cannot create a page reference from the pen name: #2 #3.}%
          \else%
               \if@nameauth@DoFormat%
                    \ifcsname\@CleanName{#2#3!MN!}\endcsname%
                         \@FmtName*{\@Zapsuffix{#2}}\index{#2 #3}%
                    \else%
                         \csgdef{\@CleanName{#2#3!MN!}}{}%
                         \@FmtName{#2 #3}\index{#2 #3}%
                    \fi%
               \else%
                    \ifcsname\@CleanName{#2#3!NF!}\endcsname%
                         \@FmtName*{\@Zapsuffix{#2}}\index{#2 #3}%
                    \else%
                         \csgdef{\@CleanName{#2#3!NF!}}{}%
                         \@FmtName*{#2 #3}\index{#2 #3}%
                    \fi%
               \fi%
          \fi}%
          {\ifcsname\@CleanName{#2!PN!}\endcsname%
               \@FmtName*{#2}%
               \PackageWarning{nameauth}%
               {You cannot create a page reference from the pen name: #2.}%
          \else%
               \if@nameauth@DoFormat%
                    \ifcsname\@CleanName{#2!MN!}\endcsname%
                         \@FmtName*{\@Zapsuffix{#2}}\index{#2}%
                    \else%
                         \csgdef{\@CleanName{#2!MN!}}{}%
                         \@FmtName{#2}\index{#2}%
                    \fi%
               \else%
                    \ifcsname\@CleanName{#2!NF!}\endcsname%
                         \@FmtName*{\@Zapsuffix{#2}}\index{#2}%
                    \else%
                         \csgdef{\@CleanName{#2!NF!}}{}%
                         \@FmtName*{#2}\index{#2}%
                    \fi%
               \fi%
          \fi}%
     }%
}
\DeclareDocumentCommand\Name{s o m o}%
{%
     \@nameauth@Punctfalse%
     \IfBooleanTF{#1}{\@FName[#2]{#3}[#4]}{\@LName[#2]{#3}[#4]}%
     \if@nameauth@Punct\expandafter\@CheckDot\fi%
}
\DeclareDocumentCommand\PName{s o m o m}%
{%
     \IfBooleanTF{#1}{\Name*[#2]{#3}}{\Name[#2]{#3}}%
     {\space}(\AKA[#2]{#3}[#4]{#5})%
}
\DeclareDocumentCommand\AKA{o m o m}%
{%
     \@nameauth@Punctfalse%
     \IfValueTF{#3}%
     {\@FmtName*{#3 #4}\ifcsname\@CleanName{#3#4!PN!}\endcsname\relax\else%
          \csgdef{\@CleanName{#3#4!PN!}}{}%
          \IfValueTF{#1}%
               {\index{#4,{\space}#3|see{#2,{\space}#1}}}%
               {\index{#4,{\space}#3|see{#2}}}%
          \fi}%
     {\@FmtName*{#4}\ifcsname\@CleanName{#4!PN!}\endcsname\relax\else%
          \csgdef{\@CleanName{#4!PN!}}{}%
          \IfValueTF{#1}%
               {\index{#4|see{#2,{\space}#1}}}%
               {\index{#4|see{#2}}}%
          \fi}%
     \if@nameauth@Punct\expandafter\@CheckDot\fi%
}
\DeclareDocumentCommand\IndexName{o m o}%
{%
     \IfValueTF{#1}%
          {\ifcsname\@CleanName{#1#2!PN!}\endcsname\else\index{#2,{\space}#1}\fi}%
          {\IfValueTF{#3}
               {\ifcsname\@CleanName{#2#3!PN!}\endcsname\else\index{#2 #3}\fi}
               {\ifcsname\@CleanName{#2!PN!}\endcsname\else\index{#2}\fi}%
          }%
}
\DeclareDocumentCommand\ForgetName{o m o}%
{%
     \IfValueTF{#1}%
          {\csundef{\@CleanName{#1#2!MN!}}\csundef{\@CleanName{#1#2!NF!}}}%
          {\IfValueTF{#3}%
               {\csundef{\@CleanName{#2#3!MN!}}\csundef{\@CleanName{#2#3!NF!}}}%
               {\csundef{\@CleanName{#2!MN!}}\csundef{\@CleanName{#2!NF!}}}%
          }%
}
\newcommand{\NamesInactive}{\@nameauth@DoFormatfalse}
\newcommand{\NamesActive}{\@nameauth@DoFormattrue}
\endinput
%%
%% End of file `nameauth.sty'.
