summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/nameauth
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-02-06 23:37:02 +0000
committerKarl Berry <karl@freefriends.org>2012-02-06 23:37:02 +0000
commit8085544365e7f2ec7bb1e87d0ed6da322fd6a0c7 (patch)
treecb8f9bdb3b39fac63296024d75f473112dfa4f5c /Master/texmf-dist/tex/latex/nameauth
parenta75f7e798d1c5d31c4bcb89338923f0120ccc6df (diff)
nameauth 0.86 (6feb12)
git-svn-id: svn://tug.org/texlive/trunk@25320 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/nameauth')
-rw-r--r--Master/texmf-dist/tex/latex/nameauth/nameauth.sty146
1 files changed, 110 insertions, 36 deletions
diff --git a/Master/texmf-dist/tex/latex/nameauth/nameauth.sty b/Master/texmf-dist/tex/latex/nameauth/nameauth.sty
index b8f348667b0..e9cc3c63513 100644
--- a/Master/texmf-dist/tex/latex/nameauth/nameauth.sty
+++ b/Master/texmf-dist/tex/latex/nameauth/nameauth.sty
@@ -22,23 +22,35 @@
%%
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesPackage{nameauth}
- [2012/01/29 v0.8 name authority macros to aid consistent display and indexing of names]
+ [2012/02/06 v0.86 name authority macros to aid consistent display and indexing of names]
\newif\if@nameauth@DoFormat
+\newif\if@nameauth@DoComma
\newif\if@nameauth@Punct
+\newif\if@nameauth@dtx
\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}
+\DeclareOption{nocomma}{\@nameauth@DoCommafalse}
+\DeclareOption{comma}{\@nameauth@DoCommatrue}
+\ExecuteOptions{smallcaps,mainmatter,nocomma}
\ProcessOptions\relax
\RequirePackage{etoolbox}
\RequirePackage{xparse}
+\@ifclassloaded{ltxdoc}
+ {\@nameauth@dtxtrue}
+ {\@nameauth@dtxfalse}%
\newcommand*{\@nameauth@CleanName}[1]{\expandafter\zap@space\detokenize{#1} \@empty}
-\newcommand{\@nameauth@Zapsuffix}[1]{%
- \def\@@Zapsuffix##1,##2*{##1}%
- {\@@Zapsuffix#1,*}%
+\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@Zapsuffix}[1]{%
+ {\@nameauth@Root#1,*}%
}
\def\@nameauth@CheckDot{\futurelet\@token\@nameauth@EvalDot}
\def\@nameauth@EvalDot{\let\@period=.\ifx\@token\@period\expandafter\@gobble \fi}
@@ -51,13 +63,20 @@
\DeclareDocumentCommand\@nameauth@FmtName{s m}%
{%
\@nameauth@TestDot{#2}%
- \IfBooleanTF{#1}{#2}{\bgroup\NamesFormat{#2}\egroup}%
+ \if@nameauth@DoComma%
+ \IfBooleanTF{#1}{#2}{\bgroup\NamesFormat{#2}\egroup}%
+ \else
+ \IfBooleanTF{#1}%
+ {\@nameauth@NoComma{#2}}%
+ {\bgroup\NamesFormat{\@nameauth@NoComma{#2}}\egroup}%
+ \fi
}
\DeclareDocumentCommand\Name{s o m o}%
{%
- \@nameauth@Punctfalse%
+ \if@nameauth@DoComma\edef\Surnames{#3}%
+ \else\edef\Surnames{\@nameauth@NoComma{#3}}\fi%
\IfValueTF{#2}%
- {\IfValueTF{#4}{\def\@ForeNames{#4}}{\def\@ForeNames{#2}}%
+ {\IfValueTF{#4}{\edef\Forenames{#4}}{\edef\Forenames{#2}}%
\ifcsname\@nameauth@CleanName{#2#3!PN!}\endcsname%
\@nameauth@FmtName*{#2 #3}%
\PackageWarning{nameauth}%
@@ -66,20 +85,32 @@
\if@nameauth@DoFormat%
\ifcsname\@nameauth@CleanName{#2#3!MN!}\endcsname%
\IfBooleanTF{#1}%
- {\@nameauth@FmtName*{\@ForeNames{\space}#3}\index{#3,{\space}#2}}%
- {\@nameauth@FmtName*{\@nameauth@Zapsuffix{#3}}\index{#3,{\space}#2}}%
+ {\@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}%
\else%
\csgdef{\@nameauth@CleanName{#2#3!MN!}}{}%
- \@nameauth@FmtName{\@ForeNames{\space}#3}\index{#3,{\space}#2}%
+ \@nameauth@FmtName{\Forenames{} #3}%
+ \if@nameauth@dtx\index{#3=\Surnames, #2}%
+ \else\index{#3@\Surnames, #2}\fi%
\fi%
\else%
\ifcsname\@nameauth@CleanName{#2#3!NF!}\endcsname%
\IfBooleanTF{#1}%
- {\@nameauth@FmtName*{\@ForeNames{\space}#3}\index{#3,{\space}#2}}%
- {\@nameauth@FmtName*{\@nameauth@Zapsuffix{#3}}\index{#3,{\space}#2}}%
+ {\@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}%
\else%
\csgdef{\@nameauth@CleanName{#2#3!NF!}}{}%
- \@nameauth@FmtName*{\@ForeNames{\space}#3}\index{#3,{\space}#2}%
+ \@nameauth@FmtName*{\Forenames{} #3}%
+ \if@nameauth@dtx\index{#3=\Surnames, #2}%
+ \else\index{#3@\Surnames, #2}\fi%
\fi%
\fi%
\fi}%
@@ -92,20 +123,32 @@
\if@nameauth@DoFormat%
\ifcsname\@nameauth@CleanName{#3#4!MN!}\endcsname%
\IfBooleanTF{#1}%
- {\@nameauth@FmtName*{#3 #4}\index{#3 #4}}%
- {\@nameauth@FmtName*{\@nameauth@Zapsuffix{#3}}\index{#3 #4}}%
+ {\@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}%
\else%
\csgdef{\@nameauth@CleanName{#3#4!MN!}}{}%
- \@nameauth@FmtName{#3 #4}\index{#3 #4}%
+ \@nameauth@FmtName{#3 #4}%
+ \if@nameauth@dtx\index{#3=\Surnames{} #4}%
+ \else\index{#3@\Surnames{} #4}\fi%
\fi%
\else%
\ifcsname\@nameauth@CleanName{#3#4!NF!}\endcsname%
\IfBooleanTF{#1}%
- {\@nameauth@FmtName*{#3 #4}\index{#3 #4}}%
- {\@nameauth@FmtName*{\@nameauth@Zapsuffix{#3}}\index{#3 #4}}%
+ {\@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}%
\else%
\csgdef{\@nameauth@CleanName{#3#4!NF!}}{}%
- \@nameauth@FmtName*{#3 #4}\index{#3 #4}%
+ \@nameauth@FmtName*{#3 #4}%
+ \if@nameauth@dtx\index{#3=\Surnames{} #4}%
+ \else\index{#3@\Surnames{} #4}\fi%
\fi%
\fi%
\fi}%
@@ -117,20 +160,32 @@
\if@nameauth@DoFormat%
\ifcsname\@nameauth@CleanName{#3!MN!}\endcsname%
\IfBooleanTF{#1}%
- {\@nameauth@FmtName*{#3}\index{#3}}%
- {\@nameauth@FmtName*{\@nameauth@Zapsuffix{#3}}\index{#3}}%
+ {\@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}%
\else%
\csgdef{\@nameauth@CleanName{#3!MN!}}{}%
- \@nameauth@FmtName{#3}\index{#3}%
+ \@nameauth@FmtName{#3}%
+ \if@nameauth@dtx\index{#3=\Surnames}%
+ \else\index{#3@\Surnames}\fi%
\fi%
\else%
\ifcsname\@nameauth@CleanName{#3!NF!}\endcsname%
\IfBooleanTF{#1}%
- {\@nameauth@FmtName*{#3}\index{#3}}%
- {\@nameauth@FmtName*{\@nameauth@Zapsuffix{#3}}\index{#3}}%
+ {\@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}%
\else%
\csgdef{\@nameauth@CleanName{#3!NF!}}{}%
- \@nameauth@FmtName*{#3}\index{#3}%
+ \@nameauth@FmtName*{#3}%
+ \if@nameauth@dtx\index{#3=\Surnames}%
+ \else\index{#3@\Surnames}\fi%
\fi%
\fi%
\fi}%
@@ -144,34 +199,53 @@
}
\DeclareDocumentCommand\AKA{o m o m}%
{%
- \@nameauth@Punctfalse%
+ \if@nameauth@DoComma%
+ \edef\Surnamesi{#2}\edef\Surnamesii{#4}%
+ \else\edef\Surnamesi{\@nameauth@NoComma{#2}}%
+ \edef\Surnamesii{\@nameauth@NoComma{#4}}%
+ \fi%
\IfValueTF{#3}%
{\@nameauth@FmtName*{#3 #4}%
\ifcsname\@nameauth@CleanName{#3#4!PN!}\endcsname\relax\else%
\csgdef{\@nameauth@CleanName{#3#4!PN!}}{}%
\IfValueTF{#1}%
- {\index{#4,{\space}#3|see{#2,{\space}#1}}}%
- {\index{#4,{\space}#3|see{#2}}}%
- \fi}%
+ {\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}%
+ \fi}%
{\@nameauth@FmtName*{#4}%
\ifcsname\@nameauth@CleanName{#4!PN!}\endcsname\relax\else%
\csgdef{\@nameauth@CleanName{#4!PN!}}{}%
\IfValueTF{#1}%
- {\index{#4|see{#2,{\space}#1}}}%
- {\index{#4|see{#2}}}%
- \fi}%
+ {\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}%
+ \fi}%
\if@nameauth@Punct\expandafter\@nameauth@CheckDot\fi%
}
\DeclareDocumentCommand\IndexName{o m o}%
{%
+ \if@nameauth@DoComma\edef\Surnames{#2}%
+ \else\edef\Surnames{\@nameauth@NoComma{#2}}\fi%
\IfValueTF{#1}%
{\ifcsname\@nameauth@CleanName{#1#2!PN!}\endcsname%
- \else\index{#2,{\space}#1}\fi}%
+ \else%
+ \if@nameauth@dtx\index{#2=\Surnames, #1}%
+ \else\index{#2@\Surnames, #1}\fi%
+ \fi}%
{\IfValueTF{#3}
{\ifcsname\@nameauth@CleanName{#2#3!PN!}\endcsname%
- \else\index{#2 #3}\fi}
+ \else%
+ \if@nameauth@dtx\index{#2=\Surnames{} #3}%
+ \else\index{#2@\Surnames{} #3}\fi%
+ \fi}%
{\ifcsname\@nameauth@CleanName{#2!PN!}\endcsname%
- \else\index{#2}\fi}%
+ \else%
+ \if@nameauth@dtx\index{#2=\Surnames}%
+ \else\index{#2@\Surnames}\fi%
+ \fi}
}%
}
\DeclareDocumentCommand\ForgetName{o m o}%