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.tex187
1 files changed, 114 insertions, 73 deletions
diff --git a/Master/texmf-dist/doc/latex/nameauth/examples.tex b/Master/texmf-dist/doc/latex/nameauth/examples.tex
index f469316175f..85c62eb98f1 100644
--- a/Master/texmf-dist/doc/latex/nameauth/examples.tex
+++ b/Master/texmf-dist/doc/latex/nameauth/examples.tex
@@ -4,25 +4,23 @@
%% This is an example file used with the nameauth package.
%% See README and nameauth.pdf for copyright info.
%%
+\section*{Test for Latex Engine}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Test which LaTeX engine you are using
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%
-\section*{Test for Latex Engine}
\begin{verbatim}
\usepackage{ifxetex}
\usepackage{ifluatex}
-
-\ifxetex% uses fontspec
- \usepackage{fontspec}
+\ifxetex% uses fontspec
+ \usepackage{fontspec}% check package docs
\defaultfontfeatures{Mapping=tex-text}
- \usepackage{xunicode}
- \usepackage{xltxtra}
+ \usepackage{xunicode}% check if outmoded
+ \usepackage{xltxtra}% check if outmoded
\else
- \ifluatex% also uses fontspec
- \usepackage{fontspec}
+ \ifluatex% also uses fontspec
+ \usepackage{fontspec}% check package docs
\defaultfontfeatures{Ligatures=TeX}
- \else% traditional NFSS
+ \else% traditional NFSS
\usepackage[utf8]{inputenc}
\usepackage[TS1,T1]{fontenc}
\fi
@@ -37,13 +35,22 @@
%%
%% This macro is suitable to replace \NamesFormat and \FrontNamesFormat.
%%
-\section*{First Use in Margin}
+\section*{First Use in Margin: $\epsilon$-\TeX}
\begin{verbatim}
\renewcommand*\NamesFormat[1]%
{%
#1%
- \ifinner
- \else
+ \unless\ifinner
+ \marginpar{\raggedleft\scriptsize #1}%
+ \fi
+}
+\end{verbatim}
+\section*{First Use in Margin: Historic \TeX}
+\begin{verbatim}
+\renewcommand*\NamesFormat[1]%
+{%
+ #1%
+ \ifinner\else
\marginpar{\raggedleft\scriptsize #1}%
\fi
}
@@ -58,103 +65,135 @@
%%
%% This macro is suitable to replace \NamesFormat and \FrontNamesFormat.
%%
-\section*{Text Tag With First Use}
+\section*{Text Tag With First Use: $\epsilon$-\TeX}
\begin{verbatim}
-\newif\ifNoTextTag
+\newif\ifNoTag
\makeatletter
-\renewcommand*\NamesFormat[1]%
-{%
+\renewcommand*\NamesFormat[1]{\begingroup%
+ \protected@edef\temp{\endgroup\textbf{#1}%
+ \unless\ifNoTag
+ \if@nameauth@InName
+ {\bfseries\noexpand\NameQueryInfo
+ [\unexpanded\expandafter{\the\@nameauth@toksa}]
+ {\unexpanded\expandafter{\the\@nameauth@toksb}}
+ [\unexpanded\expandafter{\the\@nameauth@toksc}]}\fi
+ \if@nameauth@InAKA
+ \noexpand\NameQueryInfo
+ [\unexpanded\expandafter{\the\@nameauth@toksa}]
+ {\unexpanded\expandafter{\the\@nameauth@toksb}}
+ [\unexpanded\expandafter{\the\@nameauth@toksc}]\fi
+ \fi}\temp\global\NoTagfalse}
+\makeatother
+\end{verbatim}
+\section*{Text Tag With First Use: Historic \TeX}
+\begin{verbatim}
+\newif\ifNoTag
+\makeatletter
+\renewcommand*\NamesFormat[1]{%
\let\ex\expandafter%
#1%
\if@nameauth@InName
- \ifNoTextTag
+ \ifNoTag
\else
\ex\ex\ex\ex\ex\ex\ex\NameQueryInfo\ex\ex\ex\ex\ex\ex\ex[%
\ex\ex\ex\the\ex\ex\ex\@nameauth@toksa\ex\ex\ex]%
\ex\ex\ex{\ex\the\ex\@nameauth@toksb\ex}\ex[\the\@nameauth@toksc]%
- \fi
- \fi
+ \fi\fi
\if@nameauth@InAKA
- \ifNoTextTag
+ \ifNoTag
\else
\ex\ex\ex\ex\ex\ex\ex\NameQueryInfo\ex\ex\ex\ex\ex\ex\ex[%
\ex\ex\ex\the\ex\ex\ex\@nameauth@toksa\ex\ex\ex]%
\ex\ex\ex{\ex\the\ex\@nameauth@toksb\ex}\ex[\the\@nameauth@toksc]%
- \fi
- \fi
- \global\NoTextTagfalse%
-}
+ \fi\fi
+ \global\NoTagfalse}
\makeatother
\end{verbatim}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% Surname index entries in small caps
-%% First surname instances in text are small caps
+%% Surname index entries in an fbox
+%% First surname instances in text are in an fbox
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
-%% 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.
+%% We create a macro \Fbox that prints its argument in a framed
+%% box when \@nameauth@DoAlt is true, or it just prints its 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}
+\section*{Formatting and Capping: New Style}
\begin{verbatim}
\makeatletter
-
-\newif\ifSC
-\SCtrue
-
-\def\DoFormat#1{%
- \ifSC
- \textsc{#1}%
- \else
- #1%
- \fi
+\newcommand*\Fbox[1]{%
+ \if@nameauth@DoAlt
+ \fbox{#1}\else#1\fi
}
+\makeatother
+
+\renewcommand*\MainNameHook[1]{\NameOnly\NameParser}
-\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
+%% Use both the arguments passed to the hooks
+%% and \NameParser under different conditions
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%
+%% We redefine the hooks to print a name in the text and in
+%% a margin paragraph. We change some of the internal flags
+%% to make \NameParser print the name differently.
+%%
+%%
+\section*{Putting \texttt{\textbackslash NameParser} on Display}
+\begin{verbatim}
+\makeatletter
+\renewcommand*\NamesFormat[1]{%
+ #1\unless\ifinner
+ \marginpar{\small\raggedleft%
+ \@nameauth@FullNametrue%
+ \@nameauth@FirstNamefalse%
+ \@nameauth@EastFNfalse%
+ \NameParser}%
+ \fi}
+\renewcommand*\MainNameHook[1]{%
+ \AltOff#1\unless\ifinner
+ \marginpar{\small\raggedleft%
+ \@nameauth@FullNamefalse%
+ \@nameauth@FirstNamefalse%
+ \@nameauth@EastFNfalse%
+ \NameParser}%
+ \fi}
+\makeatother
+\end{verbatim}
+\clearpage
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Surname index entries in an fbox
+%% First surname instances in text are in an fbox
+%% We can 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.
+%% Below we create a Boolean value \ifFbox and set it true.
+%% This will trigger an fbox
%%
-%% We then create a macro \DoFormat that prints its argument in
-%% italic when \ifItal is true, or makes no font change otherwise.
+%% We then create a macro \Fbox that prints its argument in
+%% an fbox when \ifFbox is true, or makes no change otherwise.
%%
-%% The \CP macro only capitalizies its argument inside \NamesFormat below.
+%% The \AltCap macro only capitalizies its argument inside the formatting
+%% hook \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}
+\section*{Formatting and Capping: Old Style}
\begin{verbatim}
-\newif\ifItal
+\newif\ifFbox
\newif\ifFirstCap
\newif\ifInHook
-\Italtrue
+\Fboxtrue
-\def\DoFormat#1{%
- \ifItal\textit{#1}\else#1\fi
+\renewcommand*\Fbox[1]{%
+ \ifFbox\fbox{#1}\else#1\fi
}
-\def\CP#1{%
+
+\renewcommand*\AltCap[1]{%
\ifInHook
\ifFirstCap\uppercase{#1}\else#1\fi
\else
@@ -162,19 +201,21 @@
\fi
}
-\newcommand*\CapMe{\FirstCaptrue}
-\makeatletter%
+\renewcommand\CapThis{\FirstCaptrue}
+
\renewcommand*\NamesFormat[1]
{%
\InHooktrue\NameParser\InHookfalse%
\global\FirstCapfalse%
}
+
\renewcommand*\MainNameHook[1]
{%
- \Italfalse\InHooktrue\NameParser\InHookfalse%
- \global\FirstCapfalse\Italtrue%
+ \Fboxfalse\InHooktrue\NameParser\InHookfalse%
+ \global\FirstCapfalse\Fboxtrue%
}
+
\let\FrontNamesFormat\Namesformat
\let\FrontNameHook\MainNameHook
\end{verbatim}
-\end{document}
+\end{document} \ No newline at end of file