diff options
author | Karl Berry <karl@freefriends.org> | 2016-09-22 21:36:19 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-09-22 21:36:19 +0000 |
commit | 2313916fd74b79a0160ff9b73de3fbacfbe0595c (patch) | |
tree | 2c1818f2b610b0dd23785e502338d1b102895793 /Master/texmf-dist/doc/latex/nameauth/examples.tex | |
parent | 125dfec8232c7f0852f569df6ce000ff87c1056b (diff) |
nameauth (22sep16)
git-svn-id: svn://tug.org/texlive/trunk@42128 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/nameauth/examples.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/nameauth/examples.tex | 215 |
1 files changed, 205 insertions, 10 deletions
diff --git a/Master/texmf-dist/doc/latex/nameauth/examples.tex b/Master/texmf-dist/doc/latex/nameauth/examples.tex index 5719834e614..00eaadd2635 100644 --- a/Master/texmf-dist/doc/latex/nameauth/examples.tex +++ b/Master/texmf-dist/doc/latex/nameauth/examples.tex @@ -1,11 +1,39 @@ % 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 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% + +\usepackage{ifxetex} +\usepackage{ifluatex} + +\ifxetex% uses fontspec + \usepackage{fontspec} + \defaultfontfeatures{Mapping=tex-text} + \usepackage{xunicode} + \usepackage{xltxtra} +\else + \ifluatex% also uses fontspec + \usepackage{fontspec} + \defaultfontfeatures{Ligatures=TeX} + \else% traditional NFSS + \usepackage[utf8]{inputenc} + \usepackage[TS1,T1]{fontenc} + \fi +\fi + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% 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. % + \renewcommand*\NamesFormat[1]% {% #1% @@ -14,12 +42,17 @@ \marginpar{\raggedleft\scriptsize #1}% \fi } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% 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. % + \newif\ifNoTextTag \makeatletter \renewcommand*\NamesFormat[1]% @@ -45,22 +78,32 @@ \global\NoTextTagfalse% } \makeatother + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% 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. +% 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 a Boolean value is true, or makes no font change -% and prints the the argument of the value is false. +% small caps if \ifSC is true, or makes no font change +% and prints the the argument. % -% The next macro ignores its argument, sets \SCfalse, then -% uses some control sequences internal to the naming macros to -% parse and print the current name values without any formatting. +% \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 final macro is suitable to replace \MainNameHook and \FrontNameHook. +% The hook macro can replace both \MainNameHook and \FrontNameHook. % + \makeatletter + \newif\ifSC \SCtrue + \def\DoFormat#1{% \ifSC \textsc{#1}% @@ -68,9 +111,10 @@ #1% \fi } -\newcommand*\MainNameHook[1]{% + +\renewcommand*\MainNameHook[1]{% \let\ex\expandafter% - \SCfalse\ignorespaces% + \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}}% @@ -103,7 +147,7 @@ \argc% \else \if@nameauth@RevThis - \ex\argc\ex\Space\SNN% + \ex\argc\ex\space\SNN% \else \ex\SNN\ex\space\argc% \fi @@ -177,3 +221,154 @@ } \makeatother +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% 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. +% + +\newif\ifItal +\newif\ifFirstCap +\newif\ifInHook +\Italtrue + +\def\DoFormat#1{% + \ifItal\textit{#1}\else#1\fi +} +\def\CP#1{% + \ifInHook + \ifFirstCap\uppercase{#1}\else#1\fi% + \else + #1% + \fi +} + +\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% + \global\FirstCapfalse% +}
\ No newline at end of file |