summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/nameauth/examples.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex/nameauth/examples.tex')
-rw-r--r--Master/texmf-dist/doc/latex/nameauth/examples.tex372
1 files changed, 89 insertions, 283 deletions
diff --git a/Master/texmf-dist/doc/latex/nameauth/examples.tex b/Master/texmf-dist/doc/latex/nameauth/examples.tex
index 00eaadd2635..f469316175f 100644
--- a/Master/texmf-dist/doc/latex/nameauth/examples.tex
+++ b/Master/texmf-dist/doc/latex/nameauth/examples.tex
@@ -1,11 +1,15 @@
-% This is an example file used with the nameauth package.
-% See README and nameauth.pdf for copyright info.
-%
+\documentclass{article}
+\usepackage{verbatim}
+\begin{document}
+%% This is an example file used with the nameauth package.
+%% See README and nameauth.pdf for copyright info.
+%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Test which LaTeX engine you are using
+%% Test which LaTeX engine you are using
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-
+%%
+\section*{Test for Latex Engine}
+\begin{verbatim}
\usepackage{ifxetex}
\usepackage{ifluatex}
@@ -23,17 +27,18 @@
\usepackage[TS1,T1]{fontenc}
\fi
\fi
-
+\end{verbatim}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Print the first use of a name in text and margin
+%% Print the first use of a name in text and margin
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% Below we print the argument both in the text and in a margin paragraph
-% unless we are in internal vertical mode.
-%
-% This macro is suitable to replace \NamesFormat and \FrontNamesFormat.
-%
-
+%%
+%% Below we print the argument both in the text and in a margin paragraph
+%% unless we are in internal vertical mode.
+%%
+%% This macro is suitable to replace \NamesFormat and \FrontNamesFormat.
+%%
+\section*{First Use in Margin}
+\begin{verbatim}
\renewcommand*\NamesFormat[1]%
{%
#1%
@@ -42,17 +47,19 @@
\marginpar{\raggedleft\scriptsize #1}%
\fi
}
-
+\end{verbatim}
+\clearpage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Print a text tag after first name use
+%% Print a text tag after first name use
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% Below we print the argument in the text and then we query the text tag
-% database to see if we can print a text tag after the argument.
-%
-% This macro is suitable to replace \NamesFormat and \FrontNamesFormat.
-%
-
+%%
+%% Below we print the argument in the text and then we query the text tag
+%% database to see if we can print a text tag after the argument.
+%%
+%% This macro is suitable to replace \NamesFormat and \FrontNamesFormat.
+%%
+\section*{Text Tag With First Use}
+\begin{verbatim}
\newif\ifNoTextTag
\makeatletter
\renewcommand*\NamesFormat[1]%
@@ -78,27 +85,27 @@
\global\NoTextTagfalse%
}
\makeatother
-
+\end{verbatim}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Surname index entries in small caps
-% First surname instances in text are small caps
+%% Surname index entries in small caps
+%% First surname instances in text are small caps
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% Below we create a Boolean value \ifSC and set it true. That means
-% the surnames in the index will be in small caps.
-%
-% We then create a macro \DoFormat that prints its argument in
-% small caps if \ifSC is true, or makes no font change
-% and prints the the argument.
-%
-% \MainNameHook ignores its argument, sets \SCfalse to suppress
-% small caps in the text only, then uses control sequences and
-% token registers internal to the naming macros to parse and
-% print the current name values without any formatting.
-%
-% The hook macro can replace both \MainNameHook and \FrontNameHook.
-%
-
+%%
+%% Below we create a Boolean value \ifSC and set it true. That means
+%% the surnames in the index will be in small caps.
+%%
+%% We then create a macro \DoFormat that prints its argument in
+%% small caps if \ifSC is true, or makes no font change
+%% and prints the the argument.
+%%
+%% \MainNameHook ignores its argument, sets \SCfalse to suppress
+%% small caps in the text only, then calls the name parser used
+%% specifically in formatting hooks.
+%%
+%% The hook macro can replace both \MainNameHook and \FrontNameHook.
+%%
+\section*{Continental Small Caps}
+\begin{verbatim}
\makeatletter
\newif\ifSC
@@ -112,139 +119,33 @@
\fi
}
-\renewcommand*\MainNameHook[1]{%
- \let\ex\expandafter%
- \SCfalse%
- \protected@edef\arga{\ex\trim@spaces\ex{\the\@nameauth@toksa}}%
- \protected@edef\argb{\ex\trim@spaces\ex{\the\@nameauth@toksb}}%
- \protected@edef\testb{\ex\@nameauth@Root\ex{\the\@nameauth@toksb}}%
- \protected@edef\argc{\ex\trim@spaces\ex{\the\@nameauth@toksc}}%
- \ifx\argb\testb
- \protected@edef\Suff{\@empty}%
- \let\Reversed\argb%
- \let\SNN\argb%
- \let\Short\argb%
- \else
- \protected@edef\Suff{\ex\@nameauth@Suffix\ex{\the\@nameauth@toksb}}%
- \protected@edef\Reversed{\Suff\Space\testb}%
- \protected@edef\SNN{\testb\Space\Suff}%
- \if@nameauth@RevThis
- \let\Short\Suff%
- \else
- \let\Short\testb%
- \fi
- \fi
- \if@nameauth@InAKA
- \ifx\arga\@empty
- \ifx\argc\@empty
- \if@nameauth@RevThis
- \Reversed%
- \else
- \SNN%
- \fi
- \else
- \if@nameauth@AltAKA
- \argc%
- \else
- \if@nameauth@RevThis
- \ex\argc\ex\space\SNN%
- \else
- \ex\SNN\ex\space\argc%
- \fi
- \fi
- \fi
- \else
- \ifx\argc\@empty
- \let\FNN\arga%
- \else
- \let\FNN\argc%
- \fi
- \if@nameauth@AltAKA
- \FNN%
- \else
- \if@nameauth@RevThis
- \ex\SNN\ex\Space\FNN%
- \else
- \ex\FNN\ex\space\SNN%
- \fi
- \fi
- \fi
- \else
- \ifx\arga\@empty
- \ifx\argc\@empty
- \if@nameauth@FullName
- \if@nameauth@RevThis
- \Reversed%
- \else
- \SNN%
- \fi
- \else
- \Short%
- \fi
- \else
- \if@nameauth@FullName
- \if@nameauth@RevThis
- \ex\argc\ex\space\SNN%
- \else
- \ex\SNN\ex\space\argc%
- \fi
- \else
- \if@nameauth@RevThis
- \argc%
- \else
- \Short%
- \fi
- \fi
- \fi
- \else
- \ifx\argc\@empty
- \let\FNN\arga%
- \else
- \let\FNN\argc%
- \fi
- \let\Short\FNN%
- \if@nameauth@FullName
- \if@nameauth@RevThis
- \ex\SNN\ex\Space\FNN%
- \else
- \ex\FNN\ex\space\SNN%
- \fi
- \else
- \if@nameauth@FirstName
- \Short%
- \else
- \testb%
- \fi
- \fi
- \fi
- \fi
-}
-\makeatother
-
+\renewcommand*\MainNameHook[1]{\SCfalse\NameParser}
+\let\FrontNameHook\MainNameHook
+\end{verbatim}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Surname index entries in talic
-% First surname instances in text are italic
-% Capitalize name within that formatting
+%% Surname index entries in talic
+%% First surname instances in text are italic
+%% Capitalize name within that formatting
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% Below we create a Boolean value \ifItal and set it true.
-% This will trigger italics, similar to the Continental
-% example above.
-%
-% We then create a macro \DoFormat that prints its argument in
-% italic when \ifItal is true, or makes no font change otherwise.
-%
-% The \CP macro only capitalizies its argument inside \NamesFormat below.
-%
-% \Namesformat ignores its argument, sets \InHooktrue, then
-% uses control sequences internal to the naming macros to
-% parse and print the current name values with formatting.
-%
-% The hook macro is suitable to replace \NamesFormat and \FrontNamesFormat.
-% To replace \MainNameHook and \FrontNameHook, wrap the hook macro
-% between \Italfalse and \italtrue for first-only italic.
-%
-
+%%
+%% Below we create a Boolean value \ifItal and set it true.
+%% This will trigger italics, similar to the Continental
+%% example above.
+%%
+%% We then create a macro \DoFormat that prints its argument in
+%% italic when \ifItal is true, or makes no font change otherwise.
+%%
+%% The \CP macro only capitalizies its argument inside \NamesFormat below.
+%%
+%% \Namesformat ignores its argument, sets \InHooktrue, then
+%% calls the name parser used specifically in formatting hooks.
+%%
+%% The hook macro is suitable to replace \NamesFormat and \FrontNamesFormat.
+%% To replace \MainNameHook and \FrontNameHook, wrap the hook macro
+%% between \Italfalse and \italtrue for first-only italic.
+%%
+\section*{Formatting and Capping}
+\begin{verbatim}
\newif\ifItal
\newif\ifFirstCap
\newif\ifInHook
@@ -255,7 +156,7 @@
}
\def\CP#1{%
\ifInHook
- \ifFirstCap\uppercase{#1}\else#1\fi%
+ \ifFirstCap\uppercase{#1}\else#1\fi
\else
#1%
\fi
@@ -263,112 +164,17 @@
\newcommand*\CapMe{\FirstCaptrue}
\makeatletter%
-\renewcommand*\NamesFormat[1]{\ignorespaces%
- \let\ex\expandafter\ignorespaces%
- \InHooktrue\ignorespaces%
- \protected@edef\arga{\ex\trim@spaces\ex{\the\@nameauth@toksa}}\ignorespaces%
- \protected@edef\argb{\ex\trim@spaces\ex{\the\@nameauth@toksb}}\ignorespaces%
- \protected@edef\testb{\ex\@nameauth@Root\ex{\the\@nameauth@toksb}}\ignorespaces%
- \protected@edef\argc{\ex\trim@spaces\ex{\the\@nameauth@toksc}}\ignorespaces%
- \ifx\argb\testb
- \protected@edef\Suff{\@empty}\ignorespaces%
- \let\Reversed\argb\ignorespaces%
- \let\SNN\argb\ignorespaces%
- \let\Short\argb\ignorespaces%
- \else
- \protected@edef\Suff{\ex\@nameauth@Suffix\ex{\the\@nameauth@toksb}}\ignorespaces%
- \protected@edef\Reversed{\Suff\Space\testb}\ignorespaces%
- \protected@edef\SNN{\testb\Space\Suff}\ignorespaces%
- \if@nameauth@RevThis
- \let\Short\Suff%
- \else
- \let\Short\testb%
- \fi
- \fi
- \if@nameauth@InAKA
- \ifx\arga\@empty
- \ifx\argc\@empty
- \if@nameauth@RevThis
- \Reversed%
- \else
- \SNN%
- \fi
- \else
- \if@nameauth@AltAKA
- \argc%
- \else
- \if@nameauth@RevThis
- \ex\argc\ex\space\SNN%
- \else
- \ex\SNN\ex\space\argc%
- \fi
- \fi
- \fi
- \else
- \ifx\argc\@empty
- \let\FNN\arga%
- \else
- \let\FNN\argc%
- \fi
- \if@nameauth@AltAKA
- \FNN%
- \else
- \if@nameauth@RevThis
- \ex\SNN\ex\Space\FNN%
- \else
- \ex\FNN\ex\space\SNN%
- \fi
- \fi
- \fi
- \else
- \ifx\arga\@empty
- \ifx\argc\@empty
- \if@nameauth@FullName
- \if@nameauth@RevThis
- \Reversed%
- \else
- \SNN%
- \fi
- \else
- \Short%
- \fi
- \else
- \if@nameauth@FullName
- \if@nameauth@RevThis
- \ex\argc\ex\space\SNN%
- \else
- \ex\SNN\ex\space\argc%
- \fi
- \else
- \if@nameauth@RevThis
- \argc%
- \else
- \Short%
- \fi
- \fi
- \fi
- \else
- \ifx\argc\@empty
- \let\FNN\arga%
- \else
- \let\FNN\argc%
- \fi
- \let\Short\FNN%
- \if@nameauth@FullName
- \if@nameauth@RevThis
- \ex\SNN\ex\Space\FNN%
- \else
- \ex\FNN\ex\space\SNN%
- \fi
- \else
- \if@nameauth@FirstName
- \Short%
- \else
- \testb%
- \fi
- \fi
- \fi
- \fi
- \InHookfalse%
+\renewcommand*\NamesFormat[1]
+{%
+ \InHooktrue\NameParser\InHookfalse%
\global\FirstCapfalse%
-} \ No newline at end of file
+}
+\renewcommand*\MainNameHook[1]
+{%
+ \Italfalse\InHooktrue\NameParser\InHookfalse%
+ \global\FirstCapfalse\Italtrue%
+}
+\let\FrontNamesFormat\Namesformat
+\let\FrontNameHook\MainNameHook
+\end{verbatim}
+\end{document}