From f84e441f563ccac19ce53299ad4a6d507e0c0c35 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 24 Nov 2020 22:13:48 +0000 Subject: nameauth (24nov20) git-svn-id: svn://tug.org/texlive/trunk@56995 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/nameauth/README | 129 -- Master/texmf-dist/doc/latex/nameauth/README.md | 156 +++ Master/texmf-dist/doc/latex/nameauth/README.txt | 129 -- Master/texmf-dist/doc/latex/nameauth/examples.tex | 1313 +++++++++++---------- Master/texmf-dist/doc/latex/nameauth/nameauth.pdf | Bin 1049659 -> 1144403 bytes 5 files changed, 847 insertions(+), 880 deletions(-) delete mode 100644 Master/texmf-dist/doc/latex/nameauth/README create mode 100644 Master/texmf-dist/doc/latex/nameauth/README.md delete mode 100644 Master/texmf-dist/doc/latex/nameauth/README.txt (limited to 'Master/texmf-dist/doc') diff --git a/Master/texmf-dist/doc/latex/nameauth/README b/Master/texmf-dist/doc/latex/nameauth/README deleted file mode 100644 index 8a950701179..00000000000 --- a/Master/texmf-dist/doc/latex/nameauth/README +++ /dev/null @@ -1,129 +0,0 @@ -| ---------:| ---------------------------------------------------------------- -nameauth:| Name authority mechanism for consistency in text and index - Author:| Charles P. Schaum - E-mail:| charles dot schaum@comcast.net - License:| Released under the LaTeX Project Public License 1.3c or later - See:| http://www.latex-project.org/lppl.txt - -Short description: - -The nameauth package automates the correct formatting and indexing of names -for professional writing. This aids the use of a name authority and the -editing process without needing to retype name references. - -Files Distribution - -README This file -nameauth.pdf Documentation -examples.tex Some longer example macros from the documentation - -Makefile Automates building with GNU make 3.81 -nameauth.dtx Documented LaTeX file containing both code and documentation - -Manual Installation - -Download the package from - -www.ctan.org/tex-archive/macros/latex/contrib/nameauth - -Unpack nameauth.zip in an appropriate directory. - -If you have a make utility compatible with GNU make, either in -GNU/Linux, a BSD variant, OSX, or Cygwin in Windows you can type - -make inst - -to install the package into your $TEXMFHOME tree or - -make install - -to install the package into your $TEXMFLOCAL tree for all users. -The latter requires sudo privileges. - -Other useful targets include: - -(release process) - -make release The default target, same as just ``make''. - -make clean Removes all intermediate files. Left are -the files listed above plus nameauth.sty. - -make distclean Leave only nameauth.dtx, examples.tex, -and Makefile. - -make zip Generate a zip file ready for distribution. - -(testing process) - -make testing Release files, plus compiles examples.tex. - -make release ENGINE= -Here, can be pdflatex (default), -xelatex, lualatex, dvilualatex, or latex. - -make testing ENGINE= See above. - -It is not necessary, however, to use GNU make. One can generate -the package files manually. Since the files nameauth.ins and README.txt -are contained in the .dtx file itself, the first step is to generate -the installer driver nameauth.ins, plus the file README.txt, which will -also trigger the extraction of nameauth.sty and produce the first pass of -the package documentation nameauth.pdf: - -pdflatex -shell-escape -recorder -interaction=batchmode nameauth.dtx - -Next one adds a table of contents and all cross-references, this also -should finalize page numbers for glossary and index input files: - -pdflatex --recorder --interaction=nonstopmode nameauth.dtx - -The next commands generate the glossary/index output files: - -makeindex -q -s gglo.ist -o nameauth.gls nameauth.glo -makeindex -q -s gind.ist -o nameauth.ind nameauth.idx - -The final two commands integrate the glossary (changes) and index: - -pdflatex --recorder --interaction=nonstopmode nameauth.dtx -pdflatex --recorder --interaction=nonstopmode nameauth.dtx - -Now one can either keep README.txt or rename it to README, e.g.: - -mv README.txt README - -Normally one creates the following directories for a user: - -$TEXMFHOME/source/latex/nameauth dtx file -$TEXMFHOME/tex/latex/nameauth sty file -$TEXMFHOME/doc/latex/nameauth pdf file, README, examples.tex - -and creates the following directories for the local site: - -$TEXMFLOCAL/source/latex/nameauth dtx file -$TEXMFLOCAL/tex/latex/nameauth sty file -$TEXMFLOCAL/doc/latex/nameauth pdf file, README, examples.tex - -The above environment variables often are /usr/local/texlive/texmf-local -and ~/texmf. - -The make process normally renames the README.txt file created from the -dtx file to just README by using mv (move / rename utility in the *nix -userland). Windows distributions of TeX and LaTeX often keep the txt file -because of using file extensions instead of ``magic numbers'' to identify -files. - -Run mktexlsr with the appropriate level of permissions to complete the -install. - -Testing notes: - -See the nameauth manual. - -License - -This material is subject to the LaTeX Project Public License: -http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html - -Happy TeXing! diff --git a/Master/texmf-dist/doc/latex/nameauth/README.md b/Master/texmf-dist/doc/latex/nameauth/README.md new file mode 100644 index 00000000000..2ea1c5952b3 --- /dev/null +++ b/Master/texmf-dist/doc/latex/nameauth/README.md @@ -0,0 +1,156 @@ +# Short Description + +The `nameauth` package automates the correct formatting and indexing of names +for professional writing. This aids the use of a name authority and the +editing process without needing to retype name references. + +# Files + +|Filename |Description | +|--------------|---------------------------------------| +|`nameauth.dtx`|commented style file; source file | +|`Makefile` |For use with GNU make; with source file| +|`nameauth.ins`|installation driver (generated file) | +|`nameauth.pdf`|Documentation (generated file) | +|`README.md` |This file (generated file) | +|`examples.tex`|example macros (generated file) | + +# Obtaining the Package + +1. Packaged in your current TeX distrbution: See the appropriate documentation. + +2. Otherwise, download `nameauth.zip` from [CTAN](www.ctan.org/tex-archive/macros/latex/contrib/nameauth). + +3. Unpack `nameauth.zip` in an appropriate directory. + +4. Change to the directory containing the `nameauth` files. + +# File Generation + +## Automatic Installation + +This method requires GNU `make` on a POSIX-compliant environment, such as GNU/Linux, various BSD flavors, perhaps MacOS (e.g., with various porting systems), and even Cygwin on Windows. + +0. A quick install in one's home directory using some of the included files from the `zip` archive just requires the following steps: + + tex nameauth.dtx + make inst + +Otherwise we use the LaTeX installation on the host machine to build the package. When using `make`, any `dvi` files that are created will also be converted to `pdf` format. + +1. Type `make distclean release` to generate the release files using `pdflatex`. + +2. To use another TeX engine, type one of the following: + make ENGINE=latex + make ENGINE=lualatex + make ENGINE=dvilualatex + make ENGINE=xelatex + +3. Type `make inst` to install the files in the user's personal TDS-compliant directory tree. + +4. Type `sudo make install` to install the files in the system-wide, local TDS-compliant directory tree. + +## Manual Compilation + +Otherwise, the following steps are used for manual installation. See the general information at the [TeX FAQ](https://www.texfaq.org/FAQ-installthings). + +0. To use some of the included files from the `zip` archive and only extract files from the `dtx` file, just do the following step and proceed to installation: + + tex nameauth.dtx + +1. To build the package on the host system, generate the installation files and a copy of the documentation without the table of contents and cross-references. We use `pdflatex` by default: + + pdflatex --shell-escape --recorder --interaction=batchmode nameauth.dtx + +2. Generate the TOC and cross-references for the documentation: + + pdflatex --recorder --interaction=nonstopmode nameauth.dtx + +3. Generate the index files using `makeindex`: + + makeindex -q -s gglo.ist -o nameauth.gls nameauth.glo + makeindex -q -s gind.ist -o nameauth.ind nameauth.idx + +4. Integrate the glossary (changes) and index into the documentation. The second run updates the TOC: + + pdflatex --recorder --interaction=nonstopmode nameauth.dtx + pdflatex --recorder --interaction=nonstopmode nameauth.dtx + +One can substitute, e.g., `latex`, `xelatex`, `lualatex`, and `dvilualatex` for `pdflatex`, but the documentation may look different in some cases. + +## File Installation + +Different TeX distributions have somewhat different ways to store TDS-compliant configuration and package data. See, for example, [MikTeX](https://miktex.org/kb/texmf-roots) and the [TeX FAQ](https://www.texfaq.org/FAQ-privinst). Two approaches below conform generally to a Unix-based system: + +## User's Home Directory + +`TEXMFHOME` is a variable that points to the root of a TDS-compliant directory tree available to a user. Use `kpsewhich --var-value TEXMFHOME` to obtain its value. Quite often it is equivalent to `$HOME/texmf`. The dollar sign in front of the variable denotes the value of the variable instead of its name. So if `$HOME` is `/home/bob`, then `$TEXMFHOME` would be `/home/bob/texmf`, and we can understand the following paths to be under that directory: + +|Path |Description | +|----------------------------------|---------------------------------------| +|`$TEXMFHOME/source/latex/nameauth`|`ins` and `dtx` files, Makefile | +|`$TEXMFHOME/tex/latex/nameauth` |`sty` file | +|`$TEXMFHOME/doc/latex/nameauth` |`pdf` file, `README.md`, `examples.tex`| + +On older TeX distributions, run `mktexlsr` on $TEXMFHOME to complete the install process. + +## System-Wide Directory + +`TEXMFLOCAL` is a variable that points to the root of a TDS-compliant directory tree available to all users on a local site, system-wide installation. Use `kpsewhich --var-value TEXMFLOCAL` to obtain its value. See the [TeX FAQ](https://www.texfaq.org/FAQ-what-TDS). We can understand the following paths to be under that directory: + +|Path |Description | +|-----------------------------------|---------------------------------------| +|`$TEXMFLOCAL/source/latex/nameauth`|`ins` and `dtx` files, Makefile | +|`$TEXMFLOCAL/tex/latex/nameauth` |`sty` file | +|`$TEXMFLOCAL/doc/latex/nameauth` |`pdf` file, `README.md`, `examples.tex`| + +Run `mktexlsr` with the appropriate permissions on `$TEXMFLOCAL` to complete the install process. + +# Testing + +## Compiling `examples.tex` + +1. Either go to the directory used when unpacking the `zip` file or copy the file `examples.tex` from the `doc/latex/nameauth` branch of whatever TDS-compliant tree to a directory of your choice. + +2. If one has access to GNU `make`, use either `Makefile` in the directory where one unpacked the `zip` file or copy `Makefile` from either `src/latex/nameauth` or `doc/latex/nameauth` in whatever TDS-compliant tree it exists. + +When using `make`, any `dvi` files that are created will also be converted to `pdf` format. + +3. To compile the test file using `make` and `pdflatex`, simply type `make testing`. + +4. For multi-format testing using `make` in addition to that above, one can do the following: + + make testing ENGINE=pdflatex + make testing ENGINE=latex + make testing ENGINE=lualatex + make testing ENGINE=dvilualatex + make testing ENGINE=xelatex + +5. If one does not have `make`, one can use the following commands, substituting, e.g., `latex`, `xelatex`, `lualatex`, and `dvilualatex` for `pdflatex`: + + pdflatex --interaction=nonstopmode examples + pdflatex --interaction=nonstopmode examples + makeindex -o examples.ind examples.idx + makeindex -o examples.rnd examples.rdx + pdflatex --interaction=nonstopmode examples + pdflatex --interaction=nonstopmode examples + +The use of different extensions for the index results from using the `index` package to generate a persons index separate from a subject index. + +The manual is also a test suite. + +# Copyright + +Copyright (C) 2020 by Charles P. Schaum +------------------------------------------------------- + +This file may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3 +of this license or (at your option) any later version. +The latest version of this license is in: + + [http://www.latex-project.org/lppl.txt](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. + diff --git a/Master/texmf-dist/doc/latex/nameauth/README.txt b/Master/texmf-dist/doc/latex/nameauth/README.txt deleted file mode 100644 index 8a950701179..00000000000 --- a/Master/texmf-dist/doc/latex/nameauth/README.txt +++ /dev/null @@ -1,129 +0,0 @@ -| ---------:| ---------------------------------------------------------------- -nameauth:| Name authority mechanism for consistency in text and index - Author:| Charles P. Schaum - E-mail:| charles dot schaum@comcast.net - License:| Released under the LaTeX Project Public License 1.3c or later - See:| http://www.latex-project.org/lppl.txt - -Short description: - -The nameauth package automates the correct formatting and indexing of names -for professional writing. This aids the use of a name authority and the -editing process without needing to retype name references. - -Files Distribution - -README This file -nameauth.pdf Documentation -examples.tex Some longer example macros from the documentation - -Makefile Automates building with GNU make 3.81 -nameauth.dtx Documented LaTeX file containing both code and documentation - -Manual Installation - -Download the package from - -www.ctan.org/tex-archive/macros/latex/contrib/nameauth - -Unpack nameauth.zip in an appropriate directory. - -If you have a make utility compatible with GNU make, either in -GNU/Linux, a BSD variant, OSX, or Cygwin in Windows you can type - -make inst - -to install the package into your $TEXMFHOME tree or - -make install - -to install the package into your $TEXMFLOCAL tree for all users. -The latter requires sudo privileges. - -Other useful targets include: - -(release process) - -make release The default target, same as just ``make''. - -make clean Removes all intermediate files. Left are -the files listed above plus nameauth.sty. - -make distclean Leave only nameauth.dtx, examples.tex, -and Makefile. - -make zip Generate a zip file ready for distribution. - -(testing process) - -make testing Release files, plus compiles examples.tex. - -make release ENGINE= -Here, can be pdflatex (default), -xelatex, lualatex, dvilualatex, or latex. - -make testing ENGINE= See above. - -It is not necessary, however, to use GNU make. One can generate -the package files manually. Since the files nameauth.ins and README.txt -are contained in the .dtx file itself, the first step is to generate -the installer driver nameauth.ins, plus the file README.txt, which will -also trigger the extraction of nameauth.sty and produce the first pass of -the package documentation nameauth.pdf: - -pdflatex -shell-escape -recorder -interaction=batchmode nameauth.dtx - -Next one adds a table of contents and all cross-references, this also -should finalize page numbers for glossary and index input files: - -pdflatex --recorder --interaction=nonstopmode nameauth.dtx - -The next commands generate the glossary/index output files: - -makeindex -q -s gglo.ist -o nameauth.gls nameauth.glo -makeindex -q -s gind.ist -o nameauth.ind nameauth.idx - -The final two commands integrate the glossary (changes) and index: - -pdflatex --recorder --interaction=nonstopmode nameauth.dtx -pdflatex --recorder --interaction=nonstopmode nameauth.dtx - -Now one can either keep README.txt or rename it to README, e.g.: - -mv README.txt README - -Normally one creates the following directories for a user: - -$TEXMFHOME/source/latex/nameauth dtx file -$TEXMFHOME/tex/latex/nameauth sty file -$TEXMFHOME/doc/latex/nameauth pdf file, README, examples.tex - -and creates the following directories for the local site: - -$TEXMFLOCAL/source/latex/nameauth dtx file -$TEXMFLOCAL/tex/latex/nameauth sty file -$TEXMFLOCAL/doc/latex/nameauth pdf file, README, examples.tex - -The above environment variables often are /usr/local/texlive/texmf-local -and ~/texmf. - -The make process normally renames the README.txt file created from the -dtx file to just README by using mv (move / rename utility in the *nix -userland). Windows distributions of TeX and LaTeX often keep the txt file -because of using file extensions instead of ``magic numbers'' to identify -files. - -Run mktexlsr with the appropriate level of permissions to complete the -install. - -Testing notes: - -See the nameauth manual. - -License - -This material is subject to the LaTeX Project Public License: -http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html - -Happy TeXing! diff --git a/Master/texmf-dist/doc/latex/nameauth/examples.tex b/Master/texmf-dist/doc/latex/nameauth/examples.tex index 105403ef84e..c9e41e6eab9 100644 --- a/Master/texmf-dist/doc/latex/nameauth/examples.tex +++ b/Master/texmf-dist/doc/latex/nameauth/examples.tex @@ -1,20 +1,35 @@ -%--------:| ---------------------------------------------------------------- -%nameauth:| Name authority mechanism for consistency in text and index -% Author:| Charles P. Schaum -% E-mail:| charles dot schaum@comcast.net -% License:| Released under the LaTeX Project Public License 1.3c or later -% See:| http://www.latex-project.org/lppl.txt +%% +%% This is file `examples.tex', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% nameauth.dtx (with options: `examples') +%% +%% This is a generated file. +%% +%% Copyright (C) 2020 by Charles P. Schaum +%% +%% This file may be distributed and/or modified under the conditions of +%% the LaTeX Project Public License, either version 1.3 of this license +%% or (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. +%% + +\documentclass[oneside]{article} % -% This is an example file used with the nameauth package. -% See README and nameauth.pdf for copyright info. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Backward compatibility for older distributions of LaTeX. % -\documentclass[11pt]{article} +% Include the iftex package only if it exists. If the iftex +% package is older than 2019, include additional packages +% that aid using multiple LaTeX engines. % -% This part of the document preamble exists only for backward compatibility in older -% distributions of LaTeX. It includes the iftex package only if it exists. -% If the iftex package is older than 2019, it includes the older packages -% that aid using multiple engines. - \IfFileExists{iftex.sty}{\usepackage{iftex}}{} \unless\ifdefined\RequireTUTeX \usepackage{ifxetex} @@ -22,103 +37,177 @@ \usepackage{ifpdf} \fi % -% This template can be used when creating both dvi and pdf output. We -% do not actually use the tikz package in this example file. We set -% the condition for using tikz with a Boolean flag. -% -% If compatibility with specific dvi viewers is not an issue, then -% one might ignore the use of \ifDoTikZ altogether. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Compatibility for multiple LaTeX engines. % -\newif\ifDoTikZ \ifxetex \usepackage{fontspec} \usepackage{polyglossia} - \setdefaultlanguage{american} % Use own language - \usepackage{tikz} - \DoTikZtrue % Perhaps not needed + \setdefaultlanguage{american} \else \ifluatex \ifpdf \usepackage{fontspec} \usepackage{polyglossia} - \setdefaultlanguage{american} % Use own language - \usepackage{tikz} - \DoTikZtrue % Perhaps not needed + \setdefaultlanguage{american} \else \IfFileExists{utf8-2018.def}{} {\usepackage[utf8]{inputenc}} \usepackage[TS1,T1]{fontenc} - \usepackage[american]{babel} % Use own language + \usepackage[american]{babel} \usepackage{lmodern} -% -% There may be a need to include tikz using luatex in dvi mode; -% that goes beyond the scope of the nameauth package. -% \fi \else \IfFileExists{utf8-2018.def}{} {\usepackage[utf8]{inputenc}} \usepackage[TS1,T1]{fontenc} - \usepackage[american]{babel} % Use own language + \usepackage[american]{babel} \usepackage{lmodern} - \ifpdf % Perhaps not needed - \usepackage{tikz} - \DoTikZtrue % Perhaps not needed - \fi \fi \fi % -% Below are the remainder of package inclusions. -% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Remainder of package inclusions +% +\usepackage[textwidth=137mm,textheight=237mm, + right=25mm,marginparwidth=39mm,nohead]{geometry} \usepackage{booktabs} -\usepackage[textwidth=137mm,textheight=237mm,right=30mm,marginparwidth=30mm,nohead]{geometry} -\usepackage{makeidx} -\usepackage{nameauth} +\usepackage{colortbl} +\usepackage{index} +\usepackage{nameauth}[2020/11/23] \usepackage{verbatim} +\usepackage{xcolor} +\colorlet{grey}{black!7!white} \usepackage[colorlinks=true]{hyperref} % -% We set up indexing, put margin paragraphs on the left, set up the counter for -% line numbering in verbatim environments, and set up \ifNoTag for use in the -% life dates text tagging example. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% We set up indexing, put margin paragraphs on the left, +% and set up the counter for line numbering in verbatim +% environments. % \makeindex +\newindex{per}{rdx}{rnd}{Index of Persons} +\renewcommand\NameauthIndex{\index[per]} \reversemarginpar \newcounter{VerbLine} +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Global definitions of conditionals for examples +% For Scipio Africanus +\newif\ifSkipGens +\newif\ifNoGens +\newif\ifSkipAgnomen +\newif\ifNoAgnomen +% For Thomas Jefferson +\newif\ifGenitive +\newif\ifDoGen +% For George Washington/Mustafa Kemal \newif\ifNoTag +% For William Shakespeare +\newif\ifSpecialFN +\newif\ifSpecialSN +\newif\ifRevertSN +% For advanced hooks +\newif\ifFbox +\newif\ifFirstCap +\newif\ifInHook +\Fboxtrue +\newif\ifCaps % -% We establish name shorthands. Note the heavy use of \noexpand in the macro arguments -% below. This is intrinsic to the proper function of such arguments. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Global definitions of macros for examples +% For Scipio Africanus +\newcommand*\SCIPi{\ifNoGens + Publius\else Publius Cornelius\fi} +\newcommand*\SCIPii{\ifNoAgnomen + Scipio\else Scipio Africanus\fi} +\newcommand*\ScipioOnly{\SkipAgnomentrue\Scipio} +\newcommand*\CSA{\ifNoGens\ifNoAgnomen + Scipio\else + Scipio Africanus\fi + \else\ifNoAgnomen + Cornelius Scipio\else + Cornelius Scipio Africanus\fi\fi} +\ExcludeName[Publius]{\noexpand\CSA} +% For Thomas Jefferson +\newcommand\JEFF{\ifDoGen\textSC{Jefferson's}\else\textSC{Jefferson}\fi} +% For William Shakespeare +\newcommand*\WM{\ifSpecialFN Wm.\else William\fi} +\newcommand*\SHK{\ifRevertSN \textSC{Shakespeare}\else + \ifSpecialSN \noexpand\AltCaps{t}he Bard\else + \textSC{Shakespeare}\fi\fi} +\newcommand*\Revert{\RevertSNtrue} +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% We include a few macros from ltxdoc.cls and doc.sty. +% These are copyright by the LaTeX dev team. +% +\makeatletter +\DeclareRobustCommand\meta[1]{% + \ensuremath\langle + \ifmmode \expandafter \nfss@text \fi + {% + \meta@font@select + \edef\meta@hyphen@restore + {\hyphenchar\the\font\the\hyphenchar\font}% + \hyphenchar\font\m@ne + \language\l@nohyphenation + #1\/% + \meta@hyphen@restore + }\ensuremath\rangle +} +\def\meta@font@select{\itshape} +\def\cmd#1{\cs{\expandafter\cmd@to@cs\string#1}} +\def\cmd@to@cs#1#2{\char\number`#2\relax} +\DeclareRobustCommand\cs[1]{\texttt{\char`\\#1}} +\providecommand\marg[1]{% + {\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}} +\providecommand\oarg[1]{% + {\ttfamily[}\meta{#1}{\ttfamily]}} +\providecommand\parg[1]{% + {\ttfamily(}\meta{#1}{\ttfamily)}} +\makeatother +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% We establish name shorthands. Note the heavy use of \noexpand +% in the macro arguments below. This is intrinsic to the proper +% function of such arguments (advanced alternate formatting). % \begin{nameauth} \< Adams & John & \noexpand\textSC{Adams} & > \< SDJR & Sammy & \noexpand\textSC{Davis}, \noexpand\textSC{Jr}. & > \< Dem & & Demetrius, I & > - \< deSmet & Pierre-Jean & \noexpand\Fbox{\noexpand\AltCaps{d}e Smet} & > + \< deSmet & Pierre-Jean & \noexpand\Fbox{\noexpand\AltCaps{d}e~Smet} & > \< HAR & & Harun, \noexpand\textSC{\noexpand\AltCaps{a}l-Rashid} & > \< Harnack & Adolf & Harnack & > \< Jeff & Thomas & \noexpand\JEFF & > \< Mencius & & \noexpand\textSC{Mencius} & > \< Scipio & \noexpand\SCIPi & \noexpand\SCIPii & > + \< OScipio & Publius & \noexpand\CSA & > \< Shak & \noexpand\WM & \noexpand\SHK & > \< Sutorius & Quintus & \noexpand\SUTOR & > \< Wash & George & Washington & > \end{nameauth} % -% We set up a text tag here, but we will set more up in the body text. +% We could add name info database tags (text tags) either +% in the preamble or in the document environment. We will do +% the latter in this example file. % -\NameAddInfo{Demetrius, I}{ Soter} -% -% Below we establish sort tags for names. Note again the consistent use of \noexpand. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Below we establish sort tags for names. We also can do that +% later on in the body text. Note again the consistent use of +% \noexpand with alternate formatting. % \PretagName[John]{\noexpand\textSC{Adams}}{Adams, John} \PretagName[Sammy]{\noexpand\textSC{Davis}, \noexpand\textSC{Jr}.}{Davis, Sammy, Jr.} \PretagName{Demetrius, I}{Demetrius 1} -\PretagName[Pierre-Jean]{\noexpand\Fbox{\noexpand\AltCaps{d}e Smet}}{de Smet, Pierre-Jean} +\PretagName[Pierre-Jean]{\noexpand\Fbox{\noexpand\AltCaps{d}e~Smet}}{de~Smet, Pierre-Jean} \PretagName{Harun, \noexpand\textSC{\noexpand\AltCaps{a}l-Rashid}}{Harun al-Rashid} \PretagName[Thomas]{\noexpand\JEFF}{Jefferson, Thomas} \PretagName{\noexpand\textSC{Mencius}}{Mencius} \PretagName{\noexpand\textSC{Meng}, Ke}{Meng Ke} \PretagName[\noexpand\SCIPi]{\noexpand\SCIPii}{Scipio Africanus} +\PretagName[Publius]{\noexpand\CSA}{Cornelius Scipio Africanus} \PretagName[Quintus]{\noexpand\SUTOR}{Naevius Sutorius} \PretagName[\noexpand\WM]{\noexpand\SHK}{Shakespeare, William} \PretagName{Vlad, Ţepeş}{Vlad Tepes} @@ -131,6 +220,7 @@ \TagName[Ulysses S.]{Grant}{, president} \TagName[George]{Washington}{, president} % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % We set up line numbering in verbatim environments. % \makeatletter @@ -139,26 +229,28 @@ \newcommand*\ContinueNum{\def\verbatim@processline{\stepcounter{VerbLine}\leavevmode\llap{\footnotesize\normalfont\theVerbLine\quad}\the\verbatim@line\par}} \makeatother % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % The default verbatim format is no line numbers. % We add title, author, and date. % \ClearNum \title{\bfseries Longer Examples} \author{Charles P. Schaum} -\date{2020/02/26} +\date{2020/11/23} \begin{document} \maketitle +\phantomsection +\pdfbookmark[1]{\contentsname}{toc} \tableofcontents -\bigskip - -{\large\bfseries\hyperlink{Index}{Index}} \newpage \section{Particles} -First we use variants with the \(\langle Alternate\rangle\) argument: +First we use variants with the \meta{Alternate} argument: + +\NameAddInfo{Demetrius, I}{ Soter} \begin{quote}\small \StartNum \begin{verbatim} @@ -166,29 +258,40 @@ First we use variants with the \(\langle Alternate\rangle\) argument: \PretagName{Demetrius, I}{Demetrius 1} \TagName{Demetrius, I}{ Soter, king} \begin{nameauth} - \< Dem & & Demetrius, I & > +\< Dem & & Demetrius, I & > \end{nameauth} \end{verbatim} -\smallskip - \begin{tabular}{@{}ll} - \verb+\Dem[I Soter]+ & \Dem[I Soter]\\ - \verb+\LDem+ & \LDem\\ - \verb+\Dem+ & \Dem\\ - \end{tabular} -\end{quote} + \smallskip + \begin{tabular}{ll}\toprule + \cmd{\Dem[I Soter]} & \Dem[I Soter]\\ + \rowcolor{grey}% + \cmd{\LDem} & \LDem\\ + \cmd{\Dem} & \Dem\\\bottomrule + \end{tabular} + \end{quote} \begingroup% -\makeatletter\renewcommand*\NamesFormat[1]{\begingroup% -\protected@edef\temp{\endgroup{#1% -\noexpand\NameQueryInfo[\unexpanded\expandafter{\the\@nameauth@toksa}] -{\unexpanded\expandafter{\the\@nameauth@toksb}} -[\unexpanded\expandafter{\the\@nameauth@toksc}]}}\temp}\makeatother -\noindent For a more automated approach, we use ``text tags'' in the formatting macros: +\makeatletter +\renewcommand*\NamesFormat[1]{% + \begingroup% + \protected@edef\temp{\endgroup% + {#1\noexpand\NameQueryInfo + [\unexpanded\expandafter{\the\@nameauth@toksa}] + {\unexpanded\expandafter{\the\@nameauth@toksb}} + [\unexpanded\expandafter{\the\@nameauth@toksc}]% + }% + }% + \temp% +} +\makeatother +For a more automated approach, we use ``text tags'': + \begin{quote}\small -\makeatletter\ContinueNum\makeatother +\ContinueNum \begin{verbatim} \makeatletter +\makeatletter \renewcommand*\NamesFormat[1]{% \begingroup% \protected@edef\temp{\endgroup% @@ -204,237 +307,275 @@ First we use variants with the \(\langle Alternate\rangle\) argument: \end{verbatim} \smallskip - \begin{tabular}{@{}ll} - \verb+\ForgetThis\Dem+ & \ForgetThis\Dem\\ - \verb+\LDem+ & \LDem\\ - \verb+\Dem+ & \Dem\\ + \begin{tabular}{ll}\toprule + \cmd{\ForgetThis}\cmd{\Dem} & \ForgetThis\Dem\\ + \rowcolor{grey}% + \cmd{\LDem} & \LDem\\ + \cmd{\Dem} & \Dem\\\bottomrule \end{tabular} \end{quote} \endgroup + +\vfil +\noindent And now for something completely different\dots + + We mention the Electric Boogaloo\index{Boogaloo, Electric} + by \Name{Ollie~\& Jerry}.\\ + +\noindent The index references made here will put: + + ``Boogaloo, Electric'' in the main index + + and ``\ShowIdxPageref*{Ollie~\& Jerry}'' in the index of names. \newpage \section{Roman Names} -\begingroup -We want all names in the index, so we define two macros that expand to be one or two components: \textit{praenomen} and \textit{nomen}; \textit{cognomen} and \textit{agnomen}. Below we want to index under the \textit{cognomen}. We begin by defining a name with macros using \verb+\noexpand+ to prevent error: + + We define all macros and conditionals used in naming macro arguments in the preamble. We use \cmd{\noexpand} in the naming macro arguments to prevent error. Since we do not use \cmd{\CapThis} in the examples below, we skip alternate formatting for simplicity, yet we still recommend it: + \begin{quote}\small + \StartNum + \begin{verbatim} \newif\ifSkipGens \newif\ifNoGens \newif\ifSkipAgnomen \newif\ifNoAgnomen -\newcommand*\SCIPi{\ifNoGens Publius\else - Publius Cornelius\fi} -\newcommand*\SCIPii{\ifNoAgnomen Scipio\else - Scipio Africanus\fi} +\newcommand*\SCIPi{\ifNoGens + Publius\else Publius Cornelius\fi} +\newcommand*\SCIPii{\ifNoAgnomen + Scipio\else Scipio Africanus\fi} \newcommand*\ScipioOnly{\SkipAgnomentrue\Scipio} -% -% This form of \NamesFormat produces the longest possible name form in the first mention. -% -\renewcommand*\NamesFormat[1]% - {\ifSkipGens\NoGenstrue\fi\ifSkipAgnomen\NoAgnomentrue\fi#1% - \global\SkipGensfalse\global\SkipAgnomenfalse} -% -% If we always wanted to skip the nomen or agnomen in subsequent references, we could -% force either \NoGenstrue or \NoAgnomentrue in \MainNameHook. The form below is -% neutral to such preferences and thus, one must set them manually. -% -\renewcommand*\MainNameHook[1]% - {\ifSkipGens\NoGenstrue\fi\ifSkipAgnomen\NoAgnomentrue\fi#1% - \global\SkipGensfalse\global\SkipAgnomenfalse} - \begin{quote}\small - \StartNum - \begin{verbatim} \begin{nameauth} \< Scipio & \noexpand\SCIPi & \noexpand\SCIPii & > \end{nameauth} -\PretagName[\noexpand\SCIPi]{\noexpand\SCIPii}{Scipio Africanus} -\end{verbatim} +\PretagName[\noexpand\SCIPi]{\noexpand\SCIPii}{Scipio Africanus}\end{verbatim} \end{quote} - We define the flags and macros by which the name will change. The global state of \verb+\NoGens+ and \verb+\NoAgnomen+ determine the index form. The local scope in the formatting hooks allows changes that are reset when exiting that scope. + We begin a new scope below, redefining the formatting hooks, which affect only names printed in the text. If the local Boolean flags are false, one gets longer name forms. If the flags are true, one gets shorter forms. This approach allows the global state of the flags to be false by default, meaning that one need not remember to set any of them true in the preamble. That results in one less thing to remember, and one less problem to fix. +\begingroup +\renewcommand*\NamesFormat[1] + {\ifSkipGens\NoGenstrue\fi\ifSkipAgnomen\NoAgnomentrue\fi#1% + \global\SkipGensfalse\global\SkipAgnomenfalse} +\renewcommand*\MainNameHook[1] + {\ifSkipGens\NoGenstrue\fi\ifSkipAgnomen\NoAgnomentrue\fi#1% + \global\SkipGensfalse\global\SkipAgnomenfalse} \begin{quote}\small \ContinueNum -\begin{verbatim} -\newif\ifSkipGens -\newif\ifNoGens -\newif\ifSkipAgnomen -\newif\ifNoAgnomen -\newcommand*\SCIPi{\ifNoGens Publius\else - Publius Cornelius\fi} -\newcommand*\SCIPii{\ifNoAgnomen Scipio\else - Scipio Africanus\fi} -\newcommand*\ScipioOnly{\SkipAgnomentrue\Scipio} -\renewcommand*\NamesFormat[1]%^^A + \begin{verbatim} +\renewcommand*\NamesFormat[1] {\ifSkipGens\NoGenstrue\fi\ifSkipAgnomen\NoAgnomentrue\fi#1% \global\SkipGensfalse\global\SkipAgnomenfalse} -\renewcommand*\MainNameHook[1]%^^A +\renewcommand*\MainNameHook[1] {\ifSkipGens\NoGenstrue\fi\ifSkipAgnomen\NoAgnomentrue\fi#1% - \global\SkipGensfalse\global\SkipAgnomenfalse} -\end{verbatim} -\smallskip -\ScipioOnly\ \verb+\ScipioOnly+ was born around 236 \textsc{bc} into the Scipio branch of the Cornelius clan, one of six large patrician clans. \SkipGenstrue\ScipioOnly\ \verb+\SkipGenstrue\ScipioOnly+ rose to fame with his military exploits in Hispania and Africa during the Second Punic War. Thereafter he was known as \SkipGenstrue\Scipio\ \verb+\SkipGenstrue\Scipio+. + \global\SkipGensfalse\global\SkipAgnomenfalse}\end{verbatim} \end{quote} - - The index entry is fairly lengthy by necessity, governed by the global state of the Boolean flags, and expanding to: -\begin{quote} - \texttt{\ShowIdxPageref[\noexpand\SCIPi]{\noexpand\SCIPii}} -\end{quote} -% -% We can keep the redefined formatting macros above. -% -If we want to index under the \textit{nomen}, we take a slightly different approach: + The index always shows the name determined by the global state of \cmd{\NoGens} and \cmd{\NoAgnomen}, which we set up as false, meaning a maximally long name form. In the body text we have: + \begin{quote}\small + \ForgetThis\ScipioOnly\ \cmd{\ScipioOnly} was born around 236 \textsc{bc} into the Scipio branch of the Cornelius clan, one of six large patrician clans. \ScipioOnly\ \cmd{\ScipioOnly} rose to military fame during the Second Punic War. Thereafter he was known as \Scipio\ \cmd{\Scipio}. + \end{quote} + + Below we show more information about popular name forms by way of comparison with scholarly name forms.\medskip + + The \textit{Oxford Classical Dictionary} and other scholarly sources index according to the \textit{nomen}. That approach moves the \textit{nomen} from \meta{FNN} to \meta{SNN}. + + The two methods do not clash \textit{per se} in the text, but they make incompatible index entries. In this case, since we have indexed \ScipioOnly\ under the popular form above, we use \cmd{\ExcludeName} to exclude the scholarly form below. + + In the document preamble we define the following Boolean flags and macros. We use a nested conditional in \meta{SNN}. The default still is to show all names so that they can be indexed that way: \begin{quote}\small \StartNum \begin{verbatim} +\newif\ifSkipGens % These flags remain the same as above. +\newif\ifNoGens +\newif\ifSkipAgnomen +\newif\ifNoAgnomen +\global\def\CSA{\ifNoGens\ifNoAgnomen + Scipio\else + Scipio Africanus\fi + \else\ifNoAgnomen + Cornelius Scipio\else + Cornelius Scipio Africanus\fi\fi} +\ExcludeName[Publius]{\noexpand\CSA} \begin{nameauth} - \< Sutorius & Quintus & \noexpand\SUTOR & > + \< OScipio & Publius & \noexpand\CSA & > % O for Oxford \end{nameauth} -\PretagName[Quintus]{\noexpand\SUTOR}{Naevius Sutorius} -\newcommand*\SUTOR{\ifNoGens - \ifNoAgnomen - Sutorius\else - Sutorius Macro\fi - \else\ifNoAgnomen - Naevius Sutorius\else - Naevius Sutorius Macro\fi\fi} -\end{verbatim} -\end{quote} -\newcommand*\SUTOR{\ifNoGens - \ifNoAgnomen - Sutorius\else - Sutorius Macro\fi - \else\ifNoAgnomen - Naevius Sutorius\else - Naevius Sutorius Macro\fi\fi} - -\verb+\Sutorius +\Sutorius +\PretagName[Publius]{\noexpand\CSA}{Cornelius Scipio Africanus}\end{verbatim} + \end{quote} -\verb+\SkipGenstrue\Sutorius +\SkipGenstrue\Sutorius + We keep the same formatting macros that we defined above. By the way, these formatting macros could work with regular names as well as Roman names, e.g., \LDem, because they have no side effects. + + The scholarly form of Roman names has a different name pattern, so it is not compatible with the popular version. Nevertheless, we show what the index entries would be in a normal \LaTeX\ document without hyperlinks: + \begin{quote}\small\IndexActual{@} + \textbf{Simplified Name Patterns:}\\ + Scholarly: \texttt{\ShowPattern[Publius]{\noexpand\CSA}}\\ + \setbox0\hbox{Scholarly:}\hbox to \wd0{Popular:\hfill} \texttt{\ShowPattern[\noexpand\SCIPi]{\noexpand\SCIPii}}\\ + + \textbf{Full Index Entries:} + \UntagName[Publius]{\noexpand\CSA} + \UntagName[\noexpand\SCIPi]{\noexpand\SCIPii}\\ + Scholarly:\\ \hbox{}\quad\texttt{\ShowIdxPageref[Publius]{\noexpand\CSA}}\\ + Popular:\\ \hbox{}\quad\texttt{\ShowIdxPageref[\noexpand\SCIPi]{\noexpand\SCIPii}} + \TagName[Publius]{\noexpand\CSA}{\string|hyperpage} + \TagName[\noexpand\SCIPi]{\noexpand\SCIPii}{\string|hyperpage}\\ + + \textbf{Basic Index Entries:}\\ + \UntagName[Publius]{\noexpand\CSA} + Scholarly:\\ \hbox{}\quad\ShowIdxPageref*[Publius]{\noexpand\CSA}\\ + Popular:\\ \hbox{}\quad\ShowIdxPageref*[\noexpand\SCIPi]{\noexpand\SCIPii} + \end{quote} -\endgroup + Below we compare some differences between the scholarly and popular forms, and how to get equivalent forms in the text while understanding that they would be two separate forms in the index. + \begin{center}\small + \begin{tabular}{p{0.51\textwidth}@{\ \ }l} + \multicolumn{2}{l}{\textbf{First use:}}\\ + scholarly:\dotfill \cmd{\OScipio} & \OScipio\\ + popular:\dotfill \cmd{\Scipio} & \ForgetThis\Scipio\\[2ex] + + \multicolumn{2}{l}{\textbf{Subsequent use:}}\\ + scholarly:\dotfill \cmd{\OScipio} & \OScipio\\ + scholarly:\dotfill \cmd{\SkipGenstrue}\cmd{\OScipio} & \SkipGenstrue\OScipio\\ + popular:\dotfill \cmd{\Scipio} & \SkipGenstrue\Scipio\\[2ex] + + \multicolumn{2}{l}{\textbf{Subsequent use, full, no \textit{agnomen}:}}\\ + scholarly:\dotfill \cmd{\SkipAgnomentrue}\cmd{\LOScipio} & \SkipAgnomentrue\LOScipio\\ + popular:\dotfill \cmd{\SkipAgnomentrue}\cmd{\LScipio} & \SkipAgnomentrue\LScipio\\[2ex] + + \multicolumn{2}{l}{\textbf{Subsequent use, shortest forms:}}\\ + scholarly:\dotfill \cmd{\SkipAgnomentrue}\cmd{\OScipio} & \SkipAgnomentrue\OScipio\\ + \hfill\cmd{\SkipGenstrue}\cmd{\SkipAgnomentrue}\cmd{\OScipio} & \SkipGenstrue\SkipAgnomentrue\OScipio\\ + popular:\dotfill \cmd{\SkipAgnomentrue}\cmd{\Scipio\ } & \SkipAgnomentrue\Scipio\\[2ex] + + \multicolumn{2}{l}{\textbf{Subsequent use, personal name:}}\\ + scholarly:\dotfill \cmd{\SOScipio} & \SOScipio\\ + popular:\dotfill \cmd{\SScipio} & \SScipio\\ + popular:\dotfill \cmd{\SkipGenstrue}\cmd{\SScipio} & \SkipGenstrue\SScipio + \end{tabular} + \end{center} + \endgroup \newpage -\section{Alternate Formatting: Inflections} +\section{Inflected Name Forms} -In this section we use a scope to contain \verb+\AltFormatActive+ as we show how to implement a simple grammatical inflection. Notice the similarities between handling the Roman names above and the grammatical inflections below this points to a general method when introducing variations into the name macro arguments, while keeping index entries consistent. - -\begingroup\AltFormatActive -\newif\ifGenitive -\newif\ifDoGen -\renewcommand*\NamesFormat[1] - {\ifGenitive\DoGentrue\fi#1\global\Genitivefalse} -\renewcommand*\MainNameHook[1] - {\ifGenitive\DoGentrue\fi\AltOff#1\global\Genitivefalse} -\newcommand\JEFF{\ifDoGen\textSC{Jefferson's}\else\textSC{Jefferson}\fi} -\begin{quote}\small -\StartNum -\begin{verbatim} -\newif\ifGenitive -\newif\ifDoGen -\renewcommand*\NamesFormat[1] - {\ifGenitive\DoGentrue\fi#1\global\Genitivefalse} -\renewcommand*\MainNameHook[1] - {\ifGenitive\DoGentrue\fi\AltOff#1\global\Genitivefalse} +\begingroup +Below we use alternate formatting, sort index entries, and set up a cross-reference, then redefine the hook macros locally. +\AltFormatActive + \renewcommand*\NamesFormat[1]{\ifGenitive\DoGentrue\fi#1\global\Genitivefalse} + \renewcommand*\MainNameHook[1]{\ifGenitive\DoGentrue\fi\AltOff#1\global\Genitivefalse} + \begin{quote}\small + \StartNum + \begin{verbatim} \begin{nameauth} - \< Jeff & Thomas & \noexpand\JEFF & > + \< Jeff & Thomas & \noexpand\JEFF & > \end{nameauth} \PretagName[Thomas]{\noexpand\JEFF}{Jefferson, Thomas} \TagName[Thomas]{\noexpand\JEFF}{, president} -\newcommand\JEFF{\ifDoGen\textSC{Jefferson's}\else - \textSC{Jefferson}\fi} +\renewcommand*\NamesFormat[1] + {\ifGenitive\DoGentrue\fi#1\global\Genitivefalse} +\renewcommand*\MainNameHook[1] + {\ifGenitive\DoGentrue\fi\AltOff#1\global\Genitivefalse} -Consider \Genitivetrue\Jeff\ influence. More on \Jeff\ later. +Consider \Genitivetrue\Jeff\ legacy. More on \Jeff\ later. \Genitivetrue\Jeff\ reputation has declined in recent decades. \end{verbatim} -\smallskip -Consider \Genitivetrue\Jeff\ legacy. More on \Jeff\ later. -\Genitivetrue\Jeff\ reputation has declined in recent decades. -\end{quote} + \smallskip + Consider \Genitivetrue\Jeff\ legacy. More on \Jeff\ later. + \Genitivetrue\Jeff\ reputation has declined in recent decades. + \end{quote} +\AltFormatInactive +\endgroup \newpage - -\section{Continental Format Reference Work} +\section{Example Reference Work} -Let us create a macro for entries in a reference work using the basic form of Continental formatting. +Below we use alternate formatting, sort index entries, set up a cross-reference, and define a reference article macro: -\begin{quote}\small - \StartNum - \begin{verbatim} \AltFormatActive \PretagName[Greta]{\textSC{Garbo}}{Garbo, Greta} +\PretagName{\textSC{Misora}, Hibari}{Misora Hibari} \PretagName[Heinz]{\textSC{Rühmann}}{Ruehmann, Heinz} \PretagName[Heinrich Wilhelm]{\textSC{Rühmann}}% {Ruehmann, Heinrich Wilhelm} - -\newcommand{\RefArticle}[4]{% +\IndexRef[Heinrich Wilhelm]{\textSC{Rühmann}}% + {\textSC{Rühmann}, Heinz}% +\newcommand{\RefArticle}[3]{% \def\check{#2}% \ifx\check\empty - \noindent\ForgetThis#1\ {#4} + \noindent\ForgetThis#1\ #3 \else - \noindent\ForceName#1\ ``\ForceName#2'' - \ForceName#3\ {#4} + \noindent\ForgetThis#1\ #2\ #3 \fi } -\end{verbatim} -\end{quote} - +\begin{quote}\small +\StartNum +\begin{verbatim} +\AltFormatActive \PretagName[Greta]{\textSC{Garbo}}{Garbo, Greta} +\PretagName{\textSC{Misora}, Hibari}{Misora Hibari} \PretagName[Heinz]{\textSC{Rühmann}}{Ruehmann, Heinz} \PretagName[Heinrich Wilhelm]{\textSC{Rühmann}}% {Ruehmann, Heinrich Wilhelm} -\newcommand{\RefArticle}[4]{% +\IndexRef[Heinrich Wilhelm]{\textSC{Rühmann}}% + {\textSC{Rühmann}, Heinz}% +\newcommand{\RefArticle}[3]{% \def\check{#2}% \ifx\check\empty - \noindent\ForgetThis#1\ {#4} + \noindent\ForgetThis#1\ #3 \else - \noindent\ForceName#1\ ``\ForceName#2'' - \ForceName#3\ {#4} + \noindent\ForgetThis#1\ #2\ #3 \fi } -\verb+\RefArticle+ either formats the name from the first argument and appends the fourth argument, ignoring the others if the second is empty, or it formats the first three arguments and appends the fourth. We determine what those arguments mean by including specific naming macros. +\end{verbatim} +\end{quote} + +\cmd{\RefArticle} prints only the first and third arguments if the second is empty, else it prints all three. We determine what those arguments mean by including specific naming macros. That includes using \cmd{\RevComma} for Western names, but not for Eastern ones. + \begin{quote}\small - \ContinueNum - \begin{verbatim} -\RefArticle% - {\Name[Greta]{\textSC{Garbo}}}% - {}{}% +\ContinueNum +\begin{verbatim} +\RefArticle + {\RevComma\Name[Greta]{\textSC{Garbo}}} + {} {(18 September 1905\,--\,15 April 1990) was a Swedish film actress during the 1920s and 1930s.} -\RefArticle% - {% - \IndexRef[Heinrich Wilhelm]{\textSC{Rühmann}}% - {\textSC{Rühmann}, Heinz}% - \SubvertThis\FName[Heinrich Wilhelm]{\textSC{Rühmann}}% - }% - {\SubvertThis\FName[Heinz]{\textSC{Rühmann}}}% - {\Name[Heinz]{\textSC{Rühmann}}}% +\RefArticle + {\Name{\textSC{Misora}, Hibari}} + {} + {(W: ``\RevName\Name*{\textSC{Misora}, Hibari}''; + 29 May 1937\,--\,24 June 1989) was a Japanese singer + and actress noted for her positive message.} + +\RefArticle + {\RevComma\Name[Heinrich Wilhelm]{\textSC{Rühmann}}} + {``\SubvertThis\ForceName\FName[Heinz]{\textSC{Rühmann}}''} {(7 March 1902\,--\,3 October 1994) was a German actor in over 100 films.} - \AltFormatInactive \end{verbatim} \end{quote} -\begin{quote} -\RefArticle% - {\Name[Greta]{\textSC{Garbo}}}% - {}{}% +\begin{quote}\small +\RefArticle + {\RevComma\Name[Greta]{\textSC{Garbo}}} + {} {(18 September 1905\,--\,15 April 1990) was a Swedish film actress during the 1920s and 1930s.} -\RefArticle% - {% - \IndexRef[Heinrich Wilhelm]{\textSC{Rühmann}}% - {\textSC{Rühmann}, Heinz}% - \SubvertThis\FName[Heinrich Wilhelm]{\textSC{Rühmann}}% - }% - {\SubvertThis\FName[Heinz]{\textSC{Rühmann}}}% - {\Name[Heinz]{\textSC{Rühmann}}}% +\RefArticle + {\Name{\textSC{Misora}, Hibari}} + {}% + {(W: ``\RevName\Name*{\textSC{Misora}, Hibari}''; + 29 May 1937\,--\,24 June 1989) was a Japanese singer + and actress noted for her positive message.} + +\RefArticle + {\RevComma\Name[Heinrich Wilhelm]{\textSC{Rühmann}}} + {``\SubvertThis\ForceName\FName[Heinz]{\textSC{Rühmann}}''} {(7 March 1902\,--\,3 October 1994) was a German actor in over 100 films.} \end{quote} -\endgroup + +\AltFormatInactive \newpage \section{Beamer MWE} @@ -453,8 +594,7 @@ One must use the macros that control and detect names, otherwise name forms will \begin{itemize}\footnotesize \item<1-> Original\ForgetName[George]{Washington}% \ForgetName[George]{Washington's}\\ - \Name[Martin]{Van Buren} changes - after the first overlay. + This version of \Name[Ulysses S.]{Grant} changes. \begin{enumerate} \item<2-> \IfMainName[George]{Washington's}{He}% {\Name[George]{Washington}} @@ -468,7 +608,7 @@ One must use the macros that control and detect names, otherwise name forms will \end{enumerate} \item<1-> Reordered\ForgetName[George]{Washington}% \ForgetName[George]{Washington's}\\ - \ForgetThis\Name[Ulysses S.]{Grant} + This version of \ForgetThis\Name[Ulysses S.]{Grant} does not change. \begin{enumerate} \item<3-> \IfMainName[George]{Washington}{His}% @@ -487,7 +627,6 @@ One must use the macros that control and detect names, otherwise name forms will \end{document} \end{verbatim} \IndexName[George]{Washington} -\IndexName[Martin]{Van Buren} \IndexName[Ulysses S.]{Grant} \end{quote} @@ -497,30 +636,29 @@ The overlays, numbered progressively from one to three, begin by deleting name c \section{Hooks: Intro} \label{sec:Hooksi} -Something more complex than a font switch can occur in \verb+\NamesFormat+. Below we put the first mention of a name in boldface, with a margin note, if possible. +Here we show that something more complex than a font switch can occur in \cmd{\NamesFormat}. Below we put the first mention of a name in boldface, along with a marginal notation if possible. \begin{quote}\small \StartNum \begin{verbatim} \let\OldFormat\NamesFormat \renewcommand*\NamesFormat[1]{\textbf{#1}\unless\ifinner - \marginpar{\raggedleft\scriptsize #1}\fi} -\let\NamesFormat\OldFormat + \marginpar{\raggedleft\scriptsize #1}\fi} \PretagName{Vlad, Ţepeş}{Vlad Tepes} % for accented names -\TagName{Vlad, II}{ Dracul} % for index information +\TagName{Vlad, II}{ Dracul} % for index information \TagName{Vlad, III}{ Dracula} \end{verbatim} -Within the document after the preamble:\vspace{-\medskipamount}% -\let\OldFormat\NamesFormat% +\medskip Within the document after the preamble: +\let\OldFormat\NamesFormat \renewcommand*\NamesFormat[1]{\textbf{#1}\unless\ifinner - \marginpar{\raggedleft\scriptsize #1}\fi}% + \marginpar{\raggedleft\scriptsize #1}\fi} \ContinueNum -\begin{verbatim} -\Name{Vlad, III}[III Dracula], known as +\begin{verbatim}\Name{Vlad, III}[III Dracula], known as \AKA{Vlad III}{Vlad, Ţepeş} (the Impaler) after his death, was the son of \Name{Vlad, II}[II Dracul], a member of the Order of the Dragon. Later references to -``\Name*{Vlad, III}'' and ``\Name{Vlad, III}'' appear thus.\end{verbatim} +``\Name*{Vlad, III}'' and ``\Name{Vlad, III}'' appear thus. +\end{verbatim} \Name{Vlad, III}[III Dracula], known as \AKA{Vlad III}{Vlad, Ţepeş} (the Impaler) @@ -529,55 +667,50 @@ a member of the Order of the Dragon. Later references to ``\Name*{Vlad, III}'' and ``\Name{Vlad, III}'' appear thus. \let\NamesFormat\OldFormat -\begin{verbatim}\let\NamesFormat\OldFormat -\end{verbatim} +\begin{verbatim}\let\NamesFormat\OldFormat\end{verbatim} \end{quote} - -Now we have reverted to the default \verb+\NamesFormat+ and we get: +Now we have reverted to the default \cmd{\NamesFormat} and we get: \begin{itemize} - \item \verb+\ForgetThis\Name{Vlad, III}[III Dracula]+\dotfill \ForgetThis\Name{Vlad, III}[III Dracula] - \item \verb+\Name*{Vlad, III}+\dotfill \Name*{Vlad, III} - \item \verb+\Name{Vlad, III}+\dotfill \Name{Vlad, III} + \item \cmd{\ForgetThis}\cmd{\Name\{Vlad, III\}[III Dracula]}\dotfill \ForgetThis\Name{Vlad, III}[III Dracula] + \item \cmd{\Name*\{Vlad, III\}}\dotfill \Name*{Vlad, III} + \item \cmd{\Name\{Vlad, III\}}\dotfill \Name{Vlad, III} \end{itemize} - -We also set up the cross-reference \verb+\IndexRef{Dracula}{Vlad III}+\IndexRef{Dracula}{Vlad III}. +We also set up the cross-reference \cmd{\IndexRef\{Dracula\}\{Vlad III\}}\IndexRef{Dracula}{Vlad III}. \newpage \section{Hooks: Life Dates} \label{sec:Hooksii} -Here we add name conditionals and ``text tags'' to add information to names when desired. The example \verb+\NamesFormat+ below adds a text tag to the first occurrences of main-matter names. It uses internal macros of \verb+\@nameauth@Name+. To prevent errors, the Boolean values \texttt{\textbackslash if@nameauth@InName} and \texttt{\textbackslash if@nameauth@InAKA} are true only within the scope of \verb+\@nameauth@Name+ and \verb+\AKA+ respectively. +\begingroup +Here we add name conditionals and ``text tags'' to add information to names when desired. The example \cmd{\NamesFormat} below adds a text tag to the first occurrences of main-matter names. -Below we use the three token registers available in \textsf{nameauth} to use the name conditional macros. In \verb+\AKA+ these token registers are copies of the \textbf{last} three arguments, corresponding to the pseudonym. We assume that we will not be using the \texttt{alwaysformat} option, meaning that we only call this hook once for a first use of \verb+\AKA+. We also use a different formatting for the naming macros on the one hand and \verb+\AKA+ on the other: +Below we use the three token registers available in \textsf{nameauth} to use the name conditional macros. In \cmd{\AKA} these token registers are copies of the \textbf{last} three arguments, corresponding to the pseudonym. We assume that we will not be using the \texttt{alwaysformat} option, meaning that we only call this hook once for a first use of \cmd{\AKA}. We also use a different formatting for the naming macros on the one hand and \cmd{\AKA} on the other: +The first use of a name is in small caps. Text tags are in boldface with naming macros, and roman with \cmd{\AKA}. Just because we set up a cross-reference does not mean that we have to use \cmd{\AKA}. We use \cmd{\ForceName} as needed with \cmd{\AKA}. In the document preamble we set up the following: \begin{quote}\small \StartNum \begin{verbatim} -\newif\ifNoTag% allows us to work around \ForgetName -\let\OldFormat\NamesFormat -\let\OldFrontFormat\FrontNamesFormat +\newif\ifNoTag \makeatletter \renewcommand*\NamesFormat[1]{\begingroup% - \protected@edef\temp{\endgroup\textsc{#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 - {\normalfont\noexpand\NameQueryInfo - [\unexpanded\expandafter{\the\@nameauth@toksa}] - {\unexpanded\expandafter{\the\@nameauth@toksb}} - [\unexpanded\expandafter{\the\@nameauth@toksc}]}\fi - \fi}\temp\global\NoTagfalse% + \protected@edef\temp{\endgroup\textsc{#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 + {\normalfont\noexpand\NameQueryInfo + [\unexpanded\expandafter{\the\@nameauth@toksa}] + {\unexpanded\expandafter{\the\@nameauth@toksb}} + [\unexpanded\expandafter{\the\@nameauth@toksc}]}\fi + \fi}\temp\global\NoTagfalse% } \makeatother \let\FrontNamesFormat\NamesFormat \end{verbatim} \end{quote} -\let\OldFormat\NamesFormat% -\let\OldFrontFormat\FrontNamesFormat% -\makeatletter% +\makeatletter \renewcommand*\NamesFormat[1]{\begingroup% \protected@edef\temp{\endgroup\textsc{#1}% \unless\ifNoTag @@ -593,10 +726,12 @@ Below we use the three token registers available in \textsf{nameauth} to use the [\unexpanded\expandafter{\the\@nameauth@toksc}]}\fi \fi}\temp\global\NoTagfalse}% \makeatother +\let\FrontNamesFormat\NamesFormat -We print tags in the first use hooks unless \verb+\NoTag+ is set true. Please note that the conditional path here is placed within the \verb+\edef+. Putting it outside the \verb+\edef+, such as \verb+\unless\ifNoTag\temp\fi+, will cause errors. This method uses the $\epsilon$-\TeX{} primitives \verb+\noexpand+ and \verb+\unexpanded+ to avoid repetition of \verb+\expandafter+. +We print tags in the first use hooks unless \cmd{\NoTag} is set true. This method uses the two \(\epsilon\)-\TeX{} primitives \cmd{\noexpand} and \cmd{\unexpanded} to avoid repetition of \cmd{\expandafter}. Since \textsf{nameauth} depends on \textsf{etoolbox}, we assume \(\epsilon\)-\TeX. -Before we can refer to any text tags, we must create them. Using the approach above, we must include a leading space in the text tags. The leading space is needed only when a text tag appears. We also set up a cross-reference: +Before we can refer to any text tags, we must create them. Using the approach above, we include a leading space in the text tags. The leading space is needed only when a text tag appears.\footnote{Another way to add that space is to put it in the conditional path of the formatting hook and leave it out of the text tags entirely: \dots\texttt{\{ \}}\cmd{\noexpand}\cmd{\NameQueryInfo}\dots} +We also set up a cross-reference, which we will use regardless of whether we also use \cmd{\AKA}. The cross-reference will be created only once and skipped thereafter: \begin{quote}\small \ContinueNum \begin{verbatim} @@ -610,25 +745,27 @@ Before we can refer to any text tags, we must create them. Using the approach ab \NameAddInfo[Mustafa]{Kemal}{ (1881--1938)} \NameAddInfo{Atatürk}{ (in 1934, a special surname)} \IndexRef{Atatürk}{Kemal, Mustafa} +\pagebreak -Now we begin with the first example, where the name is in small caps, while the dates are in boldface because we use a naming macro. This formatting is used only to show the different decision paths: -\newpage - +Now we begin with the first example, which, after all the setup, looks deceptively simple, but highly reusable without extra work: \begin{quote}\small \ContinueNum \begin{verbatim} -\ForgetThis\Wash held office 1789--97.\\ +\ForgetThis\Wash held office 1789--97. No tags: \Wash.\\ -First use, dates suppressed: \NoTagtrue\ForgetThis\Wash. +First use, dates suppressed: \NoTagtrue\ForgetThis\Wash.\\ +Subsequent use with format and dates: \ForceName\Wash. \end{verbatim} \smallskip \ForgetThis\Wash\ held office 1789--97.\\ No tags: \Wash.\\ -First use, dates suppressed: \NoTagtrue\ForgetThis\Wash. +First use, dates suppressed: \NoTagtrue\ForgetThis\Wash.\\ +Subsequent use with format and dates: \ForceName\Wash. \end{quote} -Since we already set up a cross-reference with \verb+\IndexRef+, we can use the naming macros with ``Atatürk'' and get the desired formatting without any page references: +Since we already set up a cross-reference with \cmd{\IndexRef}, we can use just the the naming macros with ``Atatürk'' and get the desired formatting without any page references in the index: + \begin{quote}\small \ContinueNum \begin{verbatim} @@ -649,7 +786,7 @@ First use, no tag: \NoTagtrue\ForgetThis\Name{Atatürk}. \end{quote} -Since we set up distinct formatting (\verb+\normalfont+ instead of boldface) for name tags and cross-reference tags, we now simulate the \texttt{formatAKA} package option and use \verb+\ForceName+ with \verb+\AKA+: +Since we set up distinct formatting for \cmd{\AKA} (\cmd{\normalfont} instead of boldface for text tags associated with cross-references), we now simulate the \texttt{formatAKA} package option and use \cmd{\ForceName} with \cmd{\AKA}: \begin{quote}\small \ContinueNum \begin{verbatim} @@ -675,16 +812,16 @@ First use, no tag: We show an alternate part of this example on the next page that does not appear in the manual, but works identically to that above. \newpage -We change the look of the page reference just to see if it works: +We change the look of the page reference just to see if it works. Since we are in a local scope, note the use of \cmd{\global}: \begin{quote}\small \ContinueNum \begin{verbatim} -\def\fett#1{\textbf{\sffamily #1}} +\global\def\fett#1{\textbf{\sffamily #1}} \TagName[Mustafa]{Kemal}{|fett} \end{verbatim} \end{quote} -\def\fett#1{\textbf{\sffamily #1}} +\global\def\fett#1{\textbf{\sffamily #1}} \TagName[Mustafa]{Kemal}{|fett} This version does not use $\epsilon$-\TeX primitives. We ``forget'' names as needed and replay the text on the previous page with the new version: @@ -744,14 +881,14 @@ This version does not use $\epsilon$-\TeX primitives. We ``forget'' names as nee \end{verbatim} \smallskip -With \verb+\Name+:\\ +With \cmd{\Name}:\\ \ForgetThis\Name[Mustafa]{Kemal} was granted the name \ForgetThis\Name{Atatürk}. We mention \Name[Mustafa]{Kemal} and \Name{Atatürk} again. First use, no tag: \NoTagtrue\ForgetThis\Name{Atatürk}.\bigskip -With \verb+\AKA+:\\ +With \cmd{\AKA}:\\ \makeatletter\@nameauth@AKAFormattrue\makeatother \ForgetThis\Name[Mustafa]{Kemal} was granted the name \ForceName\AKA[Mustafa]{Kemal}{Atatürk}. We mention @@ -760,72 +897,30 @@ With \verb+\AKA+:\\ First use, no tag: \NoTagtrue\ForceName\AKA[Mustafa]{Kemal}{Atatürk}. \end{quote} -\begin{quote}\small -\ContinueNum -\begin{verbatim} -\let\NamesFormat\OldFormat -\let\FrontNamesFormat\OldFrontFormat -\end{verbatim} -\end{quote} -\let\NamesFormat\OldFormat -\let\FrontNamesFormat\OldFrontFormat +Now we end the scope. +\endgroup \newpage \section{Hooks: Advanced} \label{sec:Hooksiii} -We start alternate formatting in a new scope with \verb+\AltFormatActive+. The scope ends just before the index is printed. \AltFormatActive +In this section we invoke \cmd{\AltFormatActive} and create several scopes containing respective examples. Some macros in this section normally should be defined in a document preamble. We define them locally and ensure that names do not use them when they are undefined. This is not best practices, but it makes sense for this manual's need for multiple redefinitions. -\begin{center}\bfseries Continental Format\end{center} - -\noindent Here we look in greater detail at how \textsf{nameauth} implements the advanced version of Continental formatting. Font changes in both text and the index occur with the short macros \verb+\textSC+, \verb+\textIT+, \verb+\textBF+, and \verb+\textUC+. Since they all look similar to \verb+\textSC+, we just show this one macro from the package source: +\begin{center}\bfseries Continental Format: User-Defined\end{center} +\phantomsection +\begingroup +The user must implement this final step. We use \cmd{\AltFormatActive}, then redefine \cmd{\MainNameHook} to have small caps on by default in the index and first uses in the text, then off in subsequent uses in the text: \begin{quote}\small \StartNum \begin{verbatim} -\newcommand*\textSC[1]{% - \if@nameauth@DoAlt\textsc{#1}\else#1\fi -} -\end{verbatim} -\end{quote} - -We plan to have small caps on by default, then off in subsequent uses. We therefore use \verb+\AltFormatActive+ for the ``always on'' general condition, then redefine \verb+\MainNameHook+ because it is the subsequent use. We use \verb+\AltOff+ to suppress formatting. It works only in the formatting hooks. \verb+\AltOff+ toggles an internal flag that deactivates any changes: -\begin{quote}\small -\ContinueNum -\begin{verbatim} -\newcommand*\AltOff{% - \if@nameauth@InHook\@nameauth@DoAltfalse\fi -} -\end{verbatim} -\end{quote} - -Since the normal effects of \verb+\CapThis+ are disabled, \verb+\AltCaps+ does the job by capitalizing its argument in braces \texttt{\{~\}} when it is used in a macro hook and triggered by \verb+\CapThis+. The source looks like: -\begin{quote}\small -\ContinueNum -\begin{verbatim} -\newcommand*\AltCaps[1]{% - \if@nameauth@InHook - \if@nameauth@DoCaps\MakeUppercase{#1}\else#1\fi - \else#1\fi -} -\end{verbatim} -\end{quote} - -It is important that these macros not expand too soon. We therefore must put \verb+\noexpand+ once before \verb+\textSC+, etc., and once before \verb+\AltCaps+. This is because the name arguments in \textsf{nameauth} have to use \verb+\protected@edef+ to work consistently in different document classes. - -Before we alter the formatting hooks, we either can \verb+\let+ the hook macros to recall them later or we can use \verb+\begingroup+ and \verb+\endgroup+ to create a new scope that localizes any changes. We use scoping in this section. - -The final step \textbf{does not come} from the \textsf{nameauth} source. We must redefine the formatting hooks ourselves. One of the simplest ways to do this when using the \texttt{altformat} option or \verb+\AltFormatActive+ is: -\begin{quote}\small -\ContinueNum -\begin{verbatim} \renewcommand*\MainNameHook{\AltOff} \let\FrontNameHook\MainNameHook \end{verbatim} \end{quote} +\renewcommand*\MainNameHook{\AltOff} +\let\FrontNameHook\MainNameHook -\renewcommand*\MainNameHook{\AltOff}\let\FrontNameHook\MainNameHook -Use \verb+\let\FrontNamesFormat\MainNameHook+ to suppress formatting in the front matter. -Continental formatting usually alters at least one element in the required name argument, as we see below: +Usually, we set up the names and any related macros in the preamble: \begin{quote}\small \ContinueNum \begin{verbatim} @@ -840,7 +935,7 @@ Continental formatting usually alters at least one element in the required name \end{verbatim} \end{quote} -Now we must ensure that these names are sorted properly in the index. When sorting names, be sure to use \verb+\noexpand+ before the control sequences in the macro arguments so they expand at the proper time: +Likewise in the preamble, we must ensure that these names are sorted properly in the index. When sorting names, be sure to use \cmd{\noexpand} as well: \begin{quote}\small \ContinueNum \begin{verbatim} @@ -856,59 +951,46 @@ Now we must ensure that these names are sorted properly in the index. When sorti \begin{center} \small\noindent\begin{tabular}{llll}\toprule -First & Next & Long & Short \\\midrule -\verb+\Adams+ & \verb+\Adams+ & \verb+\LAdams+ & \verb+\SAdams+\\ -\Adams & \Adams & \LAdams & \SAdams\\\midrule -\verb+\SDJR+ & \verb+\SDJR+ & \verb+\LSDJR+ & \verb+\SSDJR+\\ -\SDJR & \SDJR & \LSDJR & \SSDJR\\\midrule -\verb+\HAR+ & \verb+\HAR+ & \verb+\LHAR+ & \verb+\SHAR+\\ -\HAR & \HAR & \LHAR & \SHAR\\\midrule -\verb+\Mencius+ & \verb+\Mencius+ & \verb+\LMencius+ & \verb+\SMencius+\\ -\Mencius & \Mencius & \LMencius & \SMencius\\\bottomrule + First & Next & Long & Short \\\midrule + \cmd{\Adams} & \cmd{\Adams} & \cmd{\LAdams} & \cmd{\SAdams}\\ + \Adams & \Adams & \LAdams & \SAdams\\ + \rowcolor{grey}\cmd{\SDJR} & \cmd{\SDJR} & \cmd{\LSDJR} & \cmd{\SSDJR}\\ + \rowcolor{grey}\SDJR & \SDJR & \LSDJR & \SSDJR\\ + \cmd{\HAR} & \cmd{\HAR} & \cmd{\LHAR} & \cmd{\SHAR}\\ + \HAR & \HAR & \LHAR & \SHAR\\ + \rowcolor{grey}\cmd{\Mencius} & \cmd{\Mencius} & \cmd{\LMencius} & \cmd{\SMencius}\\ + \rowcolor{grey}\Mencius & \Mencius & \LMencius & \SMencius\\\bottomrule \end{tabular} -\end{center}\bigskip +\end{center} -Debugging tests: +\begin{itemize}\small + \item Punctuation detection works: \ForceName\LSDJR. Also \LSDJR. Then \ForceName\SDJR. Now \SDJR. (We used \cmd{\ForceName} for formatting.) + \item \cmd{\ForceName}\cmd{\DropAffix}\cmd{\LSDJR} gives \ForceName\DropAffix\LSDJR. Just \cmd{\DropAffix}\cmd{\LSDJR} gives \DropAffix\LSDJR. + \item \cmd{\RevComma}\cmd{\LAdams} yields \RevComma\LAdams. All the reversing macros work. + \item \cmd{\ForceName}\cmd{\ForceFN}\cmd{\SHAR} produces \ForceName\ForceFN\SHAR. \cmd{\ForceFN}\cmd{\SHAR} produces \ForceFN\SHAR. If we add \cmd{\CapThis} we get \CapThis\ForceName\ForceFN\SHAR\ and \CapThis\ForceFN\SHAR. + \item One must include all the macros in the name arguments. +\end{itemize} +\makeatletter\@nameauth@AKAFormattrue\makeatother +With the \texttt{formatAKA} option we refer to \Mencius\ as \AKA{\noexpand\textSC{Mencius}}{\noexpand\textSC{Meng}, Ke} and \AKA{\noexpand\textSC{Mencius}}{\noexpand\textSC{Meng}, Ke}: \begin{quote}\small -\StartNum +\ContinueNum \begin{verbatim} -\ShowPattern[John]{\noexpand\textSC{Adams}} -\ShowPattern[Sammy]{\noexpand\textSC{Davis}, \noexpand\textSC{Jr}.} -\ShowPattern{Harun, \noexpand\textSC{\noexpand\AltCaps{a}l-Rashid}} -\ShowPattern{\noexpand\textSC{Mencius}} -\ShowIdxPageref[John]{\noexpand\textSC{Adams}} -\ShowIdxPageref[Sammy]{\noexpand\textSC{Davis}, \noexpand\textSC{Jr}.} -\ShowIdxPageref{Harun, \noexpand\textSC{\noexpand\AltCaps{a}l-Rashid}} -\ShowIdxPageref{\noexpand\textSC{Mencius}} +\PretagName{\noexpand\textSC{Meng}, Ke}{Meng Ke} +\AKA{\noexpand\textSC{Mencius}}{\noexpand\textSC{Meng}, Ke} \end{verbatim} \end{quote} - -\begin{center} -\footnotesize\begin{tabular}{ll}\toprule -First & \verb+\ShowPattern+ \\\midrule -\ForgetThis\Adams & \ShowPattern[John]{\noexpand\textSC{Adams}}\\ -\ForgetThis\SDJR & \ShowPattern[Sammy]{\noexpand\textSC{Davis}, \noexpand\textSC{Jr}.}\\ -\ForgetThis\HAR & \ShowPattern{Harun, \noexpand\textSC{\noexpand\AltCaps{a}l-Rashid}}\\ -\ForgetThis\Mencius & \ShowPattern{\noexpand\textSC{Mencius}}\\\bottomrule -\end{tabular}\bigskip - -\begin{tabular}{llll}\toprule -First & \verb+\ShowIdxPageref+ & \verb+\ShowIdxPageref*+\\\midrule -\ForgetThis\Adams & \ShowIdxPageref[John]{\noexpand\textSC{Adams}} & \ShowIdxPageref*[John]{\noexpand\textSC{Adams}}\\ -\ForgetThis\SDJR & \ShowIdxPageref[Sammy]{\noexpand\textSC{Davis}, \noexpand\textSC{Jr}.} & \ShowIdxPageref*[Sammy]{\noexpand\textSC{Davis}, \noexpand\textSC{Jr}.}\\ -\ForgetThis\HAR & \ShowIdxPageref{Harun, \noexpand\textSC{\noexpand\AltCaps{a}l-Rashid}} & \ShowIdxPageref*{Harun, \noexpand\textSC{\noexpand\AltCaps{a}l-Rashid}} \\ -\ForgetThis\Mencius & \ShowIdxPageref{\noexpand\textSC{Mencius}} & \ShowIdxPageref*{\noexpand\textSC{Mencius}}\\\bottomrule -\end{tabular} -\end{center} - -\newpage +\makeatletter\@nameauth@AKAFormatfalse\makeatother +\endgroup \begin{center}\bfseries Rolling Your Own: Basic\end{center} +\phantomsection +\begingroup +Here we set out on the path to custom formatting by using package features that have been implemented already. When redesigning formatting hooks, we recommend using \cmd{\AltFormatActive} or the \texttt{altformat} option to enable alternate formatting and prevent \cmd{\CapThis} from breaking custom formatting macros. -\noindent When redesigning formatting hooks, one often uses \verb+\AltFormatActive+ or the \texttt{altformat} option to enable alternate formatting and prevent \verb+\CapThis+ from breaking custom formatting macros. +We recommend examining the internal package flag \cmd{\@nameauth@DoAlt}, which activates alternate formatting, \cmd{\@nameauth@DoCaps}, which handles capitalization, and finally \cmd{\@nameauth@InHook}, which is true when the formatting hooks are called. If you create your own macros, they will look similar. -We recommend examining the internal package flag \verb+\@nameauth@DoAlt+, which activates alternate formatting, \verb+\@nameauth@DoCaps+, which handles capitalization, and \verb+\@nameauth@InHook+, which is true when the formatting hooks are called. Custom macros tend to look like: +Normally we define a macro for use in name arguments in the document preamble in order to ensure that it is always defined: \begin{quote}\small \StartNum \begin{verbatim} @@ -925,7 +1007,7 @@ We recommend examining the internal package flag \verb+\@nameauth@DoAlt+, which } \makeatother -Since \verb+\AltCaps+ is part of \textsf{nameauth}, you need not reinvent that wheel. Just use it. The final step is redefining the hooks, which can be as simple as: +Since \cmd{\AltCaps} is part of \textsf{nameauth}, you need not reinvent that wheel. Just use it. The final step is redefining the hooks, which can be as simple as: \begin{quote}\small \ContinueNum \begin{verbatim} @@ -933,87 +1015,91 @@ Since \verb+\AltCaps+ is part of \textsf{nameauth}, you need not reinvent that w \let\FrontNameHook\MainNameHook \end{verbatim} \end{quote} +\renewcommand*\MainNameHook{\AltOff} +\let\FrontNameHook\MainNameHook -When sorting names, be sure to use \verb+\noexpand+ before the control sequences in the macro arguments so they expand at the proper time: +When sorting names, be sure to use \cmd{\noexpand} as shown previously: \begin{quote}\small \ContinueNum \begin{verbatim} -\PretagName[Pierre-Jean]% - {\noexpand\Fbox{\noexpand\AltCaps{d}e Smet}}% - {de Smet, Pierre-Jean} - \begin{nameauth} \< deSmet & Pierre-Jean & - \noexpand\Fbox{\noexpand\AltCaps{d}e Smet} & > + \noexpand\Fbox{\noexpand\AltCaps{d}e~Smet} & > \end{nameauth} + +\PretagName[Pierre-Jean]% + {\noexpand\Fbox{\noexpand\AltCaps{d}e~Smet}}% + {de~Smet, Pierre-Jean} \end{verbatim} \end{quote} Now we show how the formatting hooks work in the body text. One can check the index to see that it is formatted properly and consistently. -\begin{center}\footnotesize -\begin{tabular}{llll}\toprule -First & Next & Long & Short \\\midrule -\verb+\deSmet+ & \verb+\deSmet+ & \verb+\LdeSmet+ & \verb+\SdeSmet+\\ -\deSmet & \deSmet & \LdeSmet & \SdeSmet\\ -& \verb+\CapThis+ & \verb+\ForceName+ & \\ -& \CapThis\deSmet & \ForceName\LdeSmet & \\\bottomrule +\begin{center}\small +\begin{tabular}{rll}\toprule + First & \cmd{\deSmet} & \deSmet\\ + \rowcolor{grey}Next & \cmd{\deSmet} & \deSmet\\ + Long & \cmd{\LdeSmet} & \LdeSmet\\ + \rowcolor{grey}Short & \cmd{\SdeSmet} & \SdeSmet\\ + & \cmd{\CapThis}\cmd{\deSmet} & \CapThis\deSmet\\ + \rowcolor{grey} & \cmd{\ForceName}\cmd{\CapThis}\cmd{\deSmet} & \ForceName\CapThis\deSmet\\\bottomrule \end{tabular} -\end{center}\smallskip -\newpage +\end{center} -\begin{center}\bfseries Rolling Your Own: Intermediate\end{center} +With \cmd{\CapThis}\cmd{\deSmet}: \CapThis\deSmet. \cmd{\ForceName}\cmd{\CapThis}\cmd{\deSmet}: \ForceName\CapThis\deSmet.\medskip -\noindent We begin by defining a name composed only of macros: +Some formatting, such as the use of \cmd{\textSC}, is fairly standard. Other formatting, such as \cmd{\Fbox} above, is ornamental and may be handled better with custom features, but those features appear only in the text. +\endgroup + +\begin{center}\bfseries Rolling Your Own: Intermediate\end{center} +\phantomsection \begingroup -\newif\ifSpecialFN -\newif\ifSpecialSN -\newif\ifRevertSN -\newcommand*\WM{\ifSpecialFN Wm.\else William\fi} -\newcommand*\SHK{\ifRevertSN \textSC{Shakespeare}\else - \ifSpecialSN \noexpand\AltCaps{t}he Bard\else - \textSC{Shakespeare}\fi\fi} -\newcommand*\Revert{\RevertSNtrue} +``Intermediate'' and ``advanced'' refer to the way that formatting hooks were designed before version 3.1. The user-accessible \cmd{\NameParser} builds a printed name from the internal, locally-scoped macros \cmd{\FNN}, \cmd{\SNN}, \cmd{\rootb} and \cmd{\suffb}. + +We create a hook that can ignore the output of \cmd{\@nameauth@Name}, which is the \texttt{\#1} in the hook dispatcher's code \cmd{\bgroup}\meta{Hook}\texttt{\{\#1\}}\cmd{\egroup}: +\begin{quote}\small + \cmd{\renewcommand*}\meta{FirstHook}\texttt{[1]\{\dots}\cmd{\NameParser}\texttt{\dots\}} +\end{quote} + +With the \texttt{altformat} option or \cmd{\AltFormatActive} we can design a subsequent-use hook that deactivates formatting inside of it: +\begin{quote}\small + \cmd{\renewcommand*}\meta{SubsequentHook}\texttt{[1]\{\dots}\cmd{\AltOff}\cmd{\NameParser}\texttt{\dots\}} +\end{quote} + +If we used \cmd{\AltFormatActive*}, where the formatting macros are enabled, but deactivated, then we might want a hook that activates the macros: +\begin{quote}\small + \cmd{\renewcommand*}\meta{Hook}\texttt{[1]\{\dots}\cmd{\AltOn}\cmd{\NameParser}\texttt{\dots\}} +\end{quote} + \makeatletter \renewcommand*\NamesFormat[1]{% - \RevertSNfalse\SpecialFNfalse\SpecialSNfalse#1% - \unless\ifinner\marginpar{% - \footnotesize\raggedleft% - \@nameauth@FullNametrue% - \@nameauth@FirstNamefalse% - \@nameauth@EastFNfalse% - \SpecialFNtrue\SpecialSNfalse% - \NameParser}% - \fi\global\RevertSNfalse} + \RevertSNfalse\SpecialFNfalse\SpecialSNfalse#1% + \unless\ifinner\marginpar{% + \footnotesize\raggedleft% + \@nameauth@FullNametrue% + \@nameauth@FirstNamefalse% + \@nameauth@EastFNfalse% + \SpecialFNtrue\SpecialSNfalse% + \NameParser}% + \fi\global\RevertSNfalse} \renewcommand*\MainNameHook[1]{% - \AltOff\SpecialFNfalse\SpecialSNtrue#1% - \unless\ifinner - \unless\ifRevertSN - \marginpar{% - \footnotesize\raggedleft% - \@nameauth@FullNamefalse% - \@nameauth@FirstNamefalse% - \@nameauth@EastFNfalse% - \SpecialFNfalse\SpecialSNfalse% - \NameParser}% - \fi - \fi\global\RevertSNfalse} + \AltOff\SpecialFNfalse\SpecialSNtrue#1% + \unless\ifinner + \unless\ifRevertSN + \marginpar{% + \footnotesize\raggedleft% + \@nameauth@FullNamefalse% + \@nameauth@FirstNamefalse% + \@nameauth@EastFNfalse% + \SpecialFNfalse\SpecialSNfalse% + \NameParser}% + \fi + \fi\global\RevertSNfalse} \makeatother +We begin in the document preamble by defining a series of conditionals and macros whose default expansion produces the index entry, yet whose other expansions occur only in the formatting hooks. Then we create a name that is composed only of macros, using \cmd{\noexpand} with \cmd{\WM} and \cmd{\SHK}. We use \cmd{\PretagName} to sort the names. \cmd{\Revert} is used to print a last name without a margin note. \begin{quote}\small \StartNum \begin{verbatim} -\begin{nameauth} - \< Shak & \noexpand\WM & \noexpand\SHK & > -\end{nameauth} -\PretagName[\noexpand\WM]{\noexpand\SHK}{Shakespeare, William} -\PretagName[Robert]{\textSC{Burns}}{Burns, Robert} -\end{verbatim} -\end{quote} - -Now we define the flags by which the macros \verb+\WM+ and \verb+\SHK+ can change inside of the formatting macros, and the different values the macros can have: -\begin{quote}\small -\ContinueNum -\begin{verbatim} \newif\ifSpecialFN \newif\ifSpecialSN \newif\ifRevertSN @@ -1021,92 +1107,91 @@ Now we define the flags by which the macros \verb+\WM+ and \verb+\SHK+ can chang \newcommand*\SHK{\ifRevertSN \textSC{Shakespeare}\else \ifSpecialSN \noexpand\AltCaps{t}he Bard\else \textSC{Shakespeare}\fi\fi} -\newcommand\Revert{\RevertSNtrue} -\makeatletter +\newcommand*\Revert{\RevertSNtrue} + +\begin{nameauth} + \< Shak & \noexpand\WM & \noexpand\SHK & > +\end{nameauth} + +\PretagName[\noexpand\WM]{\noexpand\SHK}{Shakespeare, William} +\PretagName[Robert]{\textSC{Burns}}{Burns, Robert} \end{verbatim} \end{quote} -Finally, we define the formatting hooks that execute these changes: +Below we define the two formatting hooks that structure the ways in which these macros can expand when printed in the text. \cmd{\NamesFormat} allows only the canonical name via \cmd{\RevertSNfalse}, \cmd{\SpecialFNfalse}, and \cmd{\SpecialSNfalse}. We print the canonical name in the body text. If allowed, we print a margin paragraph with an alternate full name using \cmd{\NameParser} and two flags. Both hooks set \cmd{\RevertSNfalse} so that \cmd{\Revert} works on a per-name basis. The subsequent-use hook disables formatting with \cmd{\AltOff}, but it allows variant forms. + \begin{quote}\small \ContinueNum \begin{verbatim} +\makeatletter \renewcommand*\NamesFormat[1]{% - \RevertSNfalse\SpecialFNfalse\SpecialSNfalse#1% - \unless\ifinner\marginpar{% - \footnotesize\raggedleft% - \@nameauth@FullNametrue% - \@nameauth@FirstNamefalse% - \@nameauth@EastFNfalse% - \SpecialFNtrue\SpecialSNfalse% - \NameParser}% - \fi\global\RevertSNfalse} -\end{verbatim} - -\begin{verbatim} + \RevertSNfalse\SpecialFNfalse\SpecialSNfalse#1% + \unless\ifinner\marginpar{% + \footnotesize\raggedleft% + \@nameauth@FullNametrue% + \@nameauth@FirstNamefalse% + \@nameauth@EastFNfalse% + \SpecialFNtrue\SpecialSNfalse% + \NameParser}% + \fi\global\RevertSNfalse} \renewcommand*\MainNameHook[1]{% - \AltOff\SpecialFNfalse\SpecialSNtrue#1% - \unless\ifinner - \unless\ifRevertSN - \marginpar{% - \footnotesize\raggedleft% - \@nameauth@FullNamefalse% - \@nameauth@FirstNamefalse% - \@nameauth@EastFNfalse% - \SpecialFNfalse\SpecialSNfalse% - \NameParser}% - \fi - \fi\global\RevertSNfalse} + \AltOff\SpecialFNfalse\SpecialSNtrue#1% + \unless\ifinner + \unless\ifRevertSN + \marginpar{% + \footnotesize\raggedleft% + \@nameauth@FullNamefalse% + \@nameauth@FirstNamefalse% + \@nameauth@EastFNfalse% + \SpecialFNfalse\SpecialSNfalse% + \NameParser}% + \fi + \fi\global\RevertSNfalse} \makeatother \end{verbatim} \smallskip -\Shak\ (\verb+\Shak+) is the national poet of England in much the same way as \Name[Robert]{\textSC{Burns}} (\verb+\Name[Robert]{\textSC{Burns}}+) is that of Scotland. With the latter's rise of influence in the 1800s, \Revert\Shak\ (\verb+\Revert+\verb+\Shak+) became known as ``\Shak'' (\verb+\Shak+). +\Shak\ \cmd{\Shak} is the national poet of England in much the same way that \Name[Robert]{\textSC{Burns}} \cmd{\Name[Robert]\{}\cmd{\textSC\{Burns\}\}} is that of Scotland. With the latter's rise of influence in the 1800s, \Revert\Shak\ \cmd{\Revert}\cmd{\Shak} became known as ``\Shak'' \cmd{\Shak}. \end{quote} \endgroup -First, we establish macros \verb+\WM+ and \verb+\SHK+ in name arguments using \verb+\noexpand+. That will make the index work properly. We use \verb+\PretagName+ to sort the names. Since we need to make some name decisions, we set up three Boolean values. One is for \verb+\WM+ and two are for variations within \verb+\SHK+. The macro \verb+\Revert+ is used to print a canonical last name without a margin note. - -In the first-use hook above, we prevent any form except the canonical name via \verb+\RevertSNfalse\SpecialFNfalse\SpecialSNfalse+. The default global state is set by \verb+\AltFormatActive+, so we do not need to modify that. We then print the canonical name in the body text. If not in inner horizontal mode, we print a margin paragraph containing a full name. Yet with \verb+\NameParser+ we print a special form of the personal name with the canonical form of the surname. Both hooks globally set \verb+\RevertSNfalse+ because we want \verb+\Revert+ used on a per-name basis. - -The subsequent-use hook uses \verb+\AltOff+ to disable formatting within the hook. Here we do not allow special forenames but we do select special surname forms. Thus, ``the Bard'' will be selected instead of ``Shakespeare''. Yet if we call \verb+\Revert+, we get ``Shakespeare'' in the text, but no margin note. -\newpage - \begin{center}\bfseries Rolling Your Own: Advanced\end{center} - -\newif\ifFbox -\newif\ifFirstCap -\newif\ifInHook -\Fboxtrue -We create three flags. We set \texttt{\textbackslash ifFbox} true; it replaces \texttt{\textbackslash @nameauth@DoAlt}. \texttt{\textbackslash ifFirstCap} replaces \texttt{\textbackslash @nameauth@DoCaps}, which is set by \verb+\CapThis+. The flag \texttt{\textbackslash ifInHook} replaces \texttt{\textbackslash @nameauth@InHook}, which normally is enabled by the internal format hook dispatcher. +\phantomsection +\begingroup +Here is how formatting hooks were designed before version 3.0. Updating older hooks may be helpful, but is not necessary. We do not use the internal package macros. We only use \cmd{\NameParser} in the hooks to produce output. We still recommend using \cmd{\AltFormatActive} to mitigate errors. In the preamble, three flags replace package internals.\footnote{The internal flag \texttt{\textbackslash @nameauth@DoAlt} activates formatting, \cmd{\CapThis} sets \texttt{\textbackslash @nameauth@DoCaps} true, and \texttt{\textbackslash @nameauth@InHook} is set by the hook dispatcher.} +Setting \texttt{\textbackslash Fboxtrue} is equivalent to using \cmd{\AltFormatActive}: \begin{quote}\small \StartNum \begin{verbatim} -\newif\ifFbox -\newif\ifFirstCap -\newif\ifInHook +\newif\ifFbox% Replaces \@nameauth@DoAlt +\newif\ifFirstCap% Replaces \@nameauth@DoCaps +\newif\ifInHook% Replaces \@nameauth@InHook \Fboxtrue \end{verbatim} \end{quote} -\renewcommand*\Fbox[1]{\ifFbox\protect\fbox{#1}\else#1\fi} -The formatting macro is like what we have seen, except it refers to \texttt{\textbackslash ifFbox}: +\newcommand*\Fbox[1]{\ifFbox\protect\fbox{#1}\else#1\fi} +Also in the preamble, the formatting macro is like what we have seen, except it refers to \texttt{\textbackslash ifFbox}:\footnote{We define \cmd{\Fbox} locally because it has multiple definitions, but are very careful where we use names with it.} \begin{quote}\small \ContinueNum \begin{verbatim} -\renewcommand*\Fbox[1]{% +\newcommand*\Fbox[1]{% \ifFbox\protect\fbox{#1}\else#1\fi } \end{verbatim} \end{quote} -\renewcommand*\AltCaps[1]{\ifInHook - \ifFirstCap\MakeUppercase{#1}\else#1\fi - \else - #1\fi} -Our new \verb+\AltCaps+ works like the built-in version, except it does not use the internal macros and flags: -\begin{quote}\small -\ContinueNum -\begin{verbatim} +\renewcommand*\AltCaps[1]{% + \ifInHook + \ifFirstCap\MakeUppercase{#1}\else#1\fi + \else + #1% + \fi +} +Our new \cmd{\AltCaps} works like the built-in version, except it does not use the internal macros and flags: + \begin{quote}\small + \ContinueNum + \begin{verbatim} \renewcommand*\AltCaps[1]{% \ifInHook \ifFirstCap\MakeUppercase{#1}\else#1\fi @@ -1119,12 +1204,12 @@ Our new \verb+\AltCaps+ works like the built-in version, except it does not use \renewcommand*\CapThis{\FirstCaptrue} \renewcommand*\NamesFormat[1] -{\InHooktrue\NameParser\global\FirstCapfalse} + {\InHooktrue\NameParser\global\FirstCapfalse} \renewcommand*\MainNameHook[1] -{\Fboxfalse\InHooktrue\NameParser\global\FirstCapfalse} + {\Fboxfalse\InHooktrue\NameParser\global\FirstCapfalse} \let\FrontNamesFormat\Namesformat \let\FrontNameHook\MainNameHook -Here we redefine \verb+\CapThis+ to use our flag instead of the internal flag: +Here we redefine \cmd{\CapThis} to use our flag instead of the internal flag: \begin{quote}\small \ContinueNum \begin{verbatim} @@ -1132,27 +1217,21 @@ Here we redefine \verb+\CapThis+ to use our flag instead of the internal flag: \end{verbatim} \end{quote} -We have to reproduce the logic and macros that the package would have provided. That means defining everything, including \verb+\NamesFormat+, from scratch: +We have to reproduce the logic and macros that the package would have provided. That means defining everything, including \cmd{\NamesFormat}, from scratch: \begin{quote}\small \ContinueNum \begin{verbatim} \renewcommand*\NamesFormat[1] -{% - \InHooktrue\NameParser% - \global\FirstCapfalse% -} + {\InHooktrue\NameParser\global\FirstCapfalse} \end{verbatim} \end{quote} -Changes to \texttt{\textbackslash ifInHook} (default false) and \texttt{\textbackslash ifFbox} (default true) are local to the scope in which the hook macros are called. \texttt{\textbackslash ifFirstCap} must be \verb+\global+ in order to work correctly. Instead of using just \verb+\AltOff+ before \verb+\NameParser+ below, we have mimic the functions of the internal flags: +Changes to \texttt{\textbackslash ifInHook} (default false) and \texttt{\textbackslash ifFbox} (default true) are local to the scope in which the hook macros are called. \texttt{\textbackslash ifFirstCap} must be set globally. Below we reproduce the logic of \cmd{\AltOff} before \cmd{\NameParser}: \begin{quote}\small \ContinueNum \begin{verbatim} \renewcommand*\MainNameHook[1] -{% - \Fboxfalse\InHooktrue\NameParser% - \global\FirstCapfalse% -} +{\Fboxfalse\InHooktrue\NameParser\global\FirstCapfalse} \end{verbatim} \end{quote} @@ -1165,127 +1244,102 @@ We avoid spurious index entries in the front matter by using the same hooks. \end{verbatim} \end{quote} -Because we use \verb+\noexpand+, our ``old-style'' macros will index the name below under the same entry as the ``new-style'' macros. -\begin{center}\footnotesize -\begin{tabular}{llll}\toprule -First & Next & Long & Short \\\midrule -\verb+\deSmet+ & \verb+\deSmet+ & \verb+\LdeSmet+ & \verb+\SdeSmet+\\ -\ForgetThis\deSmet & \deSmet & \LdeSmet & \SdeSmet\\ -& \verb+\CapThis+ & \verb+\ForceName+ & \\ -& \CapThis\deSmet & \ForceName\LdeSmet & \\\bottomrule +Because we use \cmd{\noexpand}, our ``old-style'' macros will index the following names under the same entry as the ``new-style'' macros. +\begin{center}\small +\begin{tabular}{rll}\toprule + First & \cmd{\deSmet} & \ForgetThis\deSmet\\ + \rowcolor{grey}Next & \cmd{\deSmet} & \deSmet\\ + Long & \cmd{\LdeSmet} & \LdeSmet\\ + \rowcolor{grey}Short & \cmd{\SdeSmet} & \SdeSmet\\ + & \cmd{\CapThis}\cmd{\deSmet} & \CapThis\deSmet\\ + \rowcolor{grey} & \cmd{\ForceName}\cmd{\CapThis}\cmd{\deSmet} & \ForceName\CapThis\deSmet\\\bottomrule \end{tabular} -\end{center}\smallskip +\end{center} -We can reuse new-style names (above) with old-style macros when needed. We reinstate alternate formatting: -\AltFormatActive +With \cmd{\CapThis}\cmd{\deSmet}: \CapThis\deSmet. \cmd{\ForceName}\cmd{\CapThis}\cmd{\deSmet}: \ForceName\CapThis\deSmet.\medskip -\newif\ifCaps -\Capstrue -\begin{quote}\small -\StartNum -\begin{verbatim} -\newif\ifFCaps -\newif\ifFirstCap -\newif\ifInHook +We can reuse new-style names with old-style macros, shown below in abbreviated fashion. We keep the flags \texttt{\textbackslash ifFirstCap} and \texttt{\textbackslash ifInHook}. We also keep the redefined \cmd{\AltCaps}, \cmd{\CapThis}, and \cmd{\NamesFormat}. We then add: \Capstrue -\end{verbatim} -\end{quote} - -We redefine the other macros: \renewcommand*\textSC[1]{% \ifCaps\textsc{#1}\else#1\fi } -\renewcommand*\AltCaps[1]{% - \ifInHook - \ifFirstCap\MakeUppercase{#1}\else#1\fi - \else - #1% - \fi -} -\renewcommand\CapThis{\FirstCaptrue} -\renewcommand*\NamesFormat[1] -{% - \InHooktrue\NameParser\InHookfalse% - \global\FirstCapfalse% -} \renewcommand*\MainNameHook[1] {% - \Capsfalse\InHooktrue\NameParser\InHookfalse% - \global\FirstCapfalse\Capstrue% + \Capsfalse\InHooktrue\NameParser% + \global\FirstCapfalse% } -\let\FrontNamesFormat\Namesformat \let\FrontNameHook\MainNameHook \begin{quote}\small -\ContinueNum +\StartNum \begin{verbatim} +\newif\ifCaps +\Capstrue \renewcommand*\textSC[1]{% \ifCaps\textsc{#1}\else#1\fi } - -\renewcommand*\AltCaps[1]{% - \ifInHook - \ifFirstCap\MakeUppercase{#1}\else#1\fi - \else - #1% - \fi -} - -\renewcommand\CapThis{\FirstCaptrue} - -\renewcommand*\NamesFormat[1] -{% - \InHooktrue\NameParser\InHookfalse% - \global\FirstCapfalse% -} - \renewcommand*\MainNameHook[1] {% - \Capsfalse\InHooktrue\NameParser\InHookfalse% - \global\FirstCapfalse\Capstrue% + \Capsfalse\InHooktrue\NameParser% + \global\FirstCapfalse% } - -\let\FrontNamesFormat\Namesformat \let\FrontNameHook\MainNameHook \end{verbatim} \end{quote} -The names below have the same declarations and index entries as they did above. They look and work the same but use different macros. +The names below have the same declarations and index entries as they did above. They look and work the same but use different back-end macros: \begin{center} \small\noindent\begin{tabular}{llll}\toprule -First & Next & Long & Short \\\midrule -\ForgetThis\Adams & \Adams & \LAdams & \SAdams\\ -\ForgetThis\SDJR & \SDJR & \LSDJR & \SSDJR\\ -\ForgetThis\HAR & \HAR & \LHAR & \SHAR\\ -\ForgetThis\Mencius & \Mencius & \LMencius & \SMencius\\\bottomrule + First & Next & Long & Short \\\midrule + \ForgetThis\Adams & \Adams & \LAdams & \SAdams\\ + \rowcolor{grey}\ForgetThis\SDJR & \SDJR & \LSDJR & \SSDJR\\ + \ForgetThis\HAR & \HAR & \LHAR & \SHAR\\ + \rowcolor{grey}\ForgetThis\Mencius & \Mencius & \LMencius & \SMencius\\\bottomrule \end{tabular} \end{center} -\section{Feature Redesign} +\begin{itemize}\small + \item Punctuation detection works: \ForceName\LSDJR. Also \LSDJR. Then \ForceName\SDJR. Now \SDJR. (We used \cmd{\ForceName} for formatting.) + \item \cmd{\ForceName}\cmd{\DropAffix}\cmd{\LSDJR} gives \ForceName\DropAffix\LSDJR. Just \cmd{\DropAffix}\cmd{\LSDJR} gives \DropAffix\LSDJR. + \item \cmd{\RevComma}\cmd{\LAdams} yields \RevComma\LAdams. All the reversing macros work. + \item \cmd{\ForceName}\cmd{\ForceFN}\cmd{\SHAR} produces \ForceName\ForceFN\SHAR. \cmd{\ForceFN}\cmd{\SHAR} produces \ForceFN\SHAR. If we add \cmd{\CapThis} we get \CapThis\ForceName\ForceFN\SHAR\ and \CapThis\ForceFN\SHAR. +\end{itemize} + +We now close the scope of this current example and resume normal formatting. +\endgroup +\AltFormatInactive +\newpage + +\section{Customization} +Assuming that redefining hooks and adding control sequences is insufficient, one could redesign the core name macros partially or wholly, then hook those modifications into the \textsf{nameauth} package without needing to patch the style file itself. + +All these macros are set by default to \cmd{\@nameauth@Name}, the internal name parser. \cmd{\Name}, or an unmodified shorthand, calls \cmd{\NameauthName}. \cmd{\Name*}, or an L-shorthand, sets \cmd{\@nameauth@FullNametrue}, then calls \cmd{\NameauthLName}. \cmd{\FName}, or an S-shorthand, sets \cmd{\@nameauth@FirstNametrue}, then calls \cmd{\NameauthFName}. One should not modify \cmd{\Name} and \cmd{\FName} directly. + +We use features of \textsf{xargs}. Below we introduce formatting that is additional to, inter-operative with, yet distinct from the formatting hooks: \begin{quote}\small \StartNum \begin{verbatim} \makeatletter \newcommandx*\MyName[3][1=\@empty, 3=\@empty]{% - \@nameauth@toksa\expandafter{#1}% - \@nameauth@toksb\expandafter{#2}% - \@nameauth@toksc\expandafter{#3}% + \global\@nameauth@toksa\expandafter{#1}% + \global\@nameauth@toksb\expandafter{#2}% + \global\@nameauth@toksc\expandafter{#3}% \hbox to 4em{Normal: \hfill}% - \fbox{\@nameauth@Name[#1]{#2}[#3]}% + \fcolorbox{black}{gray!25!white}{\@nameauth@Name[#1]{#2}[#3]}% } \newcommandx*\MyLName[3][1=\@empty, 3=\@empty]{% - \@nameauth@toksa\expandafter{#1}% - \@nameauth@toksb\expandafter{#2}% - \@nameauth@toksc\expandafter{#3}% + \global\@nameauth@toksa\expandafter{#1}% + \global\@nameauth@toksb\expandafter{#2}% + \global\@nameauth@toksc\expandafter{#3}% \hbox to 4em{Long: \hfill}% - \fbox{\@nameauth@Name[#1]{#2}[#3]}% + \fcolorbox{black}{green!25!white}{\@nameauth@Name[#1]{#2}[#3]}% } \newcommandx*\MyFName[3][1=\@empty, 3=\@empty]{% - \@nameauth@toksa\expandafter{#1}% - \@nameauth@toksb\expandafter{#2}% - \@nameauth@toksc\expandafter{#3}% + \global\@nameauth@toksa\expandafter{#1}% + \global\@nameauth@toksb\expandafter{#2}% + \global\@nameauth@toksc\expandafter{#3}% \hbox to 4em{Short: \hfill}% - \fbox{\@nameauth@Name[#1]{#2}[#3]}% + \fcolorbox{black}{yellow!25!white}{\@nameauth@Name[#1]{#2}[#3]}% } \makeatother \renewcommand*\NamesFormat[1] @@ -1295,50 +1349,50 @@ First & Next & Long & Short \\\midrule \renewcommand*\NameauthLName{\MyLName} \renewcommand*\NameauthFName{\MyFName} \end{verbatim} + \makeatletter \newcommandx*\MyName[3][1=\@empty, 3=\@empty]{% - \@nameauth@toksa\expandafter{#1}% - \@nameauth@toksb\expandafter{#2}% - \@nameauth@toksc\expandafter{#3}% + \global\@nameauth@toksa\expandafter{#1}% + \global\@nameauth@toksb\expandafter{#2}% + \global\@nameauth@toksc\expandafter{#3}% \hbox to 4em{Normal: \hfill}% - \fbox{\@nameauth@Name[#1]{#2}[#3]}% + \fcolorbox{black}{gray!25!white}{\@nameauth@Name[#1]{#2}[#3]}% } \newcommandx*\MyLName[3][1=\@empty, 3=\@empty]{% - \@nameauth@toksa\expandafter{#1}% - \@nameauth@toksb\expandafter{#2}% - \@nameauth@toksc\expandafter{#3}% + \global\@nameauth@toksa\expandafter{#1}% + \global\@nameauth@toksb\expandafter{#2}% + \global\@nameauth@toksc\expandafter{#3}% \hbox to 4em{Long: \hfill}% - \fbox{\@nameauth@Name[#1]{#2}[#3]}% + \fcolorbox{black}{green!25!white}{\@nameauth@Name[#1]{#2}[#3]}% } \newcommandx*\MyFName[3][1=\@empty, 3=\@empty]{% - \@nameauth@toksa\expandafter{#1}% - \@nameauth@toksb\expandafter{#2}% - \@nameauth@toksc\expandafter{#3}% + \global\@nameauth@toksa\expandafter{#1}% + \global\@nameauth@toksb\expandafter{#2}% + \global\@nameauth@toksc\expandafter{#3}% \hbox to 4em{Short: \hfill}% - \fbox{\@nameauth@Name[#1]{#2}[#3]}% + \fcolorbox{black}{yellow!25!white}{\@nameauth@Name[#1]{#2}[#3]}% } \makeatother -\renewcommand*\NamesFormat[1] - {\hbox to 9em{\hfil\scshape#1\hfil}} +\renewcommand*\NamesFormat[1]{\hbox to 9em{\hfil\scshape#1\hfil}} \renewcommand*\MainNameHook[1]{\hbox to 9em{\hfil#1\hfil}} -\renewcommand*\NameauthName{\MyName} -\renewcommand*\NameauthLName{\MyLName} +\renewcommand*\NameauthName{\MyName}% +\renewcommand*\NameauthLName{\MyLName}% \renewcommand*\NameauthFName{\MyFName} \smallskip -\verb+\ForgetName[Adolf]{Harnack}+\ForgetName[Adolf]{Harnack}\\[1ex] +\cmd{\ForgetName[Adolf]\{Harnack\}}\ForgetName[Adolf]{Harnack}\\[1ex] \begin{tabular}{@{}rl} -\verb+\Harnack+ & \Harnack\\ -\verb+\LHarnack[Adolf von]+ & \LHarnack[Adolf von]\\ -\verb+\Harnack+ & \Harnack\\ -\verb+\SHarnack+ & \SHarnack\\ + \cmd{\Harnack} & \Harnack\\ + \cmd{\LHarnack[Adolf von]} & \LHarnack[Adolf von]\\ + \cmd{\Harnack} & \Harnack\\ + \cmd{\SHarnack} & \SHarnack\\ \end{tabular} \end{quote} \newpage \section{\protect\LaTeX\ Engines} -We use \texttt{american} for the language; one should use one's own. We use Latin Modern. We load \textsf{tikz} only in pdf mode to avoid crashing some DVI viewers. +We use \texttt{american} for the language; one should use one's own. We use Latin Modern. We could load \textsf{tikz} using \texttt{\textbackslash ifDoTikZ} to avoid crashing some \texttt{dvi} viewers in a \texttt{dvi}-only workflow. \begin{quote}\small \StartNum @@ -1349,14 +1403,14 @@ We use \texttt{american} for the language; one should use one's own. We use Lati \usepackage{ifluatex} \usepackage{ifpdf} \fi -% Used to create both dvi and pdf output -\newif\ifDoTikZ % Perhaps not needed + +\newif\ifDoTikZ % If dvi-only workflow \ifxetex \usepackage{fontspec} \usepackage{polyglossia} \setdefaultlanguage{american} % Use own language \usepackage{tikz} - \DoTikZtrue % Perhaps not needed + \DoTikZtrue % If dvi-only workflow \else \ifluatex \ifpdf @@ -1364,7 +1418,7 @@ We use \texttt{american} for the language; one should use one's own. We use Lati \usepackage{polyglossia} \setdefaultlanguage{american} % Use own language \usepackage{tikz} - \DoTikZtrue % Perhaps not needed + \DoTikZtrue % If dvi-only workflow \else \IfFileExists{utf8-2018.def}{} {\usepackage[utf8]{inputenc}} @@ -1379,23 +1433,32 @@ We use \texttt{american} for the language; one should use one's own. We use Lati \usepackage[TS1,T1]{fontenc} \usepackage[american]{babel} % Use own language \usepackage{lmodern} - \ifpdf % Perhaps not needed - \usepackage{tikz} - \DoTikZtrue % Perhaps not needed + \ifpdf + \usepackage{tikz} % If dvi-only workflow + \DoTikZtrue % If dvi-only workflow \fi \fi \fi \end{verbatim} \end{quote} -In the body text we can use something like the test below for \fbox{\ifDoTikZ doing \texttt{pdf} things\else doing \texttt{dvi} things\fi} +\newpage + +In the body text we can use something like the test below for: + +\begin{center}\fbox{\ifxetex doing \texttt{pdf} things\else \ifpdf doing \texttt{pdf} things\else doing \texttt{dvi} things\fi\fi}\end{center} + \begin{quote}\small \begin{verbatim} -\ifDoTikZ - doing \texttt{pdf} things\else - doing \texttt{dvi} things\fi -\end{verbatim} +\ifxetex + doing \texttt{pdf} things +\else + \ifpdf + doing \texttt{pdf} things + \else + doing \texttt{dvi} things + \fi +\fi\end{verbatim} \end{quote} -\newpage The following equivalent conditional statements can help a macro or just the body text to work under multiple engines: \begin{quote}\small @@ -1431,9 +1494,15 @@ The following equivalent conditional statements can help a macro or just the bod \fi \end{verbatim} \end{quote} - -\def\indexname{\hypertarget{Index}{Index}} \newpage + +\phantomsection +\addcontentsline{toc}{section}{Index of Persons} +\printindex[per] + +\renewcommand\indexname{Index of Subjects} +\phantomsection +\addcontentsline{toc}{section}{Index of Subjects} \printindex \end{document} diff --git a/Master/texmf-dist/doc/latex/nameauth/nameauth.pdf b/Master/texmf-dist/doc/latex/nameauth/nameauth.pdf index d33860b49ed..63ce4add2a0 100644 Binary files a/Master/texmf-dist/doc/latex/nameauth/nameauth.pdf and b/Master/texmf-dist/doc/latex/nameauth/nameauth.pdf differ -- cgit v1.2.3