diff options
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/nameauth/nameauth.dtx | 268 |
1 files changed, 162 insertions, 106 deletions
diff --git a/Master/texmf-dist/source/latex/nameauth/nameauth.dtx b/Master/texmf-dist/source/latex/nameauth/nameauth.dtx index 34f9c1e2786..b3def071436 100644 --- a/Master/texmf-dist/source/latex/nameauth/nameauth.dtx +++ b/Master/texmf-dist/source/latex/nameauth/nameauth.dtx @@ -168,14 +168,14 @@ Running "make install" installs the files in the local TeX tree. %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{nameauth} %<*package> - [2015/11/11 v2.0 Name authority mechanism for consistency in text and index] + [2015/11/24 v2.1 Name authority mechanism for consistency in text and index] %</package> %<*driver> \documentclass[11pt]{ltxdoc} \usepackage[textwidth=135mm,textheight=237mm,right=25mm,nohead]{geometry} \usepackage[numbered]{hypdoc} \usepackage{\jobname} -\usepackage[american]{babel} +\usepackage[ngerman,american]{babel} \usepackage{makeidx} \usepackage{multicol} \usepackage[toc]{multitoc} @@ -321,10 +321,10 @@ Running "make install" installs the files in the local TeX tree. \TagName{Voltaire}{|hyperpage} \TagName{Yohko}{|hyperpage} \TagName[Johann]{Andreä}{|hyperpage} -\PretagName{{Æ}thelred, II}{Aethelred 2} -\TagName{{Æ}thelred, II}{, king|hyperpage} -\PretagName[Jan]{{Ł}ukasiewicz}{Lukasiewicz, Jan} -\TagName[Jan]{{Ł}ukasiewicz}{|hyperpage} +\PretagName{Æthelred, II}{Aethelred 2} +\TagName{Æthelred, II}{, king|hyperpage} +\PretagName[Jan]{Łukasiewicz}{Lukasiewicz, Jan} +\TagName[Jan]{Łukasiewicz}{|hyperpage} \PretagName{Vlad, Ţepeş}{Vlad Tepes} \TagName[Patrick]{Cousot}{|hyperpage} \IndexActual{=} @@ -334,7 +334,7 @@ Running "make install" installs the files in the local TeX tree. %</driver> % \fi % -% \CheckSum{2651} +% \CheckSum{2691} % % \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 @@ -369,9 +369,10 @@ Running "make install" installs the files in the local TeX tree. % \changes{v1.8}{2013/09/19}{Update docs} % \changes{v1.9}{2015/07/09}{Better Eastern name support; fix |nameauth| bugs, global un-tagging} % \changes{v2.0}{2015/11/11}{Use dtxgen template instead of dtxtut; update docs} +% \changes{v2.1}{2015/11/24}{Isolate Unicode issues} % \GetFileInfo{\jobname.dtx} % \DoNotIndex{\@empty, \@gobble, \@period, \@token, \trim@spaces, \zap@space} -% \DoNotIndex{\begingroup, \bfseries, \bgroup, \csdef, \csgdef, \csgdef, \csname, \csundef, \DeclareOption, \def, \detokenize, \edef, \egroup, \else, \endcsname, \endgroup, \endinput, \ExecuteOptions, \expandafter, \fi, \futurelet, \global, \hbox, \if, \ifcsname, \ifx, \ignorespaces, \index, \itshape, \leavevmode, \let, \newcommand, \newcommandx, \newenvironment, \newif, \nobreakspace, \PackageError, \PackageWarning, \ProcessOptions, \relax, \renewcommand, \RequirePackage, \scshape, \space, \textbackslash, \uppercase} +% \DoNotIndex{\begingroup, \bfseries, \bgroup, \csdef, \csgdef, \csgdef, \csname, \csundef, \DeclareOption, \def, \detokenize, \edef, \egroup, \else, \endcsname, \endgroup, \endinput, \ExecuteOptions, \expandafter, \fi, \foo, \futurelet, \global, \hbox, \if, \ifcsname, \ifx, \ignorespaces, \index, \itshape, \leavevmode, \let, \newcommand, \newcommandx, \newenvironment, \newif, \nobreakspace, \PackageError, \PackageWarning, \ProcessOptions, \relax, \renewcommand, \RequirePackage, \scshape, \space, \textbackslash, \uppercase} % %\title{\textsf{nameauth} --- Name authority mechanism for consistency in text and index\thanks{This file % describes version \fileversion, last revised \filedate.} @@ -416,7 +417,7 @@ Running "make install" installs the files in the local TeX tree. % % This manual performs something of a ``torture test'' on this package. You might want to avoid doing that. % -% This package depends on \textsf{etoolbox}, \textsf{suffix}, \textsf{trimspaces}, and \textsf{xargs}. It has been tested with \texttt{latex,} \texttt{lualatex,} \texttt{pdflatex,} and \texttt{xelatex.} It will work with \texttt{makeindex} and \texttt{texindy.} This documentation was typeset with \ifxetex\texttt{xelatex}\else\ifluatex\ifpdf\texttt{lualatex} in \texttt{pdf} mode\else\texttt{lualatex} in \texttt{dvi} mode\fi\else\ifpdf\texttt{pdflatex}\else\texttt{latex}\fi\fi\fi{} and \texttt{makeindex.} +% This package depends on \textsf{etoolbox}, \textsf{ifxetex}, \textsf{ifluatex}, \textsf{suffix}, \textsf{trimspaces}, and \textsf{xargs}. It has been tested with \texttt{latex,} \texttt{lualatex,} \texttt{pdflatex,} and \texttt{xelatex.} It will work with \texttt{makeindex} and \texttt{texindy.} This documentation was typeset with \ifxetex\texttt{xelatex}\else\ifluatex\ifpdf\texttt{lualatex} in \texttt{pdf} mode\else\texttt{lualatex} in \texttt{dvi} mode\fi\else\ifpdf\texttt{pdflatex}\else\texttt{latex}\fi\fi\fi{} and \texttt{makeindex.} % % Indexing generally conforms to the standard in Nancy C. Mulvany, \emph{Indexing Books} (Chicago: University of Chicago Press, 1994). This should be suitable for a very wide application across a number of disciplines. % \end{quote} @@ -759,8 +760,8 @@ Running "make install" installs the files in the local TeX tree. % \node [matrix,column sep=1em] (tipsi) at (2,2) % { % \node(opt){\quad\small Add to force full name.}; & -% \node[text width=3cm,align=left](a1){\small Mononym\hfil\break Mononym, Affix}; & -% \node[text width=3.5cm,align=left](grp){\small Add only if text in brackets |[ ]| follows.}; \\ +% \node[text width=2.6cm,align=left](a1){\small Mononym\hfil\break Mononym, Affix}; & +% \node[text width=3.3cm,align=left](grp){\small Add only if text in brackets |[ ]| follows.}; \\ % }; % \node [matrix] (macro) at (1,1) % { @@ -1148,6 +1149,24 @@ Running "make install" installs the files in the local TeX tree. % % \subsection{Other Naming Topics} % +% \subsubsection{Fault Tolerance} +% +% Especially since version 2.0, the \textsf{nameauth} package tries to prevent malformed input from creating side effects. For example, the malformed |\Name[Henry]{VIII}| and the well-formed |\Name{Henry}[VIII]| used to create the same control sequence and thus affect each other. That no longer happens. Furthermore, we guard against empty required values being passed to naming macros. +% +% To reduce errors, \cmd{\Name}, \cmd{\FName}, \cmd{\AKA}, and \cmd{\IndexName} ignore leading and trailing spaces\,---\,but not medial spaces\,---\,making the following equivalent: +% +% \begin{quote}\small\ForgetName[Martin Luther]{King, Jr.} +% \begin{tabular}{ll} +% \textit{Macro Example} & \textit{Resulting text}\\ +% |\Name*[ Martin Luther]{King, Jr.}| & \Name*[ Martin Luther]{King, Jr.}\\ +% |\Name*[Martin Luther ]{King, Jr.}| & \Name*[Martin Luther ]{King, Jr.}\\ +% |\Name*[ Martin Luther ]{King, Jr.}| & \Name*[ Martin Luther ]{King, Jr.}\\ +% |\Name*[Martin Luther]{ King, Jr.}| & \Name*[Martin Luther]{ King, Jr.}\\ +% |\Name*[Martin Luther]{King, Jr. }| & \Name*[Martin Luther]{King, Jr. }\\ +% |\Name*[Martin Luther]{ King, Jr. }| & \Name*[Martin Luther]{ King, Jr. }\\ +% \end{tabular} +% \end{quote} +% % \subsubsection{Listing by Surname} % \label{sec:LastFirst} % @@ -1170,31 +1189,16 @@ Running "make install" installs the files in the local TeX tree. % % \subsubsection{Naming Standards} % -% \DescribeMacro{\CapThis} % According to the \emph{Chicago Manual of Style}, English names with the particles \emph{de}, \emph{de\ la}, \emph{d'}, \emph{von}, \emph{van}, and \emph{ten} generally keep them with the last name, using varied capitalization. \emph{Le}, \emph{La}, and \emph{L'} always are capitalized unless preceded by \emph{de}. % -% In English, these particles go in the \meta{SNN} field of \cmd{\Name}, \emph{e.g.}, \ForgetName[Walter]{de la Mare}\Name[Walter]{de la Mare}. To capitalize \emph{de} when it arises at the beginning of a sentence, use |\CapThis\Name[Walter]{de la Mare}|. \CapThis\Name[Walter]{de la Mare} will think it fair. Non-English contexts do not always bind particles to surnames. Using \cmd{\Name} and \cmd{\FName} with alternate forenames helps to address this issue of different standards. See also Section~\ref{sec:Particles}. -% -% \subsubsection{Fault Tolerance} -% -% Especially since version 2.0, the \textsf{nameauth} package has been redesigned to help prevent malformed input from generating odd side effects. For example, |\Name[Henry]{VIII}| and |\Name{Henry}[VIII]| used to create the same control sequence and allow one to affect the well-formed input via the malformed input. That no longer happens. Furthermore, we guard against deliberately empty required values being passed to the naming macros. +% \DescribeMacro{\CapThis} +% In English, these particles go in the \meta{SNN} field of \cmd{\Name}, \emph{e.g.}, \ForgetName[Walter]{de la Mare}\Name[Walter]{de la Mare}. To capitalize \emph{de} when it arises at the beginning of a sentence, use |\CapThis\Name[Walter]{de la Mare}|. \CapThis\Name[Walter]{de la Mare} will think it fair. In the rare case where the particle is but one character (unlike all those listed above), the capping macros will eat the space between particle and name. One workaround is to follow such a particle with \cmd{\nobreakspace}. % -% Perhaps a vexing issue with older versions of the package was that leading and trailing spaces in the input could cause significant and obscure errors. Currently, both leading and trailing spaces\,---\,but not medial spaces\,---\,are ignored in the naming macros, making the following equivalent: +% \DescribeMacro{\AccentCapThis} +% Using \texttt{xelatex} and \texttt{lualatex} present no problems for \cmd{\CapThis} when the first character in the \meta{SNN} field is an extended Unicode character. However, using \texttt{pdflatex} and \textsf{inputenc} will cause \cmd{\CapThis} to fail and halt execution; see Section~\ref{sec:accents}. In this particular case you can use \cmd{\AccentCapThis} instead. Alternately, you could \cmd{\CapThis} but you would have to put the leading character in braces or use a control sequence. % -% \begin{quote}\small\ForgetName[Martin Luther]{King, Jr.} -% \begin{tabular}{ll} -% \textit{Macro Example} & \textit{Resulting text}\\ -% |\Name*[ Martin Luther]{King, Jr.}| & \Name*[ Martin Luther]{King, Jr.}\\ -% |\Name*[Martin Luther ]{King, Jr.}| & \Name*[Martin Luther ]{King, Jr.}\\ -% |\Name*[ Martin Luther ]{King, Jr.}| & \Name*[ Martin Luther ]{King, Jr.}\\ -% |\Name*[Martin Luther]{ King, Jr.}| & \Name*[Martin Luther]{ King, Jr.}\\ -% |\Name*[Martin Luther]{King, Jr. }| & \Name*[Martin Luther]{King, Jr. }\\ -% |\Name*[Martin Luther]{ King, Jr. }| & \Name*[Martin Luther]{ King, Jr. }\\ -% \end{tabular} -% \end{quote} +% Non-English contexts do not always bind particles to surnames. Using \cmd{\Name} and \cmd{\FName} with alternate forenames helps address this. See also Section~\ref{sec:Particles}. % -% All name input fields of \cmd{\Name}, \cmd{\FName}, \cmd{\AKA}, and \cmd{\IndexName} are so protected. The other macros really are not affected by these issues. -% % \subsubsection{Hyphenation} % % The simplified interface trivializes the consistent insertion of optional hyphens in names, as we see below: @@ -1204,7 +1208,7 @@ Running "make install" installs the files in the local TeX tree. % | \< Bier & Johann & Bier\-mann & >|\\ % |\end{nameauth}| % \end{quote} -% produces \Bier\ and \Bier. This should prevent the break ``Bi-ermann,'' which could happen otherwise. You can even tag and untag such forms. The bad break above was manufactured, while the bad break below is actual. +% We get \Bier\ and \Bier. This should prevent the break ``Bi-ermann,'' which could happen otherwise. You can even tag and untag such forms. The bad break above was manufactured, while the bad break below is actual. % % \newcommand{\de}[1]{\foreignlanguage{ngerman}{#1}} % Bad breaks can be fixed with the \textsf{babel} or \textsf{polyglossia} packages. \Name[John]{Strietelmeier} can have a bad break in English, as you see. Using \textsf{babel}, we can use the following example so that |\de{\Name*[John]{Strietelmeier}}| generates \de{\Name*[John]{Strietelmeier}} and helps prevent bad breaks: @@ -1242,9 +1246,10 @@ Running "make install" installs the files in the local TeX tree. % \subsubsection{Accented Names} % \label{sec:accents} % -% For texts that contain significant amounts of accented characters, using \texttt{xindy} (\texttt{texindy}) and \texttt{xelatex} or \texttt{lualatex} is recommended. +% For texts that contain accented characters, using \texttt{xelatex} or \texttt{lualatex} with \texttt{xindy} (\texttt{texindy}) is recommended. Since version 2.1, \textsf{nameauth} generally does not require any special treatment for the leading character of the \meta{SNN} field. The only exception is the case where you need \cmd{\CapThis} and \cmd{\AccentCapThis}.\footnote{The root of this problem is shown by this example: \texttt{\textbackslash def\textbackslash foo\#1\#2\#3\textbackslash relax\{<\#1\#2><\#3>\}.}\def\foo#1#2#3\relax{<#1#2><#3>} With \texttt{\textbackslash foo abc\textbackslash relax} you get \foo abc\relax. With \texttt{\textbackslash foo æbc\textbackslash relax} you get \foo æbc\relax. A Unicode-native engine always gives you the results <ab><c> and <æb><c>.\\[0.5ex] +%\indent Using \texttt{xelatex} and \texttt{lualatex} avoids the problem. With \texttt{pdflatex}, if you try to capitalize half of ``æ'' you will get \texttt{Argument of \textbackslash UTFviii@two@ octets has an extra \}.} Because \textsf{nameauth} passes on the capitalized word to other macros via \cmd{\protected@edef} instead of just printing it in the text, many extant word-capitalizing macros and even kernel macros like \cmd{\in@}\dots\cmd{\ifin@} fail with regard to expansion, scoping, and control sequence definition.} % -% Under NFSS your results may vary with the |utf8| input encoding and |T1| or |TS1| font encoding. First of all, at the start of a name field, you need to put Unicode characters in braces or use control sequences, \emph{e.g.}, |\Name{{Æ}thelred, II}| and |\Name{\AE thelred, II}|. With |\Name[Johann]{Andreä}| we see that subsequent letters need no changes. For the first letter in any argument field of the \textsf{nameauth} macros, if you fail to put accented letters in braces or use control sequences, you will get an error and execution will halt. You can use these glyphs: +% Under NFSS and the |utf8| input encoding, the following glyphs generally are available to you: % \begin{quote}\small % \begin{tabular}{llll} % \scshape À Á Â Ã Ä Å Æ & \scshape Ç È É Ê Ë & \scshape Ì Í Î Ï Ð Ñ & \scshape first use \\ @@ -1263,21 +1268,16 @@ Running "make install" installs the files in the local TeX tree. % Ś Ş ş Š š Ţ ţ Ť ť & Ů ů Ű ű & Ź ź Ż ż Ž ž & second use \\ % \end{tabular} % \end{quote} -% -% The first example below shows that Unicode characters and control sequences are not interchangeable. Notice again that only the first Unicode character need be a control sequence or put in braces: +% These glyphs do not cover some of the extended character sets completely. Unicode characters and control sequences are not interchangeable. Instead of getting long, then short references (if they were the same), you only get long ones below: % \begin{quote} % \IndexInactive% % |\Name[Johann]{Andre\"a}|\hfill \Name[Johann]{Andre\"a}\\ -% |\Name[Johann]{Andre\"a}|\hfill \Name[Johann]{Andre\"a}\\ % \IndexActive% % |\Name[Johann]{Andreä}|\hfill \Name[Johann]{Andreä}\\ -% |\Name[Johann]{Andreä}|\hfill \Name[Johann]{Andreä}\\[2ex] % \IndexInactive% % |\Name{\AE thelred, II}|\hfill \Name{\AE thelred, II}\\ -% |\Name{\AE thelred, II}|\hfill \Name{\AE thelred, II}\\ % \IndexActive% -% |\Name{{Æ}thelred, II}|\hfill \Name{{Æ}thelred, II}\\ -% |\Name{{Æ}thelred, II}|\hfill \Name{{Æ}thelred, II} +% |\Name{Æthelred, II}|\hfill \Name{Æthelred, II} % \end{quote} % % Additional accents and glyphs can be used with Unicode input, NFSS, \textsf{inputenc}, and \textsf{fontenc} when using fonts with TS1 glyphs, \emph{e.g.}, |\usepackage{lmodern}| (per the table on pages 455--63 in \emph{The Latex Companion}): @@ -1296,11 +1296,11 @@ Running "make install" installs the files in the local TeX tree. % \subsubsection{Index Sorting} % \label{sec:IndexSort} % -% The general practice for sorting with \texttt{makeindex -g} involves creating your own |.ist| file (pages 659--65 in \emph{The Latex Companion}). Otherwise use the following form that works with both \texttt{makeindex} and \texttt{texindy}: +% The general practice for sorting with \texttt{makeindex -s} involves creating your own |.ist| file (pages 659--65 in \emph{The Latex Companion}). Otherwise use the following form that works with both \texttt{makeindex} and \texttt{texindy}: % \begin{quote} % |\index{|\meta{sortkey}|@|\meta{actual}|}| % \end{quote} -%Before version 2.0 of \textsf{nameauth}, one had to sort and index a name like \Name[Jan]{{Ł}ukasiewicz} by putting it between \cmd{\IndexInactive} and \cmd{\IndexActive} while creating a manual index entry.\\ +%Before version 2.0 of \textsf{nameauth}, one had to sort and index a name like \Name[Jan]{Łukasiewicz} by putting it between \cmd{\IndexInactive} and \cmd{\IndexActive} while creating a manual index entry.\\ % % \DescribeMacro{\PretagName} % Fortunately, the current versions of \textsf{nameauth} have adopted an easier solution. The syntax of \cmd{\PretagName} is like that of \cmd{\TagName}: @@ -1316,11 +1316,11 @@ Running "make install" installs the files in the local TeX tree. % The \cmd{\PretagName} macro creates a sort key terminated with the ``actual'' character, which is |@| by default. Do not include the ``actual'' character in the pretag. % Now, sorting index entries is as simple as: % \begin{quote} -% |\PretagName[Jan]{{Ł}ukasiewicz}{Lukasiewicz, Jan}|\\ -% |\PretagName{{Æ}thelred, II}{Aethelred 2}| +% |\PretagName[Jan]{Łukasiewicz}{Lukasiewicz, Jan}|\\ +% |\PretagName{Æthelred, II}{Aethelred 2}| % \end{quote} % -% One need only pretag names once in the preamble. Every time that \Name[Jan]{{Ł}ukasiewicz} or \Name{{Æ}thelred, II} are referenced, the proper index entry will be created. If you create a cross-reference with \cmd{\AKA} and you want to pretag it, see Section~\ref{sec:AKA}.\\ +% One need only pretag names once in the preamble. Every time that one refers to \Name[Jan]{Łukasiewicz} or \Name{Æthelred, II}, the proper index entry will be created. If you create a cross-reference with \cmd{\AKA} and you want to pretag it, see Section~\ref{sec:AKA}.\\ % % \DescribeMacro{\IndexActual} % If you need to change the ``actual'' character, such as with \texttt{gind.ist}, put |\IndexActual{=}| in the preamble.\\ @@ -1373,7 +1373,8 @@ Running "make install" installs the files in the local TeX tree. % \begin{quote}\small % |\makeatletter|\\ % |\let\@oldfntext\@makefntext|\\ -% |\long\def\@makefntext#1{\def\NamesFormat{}\@oldfntext{#1}}|\\ +% |\long\def\@makefntext#1{%|\\ +% | \renewcommand*\NamesFormat{}\@oldfntext{#1}}|\\ % |\makeatother| % \end{quote} % @@ -1382,13 +1383,13 @@ Running "make install" installs the files in the local TeX tree. % A second example puts the mention of first names in boldface, with additional notations in the margin if possible: %\begin{quote}\small % |\let\oldformat\NamesFormat|\\ -% |\renewcommand{\NamesFormat}[1]%|\\ +% |\renewcommand*{\NamesFormat}[1]%|\\ % | {\textbf{#1}\ifinner\else|\\ % | \marginpar{\raggedleft\scriptsize #1}\fi}|\\ % |\PretagName{Vlad, Ţepeş}{Vlad Tepes}%| % % \let\oldformat\NamesFormat% -% \renewcommand{\NamesFormat}[1]{\textbf{#1}\ifinner\else\marginpar{\raggedleft\scriptsize #1}\fi}% +% \renewcommand*{\NamesFormat}[1]{\textbf{#1}\ifinner\else\marginpar{\raggedleft\scriptsize #1}\fi}% % {\footnotesize |\Name{Vlad| |III,| |Dracula},| |known| |as| |\AKA{Vlad| |III,| |Dracula}{Vlad, Ţepeş},| |``\AKA*{Vlad| |III,| |Dracula}{Vlad}[the| |Impaler]''| |after| |his| |death,| |was| |the| |son| |of| |\Name{Vlad| |II,| |Dracul},| |a| |member| |of| |the| |Order| |of| |the| |Dragon.| |Later| |references| |to| |``\Name{Vlad| |III,| |Dracula}''| |appear| |thus.|}\smallskip % % \Name{Vlad III, Dracula}, known as \AKA{Vlad III, Dracula}{Vlad, Ţepeş}, ``\AKA*{Vlad III, Dracula}{Vlad}[the Impaler]'' after his death, was the son of \Name{Vlad II, Dracul}, a member of the Order of the Dragon. Later references to ``\Name{Vlad III, Dracula}'' appear thus. @@ -1885,65 +1886,76 @@ Running "make install" installs the files in the local TeX tree. % \fi % \small % \subsection{Boolean Values} -% We begin with Boolean values that control printed name forms. |@nameauth@FullName| toggles long or short forms in subsequent name uses. |@nameauth@FirstName| is used when printing only first names. |@nameauth@AltAKA| determines if \cmd{\AKA} will print a longer or shorter name, depending on the starred or unstarred form. -% \begin{macrocode} -\newif\if@nameauth@FullName -\newif\if@nameauth@FirstName -\newif\if@nameauth@AltAKA -% \end{macrocode} -% The next few Boolean values control formatting. The first is toggled with \cmd{\NamesActive} and \cmd{\NamesInctive} or the front and main matter options. The next toggles the formatting of first occurrences of names. The last forces name formatting whenever formatting is active, or allows normal operation. -% \begin{macrocode} -\newif\if@nameauth@DoFormat -\newif\if@nameauth@FirstFormat -\newif\if@nameauth@AlwaysFormat -% \end{macrocode} +% \noindent{\large\bfseries Affix Commas}\\[.5ex] % The |comma| and |nocomma| options toggle the first value below, while \cmd{\ShowComma} toggles the second. Each instance of \cmd{\Name} and \cmd{\AKA} reset |@nameauth@ShowComma|. % \begin{macrocode} \newif\if@nameauth@AlwaysComma \newif\if@nameauth@ShowComma -% \end{macrocode} -% \cmd{\KeepAffix} toggles the value below. Each instance of \cmd{\Name} and \cmd{\AKA} reset it. +% \end{macrocode}\medskip +% \noindent{\large\bfseries Toggle Formatting}\\[.5ex] +% This value is toggled with \cmd{\NamesActive} and \cmd{\NamesInactive} or the |mainmatter| and |frontmatter| options. % \begin{macrocode} -\newif\if@nameauth@NBSP -% \end{macrocode} -% \cmd{\IndexActive} and \cmd{\IndexInctive} toggle the value below. +\newif\if@nameauth@DoFormat +% \end{macrocode}\medskip +% \noindent{\large\bfseries Indexing}\\[.5ex] +% \cmd{\IndexActive} and \cmd{\IndexInctive}, with the |index| and |noindex| options, toggle the value below. % \begin{macrocode} \newif\if@nameauth@DoIndex % \end{macrocode} % The |pretag| and |nopretag| options toggle the value below. % \begin{macrocode} \newif\if@nameauth@Pretag +% \end{macrocode}\medskip +% \noindent{\large\bfseries Name Formatting}\\[.5ex] +% The next Boolean values govern full name capitalization, name reversing, and name reversing with commas. +% \begin{macrocode} +\newif\if@nameauth@AllCaps +\newif\if@nameauth@AllThis +\newif\if@nameauth@RevAll +\newif\if@nameauth@RevThis +\newif\if@nameauth@RevAllComma +\newif\if@nameauth@RevThisComma +% \end{macrocode} +% |@nameauth@FirstFormat| toggles the formatting of first occurrences of names.\\ |@nameauth@AlwaysFormat| forces name formatting whenever formatting is active. +% \begin{macrocode} +\newif\if@nameauth@FirstFormat +\newif\if@nameauth@AlwaysFormat +% \end{macrocode} +% |@nameauth@FullName| toggles long or short forms in subsequent name uses.\\ |@nameauth@FirstName| is used when printing only first names. |@nameauth@AltAKA| is toggled by either \cmd{\AKA} or \cmd{\AKA*} to print a longer or shorter name. +% \begin{macrocode} +\newif\if@nameauth@FullName +\newif\if@nameauth@FirstName +\newif\if@nameauth@AltAKA +% \end{macrocode} +% \cmd{\KeepAffix} toggles the value below. Each instance of \cmd{\Name} and \cmd{\AKA} reset it. +% \begin{macrocode} +\newif\if@nameauth@NBSP % \end{macrocode} % This Boolean value is used for detection of affixes and final periods. % \begin{macrocode} \newif\if@nameauth@Punct % \end{macrocode} -% This Boolean value is triggered by \cmd{\CapThis}. +% This Boolean value is triggered by \cmd{\CapThis}. Each instance of \cmd{\Name} and \cmd{\AKA} reset it. % \begin{macrocode} \newif\if@nameauth@DoCaps % \end{macrocode} -% The next Boolean values govern full name capitalization, name reversing, and name reversing with commas. +% This Boolean value is triggered by \cmd{\AccentCapThis} to handle special cases of extended Unicode particle caps. Each instance of \cmd{\Name} and \cmd{\AKA} reset it. % \begin{macrocode} -\newif\if@nameauth@AllCaps -\newif\if@nameauth@AllThis -\newif\if@nameauth@RevAll -\newif\if@nameauth@RevThis -\newif\if@nameauth@RevAllComma -\newif\if@nameauth@RevThisComma +\newif\if@nameauth@Accent % \end{macrocode} % \clearpage\noindent % \subsection{Package Options} % The following package options interact with many of the prior Boolean values. Suppressing and showing commas is set at load time. Most options can be changed with user interface macros. Avoid changing the internal Boolean values directly. % \begin{macrocode} -\newcommand{\NamesFormat}{} \def\@nameauth@Actual{@} +\DeclareOption{comma}{\@nameauth@AlwaysCommatrue} +\DeclareOption{nocomma}{\@nameauth@AlwaysCommafalse} \DeclareOption{mainmatter}{\@nameauth@DoFormattrue} \DeclareOption{frontmatter}{\@nameauth@DoFormatfalse} -\DeclareOption{smallcaps}{\renewcommand{\NamesFormat}{\scshape}} -\DeclareOption{italic}{\renewcommand{\NamesFormat}{\itshape}} -\DeclareOption{boldface}{\renewcommand{\NamesFormat}{\bfseries}} -\DeclareOption{noformat}{\renewcommand{\NamesFormat}{}} -\DeclareOption{alwaysformat}{\@nameauth@AlwaysFormattrue} +\DeclareOption{index}{\@nameauth@DoIndextrue} +\DeclareOption{noindex}{\@nameauth@DoIndexfalse} +\DeclareOption{pretag}{\@nameauth@Pretagtrue} +\DeclareOption{nopretag}{\@nameauth@Pretagfalse} \DeclareOption{allcaps}{\@nameauth@AllCapstrue} \DeclareOption{normalcaps}{\@nameauth@AllCapsfalse} \DeclareOption{allreversed}% @@ -1952,12 +1964,11 @@ Running "make install" installs the files in the local TeX tree. {\@nameauth@RevAlltrue\@nameauth@RevAllCommatrue} \DeclareOption{notreversed}% {\@nameauth@RevAllfalse\@nameauth@RevAllCommafalse} -\DeclareOption{comma}{\@nameauth@AlwaysCommatrue} -\DeclareOption{nocomma}{\@nameauth@AlwaysCommafalse} -\DeclareOption{index}{\@nameauth@DoIndextrue} -\DeclareOption{noindex}{\@nameauth@DoIndexfalse} -\DeclareOption{pretag}{\@nameauth@Pretagtrue} -\DeclareOption{nopretag}{\@nameauth@Pretagfalse} +\DeclareOption{alwaysformat}{\@nameauth@AlwaysFormattrue} +\DeclareOption{smallcaps}{\newcommand*{\NamesFormat}{\scshape}} +\DeclareOption{italic}{\newcommand*{\NamesFormat}{\itshape}} +\DeclareOption{boldface}{\newcommand*{\NamesFormat}{\bfseries}} +\DeclareOption{noformat}{\newcommand*{\NamesFormat}{}} \ExecuteOptions% {nocomma,% mainmatter,% @@ -1971,8 +1982,10 @@ Running "make install" installs the files in the local TeX tree. % Now we load the required packages. They facilitate the first/subsequent name uses, the parsing of arguments, and the implementation of starred forms. % \begin{macrocode} \RequirePackage{etoolbox} -\RequirePackage{trimspaces} +\RequirePackage{ifluatex} +\RequirePackage{ifxetex} \RequirePackage{suffix} +\RequirePackage{trimspaces} \RequirePackage{xargs} % \end{macrocode} % \clearpage\noindent @@ -2005,19 +2018,43 @@ Running "make install" installs the files in the local TeX tree. % % \begin{macro}{\@nameauth@CapRoot} % \changes{v0.95}{2012/02/17}{Added} -% The next two macros implement the particulate name capitalization mechanism by returning a radix where the first letter is capitalized. +% \changes{v2.1}{2015/11/24}{Handle Unicode better} +% The next two macros implement the particulate name capitalization mechanism by returning a radix where the first letter is capitalized. In \texttt{xelatex} and \texttt{lualatex} this is trivial and causes no problems. In \texttt{pdflatex} we have to account for ``double-wide'' accented Unicode characters. % \begin{macrocode} \newcommand*{\@nameauth@CapRoot}[1]% - {\@nameauth@CR#1\relax} +{% + \ifxetex + \@nameauth@CRii#1\relax% + \else + \ifluatex + \@nameauth@CRii#1\relax% + \else + \if@nameauth@Accent + \@nameauth@CRiii#1\relax% + \else + \@nameauth@CRii#1\relax% + \fi + \fi + \fi +} % \end{macrocode} % \end{macro} % -% \begin{macro}{\@nameauth@CR} +% \begin{macro}{\@nameauth@CRii} % \changes{v0.95}{2012/02/17}{Added} % \changes{v1.26}{2012/04/24}{Fixed} % Grab the first letter as one parameter, and everything before \cmd{\relax} as the second. Capitalize the first and return it with the second. % \begin{macrocode} -\def\@nameauth@CR#1#2\relax{\uppercase{#1}\@nameauth@Root{#2}} +\def\@nameauth@CRii#1#2\relax{\uppercase{#1}\@nameauth@Root{#2}} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@nameauth@CRiii} +% \changes{v2.1}{2015/11/24}{added} +% This is called in \texttt{pdflatex} under \textsf{inputenc} where an accented Unicode character takes the first two parameters. Grab the first ``letter'' as two parameters and cap it, then everything before \cmd{\relax} as the third. Capitalize the first and return it with the second. +% \begin{macrocode} +\def\@nameauth@CRiii#1#2#3\relax{\uppercase{#1#2}\@nameauth@Root{#3}} % \end{macrocode} % \end{macro} % @@ -2029,7 +2066,7 @@ Running "make install" installs the files in the local TeX tree. {\uppercase{\@nameauth@Root{#1}}} % \end{macrocode} % \end{macro} -% +% \clearpage % \begin{macro}{\@nameauth@Suffix} % \changes{v0.9}{2012/02/10}{Added} % The following two macros parse \meta{SNN} into a radix and a comma-delimited suffix, returning only the suffix. Anything before a comma is stripped off by |\@nameauth@Suffix|, but a comma must be present in the parameter. Leading spaces are removed to allow consistent formatting. @@ -2101,6 +2138,7 @@ Running "make install" installs the files in the local TeX tree. } % \end{macrocode} % \end{macro} +% \clearpage % % \begin{macro}{\@nameauth@Index} % \changes{v0.94}{2012/02/15}{Added} @@ -2133,12 +2171,18 @@ Running "make install" installs the files in the local TeX tree. % The following macros have been documented previously. Either they call the internal macros or they set Boolean values. % \begin{macro}{\CapThis} % \changes{v0.94}{2012/02/15}{Added} -% Capitalize first letter of name. +% Tells the root capping macro to cap an unaccented character. % \begin{macrocode} \newcommand*{\CapThis}{\@nameauth@DoCapstrue} % \end{macrocode} % \end{macro} -% +% \begin{macro}{\AccentCapThis} +% \changes{v2.1}{2015/11/24}{Added} +% Tells the root capping macro to cap an accented Unicode character. +% \begin{macrocode} +\newcommand*{\AccentCapThis}{\@nameauth@Accenttrue\@nameauth@DoCapstrue} +% \end{macrocode} +% \end{macro} % \begin{macro}{\CapName} % \changes{v1.5}{2013/02/22}{Added} % Capitalize entire name. @@ -2269,6 +2313,7 @@ Running "make install" installs the files in the local TeX tree. % \changes{v0.96}{2012/02/19}{Works w/ \textsf{microtype}, \textsf{memoir}} % \changes{v1.5}{2013/02/22}{Add reversing and caps} % \changes{v2.0}{2015/11/11}{Isolate malformed input; trim spaces; redesign tagging} +% \changes{v2.1}{2015/11/24}{Isolate Unicode issues} % Here is the heart of the package. \Name*[Marc van]{Dongen} provided the basic structure. Parsing, indexing, and formatting are in discrete elements. % \begin{macrocode} \newcommandx*\Name[3][1=\@empty, 3=\@empty]% @@ -2276,7 +2321,7 @@ Running "make install" installs the files in the local TeX tree. \let\ex\expandafter% \leavevmode\hbox{}% % \end{macrocode} -% Names occur in horizontal mode; we ensure that. +% Names occur in horizontal mode; we ensure that. Next we make copies of the arguments to test them and make parsing decisions % \begin{macrocode} \protected@edef\testa{#1}% \protected@edef\arga{\trim@spaces{#1}}% @@ -2287,24 +2332,25 @@ Running "make install" installs the files in the local TeX tree. \def\csb{\@nameauth@Clean{#2}}% \def\csbc{\@nameauth@Clean{#2#3}}% \def\csab{\@nameauth@Clean{#1!#2}}% +% \end{macrocode} +% Test for malformed input. +% \begin{macrocode} \ifx\testb\@empty \PackageError{nameauth}% {macro \Name: Essential name missing}% \else \ifx\csb\@empty \PackageError{nameauth}% - {macro \AKA: Essential name malformed}% + {macro \Name: Essential name malformed}% \fi \fi % \end{macrocode} -% We make copies of the arguments to test them and make parsing decisions. +% If global caps. reversing, and commas are true, set the local flags true. % \begin{macrocode} \if@nameauth@AllCaps\@nameauth@AllThistrue\fi \if@nameauth@RevAll\@nameauth@RevThistrue\fi \if@nameauth@RevAllComma\@nameauth@RevThisCommatrue\fi % \end{macrocode} -% If global caps. reversing, and commas are true, set the local flags true. -% % The code below handles non-breaking and regular spaces, as well as commas, in the text and the index by setting up which kind we want to use. These will be inserted as appropriate as the output is formatted. % \begin{macrocode} \protected@edef\ISpace{\space}% @@ -2325,7 +2371,11 @@ Running "make install" installs the files in the local TeX tree. % The section below parses any ``surnames'' into name/suffix pairs and figures out how to capitalize and reverse them as needed, storing the results for the main parser. % \begin{macrocode} \protected@edef\RawShort{\@nameauth@Root{#2}}% - \protected@edef\CapShort{\@nameauth@CapRoot{#2}}% + \if@nameauth@DoCaps + \protected@edef\CapShort{\@nameauth@CapRoot{#2}}% + \else + \let\CapShort\RawShort% + \fi \protected@edef\AllCapShort{\@nameauth@AllCapRoot{#2}}% \let\IndexShort\RawShort% \ifx\testb\testbr @@ -2643,6 +2693,7 @@ Running "make install" installs the files in the local TeX tree. \@nameauth@FirstFormatfalse% \@nameauth@NBSPfalse% \@nameauth@DoCapsfalse% + \@nameauth@Accentfalse% \@nameauth@AllThisfalse% \@nameauth@ShowCommafalse% \@nameauth@RevThisfalse% @@ -2686,6 +2737,7 @@ Running "make install" installs the files in the local TeX tree. % \changes{v1.26}{2012/04/24}{Fix sorting of name suffixes} % \changes{v1.5}{2013/02/22}{Add reversing and caps} % \changes{v2.0}{2015/11/11}{Isolate malformed input; trim spaces; redesign tagging} +% \changes{v2.1}{2015/11/24}{Isolate Unicode issues} % \cmd{\AKA} prints an alternate name and creates index cross-references. It prevents multiple generation of cross-references and suppresses double periods. % \begin{macrocode} \newcommandx*\AKA[5][1=\@empty, 3=\@empty, 5=\@empty]% @@ -2693,7 +2745,7 @@ Running "make install" installs the files in the local TeX tree. \let\ex\expandafter% \leavevmode\hbox{}% % \end{macrocode} -% Names occur in horizontal mode; we ensure that. +% Names occur in horizontal mode; we ensure that. Next we make copies of the arguments to test them and make parsing decisions. % \begin{macrocode} \protected@edef\testa{#1}% \protected@edef\arga{\trim@spaces{#1}}% @@ -2709,8 +2761,8 @@ Running "make install" installs the files in the local TeX tree. \def\csde{\@nameauth@Clean{#4#5}}% \def\cscd{\@nameauth@Clean{#3!#4}}% % \end{macrocode} -% Above we make copies of the arguments to test them and make parsing decisions. % \clearpage\noindent +% Test for malformed input. % \begin{macrocode} \ifx\testb\@empty \PackageError{nameauth}% @@ -2731,14 +2783,12 @@ Running "make install" installs the files in the local TeX tree. \fi \fi % \end{macrocode} -% We test for one kind of malformed input input. +% If global caps. reversing, and commas are true, set the local flags true. % \begin{macrocode} \if@nameauth@AllCaps\@nameauth@AllThistrue\fi \if@nameauth@RevAll\@nameauth@RevThistrue\fi \if@nameauth@RevAllComma\@nameauth@RevThisCommatrue\fi % \end{macrocode} -% If global caps. reversing, and commas are true, set the local flags true. -% % The code below handles non-breaking and regular spaces, as well as commas, in the text and the index by setting up which kind we want to use. These will be inserted as appropriate as the output is formatted. % \begin{macrocode} \protected@edef\ISpace{\space}% @@ -2760,7 +2810,11 @@ Running "make install" installs the files in the local TeX tree. % \begin{macrocode} \protected@edef\Shortb{\@nameauth@Root{#2}}% \protected@edef\Shortd{\@nameauth@Root{#4}}% - \protected@edef\CapShort{\@nameauth@CapRoot{#4}}% + \if@nameauth@DoCaps + \protected@edef\CapShort{\@nameauth@CapRoot{#4}}% + \else + \let\CapShort\Shortd + \fi \protected@edef\AllCapShort{\@nameauth@AllCapRoot{#4}}% \ifx\testb\testbr \let\SNNb\Shortb% @@ -2902,6 +2956,7 @@ Running "make install" installs the files in the local TeX tree. \fi \else % \end{macrocode} +% \clearpage\noindent % For Western names and affixes: If a pseudonym has not been generated by \cmd{\AKA} or \cmd{\ExcludeName}, and if the proposed pseudonym is not already a mainmatter or frontmatter name, then generate a \textit{see} reference from the pseudonym to a name that will appear in the index. % \begin{macrocode} \ifcsname\cscd!PN\endcsname @@ -2973,6 +3028,7 @@ Running "make install" installs the files in the local TeX tree. \@nameauth@NBSPfalse% \@nameauth@AltAKAfalse% \@nameauth@DoCapsfalse% + \@nameauth@Accentfalse% \@nameauth@AllThisfalse% \@nameauth@ShowCommafalse% \@nameauth@RevThisfalse% |