diff options
author | Karl Berry <karl@freefriends.org> | 2015-09-10 20:59:49 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-09-10 20:59:49 +0000 |
commit | 33a4150d1da52eedaebb96c4693913b8b024c8de (patch) | |
tree | d7721b82a2d8bdd222900c9e6b23e391e889a115 /Master/texmf-dist/doc | |
parent | 09eacca54ff83c24b65dc6f2472666febb9a15cc (diff) |
mfirstuc (9sep15)
git-svn-id: svn://tug.org/texlive/trunk@38343 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc')
-rw-r--r-- | Master/texmf-dist/doc/latex/mfirstuc/CHANGES | 60 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/mfirstuc/README | 41 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-code.pdf | bin | 0 -> 220571 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-manual.html | 944 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-manual.pdf | bin | 0 -> 223024 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-manual.tex | 475 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/mfirstuc/sample-mfirstuc.pdf | bin | 0 -> 25848 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/mfirstuc/sample-mfirstuc.tex | 40 |
8 files changed, 1560 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/mfirstuc/CHANGES b/Master/texmf-dist/doc/latex/mfirstuc/CHANGES new file mode 100644 index 00000000000..277d9033b7d --- /dev/null +++ b/Master/texmf-dist/doc/latex/mfirstuc/CHANGES @@ -0,0 +1,60 @@ +mfirstuc change log: + +v1.11 + + * Split from glossaries bundle. + + * Fixed bug the occurred when the first two tokens of + \makefirstuc are both control sequences. + +v1.10: + + * added \ecapitalisewords, \emakefirstuc + +v1.09: + + * Added \MFUnocap + + * New package: mfirstuc-english.sty + +v1.08: + + * Made \makefirstuc and \capitalisewords robust + +v1.07: + + * Added \mfirstucMakeUppercase to allow the user to switch from + \MakeUppercase to another case changing command. + +v1.06: + + * added \capitalisewords, \xcapitalisewords + +v1.05: + + * added \glsmakefirstuc (replaces \@gls@makefirstuc) to make + it easier to customise. + +v1.04: + + * fixed bug occurring when initial control sequence + in the argument of \makefirstuc has more than one + argument. + +v1.02: + + * Fixed bug that transfered grouping, (e.g + \makefirstuc{\emph{abc}xyz} moved the xyz into the \emph) + + * If group following initial command is empty, \MakeUppercase + is applied to the command, e.g. \makefirstuc{\ae{}bc} now + produces \MakeUppercase\ae{}bc. + +v1.01: + + * Added \xmakefirstuc (expands argument before applying \makefirstuc) + +v1.0: + + * Initial version + diff --git a/Master/texmf-dist/doc/latex/mfirstuc/README b/Master/texmf-dist/doc/latex/mfirstuc/README new file mode 100644 index 00000000000..eee6e3d6343 --- /dev/null +++ b/Master/texmf-dist/doc/latex/mfirstuc/README @@ -0,0 +1,41 @@ +LaTeX Package : mfirstuc v2.0 + +Last Modified : 2015-09-09 + +Author : Nicola Talbot + +This package provides \makefirstuc{<stuff>} which makes the first object of +<stuff> upper case unless <stuff> starts with a control +sequence followed by a non-empty group, in which case the first +object in the group is converted to upper case. Examples: + + \makefirstuc{abc} -> Abc + \makefirstuc{\emph{abc}} -> \emph{Abc} + \makefirstuc{{\'a}bc} -> \'Abc + \makefirstuc{\ae bc} -> \AE bc + \makefirstuc{{\ae}bc} -> \AE bc + \makefirstuc{\ae{}bc} -> \AE{}bc + +The package also provides \capitalisewords{<phrase>} which applies +\makefirstuc to each word in the <phrase>, where the words are +separated by regular spaces. (Exceptions can be made for words that +shouldn't be converted.) + +The mfirstuc package was originally bundled with the glossaries +package. + +LaTeX2HTML + +This package comes with a LaTeX2HTML style file mfirstuc.perl which +should be placed in the relevant LaTeX2HTML styles directory, but +note that some commands may not be implemented or may be implemented +in a different way. + +LICENCE + +This material is subject to the LaTeX Project Public License. +See http://www.ctan.org/license/lppl1.3 +for the details of that license. + +Author's home page: http://www.dickimaw-books.com/ + diff --git a/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-code.pdf b/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-code.pdf Binary files differnew file mode 100644 index 00000000000..3bf567fe659 --- /dev/null +++ b/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-code.pdf diff --git a/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-manual.html b/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-manual.html new file mode 100644 index 00000000000..8d30a8f8844 --- /dev/null +++ b/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-manual.html @@ -0,0 +1,944 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<!--http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd--> +<html xmlns="http://www.w3.org/1999/xhtml" +> +<head><title>mfirstuc.sty v2.0: uppercasing first letter</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<meta name="generator" content="TeX4ht (http://www.tug.org/tex4ht/)" /> +<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="2015-09-09 15:55:00" /> + +<style type="text/css"> +<!-- + +/* start css.sty */ +.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;} +.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; } +p.indent{ text-indent: 1.5em } +@media print {div.crosslinks {visibility:hidden;}} +a img { border-top: 0; border-left: 0; border-right: 0; } +center { margin-top:1em; margin-bottom:1em; } +td center { margin-top:0em; margin-bottom:0em; } +.Canvas { position:relative; } +img.math{vertical-align:middle;} +li p.indent { text-indent: 0em } +li p:first-child{ margin-top:0em; } +li p:last-child, li div:last-child { margin-bottom:0.5em; } +li p~ul:last-child, li p~ol:last-child{ margin-bottom:0.5em; } +.enumerate1 {list-style-type:decimal;} +.enumerate2 {list-style-type:lower-alpha;} +.enumerate3 {list-style-type:lower-roman;} +.enumerate4 {list-style-type:upper-alpha;} +div.newtheorem { margin-bottom: 2em; margin-top: 2em;} +.obeylines-h,.obeylines-v {white-space: nowrap; } +div.obeylines-v p { margin-top:0; margin-bottom:0; } +.overline{ text-decoration:overline; } +.overline img{ border-top: 1px solid black; } +td.displaylines {text-align:center; white-space:nowrap;} +.centerline {text-align:center;} +.rightline {text-align:right;} +div.verbatim {font-family: monospace; white-space: nowrap; text-align:left; clear:both; } +.fbox {padding-left:3.0pt; padding-right:3.0pt; text-indent:0pt; border:solid black 0.4pt; } +div.fbox {display:table} +div.center div.fbox {text-align:center; clear:both; padding-left:3.0pt; padding-right:3.0pt; text-indent:0pt; border:solid black 0.4pt; } +div.minipage{width:100%;} +div.center, div.center div.center {text-align: center; margin-left:1em; margin-right:1em;} +div.center div {text-align: left;} +div.flushright, div.flushright div.flushright {text-align: right;} +div.flushright div {text-align: left;} +div.flushleft {text-align: left;} +.underline{ text-decoration:underline; } +.underline img{ border-bottom: 1px solid black; margin-bottom:1pt; } +.framebox-c, .framebox-l, .framebox-r { padding-left:3.0pt; padding-right:3.0pt; text-indent:0pt; border:solid black 0.4pt; } +.framebox-c {text-align:center;} +.framebox-l {text-align:left;} +.framebox-r {text-align:right;} +span.thank-mark{ vertical-align: super } +span.footnote-mark sup.textsuperscript, span.footnote-mark a sup.textsuperscript{ font-size:80%; } +div.footnotes{border-top:solid 1px black; border-bottom:solid 1px black; padding-bottom:1ex; padding-top:0.5ex; margin-right:15%; margin-top:2ex; font-style:italic; font-size:85%;} +div.footnotes p{margin-top:0; margin-bottom:0; text-indent:0;} +div.tabular, div.center div.tabular {text-align: center; margin-top:0.5em; margin-bottom:0.5em; } +table.tabular td p{margin-top:0em;} +table.tabular {margin-left: auto; margin-right: auto;} +td p:first-child{ margin-top:0em; } +td p:last-child{ margin-bottom:0em; } +div.td00{ margin-left:0pt; margin-right:0pt; } +div.td01{ margin-left:0pt; margin-right:5pt; } +div.td10{ margin-left:5pt; margin-right:0pt; } +div.td11{ margin-left:5pt; margin-right:5pt; } +table[rules] {border-left:solid black 0.4pt; border-right:solid black 0.4pt; } +td.td00{ padding-left:0pt; padding-right:0pt; } +td.td01{ padding-left:0pt; padding-right:5pt; } +td.td10{ padding-left:5pt; padding-right:0pt; } +td.td11{ padding-left:5pt; padding-right:5pt; } +table[rules] {border-left:solid black 0.4pt; border-right:solid black 0.4pt; } +.hline hr, .cline hr{ height : 1px; margin:0px; } +.tabbing-right {text-align:right;} +span.TEX {letter-spacing: -0.125em; } +span.TEX span.E{ position:relative;top:0.5ex;left:-0.0417em;} +a span.TEX span.E {text-decoration: none; } +span.LATEX span.A{ position:relative; top:-0.5ex; left:-0.4em; font-size:85%;} +span.LATEX span.TEX{ position:relative; left: -0.4em; } +div.float, div.figure {margin-left: auto; margin-right: auto;} +div.float img {text-align:center;} +div.figure img {text-align:center;} +.marginpar {width:20%; float:right; text-align:left; margin-left:auto; margin-top:0.5em; font-size:85%; text-decoration:underline;} +.marginpar p{margin-top:0.4em; margin-bottom:0.4em;} +table.equation {width:100%;} +.equation td{text-align:center; } +td.equation { margin-top:1em; margin-bottom:1em; } +td.equation-label { width:5%; text-align:center; } +td.eqnarray4 { width:5%; white-space: normal; } +td.eqnarray2 { width:5%; } +table.eqnarray-star, table.eqnarray {width:100%;} +div.eqnarray{text-align:center;} +div.array {text-align:center;} +div.pmatrix {text-align:center;} +table.pmatrix {width:100%;} +span.pmatrix img{vertical-align:middle;} +div.pmatrix {text-align:center;} +table.pmatrix {width:100%;} +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%;} +.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; } +h1.partHead{text-align: center} +p.bibitem { text-indent: -2em; margin-left: 2em; margin-top:0.6em; margin-bottom:0.6em; } +p.bibitem-p { text-indent: 0em; margin-left: 2em; margin-top:0.6em; margin-bottom:0.6em; } +.paragraphHead, .likeparagraphHead { margin-top:2em; font-weight: bold;} +.subparagraphHead, .likesubparagraphHead { font-weight: bold;} +.quote {margin-bottom:0.25em; margin-top:0.25em; margin-left:1em; margin-right:1em; text-align:justify;} +.verse{white-space:nowrap; margin-left:2em} +div.maketitle {text-align:center;} +h2.titleHead{text-align:center;} +div.maketitle{ margin-bottom: 2em; } +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; } +.abstract p {margin-left:5%; margin-right:5%;} +div.abstract {width:100%;} +.alltt P { margin-bottom : 0em; margin-top : 0em; } +.alltt { margin-bottom : 1em; margin-top : 1em; } +div.important { border : solid red; } +div.verbatim { font-family: monospace; white-space: nowrap; text-align:left; clear:both; padding-top: 2ex; padding-bottom: 2ex;} +/* end css.sty */ + + +--> +</style> +</head><body +> + <div class="maketitle"><a + id="top"></a> + + + + + + + +<h2 class="titleHead">mfirstuc.sty v2.0: uppercasing first letter</h2> + <div class="author" ><span +class="cmr-12">Nicola L.C. Talbot</span> +<br /> <span +class="cmr-12">Dickimaw Books</span> +<br /><a +href="http://www.dickimaw-books.com/" class="url" ><span +class="cmtt-12">http://www.dickimaw-books.com/</span></a></div><br /> +<div class="date" ><span +class="cmr-12">2015-09-09</span></div> + </div> + <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:makefirstuc" id="QQ2-1-3">Capitalising a Word</a></span> +<br /> <span class="sectionToc" >3 <a +href="#sec:capitalisewords" id="QQ2-1-4">Capitalise Each Word in a Phrase or Sentence (Title Case)</a></span> +<br /> <span class="sectionToc" >4 <a +href="#sec:utf8" id="QQ2-1-5">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">mfirstuc </span>package was originally part of the <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. +</p><!--l. 42--><p class="noindent" > +</p> +<!--l. 42--><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 a Word</h3> +<!--l. 45--><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, + + + +</p> + <div class="verbatim" id="verbatim-1"> +\MakeUppercase word +</div> +<!--l. 49--><p class="nopar" > but for commands like <span +class="cmtt-10">\Gls </span>the word may be embedded within the argument of +another command, such as a font changing command. This makes things more +complicated for a general purpose solution, so the <span +class="cmss-10">mfirstuc </span>package provides: +</p><!--l. 54--><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-3001"></a> <span +class="cmtt-10">\makefirstuc{</span>⟨<span +class="cmitt-10">stuff</span>⟩<span +class="cmtt-10">} </span></div><hr> +</p><!--l. 56--><p class="noindent" > +This makes the first object of ⟨<span +class="cmti-10">stuff </span>⟩ upper case 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 upper case. <span +class="cmbx-10">No expansion is performed on the</span> +<span +class="cmbx-10">argument.</span> +</p><!--l. 63--><p class="indent" > <div class="important" title="Important Note"> If ⟨<span +class="cmti-10">stuff </span>⟩ starts with a control sequence that takes more than one argument, the +case-changing will always be applied to the <span +class="cmti-10">first </span>argument. If the text that requires the +case change is in one of the other arguments, you must hide the earlier arguments in a +wrapper command. For example, instead of <span class="obeylines-h"><span class="verb"><span +class="cmtt-10">\color{red}{text}</span></span></span> you need to define, +say, <span class="obeylines-h"><span class="verb"><span +class="cmtt-10">\red</span></span></span> as <span class="obeylines-h"><span class="verb"><span +class="cmtt-10">\color{red}</span></span></span> and use <span class="obeylines-h"><span class="verb"><span +class="cmtt-10">\red{text}</span></span></span>. </div> +</p><!--l. 71--><p class="noindent" > +</p><!--l. 73--><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-3002"></a> has been applied to + the letter “a” rather than <span +class="cmtt-10">\emph</span>). Note however that + + + + <div class="verbatim" id="verbatim-2"> + \makefirstuc{{\em abc}} +</div> + <!--l. 82--><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 this is equivalent to + <span class="obeylines-h"><span class="verb"><span +class="cmtt-10">\MakeUppercase{\em</span><span +class="cmtt-10"> abc}</span></span></span>), and + + + +</p> + <div class="verbatim" id="verbatim-3"> + {\makefirstuc{\em abc}} +</div> + <!--l. 87--><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 +class="cmtt-10">{\MakeUppercase{\em}abc}</span></span></span>). + </p></li> + <li class="itemize"><span class="obeylines-h"><span class="verb"><span +class="cmtt-10">\makefirstuc{{\’a}bc}</span></span></span> produces Ábc. + </li> + <li class="itemize"><span class="obeylines-h"><span class="verb"><span +class="cmtt-10">\makefirstuc{\ae</span><span +class="cmtt-10"> bc}</span></span></span> produces Æbc. + </li> + <li class="itemize"><span class="obeylines-h"><span class="verb"><span +class="cmtt-10">\makefirstuc{{\ae}bc}</span></span></span> produces Æbc. + </li> + <li class="itemize"><span class="obeylines-h"><span class="verb"><span +class="cmtt-10">\makefirstuc{{</span><span +class="cmtt-10">ä</span><span +class="cmtt-10">}bc}</span></span></span> produces Äbc. + </li></ul> +<!--l. 101--><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-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. 106--><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. 112--><p class="noindent" > +</p><!--l. 114--><p class="indent" > Note also that + + + +</p> + <div class="verbatim" id="verbatim-4"> +\newcommand{\abc}{abc} + <br />\makefirstuc{\abc} +</div> +<!--l. 118--><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 +class="cmtt-10">\MakeUppercase{\abc}</span></span></span>. Whereas: + + + +</p> + <div class="verbatim" id="verbatim-5"> +\newcommand{\abc}{abc} + <br />\expandafter\makefirstuc\expandafter{\abc} +</div> +<!--l. 125--><p class="nopar" > produces: Abc. There is a short cut command which will do this: +</p><!--l. 127--><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 +class="cmtt-10">\xmakefirstuc{</span>⟨<span +class="cmitt-10">stuff</span>⟩<span +class="cmtt-10">} </span></div><hr> +</p><!--l. 129--><p class="noindent" > +This is equivalent to <span +class="cmtt-10">\expandafter\makefirstuc\expandafter{</span>⟨<span +class="cmti-10">stuff </span>⟩<span +class="cmtt-10">}</span>. So + + + +</p> + <div class="verbatim" id="verbatim-6"> +\newcommand{\abc}{abc} + <br />\xmakefirstuc{\abc} +</div> +<!--l. 134--><p class="nopar" > produces: Abc. +</p><!--l. 139--><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. 143--><p class="noindent" > +</p><!--l. 145--><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. 147--><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 +class="cmtt-10">\emakefirstuc{</span>⟨<span +class="cmitt-10">text</span>⟩<span +class="cmtt-10">} </span></div><hr> +</p><!--l. 149--><p class="noindent" > +</p><!--l. 151--><p class="indent" > Examples: + + + +</p> + <div class="verbatim" id="verbatim-7"> +\newcommand{\abc}{\xyz a} + <br />\newcommand{\xyz}{xyz} + <br />No expansion: \makefirstuc{\abc}. + <br />First object one-level expansion: \xmakefirstuc{\abc}. + <br />Fully expanded: \emakefirstuc{\abc}. +</div> +<!--l. 158--><p class="nopar" > produces: No expansion: XYZA. First object one-level expansion: XYZa. Fully +expanded: Xyza. +</p><!--l. 166--><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 +class="cmtt-10">\MakeUppercase</span> +command is used. If used with <span +class="cmss-10">glossaries</span><a + id="dx1-3007"></a>, <span +class="cmtt-10">\MakeTextUppercase</span><a + id="dx1-3008"></a> (defined by the <span +class="cmss-10">textcase</span><a + id="dx1-3009"></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. 172--><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 +class="cmtt-10">\glsmakefirstuc{</span>⟨<span +class="cmitt-10">text</span>⟩<span +class="cmtt-10">} </span></div><hr> +</p><!--l. 174--><p class="noindent" > +For example: + + + +</p> + <div class="verbatim" id="verbatim-8"> +\renewcommand{\glsmakefirstuc}[1]{\MakeTextUppercase #1} +</div> +<!--l. 178--><p class="nopar" > Remember to also load <span +class="cmss-10">textcase</span><a + id="dx1-3012"></a> (<span +class="cmss-10">glossaries </span>loads this automatically). +</p><!--l. 182--><p class="noindent" > +</p> +<!--l. 182--><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 Each Word in a Phrase or Sentence (Title Case)</h3> +<!--l. 185--><p class="noindent" >New to mfirstuc v1.06: +</p><!--l. 186--><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 +class="cmtt-10">\capitalisewords{</span>⟨<span +class="cmitt-10">text</span>⟩<span +class="cmtt-10">} </span></div><hr> +</p><!--l. 188--><p class="noindent" > +This command apply <span +class="cmtt-10">\makefirstuc</span><a + id="dx1-4002"></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="cmti-10">text</span>⟩. +</p><!--l. 195--><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-4003"></a> <span +class="cmtt-10">\xcapitalisewords{</span>⟨<span +class="cmitt-10">text</span>⟩<span +class="cmtt-10">} </span></div><hr> +</p><!--l. 197--><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. 201--><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. 203--><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-4004"></a> <span +class="cmtt-10">\ecapitalisewords{</span>⟨<span +class="cmitt-10">text</span>⟩<span +class="cmtt-10">} </span></div><hr> +</p><!--l. 205--><p class="noindent" > +</p><!--l. 207--><p class="indent" > Examples: + + + +</p> + <div class="verbatim" id="verbatim-9"> +\newcommand{\abc}{\xyz\space four five} + <br />\newcommand{\xyz}{one two three} + <br />No expansion: \capitalisewords{\abc}. + <br />First object one-level expansion: \xcapitalisewords{\abc}. + <br />Fully expanded: \ecapitalisewords{\abc}. +</div> +<!--l. 214--><p class="nopar" > produces: No expansion: ONE TWO THREE FOUR FIVE. First object one-level +expansion: ONE TWO THREE four Five. Fully expanded: One Two Three Four +Five. +</p><!--l. 222--><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 +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. 228--><p class="indent" > <div class="important" title="Important Note"> If you are using <span +class="cmss-10">hyperref</span><a + id="dx1-4005"></a> and want to use <span +class="cmtt-10">\capitalisewords </span>or <span +class="cmtt-10">\makefirstuc</span><a + id="dx1-4006"></a> (or +the expanded variants) in a section heading, the PDF bookmarks won’t be able to use +the command as it’s not expandable, so you will get a warning that looks +like: + + + +</p> + <div class="verbatim" id="verbatim-10"> +Package hyperref Warning: Token not allowed in a PDF string + <br />(PDFDocEncoding): + <br />(hyperref)                removing ‘\capitalisewords’ +</div> +<!--l. 237--><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-4007"></a>’s <span +class="cmtt-10">\texorpdfstring</span><a + id="dx1-4008"></a> command. See the <span +class="cmss-10">hyperref</span><a + id="dx1-4009"></a> manual for further details. +</div> +</p><!--l. 241--><p class="noindent" > +</p><!--l. 243--><p class="indent" > Examples: + </p><ol class="enumerate1" > + <li + class="enumerate" id="x1-4011x1"> + + + + <div class="verbatim" id="verbatim-11"> + \capitalisewords{a book of rhyme.} +</div> + <!--l. 248--><p class="nopar" > produces: A Book Of Rhyme. + </p></li> + <li + class="enumerate" id="x1-4013x2"> + + + + <div class="verbatim" id="verbatim-12"> + \capitalisewords{a book\space of rhyme.} +</div> + <!--l. 255--><p class="nopar" > produces: A Book of Rhyme. + </p></li> + <li + class="enumerate" id="x1-4015x3"> + + + + <div class="verbatim" id="verbatim-13"> + \newcommand{\mytitle}{a book\space of rhyme.} +  <br />\capitalisewords{\mytitle} +</div> + <!--l. 263--><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-4017x4"> + + + + <div class="verbatim" id="verbatim-14"> + \newcommand{\mytitle}{a book\space of rhyme.} +  <br />\xcapitalisewords{\mytitle} +</div> + <!--l. 273--><p class="nopar" > produces: A Book of Rhyme. + </p><!--l. 277--><p class="noindent" >However + + + +</p> + <div class="verbatim" id="verbatim-15"> + \ecapitalisewords{\mytitle} +</div> + <!--l. 280--><p class="nopar" > produces: A Book Of Rhyme. +</p> + </li></ol> +<!--l. 286--><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. 288--><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-4018"></a> <span +class="cmtt-10">\MFUnocap{</span>⟨<span +class="cmitt-10">word</span>⟩<span +class="cmtt-10">} </span></div><hr> +</p><!--l. 290--><p class="noindent" > +This only has a local effect. The global version is: +</p><!--l. 292--><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-4019"></a> <span +class="cmtt-10">\gMFUnocap{</span>⟨<span +class="cmitt-10">word</span>⟩<span +class="cmtt-10">} </span></div><hr> +</p><!--l. 294--><p class="noindent" > +</p><!--l. 296--><p class="indent" > For example: + + + +</p> + <div class="verbatim" id="verbatim-16"> +\capitalisewords{the wind in the willows} + <br />\MFUnocap{in}% + <br />\MFUnocap{the}% + <br />\capitalisewords{the wind in the willows} +</div> +<!--l. 304--><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. 315--><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-4020"></a> <span +class="cmtt-10">\MFUclear </span></div><hr> +</p><!--l. 317--><p class="noindent" > +</p><!--l. 319--><p class="indent" > The package <span +class="cmss-10">mfirstuc-english</span><a + id="dx1-4021"></a> loads <span +class="cmss-10">mfirstuc</span><a + id="dx1-4022"></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. 326--><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 + + + +</p> + <div class="verbatim" id="verbatim-17"> +\NeedsTeXFormat{LaTeX2e} +</div> +<!--l. 331--><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: + + + +</p> + <div class="verbatim" id="verbatim-18"> +\ProvidesPackage{mfirstuc-french} +</div> +<!--l. 336--><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-19"> +\ProvidesPackage{mfirstuc-french}[2014/07/30 v1.0] +</div> +<!--l. 341--><p class="nopar" > Next load <span +class="cmss-10">mfirstuc</span><a + id="dx1-4023"></a>: + + + +</p> + <div class="verbatim" id="verbatim-20"> +\RequirePackage{mfirstuc} +</div> +<!--l. 345--><p class="nopar" > Now add all your <span +class="cmtt-10">\MFUnocap </span>commands. For example: + + + +</p> + <div class="verbatim" id="verbatim-21"> +\MFUnocap{de} +</div> +<!--l. 349--><p class="nopar" > At the end of the file add: + + + +</p> + <div class="verbatim" id="verbatim-22"> +\endinput +</div> +<!--l. 353--><p class="nopar" > +</p><!--l. 355--><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. 359--><p class="noindent" > +</p> +<!--l. 359--><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. 362--><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. 369--><p class="indent" > A simplistic version of the <span +class="cmtt-10">\makefirstuc </span>command is: + + + +</p> + <div class="verbatim" id="verbatim-23"> +\newcommand*{\FirstUC}[1]{\MakeUppercase #1} +</div> +<!--l. 372--><p class="nopar" > Here + + + +</p> + <div class="verbatim" id="verbatim-24"> +\FirstUC{abc} +</div> +<!--l. 376--><p class="nopar" > is equivalent to + + + +</p> + <div class="verbatim" id="verbatim-25"> +\MakeUppercase abc +</div> +<!--l. 380--><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. 385--><p class="indent" > The <span +class="cmss-10">glossaries</span><a + id="dx1-5001"></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 +</p><div class="alltt"> +<div class="obeylines-v"> +<span +class="cmtt-10">\MakeUppercase</span><span +class="cmtt-10"> </span>⟨<span +class="cmitt-10">stuff</span>⟩ +</div> +</div> works, then <div class="alltt"> +<div class="obeylines-v"> +<span +class="cmtt-10">\makefirstuc{</span>⟨<span +class="cmitt-10">stuff</span>⟩<span +class="cmtt-10">}</span> +</div> +</div> should also work and so should <div class="alltt"> +<div class="obeylines-v"> +<span +class="cmtt-10">\makefirstuc</span><span +class="cmsy-10">{</span><span +class="cmtt-10">\foo{</span>⟨<span +class="cmitt-10">stuff</span>⟩<span +class="cmtt-10">}</span><span +class="cmsy-10">}</span> +</div> +</div> but if <div class="alltt"> +<div class="obeylines-v"> +<span +class="cmtt-10">\MakeUppercase</span><span +class="cmtt-10"> </span>⟨<span +class="cmitt-10">stuff</span>⟩ +</div> +</div> doesn’t work, then neither will <div class="alltt"> +<div class="obeylines-v"> +<span +class="cmtt-10">\makefirstuc{</span>⟨<span +class="cmitt-10">stuff</span>⟩<span +class="cmtt-10">}</span> + + + +</div> +</div> nor <div class="alltt"> +<div class="obeylines-v"> +<span +class="cmtt-10">\makefirstuc</span><span +class="cmsy-10">{</span><span +class="cmtt-10">\foo{</span>⟨<span +class="cmitt-10">stuff</span>⟩<span +class="cmtt-10">}</span><span +class="cmsy-10">}</span> +</div> +</div> +<!--l. 417--><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. 431--><p class="indent" > This will result in the error: + + + +</p> + <div class="verbatim" id="verbatim-26"> +! Argument of \UTFviii@two@octets has an extra }. +</div> +<!--l. 434--><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. 439--><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. 455--><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. 471--><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-5002"></a> +<span +class="cmti-10">package</span>. +</p> + +</body></html> + + + + diff --git a/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-manual.pdf b/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-manual.pdf Binary files differnew file mode 100644 index 00000000000..b6413ad4185 --- /dev/null +++ b/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-manual.pdf diff --git a/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-manual.tex b/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-manual.tex new file mode 100644 index 00000000000..60d25f80a0f --- /dev/null +++ b/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-manual.tex @@ -0,0 +1,475 @@ +\documentclass{nlctdoc} + +\usepackage{alltt} +\usepackage{mfirstuc} +\usepackage{pifont} +\usepackage[utf8]{inputenc} +\ifpdf + \usepackage[T1]{fontenc} + \usepackage{metalogo} +\else + \providecommand{\XeLaTeX}{XeLaTeX} + \providecommand{\XeTeX}{XeTeX} +\fi +\usepackage{cmap} +\usepackage[colorlinks, + bookmarks, + hyperindex=false, + pdfauthor={Nicola L.C. Talbot}, + pdftitle={mfirstuc.sty: uppercasing first letter}, + pdfkeywords={LaTeX,package,uppercase}]{hyperref} + +\begin{document} + \title{mfirstuc.sty v2.0: +uppercasing first letter} + \author{Nicola L.C. Talbot\\[10pt] +Dickimaw Books\\ +\url{http://www.dickimaw-books.com/}} + + \date{2015-09-09} + \maketitle + \tableofcontents + + \section{Introduction} + \label{sec:intro} + +The \styfmt{mfirstuc} package was originally part of the +\styfmt{glossaries} bundle for use with commands like \cs{Gls}, but +as the commands provided by \styfmt{mfirstuc} may be used without +\styfmt{glossaries}, the two have been split into separately +maintained packages. + +\section{Capitalising a Word} +\label{sec:makefirstuc} + +A simple word can be capitalised just using the standard \LaTeX\ +upper casing command. For example, +\begin{verbatim} +\MakeUppercase word +\end{verbatim} +but for commands like \cs{Gls} the word may be embedded within the +argument of another command, such as a~font changing command. This +makes things more complicated for a~general purpose solution, so +the \styfmt{mfirstuc} package provides: +\begin{definition}[\DescribeMacro{\makefirstuc}] +\cs{makefirstuc}\marg{stuff} +\end{definition} +This makes the first object of +\meta{stuff} upper case unless \meta{stuff} starts with a control +sequence followed by a non-empty group, in which case the first +object in the group is converted to upper case. +\textbf{No expansion is performed on the argument.} + +\begin{important} +If \meta{stuff} starts with a control sequence that takes more than +one argument, the case-changing will always be applied to the +\emph{first} argument. If the text that requires the case change is +in one of the other arguments, you must hide the earlier arguments +in a wrapper command. For example, instead of \verb|\color{red}{text}| +you need to define, say, \verb|\red| as \verb|\color{red}| and use +\verb|\red{text}|. +\end{important} + +Examples: +\begin{itemize} +\item |\makefirstuc{abc}| produces \makefirstuc{abc}. + +\item |\makefirstuc{\emph{abc}}| produces \makefirstuc{\emph{abc}} +(\ics{MakeUppercase} has been applied to the letter \qt{a} rather +than \cs{emph}). Note however that +\begin{verbatim} +\makefirstuc{{\em abc}} +\end{verbatim} +produces \makefirstuc{{\em abc}} (first object is |{\em abc}| so +this is equivalent to |\MakeUppercase{\em abc}|), and +\begin{verbatim} +{\makefirstuc{\em abc}} +\end{verbatim} +produces {\makefirstuc{\em abc}} (|\em| doesn't have an argument +therefore first object is |\em| and so is equivalent to +|{\MakeUppercase{\em}abc}|). + +\item |\makefirstuc{{\'a}bc}| produces \makefirstuc{{\'a}bc}. + +\item |\makefirstuc{\ae bc}| produces \makefirstuc{\ae bc}. + +\item |\makefirstuc{{\ae}bc}| produces \makefirstuc{{\ae}bc}. + +\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 +using the \sty{inputenc} package). The reason for this restriction +is detailed in \sectionref{sec:utf8}. + +\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 +an empty group. Prior to version 1.02, |\makefirstuc{\ae{}bc}| +produced \ae Bc. However as from version 1.02, it now produces +\AE bc. +\end{important} + +Note also that +\begin{verbatim} +\newcommand{\abc}{abc} +\makefirstuc{\abc} +\end{verbatim} +produces: ABC. This is because the first object in the argument of +\cs{makefirstuc} is \cs{abc}, so it does |\MakeUppercase{\abc}|. +Whereas: +\begin{verbatim} +\newcommand{\abc}{abc} +\expandafter\makefirstuc\expandafter{\abc} +\end{verbatim} +produces: Abc. There is a short cut command which will do this: +\begin{definition}[\DescribeMacro{\xmakefirstuc}] +\cs{xmakefirstuc}\marg{stuff} +\end{definition} +This is equivalent to \cs{expandafter}\cs{makefirstuc}\cs{expandafter}\marg{stuff}. So +\begin{verbatim} +\newcommand{\abc}{abc} +\xmakefirstuc{\abc} +\end{verbatim} +produces: +\newcommand{\abc}{abc}% +\xmakefirstuc{\abc}. + +\begin{important} +\cs{xmakefirstuc} only performs one level expansion on the +\emph{first} object in its argument. It does not fully expand the entire +argument. +\end{important} + +As from version 1.10, there is now a command that fully expands the +entire argument before applying \cs{makefirstuc}: +\begin{definition}[\DescribeMacro\emakefirstuc] +\cs{emakefirstuc}\marg{text} +\end{definition} + +Examples: +\begin{verbatim} +\newcommand{\abc}{\xyz a} +\newcommand{\xyz}{xyz} +No expansion: \makefirstuc{\abc}. +First object one-level expansion: \xmakefirstuc{\abc}. +Fully expanded: \emakefirstuc{\abc}. +\end{verbatim} +produces: +\renewcommand{\abc}{\xyz a}% +\newcommand{\xyz}{xyz} +No expansion: \makefirstuc{\abc}. +First object one-level expansion: \xmakefirstuc{\abc}. +Fully expanded: \emakefirstuc{\abc}. + +If you use \styfmt{mfirstuc} without the \sty{glossaries} package, +the standard \cs{MakeUppercase} command is used. If used with +\sty{glossaries}, \ics{MakeTextUppercase} (defined by the \sty{textcase} +package) is used instead. If you are using \styfmt{mfirstuc} +without the \styfmt{glossaries} package and want to use +\ics{MakeTextUppercase} instead, you can redefine +\begin{definition}[\DescribeMacro\glsmakefirstuc] +\cs{glsmakefirstuc}\marg{text} +\end{definition} +For example: +\begin{verbatim} +\renewcommand{\glsmakefirstuc}[1]{\MakeTextUppercase #1} +\end{verbatim} +Remember to also load \sty{textcase} (\styfmt{glossaries} loads this +automatically). + +\section{Capitalise Each Word in a Phrase or Sentence (Title Case)} +\label{sec:capitalisewords} + +New to mfirstuc v1.06: +\begin{definition}[\DescribeMacro{\capitalisewords}] +\cs{capitalisewords}\marg{text} +\end{definition} +This command apply \ics{makefirstuc} to each word in \meta{text} +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 \verb|~| or \cs{space}. Note that no expansion is performed +on \meta{text}. + +\begin{definition}[\DescribeMacro{\xcapitalisewords}] +\cs{xcapitalisewords}\marg{text} +\end{definition} +This is a short cut for +\cs{expandafter}\cs{capitalisewords}\cs{expandafter}\marg{text}. + +As from version 1.10, there is now a command that fully expands the +entire argument before applying \cs{capitalisewords}: +\begin{definition}[\DescribeMacro\ecapitalisewords] +\cs{ecapitalisewords}\marg{text} +\end{definition} + +Examples: +\begin{verbatim} +\newcommand{\abc}{\xyz\space four five} +\newcommand{\xyz}{one two three} +No expansion: \capitalisewords{\abc}. +First object one-level expansion: \xcapitalisewords{\abc}. +Fully expanded: \ecapitalisewords{\abc}. +\end{verbatim} +produces: +\renewcommand{\abc}{\xyz\space four five}% +\renewcommand{\xyz}{one two three} +No expansion: \capitalisewords{\abc}. +First object one-level expansion: \xcapitalisewords{\abc}. +Fully expanded: \ecapitalisewords{\abc}. + +(Remember that the spaces need to be explicit. In the second case +above, using \cs{xcapitalisewords}, the space before \qt{four} has +been hidden within \cs{space} so it's not recognised as a word +boundary, but in the third case, \cs{space} has been expanded to an +actual space character.) + +\begin{important} +If you are using \sty{hyperref} and want to use \cs{capitalisewords} +or \ics{makefirstuc} (or the expanded variants) +in a section heading, the PDF bookmarks won't be able to use the command +as it's not expandable, so you will get a warning that looks like: +\begin{verbatim} +Package hyperref Warning: Token not allowed in a PDF string +(PDFDocEncoding): +(hyperref) removing `\capitalisewords' +\end{verbatim} +If you want to provide an alternative for the PDF bookmark, you can +use \sty{hyperref}'s \ics{texorpdfstring} command. See the +\sty{hyperref} manual for further details. +\end{important} + +Examples: +\begin{enumerate} +\item +\begin{verbatim} +\capitalisewords{a book of rhyme.} +\end{verbatim} +produces: +\capitalisewords{a book of rhyme.} + +\item +\begin{verbatim} +\capitalisewords{a book\space of rhyme.} +\end{verbatim} +produces: +\capitalisewords{a book\space of rhyme.} + +\item +\begin{verbatim} +\newcommand{\mytitle}{a book\space of rhyme.} +\capitalisewords{\mytitle} +\end{verbatim} +produces: +\newcommand{\mytitle}{a book\space of rhyme.} +\capitalisewords{\mytitle} +(No expansion is performed on \cs{mytitle}.) Compare with next example: + +\item +\begin{verbatim} +\newcommand{\mytitle}{a book\space of rhyme.} +\xcapitalisewords{\mytitle} +\end{verbatim} +produces: +\xcapitalisewords{\mytitle} + +However +\begin{verbatim} +\ecapitalisewords{\mytitle} +\end{verbatim} +produces: +\ecapitalisewords{\mytitle} + +\end{enumerate} + +As from v1.09, you can specify words which shouldn't be capitalised unless they +occur at the start of \meta{text} using: +\begin{definition}[\DescribeMacro\MFUnocap] +\cs{MFUnocap}\marg{word} +\end{definition} +This only has a local effect. The global version is: +\begin{definition}[\DescribeMacro\gMFUnocap] +\cs{gMFUnocap}\marg{word} +\end{definition} + +For example: +\begin{verbatim} +\capitalisewords{the wind in the willows} + +\MFUnocap{in}% +\MFUnocap{the}% + +\capitalisewords{the wind in the willows} +\end{verbatim} +produces: +\begin{display} +\capitalisewords{the wind in the willows} + +\MFUnocap{in}% +\MFUnocap{the}% + +\capitalisewords{the wind in the willows} +\end{display} +The list of words that shouldn't be capitalised can be cleared using +\begin{definition}[\DescribeMacro\MFUclear] +\cs{MFUclear} +\end{definition} + +The package \sty{mfirstuc-english} loads \sty{mfirstuc} and uses +\cs{MFUnocap} 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. + +If you want to write a similar package for another language, all you +need to do is create a file with the extension \texttt{.sty} +that starts with +\begin{verbatim} +\NeedsTeXFormat{LaTeX2e} +\end{verbatim} +The next line should identify the package. For example, if you have +called the file \texttt{mfirstuc-french.sty} then you need: +\begin{verbatim} +\ProvidesPackage{mfirstuc-french} +\end{verbatim} +It's a good idea to also add a version in the final optional +argument, for example: +\begin{verbatim} +\ProvidesPackage{mfirstuc-french}[2014/07/30 v1.0] +\end{verbatim} +Next load \sty{mfirstuc}: +\begin{verbatim} +\RequirePackage{mfirstuc} +\end{verbatim} +Now add all your \cs{MFUnocap} commands. For example: +\begin{verbatim} +\MFUnocap{de} +\end{verbatim} +At the end of the file add: +\begin{verbatim} +\endinput +\end{verbatim} + +Put the file somewhere on \TeX'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. + +\section{UTF-8} +\label{sec:utf8} + +The \cs{makefirstuc} command works by utilizing the fact that, in +most cases, \TeX\ 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, \verb|\frac12| instead of \verb|\frac{1}{2}| or +\verb|x^2| instead of \verb|x^{2}|, although some users +frown on this practice.) + +A~simplistic version of the \cs{makefirstuc} command is: +\begin{verbatim} +\newcommand*{\FirstUC}[1]{\MakeUppercase #1} +\end{verbatim} +Here +\begin{verbatim} +\FirstUC{abc} +\end{verbatim} +is equivalent to +\begin{verbatim} +\MakeUppercase abc +\end{verbatim} +and since \cs{MakeUppercase} 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. + +The \sty{glossaries} package needs to take into account the fact +that the text may be contained in the argument of a formatting +command, such as \cs{acronymfont}, so \cs{makefirstuc} has to be +more complicated than the trivial \cs{FirstUC} shown above, but at +its basic level, \cs{makefirstuc} 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 +\begin{alltt} +\cs{MakeUppercase} \meta{stuff} +\end{alltt} +works, +then +\begin{alltt} +\cs{makefirstuc}\marg{stuff} +\end{alltt} +should also work and so should +\begin{alltt} +\cs{makefirstuc}\{\cs{foo}\marg{stuff}\} +\end{alltt} +but if +\begin{alltt} +\cs{MakeUppercase} \meta{stuff} +\end{alltt} +doesn't work, then neither will +\begin{alltt} +\cs{makefirstuc}\marg{stuff} +\end{alltt} +nor +\begin{alltt} +\cs{makefirstuc}\{\cs{foo}\marg{stuff}\} +\end{alltt} + +Try the following document: +\begin{alltt} +\cs{documentclass}\{article\} + +\cs{usepackage}[utf8]\{inputenc\} +\cs{usepackage}[T1]\{fontenc\} + +\cs{begin}\{document\} + +\cs{MakeUppercase} \~abc + +\cs{end}\{document\} +\end{alltt} + +This will result in the error: +\begin{verbatim} +! Argument of \UTFviii@two@octets has an extra }. +\end{verbatim} +This is why \verb|\makefirstuc{|\texttt{\~abc}\verb|}| won't work. +It will only work if the character \texttt{\~a} is placed inside a +group. + +The reason for this error message is due to \TeX\ having been written before +Unicode was invented. Although \texttt{\~a} may look like a single +character in your text editor, from \TeX's point of view it's \emph{two} +tokens. So +\begin{alltt} +\cs{MakeUppercase} \~abc +\end{alltt} +tries to apply \cs{MakeUppercase} to just the first octet of \~a. +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 \~a) +must be grouped: +\begin{alltt} +\cs{MakeUppercase}\{\~a\}bc +\end{alltt} + +Note that \XeTeX\ (and therefore \XeLaTeX) is a modern +implementation of \TeX\ 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: +\begin{alltt} +\cs{documentclass}\{article\} + +\cs{usepackage}\{fontspec\} + +\cs{begin}\{document\} + +\cs{MakeUppercase} \~abc + +\cs{end}\{document\} +\end{alltt} + +This works correctly when compiled with \XeLaTeX. This means +that \cs{makefirstuc}\verb|{|\texttt{\~abc}\verb|}| will work +\emph{provided you use \XeLaTeX\ and the \sty{fontspec} package}. + +\end{document} diff --git a/Master/texmf-dist/doc/latex/mfirstuc/sample-mfirstuc.pdf b/Master/texmf-dist/doc/latex/mfirstuc/sample-mfirstuc.pdf Binary files differnew file mode 100644 index 00000000000..cd01cfbecd4 --- /dev/null +++ b/Master/texmf-dist/doc/latex/mfirstuc/sample-mfirstuc.pdf diff --git a/Master/texmf-dist/doc/latex/mfirstuc/sample-mfirstuc.tex b/Master/texmf-dist/doc/latex/mfirstuc/sample-mfirstuc.tex new file mode 100644 index 00000000000..0cdae525b58 --- /dev/null +++ b/Master/texmf-dist/doc/latex/mfirstuc/sample-mfirstuc.tex @@ -0,0 +1,40 @@ + % This file is public domain + % If you want to use arara, you need the following directive: + % arara: pdflatex: { synctex: on } +\documentclass{article} + +\usepackage{mfirstuc-english} + +\begin{document} + +\makefirstuc{abc}. + +\makefirstuc{{\em abc}}. + +\makefirstuc{\emph{abc}}. + +\makefirstuc{\ae bc}. + +\makefirstuc{{\ae}bc}. + +\newcommand{\abc}{abc}% +\xmakefirstuc{\abc}. + +\capitalisewords{the wind in the willows} + +\capitalisewords{a book of rhyme.} + +\MFUclear + +\capitalisewords{the wind in the willows} + +\capitalisewords{a book of rhyme.} + +\capitalisewords{a book\space of rhyme.} + +\newcommand{\mytitle}{a book\space of rhyme.} +\capitalisewords{\mytitle} + +\xcapitalisewords{\mytitle} + +\end{document} |