diff options
author | Karl Berry <karl@freefriends.org> | 2016-01-08 00:05:30 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-01-08 00:05:30 +0000 |
commit | d79d90dc1ec3814e1cb0a2e5e25af323a98265fc (patch) | |
tree | 02e4ed8035d202751c049631dc7609a246556bef /Master/texmf-dist/tex/latex/nameauth | |
parent | 804ed063151696ec3101ec58445e342c4dff43e5 (diff) |
nameauth (6jan16)
git-svn-id: svn://tug.org/texlive/trunk@39310 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/nameauth')
-rw-r--r-- | Master/texmf-dist/tex/latex/nameauth/nameauth.sty | 268 |
1 files changed, 209 insertions, 59 deletions
diff --git a/Master/texmf-dist/tex/latex/nameauth/nameauth.sty b/Master/texmf-dist/tex/latex/nameauth/nameauth.sty index 368cfdd626a..3845762c79c 100644 --- a/Master/texmf-dist/tex/latex/nameauth/nameauth.sty +++ b/Master/texmf-dist/tex/latex/nameauth/nameauth.sty @@ -14,10 +14,11 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{nameauth} - [2015/12/01 v2.2 Name authority mechanism for consistency in text and index] + [2016/01/05 v2.3 Name authority mechanism for consistency in text and index] \newif\if@nameauth@AlwaysComma \newif\if@nameauth@ShowComma \newif\if@nameauth@DoFormat +\newif\if@nameauth@LocalNames \newif\if@nameauth@DoIndex \newif\if@nameauth@Pretag \newif\if@nameauth@AllCaps @@ -36,8 +37,9 @@ \newif\if@nameauth@DoCaps \newif\if@nameauth@Accent \newcommand*{\NamesFormat}{} -\newcommand*{\NameauthName}{\Name} -\newcommand*{\NameauthFName}{\FName} +\newcommand*{\NameauthName}{\@nameauth@Name} +\newcommand*{\NameauthLName}{\@nameauth@Name} +\newcommand*{\NameauthFName}{\@nameauth@Name} \DeclareOption{comma}{\@nameauth@AlwaysCommatrue} \DeclareOption{nocomma}{\@nameauth@AlwaysCommafalse} \DeclareOption{mainmatter}{\@nameauth@DoFormattrue} @@ -71,8 +73,8 @@ \RequirePackage{etoolbox} \RequirePackage{ifluatex} \RequirePackage{ifxetex} -\RequirePackage{suffix} \RequirePackage{trimspaces} +\RequirePackage{suffix} \RequirePackage{xargs} \newcommand*\@nameauth@Actual{@} \newcommand*{\@nameauth@Clean}[1]% @@ -148,29 +150,7 @@ \fi \fi } -\newcommand*{\CapThis}{\@nameauth@DoCapstrue} -\newcommand*{\AccentCapThis}{\@nameauth@Accenttrue\@nameauth@DoCapstrue} -\newcommand*{\CapName}{\@nameauth@AllThistrue} -\newcommand*{\RevName}{\@nameauth@RevThistrue} -\newcommand*{\RevComma}% - {\@nameauth@RevThistrue\@nameauth@RevThisCommatrue} -\newcommand*{\ShowComma}{\@nameauth@ShowCommatrue} -\newcommand*{\KeepAffix}{\@nameauth@NBSPtrue} -\newcommand*{\NamesInactive}{\@nameauth@DoFormatfalse} -\newcommand*{\NamesActive}{\@nameauth@DoFormattrue} -\newcommand*{\AllCapsInactive}{\@nameauth@AllCapsfalse} -\newcommand*{\AllCapsActive}{\@nameauth@AllCapstrue} -\newcommand*{\ReverseInactive}{\@nameauth@RevAllfalse} -\newcommand*{\ReverseActive}{\@nameauth@RevAlltrue} -\newcommand*{\ReverseCommaInactive}% - {\@nameauth@RevAllfalse\@nameauth@RevAllCommafalse} -\newcommand*{\ReverseCommaActive}% - {\@nameauth@RevAlltrue\@nameauth@RevAllCommatrue} -\newcommand*{\IndexInactive}{\@nameauth@DoIndexfalse} -\newcommand*{\IndexActive}{\@nameauth@DoIndextrue} -\newcommand*{\IndexActual}[1]% - {\global\renewcommand*\@nameauth@Actual{#1}} -\newcommandx*\Name[3][1=\@empty, 3=\@empty]% +\newcommandx*\@nameauth@Name[3][1=\@empty, 3=\@empty]% {% \let\ex\expandafter% \leavevmode\hbox{}% @@ -481,9 +461,34 @@ \@nameauth@RevThisCommafalse% \if@nameauth@Punct\expandafter\@nameauth@CheckDot\fi } -\WithSuffix\def\Name*{\@nameauth@FullNametrue\Name} -\def\FName{\@nameauth@FirstNametrue\Name} -\WithSuffix\def\FName*{\@nameauth@FirstNametrue\Name} +\newcommand*{\CapThis}{\@nameauth@DoCapstrue} +\newcommand*{\AccentCapThis}{\@nameauth@Accenttrue\@nameauth@DoCapstrue} +\newcommand*{\CapName}{\@nameauth@AllThistrue} +\newcommand*{\RevName}{\@nameauth@RevThistrue} +\newcommand*{\RevComma}% + {\@nameauth@RevThistrue\@nameauth@RevThisCommatrue} +\newcommand*{\ShowComma}{\@nameauth@ShowCommatrue} +\newcommand*{\KeepAffix}{\@nameauth@NBSPtrue} +\newcommand*{\NamesInactive}{\@nameauth@DoFormatfalse} +\newcommand*{\NamesActive}{\@nameauth@DoFormattrue} +\newcommand*{\AllCapsInactive}{\@nameauth@AllCapsfalse} +\newcommand*{\AllCapsActive}{\@nameauth@AllCapstrue} +\newcommand*{\ReverseInactive}{\@nameauth@RevAllfalse} +\newcommand*{\ReverseActive}{\@nameauth@RevAlltrue} +\newcommand*{\ReverseCommaInactive}% + {\@nameauth@RevAllfalse\@nameauth@RevAllCommafalse} +\newcommand*{\ReverseCommaActive}% + {\@nameauth@RevAlltrue\@nameauth@RevAllCommatrue} +\newcommand*{\IndexInactive}{\@nameauth@DoIndexfalse} +\newcommand*{\IndexActive}{\@nameauth@DoIndextrue} +\newcommand*{\IndexActual}[1]% + {\global\renewcommand*\@nameauth@Actual{#1}} +\newcommand*\LocalNames{\@nameauth@LocalNamestrue} +\newcommand*\GlobalNames{\@nameauth@LocalNamesfalse} +\def\Name{\NameauthName} +\WithSuffix\def\Name*{\@nameauth@FullNametrue\NameauthLName} +\def\FName{\@nameauth@FirstNametrue\NameauthFName} +\WithSuffix\def\FName*{\@nameauth@FirstNametrue\NameauthFName} \newcommandx*\AKA[5][1=\@empty, 3=\@empty, 5=\@empty]% {% \let\ex\expandafter% @@ -719,10 +724,14 @@ \else \let\FNN\arge% \fi - \if@nameauth@RevThis - \ex\@nameauth@FmtName\ex{\ex\SNNd\ex\Space\FNN}% + \if@nameauth@AltAKA + \ex\@nameauth@FmtName\ex{\FNN}% \else - \ex\@nameauth@FmtName\ex{\ex\FNN\ex\space\SNNd}% + \if@nameauth@RevThis + \ex\@nameauth@FmtName\ex{\ex\SNNd\ex\Space\FNN}% + \else + \ex\@nameauth@FmtName\ex{\ex\FNN\ex\space\SNNd}% + \fi \fi \fi \@nameauth@NBSPfalse% @@ -738,7 +747,7 @@ \WithSuffix\def\AKA*{\@nameauth@AltAKAtrue\AKA} \newcommandx*\PName[5][1=\@empty,3=\@empty,5=\@empty]% {% - \Name[#1]{#2}\space(\AKA[#1]{#2}[#3]{#4}[#5])% + \NameauthName[#1]{#2}\space(\AKA[#1]{#2}[#3]{#4}[#5])% } \WithSuffix\def\PName*{\@nameauth@FullNametrue\PName} \newcommandx*\TagName[4][1=\@empty, 3=\@empty]% @@ -945,7 +954,7 @@ \PackageWarning{nameauth}% {macro \ExcludeName: Reference: #2 exists; no exclusion}% \else - \csgdef{\csb!PN}{}% + \csgdef{\csb!PN}{!}% \fi \fi \fi @@ -962,7 +971,7 @@ \PackageWarning{nameauth}% {macro \ExcludeName: Reference: #2 #3 exists; no exclusion}% \else - \csgdef{\csbc!PN}{}% + \csgdef{\csbc!PN}{!}% \fi \fi \fi @@ -980,12 +989,99 @@ \PackageWarning{nameauth}% {macro \ExcludeName: Reference: #1 #2 exists; no exclusion}% \else - \csgdef{\csab!PN}{}% + \csgdef{\csab!PN}{!}% \fi \fi \fi \fi } +\newcommandx\IfAKA[6][1=\@empty, 3=\@empty]% +{% + \protected@edef\testa{#1}% + \protected@edef\testb{\trim@spaces{#2}}% + \protected@edef\testc{#3}% + \def\csb{\@nameauth@Clean{#2}}% + \def\csbc{\@nameauth@Clean{#2#3}}% + \def\csab{\@nameauth@Clean{#1!#2}}% + \ifx\testb\@empty + \PackageError{nameauth}% + {macro \ExcludeName: Essential name missing}% + \else + \ifx\csb\@empty + \PackageError{nameauth}% + {macro \ExcludeName: Essential name malformed}% + \fi + \fi + \ifx\testa\@empty + \ifx\testc\@empty + \ifcsname\csb!PN\endcsname + \ifcsempty{\csb!PN}{#4}{#6}% + \else#5\fi + \else + \ifcsname\csbc!PN\endcsname + \ifcsempty{\csbc!PN}{#4}{#6}% + \else#5\fi + \fi + \else + \ifcsname\csab!PN\endcsname + \ifcsempty{\csab!PN}{#4}{#6}% + \else#5\fi + \fi +} +\newcommandx\IfFrontName[5][1=\@empty, 3=\@empty]% +{% + \protected@edef\testa{#1}% + \protected@edef\testb{\trim@spaces{#2}}% + \protected@edef\testc{#3}% + \def\csb{\@nameauth@Clean{#2}}% + \def\csbc{\@nameauth@Clean{#2#3}}% + \def\csab{\@nameauth@Clean{#1!#2}}% + \ifx\testb\@empty + \PackageError{nameauth}% + {macro \ExcludeName: Essential name missing}% + \else + \ifx\csb\@empty + \PackageError{nameauth}% + {macro \ExcludeName: Essential name malformed}% + \fi + \fi + \ifx\testa\@empty + \ifx\testc\@empty + \ifcsname\csb!NF\endcsname#4\else#5\fi + \else + \ifcsname\csbc!NF\endcsname#4\else#5\fi + \fi + \else + \ifcsname\csab!NF\endcsname#4\else#5\fi + \fi +} +\newcommandx\IfMainName[5][1=\@empty, 3=\@empty]% +{% + \protected@edef\testa{#1}% + \protected@edef\testb{\trim@spaces{#2}}% + \protected@edef\testc{#3}% + \def\csb{\@nameauth@Clean{#2}}% + \def\csbc{\@nameauth@Clean{#2#3}}% + \def\csab{\@nameauth@Clean{#1!#2}}% + \ifx\testb\@empty + \PackageError{nameauth}% + {macro \ExcludeName: Essential name missing}% + \else + \ifx\csb\@empty + \PackageError{nameauth}% + {macro \ExcludeName: Essential name malformed}% + \fi + \fi + \ifx\testa\@empty + \ifx\testc\@empty + \ifcsname\csb!MN\endcsname#4\else#5\fi + \else + \ifcsname\csbc!MN\endcsname#4\else#5\fi + \fi + \else + \ifcsname\csab!MN\endcsname#4\else#5\fi + \fi +} \newcommandx*\ForgetName[3][1=\@empty, 3=\@empty]% {% \protected@edef\testa{#1}% @@ -1005,15 +1101,39 @@ \fi \ifx\testa\@empty \ifx\testc\@empty - \global\csundef{\csb!MN}% - \global\csundef{\csb!NF}% + \if@nameauth@LocalNames + \if@nameauth@DoFormat + \global\csundef{\csb!MN}% + \else + \global\csundef{\csb!NF}% + \fi + \else + \global\csundef{\csb!MN}% + \global\csundef{\csb!NF}% + \fi \else - \global\csundef{\csbc!MN}% - \global\csundef{\csbc!NF}% + \if@nameauth@LocalNames + \if@nameauth@DoFormat + \global\csundef{\csbc!MN}% + \else + \global\csundef{\csbc!NF}% + \fi + \else + \global\csundef{\csbc!MN}% + \global\csundef{\csbc!NF}% + \fi \fi \else + \if@nameauth@LocalNames + \if@nameauth@DoFormat + \global\csundef{\csab!MN}% + \else + \global\csundef{\csab!NF}% + \fi + \else \global\csundef{\csab!MN}% \global\csundef{\csab!NF}% + \fi \fi } \newcommandx*\SubvertName[3][1=\@empty, 3=\@empty]% @@ -1035,17 +1155,40 @@ \fi \ifx\testa\@empty \ifx\testc\@empty - \csgdef{\csb!MN}{}% - \csgdef{\csb!NF}{}% + \if@nameauth@LocalNames + \if@nameauth@DoFormat + \csgdef{\csb!MN}{}% + \else + \csgdef{\csb!NF}{}% + \fi + \else + \csgdef{\csb!MN}{}% + \csgdef{\csb!NF}{}% + \fi \else - \csgdef{\csbc!MN}{}% - \csgdef{\csbc!NF}{}% + \if@nameauth@LocalNames + \if@nameauth@DoFormat + \csgdef{\csbc!MN}{}% + \else + \csgdef{\csbc!NF}{}% + \fi + \else + \csgdef{\csbc!MN}{}% + \csgdef{\csbc!NF}{}% + \fi \fi \else + \if@nameauth@LocalNames + \if@nameauth@DoFormat + \csgdef{\csab!MN}{}% + \else + \csgdef{\csab!NF}{}% + \fi + \else \csgdef{\csab!MN}{}% \csgdef{\csab!NF}{}% - \fi -} + \fi + \fi} \newenvironment{nameauth}{% \begingroup% \let\ex\expandafter% @@ -1061,8 +1204,8 @@ \tokc\expandafter{##3}% \tokd\expandafter{##4}% \ifx\arga\@empty - \PackageError{nameauth}% - {environment nameauth: Control sequence missing}% + \PackageError{nameauth}% + {environment nameauth: Control sequence missing}% \else \ifx\testc\@empty \PackageError{nameauth}% @@ -1075,17 +1218,20 @@ \ifx\testd\@empty \ifx\testb\@empty \ex\csgdef\ex{\ex\arga\ex}\ex{\ex\NameauthName\ex{\the\tokc}}% - \ex\csgdef\ex{\ex L\ex\arga\ex}\ex{\ex\NameauthName\ex*\ex{\the\tokc}}% - \ex\csgdef\ex{\ex S\ex\arga\ex}\ex{\ex\NameauthFName\ex{\the\tokc}}% + \ex\csgdef\ex{\ex L\ex\arga\ex}\ex{\ex\@nameauth@FullNametrue% + \ex\NameauthLName\ex{\the\tokc}}% + \ex\csgdef\ex{\ex S\ex\arga\ex}\ex{\ex\@nameauth@FirstNametrue% + \ex\NameauthFName\ex{\the\tokc}}% \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\tokb\ex]% \ex{\the\tokc}}% \ex\ex\ex\csgdef\ex\ex\ex{\ex\ex\ex L\ex\ex\ex\arga% - \ex\ex\ex}\ex\ex\ex{\ex\ex\ex\NameauthName\ex\ex\ex*% - \ex\ex\ex[\ex\the\ex\tokb\ex]\ex{\the\tokc}}% + \ex\ex\ex}\ex\ex\ex{\ex\ex\ex\@nameauth@FullNametrue% + \ex\ex\ex\NameauthLName\ex\ex\ex[\ex\the\ex\tokb\ex]\ex{\the\tokc}}% \ex\ex\ex\csgdef\ex\ex\ex{\ex\ex\ex S\ex\ex\ex\arga% - \ex\ex\ex}\ex\ex\ex{\ex\ex\ex\NameauthFName\ex\ex\ex[% + \ex\ex\ex}\ex\ex\ex{\ex\ex\ex\@nameauth@FirstNametrue% + \ex\ex\ex\NameauthFName\ex\ex\ex[% \ex\the\ex\tokb\ex]\ex{\the\tokc}}% \fi \else @@ -1094,10 +1240,12 @@ \ex\ex\ex{\ex\ex\ex\NameauthName\ex\ex\ex{\ex\the\ex\tokc\ex}% \ex[\the\tokd]}% \ex\ex\ex\csgdef\ex\ex\ex{\ex\ex\ex L\ex\ex\ex\arga% - \ex\ex\ex}\ex\ex\ex{\ex\ex\ex\NameauthName% - \ex\ex\ex*\ex\ex\ex{\ex\the\ex\tokc\ex}\ex[\the\tokd]}% + \ex\ex\ex}\ex\ex\ex{\ex\ex\ex\@nameauth@FullNametrue% + \ex\ex\ex\NameauthLName\ex\ex\ex{% + \ex\the\ex\tokc\ex}\ex[\the\tokd]}% \ex\ex\ex\csgdef\ex\ex\ex{\ex\ex\ex S\ex\ex\ex\arga% - \ex\ex\ex}\ex\ex\ex{\ex\ex\ex\NameauthFName\ex\ex\ex{% + \ex\ex\ex}\ex\ex\ex{\ex\ex\ex\@nameauth@FirstNametrue% + \ex\ex\ex\NameauthFName\ex\ex\ex{% \ex\the\ex\tokc\ex}\ex[\the\tokd]}% \else \ex\ex\ex\ex\ex\ex\ex\csgdef\ex\ex\ex\ex\ex\ex\ex{% @@ -1108,12 +1256,14 @@ \ex\ex\ex\ex\ex\ex\ex\csgdef\ex\ex\ex\ex\ex\ex\ex{% \ex\ex\ex\ex\ex\ex\ex L\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\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\tokb% \ex\ex\ex]\ex\ex\ex{\ex\the\ex\tokc\ex}\ex[\the\tokd]}% \ex\ex\ex\ex\ex\ex\ex\csgdef\ex\ex\ex\ex\ex\ex\ex{% \ex\ex\ex\ex\ex\ex\ex S\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\@nameauth@FirstNametrue% \ex\ex\ex\ex\ex\ex\ex\NameauthFName\ex\ex\ex\ex\ex\ex\ex[% \ex\ex\ex\the\ex\ex\ex\tokb\ex\ex\ex]% \ex\ex\ex{\ex\the\ex\tokc\ex}\ex[\the\tokd]}% @@ -1125,7 +1275,7 @@ }\ignorespaces% }{\endgroup\ignorespaces} %% -%% Copyright (C) 2015 by Charles P. Schaum <charles dot schaum at comcast dot net> +%% Copyright (C) 2016 by Charles P. Schaum <charles dot schaum at comcast dot net> %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License (LPPL), either |