summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-01-30 23:49:34 +0000
committerKarl Berry <karl@freefriends.org>2012-01-30 23:49:34 +0000
commit034fde36e1b3172016db6037511e0118d5ed04f6 (patch)
tree21feb78903f5f2df15a65c42ddce12ee5dc43fd9 /Master/texmf-dist/tex
parentdfc05b7d118ea655b9bb7c08ac6a7c74eecafa22 (diff)
nameauth (30jan12)
git-svn-id: svn://tug.org/texlive/trunk@25244 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/nameauth/nameauth.sty248
1 files changed, 97 insertions, 151 deletions
diff --git a/Master/texmf-dist/tex/latex/nameauth/nameauth.sty b/Master/texmf-dist/tex/latex/nameauth/nameauth.sty
index 8f493db568f..b8f348667b0 100644
--- a/Master/texmf-dist/tex/latex/nameauth/nameauth.sty
+++ b/Master/texmf-dist/tex/latex/nameauth/nameauth.sty
@@ -22,7 +22,7 @@
%%
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesPackage{nameauth}
- [2012/01/19 v0.75 name authority macros to aid consistent display and indexing of names]
+ [2012/01/29 v0.8 name authority macros to aid consistent display and indexing of names]
\newif\if@nameauth@DoFormat
\newif\if@nameauth@Punct
\DeclareOption{mainmatter}{\@nameauth@DoFormattrue}
@@ -35,169 +35,107 @@
\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,*}%
+\newcommand*{\@nameauth@CleanName}[1]{\expandafter\zap@space\detokenize{#1} \@empty}
+\newcommand{\@nameauth@Zapsuffix}[1]{%
+ \def\@@Zapsuffix##1,##2*{##1}%
+ {\@@Zapsuffix#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}%
+\def\@nameauth@CheckDot{\futurelet\@token\@nameauth@EvalDot}
+\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}%
+ \@nameauth@Punctfalse%
+ \TestDot#1\TestEnd.\TestEnd\TestStop%
}
-\DeclareDocumentCommand\@FName{o m o}%
+\DeclareDocumentCommand\@nameauth@FmtName{s m}%
{%
- \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}%
- }%
+ \@nameauth@TestDot{#2}%
+ \IfBooleanTF{#1}{#2}{\bgroup\NamesFormat{#2}\egroup}%
}
-\DeclareDocumentCommand\@LName{o m o}%
+\DeclareDocumentCommand\Name{s o m o}%
{%
- \IfValueTF{#1}%
- {\IfValueTF{#3}{\def\@ForeNames{#3}}{\def\@ForeNames{#1}}%
- \ifcsname\@CleanName{#1#2!PN!}\endcsname%
- \@FmtName*{#1 #2}%
+ \@nameauth@Punctfalse%
+ \IfValueTF{#2}%
+ {\IfValueTF{#4}{\def\@ForeNames{#4}}{\def\@ForeNames{#2}}%
+ \ifcsname\@nameauth@CleanName{#2#3!PN!}\endcsname%
+ \@nameauth@FmtName*{#2 #3}%
\PackageWarning{nameauth}%
- {You cannot create a page reference from the pen name: #1 #2.}%
+ {You cannot create a page reference from the pen name: #2 #3.}%
\else%
\if@nameauth@DoFormat%
- \ifcsname\@CleanName{#1#2!MN!}\endcsname%
- \@FmtName*{\@Zapsuffix{#2}}\index{#2,{\space}#1}%
+ \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}}%
\else%
- \csgdef{\@CleanName{#1#2!MN!}}{}%
- \@FmtName{\@ForeNames{\space}#2}\index{#2,{\space}#1}%
+ \csgdef{\@nameauth@CleanName{#2#3!MN!}}{}%
+ \@nameauth@FmtName{\@ForeNames{\space}#3}\index{#3,{\space}#2}%
\fi%
\else%
- \ifcsname\@CleanName{#1#2!NF!}\endcsname%
- \@FmtName*{\@Zapsuffix{#2}}\index{#2,{\space}#1}%
+ \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}}%
\else%
- \csgdef{\@CleanName{#1#2!NF!}}{}%
- \@FmtName*{\@ForeNames{\space}#2}\index{#2,{\space}#1}%
+ \csgdef{\@nameauth@CleanName{#2#3!NF!}}{}%
+ \@nameauth@FmtName*{\@ForeNames{\space}#3}\index{#3,{\space}#2}%
\fi%
\fi%
\fi}%
- {\IfValueTF{#3}
- {\ifcsname\@CleanName{#2#3!PN!}\endcsname%
- \@FmtName*{#2 #3}%
+ {\IfValueTF{#4}
+ {\ifcsname\@nameauth@CleanName{#3#4!PN!}\endcsname%
+ \@nameauth@FmtName*{#3 #4}%
\PackageWarning{nameauth}%
- {You cannot create a page reference from the pen name: #2 #3.}%
+ {You cannot create a page reference from the pen name: #3 #4.}%
\else%
\if@nameauth@DoFormat%
- \ifcsname\@CleanName{#2#3!MN!}\endcsname%
- \@FmtName*{\@Zapsuffix{#2}}\index{#2 #3}%
+ \ifcsname\@nameauth@CleanName{#3#4!MN!}\endcsname%
+ \IfBooleanTF{#1}%
+ {\@nameauth@FmtName*{#3 #4}\index{#3 #4}}%
+ {\@nameauth@FmtName*{\@nameauth@Zapsuffix{#3}}\index{#3 #4}}%
\else%
- \csgdef{\@CleanName{#2#3!MN!}}{}%
- \@FmtName{#2 #3}\index{#2 #3}%
- \fi%
+ \csgdef{\@nameauth@CleanName{#3#4!MN!}}{}%
+ \@nameauth@FmtName{#3 #4}\index{#3 #4}%
+ \fi%
\else%
- \ifcsname\@CleanName{#2#3!NF!}\endcsname%
- \@FmtName*{\@Zapsuffix{#2}}\index{#2 #3}%
+ \ifcsname\@nameauth@CleanName{#3#4!NF!}\endcsname%
+ \IfBooleanTF{#1}%
+ {\@nameauth@FmtName*{#3 #4}\index{#3 #4}}%
+ {\@nameauth@FmtName*{\@nameauth@Zapsuffix{#3}}\index{#3 #4}}%
\else%
- \csgdef{\@CleanName{#2#3!NF!}}{}%
- \@FmtName*{#2 #3}\index{#2 #3}%
- \fi%
+ \csgdef{\@nameauth@CleanName{#3#4!NF!}}{}%
+ \@nameauth@FmtName*{#3 #4}\index{#3 #4}%
+ \fi%
\fi%
\fi}%
- {\ifcsname\@CleanName{#2!PN!}\endcsname%
- \@FmtName*{#2}%
+ {\ifcsname\@nameauth@CleanName{#3!PN!}\endcsname%
+ \@nameauth@FmtName*{#3}%
\PackageWarning{nameauth}%
- {You cannot create a page reference from the pen name: #2.}%
+ {You cannot create a page reference from the pen name: #3.}%
\else%
\if@nameauth@DoFormat%
- \ifcsname\@CleanName{#2!MN!}\endcsname%
- \@FmtName*{\@Zapsuffix{#2}}\index{#2}%
+ \ifcsname\@nameauth@CleanName{#3!MN!}\endcsname%
+ \IfBooleanTF{#1}%
+ {\@nameauth@FmtName*{#3}\index{#3}}%
+ {\@nameauth@FmtName*{\@nameauth@Zapsuffix{#3}}\index{#3}}%
\else%
- \csgdef{\@CleanName{#2!MN!}}{}%
- \@FmtName{#2}\index{#2}%
- \fi%
+ \csgdef{\@nameauth@CleanName{#3!MN!}}{}%
+ \@nameauth@FmtName{#3}\index{#3}%
+ \fi%
\else%
- \ifcsname\@CleanName{#2!NF!}\endcsname%
- \@FmtName*{\@Zapsuffix{#2}}\index{#2}%
- \else%
- \csgdef{\@CleanName{#2!NF!}}{}%
- \@FmtName*{#2}\index{#2}%
+ \ifcsname\@nameauth@CleanName{#3!NF!}\endcsname%
+ \IfBooleanTF{#1}%
+ {\@nameauth@FmtName*{#3}\index{#3}}%
+ {\@nameauth@FmtName*{\@nameauth@Zapsuffix{#3}}\index{#3}}%
+ \else%
+ \csgdef{\@nameauth@CleanName{#3!NF!}}{}%
+ \@nameauth@FmtName*{#3}\index{#3}%
\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%
+ \if@nameauth@Punct\expandafter\@nameauth@CheckDot\fi%
}
\DeclareDocumentCommand\PName{s o m o m}%
{%
@@ -208,36 +146,44 @@
{%
\@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%
+ {\@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}%
+ {\@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@Punct\expandafter\@nameauth@CheckDot\fi%
}
\DeclareDocumentCommand\IndexName{o m o}%
{%
\IfValueTF{#1}%
- {\ifcsname\@CleanName{#1#2!PN!}\endcsname\else\index{#2,{\space}#1}\fi}%
+ {\ifcsname\@nameauth@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}%
+ {\ifcsname\@nameauth@CleanName{#2#3!PN!}\endcsname%
+ \else\index{#2 #3}\fi}
+ {\ifcsname\@nameauth@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!}}}%
+ {\csundef{\@nameauth@CleanName{#1#2!MN!}}%
+ \csundef{\@nameauth@CleanName{#1#2!NF!}}}%
{\IfValueTF{#3}%
- {\csundef{\@CleanName{#2#3!MN!}}\csundef{\@CleanName{#2#3!NF!}}}%
- {\csundef{\@CleanName{#2!MN!}}\csundef{\@CleanName{#2!NF!}}}%
+ {\csundef{\@nameauth@CleanName{#2#3!MN!}}%
+ \csundef{\@nameauth@CleanName{#2#3!NF!}}}%
+ {\csundef{\@nameauth@CleanName{#2!MN!}}%
+ \csundef{\@nameauth@CleanName{#2!NF!}}}%
}%
}
\newcommand{\NamesInactive}{\@nameauth@DoFormatfalse}