From 6c42279a36bed48049930270e967663e428a2975 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 13 Apr 2022 19:56:33 +0000 Subject: titlecaps (13apr22) git-svn-id: svn://tug.org/texlive/trunk@63020 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/titlecaps/README | 12 +- .../texmf-dist/doc/latex/titlecaps/titlecaps.pdf | Bin 272789 -> 292018 bytes .../texmf-dist/doc/latex/titlecaps/titlecaps.tex | 29 ++- .../texmf-dist/tex/latex/titlecaps/titlecaps.sty | 196 +++++++++++---------- 4 files changed, 123 insertions(+), 114 deletions(-) diff --git a/Master/texmf-dist/doc/latex/titlecaps/README b/Master/texmf-dist/doc/latex/titlecaps/README index 05bd3a320ad..8f8e886bcc3 100644 --- a/Master/texmf-dist/doc/latex/titlecaps/README +++ b/Master/texmf-dist/doc/latex/titlecaps/README @@ -1,7 +1,7 @@ -The titlecaps package is intended for setting rich text into titling -capitals (in which the first character of words are capitalized). It -automatically accounts for diacritical marks (like umlauts), national -symbols (like "ae"), punctuation, and font changing commands that alter -the appearance or size of the text. It allows a list of predesignated -words to be protected as lower-cased, and also allows for titling +The titlecaps package is intended for setting rich text into titling +capitals (in which the first character of words are capitalized). It +automatically accounts for diacritical marks (like umlauts), national +symbols (like "ae"), punctuation, and font changing commands that alter +the appearance or size of the text. It allows a list of predesignated +words to be protected as lower-cased, and also allows for titling exceptions of various sorts. diff --git a/Master/texmf-dist/doc/latex/titlecaps/titlecaps.pdf b/Master/texmf-dist/doc/latex/titlecaps/titlecaps.pdf index eb54eccbf11..13e9b497cbe 100644 Binary files a/Master/texmf-dist/doc/latex/titlecaps/titlecaps.pdf and b/Master/texmf-dist/doc/latex/titlecaps/titlecaps.pdf differ diff --git a/Master/texmf-dist/doc/latex/titlecaps/titlecaps.tex b/Master/texmf-dist/doc/latex/titlecaps/titlecaps.tex index 01124a08308..6019f7e588f 100644 --- a/Master/texmf-dist/doc/latex/titlecaps/titlecaps.tex +++ b/Master/texmf-dist/doc/latex/titlecaps/titlecaps.tex @@ -1,6 +1,4 @@ \documentclass{article} -\def\version{1.2} -%% Copyright 2013 Steven B. Segletes % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -14,13 +12,6 @@ % % The Current Maintainer of this work is Steven B. Segletes. % -% V1.1 -Typographical corrections to docs. -% -Missing % added on line 356 -% V1.2 -Now works with \l and \aa national symbols. -% -Replaced all occurrences of \roman with \romannumeral\value -% -Found two lines needing a trailing % -% -Added a trailing space following invocations of \catcode -% \usepackage{titlecaps} \usepackage{needspace} \parskip 1em @@ -41,9 +32,9 @@ \rule{0em}{.7em}\small Routines for setting rich-text input into Titling Caps\\ \rule{0em}{2.7em}\large Steven B. Segletes\\ -steven.b.segletes.civ@mail.mil\\ -\rule{0em}{1.7em}\today\\ -v\version +SSegletes@verizon.net\\ +\rule{0em}{1.7em}\titlecapsVersionDate\\ +v\titlecapsVersionNumber \end{center} \Addlcwords{for a is but and with of in as the etc on to if} @@ -156,7 +147,7 @@ the lower-cased word flag that has previously been set. The {\tcp} package can notably handle the titling of strings containing both diacritical marks found in various languages (such as \`o, \'o, \^o, \"o, \~o, \=o, \.o, \u o, \v o, \H o, \t{oo}, \c o, \d o, and \b o), as -well as national symbols (such as \oe, \ae, \aa, \l, and \o). +well as national symbols (such as \oe, \ae, and \o~[see {\QL}]). While punctuation had been earlier screened out in order to search for predefined lower-cased words, that is a slightly different problem from @@ -177,6 +168,12 @@ While {\tcp} has been set up to run with certain embedded size and font-changing commands, it will not, in general, work with macros in the argument, unless the macros expand directly to a text string. +The {\tcp} package is designed to work with diacritical marks (for +example, umlauts) as well as national symbols (symbols like \ae, \oe, +\textit{etc.}). There remain, however, two national symbols which are +not handled properly by this package. They are {\aa} and {\l}. They +will not be capitalized, even if found at the beginning of a word. + The {\tcp} package is designed to screen out punctuation when searching for words that are pre-designated as lower-cased. So, for example, the word (\textit{if}) or \textit{``if''} or [\textit{if} or \textit{if,} @@ -374,14 +371,14 @@ but if you want the argument of that command to not be titled, you either need, in this example, to add \textit{xx} to the lowercase word list, which you can see i did not. instead, i put ``\bs relax~xx'' as the argument, so that, in essence, the \bs relax was capitalized, not -the x. Or you could use \texttt{\bs textnc}. here i demonstrate that +the x. Or you could use \texttt{\bs textnc} . here i demonstrate that text boldface, \textbf{as in the \bs textbf command}, also works fine, as do \texttt{texttt}, \textsl{textsl}, \textsc{textsc}, \textsf{textsf}, \textit{etc}. titlecap will work on diacritical marks, such as \"apfel, \c cacao \textit{etc.}, \scriptsize fontsize \LARGE changing commands\normalsize\unskip, as well as national symbols such as -\o laf, \ae gis, \oe dipus, \aa ngstrom, and \l ucky. -the method will work with some +\o laf, \ae gis, and \oe dipus. unfortunately, i could not get it to +work on the \aa~nor the \l~symbols. the method will work with some things in math mode, capitalizing symbols if there is a leading space, $x^2$ can become $ x^2$, and it can process but it will not capitalize the greek symbols, such as $\alpha$, and will choke on most macros, if diff --git a/Master/texmf-dist/tex/latex/titlecaps/titlecaps.sty b/Master/texmf-dist/tex/latex/titlecaps/titlecaps.sty index 8b0b6f1c386..920e685bc04 100644 --- a/Master/texmf-dist/tex/latex/titlecaps/titlecaps.sty +++ b/Master/texmf-dist/tex/latex/titlecaps/titlecaps.sty @@ -1,7 +1,8 @@ +\def\titlecapsVersionNumber{1.3} +\def\titlecapsVersionDate{2022/04/12} \ProvidesPackage{titlecaps} -[2015/01/30 V1.2 +[\titlecapsVersionDate\ \titlecapsVersionNumber\ Routines for setting rich-text input into Titling Caps] -%% Copyright 2013 Steven B. Segletes % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -17,10 +18,13 @@ % % V1.1 -Typographical corrections to docs. % -Missing % added on line 356 -% V1.2 -Now works with \l and \aa national symbols. -% -Replaced all occurrences of \roman with \romannumeral\value +% V1.2 -Replaced all occurrences of \roman with \romannumeral\value % -Found two lines needing a trailing % % -Added a trailing space following invocations of \catcode +% V1.3 -Converted a number of \ifthenelse to corresponding TeX level +% \ifx, \ifnum, and \if syntax +% -Converted a number of \protected@edef to appropriately +% expanded \def syntax. % \usepackage{ifnextok} \usepackage{ifthen} @@ -31,6 +35,9 @@ \def\SoftSpace{ } \catcode`\^^00=12 % \def\cmd@flag{^^00} % FLAGS END-OF-COMMAND; NEXT CHAR CAPPED +\def\def@x#1#2{\expandafter\def\expandafter#1\expandafter{#2}} +\def\def@xx#1#2{\expandafter\def@x\expandafter#1\expandafter{#2}} +\def\def@xxx#1#2{\expandafter\def@xx\expandafter#1\expandafter{#2}} \let\sv@textup\textup \let\sv@textit\textit @@ -83,7 +90,8 @@ \catcode`'=12 % } -\def\add@space{\protected@edef\@thestring{\@thestring\SoftSpace}} +\def\add@space{\def@xx\@thestring{\expandafter\@thestring\SoftSpace}} + % PRIMUS IS FOR BEGINNING-OF-STRING TITLE-CAPPING (1st WORD OVERRIDES % PREDEFINED LOWER CASE) @@ -211,7 +219,7 @@ \newcommand\add@lcword[1]{% \addtocounter{lc@words}{1}% - \expandafter\edef\csname lcword\romannumeral\value{lc@words}\endcsname{#1}% + \expandafter\def@xx\csname lcword\romannumeral\value{lc@words}\endcsname{#1}% } % SEARCH TERTIUS CONVERTED ARGUMENT FOR LOWERCASE WORDS, SET FLAG @@ -221,7 +229,7 @@ \setcounter{word@count}{0}% \whiledo{\value{word@count} < \narg}{% \addtocounter{word@count}{1}% - \protected@edef\current@word{% + \def@xx\current@word{% \csname arg\romannumeral\value{word@count}\endcsname}% \def\found@word{F}% \setcounter{lcword@index}{0}% @@ -229,7 +237,7 @@ found@word\romannumeral\value{word@count}\endcsname{F}% \whiledo{\value{lcword@index} < \value{lc@words}}{% \addtocounter{lcword@index}{1}% - \protected@edef\current@lcword{% + \def@xx\current@lcword{% \csname lcword\romannumeral\value{lcword@index}\endcsname}% %% THE FOLLOWING THREE LINES ARE FROM DAVID CARLISLE \protected@edef\tmp{\noexpand\scantokens{\def\noexpand\tmp% @@ -256,23 +264,25 @@ \if P#1% \redefine@primus% \get@argsC{#2}% - \protected@edef\primus@argi{\argi}% + \def@x\primus@argi{\argi}% \else% \fi% \setcounter{word@count}{0}% \redefine@secundus% \def\@thestring{}% \get@argsC{#2}% - \if P#1\protected@edef\argi{\primus@argi}\fi% + \if P#1\def@x\argi{\primus@argi}\fi% \whiledo{\value{word@count} < \narg}{% \addtocounter{word@count}{1}% \if F\csname found@word\romannumeral\value{word@count}\endcsname% - \title@word{\csname arg\romannumeral\value{word@count}\endcsname}% - \expandafter\protected@edef\csname% + \title@word{% + \csname arg\romannumeral\value{word@count}\endcsname}% + \expandafter\def@x\csname% arg\romannumeral\value{word@count}\endcsname{\@thestring}% \else% - \notitle@word{\csname arg\romannumeral\value{word@count}\endcsname}% - \expandafter\protected@edef\csname% + \notitle@word{% + \csname arg\romannumeral\value{word@count}\endcsname}% + \expandafter\def@x\csname% arg\romannumeral\value{word@count}\endcsname{\@thestring}% \fi% }% @@ -280,9 +290,8 @@ \setcounter{word@count}{0}% \whiledo{\value{word@count} < \narg}{% \addtocounter{word@count}{1}% - \ifthenelse{\value{word@count} = 1}% - {}{\add@space}% - \protected@edef\@thestring{\@thestring% + \ifnum\value{word@count} = 1\relax\else\add@space\fi% + \def@xxx\@thestring{\expandafter\expandafter\expandafter\@thestring% \csname arg\romannumeral\value{word@count}\endcsname}% }% \let~\SaveHardspace% @@ -292,7 +301,7 @@ \newcommand\notitle@word[1]{% \def\symbol@flag{F}% - \protected@edef\the@string{#1}% + \def@xx\the@string{#1}% \def\@thestring{}\def\make@cap{F}% \expandafter\eat@noTitleWord\the@string\string@end% } @@ -304,71 +313,71 @@ \newcommand\title@word[1]{% \def\symbol@flag{F}% - \protected@edef\the@string{#1}% + \def@xx\the@string{#1}% \def\@thestring{}\def\make@cap{T}% \expandafter\eat@TitleWord\the@string\string@end% } + \def\eat@TitleWord{\IfNextToken\string@end% {\@gobble}% {\title@string{\eat@TitleWord}}% } -\def\@symboli{\noexpand\`} -\def\@symbolii{\noexpand\'} -\def\@symboliii{\noexpand\^} -\def\@symboliv{\noexpand\"} -\def\@symbolv{\noexpand\~} -\def\@symbolvi{\noexpand\=} -\def\@symbolvii{\noexpand\.} -\def\@symbolviii{\noexpand\u} -\def\@symbolix{\noexpand\v} -\def\@symbolx{\noexpand\H} -\def\@symbolxi{\noexpand\t} -\def\@symbolxii{\noexpand\c} -\def\@symbolxiii{\noexpand\d} -\def\@symbolxiv{\noexpand\b} -\def\@symbolxv{\noexpand\r} -\def\@symbolxvi{\noexpand\a} -% -\def\@symbolxvii{\ae} - \def\uc@symbolxvii{\AE} -\def\@symbolxviii{\o} - \def\uc@symbolxviii{\O} -\def\@symbolxix{\oe} - \def\uc@symbolxix{\OE} -\def\@symbolxx{\l} - \def\uc@symbolxx{\L} +\def\@symboli{\`} +\def\@symbolii{\'} +\def\@symboliii{\^} +\def\@symboliv{\"} +\def\@symbolv{\~} +\def\@symbolvi{\=} +\def\@symbolvii{\.} +\def\@symbolviii{\u} +\def\@symbolix{\v} +\def\@symbolx{\H} +\def\@symbolxi{\t} +\def\@symbolxii{\c} +\def\@symbolxiii{\d} +\def\@symbolxiv{\b} +\def\@symbolxv{\oe} + \def\uc@symbolxv{\OE} +\def\@symbolxvi{\ae} + \def\uc@symbolxvi{\AE} +\def\@symbolxvii{\o} + \def\uc@symbolxvii{\O} +%\def\@symbolxviii{\aa} +% \def\uc@symbolxviii{\AA} +%\def\@symbolxix{\l} +% \def\uc@symbolxix{\L} \newcounter{dia@count} \def\title@string#1#2{% \if T\make@cap% \setcounter{dia@count}{1}% \if F\symbol@flag% - \whiledo{\value{dia@count} < 21}{% - \ifthenelse{\equal{% - \csname @symbol\romannumeral\value{dia@count}\endcsname}{#2}}{% + \whiledo{\value{dia@count} < 18}{% + \expandafter\expandafter\expandafter\ifx + \csname @symbol\romannumeral\value{dia@count}\endcsname#2% %BEGIN IFDIACRIT - \ifthenelse{\value{dia@count} < 17}{% -%IF = DIACRIT<17 - \protected@edef\di@critic% + \ifnum\value{dia@count} < 15\relax% +%IF = DIACRIT<15 + \def@xx\di@critic% {\csname @symbol\romannumeral\value{dia@count}\endcsname}% \def\symbol@flag{D}% \setcounter{dia@count}{99}% INDICATING DICRIT JUST FOUND - }{% + \else% %IF = NATSYM - \protected@edef\di@critic% + \def@xx\di@critic% {\csname uc@symbol\romannumeral\value{dia@count}\endcsname}% \setcounter{dia@count}{90}% >19 AND <99 MEANS NON-DIACRIT SYMBOL \def\symbol@flag{N}% - }% - }{% + \fi% + \else %END IF = DIACRIT %IFNOT = DIACRIT - \addtocounter{dia@count}{1}}% + \addtocounter{dia@count}{1}\fi }% END WHILEDO \fi% - \ifthenelse{\value{dia@count} < 99}{% + \ifnum\value{dia@count} < 99\relax \if D\symbol@flag% FOR DIACRIT, ONCE ARGUMENT IS IN #2, TO BE CAPPED \def\next@char{\di@critic#2}% \def\symbol@flag{F}% @@ -380,30 +389,33 @@ \def\next@char{#2}% \fi% \fi% - \ifthenelse{\equal{\cmd@flag}{#2}}{\def\make@cap{T}}{% - \protected@edef\@thestring{\@thestring\uppercase{\next@char}}% + \expandafter\ifx\cmd@flag#2\relax\def\make@cap{T}\else% + \def@xx\@thestring{\expandafter\@thestring\expandafter + \uppercase\expandafter{\next@char}}% \def\make@cap{F}% \@checkfornewgroup{#2}% - }% - }{}% + \fi + \fi% \else% FOR CHARACTERS NOT TO BE CAPITALIZED - \ifthenelse{\equal{\cmd@flag}{#2}}{\def\make@cap{T}}{% - \protected@edef\@thestring{\@thestring#2}% + \expandafter\ifx\cmd@flag#2 + \def\make@cap{T}% + \else + \def@x\@thestring{\@thestring#2}% \@checkfornewgroup{#2}% - }% + \fi \fi% #1} \def\@checkfornewgroup#1{% - \ifthenelse{\equal{-}{#1}}{\def\make@cap{T}}{% - \ifthenelse{\equal{(}{#1}}{\def\make@cap{T}}{% - \ifthenelse{\equal{[}{#1}}{\def\make@cap{T}}{% - \ifthenelse{\equal{\{}{#1}}{\def\make@cap{T}}{% - \ifthenelse{\equal{`}{#1}}{\def\make@cap{T}}{}% - }% - }% - }% - }% + \ifx-#1\def\make@cap{T}\else + \ifx(#1\def\make@cap{T}\else + \ifx[#1\def\make@cap{T}\else + \ifx\{#1\def\make@cap{T}\else + \ifx`#1\def\make@cap{T}\fi + \fi + \fi + \fi + \fi } %%%%%%%%%%%%%%%%%% @@ -472,35 +484,35 @@ % THE \makeatletter IS REQUIRED FOR PROCESSING FONTSIZE CHANGES \def\digest@sizes{% \make@lttr% -\def\tiny{\unskip\noexpand\sz@tiny\SoftSpace}% -\def\sz@tiny{\noexpand\sv@tiny}% +\def\tiny{\unskip\sz@tiny\SoftSpace}% +\def\sz@tiny{\sv@tiny}% % -\def\scriptsize{\unskip\noexpand\sz@scriptsize\SoftSpace}% -\def\sz@scriptsize{\noexpand\sv@scriptsize}% +\def\scriptsize{\unskip\sz@scriptsize\SoftSpace}% +\def\sz@scriptsize{\sv@scriptsize}% % -\def\footnotesize{\unskip\noexpand\sz@footnotesize\SoftSpace}% -\def\sz@footnotesize{\noexpand\sv@footnotesize}% +\def\footnotesize{\unskip\sz@footnotesize\SoftSpace}% +\def\sz@footnotesize{\sv@footnotesize}% % -\def\small{\unskip\noexpand\sz@small\SoftSpace}% -\def\sz@small{\noexpand\sv@small}% +\def\small{\unskip\sz@small\SoftSpace}% +\def\sz@small{\sv@small}% % -\def\normalsize{\unskip\noexpand\sz@normalsize\SoftSpace}% -\def\sz@normalsize{\noexpand\sv@normalsize}% +\def\normalsize{\unskip\sz@normalsize\SoftSpace}% +\def\sz@normalsize{\sv@normalsize}% % -\def\large{\unskip\noexpand\sz@large\SoftSpace}% -\def\sz@large{\noexpand\sv@large}% +\def\large{\unskip\sz@large\SoftSpace}% +\def\sz@large{\sv@large}% % -\def\Large{\unskip\noexpand\sz@Large\SoftSpace}% -\def\sz@Large{\noexpand\sv@Large}% +\def\Large{\unskip\sz@Large\SoftSpace}% +\def\sz@Large{\sv@Large}% % -\def\LARGE{\unskip\noexpand\sz@LARGE\SoftSpace}% -\def\sz@LARGE{\noexpand\sv@LARGE}% +\def\LARGE{\unskip\sz@LARGE\SoftSpace}% +\def\sz@LARGE{\sv@LARGE}% % -\def\huge{\unskip\noexpand\sz@huge\SoftSpace}% -\def\sz@huge{\noexpand\sv@huge}% +\def\huge{\unskip\sz@huge\SoftSpace}% +\def\sz@huge{\sv@huge}% % -\def\Huge{\unskip\noexpand\sz@Huge\SoftSpace}% -\def\sz@Huge{\noexpand\sv@Huge}% +\def\Huge{\unskip\sz@Huge\SoftSpace}% +\def\sz@Huge{\sv@Huge}% } \endinput -- cgit v1.2.3