texlive[41785] Master/texmf-dist: mfirstuc (1aug16)
commits+karl at tug.org
commits+karl at tug.org
Mon Aug 1 23:47:34 CEST 2016
Revision: 41785
http://tug.org/svn/texlive?view=revision&revision=41785
Author: karl
Date: 2016-08-01 23:47:34 +0200 (Mon, 01 Aug 2016)
Log Message:
-----------
mfirstuc (1aug16)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/mfirstuc/CHANGES
trunk/Master/texmf-dist/doc/latex/mfirstuc/README
trunk/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-code.pdf
trunk/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-manual.html
trunk/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-manual.pdf
trunk/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-manual.tex
trunk/Master/texmf-dist/doc/latex/mfirstuc/sample-mfirstuc.pdf
trunk/Master/texmf-dist/doc/latex/mfirstuc/sample-mfirstuc.tex
trunk/Master/texmf-dist/source/latex/mfirstuc/mfirstuc.dtx
trunk/Master/texmf-dist/source/latex/mfirstuc/mfirstuc.ins
trunk/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc-english.sty
trunk/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty
Modified: trunk/Master/texmf-dist/doc/latex/mfirstuc/CHANGES
===================================================================
--- trunk/Master/texmf-dist/doc/latex/mfirstuc/CHANGES 2016-08-01 21:47:21 UTC (rev 41784)
+++ trunk/Master/texmf-dist/doc/latex/mfirstuc/CHANGES 2016-08-01 21:47:34 UTC (rev 41785)
@@ -1,5 +1,11 @@
mfirstuc change log:
+v2.04:
+
+ * bug fixes in \capitalisefmtwords and \@gls at split
+
+ * added starred form of \capitalisefmtwords
+
v2.03:
* Fixed test for \protect at the start of \makefirstuc
Modified: trunk/Master/texmf-dist/doc/latex/mfirstuc/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/mfirstuc/README 2016-08-01 21:47:21 UTC (rev 41784)
+++ trunk/Master/texmf-dist/doc/latex/mfirstuc/README 2016-08-01 21:47:34 UTC (rev 41785)
@@ -1,6 +1,6 @@
-LaTeX Package : mfirstuc v2.03
+LaTeX Package : mfirstuc v2.04
-Last Modified : 2016-07-29
+Last Modified : 2016-07-31
Author : Nicola Talbot
Modified: trunk/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-code.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-manual.html
===================================================================
--- trunk/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-manual.html 2016-08-01 21:47:21 UTC (rev 41784)
+++ trunk/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-manual.html 2016-08-01 21:47:34 UTC (rev 41785)
@@ -127,6 +127,7 @@
span.bar-css {text-decoration:overline;}
img.cdots{vertical-align:middle;}
.partToc a, .partToc, .likepartToc a, .likepartToc {line-height: 200%; font-weight:bold; font-size:110%;}
+.chapterToc a, .chapterToc, .likechapterToc a, .likechapterToc, .appendixToc a, .appendixToc {line-height: 200%; font-weight:bold;}
.index-item, .index-subitem, .index-subsubitem {display:block}
div.caption {text-indent:-2em; margin-left:3em; margin-right:1em; text-align:left;}
div.caption span.id{font-weight: bold; white-space: nowrap; }
@@ -143,6 +144,7 @@
div.author, div.date {text-align:center;}
div.thanks{text-align:left; margin-left:10%; font-size:85%; font-style:italic; }
.quotation {margin-bottom:0.25em; margin-top:0.25em; margin-left:1em; }
+h1.partHead{text-align: center}
.abstract p {margin-left:5%; margin-right:5%;}
div.abstract {width:100%;}
.alltt P { margin-bottom : 0em; margin-top : 0em; }
@@ -172,7 +174,7 @@
>
<!--l. 36--><p class="noindent" >
</p><!--l. 36--><p class="noindent" ><span
-class="cmr-17">mfirstuc.sty v2.03: uppercasing first letter</span>
+class="cmr-17">mfirstuc.sty v2.04: uppercasing first letter</span>
</p>
<div class="tabular"> <table id="TBL-1" class="tabular"
cellspacing="0" cellpadding="0"
@@ -194,36 +196,38 @@
class="cmtt-12">http://www.dickimaw-books.com/</span></a></td></tr></table>
</div>
<!--l. 36--><p class="noindent" ><span
-class="cmr-12">2016-07-29</span></p></div>
- <h3 class="likesectionHead"><a
- id="x1-1000"></a>Contents</h3>
- <div class="tableofcontents">
- <span class="sectionToc" >1 <a
+class="cmr-12">2016-07-31</span></p></div>
+
+
+
+ <h2 class="likechapterHead"><a
+ id="x1-1000"></a>Contents</h2> <div class="tableofcontents">
+ <span class="chapterToc" >1 <a
href="#sec:intro" id="QQ2-1-2">Introduction</a></span>
-<br /> <span class="sectionToc" >2 <a
+<br /> <span class="chapterToc" >2 <a
href="#sec:makefirstuc" id="QQ2-1-3">Capitalising the First Letter of a Word</a></span>
-<br /> <span class="sectionToc" >3 <a
+<br /> <span class="chapterToc" >3 <a
href="#sec:capitalisewords" id="QQ2-1-4">Capitalise the First Letter of Each Word in a Phrase or Sentence (Title Case)</a></span>
-<br />  <span class="subsectionToc" >3.1 <a
+<br />  <span class="sectionToc" >3.1 <a
href="#sec:pdfbookmarks" id="QQ2-1-5">PDF Bookmarks</a></span>
-<br />  <span class="subsectionToc" >3.2 <a
+<br />  <span class="sectionToc" >3.2 <a
href="#sec:nocap" id="QQ2-1-6">Excluding Words From Case-Changing</a></span>
-<br /> <span class="sectionToc" >4 <a
+<br /> <span class="chapterToc" >4 <a
href="#sec:utf8" id="QQ2-1-7">UTF-8</a></span>
</div>
-<!--l. 39--><p class="noindent" >
-</p>
-<!--l. 39--><p class="noindent" ><a
-href="#top">Top</a><h2 class="sectionHead"></p><h3 class="sectionHead"><span class="titlemark">1 </span> <a
- id="sec:intro"></a>Introduction</h3>
-<!--l. 42--><p class="noindent" >The <span
+
+
+
+<!--l. 39--><p class="indent" > <div class="chapter"><h2 class="chapterHead">1. <a
+ id="sec:intro"></a>Introduction</h2>
+</p><!--l. 42--><p class="indent" > The <span
class="cmss-10">mfirstuc </span>package was originally part of the <span
-class="cmss-10">glossaries </span>bundle for use with commands like
-<span
+class="cmss-10">glossaries </span>bundle for use with commands
+like <span
class="cmtt-10">\Gls</span>, but as the commands provided by <span
class="cmss-10">mfirstuc </span>may be used without <span
-class="cmss-10">glossaries</span>, the two have
-been split into separately maintained packages.
+class="cmss-10">glossaries</span>, the two
+have been split into separately maintained packages.
</p><!--l. 48--><p class="indent" > <div class="important" title="Important Note"> The commands described here all have limitations. To minimise problems, use text-block
style semantic commands with one argument (the text that requires case-changing), and avoid
scoped declarations. </div>
@@ -291,14 +295,17 @@
class="cmtt-10">\ecapitalisewords </span>and
<span
class="cmtt-10">\ecapitalisefmtwords</span>).
-</p><!--l. 102--><p class="noindent" >
+
+
+
</p>
-<!--l. 102--><p class="noindent" ><a
-href="#top">Top</a><h2 class="sectionHead"></p><h3 class="sectionHead"><span class="titlemark">2 </span> <a
- id="sec:makefirstuc"></a>Capitalising the First Letter of a Word</h3>
-<!--l. 105--><p class="noindent" >A simple word can be capitalised just using the standard <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span
-class="E">E</span>X</span></span> upper casing command. For
-example,
+<!--l. 102--><p class="indent" > </div>
+</p><!--l. 102--><p class="noindent" ><a
+href="#top">Top</a><div class="chapter"><h2 class="chapterHead">2. <a
+ id="sec:makefirstuc"></a>Capitalising the First Letter of a Word</h2>
+</p><!--l. 105--><p class="indent" > A simple word can be capitalised just using the standard <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span
+class="E">E</span>X</span></span> upper casing command.
+For example,
@@ -390,30 +397,67 @@
class="cmtt-10">ä</span><span
class="cmtt-10">}bc}</span></span></span> produces Äbc.
</li></ul>
-<!--l. 161--><p class="noindent" >Note that non-Latin or accented characters appearing at the start of the text must be placed in a
-group (even if you are using the <span
+<!--l. 162--><p class="indent" > Note that non-Latin or accented characters appearing at the start of the text should be
+placed in a group (even if you are using the <span
class="cmss-10">inputenc</span><a
- id="dx1-3003"></a> package). The reason for this restriction is detailed in
-<a
+ id="dx1-3003"></a> package). The reason for this restriction
+is detailed in <a
href="#sec:utf8"><span
class="cmsy-10">§</span>4 </a><a
href="#sec:utf8">UTF-8<!--tex4ht:ref: sec:utf8 --></a>.
-</p><!--l. 166--><p class="indent" > <div class="important" title="Important Note"> In version 1.02 of <span
+</p><!--l. 167--><p class="indent" > <span
+class="cmbx-10">New to version 2.04: </span>There is now limited support for UTF-8 characters with the
+<span
+class="cmss-10">inputenc</span><a
+ id="dx1-3004"></a> package, provided that you load <span
+class="cmss-10">datatool-base</span><a
+ id="dx1-3005"></a> (at least v2.24) before <span
+class="cmss-10">mfirstuc</span>
+(<span
+class="cmss-10">datatool-base</span><a
+ id="dx1-3006"></a> is loaded automatically with newer versions of <span
+class="cmss-10">glossaries</span><a
+ id="dx1-3007"></a>). If available <span
+class="cmss-10">mfirstuc</span><a
+ id="dx1-3008"></a>
+will now use <span
+class="cmss-10">datatool-base</span><a
+ id="dx1-3009"></a>’s <span
+class="cmtt-10">\dtl at getfirst@UTFviii</span><a
+ id="dx1-3010"></a> command which is still experimental.
+See the <span
+class="cmss-10">datatool </span>manual for further details.
+
+
+
+</p>
+ <div class="verbatim" id="verbatim-9">
+\documentclass{article}
+ <br />\usepackage[T1]{fontenc}
+ <br />\usepackage[utf8]{inputenc}
+ <br />\usepackage{datatool-base}[2016/01/12]% v2.24+
+ <br />\usepackage{mfirstuc}
+ <br />\begin{document}
+ <br />\makefirstuc{élite}
+ <br />\end{document}
+</div>
+<!--l. 188--><p class="nopar" > (Package ordering is important.)
+</p><!--l. 191--><p class="indent" > <div class="important" title="Important Note"> In version 1.02 of <span
class="cmss-10">mfirstuc</span>, a bug fix resulted in a change in output if the first object is a
control sequence followed by an empty group. Prior to version 1.02, <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">\makefirstuc{\ae{}bc}</span></span></span>
produced æBc. However as from version 1.02, it now produces Æbc. </div>
-</p><!--l. 172--><p class="noindent" >
-</p><!--l. 174--><p class="indent" > Note also that
+</p><!--l. 197--><p class="noindent" >
+</p><!--l. 199--><p class="indent" > Note also that
</p>
- <div class="verbatim" id="verbatim-9">
+ <div class="verbatim" id="verbatim-10">
\newcommand{\abc}{abc}
 <br />\makefirstuc{\abc}
</div>
-<!--l. 178--><p class="nopar" > produces: ABC. This is because the first object in the argument of <span
+<!--l. 203--><p class="nopar" > produces: ABC. This is because the first object in the argument of <span
class="cmtt-10">\makefirstuc </span>is <span
class="cmtt-10">\abc</span>, so
it does <span class="obeylines-h"><span class="verb"><span
@@ -422,19 +466,19 @@
</p>
- <div class="verbatim" id="verbatim-10">
+ <div class="verbatim" id="verbatim-11">
\newcommand{\abc}{abc}
 <br />\expandafter\makefirstuc\expandafter{\abc}
