summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/mfirstuc
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-08-01 21:47:34 +0000
committerKarl Berry <karl@freefriends.org>2016-08-01 21:47:34 +0000
commita680fbdd019a24e851538a6dfde26ef301a0a286 (patch)
treedb1472fe87695f0c28151a86b79fa9444072d2a7 /Master/texmf-dist/tex/latex/mfirstuc
parent69961a3da1314fa29424307d3862116b626a3c7a (diff)
mfirstuc (1aug16)
git-svn-id: svn://tug.org/texlive/trunk@41785 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.sty2
-rw-r--r--Master/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty199
2 files changed, 150 insertions, 51 deletions
diff --git a/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc-english.sty b/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc-english.sty
index ad28d61a6c0..7b05e12309d 100644
--- a/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc-english.sty
+++ b/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc-english.sty
@@ -39,7 +39,7 @@
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{mfirstuc-english}[2016/07/29 v2.03 (NLCT)]
+\ProvidesPackage{mfirstuc-english}[2016/07/31 v2.04 (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 08b0f1f3aea..e94ec242a2a 100644
--- a/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty
+++ b/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty
@@ -39,7 +39,7 @@
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{mfirstuc}[2016/07/29 v2.03 (NLCT)]
+\ProvidesPackage{mfirstuc}[2016/07/31 v2.04 (NLCT)]
\RequirePackage{etoolbox}
\newif\if@glscs
\newtoks\@glsmfirst
@@ -107,6 +107,9 @@
\def\@gls@first{#1}\def\@gls@rest{#2}%
}%
}%
+ {%
+ \def\@gls@first{#1}\def\@gls@rest{#2}%
+ }%
}
}%
{%
@@ -223,12 +226,21 @@
\forlistloop\mfu@checkword@do\@mfu@nocaplist
}
\newcommand*{\mfu@checkword@do}[1]{%
- \ifdefstring{\mfu@checkword@arg}{#1}%
- {%
- \let\@mfu@domakefirstuc\@firstofone
- \listbreak
- }%
- {}%
+ \def\mfu@checkword@argii{#1}%
+ \ifdefequal\mfu@checkword@arg\mfu@checkword@argii
+ {%
+ \let\@mfu@domakefirstuc\@firstofone
+ \listbreak
+ }%
+ {%
+ \def\mfu@checkword@argii{#1{\@mfu@terminator}}%
+ \ifdefequal\mfu@checkword@arg\mfu@checkword@argii
+ {%
+ \let\@mfu@domakefirstuc\@firstofone
+ \listbreak
+ }%
+ {}%
+ }%
}
\newcommand*{\@mfu@nocaplist}{}
\newcommand*{\MFUnocap}[1]{\listadd{\@mfu@nocaplist}{#1}}
@@ -241,28 +253,98 @@
\protected@edef\@MFU@caparg{#1}%
\expandafter\capitalisewords\expandafter{\@MFU@caparg}%
}
-\newcommand*{\capitalisefmtwords}[1]{%
+\newcommand\@mfu@nil{\unskip}
+\newcommand*\@mfu@nnil{\@mfu@nil}
+\newcommand*{\capitalisefmtwords}{%
+ \@ifstar\@s@capitalisefmtwords\@ns@capitalisefmtwords
+}
+\newcommand*{\@s@capitalisefmtwords}[1]{%
+ \@@s@checkgrp@@capitalisefmtwords#1\@nil
+}
+\newcommand*{\@@s@checkgrp@@capitalisefmtwords}{%
+ \@ifnextchar\bgroup{\@@s@nocs@capitalisefmtwords}{\@@s@capitalisefmtwords}%
+}
+\def\@@s@nocs@capitalisefmtwords#1\@nil{%
+ \capitalisewords{#1}%
+}
+\newcommand*{\@@s@capitalisefmtwords}[1]{%
+ \def\gls@argi{#1}%
+ \ifx\gls@argi\@MFU@protect
+ \let\@mfu@capfmtwordsnext\@@s@capitalisefmtwords
+ \else
+ \ifx\gls@argi\@nnil
+ \let\@mfu@capfmtwordsnext\relax
+ \else
+ \def\@gls@tmp{\ #1}%
+ \@onelevel@sanitize\@gls@tmp
+ \expandafter\@gls@checkcs\@gls@tmp\relax\relax
+ \if@glscs
+ \def\@mfu@capfmtwordsnext{\@@s@cs@capitalisefmtwords#1}%
+ \else
+ \def\@mfu@capfmtwordsnext{\@@s@nocs@capitalisefmtwords#1}%
+ \fi
+ \fi
+ \fi
+ \@mfu@capfmtwordsnext
+}
+\newcommand*{\@@s@cs@capitalisefmtwords}[1]{%
+ \@ifnextchar\bgroup
+ {\@@s@cs@g@capitalisefmtwords#1}%
+ {\@@s@cs@ng@capitalisefmtwords#1}%
+}
+\def\@@s@cs@g@capitalisefmtwords#1#2#3\@nil{%
+ #1{\capitalisewords{#2}}%
+ \ifblank{#3}%
+ {}%
+ {%
+ \def\gls@add@space{}%
+ \let\@mfu@checkword\mfu@checkword
+ \mfu@capitalisewords#3 \@nil\mfu@endcap
+ }%
+}
+\def\@@s@cs@ng@capitalisefmtwords#1#2\@nil{%
+ \capitalisewords{#1#2}%
+}
+\newcommand*{\@ns@capitalisefmtwords}[1]{%
\let\@mfu@checkword\@gobble
\def\gls@add@space{}%
- \@capitalisefmtwords#1 \@nil\relax
+ \@capitalisefmtwords#1 \@mfu@nil{} \unskip
+}
+\newcommand*{\@capitalisefmtwords}{%
+ \@ifnextchar\bgroup{\@capitalise@g@fmtwords}{\@capitalise@ng@fmtwords}%
}
-\def\@capitalisefmtwords#1 #2{%
- \def\gls@argi{#2}%
- \ifx\gls@argi\@nnil
- \def\@mfu@capfmtwordsnext{\@capitalise@fmtwords#1\@nil}%
+\newcommand*{\@capitalise@g@fmtwords}[1]{%
+ \@capitalise@ng@fmtwords{{#1}}%
+}
+\def\@mfu@ifnil#1#2\@mfu@end@nil#3#4{%
+ \def\gls@argi{#1}%
+ \ifx\gls@argi\@mfu@nnil
+ #3%
\else
- \def\@mfu@capfmtwordsnext{\@capitalise@fmtwords#1\@nil
- \def\gls@add@space{ }%
- \let\@mfu@checkword\mfu@checkword
- \@@cap@nofmtphrase#2}%
+ #4%
\fi
+}
+\def\@capitalise@ng@fmtwords#1 {%
+ \@mfu@ifnil#1\relax\relax\@mfu@end@nil
+ {%
+ \def\@mfu@capfmtwordsnext{#1}%
+ }%
+ {%
+ \def\@mfu@capfmtwordsnext{%
+ \@capitalise@fmtwords#1\@mfu@nil
+ \def\gls@add@space{ }%
+ \let\@mfu@checkword\mfu@checkword
+ \@@cap@nofmtphrase}%
+ }%
\@mfu@capfmtwordsnext
}%
\def\@capitalise@fmtwords#1{%
- \def\gls@argi{#1}%
- \ifx\gls@argi\@nnil
- \let\@mfu@capfmtwordsnext\relax
- \else
+ \@mfu@ifnil#1\relax\relax\@mfu@end@nil
+ {%
+ \def\@mfu@capfmtwordsnext{#1}%
+ }%
+ {%
+ \def\gls@argi{#1}%
\ifx\gls@argi\@MFU@protect
\def\@mfu@capfmtwordsnext{\@capitalise@fmtwords}%
\else
@@ -279,50 +361,67 @@
\fi
\fi
\fi
- \fi
+ }%
\@mfu@capfmtwordsnext
}
\def\@@capitalisefmtwords#1{%
- \@ifnextchar\bgroup{\@@capfmtphrase#1}{\@@capnofmtphrase#1}%
+ \@ifnextchar\bgroup{\@@capfmtsubphrase#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{%
+ \@ifnextchar\bgroup{\@@cap@g@nofmtphrase}{\@@cap@ng@nofmtphrase}%
}
-\def\@@capnofmtphrase#1\@nil{%
+\def\@@cap@ng@nofmtphrase#1\@mfu@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\@@cap@g@nofmtphrase#1{%
+ \@@cap@ng@nofmtphrase{{#1}}%
+}
+\newcommand*\@mfu@terminator{\hbox{}}
+\def\@@capfmtsubphrase#1#2#3{%
+ #1{\@capitalisefmtwords#2{\@mfu@terminator} \@mfu@nil{} \unskip}%
\def\gls@add@space{ }%
\let\@mfu@checkword\mfu@checkword
- #3%
+ \@mfu@ifnil#1\relax\relax\@mfu@end@nil
+ {\let\@mfu@fmtsubphrasenext\relax}%
+ {\def\@mfu@fmtsubphrasenext{#3}}%
+ \@mfu@fmtsubphrasenext
}
-\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
+\def\@@cap@nofmtphrase#1 {%
+ \@mfu@ifnil#1\relax\relax\@mfu@end@nil
+ {%
+ \def\@mfu@capnofmtwordsnext{#1 }%
+ }%
+ {%
+ \def\@mfu@capnofmtwordsnext{%
+ \@capitalisefmtwords#1 \@mfu@nil{} \unskip
+ \def\gls@add@space{ }%
+ \let\@mfu@checkword\mfu@checkword
+ \@capitalisefmtwords
+ }%
+ }%
+ \@mfu@capnofmtwordsnext
+}
+\newcommand*{\xcapitalisefmtwords}{%
+ \@ifstar\@s@xcapitalisefmtwords\@ns@xcapitalisefmtwords
+}
+\newcommand*{\@s@xcapitalisefmtwords}[1]{%
+ \expandafter\@s@capitalisefmtwords\expandafter{#1}%
}
-\newcommand*{\xcapitalisefmtwords}[1]{%
- \expandafter\capitalisefmtwords\expandafter{#1}%
+\newcommand*{\@ns@xcapitalisefmtwords}[1]{%
+ \expandafter\@ns@capitalisefmtwords\expandafter{#1}%
+}
+\newrobustcmd*{\ecapitalisefmtwords}{%
+ \@ifstar\@s@ecapitalisefmtwords\@ns@ecapitalisefmtwords
+}
+\newcommand*{\@s@ecapitalisefmtwords}[1]{%
+ \protected@edef\@MFU@caparg{#1}%
+ \expandafter\@s@capitalisefmtwords\expandafter{\@MFU@caparg}%
}
-\newrobustcmd*{\ecapitalisefmtwords}[1]{%
+\newcommand*{\@ns@ecapitalisefmtwords}[1]{%
\protected@edef\@MFU@caparg{#1}%
- \expandafter\capitalisefmtwords\expandafter{\@MFU@caparg}%
+ \expandafter\@ns@capitalisefmtwords\expandafter{\@MFU@caparg}%
}
\endinput
%%