diff options
author | Karl Berry <karl@freefriends.org> | 2015-01-30 22:02:57 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-01-30 22:02:57 +0000 |
commit | 37a530cfe394c0bfeef73bd34cf86b9c5ecedabb (patch) | |
tree | 9041b11a20548dfa9eed5229100a5bee35c30f5c | |
parent | e5e0aeb7fe58d7adb35199774ede1ac6da9ad454 (diff) |
titlecaps (30jan15)
git-svn-id: svn://tug.org/texlive/trunk@36170 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/titlecaps/titlecaps.pdf | bin | 271714 -> 272789 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/titlecaps/titlecaps.tex | 35 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/titlecaps/titlecaps.sty | 135 |
3 files changed, 92 insertions, 78 deletions
diff --git a/Master/texmf-dist/doc/latex/titlecaps/titlecaps.pdf b/Master/texmf-dist/doc/latex/titlecaps/titlecaps.pdf Binary files differindex 242c96a5d49..eb54eccbf11 100644 --- a/Master/texmf-dist/doc/latex/titlecaps/titlecaps.pdf +++ b/Master/texmf-dist/doc/latex/titlecaps/titlecaps.pdf diff --git a/Master/texmf-dist/doc/latex/titlecaps/titlecaps.tex b/Master/texmf-dist/doc/latex/titlecaps/titlecaps.tex index e2e0b35bc8c..01124a08308 100644 --- a/Master/texmf-dist/doc/latex/titlecaps/titlecaps.tex +++ b/Master/texmf-dist/doc/latex/titlecaps/titlecaps.tex @@ -1,5 +1,5 @@ \documentclass{article} -\def\version{1.1} +\def\version{1.2} %% Copyright 2013 Steven B. Segletes % % This work may be distributed and/or modified under the @@ -16,6 +16,10 @@ % % 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} @@ -152,7 +156,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, and \o~[see {\QL}]). +well as national symbols (such as \oe, \ae, \aa, \l, and \o). While punctuation had been earlier screened out in order to search for predefined lower-cased words, that is a slightly different problem from @@ -173,12 +177,6 @@ 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,} @@ -195,10 +193,13 @@ can be used to for one-time exceptions to titling, or to overcome the curly-brace problem described above, as in \verb|\{\relax if\}|. The package introduces a command, \verb|\textnc|\margcmd{textnc} -(standing for ``text no-change''), which forces its argument to be +(standing for ``text no-change''). If used outside of the +\verb|\titlecap| argument, it is defined as \verb|\def\textnc#1{#1}| +and so is leaves the argument intact. Inside of the \verb|\titlecap| +argument, however, it forces its argument to be independently considered as text, regardless of any surrounding punctuation or other characters. Thus, this approach may also be used -to address the curly-brace issue as \verb|\{\textnc{it}\}|. In this +to address the curly-brace issue as \verb|\{\textnc{if}\}|. In this case, ``if'' would be titled if it is not on the lower-cased word list, but left in lower case if it were on the lower-cased word list. The \verb|\textnc| command is useful in a number of ways inside the argument @@ -339,6 +340,12 @@ string parsing and punctuation screening techniques of this package: \verb|http://tex.stackexchange.com/questions/105735/ignoring|\\ \verb|-punctuation-during-comparison| +I would also like to thank Prof. Enrico Gregorio for his discovery of several +bugs in the package and suggestions for fixes: + +\verb|http://tex.stackexchange.com/questions/225434/|\\ +\verb|how-to-workaround-conflict-between-greek-and-titlecaps| + \clearpage \section{\titlecap{a \ttfamily\bs titlecap \rmfamily demonstration for beginners,\\ expressed in \texttt{\bs titlecap}}} @@ -367,18 +374,18 @@ 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, and \oe dipus. unfortunately, i could not get it to -work on the \aa~nor the \l~symbols. the method will work with some +\o laf, \ae gis, \oe dipus, \aa ngstrom, and \l ucky. +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 -they are not direct character expansions. Additionally, +they are not direct character expansions. additionally, \textsf{titlecaps} also works with font changing declarations, for example, \bs itshape\bs sffamily. \itshape\sffamily you can see that it works fine. likewise, any subsequent \bs textxx command will, upon diff --git a/Master/texmf-dist/tex/latex/titlecaps/titlecaps.sty b/Master/texmf-dist/tex/latex/titlecaps/titlecaps.sty index 256c2f6e7c2..8b0b6f1c386 100644 --- a/Master/texmf-dist/tex/latex/titlecaps/titlecaps.sty +++ b/Master/texmf-dist/tex/latex/titlecaps/titlecaps.sty @@ -1,5 +1,5 @@ \ProvidesPackage{titlecaps} -[2013/04/11 V1.01 +[2015/01/30 V1.2 Routines for setting rich-text input into Titling Caps] %% Copyright 2013 Steven B. Segletes % @@ -17,6 +17,10 @@ % % 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{ifnextok} \usepackage{ifthen} @@ -25,7 +29,7 @@ \newcounter{lc@words} \let\SaveHardspace~ \def\SoftSpace{ } -\catcode`\^^00=12 +\catcode`\^^00=12 % \def\cmd@flag{^^00} % FLAGS END-OF-COMMAND; NEXT CHAR CAPPED \let\sv@textup\textup @@ -50,33 +54,33 @@ % THESE ARE THE PUNCTUATION MARKS SCREENED OUT FOR % LOWER CASE WORD SEARCH \newcommand\kill@punct{% -\catcode`.=9% -\catcode`,=9% -\catcode`:=9% -\catcode`;=9% -\catcode`(=9% -\catcode`)=9% -\catcode`[=9% -\catcode`]=9% -\catcode`?=9% -\catcode`!=9% -\catcode``=9% -\catcode`'=9% +\catcode`.=9 % +\catcode`,=9 % +\catcode`:=9 % +\catcode`;=9 % +\catcode`(=9 % +\catcode`)=9 % +\catcode`[=9 % +\catcode`]=9 % +\catcode`?=9 % +\catcode`!=9 % +\catcode``=9 % +\catcode`'=9 % } \newcommand\restore@punct{% -\catcode`.=12% -\catcode`,=12% -\catcode`:=12% -\catcode`;=12% -\catcode`(=12% -\catcode`)=12% -\catcode`[=12% -\catcode`]=12% -\catcode`?=12% -\catcode`!=12% -\catcode``=12% -\catcode`'=12% +\catcode`.=12 % +\catcode`,=12 % +\catcode`:=12 % +\catcode`;=12 % +\catcode`(=12 % +\catcode`)=12 % +\catcode`[=12 % +\catcode`]=12 % +\catcode`?=12 % +\catcode`!=12 % +\catcode``=12 % +\catcode`'=12 % } \def\add@space{\protected@edef\@thestring{\@thestring\SoftSpace}} @@ -189,7 +193,7 @@ % STORE (DON'T EXECUTE) \titlecap COMMAND & ARGUMENT \newcommand\titlecap@q[2][P]{% \def\thestring{\titlecap[#1]{#2}}% -}% +} % RESET PREDESIGNATED LOWERCASE WORD LIST \setcounter{lc@words}{0} @@ -201,12 +205,13 @@ \setcounter{lcword@index}{0}% \whiledo{\value{lcword@index} < \narg}{% \addtocounter{lcword@index}{1}% - \add@lcword{\csname arg\roman{lcword@index}\endcsname}% - } + \add@lcword{\csname arg\romannumeral\value{lcword@index}\endcsname}% + }% } + \newcommand\add@lcword[1]{% \addtocounter{lc@words}{1}% - \expandafter\edef\csname lcword\roman{lc@words}\endcsname{#1} + \expandafter\edef\csname lcword\romannumeral\value{lc@words}\endcsname{#1}% } % SEARCH TERTIUS CONVERTED ARGUMENT FOR LOWERCASE WORDS, SET FLAG @@ -216,22 +221,23 @@ \setcounter{word@count}{0}% \whiledo{\value{word@count} < \narg}{% \addtocounter{word@count}{1}% -\protected@edef\current@word{\csname arg\roman{word@count}\endcsname}% + \protected@edef\current@word{% + \csname arg\romannumeral\value{word@count}\endcsname}% \def\found@word{F}% \setcounter{lcword@index}{0}% \expandafter\def\csname% - found@word\roman{word@count}\endcsname{F}% + found@word\romannumeral\value{word@count}\endcsname{F}% \whiledo{\value{lcword@index} < \value{lc@words}}{% \addtocounter{lcword@index}{1}% \protected@edef\current@lcword{% - \csname lcword\roman{lcword@index}\endcsname}% + \csname lcword\romannumeral\value{lcword@index}\endcsname}% %% THE FOLLOWING THREE LINES ARE FROM DAVID CARLISLE \protected@edef\tmp{\noexpand\scantokens{\def\noexpand\tmp% {\noexpand\ifthenelse{\noexpand\equal{\current@word}{\current@lcword}}}}}% \tmp\ifhmode\unskip\fi\tmp %% {\expandafter\def\csname% - found@word\roman{word@count}\endcsname{T}% + found@word\romannumeral\value{word@count}\endcsname{T}% \setcounter{lcword@index}{\value{lc@words}}}% {}% }% @@ -260,14 +266,14 @@ \if P#1\protected@edef\argi{\primus@argi}\fi% \whiledo{\value{word@count} < \narg}{% \addtocounter{word@count}{1}% - \if F\csname found@word\roman{word@count}\endcsname% - \title@word{\csname arg\roman{word@count}\endcsname}% + \if F\csname found@word\romannumeral\value{word@count}\endcsname% + \title@word{\csname arg\romannumeral\value{word@count}\endcsname}% \expandafter\protected@edef\csname% - arg\roman{word@count}\endcsname{\@thestring}% - \else - \notitle@word{\csname arg\roman{word@count}\endcsname}% + arg\romannumeral\value{word@count}\endcsname{\@thestring}% + \else% + \notitle@word{\csname arg\romannumeral\value{word@count}\endcsname}% \expandafter\protected@edef\csname% - arg\roman{word@count}\endcsname{\@thestring}% + arg\romannumeral\value{word@count}\endcsname{\@thestring}% \fi% }% \def\@thestring{}% @@ -277,7 +283,7 @@ \ifthenelse{\value{word@count} = 1}% {}{\add@space}% \protected@edef\@thestring{\@thestring% - \csname arg\roman{word@count}\endcsname}% + \csname arg\romannumeral\value{word@count}\endcsname}% }% \let~\SaveHardspace% \@thestring% @@ -322,36 +328,37 @@ \def\@symbolxii{\noexpand\c} \def\@symbolxiii{\noexpand\d} \def\@symbolxiv{\noexpand\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} +\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} \newcounter{dia@count} \def\title@string#1#2{% \if T\make@cap% \setcounter{dia@count}{1}% \if F\symbol@flag% - \whiledo{\value{dia@count} < 18}{% - \ifthenelse{\equal{\csname @symbol\roman{dia@count}\endcsname}% - {#2}}{% + \whiledo{\value{dia@count} < 21}{% + \ifthenelse{\equal{% + \csname @symbol\romannumeral\value{dia@count}\endcsname}{#2}}{% %BEGIN IFDIACRIT - \ifthenelse{\value{dia@count} < 15}{% -%IF = DIACRIT<15 + \ifthenelse{\value{dia@count} < 17}{% +%IF = DIACRIT<17 \protected@edef\di@critic% - {\csname @symbol\roman{dia@count}\endcsname}% + {\csname @symbol\romannumeral\value{dia@count}\endcsname}% \def\symbol@flag{D}% \setcounter{dia@count}{99}% INDICATING DICRIT JUST FOUND }{% %IF = NATSYM \protected@edef\di@critic% - {\csname uc@symbol\roman{dia@count}\endcsname}% + {\csname uc@symbol\romannumeral\value{dia@count}\endcsname}% \setcounter{dia@count}{90}% >19 AND <99 MEANS NON-DIACRIT SYMBOL \def\symbol@flag{N}% }% @@ -409,22 +416,22 @@ \def\the@@@rule{\rule{.8ex}{1.6ex}}% \def\get@argsC#1{% - \if T\converttilde\def~{ }\else\catcode`~=12\fi + \if T\converttilde\def~{ }\else\catcode`~=12 \fi \protected@edef\the@@@string{#1}% \setcounter{arg@@@index}{0}% \lowercase{\expandafter\parse@@@Block\the@@@string} \string@@@end \let~\SaveHardspace% - \catcode`~=13% + \catcode`~=13 % } \def\parse@@@Block#1 {% \stepcounter{arg@@@index}% - \@namedef{arg\roman{arg@@@index}}{#1}% + \@namedef{arg\romannumeral\value{arg@@@index}}{#1}% \ifthenelse{\equal{\argi}{}}{\addtocounter{arg@@@index}{-1}}{}% \futurelet\tmp\parse@@@Block@@@} \def\parse@@@Block@@@{% -\ifx\tmp\string@@@end\edef\narg{\thearg@@@index}\expandafter\@gobble +\ifx\tmp\string@@@end\edef\narg{\thearg@@@index}\expandafter\@gobble% \else\expandafter\parse@@@Block\fi} %%%%%%%%%%%% @@ -444,8 +451,8 @@ \let\make@othr\makeatother% \newcommand\noatinsidetc{% - \def\make@lttr{} - \def\make@othr{} + \def\make@lttr{}% + \def\make@othr{}% } \def\restore@sizes{% |