summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/mfirstuc
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-07-30 23:07:44 +0000
committerKarl Berry <karl@freefriends.org>2016-07-30 23:07:44 +0000
commit525ac53a88fd99baae49fee0cafb38d995aaaace (patch)
tree498c03403c316dca4ec2ae3498130c8522ac8e98 /Master/texmf-dist/tex/latex/mfirstuc
parent87de64a55b20671a3b63f28699b68a97c0f0d02c (diff)
mfirstuc (30jul16)
git-svn-id: svn://tug.org/texlive/trunk@41766 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/mfirstuc')
-rw-r--r--Master/texmf-dist/tex/latex/mfirstuc/mfirstuc-english.sty4
-rw-r--r--Master/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty190
2 files changed, 180 insertions, 14 deletions
diff --git a/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc-english.sty b/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc-english.sty
index f8a111daaf6..ad28d61a6c0 100644
--- a/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc-english.sty
+++ b/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc-english.sty
@@ -7,7 +7,7 @@
%% mfirstuc.dtx (with options: `mfirstuc-english.sty,package')
%%
%% mfirstuc.dtx
-%% Copyright 2015 Nicola Talbot
+%% Copyright 2016 Nicola Talbot
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -39,7 +39,7 @@
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{mfirstuc-english}[2015/09/09 v2.0 (NLCT)]
+\ProvidesPackage{mfirstuc-english}[2016/07/29 v2.03 (NLCT)]
\RequirePackage{mfirstuc}
\MFUnocap{a}
\MFUnocap{an}
diff --git a/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty b/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty
index 472c831cc3d..08b0f1f3aea 100644
--- a/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty
+++ b/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty
@@ -7,7 +7,7 @@
%% mfirstuc.dtx (with options: `mfirstuc.sty,package')
%%
%% mfirstuc.dtx
-%% Copyright 2015 Nicola Talbot
+%% Copyright 2016 Nicola Talbot
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -39,7 +39,7 @@
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{mfirstuc}[2015/12/17 v2.02 (NLCT)]
+\ProvidesPackage{mfirstuc}[2016/07/29 v2.03 (NLCT)]
\RequirePackage{etoolbox}
\newif\if@glscs
\newtoks\@glsmfirst
@@ -47,8 +47,10 @@
\newrobustcmd*{\makefirstuc}[1]{%
\@MFU@p@makefirstuc#1\relax\relax\relax\@end@MFU@protected{#1}%
}
+\newcommand*{\@MFU@protect}{\protect}
\def\@MFU@p@makefirstuc#1#2#3\@end@MFU@protected#4{%
- \ifx\protect#1\relax
+ \def\gls@argi{#1}%
+ \ifx\gls@argi\@MFU@protect
\@makefirstuc{#2#3}%
\else
\@makefirstuc{#4}%
@@ -90,8 +92,27 @@
\fi
\fi
}
-\def\@gls@split#1#2\@nil{%
- \def\@gls@first{#1}\def\@gls@rest{#2}%
+\ifdef\dtl@getfirst@UTFviii
+{%
+ \def\@gls@split#1#2\@nil{%
+ \ifbool{@dtl@utf8}
+ {%
+ \expandafter\dtl@if@two@octets#1#2\relax\dtl@end@if@two@octets
+ {%
+ \dtl@getfirst@UTFviii#1#2\@nil\end@dtl@getfirst@UTFviii
+ \let\@gls@first\dtl@first
+ \let\@gls@rest\dtl@rest
+ }%
+ {%
+ \def\@gls@first{#1}\def\@gls@rest{#2}%
+ }%
+ }%
+ }
+}%
+{%
+ \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}%
@@ -101,21 +122,66 @@
\@glscsfalse
\fi
}
-\def\@gls@makefirstuc#1{\mfirstucMakeUppercase #1}
+\ifdef\dtl@getfirst@UTFviii
+{%
+ \def\@mfu@applytofirst#1#2\@mfu@end@applytofirst#3{%
+ \expandafter\dtl@if@two@octets#1#2\relax\dtl@end@if@two@octets
+ {%
+ \dtl@getfirst@UTFviii#1#2\@nil\end@dtl@getfirst@UTFviii
+ \expandafter#3\expandafter{\dtl@first}\dtl@rest
+ }%
+ {%
+ #3#1#2%
+ }%
+ }%
+}%
+{%
+ \def\@mfu@applytofirst#1#2\@mfu@end@applytofirst#3{#3#1#2}
+}
+\ifdef\dtl@getfirst@UTFviii
+{%
+ \newcommand*{\MFUapplytofirst}[2]{%
+ \ifbool{@dtl@utf8}
+ {%
+ \ifblank{#2}%
+ {#1{#2}}%
+ {%
+ \ifblank{#1}%
+ {#1#2}%
+ {%
+ \@mfu@applytofirst#2\@mfu@end@applytofirst#1\relax
+ }%
+ }%
+ }%
+ {%
+ #1#2%
+ }%
+ }
+}%
+{%
+ \newcommand*{\MFUapplytofirst}[2]{#1#2}
+}
+\def\@gls@makefirstuc#1{\MFUapplytofirst\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]{%
+ \expandafter\makefirstuc\expandafter{#1}%
+}
+\newrobustcmd*{\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
+ \def\gls@add@space{}%
+ \let\@mfu@domakefirstuc\MFUcapword
+ \mfu@capitalisewords#1 \@nil\mfu@endcap
+}
+\newcommand*{\@mfu@mid@capitalisewords}[1]{%
+ \def\gls@add@space{}%
+ \let\@mfu@domakefirstuc\MFUcapword
\mfu@capitalisewords#1 \@nil\mfu@endcap
}
\def\mfu@capitalisewords#1 #2\mfu@endcap{%
@@ -134,9 +200,26 @@
\next@mfu@cap#2\mfu@endcap
}
\def\mfu@noop#1\mfu@endcap{}
+\newif\ifMFUhyphen
+\MFUhyphenfalse
+\newcommand*{\MFUcapword}[1]{%
+ \ifMFUhyphen
+ \@MFUcapword#1-\@nil\@endMFUcapword
+ \else
+ \makefirstuc{#1}%
+ \fi
+}
+\def\@MFUcapword#1-#2\@endMFUcapword{%
+ \makefirstuc{#1}%
+ \def\@mfu@argii{#2}%
+ \ifx\@mfu@argii\@nnil
+ \else
+ -\@MFUcapword#2\@endMFUcapword
+ \fi
+}
\newcommand*\mfu@checkword[1]{%
\def\mfu@checkword@arg{#1}%
- \let\@mfu@domakefirstuc\makefirstuc
+ \let\@mfu@domakefirstuc\MFUcapword
\forlistloop\mfu@checkword@do\@mfu@nocaplist
}
\newcommand*{\mfu@checkword@do}[1]{%
@@ -154,10 +237,93 @@
\newcommand*{\xcapitalisewords}[1]{%
\expandafter\capitalisewords\expandafter{#1}%
}
-\DeclareRobustCommand*{\ecapitalisewords}[1]{%
+\newrobustcmd*{\ecapitalisewords}[1]{%
\protected@edef\@MFU@caparg{#1}%
\expandafter\capitalisewords\expandafter{\@MFU@caparg}%
}
+\newcommand*{\capitalisefmtwords}[1]{%
+ \let\@mfu@checkword\@gobble
+ \def\gls@add@space{}%
+ \@capitalisefmtwords#1 \@nil\relax
+}
+\def\@capitalisefmtwords#1 #2{%
+ \def\gls@argi{#2}%
+ \ifx\gls@argi\@nnil
+ \def\@mfu@capfmtwordsnext{\@capitalise@fmtwords#1\@nil}%
+ \else
+ \def\@mfu@capfmtwordsnext{\@capitalise@fmtwords#1\@nil
+ \def\gls@add@space{ }%
+ \let\@mfu@checkword\mfu@checkword
+ \@@cap@nofmtphrase#2}%
+ \fi
+ \@mfu@capfmtwordsnext
+}%
+\def\@capitalise@fmtwords#1{%
+ \def\gls@argi{#1}%
+ \ifx\gls@argi\@nnil
+ \let\@mfu@capfmtwordsnext\relax
+ \else
+ \ifx\gls@argi\@MFU@protect
+ \def\@mfu@capfmtwordsnext{\@capitalise@fmtwords}%
+ \else
+ \def\@gls@tmp{\ #1}%
+ \@onelevel@sanitize\@gls@tmp
+ \expandafter\@gls@checkcs\@gls@tmp\relax\relax
+ \if@glscs
+ \def\@mfu@capfmtwordsnext{\@@capitalisefmtwords#1}%
+ \else
+ \ifx\gls@argi\@empty
+ \def\@mfu@capfmtwordsnext{\@@capnofmtphrase{}}%
+ \else
+ \def\@mfu@capfmtwordsnext{\@@capnofmtphrase#1}%
+ \fi
+ \fi
+ \fi
+ \fi
+ \@mfu@capfmtwordsnext
+}
+\def\@@capitalisefmtwords#1{%
+ \@ifnextchar\bgroup{\@@capfmtphrase#1}{\@@capnofmtphrase#1}%
+}
+\def\@@capfmtphrase#1#2#3{%
+ \def\@gls@tmp{#3}%
+ \ifx\@gls@tmp\@nnil
+ \def\@mfu@capfmtwordsnext{#1{\@capitalisefmtwords#2 \@nil}}%
+ \else
+ \def\@mfu@capfmtwordsnext{\@@capfmtsubphrase#1{#2}#3}%
+ \fi
+ \@mfu@capfmtwordsnext
+}
+\def\@@capnofmtphrase#1\@nil{%
+ \gls@add@space
+ \@mfu@mid@capitalisewords{#1}%
+ \def\gls@add@space{ }%
+}
+\def\@@capfmtsubphrase#1#2#3\@nil{%
+ \gls@add@space
+ #1{\@mfu@mid@capitalisewords{#2}}%
+ \def\gls@add@space{ }%
+ \let\@mfu@checkword\mfu@checkword
+ #3%
+}
+\def\@@cap@nofmtphrase#1 #2\@nil{%
+ \def\gls@arg{#2}%
+ \ifx\gls@arg\@empty
+ \@capitalisefmtwords#1 \@nil
+ \else
+ \@capitalisefmtwords#1 \@nil
+ \def\gls@add@space{ }%
+ \let\@mfu@checkword\mfu@checkword
+ \@capitalisefmtwords#2 \@nil
+ \fi
+}
+\newcommand*{\xcapitalisefmtwords}[1]{%
+ \expandafter\capitalisefmtwords\expandafter{#1}%
+}
+\newrobustcmd*{\ecapitalisefmtwords}[1]{%
+ \protected@edef\@MFU@caparg{#1}%
+ \expandafter\capitalisefmtwords\expandafter{\@MFU@caparg}%
+}
\endinput
%%
%% End of file `mfirstuc.sty'.