diff options
author | Karl Berry <karl@freefriends.org> | 2022-04-13 19:56:33 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-04-13 19:56:33 +0000 |
commit | 6c42279a36bed48049930270e967663e428a2975 (patch) | |
tree | 401d637d03883603a654466b7a44266338248851 /Master/texmf-dist/tex/latex/titlecaps | |
parent | e11fc6bc7f2507fbcb14bf0150079879bcd0906f (diff) |
titlecaps (13apr22)
git-svn-id: svn://tug.org/texlive/trunk@63020 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/titlecaps')
-rw-r--r-- | Master/texmf-dist/tex/latex/titlecaps/titlecaps.sty | 196 |
1 files changed, 104 insertions, 92 deletions
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 |