diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/glossaries/mfirstuc-manual.html')
-rw-r--r-- | Master/texmf-dist/doc/latex/glossaries/mfirstuc-manual.html | 503 |
1 files changed, 351 insertions, 152 deletions
diff --git a/Master/texmf-dist/doc/latex/glossaries/mfirstuc-manual.html b/Master/texmf-dist/doc/latex/glossaries/mfirstuc-manual.html index 7b5b6744d7a..4d53a543e55 100644 --- a/Master/texmf-dist/doc/latex/glossaries/mfirstuc-manual.html +++ b/Master/texmf-dist/doc/latex/glossaries/mfirstuc-manual.html @@ -10,31 +10,33 @@ <meta name="originator" content="TeX4ht (http://www.tug.org/tex4ht/)" /> <!-- xhtml,fn-in,css-in,uni-html4,utf8 --> <meta name="src" content="mfirstuc-manual.tex" /> -<meta name="date" content="2014-08-27 15:21:00" /> +<meta name="date" content="2014-09-01 21:19:00" /> <style type="text/css"> <!-- /* start css.sty */ -.cmmi-10{font-style: italic;} .cmr-17{font-size:170%;} .cmr-12{font-size:120%;} .cmtt-12{font-size:120%;font-family: monospace;} .cmtt-12{font-family: monospace;} .cmtt-12{font-family: monospace;} .cmtt-12{font-family: monospace;} +.cmtt-10{font-family: monospace;} +.cmtt-10{font-family: monospace;} +.cmtt-10{font-family: monospace;} +.cmtt-10{font-family: monospace;} +.cmss-10{ font-family: sans-serif;} .cmss-10{ font-family: sans-serif;} .cmtt-9{font-size:90%;font-family: monospace;} .cmtt-9{font-family: monospace;} .cmtt-9{font-family: monospace;} .cmtt-9{font-family: monospace;} -.cmtt-10{font-family: monospace;} -.cmtt-10{font-family: monospace;} -.cmtt-10{font-family: monospace;} -.cmtt-10{font-family: monospace;} .cmitt-10{font-family: monospace; font-style: italic;} .cmti-10{ font-style: italic;} .cmbx-10{ font-weight: bold;} +.cmssi-10{ font-family: sans-serif; font-style: oblique;} +.cmssi-10{ font-family: sans-serif; font-style: oblique;} p.noindent { text-indent: 0em } td p.noindent { text-indent: 0em; margin-top:0em; } p.nopar { text-indent: 0em; } @@ -174,43 +176,54 @@ class="cmtt-12">http://www.dickimaw-_books.com/</span></a></div><br /> <div class="date" ><span class="cmr-12">2014-07-30</span></div> </div> -<!--l. 28--><p class="indent" > The <span + <h3 class="likesectionHead"><a + id="x1-1000"></a>Contents</h3> + <div class="tableofcontents"> + <span class="sectionToc" >1 <a +href="#sec:intro" id="QQ2-1-2">Introduction</a></span> +<br /> <span class="sectionToc" >2 <a +href="#sec:capitalisewords" id="QQ2-1-3">Capitalise Each Word in a Phrase or Sentence (Title Case)</a></span> +<br /> <span class="sectionToc" >3 <a +href="#sec:utf8" id="QQ2-1-4">UTF-8</a></span> + </div> +<!--l. 33--><p class="noindent" > +</p> +<!--l. 33--><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. 36--><p class="noindent" >The <span class="cmss-10">glossaries </span>bundle includes the package <span class="cmss-10">mfirstuc</span><a - id="dx1-2"></a> which provides the -command: -</p><!--l. 30--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span + id="dx1-2001"></a> which provides the command: +</p><!--l. 38--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="cmtt-9">\makefirstuc</span><span class="cmtt-9"> </span></span><a - id="dx1-3"></a> <span -class="cmtt-10">\makefirstuc{</span><span -class="cmmi-10"><</span><span -class="cmitt-10">stuff</span><span -class="cmmi-10">></span><span + id="dx1-2002"></a> <span +class="cmtt-10">\makefirstuc{</span>⟨<span +class="cmitt-10">stuff</span>⟩<span class="cmtt-10">} </span></div><hr> -</p><!--l. 32--><p class="noindent" > -This makes the first object of <span -class="cmmi-10"><</span><span -class="cmti-10">stuff</span><span -class="cmmi-10">> </span>uppercase unless <span -class="cmmi-10"><</span><span -class="cmti-10">stuff</span><span -class="cmmi-10">> </span>starts with a control +</p><!--l. 40--><p class="noindent" > +This makes the first object of ⟨<span +class="cmti-10">stuff </span>⟩ uppercase unless ⟨<span +class="cmti-10">stuff </span>⟩ starts with a control sequence followed by a non-empty group, in which case the first object in the group is converted to uppercase. <span class="cmbx-10">No expansion is performed on the</span> <span class="cmbx-10">argument.</span> -</p><!--l. 39--><p class="indent" > Examples: </p> +</p><!--l. 47--><p class="indent" > Examples: </p> <ul class="itemize1"> <li class="itemize"><span class="obeylines-h"><span class="verb"><span class="cmtt-10">\makefirstuc{abc}</span></span></span> produces Abc. + + + </li> <li class="itemize"><span class="obeylines-h"><span class="verb"><span class="cmtt-10">\makefirstuc{\emph{abc}}</span></span></span> produces <span class="cmti-10">Abc </span>(<span class="cmtt-10">\MakeUppercase</span><a - id="dx1-4"></a> has been applied to + id="dx1-2003"></a> has been applied to the letter “a” rather than <span class="cmtt-10">\emph</span>). Note however that @@ -219,7 +232,7 @@ class="cmtt-10">\emph</span>). Note however that <div class="verbatim" id="verbatim-1"> \makefirstuc{{\em abc}} </div> - <!--l. 48--><p class="nopar" > produces <span + <!--l. 56--><p class="nopar" > produces <span class="cmti-10">ABC </span>(first object is <span class="obeylines-h"><span class="verb"><span class="cmtt-10">{\em</span><span class="cmtt-10"> abc}</span></span></span> so equivalent to <span class="obeylines-h"><span class="verb"><span @@ -233,7 +246,7 @@ class="cmtt-10"> abc}</span></span></span>), <div class="verbatim" id="verbatim-2"> {\makefirstuc{\em abc}} </div> - <!--l. 53--><p class="nopar" > produces abc (<span class="obeylines-h"><span class="verb"><span + <!--l. 61--><p class="nopar" > produces abc (<span class="obeylines-h"><span class="verb"><span class="cmtt-10">\em</span></span></span> doesn’t have an argument therefore first object is <span class="obeylines-h"><span class="verb"><span class="cmtt-10">\em</span></span></span> and so is equivalent to <span class="obeylines-h"><span class="verb"><span @@ -254,19 +267,22 @@ class="cmtt-10">\makefirstuc{{</span><span class="cmtt-10">ä</span><span class="cmtt-10">}bc}</span></span></span> produces Äbc. </li></ul> -<!--l. 67--><p class="noindent" >Note that non-Latin or accented characters appearing at the start of the text must be +<!--l. 75--><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 class="cmss-10">inputenc</span><a - id="dx1-5"></a> package) due to expansion -issues. -</p><!--l. 71--><p class="indent" > <div class="important" title="Important Note"> In version 1.02 of <span + id="dx1-2004"></a> package). The reason for this +restriction is detailed in <a +href="#sec:utf8"><span +class="cmsy-10">§</span>3 </a><a +href="#sec:utf8">UTF-8<!--tex4ht:ref: sec:utf8 --></a>. +</p><!--l. 80--><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. 77--><p class="noindent" > -</p><!--l. 79--><p class="indent" > Note also that +</p><!--l. 86--><p class="noindent" > +</p><!--l. 88--><p class="indent" > Note also that @@ -275,7 +291,7 @@ class="cmtt-10">\makefirstuc{\ae{}bc}</span></span></span> produced æBc. H \newcommand{\abc}{abc}  <br />\makefirstuc{\abc} </div> -<!--l. 83--><p class="nopar" > produces: ABC. This is because the first object in the argument of <span +<!--l. 92--><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 @@ -288,24 +304,19 @@ class="cmtt-10">\MakeUppercase{\abc}</span></span></span>. Whereas: \newcommand{\abc}{abc}  <br />\expandafter\makefirstuc\expandafter{\abc} </div> -<!--l. 90--><p class="nopar" > produces: Abc. There is a short cut command which will do this: -</p><!--l. 92--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +<!--l. 99--><p class="nopar" > produces: Abc. There is a short cut command which will do this: +</p><!--l. 101--><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-6"></a> <span -class="cmtt-10">\xmakefirstuc{</span><span -class="cmmi-10"><</span><span -class="cmitt-10">stuff</span><span -class="cmmi-10">></span><span + id="dx1-2005"></a> <span +class="cmtt-10">\xmakefirstuc{</span>⟨<span +class="cmitt-10">stuff</span>⟩<span class="cmtt-10">} </span></div><hr> -</p><!--l. 94--><p class="noindent" > +</p><!--l. 103--><p class="noindent" > This is equivalent to <span -class="cmtt-10">\expandafter\makefirstuc\expandafter{</span><span -class="cmmi-10"><</span><span -class="cmti-10">stuff</span><span -class="cmmi-10">></span><span -class="cmtt-10">}</span>. -So +class="cmtt-10">\expandafter\makefirstuc\expandafter{</span>⟨<span +class="cmti-10">stuff </span>⟩<span +class="cmtt-10">}</span>. So @@ -314,40 +325,38 @@ So \newcommand{\abc}{abc}  <br />\xmakefirstuc{\abc} </div> -<!--l. 99--><p class="nopar" > produces: Abc. -</p><!--l. 104--><p class="indent" > <div class="important" title="Important Note"> <span +<!--l. 108--><p class="nopar" > produces: Abc. +</p><!--l. 113--><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. 108--><p class="noindent" > -</p><!--l. 110--><p class="indent" > If you use <span +</p><!--l. 117--><p class="noindent" > +</p><!--l. 119--><p class="indent" > If you use <span class="cmss-10">mfirstuc </span>without the <span class="cmss-10">glossaries</span><a - id="dx1-7"></a> package, the standard <span + id="dx1-2006"></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-8"></a>, <span + id="dx1-2007"></a>, <span class="cmtt-10">\MakeTextUppercase</span><a - id="dx1-9"></a> (defined by <span + id="dx1-2008"></a> (defined by <span class="cmss-10">textcase</span><a - id="dx1-10"></a> the + id="dx1-2009"></a> the 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-11"></a> instead, you can redefine -</p><!--l. 116--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span + id="dx1-2010"></a> instead, you can redefine +</p><!--l. 125--><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-12"></a> <span -class="cmtt-10">\glsmakefirstuc{</span><span -class="cmmi-10"><</span><span -class="cmitt-10">text</span><span -class="cmmi-10">></span><span + id="dx1-2011"></a> <span +class="cmtt-10">\glsmakefirstuc{</span>⟨<span +class="cmitt-10">text</span>⟩<span class="cmtt-10">} </span></div><hr> -</p><!--l. 118--><p class="noindent" > +</p><!--l. 127--><p class="noindent" > For example: @@ -356,57 +365,52 @@ For example: <div class="verbatim" id="verbatim-6"> \renewcommand{\glsmakefirstuc}[1]{\MakeTextUppercase #1} </div> -<!--l. 122--><p class="nopar" > Remember to also load <span +<!--l. 131--><p class="nopar" > Remember to also load <span class="cmss-10">textcase</span><a - id="dx1-13"></a> (<span + id="dx1-2012"></a> (<span class="cmss-10">glossaries </span>loads this automatically). -</p><!--l. 126--><p class="indent" > New to mfirstuc v1.06: -</p><!--l. 127--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +</p><!--l. 135--><p class="noindent" > +</p> +<!--l. 135--><p class="noindent" ><a +href="#top">Top</a><h2 class="sectionHead"></p><h3 class="sectionHead"><span class="titlemark">2 </span> <a + id="sec:capitalisewords"></a>Capitalise Each Word in a Phrase or Sentence (Title Case)</h3> +<!--l. 138--><p class="noindent" >New to mfirstuc v1.06: +</p><!--l. 139--><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-14"></a> <span -class="cmtt-10">\capitalisewords{</span><span -class="cmmi-10"><</span><span -class="cmitt-10">text</span><span -class="cmmi-10">></span><span + id="dx1-3001"></a> <span +class="cmtt-10">\capitalisewords{</span>⟨<span +class="cmitt-10">text</span>⟩<span class="cmtt-10">} </span></div><hr> -</p><!--l. 129--><p class="noindent" > +</p><!--l. 141--><p class="noindent" > This command apply <span class="cmtt-10">\makefirstuc</span><a - id="dx1-15"></a> to each word in <span -class="cmmi-10"><</span><span -class="cmti-10">text</span><span -class="cmmi-10">> </span>where the space character -is used as the word separator. Note that it has to be a plain space character, not -another form of space, such as <span class="obeylines-h"><span class="verb"><span + id="dx1-3002"></a> to each word in ⟨<span +class="cmti-10">text</span>⟩ where the space character is +used as the word separator. Note that it has to be a plain space character, not another +form of space, such as <span class="obeylines-h"><span class="verb"><span class="cmtt-10">~</span></span></span> or <span class="cmtt-10">\space</span>. Note that no expansion is performed on -<span -class="cmmi-10"><</span><span -class="cmti-10">text</span><span -class="cmmi-10">></span>. -</p><!--l. 136--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +⟨<span +class="cmti-10">text</span>⟩. +</p><!--l. 148--><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-16"></a> <span -class="cmtt-10">\xcapitalisewords{</span><span -class="cmmi-10"><</span><span -class="cmitt-10">text</span><span -class="cmmi-10">></span><span + id="dx1-3003"></a> <span +class="cmtt-10">\xcapitalisewords{</span>⟨<span +class="cmitt-10">text</span>⟩<span class="cmtt-10">} </span></div><hr> -</p><!--l. 138--><p class="noindent" > +</p><!--l. 150--><p class="noindent" > This is a short cut for <span -class="cmtt-10">\expandafter\capitalisewords\expandafter{</span><span -class="cmmi-10"><</span><span -class="cmti-10">text</span><span -class="cmmi-10">></span><span +class="cmtt-10">\expandafter\capitalisewords\expandafter{</span>⟨<span +class="cmti-10">text</span>⟩<span class="cmtt-10">}</span>. -</p><!--l. 142--><p class="indent" > <div class="important" title="Important Note"> If you are using <span +</p><!--l. 154--><p class="indent" > <div class="important" title="Important Note"> If you are using <span class="cmss-10">hyperref</span><a - id="dx1-17"></a> and want to use <span + id="dx1-3004"></a> and want to use <span class="cmtt-10">\capitalisewords </span>or <span class="cmtt-10">\makefirstuc</span><a - id="dx1-18"></a> (or + id="dx1-3005"></a> (or <span class="cmtt-10">\xcapitalisewords</span>/<span class="cmtt-10">\xmakefirstuc</span>) in a section heading, the PDF bookmarks won’t @@ -421,40 +425,40 @@ Package hyperref Warning: Token not allowed&#  <br />(PDFDocEncoding):  <br />(hyperref)                removing ‘\capitalisewords’ </div> -<!--l. 151--><p class="nopar" > If you want to provide an alternative for the PDF bookmark, you can use +<!--l. 163--><p class="nopar" > If you want to provide an alternative for the PDF bookmark, you can use <span class="cmss-10">hyperref</span><a - id="dx1-19"></a>’s <span + id="dx1-3006"></a>’s <span class="cmtt-10">\texorpdfstring</span><a - id="dx1-20"></a> command. See the <span + id="dx1-3007"></a> command. See the <span class="cmss-10">hyperref</span><a - id="dx1-21"></a> manual for further details. + id="dx1-3008"></a> manual for further details. </div> -</p><!--l. 155--><p class="noindent" > -</p><!--l. 157--><p class="indent" > Examples: +</p><!--l. 167--><p class="noindent" > +</p><!--l. 169--><p class="indent" > Examples: </p><ol class="enumerate1" > <li - class="enumerate" id="x1-23x1"> + class="enumerate" id="x1-3010x1"> <div class="verbatim" id="verbatim-8"> \capitalisewords{a book of rhyme.} </div> - <!--l. 162--><p class="nopar" > produces: A Book Of Rhyme. + <!--l. 174--><p class="nopar" > produces: A Book Of Rhyme. </p></li> <li - class="enumerate" id="x1-25x2"> + class="enumerate" id="x1-3012x2"> <div class="verbatim" id="verbatim-9"> \capitalisewords{a book\space of rhyme.} </div> - <!--l. 169--><p class="nopar" > produces: A Book of Rhyme. + <!--l. 181--><p class="nopar" > produces: A Book of Rhyme. </p></li> <li - class="enumerate" id="x1-27x3"> + class="enumerate" id="x1-3014x3"> @@ -462,15 +466,13 @@ class="cmss-10">hyperref</span><a \newcommand{\mytitle}{a book\space of rhyme.}  <br />\capitalisewords{\mytitle} </div> - <!--l. 177--><p class="nopar" > produces: A BOOK OF RHYME. (No expansion is performed on <span + <!--l. 189--><p class="nopar" > produces: A BOOK OF RHYME. (No expansion is performed on <span class="cmtt-10">\mytitle</span>, so - <span -class="cmmi-10"><</span><span -class="cmti-10">text</span><span -class="cmmi-10">> </span>consists of just one “word”.) Compare with next example: + ⟨<span +class="cmti-10">text</span>⟩ consists of just one “word”.) Compare with next example: </p></li> <li - class="enumerate" id="x1-29x4"> + class="enumerate" id="x1-3016x4"> @@ -478,36 +480,30 @@ class="cmmi-10">> </span>consists of just one “word”.) Compar \newcommand{\mytitle}{a book\space of rhyme.}  <br />\xcapitalisewords{\mytitle} </div> - <!--l. 188--><p class="nopar" > produces: A Book of Rhyme. + <!--l. 200--><p class="nopar" > produces: A Book of Rhyme. </p> </li></ol> -<!--l. 194--><p class="indent" > As from v1.09, you can specify words which shouldn’t be capitalised unless they -occur at the start of <span -class="cmmi-10"><</span><span -class="cmti-10">text</span><span -class="cmmi-10">> </span>using: -</p><!--l. 196--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +<!--l. 206--><p class="indent" > 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. 208--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="cmtt-9">\ttfamily</span><span class="cmtt-9"> </span></span><a - id="dx1-30"></a><span -class="cmtt-10">\MFUnocap{</span><span -class="cmmi-10"><</span><span -class="cmti-10">word</span><span -class="cmmi-10">></span><span + id="dx1-3017"></a><span +class="cmtt-10">\MFUnocap{</span>⟨<span +class="cmti-10">word</span>⟩<span class="cmtt-10">} </span></div><hr> -</p><!--l. 198--><p class="noindent" > +</p><!--l. 210--><p class="noindent" > This only has a local effect. The global version is: -</p><!--l. 200--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +</p><!--l. 212--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span class="cmtt-9">\ttfamily</span><span class="cmtt-9"> </span></span><a - id="dx1-31"></a><span -class="cmtt-10">\gMFUnocap{</span><span -class="cmmi-10"><</span><span -class="cmti-10">word</span><span -class="cmmi-10">></span><span + id="dx1-3018"></a><span +class="cmtt-10">\gMFUnocap{</span>⟨<span +class="cmti-10">word</span>⟩<span class="cmtt-10">} </span></div><hr> -</p><!--l. 202--><p class="noindent" > -</p><!--l. 204--><p class="indent" > For example: +</p><!--l. 214--><p class="noindent" > +</p><!--l. 216--><p class="indent" > For example: @@ -518,28 +514,28 @@ class="cmtt-10">} </span></div><hr>  <br />\MFUnocap{the}%  <br />\capitalisewords{the wind in the willows} </div> -<!--l. 212--><p class="nopar" > produces: <spacer type=vertical size=10><span class="obeylines-h"> +<!--l. 224--><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. 223--><p class="indent" > <hr><div title="Definition"><span class="marginpar"><span +</p><!--l. 235--><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-32"></a> <span + id="dx1-3019"></a> <span class="cmtt-10">\MFUclear </span></div><hr> -</p><!--l. 225--><p class="noindent" > -</p><!--l. 227--><p class="indent" > The package <span +</p><!--l. 237--><p class="noindent" > +</p><!--l. 239--><p class="indent" > The package <span class="cmss-10">mfirstuc-english</span><a - id="dx1-33"></a> loads <span + id="dx1-3020"></a> loads <span class="cmss-10">mfirstuc</span><a - id="dx1-34"></a> and uses <span + id="dx1-3021"></a> and uses <span class="cmtt-10">\MFUnocap </span>to add common English articles and conjunctions, such as “a”, “an”, “and”, “but”. You may want 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. 234--><p class="indent" > If you want to write a similar package for another language, all you need to do is +</p><!--l. 246--><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 @@ -549,7 +545,7 @@ class="cmtt-10">.sty </span>that starts with <div class="verbatim" id="verbatim-13"> \NeedsTeXFormat{LaTeX2e} </div> -<!--l. 239--><p class="nopar" > The next line should identify the package. For example, if you have called the file +<!--l. 251--><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: @@ -559,7 +555,7 @@ class="cmtt-10">mfirstuc-french.sty </span>then you need: <div class="verbatim" id="verbatim-14"> \ProvidesPackage{mfirstuc-french} </div> -<!--l. 244--><p class="nopar" > It’s a good idea to also add a version in the final optional argument, for example: +<!--l. 256--><p class="nopar" > It’s a good idea to also add a version in the final optional argument, for example: @@ -567,9 +563,9 @@ class="cmtt-10">mfirstuc-french.sty </span>then you need: <div class="verbatim" id="verbatim-15"> \ProvidesPackage{mfirstuc-french}[2014/07/30 v1.0] </div> -<!--l. 249--><p class="nopar" > Next load <span +<!--l. 261--><p class="nopar" > Next load <span class="cmss-10">mfirstuc</span><a - id="dx1-35"></a>: + id="dx1-3022"></a>: @@ -577,7 +573,7 @@ class="cmss-10">mfirstuc</span><a <div class="verbatim" id="verbatim-16"> \RequirePackage{mfirstuc} </div> -<!--l. 253--><p class="nopar" > Now add all your <span +<!--l. 265--><p class="nopar" > Now add all your <span class="cmtt-10">\MFUnocap </span>commands. For example: @@ -586,7 +582,7 @@ class="cmtt-10">\MFUnocap </span>commands. For example: <div class="verbatim" id="verbatim-17"> \MFUnocap{de} </div> -<!--l. 257--><p class="nopar" > At the end of the file add: +<!--l. 269--><p class="nopar" > At the end of the file add: @@ -594,11 +590,214 @@ class="cmtt-10">\MFUnocap </span>commands. For example: <div class="verbatim" id="verbatim-18"> \endinput </div> -<!--l. 261--><p class="nopar" > -</p><!--l. 263--><p class="indent" > Put the file somewhere on <span class="TEX">T<span +<!--l. 273--><p class="nopar" > +</p><!--l. 275--><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 uploading it to CTAN in case other users find it useful. +</p><!--l. 279--><p class="noindent" > +</p> +<!--l. 279--><p class="noindent" ><a +href="#top">Top</a><h2 class="sectionHead"></p><h3 class="sectionHead"><span class="titlemark">3 </span> <a + id="sec:utf8"></a>UTF-8</h3> +<!--l. 282--><p class="noindent" >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 why you can do, say, <span class="obeylines-h"><span class="verb"><span +class="cmtt-10">\frac12</span></span></span> instead of <span class="obeylines-h"><span class="verb"><span +class="cmtt-10">\frac{1}{2}</span></span></span> or <span class="obeylines-h"><span class="verb"><span +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. 289--><p class="indent" > A simplistic version of the <span +class="cmtt-10">\makefirstuc </span>command is: + + + +</p> + <div class="verbatim" id="verbatim-19"> +\newcommand*{\FirstUC}[1]{\MakeUppercase #1} +</div> +<!--l. 292--><p class="nopar" > Here <span class="obeylines-h"><span class="verb"><span +class="cmtt-10">\FirstUC{abc}</span></span></span> is equivalent to <span class="obeylines-h"><span class="verb"><span +class="cmtt-10">\MakeUppercase</span><span +class="cmtt-10"> abc</span></span></span> 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. 298--><p class="indent" > The <span +class="cmss-10">glossaries</span><a + id="dx1-4001"></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 +class="cmtt-10">\acronymfont</span>, so +<span +class="cmtt-10">\makefirstuc </span>has to be more complicated than the trivial <span +class="cmtt-10">\FirstUC </span>shown above, but +at its basic level, <span +class="cmtt-10">\makefirstuc </span>uses this same method and is the reason why, +in most cases, you don’t need to enclose the first character in braces. So if +<span class="obeylines-h"><span class="verb"><span +class="cmtt-10">\MakeUppercase</span><span +class="cmtt-10"> </span></span></span>⟨<span +class="cmti-10">stuff </span>⟩ works, then <span class="obeylines-h"><span class="verb"><span +class="cmtt-10">\makefirstuc</span></span></span><span +class="cmtt-10">{</span>⟨<span +class="cmti-10">stuff </span>⟩<span +class="cmtt-10">} </span>should also work and so +should <span class="obeylines-h"><span class="verb"><span +class="cmtt-10">\makefirstuc{\foo</span></span></span><span +class="cmtt-10">{</span>⟨<span +class="cmti-10">stuff </span>⟩<span +class="cmtt-10">}</span><span class="obeylines-h"><span class="verb"><span +class="cmtt-10">}</span></span></span>, but if <span class="obeylines-h"><span class="verb"><span +class="cmtt-10">\MakeUppercase</span><span +class="cmtt-10"> </span></span></span>⟨<span +class="cmti-10">stuff </span>⟩ doesn’t work, then +neither will <span class="obeylines-h"><span class="verb"><span +class="cmtt-10">\makefirstuc</span></span></span><span +class="cmtt-10">{</span>⟨<span +class="cmti-10">stuff </span>⟩<span +class="cmtt-10">} </span>(or <span class="obeylines-h"><span class="verb"><span +class="cmtt-10">\makefirstuc{\foo</span></span></span><span +class="cmtt-10">{</span>⟨<span +class="cmti-10">stuff </span>⟩<span +class="cmtt-10">}</span><span class="obeylines-h"><span class="verb"><span +class="cmtt-10">}</span></span></span>). +</p><!--l. 311--><p class="indent" > Try the following document: </p><div class="alltt"> +<div class="obeylines-v"> +<span +class="cmtt-10">\documentclass</span><span +class="cmsy-10">{</span><span +class="cmtt-10">article</span><span +class="cmsy-10">}</span> +<br /> +<br /><span +class="cmtt-10">\usepackage[utf8]</span><span +class="cmsy-10">{</span><span +class="cmtt-10">inputenc</span><span +class="cmsy-10">}</span> +<br /><span +class="cmtt-10">\usepackage[T1]</span><span +class="cmsy-10">{</span><span +class="cmtt-10">fontenc</span><span +class="cmsy-10">}</span> +<br /> +<br /><span +class="cmtt-10">\begin</span><span +class="cmsy-10">{</span><span +class="cmtt-10">document</span><span +class="cmsy-10">}</span> +<br /> +<br /><span +class="cmtt-10">\MakeUppercase</span><span +class="cmtt-10"> </span><span +class="cmtt-10">ã</span><span +class="cmtt-10">bc</span> +<br /> +<br /><span +class="cmtt-10">\end</span><span +class="cmsy-10">{</span><span +class="cmtt-10">document</span><span +class="cmsy-10">}</span> +</div> +</div> +<!--l. 325--><p class="indent" > This will result in the error: + + + +</p> + <div class="verbatim" id="verbatim-20"> +! Argument of \UTFviii@two@octets has an extra }. +</div> +<!--l. 328--><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 +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. 333--><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 +class="E">E</span>X</span>’s point of view it’s <span +class="cmti-10">two </span>tokens. So </p><div class="alltt"> +<div class="obeylines-v"> +<span +class="cmtt-10">\MakeUppercase</span><span +class="cmtt-10"> </span><span +class="cmtt-10">ã</span><span +class="cmtt-10">bc</span> +</div> +</div> tries to apply <span +class="cmtt-10">\MakeUppercase </span>to just the first octet of ã. This means that the second +octet has been separated from the first octet, which is the cause of the error. In this +case the argument isn’t a single token, so the two tokens (the first and second octet of +ã) must be grouped: <div class="alltt"> +<div class="obeylines-v"> +<span +class="cmtt-10">\MakeUppercase</span><span +class="cmsy-10">{</span><span +class="cmtt-10">ã</span><span +class="cmsy-10">}</span><span +class="cmtt-10">bc</span> +</div> +</div> +<!--l. 349--><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"> +<div class="obeylines-v"> +<span +class="cmtt-10">\documentclass</span><span +class="cmsy-10">{</span><span +class="cmtt-10">article</span><span +class="cmsy-10">}</span> +<br /> +<br /><span +class="cmtt-10">\usepackage</span><span +class="cmsy-10">{</span><span +class="cmtt-10">fontspec</span><span +class="cmsy-10">}</span> +<br /> +<br /><span +class="cmtt-10">\begin</span><span +class="cmsy-10">{</span><span +class="cmtt-10">document</span><span +class="cmsy-10">}</span> +<br /> +<br /><span +class="cmtt-10">\MakeUppercase</span><span +class="cmtt-10"> </span><span +class="cmtt-10">ã</span><span +class="cmtt-10">bc</span> +<br /> +<br /><span +class="cmtt-10">\end</span><span +class="cmsy-10">{</span><span +class="cmtt-10">document</span><span +class="cmsy-10">}</span> +</div> +</div> + + + +<!--l. 365--><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 +class="cmtt-10">bc</span><span class="obeylines-h"><span class="verb"><span +class="cmtt-10">}</span></span></span> will work <span +class="cmti-10">provided you use XeLaTeX</span><span +class="cmti-10"> and the </span><span +class="cmssi-10">fontspec</span><a + id="dx1-4002"></a> +<span +class="cmti-10">package</span>. </p> </body></html> |