diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/nameauth/nameauth.sty | 280 |
1 files changed, 199 insertions, 81 deletions
diff --git a/Master/texmf-dist/tex/latex/nameauth/nameauth.sty b/Master/texmf-dist/tex/latex/nameauth/nameauth.sty index d930e1b9a9b..156a8e79862 100644 --- a/Master/texmf-dist/tex/latex/nameauth/nameauth.sty +++ b/Master/texmf-dist/tex/latex/nameauth/nameauth.sty @@ -22,24 +22,30 @@ %% \NeedsTeXFormat{LaTeX2e}[2005/12/01] \ProvidesPackage{nameauth} - [2012/02/12 v0.92 name authority macros to aid consistent display and indexing of names] + [2012/02/15 v0.94 name authority macros to aid consistent display and indexing of names] +%% \DescribeMacro{\IndexActive} \newif\if@nameauth@DoFormat \newif\if@nameauth@DoComma +\newif\if@nameauth@DoIndex \newif\if@nameauth@Comma \newif\if@nameauth@Punct +\newif\if@nameauth@DoCaps \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}{}} -\DeclareOption{nocomma}{\@nameauth@DoCommafalse} \DeclareOption{comma}{\@nameauth@DoCommatrue} -\ExecuteOptions{smallcaps,mainmatter,nocomma} +\DeclareOption{nocomma}{\@nameauth@DoCommafalse} +\DeclareOption{index}{\@nameauth@DoIndextrue} +\DeclareOption{noindex}{\@nameauth@DoIndexfalse} +\ExecuteOptions{smallcaps,mainmatter,nocomma,index} \ProcessOptions\relax \RequirePackage{etoolbox} \RequirePackage{xparse} -\newcommand*{\@nameauth@CleanName}[1]{\expandafter\zap@space\detokenize{#1} \@empty} +\newcommand*{\@nameauth@CleanName}[1]% + {\expandafter\zap@space\detokenize{#1} \@empty} \newcommand*{\@nameauth@Root}[1]{% \@nameauth@TrimRoot#1\relax% } @@ -59,20 +65,40 @@ \@nameauth@Root{#1}\@nameauth@Suffix{#1}% } \def\@nameauth@CheckDot{\futurelet\@token\@nameauth@EvalDot} -\def\@nameauth@EvalDot{\let\@period=.\ifx\@token\@period\expandafter\@gobble \fi} +\def\@nameauth@EvalDot% + {\let\@period=.\ifx\@token\@period\expandafter\@gobble \fi} \newcommand*{\@nameauth@TestDot}[1]{% \def\TestDot##1.\TestEnd##2\TestStop{\TestPunct{##2}}% - \def\TestPunct##1{\ifx\TestPunct##1\TestPunct\else\@nameauth@Puncttrue\fi}% + \def\TestPunct##1% + {\ifx\TestPunct##1\TestPunct\else\@nameauth@Puncttrue\fi}% \@nameauth@Punctfalse% \TestDot#1\TestEnd.\TestEnd\TestStop% } \DeclareDocumentCommand\@nameauth@FmtName{s m}% {% - \@nameauth@TestDot{#2}% + \edef\Input{#2}% + \def\Cap##1{\@Cap##1}% + \def\@Cap##1##2{\uppercase{##1}##2}% + \if@nameauth@DoCaps% + \expandafter\def\expandafter\Output\expandafter{% + \expandafter\Cap\expandafter{\Input}}% + \else\let\Output\Input\fi% + \@nameauth@DoCapsfalse\@nameauth@TestDot{#2}% + \IfBooleanTF{#1}% + {\Output}% + {\bgroup\NamesFormat{#2}\egroup}% +} +\DeclareDocumentCommand\@nameauth@FmtFName{s m}% +{% + \@nameauth@DoCapsfalse\@nameauth@TestDot{#2}% \IfBooleanTF{#1}% {#2}% {\bgroup\NamesFormat{#2}\egroup}% } +\newcommand{\@nameauth@Index}[1]{% + \if@nameauth@DoIndex\index{#1}\fi% +} +\newcommand{\CapThis}{\@nameauth@DoCapstrue} \DeclareDocumentCommand\Name{s o m o}% {% \def\Surnames{#3}% @@ -83,40 +109,41 @@ \fi% \fi% \IfValueTF{#2}% - {\IfValueTF{#4}{\edef\Forenames{#4}}{\edef\Forenames{#2}}% + {\IfValueTF{#4}% + {\edef\Forenames{#4}}{\edef\Forenames{#2}}% \ifcsname\@nameauth@CleanName{#2#3!PN!}\endcsname% \expandafter\@nameauth@FmtName\expandafter*\expandafter{% \expandafter\Forenames\expandafter\space\Surnames}% \PackageWarning{nameauth}% - {You cannot create a page reference from the xref: #2 #3.}% + {\bsc Name Cross-reference: #2 #3 cannot be a page reference.}% \else% \if@nameauth@DoFormat% \ifcsname\@nameauth@CleanName{#2#3!MN!}\endcsname% \IfBooleanTF{#1}% {\expandafter\@nameauth@FmtName\expandafter*\expandafter{% \expandafter\Forenames\expandafter\space\Surnames}% - \index{\Surnames, #2}}% + \@nameauth@Index{\Surnames, #2}}% {\@nameauth@FmtName*{\@nameauth@Root{#3,}}% - \index{\Surnames, #2}}% + \@nameauth@Index{\Surnames, #2}}% \else% \csgdef{\@nameauth@CleanName{#2#3!MN!}}{}% \expandafter\@nameauth@FmtName\expandafter{% \expandafter\Forenames\expandafter\space\Surnames}% - \index{\Surnames, #2}% + \@nameauth@Index{\Surnames, #2}% \fi% \else% \ifcsname\@nameauth@CleanName{#2#3!NF!}\endcsname% \IfBooleanTF{#1}% {\expandafter\@nameauth@FmtName\expandafter*\expandafter{% \expandafter\Forenames\expandafter\space\Surnames}% - \index{\Surnames, #2}}% + \@nameauth@Index{\Surnames, #2}}% {\@nameauth@FmtName*{\@nameauth@Root{#3,}}% - \index{\Surnames, #2}}% + \@nameauth@Index{\Surnames, #2}}% \else% \csgdef{\@nameauth@CleanName{#2#3!NF!}}{}% \expandafter\@nameauth@FmtName\expandafter*\expandafter{% \expandafter\Forenames\expandafter\space\Surnames}% - \index{\Surnames, #2}% + \@nameauth@Index{\Surnames, #2}% \fi% \fi% \fi}% @@ -125,35 +152,35 @@ \expandafter\@nameauth@FmtName\expandafter*% \expandafter{\Surnames\space#4}% \PackageWarning{nameauth}% - {You cannot create a page reference from the xref: #3 #4.}% + {\bsc Name Cross-reference: #3 #4 cannot be a page reference.}% \else% \if@nameauth@DoFormat% \ifcsname\@nameauth@CleanName{#3#4!MN!}\endcsname% \IfBooleanTF{#1}% {\expandafter\@nameauth@FmtName\expandafter*% \expandafter{\Surnames\space#4}% - \index{\Surnames\space#4}}% + \@nameauth@Index{\Surnames\space#4}}% {\@nameauth@FmtName*{\@nameauth@Root{#3,}}% - \index{\Surnames\space#4}}% + \@nameauth@Index{\Surnames\space#4}}% \else% \csgdef{\@nameauth@CleanName{#3#4!MN!}}{}% \expandafter\@nameauth@FmtName\expandafter{% \Surnames\space#4}% - \index{\Surnames\space#4}% + \@nameauth@Index{\Surnames\space#4}% \fi% \else% \ifcsname\@nameauth@CleanName{#3#4!NF!}\endcsname% \IfBooleanTF{#1}% {\expandafter\@nameauth@FmtName\expandafter*% \expandafter{\Surnames\space#4}% - \index{\Surnames\space#4}}% + \@nameauth@Index{\Surnames\space#4}}% {\@nameauth@FmtName*{\@nameauth@Root{#3,}}% - \index{\Surnames\space#4}}% + \@nameauth@Index{\Surnames\space#4}}% \else% \csgdef{\@nameauth@CleanName{#3#4!NF!}}{}% \expandafter\@nameauth@FmtName\expandafter*% \expandafter{\Surnames\space#4}% - \index{\Surnames\space#4}% + \@nameauth@Index{\Surnames\space#4}% \fi% \fi% \fi}% @@ -161,34 +188,34 @@ \expandafter\@nameauth@FmtName\expandafter*% \expandafter{\Surnames}% \PackageWarning{nameauth}% - {You cannot create a page reference from the xref: #3.}% + {\bsc Name Cross-reference: #3 cannot be a page reference.}% \else% \if@nameauth@DoFormat% \ifcsname\@nameauth@CleanName{#3!MN!}\endcsname% \IfBooleanTF{#1}% {\expandafter\@nameauth@FmtName\expandafter*% \expandafter{\Surnames}% - \index{\Surnames}}% + \@nameauth@Index{\Surnames}}% {\@nameauth@FmtName*{\@nameauth@Root{#3,}}% - \index{\Surnames}}% + \@nameauth@Index{\Surnames}}% \else% \csgdef{\@nameauth@CleanName{#3!MN!}}{}% \expandafter\@nameauth@FmtName\expandafter{\Surnames}% - \index{\Surnames}% + \@nameauth@Index{\Surnames}% \fi% \else% \ifcsname\@nameauth@CleanName{#3!NF!}\endcsname% \IfBooleanTF{#1}% {\expandafter\@nameauth@FmtName\expandafter*% \expandafter{\Surnames}% - \index{\Surnames}}% + \@nameauth@Index{\Surnames}}% {\@nameauth@FmtName*{\@nameauth@Root{#3,}}% - \index{\Surnames}}% + \@nameauth@Index{\Surnames}}% \else% \csgdef{\@nameauth@CleanName{#3!NF!}}{}% \expandafter\@nameauth@FmtName\expandafter*% \expandafter{\Surnames}% - \index{\Surnames}% + \@nameauth@Index{\Surnames}% \fi% \fi% \fi}% @@ -207,87 +234,88 @@ \IfValueTF{#1}% {\IfValueTF{#3}{\edef\Forenames{#3}}{\edef\Forenames{#1}}% \ifcsname\@nameauth@CleanName{#1#2!PN!}\endcsname% - \expandafter\@nameauth@FmtName\expandafter*% + \expandafter\@nameauth@FmtFName\expandafter*% \expandafter{\Forenames}% \PackageWarning{nameauth}% - {You cannot create a page reference from the xref: #1 #2.}% + {\bsc FName Cross-reference: #1 #2 cannot be a page reference.}% \else% \if@nameauth@DoFormat% \ifcsname\@nameauth@CleanName{#1#2!MN!}\endcsname% - \expandafter\@nameauth@FmtName\expandafter*% + \expandafter\@nameauth@FmtFName\expandafter*% \expandafter{\Forenames}% - \index{\Surnames, #1}% + \@nameauth@Index{\Surnames, #1}% \else% \csgdef{\@nameauth@CleanName{#1#2!MN!}}{}% - \expandafter\@nameauth@FmtName\expandafter{% + \expandafter\@nameauth@FmtFName\expandafter{% \expandafter\Forenames\expandafter\space\Surnames}% - \index{\Surnames, #1}% + \@nameauth@Index{\Surnames, #1}% \fi% \else% \ifcsname\@nameauth@CleanName{#1#2!NF!}\endcsname% - \expandafter\@nameauth@FmtName\expandafter*% + \expandafter\@nameauth@FmtFName\expandafter*% \expandafter{\Forenames}% - \index{\Surnames, #1}% + \@nameauth@Index{\Surnames, #1}% \else% \csgdef{\@nameauth@CleanName{#1#2!NF!}}{}% - \expandafter\@nameauth@FmtName\expandafter*\expandafter{% - \Forenames\expandafter\space\Surnames}% - \index{\Surnames, #1}% + \expandafter\@nameauth@FmtFName\expandafter*% + \expandafter{\Forenames\expandafter\space\Surnames}% + \@nameauth@Index{\Surnames, #1}% \fi% \fi% \fi}% {\IfValueTF{#3} {\ifcsname\@nameauth@CleanName{#2#3!PN!}\endcsname% - \expandafter\@nameauth@FmtName\expandafter*% + \expandafter\@nameauth@FmtFName\expandafter*% \expandafter{\Surnames\space#3}% \PackageWarning{nameauth}% - {You cannot create a page reference from the xref: #2 #3.}% + {\bsc FName Cross-reference: #2 #3 cannot be a page reference.}% \else% \if@nameauth@DoFormat% \ifcsname\@nameauth@CleanName{#2#3!MN!}\endcsname% - \@nameauth@FmtName*{\@nameauth@Root{#2,}}% - \index{\Surnames\space#3}% + \@nameauth@FmtFName*{\@nameauth@Root{#2,}}% + \@nameauth@Index{\Surnames\space#3}% \else% \csgdef{\@nameauth@CleanName{#2#3!MN!}}{}% - \expandafter\@nameauth@FmtName\expandafter{\Surnames\space#3}% - \index{\Surnames\space#3}% + \expandafter\@nameauth@FmtFName% + \expandafter{\Surnames\space#3}% + \@nameauth@Index{\Surnames\space#3}% \fi% \else% \ifcsname\@nameauth@CleanName{#2#3!NF!}\endcsname% - \@nameauth@FmtName*{\@nameauth@Root{#2,}}% - \index{\Surnames\space#3}% + \@nameauth@FmtFName*{\@nameauth@Root{#2,}}% + \@nameauth@Index{\Surnames\space#3}% \else% \csgdef{\@nameauth@CleanName{#2#3!NF!}}{}% - \expandafter\@nameauth@FmtName\expandafter*% + \expandafter\@nameauth@FmtFName\expandafter*% \expandafter{\Surnames\space#3}% - \index{\Surnames\space#3}% + \@nameauth@Index{\Surnames\space#3}% \fi% \fi% \fi}% {\ifcsname\@nameauth@CleanName{#2!PN!}\endcsname% - \expandafter\@nameauth@FmtName\expandafter*% + \expandafter\@nameauth@FmtFName\expandafter*% \expandafter{\Surnames}% \PackageWarning{nameauth}% - {You cannot create a page reference from the xref: #2.}% + {\bsc FName Cross-reference: #2 cannot be a page reference.}% \else% \if@nameauth@DoFormat% \ifcsname\@nameauth@CleanName{#2!MN!}\endcsname% - \@nameauth@FmtName*{\@nameauth@Root{#2,}}% - \index{\Surnames}% + \@nameauth@FmtFName*{\@nameauth@Root{#2,}}% + \@nameauth@Index{\Surnames}% \else% \csgdef{\@nameauth@CleanName{#2!MN!}}{}% - \expandafter\@nameauth@FmtName\expandafter{\Surnames}% - \index{\Surnames}% + \expandafter\@nameauth@FmtFName\expandafter{\Surnames}% + \@nameauth@Index{\Surnames}% \fi% \else% \ifcsname\@nameauth@CleanName{#2!NF!}\endcsname% - \@nameauth@FmtName*{\@nameauth@Root{#2,}}% - \index{\Surnames}% + \@nameauth@FmtFName*{\@nameauth@Root{#2,}}% + \@nameauth@Index{\Surnames}% \else% \csgdef{\@nameauth@CleanName{#2!NF!}}{}% - \expandafter\@nameauth@FmtName\expandafter*% + \expandafter\@nameauth@FmtFName\expandafter*% \expandafter{\Surnames}% - \index{\Surnames}% + \@nameauth@Index{\Surnames}% \fi% \fi% \fi}% @@ -309,32 +337,69 @@ \fi% \fi% \IfValueTF{#4}% - {\IfValueTF{#6}{\edef\Forenames{#6}}{\edef\Forenames{#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}}}% + \ifcsname\@nameauth@CleanName{#4#5!PN!}\endcsname% + \PackageWarning{nameauth}% + {\bsc AKA XRef: #1 #2 exists.}% + \else% + \ifcsname\@nameauth@CleanName{#4#5!MN!}\endcsname% + \PackageWarning{nameauth}% + {\bsc AKA: Name reference: #4 #5 already exists; no see ref.}% + \else% + \ifcsname\@nameauth@CleanName{#4#5!NF!}\endcsname% + \PackageWarning{nameauth}% + {\bsc AKA: Name reference: #4 #5 already exists; no see ref.}% + \else% + \csgdef{\@nameauth@CleanName{#4#5!PN!}}{}% + \IfValueTF{#2}% + {\@nameauth@Index{\Surnamesii, #4|see{\Surnamesi, #2}}}% + {\@nameauth@Index{\Surnamesii, #4|see{\Surnamesi}}}% + \fi% + \fi% \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}}}% + {\expandafter\@nameauth@FmtName\expandafter*% + \expandafter{\Surnamesii\space#6}}% + \ifcsname\@nameauth@CleanName{#5#6!PN!}\endcsname\relax% + \else% + \ifcsname\@nameauth@CleanName{#5#6!MN!}\endcsname% + \PackageWarning{nameauth}% + {\bsc AKA Name reference: #5 #6 already exists; no see ref.}% + \else% + \ifcsname\@nameauth@CleanName{#5#6!NF!}\endcsname% + \PackageWarning{nameauth}% + {\bsc AKA Name reference: #5 #6 already exists; no see ref.}% + \else% + \csgdef{\@nameauth@CleanName{#5#6!PN!}}{}% + \IfValueTF{#2}% + {\@nameauth@Index{\Surnamesii\space#6|see{\Surnamesi, #2}}}% + {\@nameauth@Index{\Surnamesii\space#6|see{\Surnamesi}}}% + \fi% + \fi% \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}% + \ifcsname\@nameauth@CleanName{#5!PN!}\endcsname\relax% + \else% + \ifcsname\@nameauth@CleanName{#5!MN!}\endcsname% + \PackageWarning{nameauth}% + {\bsc AKA Name reference: #5 already exists; no see ref.}% + \else% + \ifcsname\@nameauth@CleanName{#5!NF!}\endcsname% + \PackageWarning{nameauth}% + {\bsc AKA Name reference: #5 already exists; no see ref.}% + \else% + \csgdef{\@nameauth@CleanName{#5!PN!}}{}% + \IfValueTF{#2}% + {\@nameauth@Index{\Surnamesii|see{\Surnamesi, #2}}}% + {\@nameauth@Index{\Surnamesii|see{\Surnamesi}}}% + \fi% + \fi% + \fi}% }% \if@nameauth@Punct\expandafter\@nameauth@CheckDot\fi% } @@ -355,19 +420,70 @@ \IfValueTF{#1}% {\ifcsname\@nameauth@CleanName{#1#2!PN!}\endcsname% \else% - \index{\Surnames, #1}% + \@nameauth@Index{\Surnames, #1}% \fi}% {\IfValueTF{#3} {\ifcsname\@nameauth@CleanName{#2#3!PN!}\endcsname% \else% - \index{\Surnames\space#3}% + \@nameauth@Index{\Surnames\space#3}% \fi}% {\ifcsname\@nameauth@CleanName{#2!PN!}\endcsname% \else% - \index{\Surnames}% + \@nameauth@Index{\Surnames}% \fi}% }% } +\DeclareDocumentCommand\ExcludeName{o m o}% +{% + \IfValueTF{#1}% + {% + \ifcsname\@nameauth@CleanName{#1#2!PN!}\endcsname% + \PackageWarning{nameauth}% + {\bsc ExcludeName XRef: #1 #2 exists.}% + \else% + \ifcsname\@nameauth@CleanName{#1#2!MN!}\endcsname% + \PackageWarning{nameauth}% + {\bsc ExcludeName Reference: #1 #2 already exists; no exclusion.}% + \else% + \ifcsname\@nameauth@CleanName{#1#2!NF!}\endcsname% + \PackageWarning{nameauth}% + {\bsc ExcludeName Reference: #1 #2 already exists; no exclusion.}% + \else% + \csgdef{\@nameauth@CleanName{#1#2!PN!}}{}<HOOT>% + \fi% + \fi% + \fi}% + {\IfValueTF{#3}% + {\ifcsname\@nameauth@CleanName{#2#3!PN!}\endcsname\relax% + \else% + \ifcsname\@nameauth@CleanName{#2#3!MN!}\endcsname% + \PackageWarning{nameauth}% + {\bsc ExcludeName Reference: #2 #3 already exists; no exclusion.}% + \else% + \ifcsname\@nameauth@CleanName{#2#3!NF!}\endcsname% + \PackageWarning{nameauth}% + {\bsc ExcludeName Reference: #2 #3 already exists; no exclusion.}% + \else% + \csgdef{\@nameauth@CleanName{#2#3!PN!}}{}% + \fi% + \fi% + \fi}% + {\ifcsname\@nameauth@CleanName{#2!PN!}\endcsname\relax% + \else% + \ifcsname\@nameauth@CleanName{#2!MN!}\endcsname% + \PackageWarning{nameauth}% + {\bsc ExcludeName Reference: #2 already exists; no exclusion.}% + \else% + \ifcsname\@nameauth@CleanName{#2!NF!}\endcsname% + \PackageWarning{nameauth}% + {\bsc ExcludeName Reference: #2 already exists; no exclusion.}% + \else% + \csgdef{\@nameauth@CleanName{#2!PN!}}{}% + \fi% + \fi% + \fi}% + }% +} \DeclareDocumentCommand\ForgetName{o m o}% {% \IfValueTF{#1}% @@ -394,6 +510,8 @@ } \newcommand{\NamesInactive}{\@nameauth@DoFormatfalse} \newcommand{\NamesActive}{\@nameauth@DoFormattrue} +\newcommand{\IndexInactive}{\@nameauth@DoIndexfalse} +\newcommand{\IndexActive}{\@nameauth@DoIndextrue} \endinput %% %% End of file `nameauth.sty'. |