From 053930a0ae346b5d7e31ad8e9e576cac0ea1bb70 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 1 Jan 2012 23:05:20 +0000 Subject: nameauth 0.7 (31dec11) git-svn-id: svn://tug.org/texlive/trunk@24993 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/nameauth/nameauth.sty | 196 ++++++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/nameauth/nameauth.sty (limited to 'Master/texmf-dist/tex/latex/nameauth') diff --git a/Master/texmf-dist/tex/latex/nameauth/nameauth.sty b/Master/texmf-dist/tex/latex/nameauth/nameauth.sty new file mode 100644 index 00000000000..2955483ddd9 --- /dev/null +++ b/Master/texmf-dist/tex/latex/nameauth/nameauth.sty @@ -0,0 +1,196 @@ +%% +%% 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 +%% +%% 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} + [2011/12/26 v0.7 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}% + {\ifcsname\@CleanName{#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{#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}% + {\ifcsname\@CleanName{#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{#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 m}% +{% + \IfValueTF{#1}% + {\ifcsname\@CleanName{#1#2!PN!}\endcsname\else\index{#2,{\space}#1}\fi}% + {\ifcsname\@CleanName{#2!PN!}\endcsname\else\index{#2}\fi}% + {#3}% +} +\DeclareDocumentCommand\ForgetName{o m}% +{% + \IfValueTF{#1}% + {\csundef{\@CleanName{#1#2!MN!}}\csundef{\@CleanName{#1#2!NF!}}}% + {\csundef{\@CleanName{#2!MN!}}\csundef{\@CleanName{#2!NF!}}}% +} +\newcommand{\NamesInactive}{\@nameauth@DoFormatfalse} +\newcommand{\NamesActive}{\@nameauth@DoFormattrue} +\endinput +%% +%% End of file `nameauth.sty'. -- cgit v1.2.3