From 33a4150d1da52eedaebb96c4693913b8b024c8de Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 10 Sep 2015 20:59:49 +0000 Subject: mfirstuc (9sep15) git-svn-id: svn://tug.org/texlive/trunk@38343 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty | 149 ++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty (limited to 'Master/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty') diff --git a/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty b/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty new file mode 100644 index 00000000000..ed7992e1d6f --- /dev/null +++ b/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty @@ -0,0 +1,149 @@ +%% +%% This is file `mfirstuc.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% mfirstuc.dtx (with options: `mfirstuc.sty,package') +%% +%% mfirstuc.dtx +%% Copyright 2015 Nicola Talbot +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license of (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. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Nicola Talbot. +%% +%% This work consists of the files mfirstuc.dtx and mfirstuc.ins and the derived files mfirstuc.sty, mfirstuc-english.sty, sample-mfirstuc.tex, mfirstuc.perl. +%% +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{mfirstuc}[2015/09/09 v2.0 (NLCT)] +\RequirePackage{etoolbox} +\newif\if@glscs +\newtoks\@glsmfirst +\newtoks\@glsmrest +\newrobustcmd*{\makefirstuc}[1]{% + \def\gls@argi{#1}% + \ifx\gls@argi\@empty + \else + \def\@gls@tmp{\ #1}% + \@onelevel@sanitize\@gls@tmp + \expandafter\@gls@checkcs\@gls@tmp\relax\relax + \if@glscs + \expandafter\def\expandafter\@gls@tmp\expandafter{\expandafter + \ \@gobble #1}% + \@onelevel@sanitize\@gls@tmp + \expandafter\@gls@checkcs\@gls@tmp\relax\relax + \if@glscs\@glscsfalse\else\@glscstrue\fi + \fi + \if@glscs + \@gls@getbody #1{}\@nil + \ifx\@gls@rest\@empty + \glsmakefirstuc{#1}% + \else + \expandafter\@gls@split\@gls@rest\@nil + \ifx\@gls@first\@empty + \glsmakefirstuc{#1}% + \else + \expandafter\@glsmfirst\expandafter{\@gls@first}% + \expandafter\@glsmrest\expandafter{\@gls@rest}% + \edef\@gls@domfirstuc{\noexpand\@gls@body + {\noexpand\glsmakefirstuc\the\@glsmfirst}% + \the\@glsmrest}% + \@gls@domfirstuc + \fi + \fi + \else + \glsmakefirstuc{#1}% + \fi + \fi +} +\def\@gls@split#1#2\@nil{% + \def\@gls@first{#1}\def\@gls@rest{#2}% +} +\def\@gls@checkcs#1 #2#3\relax{% + \def\@gls@argi{#1}\def\@gls@argii{#2}% + \ifx\@gls@argi\@gls@argii + \@glscstrue + \else + \@glscsfalse + \fi +} +\def\@gls@makefirstuc#1{\mfirstucMakeUppercase #1} +\newcommand*{\mfirstucMakeUppercase}{\MakeUppercase} +\newcommand*{\glsmakefirstuc}[1]{\@gls@makefirstuc{#1}} +\def\@gls@getbody#1#{\def\@gls@body{#1}\@gls@gobbletonil} +\def\@gls@gobbletonil#1\@nil{\def\@gls@rest{#1}} +\newcommand*{\xmakefirstuc}[1]{% +\expandafter\makefirstuc\expandafter{#1}} +\DeclareRobustCommand*{\emakefirstuc}[1]{% + \protected@edef\@MFU@caparg{#1}% + \expandafter\makefirstuc\expandafter{\@MFU@caparg}% +} +\newrobustcmd*{\capitalisewords}[1]{% + \def\gls@add@space{}% + \let\@mfu@domakefirstuc\makefirstuc + \let\@mfu@checkword\@gobble + \mfu@capitalisewords#1 \@nil\mfu@endcap +} +\def\mfu@capitalisewords#1 #2\mfu@endcap{% + \def\mfu@cap@first{#1}% + \def\mfu@cap@second{#2}% + \gls@add@space + \@mfu@checkword{#1}% + \@mfu@domakefirstuc{#1}% + \def\gls@add@space{ }% + \ifx\mfu@cap@second\@nnil + \let\next@mfu@cap\mfu@noop + \else + \let\next@mfu@cap\mfu@capitalisewords + \let\@mfu@checkword\mfu@checkword + \fi + \next@mfu@cap#2\mfu@endcap +} +\def\mfu@noop#1\mfu@endcap{} +\newcommand*\mfu@checkword[1]{% + \ifinlist{#1}{\@mfu@nocaplist}% + {% + \let\@mfu@domakefirstuc\@firstofone + }% + {% + \let\@mfu@domakefirstuc\makefirstuc + }% +} +\newcommand*{\@mfu@nocaplist}{} +\newcommand*{\MFUnocap}[1]{\listadd{\@mfu@nocaplist}{#1}} +\newcommand*{\gMFUnocap}[1]{\listgadd{\@mfu@nocaplist}{#1}} +\newcommand*{\MFUclear}{\renewcommand*{\@mfu@nocaplist}{}} +\newcommand*{\xcapitalisewords}[1]{% + \expandafter\capitalisewords\expandafter{#1}% +} +\DeclareRobustCommand*{\ecapitalisewords}[1]{% + \protected@edef\@MFU@caparg{#1}% + \expandafter\capitalisewords\expandafter{\@MFU@caparg}% +} +\endinput +%% +%% End of file `mfirstuc.sty'. -- cgit v1.2.3