%PDF- %PDF-
| Direktori : /proc/self/root/data/old/usr/share/texlive/texmf-dist/tex/latex/datatool/ |
| Current File : //proc/self/root/data/old/usr/share/texlive/texmf-dist/tex/latex/datatool/person.sty |
%%
%% This is file `person.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% datatool.dtx (with options: `person.sty,package')
%%
%% datatool.dtx
%% Copyright 2013 Nicola Talbot
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license of (at your option) any later version.
%% The latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%%
%% The Current Maintainer of this work is Nicola Talbot.
%%
%% This work consists of the files datatool.dtx and datatool.ins and the derived files datatool-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, datagidx.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst.
%%
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%% Digits \0\1\2\3\4\5\6\7\8\9
%% Exclamation \! Double quote \" Hash (number) \#
%% Dollar \$ Percent \% Ampersand \&
%% Acute accent \' Left paren \( Right paren \)
%% Asterisk \* Plus \+ Comma \,
%% Minus \- Point \. Solidus \/
%% Colon \: Semicolon \; Less than \<
%% Equals \= Greater than \> Question mark \?
%% Commercial at \@ Left bracket \[ Backslash \\
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{person}[2013/01/15 v2.13 (NLCT)]
\RequirePackage{ifthen}
\RequirePackage{datatool}
\newcounter{people}
\newcounter{person}
\newcommand*{\@people@list}{,}
\newcommand*{\@get@firstperson}[1]{%
\expandafter\@@get@firstperson\@people@list,\@nil{#1}}
\def\@@get@firstperson,#1,#2\@nil#3{%
\def#3{#1}%
}
\newcommand*{\malelabels}{male,Male,MALE,M,m}
\newcommand*{\addmalelabel}[1]{%
\expandafter\@dtl@toksA\expandafter{\malelabels}%
\expandafter\@dtl@toksB\expandafter{#1}%
\edef\malelabels{\the\@dtl@toksA,\the\@dtl@toksB}%
}
\newcommand*{\addfemalelabel}[1]{%
\expandafter\@dtl@toksA\expandafter{\femalelabels}%
\expandafter\@dtl@toksB\expandafter{#1}%
\edef\femalelabels{\the\@dtl@toksA,\the\@dtl@toksB}%
}
\newcommand*{\femalelabels}{female,Female,FEMALE,F,f}
\newcommand{\ifmalelabel}[3]{%
\expandafter\DTLifinlist\expandafter{#1}{\malelabels}{#2}{#3}%
}
\newcommand{\iffemalelabel}[3]{%
\expandafter\DTLifinlist\expandafter{#1}{\femalelabels}{#2}{#3}%
}
\newcommand*{\newperson}[4][anon]{%
\@ifundefined{person@#1@name}%
{%
\ifmalelabel{#4}%
{%
\expandafter\gdef\csname person@#1@gender\endcsname{male}%
}%
{%
\iffemalelabel{#4}%
{%
\expandafter\gdef\csname person@#1@gender\endcsname{female}%
}%
{%
\PackageError{person}{Unknown gender `#4' for person
`#1'}{Allowed gender labels are: \malelabels\space or
\femalelabels}%
\@namedef{person@#1@gender}{other}%
}%
}%
\expandafter
\protected@xdef\csname person@#1@fullname\endcsname{#2}%
\expandafter
\protected@xdef\csname person@#1@name\endcsname{#3}%
\protected@xdef\@people@list{\@people@list#1,}%
\stepcounter{people}%
}%
{%
\PackageError{person}{Person `#1' has already been defined}{}%
}%
}
\newcommand*{\removeperson}[1][anon]{%
\edef\@person@label{#1}%
\expandafter\@removeperson\expandafter{\@person@label}%
}
\newcommand*{\@removeperson}[1]{%
\ifpersonexists{#1}%
{%
\def\@remove@person##1,#1,##2\@nil{%
\def\@prsn@pre{##1}\def\@prsn@post{##2}}%
\expandafter\@remove@person\@people@list\@nil
\xdef\@people@list{\@prsn@pre,\@prsn@post}%
\addtocounter{people}{-1}%
\expandafter\global\expandafter
\let\csname person@#1@name\endcsname\undefined
\expandafter\global\expandafter
\let\csname person@#1@fullname\endcsname\undefined
\expandafter\global\expandafter
\let\csname person@#1@gender\endcsname\undefined
}%
{%
\PackageError{person}{Can't remove person `#1': no such
person}{}%
}%
}
\newcommand*{\removepeople}[1]{%
\@for\@thisperson:=#1\do{%
\ifx\@thisperson\@empty
\else
\expandafter\removeperson\expandafter[\@thisperson]%
\fi
}%
}
\newcommand*{\removeallpeople}{%
\@for\@thisperson:=\@people@list\do{%
\expandafter\global\expandafter
\let\csname person@\@thisperson @name\endcsname\undefined
\expandafter\global\expandafter
\let\csname person@\@thisperson @fullname\endcsname\undefined
\expandafter\global\expandafter
\let\csname person@\@thisperson @gender\endcsname\undefined
}%
\setcounter{people}{0}%
\gdef\@people@list{,}%
}
\newcommand{\ifpersonexists}[3]{%
\@ifundefined{person@#1@name}{#3}{#2}%
}
\newcommand{\ifmale}[3]{%
\ifpersonexists{#1}%
{%
\edef\@gender{\csname person@\@thisperson @gender\endcsname}%
\ifx\@gender\@male@label
#2%
\else
#3%
\fi
}%
{%
\PackageError{person}{Person `#1' doesn't exist.}{}%
}%
}
\def\@male@label{male}
\newcommand{\ifallmale}[3][\@people@list]{%
\@for\@thisperson:=#1\do{%
\ifpersonexists{\@thisperson}%
{%
\edef\@gender{\csname person@\@thisperson @gender\endcsname}%
\ifx\@gender\@male@label
\else
\@endfortrue
\fi
}%
{%
\PackageError{person}{Person `#1' doesn't exist.}{}%
}%
}%
\if@endfor
#3%
\else
#2%
\fi
}
\newcommand{\iffemale}[3]{%
\ifpersonexists{#1}%
{%
\edef\@gender{\csname person@\@thisperson @gender\endcsname}%
\ifx\@gender\@female@label
#2%
\else
#3%
\fi
}%
{%
\PackageError{person}{Person `#1' doesn't exist.}{}%
}%
}
\def\@female@label{female}
\newcommand{\ifallfemale}[3][\@people@list]{%
\@for\@thisperson:=#1\do{%
\edef\@gender{\csname person@\@thisperson @gender\endcsname}%
\ifx\@gender\@female@label
\else
\@endfortrue
\fi
}%
\if@endfor
#3%
\else
#2%
\fi
}
\def\foreachperson(#1,#2,#3,#4)#5{%
\ifx#5\in
\def\@do@foreachperson{\@foreachperson(#1,#2,#3,#4)#5}%
\else
\def\@do@foreachperson{%
\@foreachperson(#1,#2,#3,#4)\in\@people@list#5}%
\fi
\@do@foreachperson
}
\long\def\@foreachperson(#1,#2,#3,#4)\in#5\do#6{%
\@for#4:=#5\do{%
\ifx#4\@empty
\else
\ifpersonexists{#4}%
{%
\expandafter
\let\expandafter#1\csname person@#4@name\endcsname
\expandafter
\let\expandafter#2\csname person@#4@fullname\endcsname
\expandafter
\let\expandafter#3\csname person@#4@gender\endcsname
\ifx#3\@male@label
\let#3\malename
\else
\ifx#3\@female@label
\let#3\femalename
\fi
\fi
#6%
}%
{%
\PackageError{person}{Person `#4' doesn't exist}{}%
}%
\fi
}%
}
\newcommand*{\malepronoun}{he}
\newcommand*{\femalepronoun}{she}
\newcommand*{\pluralpronoun}{they}
\newcommand*{\maleobjpronoun}{him}
\newcommand*{\femaleobjpronoun}{her}
\newcommand*{\pluralobjpronoun}{them}
\newcommand*{\malepossadj}{his}
\newcommand*{\femalepossadj}{her}
\newcommand*{\pluralpossadj}{their}
\newcommand*{\maleposspronoun}{his}
\newcommand*{\femaleposspronoun}{hers}
\newcommand*{\pluralposspronoun}{theirs}
\newcommand*{\malechild}{son}
\newcommand*{\femalechild}{daughter}
\newcommand*{\pluralchild}{children}
\newcommand*{\malechildren}{sons}
\newcommand*{\femalechildren}{daughters}
\newcommand*{\maleparent}{father}
\newcommand*{\femaleparent}{mother}
\newcommand*{\pluralparent}{parents}
\newcommand*{\malesibling}{brother}
\newcommand*{\femalesibling}{sister}
\newcommand*{\pluralsibling}{siblings}
\newcommand*{\malesiblings}{brothers}
\newcommand*{\femalesiblings}{sisters}
\providecommand*{\andname}{and}
\newcommand*{\malename}{male}
\newcommand*{\femalename}{female}
\newcommand*{\personsep}{, }
\newcommand*{\personlastsep}{\space\andname\space}
\newcommand*{\twopeoplesep}{\space\andname\space}
\newcommand*{\personfullname}[1][anon]{%
\@ifundefined{person@#1@fullname}%
{%
\PackageError{person}{Person `#1' has not been defined}{}%
}%
{%
\csname person@#1@fullname\endcsname
}%
}
\newcommand*{\peoplefullname}{%
\setcounter{person}{1}%
\@for\@thisperson:=\@people@list\do{%
\ifthenelse{\equal{\@thisperson}{}}%
{}%
{%
\personfullname[\@thisperson]%
\stepcounter{person}%
\ifnum\c@people=1\relax
\else
\ifnum\c@person=\c@people
\ifnum\c@people=2\relax
\twopeoplesep
\else
\personlastsep
\fi
\else
\ifnum\c@person<\c@people
\personsep
\fi
\fi
\fi
}%
}%
}
\newcommand*{\personname}[1][anon]{%
\@ifundefined{person@#1@name}%
{%
\PackageError{person}{Person `#1' has not been defined}{}%
}%
{%
\csname person@#1@name\endcsname
}%
}
\newcommand*{\peoplename}{%
\setcounter{person}{1}%
\@for\@thisperson:=\@people@list\do{%
\ifthenelse{\equal{\@thisperson}{}}%
{}%
{%
\personname[\@thisperson]%
\stepcounter{person}%
\ifnum\c@people=1\relax
\else
\ifnum\c@person=\c@people
\ifnum\c@people=2\relax
\twopeoplesep
\else
\personlastsep
\fi
\else
\ifnum\c@person<\c@people
\personsep
\fi
\fi
\fi
}%
}%
}
\newcommand*{\personpronoun}[1][anon]{%
\@ifundefined{person@#1@gender}%
{%
\PackageError{person}{Person `#1' has not been defined}{}%
}%
{%
\edef\@gender{\csname person@#1@gender\endcsname}%
\csname\@gender pronoun\endcsname
}%
}
\newcommand*{\Personpronoun}[1][anon]{%
\@ifundefined{person@#1@gender}%
{%
\PackageError{person}{Person `#1' has not been defined}{}%
}%
{%
\edef\@gender{\csname person@#1@gender\endcsname}%
\expandafter\expandafter\expandafter
\MakeUppercase\csname\@gender pronoun\endcsname
}%
}
\newcommand*{\peoplepronoun}{%
\ifnum\c@people>1\relax
\pluralpronoun
\else
\@get@firstperson{\@thisperson}%
\personpronoun[\@thisperson]%
\fi
}
\newcommand*{\Peoplepronoun}{%
\ifnum\c@people>1\relax
\expandafter\MakeUppercase\pluralpronoun
\else
\@get@firstperson{\@thisperson}%
\Personpronoun[\@thisperson]%
\fi
}
\newcommand*{\personobjpronoun}[1][anon]{%
\@ifundefined{person@#1@gender}%
{%
\PackageError{person}{Person `#1' has not been defined}{}%
}%
{%
\edef\@gender{\csname person@#1@gender\endcsname}%
\csname\@gender objpronoun\endcsname
}%
}
\newcommand*{\Personobjpronoun}[1][anon]{%
\@ifundefined{person@#1@gender}%
{%
\PackageError{person}{Person `#1' has not been defined}{}%
}%
{%
\edef\@gender{\csname person@#1@gender\endcsname}%
\expandafter\expandafter\expandafter
\MakeUppercase\csname\@gender objpronoun\endcsname
}%
}
\newcommand*{\peopleobjpronoun}{%
\ifnum\c@people>1\relax
\pluralobjpronoun
\else
\@get@firstperson{\@thisperson}%
\personobjpronoun[\@thisperson]%
\fi
}
\newcommand*{\Peopleobjpronoun}{%
\ifnum\c@people>1\relax
\expandafter\MakeUppercase\pluralobjpronoun
\else
\@get@firstperson{\@thisperson}%
\Personobjpronoun[\@thisperson]%
\fi
}
\newcommand*{\personpossadj}[1][anon]{%
\@ifundefined{person@#1@gender}%
{%
\PackageError{person}{Person `#1' has not been defined}{}%
}%
{%
\edef\@gender{\csname person@#1@gender\endcsname}%
\csname\@gender possadj\endcsname
}%
}
\newcommand*{\Personpossadj}[1][anon]{%
\@ifundefined{person@#1@gender}%
{%
\PackageError{person}{Person `#1' has not been defined}{}%
}%
{%
\edef\@gender{\csname person@#1@gender\endcsname}%
\expandafter\expandafter\expandafter
\MakeUppercase\csname\@gender possadj\endcsname
}%
}
\newcommand*{\peoplepossadj}{%
\ifnum\c@people>1\relax
\pluralpossadj
\else
\@get@firstperson{\@thisperson}%
\personpossadj[\@thisperson]%
\fi
}
\newcommand*{\Peoplepossadj}{%
\ifnum\c@people>1\relax
\expandafter\MakeUppercase\pluralpossadj
\else
\@get@firstperson{\@thisperson}%
\Personpossadj[\@thisperson]%
\fi
}
\newcommand*{\personposspronoun}[1][anon]{%
\@ifundefined{person@#1@gender}%
{%
\PackageError{person}{Person `#1' has not been defined}{}%
}%
{%
\edef\@gender{\csname person@#1@gender\endcsname}%
\csname\@gender posspronoun\endcsname
}%
}
\newcommand*{\Personposspronoun}[1][anon]{%
\@ifundefined{person@#1@gender}%
{%
\PackageError{person}{Person `#1' has not been defined}{}%
}%
{%
\edef\@gender{\csname person@#1@gender\endcsname}%
\expandafter\expandafter\expandafter
\MakeUppercase\csname\@gender posspronoun\endcsname
}%
}
\newcommand*{\peopleposspronoun}{%
\ifnum\c@people>1\relax
\pluralposspronoun
\else
\@get@firstperson{\@thisperson}%
\personposspronoun[\@thisperson]%
\fi
}
\newcommand*{\Peopleposspronoun}{%
\ifnum\c@people>1\relax
\expandafter\MakeUppercase\pluralposspronoun
\else
\@get@firstperson{\@thisperson}%
\Personposspronoun[\@thisperson]%
\fi
}
\newcommand*{\personchild}[1][anon]{%
\@ifundefined{person@#1@gender}%
{%
\PackageError{person}{Person `#1' has not been defined}{}%
}%
{%
\edef\@gender{\csname person@#1@gender\endcsname}%
\csname\@gender child\endcsname
}%
}
\newcommand*{\Personchild}[1][anon]{%
\@ifundefined{person@#1@gender}%
{%
\PackageError{person}{Person `#1' has not been defined}{}%
}%
{%
\edef\@gender{\csname person@#1@gender\endcsname}%
\expandafter\expandafter\expandafter\MakeUppercase
\csname\@gender child\endcsname
}%
}
\newcommand*{\peoplechild}{%
\ifnum\c@people>1\relax
\ifallmale
{\malechildren}%
{\ifallfemale{\femalechildren}{\pluralchild}}%
\else
\@get@firstperson{\@thisperson}%
\personchild[\@thisperson]%
\fi
}
\newcommand*{\Peoplechild}{%
\ifnum\c@people>1\relax
\ifallmale
{\expandafter\MakeUppercase\malechildren}%
{\ifallfemale
{\expandafter\MakeUppercase\femalechildren}
{\expandafter\MakeUppercase\pluralchild}}%
\else
\@get@firstperson{\@thisperson}%
\Personchild[\@thisperson]%
\fi
}
\newcommand*{\personparent}[1][anon]{%
\@ifundefined{person@#1@gender}%
{%
\PackageError{person}{Person `#1' has not been defined}{}%
}%
{%
\edef\@gender{\csname person@#1@gender\endcsname}%
\csname\@gender parent\endcsname
}%
}
\newcommand*{\Personparent}[1][anon]{%
\@ifundefined{person@#1@gender}%
{%
\PackageError{person}{Person `#1' has not been defined}{}%
}%
{%
\edef\@gender{\csname person@#1@gender\endcsname}%
\expandafter\expandafter\expandafter\MakeUppercase
\csname\@gender parent\endcsname
}%
}
\newcommand*{\peopleparent}{%
\ifnum\c@people>1\relax
\pluralparent
\else
\@get@firstperson{\@thisperson}%
\personparent[\@thisperson]%
\fi
}
\newcommand*{\Peopleparent}{%
\ifnum\c@people>1\relax
\expandafter\MakeUppercase\pluralparent
\else
\@get@firstperson{\@thisperson}%
\Personparent[\@thisperson]%
\fi
}
\newcommand*{\personsibling}[1][anon]{%
\@ifundefined{person@#1@gender}%
{%
\PackageError{person}{Person `#1' has not been defined}{}%
}%
{%
\edef\@gender{\csname person@#1@gender\endcsname}%
\csname\@gender sibling\endcsname
}%
}
\newcommand*{\Personsibling}[1][anon]{%
\@ifundefined{person@#1@gender}%
{%
\PackageError{person}{Person `#1' has not been defined}{}%
}%
{%
\edef\@gender{\csname person@#1@gender\endcsname}%
\expandafter\expandafter\expandafter\MakeUppercase
\csname\@gender sibling\endcsname
}%
}
\newcommand*{\peoplesibling}{%
\ifnum\c@people>1\relax
\ifallmale
{\malesiblings}%
{\ifallfemale{\femalesiblings}{\pluralsibling}}%
\else
\@get@firstperson{\@thisperson}%
\personsibling[\@thisperson]%
\fi
}
\newcommand*{\persongender}[1]{%
\ifpersonmale{#1}{\malename}{\femalename}%
}
\newcommand*{\getpersongender}[2]{%
\ifpersonmale{#2}{\let#1\malename}{\let#1\femalename}%
}
\newcommand*{\getpersonname}[2]{%
\ifpersonexists{#2}%
{%
\expandafter\let\expandafter#1\csname person@#2@name\endcsname
}%
{%
\PackageError{person}{Person `#2' doesn't exist}{}%
}%
}
\newcommand*{\getpersonfullname}[2]{%
\ifpersonexists{#2}%
{%
\expandafter
\let\expandafter#1\csname person@#2@fullname\endcsname
}%
{%
\PackageError{person}{Person `#2' doesn't exist}{}%
}%
}
\endinput
%%
%% End of file `person.sty'.