</div>
-<!--l. 185--><p class="nopar" > produces: Abc. There is a short cut command which will do this:
-</p><!--l. 187--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
+<!--l. 210--><p class="nopar" > produces: Abc. There is a short cut command which will do this:
+</p><!--l. 212--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
class="cmtt-9">\xmakefirstuc</span><span
class="cmtt-9"> </span></span><a
- id="dx1-3004"></a> <span
+ id="dx1-3011"></a> <span
class="cmtt-10">\xmakefirstuc{</span>⟨<span
class="cmitt-10">stuff</span>⟩<span
class="cmtt-10">} </span></div><hr>
-</p><!--l. 189--><p class="noindent" >
+</p><!--l. 214--><p class="noindent" >
This is equivalent to <span
class="cmtt-10">\expandafter\makefirstuc\expandafter{</span>⟨<span
class="cmti-10">stuff </span>⟩<span
@@ -443,33 +487,33 @@
</p>
- <div class="verbatim" id="verbatim-11">
+ <div class="verbatim" id="verbatim-12">
\newcommand{\abc}{abc}
 <br />\xmakefirstuc{\abc}
</div>
-<!--l. 194--><p class="nopar" > produces: Abc.
-</p><!--l. 199--><p class="indent" > <div class="important" title="Important Note"> <span
+<!--l. 219--><p class="nopar" > produces: Abc.
+</p><!--l. 224--><p class="indent" > <div class="important" title="Important Note"> <span
class="cmtt-10">\xmakefirstuc </span>only performs one level expansion on the <span
class="cmti-10">first </span>object in its argument. It
does not fully expand the entire argument. </div>
-</p><!--l. 203--><p class="noindent" >
-</p><!--l. 205--><p class="indent" > As from version 1.10, there is now a command that fully expands the entire argument
+</p><!--l. 228--><p class="noindent" >
+</p><!--l. 230--><p class="indent" > As from version 1.10, there is now a command that fully expands the entire argument
before applying <span
class="cmtt-10">\makefirstuc</span>:
-</p><!--l. 207--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
+</p><!--l. 232--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
class="cmtt-9">\emakefirstuc</span><span
class="cmtt-9"> </span></span><a
- id="dx1-3005"></a> <span
+ id="dx1-3012"></a> <span
class="cmtt-10">\emakefirstuc{</span>⟨<span
class="cmitt-10">text</span>⟩<span
class="cmtt-10">} </span></div><hr>
-</p><!--l. 209--><p class="noindent" >
-</p><!--l. 211--><p class="indent" > Examples:
+</p><!--l. 234--><p class="noindent" >
+</p><!--l. 236--><p class="indent" > Examples:
</p>
- <div class="verbatim" id="verbatim-12">
+ <div class="verbatim" id="verbatim-13">
\newcommand{\abc}{\xyz a}
 <br />\newcommand{\xyz}{xyz}
 <br />No expansion: \makefirstuc{\abc}.
@@ -476,54 +520,56 @@
 <br />First object one-level expansion: \xmakefirstuc{\abc}.
 <br />Fully expanded: \emakefirstuc{\abc}.
</div>
-<!--l. 218--><p class="nopar" > produces: No expansion: XYZA. First object one-level expansion: XYZa. Fully expanded:
+<!--l. 243--><p class="nopar" > produces: No expansion: XYZA. First object one-level expansion: XYZa. Fully expanded:
Xyza.
-</p><!--l. 226--><p class="indent" > If you use <span
+</p><!--l. 251--><p class="indent" > If you use <span
class="cmss-10">mfirstuc </span>without the <span
class="cmss-10">glossaries</span><a
- id="dx1-3006"></a> package, the standard <span
+ id="dx1-3013"></a> package, the standard <span
class="cmtt-10">\MakeUppercase </span>command
is used. If used with <span
class="cmss-10">glossaries</span><a
- id="dx1-3007"></a>, <span
+ id="dx1-3014"></a>, <span
class="cmtt-10">\MakeTextUppercase</span><a
- id="dx1-3008"></a> (defined by the <span
+ id="dx1-3015"></a> (defined by the <span
class="cmss-10">textcase</span><a
- id="dx1-3009"></a> package) is used
+ id="dx1-3016"></a> package) is used
instead. If you are using <span
class="cmss-10">mfirstuc </span>without the <span
class="cmss-10">glossaries </span>package and want to use
<span
class="cmtt-10">\MakeTextUppercase</span><a
- id="dx1-3010"></a> instead, you can redefine
-</p><!--l. 232--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
+ id="dx1-3017"></a> instead, you can redefine
+</p><!--l. 257--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
class="cmtt-9">\glsmakefirstuc</span><span
class="cmtt-9"> </span></span><a
- id="dx1-3011"></a> <span
+ id="dx1-3018"></a> <span
class="cmtt-10">\glsmakefirstuc{</span>⟨<span
class="cmitt-10">text</span>⟩<span
class="cmtt-10">} </span></div><hr>
-</p><!--l. 234--><p class="noindent" >
+</p><!--l. 259--><p class="noindent" >
For example:
</p>
- <div class="verbatim" id="verbatim-13">
+ <div class="verbatim" id="verbatim-14">
\renewcommand{\glsmakefirstuc}[1]{\MakeTextUppercase #1}
</div>
-<!--l. 238--><p class="nopar" > Remember to also load <span
+<!--l. 263--><p class="nopar" > Remember to also load <span
class="cmss-10">textcase</span><a
- id="dx1-3012"></a> (<span
+ id="dx1-3019"></a> (<span
class="cmss-10">glossaries </span>loads this automatically).
-</p><!--l. 242--><p class="noindent" >
+
+
+
</p>
-<!--l. 242--><p class="noindent" ><a
-href="#top">Top</a><h2 class="sectionHead"></p><h3 class="sectionHead"><span class="titlemark">3 </span> <a
- id="sec:capitalisewords"></a>Capitalise the First Letter of Each Word in a Phrase or Sentence (Title
-Case)</h3>
-<!--l. 245--><p class="noindent" >New to mfirstuc v1.06:
-</p><!--l. 246--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
+<!--l. 267--><p class="indent" > </div>
+</p><!--l. 267--><p class="noindent" ><a
+href="#top">Top</a><div class="chapter"><h2 class="chapterHead">3. <a
+ id="sec:capitalisewords"></a>Capitalise the First Letter of Each Word in a Phrase or Sentence (Title Case)</h2>
+</p><!--l. 270--><p class="indent" > New to mfirstuc v1.06:
+</p><!--l. 271--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
class="cmtt-9">\capitalisewords</span><span
class="cmtt-9"> </span></span><a
id="dx1-4001"></a> <span
@@ -530,7 +576,7 @@
class="cmtt-10">\capitalisewords{</span>⟨<span
class="cmitt-10">text</span>⟩<span
class="cmtt-10">} </span></div><hr>
-</p><!--l. 248--><p class="noindent" >
+</p><!--l. 273--><p class="noindent" >
This command applies <span
class="cmtt-10">\makefirstuc</span><a
id="dx1-4002"></a> to each word in ⟨<span
@@ -545,8 +591,8 @@
</a><a
href="#sec:nocap">Excluding Words From Case-Changing<!--tex4ht:ref: sec:nocap --></a> for excluding words (such as “of”) from the
case-changing.
-</p><!--l. 256--><p class="indent" > The actual capitalisation of each word is done using (new to version 2.03):
-</p><!--l. 258--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
+</p><!--l. 281--><p class="indent" > The actual capitalisation of each word is done using (new to version 2.03):
+</p><!--l. 283--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
class="cmtt-9">\MFUcapword</span><span
class="cmtt-9"> </span></span><a
id="dx1-4003"></a> <span
@@ -553,42 +599,42 @@
class="cmtt-10">\MFUcapword{</span>⟨<span
class="cmitt-10">word</span>⟩<span
class="cmtt-10">} </span></div><hr>
-</p><!--l. 260--><p class="noindent" >
+</p><!--l. 285--><p class="noindent" >
This just does <span
class="cmtt-10">\makefirstuc{</span>⟨<span
class="cmti-10">word</span>⟩<span
class="cmtt-10">} </span>by default, but its behaviour is determined by the
conditional:
-</p><!--l. 263--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
+</p><!--l. 288--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
class="cmtt-9">\ifMFUhyphen</span><span
class="cmtt-9"> </span></span><a
id="dx1-4004"></a> <span
class="cmtt-10">\ifMFUhyphen </span></div><hr>
-</p><!--l. 265--><p class="noindent" >
-</p><!--l. 267--><p class="indent" > If you want to title case each part of a compound word containing hyphens, you can enable
+</p><!--l. 290--><p class="noindent" >
+</p><!--l. 292--><p class="indent" > If you want to title case each part of a compound word containing hyphens, you can enable
this using
-</p><!--l. 269--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
+</p><!--l. 294--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
class="cmtt-9">\MFUhyphentrue</span><span
class="cmtt-9"> </span></span><a
id="dx1-4005"></a> <span
class="cmtt-10">\MFUhyphentrue </span></div><hr>
-</p><!--l. 271--><p class="noindent" >
+</p><!--l. 296--><p class="noindent" >
or switch it back off again using:
-</p><!--l. 273--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
+</p><!--l. 298--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
class="cmtt-9">\MFUhyphenfalse</span><span
class="cmtt-9"> </span></span><a
id="dx1-4006"></a> <span
class="cmtt-10">\MFUhyphenfalse </span></div><hr>
-</p><!--l. 275--><p class="noindent" >
+</p><!--l. 300--><p class="noindent" >
Compare
</p>
- <div class="verbatim" id="verbatim-14">
+ <div class="verbatim" id="verbatim-15">
\capitalisewords{server-side includes}
</div>
-<!--l. 279--><p class="nopar" > which produces: <spacer type=vertical size=10><span class="obeylines-h">
+<!--l. 304--><p class="nopar" > which produces: <spacer type=vertical size=10><span class="obeylines-h">
<br />Server-side Includes
<br /><spacer type=vertical size=10></span>
with
@@ -596,14 +642,14 @@
</p>
- <div class="verbatim" id="verbatim-15">
+ <div class="verbatim" id="verbatim-16">
\MFUhyphentrue
 <br />\capitalisewords{server-side includes}
</div>
-<!--l. 288--><p class="nopar" > which produces: <spacer type=vertical size=10><span class="obeylines-h">
+<!--l. 313--><p class="nopar" > which produces: <spacer type=vertical size=10><span class="obeylines-h">
<br />Server-Side Includes
<br /><spacer type=vertical size=10></span>
-</p><!--l. 295--><p class="indent" > Formatting for the entire phrase must go outside <span
+</p><!--l. 320--><p class="indent" > Formatting for the entire phrase must go outside <span
class="cmtt-10">\capitalisewords </span>(unlike
<span
class="cmtt-10">\makefirstuc</span>). Compare:
@@ -611,10 +657,10 @@
</p>
- <div class="verbatim" id="verbatim-16">
+ <div class="verbatim" id="verbatim-17">
\capitalisewords{\textbf{a sample phrase}}
</div>
-<!--l. 299--><p class="nopar" > which produces: <spacer type=vertical size=10><span class="obeylines-h">
+<!--l. 324--><p class="nopar" > which produces: <spacer type=vertical size=10><span class="obeylines-h">
<br /><span
class="cmbx-10">A sample phrase</span>
<br /><spacer type=vertical size=10></span>
@@ -623,20 +669,20 @@
</p>
- <div class="verbatim" id="verbatim-17">
+ <div class="verbatim" id="verbatim-18">
\textbf{\capitalisewords{a sample phrase}}
</div>
-<!--l. 307--><p class="nopar" > which produces: <spacer type=vertical size=10><span class="obeylines-h">
+<!--l. 332--><p class="nopar" > which produces: <spacer type=vertical size=10><span class="obeylines-h">
<br /><span
class="cmbx-10">A Sample Phrase</span>
<br /><spacer type=vertical size=10></span>
-</p><!--l. 313--><p class="indent" > As from version 2.03, there is now a command for phrases that may include a formatting
+</p><!--l. 338--><p class="indent" > As from version 2.03, there is now a command for phrases that may include a formatting
command:
-</p><!--l. 316--><p class="indent" > <hr><div title="Definition"><span
+</p><!--l. 341--><p class="indent" > <hr><div title="Definition"><span
class="cmtt-10">\capitalisefmtwords{</span>⟨<span
class="cmitt-10">phrase</span>⟩<span
class="cmtt-10">} </span></div><hr>
-</p><!--l. 317--><p class="noindent" >
+</p><!--l. 342--><p class="noindent" >
where ⟨<span
class="cmti-10">phrase</span>⟩ may be just words (as with <span
class="cmtt-10">\capitalisewords</span>) or may be entirely enclosed in a
@@ -667,7 +713,14 @@
class="cmsy-10">}</span>
</div>
</div> Avoid scoped declarations.
-<!--l. 329--><p class="indent" > Examples:
+<!--l. 354--><p class="indent" > <div class="important" title="Important Note"> <span
+class="cmtt-10">\capitalisefmtwords </span>is only designed for phrases that contain text-block commands
+with a single argument, which should be a word or sub-phrase. Anything more complicated is
+likely to break. Instead, use the starred form or <span
+class="cmtt-10">\capitalisewords</span>. </div>
+</p><!--l. 360--><p class="noindent" >
+</p><!--l. 362--><p class="indent" > The starred form only permits a text-block command at the start of the phrase.
+</p><!--l. 365--><p class="indent" > Examples:
</p><ol class="enumerate1" >
<li
class="enumerate" id="x1-4008x1">Phrase entirely enclosed in a formatting command:
@@ -674,10 +727,10 @@
- <div class="verbatim" id="verbatim-18">
+ <div class="verbatim" id="verbatim-19">
\capitalisefmtwords{\textbf{a small book of rhyme}}
</div>
- <!--l. 334--><p class="nopar" > produces: <spacer type=vertical size=10><span class="obeylines-h">
+ <!--l. 370--><p class="nopar" > produces: <spacer type=vertical size=10><span class="obeylines-h">
<br /><span
class="cmbx-10">A Small Book Of Rhyme</span>
<br /><spacer type=vertical size=10></span>
@@ -687,10 +740,10 @@
- <div class="verbatim" id="verbatim-19">
+ <div class="verbatim" id="verbatim-20">
\capitalisefmtwords{a \textbf{small book} of rhyme}
</div>
- <!--l. 343--><p class="nopar" > produces: <spacer type=vertical size=10><span class="obeylines-h">
+ <!--l. 379--><p class="nopar" > produces: <spacer type=vertical size=10><span class="obeylines-h">
<br />A <span
class="cmbx-10">Small Book </span>Of Rhyme
<br /><spacer type=vertical size=10></span>
@@ -700,10 +753,10 @@
- <div class="verbatim" id="verbatim-20">
+ <div class="verbatim" id="verbatim-21">
\capitalisefmtwords{\textbf{a \emph{small book}} of rhyme}
</div>
- <!--l. 352--><p class="nopar" > produces: <spacer type=vertical size=10><span class="obeylines-h">
+ <!--l. 388--><p class="nopar" > produces: <spacer type=vertical size=10><span class="obeylines-h">
<br /><span
class="cmbx-10">A </span><span
class="cmbxti-10">Small Book </span>Of Rhyme
@@ -718,25 +771,88 @@
- <div class="verbatim" id="verbatim-21">
+ <div class="verbatim" id="verbatim-22">
\MFUnocap{of}
 <br />\capitalisefmtwords{\textbf{a \emph{small book}} of rhyme}
</div>
- <!--l. 363--><p class="nopar" > produces: <spacer type=vertical size=10><span class="obeylines-h">
+ <!--l. 399--><p class="nopar" > produces: <spacer type=vertical size=10><span class="obeylines-h">
<br /><span
class="cmbx-10">A </span><span
class="cmbxti-10">Small Book </span>of Rhyme
<br /><spacer type=vertical size=10></span>
- </p></li></ol>
-<!--l. 371--><p class="indent" > Grouping causes interference:
+ </p></li>
+ <li
+ class="enumerate" id="x1-4016x5">Starred form:
+ <div class="verbatim" id="verbatim-23">
+ \MFUnocap{of}
+  <br />\capitalisefmtwords*{\emph{a small book of rhyme}}
+</div>
+ <!--l. 410--><p class="nopar" > produces: <spacer type=vertical size=10><span class="obeylines-h">
+ <br /><span
+class="cmti-10">A Small Book of Rhyme</span>
+ <br /><spacer type=vertical size=10></span>
+ </p></li>
+ <li
+ class="enumerate" id="x1-4018x6">The starred form also works with just text (no text-block command):
+
+
+
+ <div class="verbatim" id="verbatim-24">
+ \MFUnocap{of}
+  <br />\capitalisefmtwords*{a small book of rhyme}
+</div>
+ <!--l. 422--><p class="nopar" > produces: <spacer type=vertical size=10><span class="obeylines-h">
+ <br />A Small Book of Rhyme
+ <br /><spacer type=vertical size=10></span>
</p>
- <div class="verbatim" id="verbatim-22">
+ </li></ol>
+<!--l. 431--><p class="indent" > If there is a text-block command within the argument of the starred form, it’s assumed to
+be at the start of the argument. Unexpected results can occur if there are other commands.
+For example
+
+
+
+</p>
+ <div class="verbatim" id="verbatim-25">
+\MFUnocap{of}
+ <br />\capitalisefmtwords*{\emph{a small} book \textbf{of rhyme}}
+</div>
+<!--l. 438--><p class="nopar" > produces: <spacer type=vertical size=10><span class="obeylines-h">
+ <br /><span
+class="cmti-10">A Small </span>Book <span
+class="cmbx-10">Of rhyme</span>
+ <br /><spacer type=vertical size=10></span>
+(In this case <span class="obeylines-h"><span class="verb"><span
+class="cmtt-10">\textbf{of</span><span
+class="cmtt-10"> rhyme}</span></span></span> is considered a single word.) Similarly if the text-block
+command occurs in the middle of the argument:
+
+
+
+</p>
+ <div class="verbatim" id="verbatim-26">
+\MFUnocap{of}
+ <br />\capitalisefmtwords*{a \emph{very small} book of rhyme}
+</div>
+<!--l. 450--><p class="nopar" > produces: <spacer type=vertical size=10><span class="obeylines-h">
+ <br />A <span
+class="cmti-10">Very small </span>Book of Rhyme
+ <br /><spacer type=vertical size=10></span>
+(In this case <span class="obeylines-h"><span class="verb"><span
+class="cmtt-10">\emph{very</span><span
+class="cmtt-10"> small}</span></span></span> is considered a single word.)
+</p><!--l. 459--><p class="indent" > Grouping causes interference:
+
+
+
+</p>
+ <div class="verbatim" id="verbatim-27">
\capitalisefmtwords{{a \emph{small book}} of rhyme}
</div>
-<!--l. 374--><p class="nopar" > produces: <spacer type=vertical size=10><span class="obeylines-h">
+<!--l. 462--><p class="nopar" > produces: <spacer type=vertical size=10><span class="obeylines-h">
<br />A <span
class="cmti-10">Small book </span>Of Rhyme
<br /><spacer type=vertical size=10></span>
@@ -746,69 +862,102 @@
</p>
- <div class="verbatim" id="verbatim-23">
+ <div class="verbatim" id="verbatim-28">
\capitalisefmtwords{{\bfseries a \emph{small book}} of rhyme}
</div>
-<!--l. 383--><p class="nopar" > produces: <spacer type=vertical size=10><span class="obeylines-h">
+<!--l. 471--><p class="nopar" > produces: <spacer type=vertical size=10><span class="obeylines-h">
<br />a <span
class="cmti-10">Small book </span>Of Rhyme
<br /><spacer type=vertical size=10></span>
-</p><!--l. 389--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
+</p><!--l. 477--><p class="indent" > Avoid complicated commands in the unstarred version. For example, the following
+breaks:
+
+
+
+</p>
+ <div class="verbatim" id="verbatim-29">
+\newcommand*{\swap}[2]{{#2}{#1}}
+ <br />\capitalisefmtwords{a \swap{bo}{ok} of rhyme}
+</div>
+<!--l. 482--><p class="nopar" > However it works okay with the starred form and the simpler <span
+class="cmtt-10">\capitalisewords</span>:
+
+
+
+</p>
+ <div class="verbatim" id="verbatim-30">
+\newcommand*{\swap}[2]{{#2}{#1}}
+ <br />\capitalisefmtwords*{a \swap{bo}{ok} of rhyme}
+ <br />\capitalisewords{a \swap{bo}{ok} of rhyme}
+</div>
+<!--l. 490--><p class="nopar" > Produces: <spacer type=vertical size=10><span class="obeylines-h">
+ <br />A okBo Of Rhyme
+ <br />A okBo Of Rhyme
+ <br /><spacer type=vertical size=10></span>
+Note that the case change is applied to the first argument.
+</p><!--l. 500--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
class="cmtt-9">\xcapitalisewords</span><span
class="cmtt-9"> </span></span><a
- id="dx1-4015"></a> <span
+ id="dx1-4019"></a> <span
class="cmtt-10">\xcapitalisewords{</span>⟨<span
class="cmitt-10">text</span>⟩<span
class="cmtt-10">} </span></div><hr>
-</p><!--l. 391--><p class="noindent" >
+</p><!--l. 502--><p class="noindent" >
This is a short cut for <span
class="cmtt-10">\expandafter\capitalisewords\expandafter{</span>⟨<span
class="cmti-10">text</span>⟩<span
class="cmtt-10">}</span>.
-</p><!--l. 395--><p class="indent" > As from version 1.10, there is now a command that fully expands the entire argument
+</p><!--l. 506--><p class="indent" > As from version 1.10, there is now a command that fully expands the entire argument
before applying <span
class="cmtt-10">\capitalisewords</span>:
-</p><!--l. 397--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
+</p><!--l. 508--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
class="cmtt-9">\ecapitalisewords</span><span
class="cmtt-9"> </span></span><a
- id="dx1-4016"></a> <span
+ id="dx1-4020"></a> <span
class="cmtt-10">\ecapitalisewords{</span>⟨<span
class="cmitt-10">text</span>⟩<span
class="cmtt-10">} </span></div><hr>
-</p><!--l. 399--><p class="noindent" >
-</p><!--l. 401--><p class="indent" > There are also similar shortcut commands for the version that allows formatting
+</p><!--l. 510--><p class="noindent" >
+</p><!--l. 512--><p class="indent" > There are also similar shortcut commands for the version that allows text-block
commands:
-</p><!--l. 403--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
+</p><!--l. 514--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
class="cmtt-9">\xcapitalisefmtwords</span><span
class="cmtt-9"> </span></span><a
- id="dx1-4017"></a> <span
+ id="dx1-4021"></a> <span
class="cmtt-10">\xcapitalisefmtwords{</span>⟨<span
class="cmitt-10">text</span>⟩<span
class="cmtt-10">} </span></div><hr>
-</p><!--l. 405--><p class="noindent" >
-This is a short cut for <span
-class="cmtt-10">\expandafter\capitalisefmtwords\expandafter{</span>⟨<span
+</p><!--l. 516--><p class="noindent" >
+The unstarred version is a short cut for <span
+class="cmtt-10">\expandafter\capitalisefmtwords\expandafter</span>
+<span
+class="cmtt-10">{</span>⟨<span
class="cmti-10">text</span>⟩<span
-class="cmtt-10">}</span>.
-</p><!--l. 409--><p class="indent" > For full expansion:
-</p><!--l. 410--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
+class="cmtt-10">}</span>. Similarly the starred version of <span
+class="cmtt-10">\xcapitalisefmtwords </span>uses the starred version of
+<span
+class="cmtt-10">\capitalisefmtwords</span>.
+</p><!--l. 522--><p class="indent" > For full expansion:
+</p><!--l. 523--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
class="cmtt-9">\ecapitalisefmtwords</span><span
class="cmtt-9"> </span></span><a
- id="dx1-4018"></a> <span
+ id="dx1-4022"></a> <span
class="cmtt-10">\ecapitalisefmtwords{</span>⟨<span
class="cmitt-10">text</span>⟩<span
class="cmtt-10">} </span></div><hr>
-</p><!--l. 412--><p class="noindent" >
-Take care with this as it may expand non-robust semantic commands to replacement text that
-breaks the functioning of <span
-class="cmtt-10">\capitalisefmtwords</span>. Use robust semantic commands where
-possible.
-</p><!--l. 418--><p class="indent" > Examples:
+</p><!--l. 525--><p class="noindent" >
+Take care with this as it may expand non-robust semantic commands to replacement
+text that breaks the functioning of <span
+class="cmtt-10">\capitalisefmtwords</span>. Use robust semantic
+commands where possible. Again this has a starred version that uses the starred form of
+<span
+class="cmtt-10">\capitalisefmtwords</span>.
+</p><!--l. 532--><p class="indent" > Examples:
</p>
- <div class="verbatim" id="verbatim-24">
+ <div class="verbatim" id="verbatim-31">
\newcommand{\abc}{\xyz\space four five}
 <br />\newcommand{\xyz}{one two three}
 <br />No expansion: \capitalisewords{\abc}.
@@ -815,12 +964,12 @@
 <br />First object one-level expansion: \xcapitalisewords{\abc}.
 <br />Fully expanded: \ecapitalisewords{\abc}.
</div>
-<!--l. 425--><p class="nopar" > produces: <spacer type=vertical size=10><span class="obeylines-h">
+<!--l. 539--><p class="nopar" > produces: <spacer type=vertical size=10><span class="obeylines-h">
<br />No expansion: ONE TWO THREE FOUR FIVE.
<br />First object one-level expansion: ONE TWO THREE four Five.
<br />Fully expanded: One Two Three Four Five.
<br /><spacer type=vertical size=10></span>
-</p><!--l. 435--><p class="indent" > (Remember that the spaces need to be explicit. In the second case above, using
+</p><!--l. 549--><p class="indent" > (Remember that the spaces need to be explicit. In the second case above, using
<span
class="cmtt-10">\xcapitalisewords</span>, the space before “four” has been hidden within <span
class="cmtt-10">\space </span>so it’s not
@@ -827,68 +976,93 @@
recognised as a word boundary, but in the third case, <span
class="cmtt-10">\space </span>has been expanded to an actual
space character.)
-</p><!--l. 441--><p class="indent" > Examples:
+</p><!--l. 555--><p class="indent" > Examples:
</p><ol class="enumerate1" >
<li
- class="enumerate" id="x1-4020x1">
+ class="enumerate" id="x1-4024x1">
- <div class="verbatim" id="verbatim-25">
+ <div class="verbatim" id="verbatim-32">
\capitalisewords{a book of rhyme.}
</div>
- <!--l. 446--><p class="nopar" > produces: A Book Of Rhyme.
+ <!--l. 560--><p class="nopar" > produces: A Book Of Rhyme.
</p></li>
<li
- class="enumerate" id="x1-4022x2">
+ class="enumerate" id="x1-4026x2">
- <div class="verbatim" id="verbatim-26">
+ <div class="verbatim" id="verbatim-33">
\capitalisewords{a book\space of rhyme.}
</div>
- <!--l. 453--><p class="nopar" > produces: A Book of Rhyme.
+ <!--l. 567--><p class="nopar" > produces: A Book of Rhyme.
</p></li>
<li
- class="enumerate" id="x1-4024x3">
+ class="enumerate" id="x1-4028x3">
- <div class="verbatim" id="verbatim-27">
+ <div class="verbatim" id="verbatim-34">
\newcommand{\mytitle}{a book\space of rhyme.}
 <br />\capitalisewords{\mytitle}
</div>
- <!--l. 461--><p class="nopar" > produces: A BOOK OF RHYME. (No expansion is performed on <span
+ <!--l. 575--><p class="nopar" > produces: A BOOK OF RHYME. (No expansion is performed on <span
class="cmtt-10">\mytitle</span>.) Compare
with next example:
</p></li>
<li
- class="enumerate" id="x1-4026x4">
+ class="enumerate" id="x1-4030x4">
- <div class="verbatim" id="verbatim-28">
+ <div class="verbatim" id="verbatim-35">
\newcommand{\mytitle}{a book\space of rhyme.}
 <br />\xcapitalisewords{\mytitle}
</div>
- <!--l. 471--><p class="nopar" > produces: A Book of Rhyme.
- </p><!--l. 475--><p class="noindent" >However
+ <!--l. 585--><p class="nopar" > produces: A Book of Rhyme.
+ </p><!--l. 589--><p class="noindent" >However
</p>
- <div class="verbatim" id="verbatim-29">
+ <div class="verbatim" id="verbatim-36">
\ecapitalisewords{\mytitle}
</div>
- <!--l. 478--><p class="nopar" > produces: A Book Of Rhyme.
+ <!--l. 592--><p class="nopar" > produces: A Book Of Rhyme. (<span
+class="cmtt-10">\space </span>has been expanded to an actual space
+ character.)
+ </p></li>
+ <li
+ class="enumerate" id="x1-4032x5">
+
+
+
+ <div class="verbatim" id="verbatim-37">
+ \newcommand*{\swap}[2]{{#2}{#1}}
+  <br />\capitalisewords{a \swap{bo}{ok} of rhyme}
+  <br />\ecapitalisewords{a \swap{bo}{ok} of rhyme}
+</div>
+ <!--l. 603--><p class="nopar" > produces: <spacer type=vertical size=10><span class="obeylines-h">
+ <br />A okBo Of Rhyme
+ <br />A OKbo Of Rhyme
+ <br /><spacer type=vertical size=10></span>
+ This is because the argument of <span
+class="cmtt-10">\ecapitalisewords </span>is fully expanded before being
+ passed to <span
+class="cmtt-10">\capitalisewords </span>so that last example is equivalent to:
+
+
+
</p>
- </li></ol>
-<!--l. 484--><p class="noindent" >
-</p>
-<!--l. 484--><p class="noindent" ><a
-href="#top">Top</a><h3 class="subsectionHead"></p><h4 class="subsectionHead"><span class="titlemark">3.1 </span> <a
- id="sec:pdfbookmarks"></a>PDF Bookmarks</h4>
-<!--l. 487--><p class="noindent" ><div class="important" title="Important Note"> If you are using <span
+ <div class="verbatim" id="verbatim-38">
+ \capitalisewords{a {ok}{bo} of rhyme}
+</div>
+ <!--l. 616--><p class="nopar" ></p></li></ol>
+<!--l. 619--><p class="noindent" ><a
+href="#top">Top</a><h3 class="sectionHead"></p><h3 class="sectionHead"><span class="titlemark">3.1 </span> <a
+ id="sec:pdfbookmarks"></a>PDF Bookmarks</h3>
+<!--l. 622--><p class="noindent" ><div class="important" title="Important Note"> If you are using <span
class="cmss-10">hyperref</span><a
id="dx1-5001"></a> and want to use <span
class="cmtt-10">\capitalisewords</span>, <span
@@ -902,14 +1076,14 @@
</p>
- <div class="verbatim" id="verbatim-30">
+ <div class="verbatim" id="verbatim-39">
Package hyperref Warning: Token not allowed in a PDF string
 <br />(PDFDocEncoding):
 <br />(hyperref)                removing ‘\capitalisewords’
</div>
-<!--l. 497--><p class="nopar" > </div>
-</p><!--l. 498--><p class="noindent" >
-</p><!--l. 500--><p class="noindent" >If you want to provide an alternative for the PDF bookmark, you can use <span
+<!--l. 632--><p class="nopar" > </div>
+</p><!--l. 633--><p class="noindent" >
+</p><!--l. 635--><p class="noindent" >If you want to provide an alternative for the PDF bookmark, you can use <span
class="cmss-10">hyperref</span><a
id="dx1-5003"></a>’s
<span
@@ -919,13 +1093,13 @@
</p>
- <div class="verbatim" id="verbatim-31">
+ <div class="verbatim" id="verbatim-40">
\chapter{\texorpdfstring
 <br />  {\capitalisewords{a book of rhyme}}% TeX
 <br />  {A Book of Rhyme}% PDF
 <br />}
</div>
-<!--l. 507--><p class="nopar" > Alternatively, you can use <span
+<!--l. 642--><p class="nopar" > Alternatively, you can use <span
class="cmss-10">hyperref</span><a
id="dx1-5005"></a>’s mechanism for disabling commands within the
bookmarks. For example:
@@ -933,24 +1107,24 @@
</p>
- <div class="verbatim" id="verbatim-32">
+ <div class="verbatim" id="verbatim-41">
\pdfstringdefDisableCommands{%
 <br /> \let\capitalisewords\@firstofone
 <br />}
</div>
-<!--l. 514--><p class="nopar" >
-</p><!--l. 516--><p class="indent" > See the <span
+<!--l. 649--><p class="nopar" >
+</p><!--l. 651--><p class="indent" > See the <span
class="cmss-10">hyperref</span><a
id="dx1-5006"></a> manual for further details.
-</p><!--l. 518--><p class="noindent" >
+</p><!--l. 653--><p class="noindent" >
</p>
-<!--l. 518--><p class="noindent" ><a
-href="#top">Top</a><h3 class="subsectionHead"></p><h4 class="subsectionHead"><span class="titlemark">3.2 </span> <a
- id="sec:nocap"></a>Excluding Words From Case-Changing</h4>
-<!--l. 521--><p class="noindent" >As from v1.09, you can specify words which shouldn’t be capitalised unless they occur at the
+<!--l. 653--><p class="noindent" ><a
+href="#top">Top</a><h3 class="sectionHead"></p><h3 class="sectionHead"><span class="titlemark">3.2 </span> <a
+ id="sec:nocap"></a>Excluding Words From Case-Changing</h3>
+<!--l. 656--><p class="noindent" >As from v1.09, you can specify words which shouldn’t be capitalised unless they occur at the
start of ⟨<span
class="cmti-10">text</span>⟩ using:
-</p><!--l. 523--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
+</p><!--l. 658--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
class="cmtt-9">\MFUnocap</span><span
class="cmtt-9"> </span></span><a
id="dx1-6001"></a> <span
@@ -957,9 +1131,9 @@
class="cmtt-10">\MFUnocap{</span>⟨<span
class="cmitt-10">word</span>⟩<span
class="cmtt-10">} </span></div><hr>
-</p><!--l. 525--><p class="noindent" >
+</p><!--l. 660--><p class="noindent" >
This only has a local effect. The global version is:
-</p><!--l. 527--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
+</p><!--l. 662--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
class="cmtt-9">\gMFUnocap</span><span
class="cmtt-9"> </span></span><a
id="dx1-6002"></a> <span
@@ -966,40 +1140,40 @@
class="cmtt-10">\gMFUnocap{</span>⟨<span
class="cmitt-10">word</span>⟩<span
class="cmtt-10">} </span></div><hr>
-</p><!--l. 529--><p class="noindent" >
-</p><!--l. 531--><p class="indent" > For example:
+</p><!--l. 664--><p class="noindent" >
+</p><!--l. 666--><p class="indent" > For example:
</p>
- <div class="verbatim" id="verbatim-33">
+ <div class="verbatim" id="verbatim-42">
\capitalisewords{the wind in the willows}
 <br />\MFUnocap{in}%
 <br />\MFUnocap{the}%
 <br />\capitalisewords{the wind in the willows}
</div>
-<!--l. 539--><p class="nopar" > produces: <spacer type=vertical size=10><span class="obeylines-h">
+<!--l. 674--><p class="nopar" > produces: <spacer type=vertical size=10><span class="obeylines-h">
<br />The Wind In The Willows
<br />The Wind in the Willows
<br /><spacer type=vertical size=10></span>
The list of words that shouldn’t be capitalised can be cleared using
-</p><!--l. 550--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
+</p><!--l. 685--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span
class="cmtt-9">\MFUclear</span><span
class="cmtt-9"> </span></span><a
id="dx1-6003"></a> <span
class="cmtt-10">\MFUclear </span></div><hr>
-</p><!--l. 552--><p class="noindent" >
-</p><!--l. 554--><p class="indent" > You can also simply place an empty group in front of a word if you don’t want that specific
+</p><!--l. 687--><p class="noindent" >
+</p><!--l. 689--><p class="indent" > You can also simply place an empty group in front of a word if you don’t want that specific
instance to be capitalised. For example:
</p>
- <div class="verbatim" id="verbatim-34">
+ <div class="verbatim" id="verbatim-43">
\MFUclear
 <br />\capitalisewords{the {}wind in the willows}
</div>
-<!--l. 560--><p class="nopar" > produces: <spacer type=vertical size=10><span class="obeylines-h">
+<!--l. 695--><p class="nopar" > produces: <spacer type=vertical size=10><span class="obeylines-h">
<br />The wind In The Willows
<br /><spacer type=vertical size=10></span>
This is also a useful way of protecting commands that shouldn’t be parsed. For
@@ -1008,16 +1182,17 @@
</p>
- <div class="verbatim" id="verbatim-35">
+ <div class="verbatim" id="verbatim-44">
\capitalisewords{this is section {}\nameref{sec:nocap}.}
</div>
-<!--l. 570--><p class="nopar" > produces <spacer type=vertical size=10><span class="obeylines-h">
+<!--l. 705--><p class="nopar" > produces <spacer type=vertical size=10><span class="obeylines-h">
<br />This Is Section <a
href="#sec:nocap">Excluding Words From Case-Changing<!--tex4ht:ref: sec:nocap --></a>.
<br /><spacer type=vertical size=10></span>
(No case-changing is applied to <span class="obeylines-h"><span class="verb"><span
-class="cmtt-10">\nameref{sec:nocap}</span></span></span>.)
-</p><!--l. 577--><p class="indent" > The package <span
+class="cmtt-10">\nameref{sec:nocap}</span></span></span>. It just happens to already be in title
+case.)
+</p><!--l. 713--><p class="indent" > The package <span
class="cmss-10">mfirstuc-english</span><a
id="dx1-6004"></a> loads <span
class="cmss-10">mfirstuc </span>and uses <span
@@ -1026,7 +1201,7 @@
to add other words to this list, such as prepositions but, as there’s some dispute
over whether prepositions should be capitalised, I don’t intend to add them to this
package.
-</p><!--l. 584--><p class="indent" > If you want to write a similar package for another language, all you need to do is create a
+</p><!--l. 720--><p class="indent" > If you want to write a similar package for another language, all you need to do is create a
file with the extension <span
class="cmtt-10">.sty </span>that starts with
@@ -1033,10 +1208,10 @@
</p>
- <div class="verbatim" id="verbatim-36">
+ <div class="verbatim" id="verbatim-45">
\NeedsTeXFormat{LaTeX2e}
</div>
-<!--l. 589--><p class="nopar" > The next line should identify the package. For example, if you have called the file
+<!--l. 725--><p class="nopar" > The next line should identify the package. For example, if you have called the file
<span
class="cmtt-10">mfirstuc-french.sty </span>then you need:
@@ -1043,55 +1218,58 @@
</p>
- <div class="verbatim" id="verbatim-37">
+ <div class="verbatim" id="verbatim-46">
\ProvidesPackage{mfirstuc-french}
</div>
-<!--l. 594--><p class="nopar" > It’s a good idea to also add a version in the final optional argument, for example:
+<!--l. 730--><p class="nopar" > It’s a good idea to also add a version in the final optional argument, for example:
</p>
- <div class="verbatim" id="verbatim-38">
+ <div class="verbatim" id="verbatim-47">
\ProvidesPackage{mfirstuc-french}[2014/07/30 v1.0]
</div>
-<!--l. 599--><p class="nopar" > Next load <span
+<!--l. 735--><p class="nopar" > Next load <span
class="cmss-10">mfirstuc</span>:
</p>
- <div class="verbatim" id="verbatim-39">
+ <div class="verbatim" id="verbatim-48">
\RequirePackage{mfirstuc}
</div>
-<!--l. 603--><p class="nopar" > Now add all your <span
+<!--l. 739--><p class="nopar" > Now add all your <span
class="cmtt-10">\MFUnocap </span>commands. For example:
</p>
- <div class="verbatim" id="verbatim-40">
+ <div class="verbatim" id="verbatim-49">
\MFUnocap{de}
</div>
-<!--l. 607--><p class="nopar" > At the end of the file add:
+<!--l. 743--><p class="nopar" > At the end of the file add:
</p>
- <div class="verbatim" id="verbatim-41">
+ <div class="verbatim" id="verbatim-50">
\endinput
</div>
-<!--l. 611--><p class="nopar" >
-</p><!--l. 613--><p class="indent" > Put the file somewhere on <span class="TEX">T<span
+<!--l. 747--><p class="nopar" >
+</p><!--l. 749--><p class="indent" > Put the file somewhere on <span class="TEX">T<span
class="E">E</span>X</span>’s path, and now you can use this package in your
document. You might also consider <a
href="http://ctan.org/upload" >uploading it to CTAN</a> in case other users find it
useful.
-</p><!--l. 618--><p class="noindent" >
+
+
+
</p>
-<!--l. 618--><p class="noindent" ><a
-href="#top">Top</a><h2 class="sectionHead"></p><h3 class="sectionHead"><span class="titlemark">4 </span> <a
- id="sec:utf8"></a>UTF-8</h3>
-<!--l. 621--><p class="noindent" >The <span
+<!--l. 754--><p class="indent" > </div>
+</p><!--l. 754--><p class="noindent" ><a
+href="#top">Top</a><div class="chapter"><h2 class="chapterHead">4. <a
+ id="sec:utf8"></a>UTF-8</h2>
+</p><!--l. 757--><p class="indent" > The <span
class="cmtt-10">\makefirstuc </span>command works by utilizing the fact that, in most cases, <span class="TEX">T<span
class="E">E</span>X</span> doesn’t
require a regular argument to be enclosed in braces if it only consists of a single token. (This is
@@ -1101,35 +1279,35 @@
class="cmtt-10">x^2</span></span></span> instead of <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">x^{2}</span></span></span>, although some
users frown on this practice.)
-</p><!--l. 628--><p class="indent" > A simplistic version of the <span
+</p><!--l. 764--><p class="indent" > A simplistic version of the <span
class="cmtt-10">\makefirstuc </span>command is:
</p>
- <div class="verbatim" id="verbatim-42">
+ <div class="verbatim" id="verbatim-51">
\newcommand*{\FirstUC}[1]{\MakeUppercase #1}
</div>
-<!--l. 631--><p class="nopar" > Here
+<!--l. 767--><p class="nopar" > Here
</p>
- <div class="verbatim" id="verbatim-43">
+ <div class="verbatim" id="verbatim-52">
\FirstUC{abc}
</div>
-<!--l. 635--><p class="nopar" > is equivalent to
+<!--l. 771--><p class="nopar" > is equivalent to
</p>
- <div class="verbatim" id="verbatim-44">
+ <div class="verbatim" id="verbatim-53">
\MakeUppercase abc
</div>
-<!--l. 639--><p class="nopar" > and since <span
+<!--l. 775--><p class="nopar" > and since <span
class="cmtt-10">\MakeUppercase </span>requires an argument, it grabs the first token (the character “a” in
this case) and uses that as the argument so that the result is: Abc.
-</p><!--l. 644--><p class="indent" > The <span
+</p><!--l. 780--><p class="indent" > The <span
class="cmss-10">glossaries</span><a
id="dx1-7001"></a> package needs to take into account the fact that the text may be contained
in the argument of a formatting command, such as <span
@@ -1186,12 +1364,12 @@
class="cmitt-10">stuff</span>⟩<span
class="cmtt-10">}</span><span
class="cmsy-10">}</span>
+</div>
+</div>
+<!--l. 812--><p class="indent" > Try the following document: </p><div class="alltt">
-</div>
-</div>
-<!--l. 676--><p class="indent" > Try the following document: </p><div class="alltt">
<div class="obeylines-v">
<span
class="cmtt-10">\documentclass</span><span
@@ -1229,15 +1407,15 @@
class="cmsy-10">}</span>
</div>
</div>
-<!--l. 690--><p class="indent" > This will result in the error:
+<!--l. 826--><p class="indent" > This will result in the error:
</p>
- <div class="verbatim" id="verbatim-45">
+ <div class="verbatim" id="verbatim-54">
! Argument of \UTFviii at two@octets has an extra }.
</div>
-<!--l. 693--><p class="nopar" > This is why <span class="obeylines-h"><span class="verb"><span
+<!--l. 829--><p class="nopar" > This is why <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">\makefirstuc{</span></span></span><span
class="cmtt-10">ã</span><span
class="cmtt-10">bc</span><span class="obeylines-h"><span class="verb"><span
@@ -1244,7 +1422,7 @@
class="cmtt-10">}</span></span></span> won’t work. It will only work if the character <span
class="cmtt-10">ã</span> is placed
inside a group.
-</p><!--l. 698--><p class="indent" > The reason for this error message is due to <span class="TEX">T<span
+</p><!--l. 834--><p class="indent" > The reason for this error message is due to <span class="TEX">T<span
class="E">E</span>X</span> having been written before Unicode was
invented. Although <span
class="cmtt-10">ã</span> may look like a single character in your text editor, from <span class="TEX">T<span
@@ -1272,7 +1450,7 @@
class="cmtt-10">bc</span>
</div>
</div>
-<!--l. 714--><p class="indent" > Note that XeTeX (and therefore XeLaTeX) is a modern implementation of <span class="TEX">T<span
+<!--l. 850--><p class="indent" > Note that XeTeX (and therefore XeLaTeX) is a modern implementation of <span class="TEX">T<span
class="E">E</span>X</span> designed
to work with Unicode and therefore doesn’t suffer from this drawback. Now let’s look at the
XeLaTeX equivalent of the above example: </p><div class="alltt">
@@ -1308,7 +1486,7 @@
class="cmsy-10">}</span>
</div>
</div>
-<!--l. 730--><p class="indent" > This works correctly when compiled with XeLaTeX. This means that <span
+<!--l. 866--><p class="indent" > This works correctly when compiled with XeLaTeX. This means that <span
class="cmtt-10">\makefirstuc</span><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">{</span></span></span><span
class="cmtt-10">ã</span><span
@@ -1320,95 +1498,111 @@
class="cmssi-10">fontspec</span><a
id="dx1-7002"></a> <span
class="cmti-10">package</span>.
+</p><!--l. 870--><p class="indent" > Version 2.24 of <span
+class="cmss-10">datatool-base</span><a
+ id="dx1-7003"></a> added the command <span
+class="cmtt-10">\dtl at getfirst@UTFviii </span>which
+attempts to grab both octets. If this command has been defined, <span
+class="cmss-10">mfirstuc</span><a
+ id="dx1-7004"></a> will use it when it
+tries to split the first character from the rest of the word. See the <a
+href="http://mirrors.ctan.org/macros/latex/contrib/datatool/datatool-code.pdf" ><span
+class="cmss-10">datatool </span>documented code</a>
+for further details.
-</p><!--l. 2--><p class="noindent" >
</p>
- <h3 class="likesectionHead"><a
- id="x1-80004"></a>Index</h3>
-<!--l. 4--><p class="noindent" > <span
+<!--l. 2--><p class="indent" > </div>
+</p><!--l. 2--><p class="noindent" ><a
+href="#top">Top</a></p><h2 class="likechapterHead"><a
+ id="x1-80004"></a>Index</h2> <span
class="cmbx-10">C</span>
-</p>
<div class="theindex"><span class="index-item"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">\capitalisewords</span></span></span>  <span
-class="cmti-10">5 </span><br /></span>
+class="cmti-10">8 </span><br /></span>
<p class="theindex"> <span
+class="cmbx-10">D</span>
+<span class="index-item"><span
+class="cmss-10">datatool-base </span>package  6, 19 <br /></span>
+</p><p class="theindex"> <span
class="cmbx-10">E</span>
<span class="index-item"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">\ecapitalisefmtwords</span></span></span>  <span
-class="cmti-10">8 </span><br /></span>
+class="cmti-10">12 </span><br /></span>
<span class="index-item"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">\ecapitalisewords</span></span></span>  <span
-class="cmti-10">8 </span><br /></span>
+class="cmti-10">12 </span><br /></span>
<span class="index-item"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">\emakefirstuc</span></span></span>  <span
-class="cmti-10">4 </span><br /></span>
+class="cmti-10">7 </span><br /></span>
</p><p class="theindex"> <span
class="cmbx-10">F</span>
<span class="index-item"><span
-class="cmss-10">fontspec </span>package  13 <br /></span>
+class="cmss-10">fontspec </span>package  19 <br /></span>
</p><p class="theindex"> <span
class="cmbx-10">G</span>
<span class="index-item"><span
-class="cmss-10">glossaries </span>package  4, 12 <br /></span>
+class="cmss-10">glossaries </span>package  6, 7, 17 <br /></span>
<span class="index-item"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">\glsmakefirstuc</span></span></span>  <span
-class="cmti-10">4 </span><br /></span>
+class="cmti-10">7 </span><br /></span>
<span class="index-item"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">\gMFUnocap</span></span></span>  <span
-class="cmti-10">10 </span><br /></span>
+class="cmti-10">15 </span><br /></span>
</p><p class="theindex"> <span
class="cmbx-10">H</span>
<span class="index-item"><span
-class="cmss-10">hyperref </span>package  9 <br /></span>
+class="cmss-10">hyperref </span>package  14 <br /></span>
</p><p class="theindex"> <span
class="cmbx-10">I</span>
<span class="index-item"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">\ifMFUhyphen</span></span></span>  <span
-class="cmti-10">5 </span><br /></span>
+class="cmti-10">8 </span><br /></span>
<span class="index-item"><span
-class="cmss-10">inputenc </span>package  3 <br /></span>
+class="cmss-10">inputenc </span>package  6 <br /></span>
</p><p class="theindex"> <span
class="cmbx-10">M</span>
<span class="index-item"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">\makefirstuc</span></span></span>  <span
-class="cmti-10">2 </span><br /></span>
+class="cmti-10">5 </span><br /></span>
<span class="index-item"><span
-class="cmss-10">mfirstuc-english </span>package  10 <br /></span>
+class="cmss-10">mfirstuc </span>package  6, 19 <br /></span>
+<span class="index-item"><span
+class="cmss-10">mfirstuc-english </span>package  15 <br /></span>
+
+
+
<span class="index-item"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">\MFUcapword</span></span></span>  <span
-class="cmti-10">5 </span><br /></span>
+class="cmti-10">8 </span><br /></span>
<span class="index-item"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">\MFUclear</span></span></span>  <span
-class="cmti-10">10 </span><br /></span>
+class="cmti-10">15 </span><br /></span>
<span class="index-item"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">\MFUhyphenfalse</span></span></span>  <span
-class="cmti-10">5 </span><br /></span>
+class="cmti-10">8 </span><br /></span>
<span class="index-item"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">\MFUhyphentrue</span></span></span>  <span
-class="cmti-10">5 </span><br /></span>
+class="cmti-10">8 </span><br /></span>
<span class="index-item"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">\MFUnocap</span></span></span>  <span
-class="cmti-10">9 </span><br /></span>
+class="cmti-10">15 </span><br /></span>
</p><p class="theindex"> <span
class="cmbx-10">T</span>
<span class="index-item"><span
-class="cmss-10">textcase </span>package  4 <br /></span>
+class="cmss-10">textcase </span>package  7 <br /></span>
</p><p class="theindex"> <span
class="cmbx-10">X</span>
<span class="index-item"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">\xcapitalisefmtwords</span></span></span>  <span
-class="cmti-10">8 </span><br /></span>
-
-
-
+class="cmti-10">12 </span><br /></span>
<span class="index-item"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">\xcapitalisewords</span></span></span>  <span
-class="cmti-10">7 </span><br /></span>
+class="cmti-10">12 </span><br /></span>
<span class="index-item"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">\xmakefirstuc</span></span></span>  <span
-class="cmti-10">4 </span><br /></span>
+class="cmti-10">7 </span><br /></span>
</p></div>
</body></html>
Modified: trunk/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-manual.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-manual.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-manual.tex 2016-08-01 21:47:21 UTC (rev 41784)
+++ trunk/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-manual.tex 2016-08-01 21:47:34 UTC (rev 41785)
@@ -1,4 +1,4 @@
-\documentclass{nlctdoc}
+\documentclass[report]{nlctdoc}
\usepackage[a4paper,left=1.75in]{geometry}
\usepackage{alltt}
@@ -21,22 +21,22 @@
pdfkeywords={LaTeX,package,uppercase}]{hyperref}
\IndexPrologue{%
-\section*{\indexname}\markright{\indexname}
-\addcontentsline{toc}{section}{\indexname}}
+\chapter*{\indexname}\markright{\indexname}
+\addcontentsline{toc}{chapter}{\indexname}}
\begin{document}
\MakeShortVerb{|}
- \title{mfirstuc.sty v2.03:
+ \title{mfirstuc.sty v2.04:
uppercasing first letter}
\author{Nicola L.C. Talbot\\[10pt]
Dickimaw Books\\
\url{http://www.dickimaw-books.com/}}
- \date{2016-07-29}
+ \date{2016-07-31}
\maketitle
\tableofcontents
- \section{Introduction}
+ \chapter{Introduction}
\label{sec:intro}
The \styfmt{mfirstuc} package was originally part of the
@@ -99,7 +99,7 @@
(\cs{emakefirstuc}, \cs{ecapitalisewords} and
\cs{ecapitalisefmtwords}).
-\section{Capitalising the First Letter of a Word}
+\chapter{Capitalising the First Letter of a Word}
\label{sec:makefirstuc}
A simple word can be capitalised just using the standard \LaTeX\
@@ -158,11 +158,36 @@
\item |\makefirstuc{{ä}bc}| produces \makefirstuc{{ä}bc}.
\end{itemize}
+
Note that non-Latin or accented characters appearing at the
-start of the text must be placed in a group (even if you are
+start of the text should be placed in a group (even if you are
using the \sty{inputenc} package). The reason for this restriction
is detailed in \sectionref{sec:utf8}.
+\textbf{New to version 2.04:} There is now limited support for
+UTF-8 characters with the \sty{inputenc} package, provided that
+you load \sty{datatool-base} (at least v2.24) before
+\styfmt{mfirstuc} (\sty{datatool-base} is loaded automatically with newer versions
+of \sty{glossaries}). If available
+\sty{mfirstuc} will now use \sty{datatool-base}'s
+\ics{dtl at getfirst@UTFviii} command which is still experimental.
+See the \styfmt{datatool} manual for further details.
+
+\begin{verbatim}
+\documentclass{article}
+
+\usepackage[T1]{fontenc}
+\usepackage[utf8]{inputenc}
+
+\usepackage{datatool-base}[2016/01/12]% v2.24+
+\usepackage{mfirstuc}
+
+\begin{document}
+\makefirstuc{élite}
+\end{document}
+\end{verbatim}
+(Package ordering is important.)
+
\begin{important}
In version 1.02 of \styfmt{mfirstuc}, a bug fix resulted in a change
in output if the first object is a control sequence followed by
@@ -239,7 +264,7 @@
Remember to also load \sty{textcase} (\styfmt{glossaries} loads this
automatically).
-\section{Capitalise the First Letter of Each Word in a Phrase or Sentence (Title Case)}
+\chapter{Capitalise the First Letter of Each Word in a Phrase or Sentence (Title Case)}
\label{sec:capitalisewords}
New to mfirstuc v1.06:
@@ -326,6 +351,17 @@
\end{alltt}
Avoid scoped declarations.
+\begin{important}
+\cs{capitalisefmtwords} is only designed for phrases that contain
+text-block commands with a single
+argument, which should be a word or sub-phrase. Anything
+more complicated is likely to break. Instead, use the
+starred form or \cs{capitalisewords}.
+\end{important}
+
+The starred form only permits a text-block command at the
+start of the phrase.
+
Examples:
\begin{enumerate}
\item Phrase entirely enclosed in a formatting command:
@@ -366,8 +402,60 @@
\MFUnocap{of}
\capitalisefmtwords{\textbf{a \emph{small book}} of rhyme}
\end{display}
+
+\item Starred form:
+\begin{verbatim}
+\MFUnocap{of}
+\capitalisefmtwords*{\emph{a small book of rhyme}}
+\end{verbatim}
+produces:
+\begin{display}
+\MFUnocap{of}
+\capitalisefmtwords*{\emph{a small book of rhyme}}
+\end{display}
+
+\item The starred form also works with just text (no text-block
+command):
+\begin{verbatim}
+\MFUnocap{of}
+\capitalisefmtwords*{a small book of rhyme}
+\end{verbatim}
+produces:
+\begin{display}
+\MFUnocap{of}
+\capitalisefmtwords*{a small book of rhyme}
+\end{display}
+
\end{enumerate}
+If there is a text-block command within the argument of the
+starred form, it's assumed to be at the start of the argument.
+Unexpected results can occur if there are other commands.
+For example
+\begin{verbatim}
+\MFUnocap{of}
+\capitalisefmtwords*{\emph{a small} book \textbf{of rhyme}}
+\end{verbatim}
+produces:
+\begin{display}
+\MFUnocap{of}
+\capitalisefmtwords*{\emph{a small} book \textbf{of rhyme}}
+\end{display}
+(In this case \verb|\textbf{of rhyme}| is considered a
+single word.) Similarly if the text-block command occurs
+in the middle of the argument:
+\begin{verbatim}
+\MFUnocap{of}
+\capitalisefmtwords*{a \emph{very small} book of rhyme}
+\end{verbatim}
+produces:
+\begin{display}
+\MFUnocap{of}
+\capitalisefmtwords*{a \emph{very small} book of rhyme}
+\end{display}
+(In this case \verb|\emph{very small}| is considered a
+single word.)
+
Grouping causes interference:
\begin{verbatim}
\capitalisefmtwords{{a \emph{small book}} of rhyme}
@@ -386,6 +474,29 @@
\capitalisefmtwords{{\bfseries a \emph{small book}} of rhyme}
\end{display}
+Avoid complicated commands in the unstarred version. For example,
+the following breaks:
+\begin{verbatim}
+\newcommand*{\swap}[2]{{#2}{#1}}
+\capitalisefmtwords{a \swap{bo}{ok} of rhyme}
+\end{verbatim}
+However it works okay with the starred form and the simpler
+\cs{capitalisewords}:
+\begin{verbatim}
+\newcommand*{\swap}[2]{{#2}{#1}}
+\capitalisefmtwords*{a \swap{bo}{ok} of rhyme}
+
+\capitalisewords{a \swap{bo}{ok} of rhyme}
+\end{verbatim}
+Produces:
+\begin{display}
+\newcommand*{\swap}[2]{{#2}{#1}}
+\capitalisefmtwords*{a \swap{bo}{ok} of rhyme}
+
+\capitalisewords{a \swap{bo}{ok} of rhyme}
+\end{display}
+Note that the case change is applied to the first argument.
+
\begin{definition}[\DescribeMacro{\xcapitalisewords}]
\cs{xcapitalisewords}\marg{text}
\end{definition}
@@ -399,12 +510,14 @@
\end{definition}
There are also similar shortcut commands for the version that allows
-formatting commands:
+text-block commands:
\begin{definition}[\DescribeMacro{\xcapitalisefmtwords}]
\cs{xcapitalisefmtwords}\marg{text}
\end{definition}
-This is a short cut for
+The unstarred version is a short cut for
\cs{expandafter}\cs{capitalisefmtwords}\cs{expandafter}\marg{text}.
+Similarly the starred version of \cs{xcapitalisefmtwords}
+uses the starred version of \cs{capitalisefmtwords}.
For full expansion:
\begin{definition}[\DescribeMacro\ecapitalisefmtwords]
@@ -413,7 +526,8 @@
Take care with this as it may expand non-robust semantic commands
to replacement text that breaks the functioning of
\cs{capitalisefmtwords}. Use robust semantic commands
-where possible.
+where possible. Again this has a starred version that uses
+the starred form of \cs{capitalisefmtwords}.
Examples:
\begin{verbatim}
@@ -478,10 +592,31 @@
\end{verbatim}
produces:
\ecapitalisewords{\mytitle}
+(\cs{space} has been expanded to an actual space character.)
+\item
+\begin{verbatim}
+\newcommand*{\swap}[2]{{#2}{#1}}
+\capitalisewords{a \swap{bo}{ok} of rhyme}
+
+\ecapitalisewords{a \swap{bo}{ok} of rhyme}
+\end{verbatim}
+produces:
+\begin{display}
+\newcommand*{\swap}[2]{{#2}{#1}}
+\capitalisewords{a \swap{bo}{ok} of rhyme}
+
+\ecapitalisewords{a \swap{bo}{ok} of rhyme}
+\end{display}
+This is because the argument of \cs{ecapitalisewords} is
+fully expanded before being passed to \cs{capitalisewords} so
+that last example is equivalent to:
+\begin{verbatim}
+\capitalisewords{a {ok}{bo} of rhyme}
+\end{verbatim}
\end{enumerate}
-\subsection{PDF Bookmarks}
+\section{PDF Bookmarks}
\label{sec:pdfbookmarks}
\begin{important}
@@ -515,7 +650,7 @@
See the \sty{hyperref} manual for further details.
-\subsection{Excluding Words From Case-Changing}
+\section{Excluding Words From Case-Changing}
\label{sec:nocap}
As from v1.09, you can specify words which shouldn't be capitalised unless they
@@ -572,7 +707,8 @@
\begin{display}
\capitalisewords{this is section {}\nameref{sec:nocap}.}
\end{display}
-(No case-changing is applied to \verb|\nameref{sec:nocap}|.)
+(No case-changing is applied to \verb|\nameref{sec:nocap}|.
+It just happens to already be in title case.)
The package \sty{mfirstuc-english} loads \styfmt{mfirstuc} and uses
\cs{MFUnocap} to add common English articles and conjunctions, such
@@ -615,7 +751,7 @@
\href{http://ctan.org/upload}{uploading it to CTAN} in case
other users find it useful.
-\section{UTF-8}
+\chapter{UTF-8}
\label{sec:utf8}
The \cs{makefirstuc} command works by utilizing the fact that, in
@@ -731,5 +867,12 @@
that \cs{makefirstuc}\verb|{|\texttt{\~abc}\verb|}| will work
\emph{provided you use \XeLaTeX\ and the \sty{fontspec} package}.
+Version 2.24 of \sty{datatool-base} added the
+command \cs{dtl at getfirst@UTFviii} which attempts to grab both octets. If this command
+has been defined, \sty{mfirstuc} will use it when it tries to split
+the first character from the rest of the word. See the
+\href{http://mirrors.ctan.org/macros/latex/contrib/datatool/datatool-code.pdf}{\styfmt{datatool}
+documented code} for further details.
+
\PrintIndex
\end{document}
Modified: trunk/Master/texmf-dist/doc/latex/mfirstuc/sample-mfirstuc.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/mfirstuc/sample-mfirstuc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/mfirstuc/sample-mfirstuc.tex 2016-08-01 21:47:21 UTC (rev 41784)
+++ trunk/Master/texmf-dist/doc/latex/mfirstuc/sample-mfirstuc.tex 2016-08-01 21:47:34 UTC (rev 41785)
@@ -1,15 +1,22 @@
% This file is public domain
% If you want to use arara, you need the following directive:
% arara: pdflatex: { synctex: on }
+ % arara: pdflatex: { synctex: on }
\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage{color}
\usepackage{mfirstuc-english}% also loads mfirstuc.sty
+\usepackage[hidelinks]{hyperref}
+\title{Sample Document Illustrating the mfirstuc Package}
+\author{Nicola Talbot}
+
\begin{document}
-This is a sample document illustrating the mfirstuc package.
+\maketitle
+\tableofcontents
+
\section{First Letter Upper Case}
\verb|\makefirstuc{abc}.|
@@ -37,24 +44,78 @@
\renewcommand*{\mytext}{\ae\oe{some text}}
Sequential commands: \xmakefirstuc{\mytext}.
-\section{Title Case (Formatting)}
+\section{Title Case (No Formatting Commands)}
+\bgroup
+
+\verb|\capitalisewords{the wind in the willows}|
+\capitalisewords{the wind in the willows}
+
+\verb|\capitalisewords{a small book of rhyme.}|
+\capitalisewords{a small book of rhyme.}
+
+\medskip
+
+\verb|\space| isn't considered a word boundary for
+\verb|\capitalisewords| as shown below:
+
+\begin{verbatim}
+\capitalisewords{a small\space book of rhyme.}
+\end{verbatim}
+\capitalisewords{a small\space book of rhyme.}
+
+\medskip
+No expansion is performed on the argument of
+\verb|\capitalisewords|:
+
+\verb|\newcommand{\mytitle}{a small book of rhyme.}|
+\newcommand{\mytitle}{a small book of rhyme.}
+
+\verb|\capitalisewords{\mytitle}|
+\capitalisewords{\mytitle}
+
+\verb|\xcapitalisewords{\mytitle}|
+\xcapitalisewords{\mytitle}
+
+\egroup
+
Formatting for the entire phrase must go outside
\verb|\capitalisewords| (unlike \verb|\makefirstuc|). Compare:
-\verb|\capitalisewords{\textbf{a small book of rhyme.}}|
+\begin{verbatim}
\capitalisewords{\textbf{a small book of rhyme.}}
+\end{verbatim}
+\capitalisewords{\textbf{a small book of rhyme.}}
-with:
-
-\verb|\textbf{\capitalisewords{a small book of rhyme.}}|
+\begin{verbatim}
\textbf{\capitalisewords{a small book of rhyme.}}
+\end{verbatim}
+\textbf{\capitalisewords{a small book of rhyme.}}
\medskip
-Use \verb|\capitalisefmtwords| instead (full stop outside
-argument to check for spurious spaces):
+Use \verb|\capitalisefmtwords| instead. The starred form
+is limited to one text-block command at the start of the argument.
+\begin{verbatim}
+\capitalisefmtwords*{\emph{a small book of rhyme}}
+\end{verbatim}
+\capitalisefmtwords*{\emph{a small book of rhyme}}
+
+Additional text-block commands can cause unexpected results.
+
+\begin{verbatim}
+\capitalisefmtwords*{\emph{a small} book \textbf{of rhyme}}
+\end{verbatim}
+\capitalisefmtwords*{\emph{a small} book \textbf{of rhyme}}
+
+\section{Title Case (Contains Text-Block Formatting Commands)}
+
+The unstarred form of \verb|\capitalisefmtwords| is still a bit
+experimental and is only designed
+for phrases that contain text-block commands with a single
+argument, which should be a word or sub-phrase.
+
\verb|\capitalisefmtwords{\textbf{a small book of rhyme}}.|
\capitalisefmtwords{\textbf{a small book of rhyme}}.
@@ -64,17 +125,28 @@
\verb|\capitalisefmtwords{a \textbf{small book} of rhyme}.|
\capitalisefmtwords{a \textbf{small book} of rhyme}.
-\verb|\capitalisefmtwords{\textbf{a} book of rhyme}.|
+\verb|\capitalisefmtwords{\textbf{a} small book of rhyme}.|
\capitalisefmtwords{\textbf{a} small book of rhyme}.
-\verb|\capitalisefmtwords{\textbf{a book }of rhyme}.|
-\capitalisefmtwords{\textbf{a small book }of rhyme}.
-
\verb|\capitalisefmtwords{a small book \textbf{of rhyme}}.|
\capitalisefmtwords{a small book \textbf{of rhyme}}.
\medskip
+Be careful of trailing spaces at the end a group. They can confuse
+things.
+
+\verb|\capitalisefmtwords{\textbf{a small }book of rhyme}.|
+\capitalisefmtwords{\textbf{a small }book of rhyme}.
+
+\verb|\capitalisefmtwords{\textbf{a small book }of rhyme}.|
+\capitalisefmtwords{\textbf{a small book }of rhyme}.
+
+\verb|\capitalisefmtwords{\textbf{a small book of }rhyme}.|
+\capitalisefmtwords{\textbf{a small book of }rhyme}.
+
+\medskip
+
Use semantic commands for things like quotations:
\begin{verbatim}
@@ -88,9 +160,28 @@
(But make them robust if you intend using commands like
\verb|\ecapitalisefmtwords|.)
+Similarly for other types of punctuation:
+\begin{verbatim}
+\newcommand*{\esq}[1]{'?#1?}
+\capitalisefmtwords{\esq{D\'onde est\'a libro}}
+\end{verbatim}
+\newcommand*{\esq}[1]{?`#1?}
+\capitalisefmtwords{\esq{D\'onde est\'a libro}}
\medskip
+Anything more complicated than a simple one-argument text-block
+command requires the starred version.
+
+\begin{verbatim}
+\newcommand*{\swap}[2]{{#2}{#1}}
+\capitalisefmtwords*{\textbf{an \swap{un}{usually} small book of} rhyme}.
+\end{verbatim}
+\newcommand*{\swap}[2]{{#2}{#1}}
+\capitalisefmtwords*{\textbf{an \swap{un}{usually} small book of} rhyme}.
+
+\medskip
+
Nested text-block commands:
\begin{verbatim}
@@ -168,38 +259,27 @@
\verb|\capitalisefmtwords{\relax a book of rhyme.}|
\capitalisefmtwords{\relax a book of rhyme.}
-\section{Title Case (No Formatting)}
+\section{Compound Words}
-\bgroup
+Use \verb|\MFUhyphentrue| to title case each part of
+a compound word.
-\verb|\capitalisewords{the wind in the willows}|
-\capitalisewords{the wind in the willows}
+Default:
+\begin{verbatim}
+\capitalisewords{a fast-paced book of rhyme}.
+\capitalisefmtwords{a \textbf{fast-paced} book of rhyme}.
+\end{verbatim}
+\capitalisewords{a fast-paced book of rhyme}.
+\capitalisefmtwords{a \textbf{fast-paced} book of rhyme}.
-\verb|\capitalisewords{a small book of rhyme.}|
-\capitalisewords{a small book of rhyme.}
-
-\medskip
-
-\verb|\space| isn't considered a word boundary for
-\verb|\capitalisewords| as shown below:
-
+Compare with
\begin{verbatim}
-\capitalisewords{a small\space book of rhyme.}
+\MFUhyphentrue
+\capitalisewords{a fast-paced book of rhyme}.
+\capitalisefmtwords{a \textbf{fast-paced} book of rhyme}.
\end{verbatim}
-\capitalisewords{a small\space book of rhyme.}
+\MFUhyphentrue
+\capitalisewords{a fast-paced book of rhyme}.
+\capitalisefmtwords{a \textbf{fast-paced} book of rhyme}.
-\medskip
-No expansion is performed on the argument of
-\verb|\capitalisewords|:
-
-\verb|\newcommand{\mytitle}{a small\space book of rhyme.}|
-\newcommand{\mytitle}{a small\space book of rhyme.}
-
-\verb|\capitalisewords{\mytitle}|
-\capitalisewords{\mytitle}
-
-\verb|\xcapitalisewords{\mytitle}|
-\xcapitalisewords{\mytitle}
-
-\egroup
\end{document}
Modified: trunk/Master/texmf-dist/source/latex/mfirstuc/mfirstuc.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/mfirstuc/mfirstuc.dtx 2016-08-01 21:47:21 UTC (rev 41784)
+++ trunk/Master/texmf-dist/source/latex/mfirstuc/mfirstuc.dtx 2016-08-01 21:47:34 UTC (rev 41785)
@@ -1,21 +1,21 @@
%\iffalse
% mfirstuc.dtx generated using makedtx version 1.1 (c) Nicola Talbot
% Command line args:
+% -doc "mfirstuc-codedoc.tex"
+% -macrocode ".*\.perl"
+% -macrocode ".*\.tex"
% -codetitle "Main Package Code"
+% -comment ".*\.perl"
+% -comment ".*\.tex"
+% -setambles ".*\.perl=>\nopreamble\nopostamble"
+% -setambles ".*\.tex=>\nopreamble\nopostamble"
% -author "Nicola Talbot"
-% -doc "mfirstuc-codedoc.tex"
% -src "mfirstuc.sty\Z=>mfirstuc.sty"
% -src "mfirstuc-english.sty\Z=>mfirstuc-english.sty"
% -src "(sample.*\.tex)\Z=>\1"
% -src "(.*\.perl)\Z=>\1"
-% -comment ".*\.perl"
-% -comment ".*\.tex"
-% -macrocode ".*\.perl"
-% -macrocode ".*\.tex"
-% -setambles ".*\.perl=>\nopreamble\nopostamble"
-% -setambles ".*\.tex=>\nopreamble\nopostamble"
% mfirstuc
-% Created on 2016/7/29 22:54
+% Created on 2016/7/31 20:20
%\fi
%\iffalse
%<*package>
@@ -64,7 +64,7 @@
\setcounter{IndexColumns}{2}
\setlength\IndexMin{100pt}
-\CheckSum{519}
+\CheckSum{664}
\begin{document}
\DocInput{mfirstuc.dtx}
@@ -74,12 +74,12 @@
%\MakeShortVerb{"}
%\DeleteShortVerb{\|}
%
-% \title{Documented Code For mfirstuc v2.03}
+% \title{Documented Code For mfirstuc v2.04}
% \author{Nicola L.C. Talbot\\[10pt]
%Dickimaw Books\\
%\url{http://www.dickimaw-books.com/}}
%
-% \date{2016-07-29}
+% \date{2016-07-31}
% \maketitle
%
%\tableofcontents
@@ -111,7 +111,7 @@
%\changes{2.0}{2015/09/09}{package split from glossaries}
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{mfirstuc}[2016/07/29 v2.03 (NLCT)]
+\ProvidesPackage{mfirstuc}[2016/07/31 v2.04 (NLCT)]
% \end{macrocode}
% Requires \sty{etoolbox}:\changes{1.06}{2012/05/21}{now requires
% etoolbox}
@@ -226,7 +226,7 @@
%\begin{macro}{\@gls at split}
% Put first argument in \cs{@gls at first} and second argument in
% \cs{@gls at rest}:
-%\changes{??}{??}{added check for datatool-base UTF-8 support}
+%\changes{2.03}{2016-07-29}{added check for datatool-base UTF-8 support}
% \begin{macrocode}
\ifdef\dtl at getfirst@UTFviii
{%
@@ -243,6 +243,12 @@
\def\@gls at first{#1}\def\@gls at rest{#2}%
}%
}%
+ {%
+% \end{macrocode}
+%\changes{2.04}{2016-07-31}{added missing false part}
+% \begin{macrocode}
+ \def\@gls at first{#1}\def\@gls at rest{#2}%
+ }%
}
}%
{%
@@ -265,7 +271,7 @@
% Has \sty{datatool-base} v2.24 (or above) been loaded? If so and we
% have UTF-8 enabled, we can grab the first octet.
%\begin{macro}{\@mfu at applytofirst}
-%\changes{??}{??}{new}
+%\changes{2.03}{2016-07-29}{new}
% \begin{macrocode}
\ifdef\dtl at getfirst@UTFviii
{%
@@ -287,7 +293,7 @@
%\end{macro}
%
%\begin{macro}{\MFUapplytofirst}
-%\changes{??}{??}{new}
+%\changes{2.03}{2016-07-29}{new}
%\begin{definition}
%\cs{MFUapplytofirst}\marg{cs}\marg{text}
%\end{definition}
@@ -478,12 +484,24 @@
%\changes{2.02}{2015-12-17}{new}
% \begin{macrocode}
\newcommand*{\mfu at checkword@do}[1]{%
- \ifdefstring{\mfu at checkword@arg}{#1}%
- {%
- \let\@mfu at domakefirstuc\@firstofone
- \listbreak
- }%
- {}%
+ \def\mfu at checkword@argii{#1}%
+ \ifdefequal\mfu at checkword@arg\mfu at checkword@argii
+ {%
+ \let\@mfu at domakefirstuc\@firstofone
+ \listbreak
+ }%
+ {%
+% \end{macrocode}
+%Need to check if \cs{@mfu at terminator} has been tacked onto the end.
+% \begin{macrocode}
+ \def\mfu at checkword@argii{#1{\@mfu at terminator}}%
+ \ifdefequal\mfu at checkword@arg\mfu at checkword@argii
+ {%
+ \let\@mfu at domakefirstuc\@firstofone
+ \listbreak
+ }%
+ {}%
+ }%
}
% \end{macrocode}
%\end{macro}
@@ -498,6 +516,7 @@
%
%\begin{macro}{\MFUnocap}
% Provide the user with a means to add a word to the list.
+% (No expansion performed on the argument.)
% \begin{macrocode}
\newcommand*{\MFUnocap}[1]{\listadd{\@mfu at nocaplist}{#1}}
% \end{macrocode}
@@ -539,31 +558,167 @@
% \end{macrocode}
%\end{macro}
%
+%\begin{macro}{\@mfu at nil}
+% \begin{macrocode}
+\newcommand\@mfu at nil{\unskip}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@mfu at nnil}
+% \begin{macrocode}
+\newcommand*\@mfu at nnil{\@mfu at nil}
+% \end{macrocode}
+%\end{macro}
+%
%\begin{macro}{\capitalisefmtwords}
%\changes{2.03}{2016-07-29}{new}
%Like \cs{capitalisewords} but assumes that the phrase contains
%formatting text-block commands.
% \begin{macrocode}
-\newcommand*{\capitalisefmtwords}[1]{%
+\newcommand*{\capitalisefmtwords}{%
+ \@ifstar\@s at capitalisefmtwords\@ns at capitalisefmtwords
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@s at capitalisefmtwords}
+%\changes{2.04}{2016-07-31}{new}
+% Starred form.
+% \begin{macrocode}
+\newcommand*{\@s at capitalisefmtwords}[1]{%
+ \@@s at checkgrp@@capitalisefmtwords#1\@nil
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@@s at checkgrp@capitalisefmtwords}
+%\changes{2.04}{2016-07-31}{new}
+% \begin{macrocode}
+\newcommand*{\@@s at checkgrp@@capitalisefmtwords}{%
+ \@ifnextchar\bgroup{\@@s at nocs@capitalisefmtwords}{\@@s at capitalisefmtwords}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@@s at nocs@capitalisefmtwords}
+%\changes{2.04}{2016-07-31}{new}
+%Argument starts with a group.
+% \begin{macrocode}
+\def\@@s at nocs@capitalisefmtwords#1\@nil{%
+ \capitalisewords{#1}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@@s at capitalisefmtwords}
+%\changes{2.04}{2016-07-31}{new}
+% \begin{macrocode}
+\newcommand*{\@@s at capitalisefmtwords}[1]{%
+ \def\gls at argi{#1}%
+ \ifx\gls at argi\@MFU at protect
+% \end{macrocode}
+%Skip \cs{protect}
+% \begin{macrocode}
+ \let\@mfu at capfmtwordsnext\@@s at capitalisefmtwords
+ \else
+ \ifx\gls at argi\@nnil
+% \end{macrocode}
+%Nothing to do.
+% \begin{macrocode}
+ \let\@mfu at capfmtwordsnext\relax
+ \else
+ \def\@gls at tmp{\ #1}%
+ \@onelevel at sanitize\@gls at tmp
+ \expandafter\@gls at checkcs\@gls at tmp\relax\relax
+ \if at glscs
+ \def\@mfu at capfmtwordsnext{\@@s at cs@capitalisefmtwords#1}%
+ \else
+ \def\@mfu at capfmtwordsnext{\@@s at nocs@capitalisefmtwords#1}%
+ \fi
+ \fi
+ \fi
+ \@mfu at capfmtwordsnext
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@@s at cs@capitalisefmtwords}
+%\changes{2.04}{2016-07-31}{new}
+% \begin{macrocode}
+\newcommand*{\@@s at cs@capitalisefmtwords}[1]{%
+ \@ifnextchar\bgroup
+ {\@@s at cs@g at capitalisefmtwords#1}%
+ {\@@s at cs@ng at capitalisefmtwords#1}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@@s at cs@g at capitalisefmtwords}
+%\changes{2.04}{2016-07-31}{new}
+% \begin{macrocode}
+\def\@@s at cs@g at capitalisefmtwords#1#2#3\@nil{%
+ #1{\capitalisewords{#2}}%
+ \ifblank{#3}%
+ {}%
+ {%
+ \def\gls at add@space{}%
+ \let\@mfu at checkword\mfu at checkword
+ \mfu at capitalisewords#3 \@nil\mfu at endcap
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@@s at cs@ng at capitalisefmtwords}
+%\changes{2.04}{2016-07-31}{new}
+% \begin{macrocode}
+\def\@@s at cs@ng at capitalisefmtwords#1#2\@nil{%
+ \capitalisewords{#1#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@ns at capitalisefmtwords}
+%\changes{2.04}{2016-07-31}{new}
+% Unstarred form.
+% \begin{macrocode}
+\newcommand*{\@ns at capitalisefmtwords}[1]{%
\let\@mfu at checkword\@gobble
\def\gls at add@space{}%
- \@capitalisefmtwords#1 \@nil\relax
+ \@capitalisefmtwords#1 \@mfu at nil{} \unskip
}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\@capitalisefmtwords}
%\changes{2.03}{2016-07-29}{new}
+%Take care of group at the start of the word.
% \begin{macrocode}
-\def\@capitalisefmtwords#1 #2{%
- \def\gls at argi{#2}%
- \ifx\gls at argi\@nnil
- \def\@mfu at capfmtwordsnext{\@capitalise at fmtwords#1\@nil}%
+\newcommand*{\@capitalisefmtwords}{%
+ \@ifnextchar\bgroup{\@capitalise at g@fmtwords}{\@capitalise at ng@fmtwords}%
+}
+\newcommand*{\@capitalise at g@fmtwords}[1]{%
+ \@capitalise at ng@fmtwords{{#1}}%
+}
+\def\@mfu at ifnil#1#2\@mfu at end@nil#3#4{%
+ \def\gls at argi{#1}%
+ \ifx\gls at argi\@mfu at nnil
+ #3%
\else
- \def\@mfu at capfmtwordsnext{\@capitalise at fmtwords#1\@nil
- \def\gls at add@space{ }%
- \let\@mfu at checkword\mfu at checkword
- \@@cap at nofmtphrase#2}%
+ #4%
\fi
+}
+\def\@capitalise at ng@fmtwords#1 {%
+ \@mfu at ifnil#1\relax\relax\@mfu at end@nil
+ {%
+ \def\@mfu at capfmtwordsnext{#1}%
+ }%
+ {%
+ \def\@mfu at capfmtwordsnext{%
+ \@capitalise at fmtwords#1\@mfu at nil
+ \def\gls at add@space{ }%
+ \let\@mfu at checkword\mfu at checkword
+ \@@cap at nofmtphrase}%
+ }%
\@mfu at capfmtwordsnext
}%
% \end{macrocode}
@@ -572,13 +727,15 @@
%\changes{2.03}{2016-07-29}{new}
% \begin{macrocode}
\def\@capitalise at fmtwords#1{%
- \def\gls at argi{#1}%
- \ifx\gls at argi\@nnil
+ \@mfu at ifnil#1\relax\relax\@mfu at end@nil
+ {%
% \end{macrocode}
%Do nothing.
% \begin{macrocode}
- \let\@mfu at capfmtwordsnext\relax
- \else
+ \def\@mfu at capfmtwordsnext{#1}%
+ }%
+ {%
+ \def\gls at argi{#1}%
\ifx\gls at argi\@MFU at protect
% \end{macrocode}
%Skip \cs{protect}
@@ -598,41 +755,34 @@
\fi
\fi
\fi
- \fi
+ }%
\@mfu at capfmtwordsnext
}
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\@capitalisefmtwords}
+%\begin{macro}{\@@capitalisefmtwords}
%\changes{2.03}{2016-07-29}{new}
%Check for a group following argument.
% \begin{macrocode}
\def\@@capitalisefmtwords#1{%
- \@ifnextchar\bgroup{\@@capfmtphrase#1}{\@@capnofmtphrase#1}%
+ \@ifnextchar\bgroup{\@@capfmtsubphrase#1}{\@@capnofmtphrase#1}%
}
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\@@capfmtphrase}
+%\begin{macro}{\@@capnofmtphrase}
%\changes{2.03}{2016-07-29}{new}
% \begin{macrocode}
-\def\@@capfmtphrase#1#2#3{%
- \def\@gls at tmp{#3}%
- \ifx\@gls at tmp\@nnil
- \def\@mfu at capfmtwordsnext{#1{\@capitalisefmtwords#2 \@nil}}%
- \else
- \def\@mfu at capfmtwordsnext{\@@capfmtsubphrase#1{#2}#3}%
- \fi
- \@mfu at capfmtwordsnext
+\def\@@capnofmtphrase{%
+ \@ifnextchar\bgroup{\@@cap at g@nofmtphrase}{\@@cap at ng@nofmtphrase}%
}
% \end{macrocode}
%\end{macro}
-%
-%\begin{macro}{\@@capnofmtphrase}
-%\changes{2.03}{2016-07-29}{new}
+%\begin{macro}{\@@cap at ng@nofmtphrase}
+%\changes{2.04}{2016-07-31}{new}
% \begin{macrocode}
-\def\@@capnofmtphrase#1\@nil{%
+\def\@@cap at ng@nofmtphrase#1\@mfu at nil{%
\gls at add@space
\@mfu at mid@capitalisewords{#1}%
\def\gls at add@space{ }%
@@ -639,34 +789,57 @@
}
% \end{macrocode}
%\end{macro}
+%\begin{macro}{\@@cap at g@nofmtphrase}
+%\changes{2.04}{2016-07-31}{new}
+% \begin{macrocode}
+\def\@@cap at g@nofmtphrase#1{%
+ \@@cap at ng@nofmtphrase{{#1}}%
+}
+% \end{macrocode}
+%\end{macro}
%
+%\begin{macro}{\@mfu at terminator}
+%\changes{2.04}{2016-07-31}{new}
+% \begin{macrocode}
+\newcommand*\@mfu at terminator{\hbox{}}
+% \end{macrocode}
+%\end{macro}
+%
%\begin{macro}{\@@capfmtsubphrase}
%\changes{2.03}{2016-07-29}{new}
% \begin{macrocode}
-\def\@@capfmtsubphrase#1#2#3\@nil{%
- \gls at add@space
- #1{\@mfu at mid@capitalisewords{#2}}%
+\def\@@capfmtsubphrase#1#2#3{%
+% \end{macrocode}
+%Protect any trailing space at the end of the second argument.
+% \begin{macrocode}
+ #1{\@capitalisefmtwords#2{\@mfu at terminator} \@mfu at nil{} \unskip}%
\def\gls at add@space{ }%
\let\@mfu at checkword\mfu at checkword
- #3%
+ \@mfu at ifnil#1\relax\relax\@mfu at end@nil
+ {\let\@mfu at fmtsubphrasenext\relax}%
+ {\def\@mfu at fmtsubphrasenext{#3}}%
+ \@mfu at fmtsubphrasenext
}
% \end{macrocode}
%\end{macro}
%
-%
%\begin{macro}{\@@cap at nofmtphrase}
%\changes{2.03}{2016-07-29}{new}
% \begin{macrocode}
-\def\@@cap at nofmtphrase#1 #2\@nil{%
- \def\gls at arg{#2}%
- \ifx\gls at arg\@empty
- \@capitalisefmtwords#1 \@nil
- \else
- \@capitalisefmtwords#1 \@nil
- \def\gls at add@space{ }%
- \let\@mfu at checkword\mfu at checkword
- \@capitalisefmtwords#2 \@nil
- \fi
+\def\@@cap at nofmtphrase#1 {%
+ \@mfu at ifnil#1\relax\relax\@mfu at end@nil
+ {%
+ \def\@mfu at capnofmtwordsnext{#1 }%
+ }%
+ {%
+ \def\@mfu at capnofmtwordsnext{%
+ \@capitalisefmtwords#1 \@mfu at nil{} \unskip
+ \def\gls at add@space{ }%
+ \let\@mfu at checkword\mfu at checkword
+ \@capitalisefmtwords
+ }%
+ }%
+ \@mfu at capnofmtwordsnext
}
% \end{macrocode}
%\end{macro}
@@ -675,22 +848,60 @@
%\changes{2.03}{2016-07-29}{new}
% Short-cut command:
% \begin{macrocode}
-\newcommand*{\xcapitalisefmtwords}[1]{%
- \expandafter\capitalisefmtwords\expandafter{#1}%
+\newcommand*{\xcapitalisefmtwords}{%
+ \@ifstar\@s at xcapitalisefmtwords\@ns at xcapitalisefmtwords
}
% \end{macrocode}
%\end{macro}
+%\begin{macro}{\@s at xcapitalisefmtwords}
+%\changes{2.04}{2016-07-31}{new}
+% Starred version
+% \begin{macrocode}
+\newcommand*{\@s at xcapitalisefmtwords}[1]{%
+ \expandafter\@s at capitalisefmtwords\expandafter{#1}%
+}
+% \end{macrocode}
+%\end{macro}
%
+%\begin{macro}{\@ns at xcapitalisefmtwords}
+%\changes{2.04}{2016-07-31}{new}
+% Unstarred version
+% \begin{macrocode}
+\newcommand*{\@ns at xcapitalisefmtwords}[1]{%
+ \expandafter\@ns at capitalisefmtwords\expandafter{#1}%
+}
+% \end{macrocode}
+%\end{macro}
+%
%\begin{macro}{\ecapitalisefmtwords}
%\changes{2.03}{2016-07-29}{new}
% \begin{macrocode}
-\newrobustcmd*{\ecapitalisefmtwords}[1]{%
+\newrobustcmd*{\ecapitalisefmtwords}{%
+ \@ifstar\@s at ecapitalisefmtwords\@ns at ecapitalisefmtwords
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@s at ecapitalisefmtwords}
+%\changes{2.04}{2016-07-31}{new}
+%Starred version
+% \begin{macrocode}
+\newcommand*{\@s at ecapitalisefmtwords}[1]{%
\protected at edef\@MFU at caparg{#1}%
- \expandafter\capitalisefmtwords\expandafter{\@MFU at caparg}%
+ \expandafter\@s at capitalisefmtwords\expandafter{\@MFU at caparg}%
}
% \end{macrocode}
%\end{macro}
%
+%\begin{macro}{\@ns at ecapitalisefmtwords}
+%\changes{2.04}{2016-07-31}{new}
+%Unstarred version
+% \begin{macrocode}
+\newcommand*{\@ns at ecapitalisefmtwords}[1]{%
+ \protected at edef\@MFU at caparg{#1}%
+ \expandafter\@ns at capitalisefmtwords\expandafter{\@MFU at caparg}%
+}
+% \end{macrocode}
+%\end{macro}
%\iffalse
% \begin{macrocode}
%</mfirstuc.sty>
@@ -705,7 +916,7 @@
%\label{sec:code:mfirstuc-english}
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{mfirstuc-english}[2016/07/29 v2.03 (NLCT)]
+\ProvidesPackage{mfirstuc-english}[2016/07/31 v2.04 (NLCT)]
% \end{macrocode}
% Load \sty{mfirstuc} if not already loaded:
% \begin{macrocode}
@@ -746,15 +957,22 @@
% This file is public domain
% If you want to use arara, you need the following directive:
% arara: pdflatex: { synctex: on }
+ % arara: pdflatex: { synctex: on }
\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage{color}
\usepackage{mfirstuc-english}% also loads mfirstuc.sty
+\usepackage[hidelinks]{hyperref}
+\title{Sample Document Illustrating the mfirstuc Package}
+\author{Nicola Talbot}
+
\begin{document}
-This is a sample document illustrating the mfirstuc package.
+\maketitle
+\tableofcontents
+
\section{First Letter Upper Case}
\verb|\makefirstuc{abc}.|
@@ -785,24 +1003,83 @@
\renewcommand*{\mytext}{\ae\oe{some text}}
Sequential commands: \xmakefirstuc{\mytext}.
-\section{Title Case (Formatting)}
+\section{Title Case (No Formatting Commands)}
+\bgroup
+%Clearing ``nocap'' words.
+%\verb|\MFUclear|
+%\MFUclear
+%(localised by group)
+
+\verb|\capitalisewords{the wind in the willows}|
+\capitalisewords{the wind in the willows}
+
+\verb|\capitalisewords{a small book of rhyme.}|
+\capitalisewords{a small book of rhyme.}
+
+\medskip
+
+\verb|\space| isn't considered a word boundary for
+\verb|\capitalisewords| as shown below:
+
+\begin{verbatim}
+\capitalisewords{a small\space book of rhyme.}
+\end{verbatim}
+\capitalisewords{a small\space book of rhyme.}
+
+\medskip
+No expansion is performed on the argument of
+\verb|\capitalisewords|:
+
+\verb|\newcommand{\mytitle}{a small book of rhyme.}|
+\newcommand{\mytitle}{a small book of rhyme.}
+
+\verb|\capitalisewords{\mytitle}|
+\capitalisewords{\mytitle}
+
+\verb|\xcapitalisewords{\mytitle}|
+\xcapitalisewords{\mytitle}
+
+\egroup
+
Formatting for the entire phrase must go outside
\verb|\capitalisewords| (unlike \verb|\makefirstuc|). Compare:
-\verb|\capitalisewords{\textbf{a small book of rhyme.}}|
+\begin{verbatim}
\capitalisewords{\textbf{a small book of rhyme.}}
+\end{verbatim}
+\capitalisewords{\textbf{a small book of rhyme.}}
-with:
-
-\verb|\textbf{\capitalisewords{a small book of rhyme.}}|
+\begin{verbatim}
\textbf{\capitalisewords{a small book of rhyme.}}
+\end{verbatim}
+\textbf{\capitalisewords{a small book of rhyme.}}
\medskip
-Use \verb|\capitalisefmtwords| instead (full stop outside
-argument to check for spurious spaces):
+Use \verb|\capitalisefmtwords| instead. The starred form
+is limited to one text-block command at the start of the argument.
+\begin{verbatim}
+\capitalisefmtwords*{\emph{a small book of rhyme}}
+\end{verbatim}
+\capitalisefmtwords*{\emph{a small book of rhyme}}
+
+Additional text-block commands can cause unexpected results.
+
+\begin{verbatim}
+\capitalisefmtwords*{\emph{a small} book \textbf{of rhyme}}
+\end{verbatim}
+\capitalisefmtwords*{\emph{a small} book \textbf{of rhyme}}
+
+
+\section{Title Case (Contains Text-Block Formatting Commands)}
+
+The unstarred form of \verb|\capitalisefmtwords| is still a bit
+experimental and is only designed
+for phrases that contain text-block commands with a single
+argument, which should be a word or sub-phrase.
+
\verb|\capitalisefmtwords{\textbf{a small book of rhyme}}.|
\capitalisefmtwords{\textbf{a small book of rhyme}}.
@@ -812,17 +1089,28 @@
\verb|\capitalisefmtwords{a \textbf{small book} of rhyme}.|
\capitalisefmtwords{a \textbf{small book} of rhyme}.
-\verb|\capitalisefmtwords{\textbf{a} book of rhyme}.|
+\verb|\capitalisefmtwords{\textbf{a} small book of rhyme}.|
\capitalisefmtwords{\textbf{a} small book of rhyme}.
-\verb|\capitalisefmtwords{\textbf{a book }of rhyme}.|
-\capitalisefmtwords{\textbf{a small book }of rhyme}.
-
\verb|\capitalisefmtwords{a small book \textbf{of rhyme}}.|
\capitalisefmtwords{a small book \textbf{of rhyme}}.
\medskip
+Be careful of trailing spaces at the end a group. They can confuse
+things.
+
+\verb|\capitalisefmtwords{\textbf{a small }book of rhyme}.|
+\capitalisefmtwords{\textbf{a small }book of rhyme}.
+
+\verb|\capitalisefmtwords{\textbf{a small book }of rhyme}.|
+\capitalisefmtwords{\textbf{a small book }of rhyme}.
+
+\verb|\capitalisefmtwords{\textbf{a small book of }rhyme}.|
+\capitalisefmtwords{\textbf{a small book of }rhyme}.
+
+\medskip
+
Use semantic commands for things like quotations:
\begin{verbatim}
@@ -836,9 +1124,28 @@
(But make them robust if you intend using commands like
\verb|\ecapitalisefmtwords|.)
+Similarly for other types of punctuation:
+\begin{verbatim}
+\newcommand*{\esq}[1]{'?#1?}
+\capitalisefmtwords{\esq{D\'onde est\'a libro}}
+\end{verbatim}
+\newcommand*{\esq}[1]{?`#1?}
+\capitalisefmtwords{\esq{D\'onde est\'a libro}}
\medskip
+Anything more complicated than a simple one-argument text-block
+command requires the starred version.
+
+\begin{verbatim}
+\newcommand*{\swap}[2]{{#2}{#1}}
+\capitalisefmtwords*{\textbf{an \swap{un}{usually} small book of} rhyme}.
+\end{verbatim}
+\newcommand*{\swap}[2]{{#2}{#1}}
+\capitalisefmtwords*{\textbf{an \swap{un}{usually} small book of} rhyme}.
+
+\medskip
+
Nested text-block commands:
\begin{verbatim}
@@ -916,43 +1223,29 @@
\verb|\capitalisefmtwords{\relax a book of rhyme.}|
\capitalisefmtwords{\relax a book of rhyme.}
-\section{Title Case (No Formatting)}
+\section{Compound Words}
-\bgroup
-%Clearing ``nocap'' words.
-%\verb|\MFUclear|
-%\MFUclear
+Use \verb|\MFUhyphentrue| to title case each part of
+a compound word.
-\verb|\capitalisewords{the wind in the willows}|
-\capitalisewords{the wind in the willows}
+Default:
+\begin{verbatim}
+\capitalisewords{a fast-paced book of rhyme}.
+\capitalisefmtwords{a \textbf{fast-paced} book of rhyme}.
+\end{verbatim}
+\capitalisewords{a fast-paced book of rhyme}.
+\capitalisefmtwords{a \textbf{fast-paced} book of rhyme}.
-\verb|\capitalisewords{a small book of rhyme.}|
-\capitalisewords{a small book of rhyme.}
-
-\medskip
-
-\verb|\space| isn't considered a word boundary for
-\verb|\capitalisewords| as shown below:
-
+Compare with
\begin{verbatim}
-\capitalisewords{a small\space book of rhyme.}
+\MFUhyphentrue
+\capitalisewords{a fast-paced book of rhyme}.
+\capitalisefmtwords{a \textbf{fast-paced} book of rhyme}.
\end{verbatim}
-\capitalisewords{a small\space book of rhyme.}
+\MFUhyphentrue
+\capitalisewords{a fast-paced book of rhyme}.
+\capitalisefmtwords{a \textbf{fast-paced} book of rhyme}.
-\medskip
-No expansion is performed on the argument of
-\verb|\capitalisewords|:
-
-\verb|\newcommand{\mytitle}{a small\space book of rhyme.}|
-\newcommand{\mytitle}{a small\space book of rhyme.}
-
-\verb|\capitalisewords{\mytitle}|
-\capitalisewords{\mytitle}
-
-\verb|\xcapitalisewords{\mytitle}|
-\xcapitalisewords{\mytitle}
-
-\egroup
\end{document}
% \end{macrocode}
%\fi
Modified: trunk/Master/texmf-dist/source/latex/mfirstuc/mfirstuc.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/mfirstuc/mfirstuc.ins 2016-08-01 21:47:21 UTC (rev 41784)
+++ trunk/Master/texmf-dist/source/latex/mfirstuc/mfirstuc.ins 2016-08-01 21:47:34 UTC (rev 41785)
@@ -1,4 +1,4 @@
-% mfirstuc.ins generated using makedtx version 1.1 2016/7/29 22:54
+% mfirstuc.ins generated using makedtx version 1.1 2016/7/31 20:20
\input docstrip
\preamble
Modified: trunk/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc-english.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc-english.sty 2016-08-01 21:47:21 UTC (rev 41784)
+++ trunk/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc-english.sty 2016-08-01 21:47:34 UTC (rev 41785)
@@ -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}
Modified: trunk/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty 2016-08-01 21:47:21 UTC (rev 41784)
+++ trunk/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty 2016-08-01 21:47:34 UTC (rev 41785)
@@ -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 at glscs
\newtoks\@glsmfirst
@@ -107,6 +107,9 @@
\def\@gls at first{#1}\def\@gls at rest{#2}%
}%
}%
+ {%
+ \def\@gls at first{#1}\def\@gls at rest{#2}%
+ }%
}
}%
{%
@@ -223,12 +226,21 @@
\forlistloop\mfu at checkword@do\@mfu at nocaplist
}
\newcommand*{\mfu at checkword@do}[1]{%
- \ifdefstring{\mfu at checkword@arg}{#1}%
- {%
- \let\@mfu at domakefirstuc\@firstofone
- \listbreak
- }%
- {}%
+ \def\mfu at checkword@argii{#1}%
+ \ifdefequal\mfu at checkword@arg\mfu at checkword@argii
+ {%
+ \let\@mfu at domakefirstuc\@firstofone
+ \listbreak
+ }%
+ {%
+ \def\mfu at checkword@argii{#1{\@mfu at terminator}}%
+ \ifdefequal\mfu at checkword@arg\mfu at checkword@argii
+ {%
+ \let\@mfu at domakefirstuc\@firstofone
+ \listbreak
+ }%
+ {}%
+ }%
}
\newcommand*{\@mfu at nocaplist}{}
\newcommand*{\MFUnocap}[1]{\listadd{\@mfu at nocaplist}{#1}}
@@ -241,28 +253,98 @@
\protected at edef\@MFU at caparg{#1}%
\expandafter\capitalisewords\expandafter{\@MFU at caparg}%
}
-\newcommand*{\capitalisefmtwords}[1]{%
+\newcommand\@mfu at nil{\unskip}
+\newcommand*\@mfu at nnil{\@mfu at nil}
+\newcommand*{\capitalisefmtwords}{%
+ \@ifstar\@s at capitalisefmtwords\@ns at capitalisefmtwords
+}
+\newcommand*{\@s at capitalisefmtwords}[1]{%
+ \@@s at checkgrp@@capitalisefmtwords#1\@nil
+}
+\newcommand*{\@@s at checkgrp@@capitalisefmtwords}{%
+ \@ifnextchar\bgroup{\@@s at nocs@capitalisefmtwords}{\@@s at capitalisefmtwords}%
+}
+\def\@@s at nocs@capitalisefmtwords#1\@nil{%
+ \capitalisewords{#1}%
+}
+\newcommand*{\@@s at capitalisefmtwords}[1]{%
+ \def\gls at argi{#1}%
+ \ifx\gls at argi\@MFU at protect
+ \let\@mfu at capfmtwordsnext\@@s at capitalisefmtwords
+ \else
+ \ifx\gls at argi\@nnil
+ \let\@mfu at capfmtwordsnext\relax
+ \else
+ \def\@gls at tmp{\ #1}%
+ \@onelevel at sanitize\@gls at tmp
+ \expandafter\@gls at checkcs\@gls at tmp\relax\relax
+ \if at glscs
+ \def\@mfu at capfmtwordsnext{\@@s at cs@capitalisefmtwords#1}%
+ \else
+ \def\@mfu at capfmtwordsnext{\@@s at nocs@capitalisefmtwords#1}%
+ \fi
+ \fi
+ \fi
+ \@mfu at capfmtwordsnext
+}
+\newcommand*{\@@s at cs@capitalisefmtwords}[1]{%
+ \@ifnextchar\bgroup
+ {\@@s at cs@g at capitalisefmtwords#1}%
+ {\@@s at cs@ng at capitalisefmtwords#1}%
+}
+\def\@@s at cs@g at capitalisefmtwords#1#2#3\@nil{%
+ #1{\capitalisewords{#2}}%
+ \ifblank{#3}%
+ {}%
+ {%
+ \def\gls at add@space{}%
+ \let\@mfu at checkword\mfu at checkword
+ \mfu at capitalisewords#3 \@nil\mfu at endcap
+ }%
+}
+\def\@@s at cs@ng at capitalisefmtwords#1#2\@nil{%
+ \capitalisewords{#1#2}%
+}
+\newcommand*{\@ns at capitalisefmtwords}[1]{%
\let\@mfu at checkword\@gobble
\def\gls at add@space{}%
- \@capitalisefmtwords#1 \@nil\relax
+ \@capitalisefmtwords#1 \@mfu at nil{} \unskip
}
-\def\@capitalisefmtwords#1 #2{%
- \def\gls at argi{#2}%
- \ifx\gls at argi\@nnil
- \def\@mfu at capfmtwordsnext{\@capitalise at fmtwords#1\@nil}%
+\newcommand*{\@capitalisefmtwords}{%
+ \@ifnextchar\bgroup{\@capitalise at g@fmtwords}{\@capitalise at ng@fmtwords}%
+}
+\newcommand*{\@capitalise at g@fmtwords}[1]{%
+ \@capitalise at ng@fmtwords{{#1}}%
+}
+\def\@mfu at ifnil#1#2\@mfu at end@nil#3#4{%
+ \def\gls at argi{#1}%
+ \ifx\gls at argi\@mfu at nnil
+ #3%
\else
- \def\@mfu at capfmtwordsnext{\@capitalise at fmtwords#1\@nil
- \def\gls at add@space{ }%
- \let\@mfu at checkword\mfu at checkword
- \@@cap at nofmtphrase#2}%
+ #4%
\fi
+}
+\def\@capitalise at ng@fmtwords#1 {%
+ \@mfu at ifnil#1\relax\relax\@mfu at end@nil
+ {%
+ \def\@mfu at capfmtwordsnext{#1}%
+ }%
+ {%
+ \def\@mfu at capfmtwordsnext{%
+ \@capitalise at fmtwords#1\@mfu at nil
+ \def\gls at add@space{ }%
+ \let\@mfu at checkword\mfu at checkword
+ \@@cap at nofmtphrase}%
+ }%
\@mfu at capfmtwordsnext
}%
\def\@capitalise at fmtwords#1{%
- \def\gls at argi{#1}%
- \ifx\gls at argi\@nnil
- \let\@mfu at capfmtwordsnext\relax
- \else
+ \@mfu at ifnil#1\relax\relax\@mfu at end@nil
+ {%
+ \def\@mfu at capfmtwordsnext{#1}%
+ }%
+ {%
+ \def\gls at argi{#1}%
\ifx\gls at argi\@MFU at protect
\def\@mfu at capfmtwordsnext{\@capitalise at fmtwords}%
\else
@@ -279,51 +361,68 @@
\fi
\fi
\fi
- \fi
+ }%
\@mfu at capfmtwordsnext
}
\def\@@capitalisefmtwords#1{%
- \@ifnextchar\bgroup{\@@capfmtphrase#1}{\@@capnofmtphrase#1}%
+ \@ifnextchar\bgroup{\@@capfmtsubphrase#1}{\@@capnofmtphrase#1}%
}
-\def\@@capfmtphrase#1#2#3{%
- \def\@gls at tmp{#3}%
- \ifx\@gls at tmp\@nnil
- \def\@mfu at capfmtwordsnext{#1{\@capitalisefmtwords#2 \@nil}}%
- \else
- \def\@mfu at capfmtwordsnext{\@@capfmtsubphrase#1{#2}#3}%
- \fi
- \@mfu at capfmtwordsnext
+\def\@@capnofmtphrase{%
+ \@ifnextchar\bgroup{\@@cap at g@nofmtphrase}{\@@cap at ng@nofmtphrase}%
}
-\def\@@capnofmtphrase#1\@nil{%
+\def\@@cap at ng@nofmtphrase#1\@mfu at nil{%
\gls at add@space
\@mfu at mid@capitalisewords{#1}%
\def\gls at add@space{ }%
}
-\def\@@capfmtsubphrase#1#2#3\@nil{%
- \gls at add@space
- #1{\@mfu at mid@capitalisewords{#2}}%
+\def\@@cap at g@nofmtphrase#1{%
+ \@@cap at ng@nofmtphrase{{#1}}%
+}
+\newcommand*\@mfu at terminator{\hbox{}}
+\def\@@capfmtsubphrase#1#2#3{%
+ #1{\@capitalisefmtwords#2{\@mfu at terminator} \@mfu at nil{} \unskip}%
\def\gls at add@space{ }%
\let\@mfu at checkword\mfu at checkword
- #3%
+ \@mfu at ifnil#1\relax\relax\@mfu at end@nil
+ {\let\@mfu at fmtsubphrasenext\relax}%
+ {\def\@mfu at fmtsubphrasenext{#3}}%
+ \@mfu at fmtsubphrasenext
}
-\def\@@cap at nofmtphrase#1 #2\@nil{%
- \def\gls at arg{#2}%
- \ifx\gls at arg\@empty
- \@capitalisefmtwords#1 \@nil
- \else
- \@capitalisefmtwords#1 \@nil
- \def\gls at add@space{ }%
- \let\@mfu at checkword\mfu at checkword
- \@capitalisefmtwords#2 \@nil
- \fi
+\def\@@cap at nofmtphrase#1 {%
+ \@mfu at ifnil#1\relax\relax\@mfu at end@nil
+ {%
+ \def\@mfu at capnofmtwordsnext{#1 }%
+ }%
+ {%
+ \def\@mfu at capnofmtwordsnext{%
+ \@capitalisefmtwords#1 \@mfu at nil{} \unskip
+ \def\gls at add@space{ }%
+ \let\@mfu at checkword\mfu at checkword
+ \@capitalisefmtwords
+ }%
+ }%
+ \@mfu at capnofmtwordsnext
}
-\newcommand*{\xcapitalisefmtwords}[1]{%
- \expandafter\capitalisefmtwords\expandafter{#1}%
+\newcommand*{\xcapitalisefmtwords}{%
+ \@ifstar\@s at xcapitalisefmtwords\@ns at xcapitalisefmtwords
}
-\newrobustcmd*{\ecapitalisefmtwords}[1]{%
+\newcommand*{\@s at xcapitalisefmtwords}[1]{%
+ \expandafter\@s at capitalisefmtwords\expandafter{#1}%
+}
+\newcommand*{\@ns at xcapitalisefmtwords}[1]{%
+ \expandafter\@ns at capitalisefmtwords\expandafter{#1}%
+}
+\newrobustcmd*{\ecapitalisefmtwords}{%
+ \@ifstar\@s at ecapitalisefmtwords\@ns at ecapitalisefmtwords
+}
+\newcommand*{\@s at ecapitalisefmtwords}[1]{%
\protected at edef\@MFU at caparg{#1}%
- \expandafter\capitalisefmtwords\expandafter{\@MFU at caparg}%
+ \expandafter\@s at capitalisefmtwords\expandafter{\@MFU at caparg}%
}
+\newcommand*{\@ns at ecapitalisefmtwords}[1]{%
+ \protected at edef\@MFU at caparg{#1}%
+ \expandafter\@ns at capitalisefmtwords\expandafter{\@MFU at caparg}%
+}
\endinput
%%
%% End of file `mfirstuc.sty'.
More information about the tex-live-commits
mailing list