diff options
author | Karl Berry <karl@freefriends.org> | 2022-10-18 20:54:55 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-10-18 20:54:55 +0000 |
commit | 3133b2f6f5ab9b219387d63f9fc31d854b03306f (patch) | |
tree | e562bf827252a8e7a75436f759cb7fca1e088ccd /Master/texmf-dist | |
parent | bfcea5464a52a2ec66df98da0a380869ffbe6e79 (diff) |
mfirstuc (17oct22)
git-svn-id: svn://tug.org/texlive/trunk@64743 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
14 files changed, 5168 insertions, 3041 deletions
diff --git a/Master/texmf-dist/doc/latex/mfirstuc/CHANGES b/Master/texmf-dist/doc/latex/mfirstuc/CHANGES index a78e049ba9c..d1cc1e183a1 100644 --- a/Master/texmf-dist/doc/latex/mfirstuc/CHANGES +++ b/Master/texmf-dist/doc/latex/mfirstuc/CHANGES @@ -1,5 +1,57 @@ mfirstuc change log: +v2.08 (2022-10-14): + + * Reimplemented \makefirstuc in LaTeX3. This change supports + UTF-8 with pdflatex. + + Rollback to v2.07 provided: + + \usepackage{mfirstuc}[=v2.07] + + * New command \MFUsentencecase + + This just uses \text_titlecase_first:n + + Principle features of \MFUsentencecase vs \makefirstuc are + listed in Table 1 of the manual. + + * \makefirstuc has been rewritten to internally use + \MFUsentencecase (via \glsmakefirstuc), but it still parses + its argument as in previous versions. + + * New command \MFUexcl{<cs>} + + This adds a command to the case-changing exclusion list. + Both \MFUsentencecase and \makefirstuc will skip the + identified command and its argument, and apply sentence-casing + to the content that follows. + + For example, glossaries.sty v4.50 implements \MFUexcl{\glsadd} + + * New command \MFUblocker{<cs>} + + This adds a command to the blocker list. This is used by + \makefirstuc but not \MFUsentencecase. If the command is encountered + no case-change will be applied. This is designed for commands + that automatically implement a case-change that may have been nested. + + For example, glossaries.sty v4.50 implements \MFUblocker{\Gls} + + * New command \MFUaddmap{<cs1>}{<cs2>} + + Adds a mapping. This is used by \makefirstuc but not + \MFUsentencecase. If the first command <cs1> is encountered + it will be replaced with the second <cs2>. No case change + will be applied. (The case-change, if appropriate, + should be dealt with by the replacement command.) + + For example, glossaries.sty v4.50 implements \MFUaddmap{\gls}{\Gls} + + Order of precedence: map, blocker, exclusion + + * New commands \MFUsaveatend and \MFUsave + v2.07 (2021-10-15): * new commands: diff --git a/Master/texmf-dist/doc/latex/mfirstuc/README b/Master/texmf-dist/doc/latex/mfirstuc/README index 95e632cfc7e..e7ba4933d8a 100644 --- a/Master/texmf-dist/doc/latex/mfirstuc/README +++ b/Master/texmf-dist/doc/latex/mfirstuc/README @@ -1,6 +1,6 @@ -LaTeX Package : mfirstuc v2.07 +LaTeX Package : mfirstuc v2.08 -Last Modified : 2021-10-15 +Last Modified : 2022-10-14 Author : Nicola Talbot @@ -26,10 +26,12 @@ 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. +This package comes with a LaTeX2HTML style file mfirstuc.l2h which +should be placed in the relevant LaTeX2HTML styles directory and may +need to have the file extension changed, but note that some commands +may not be implemented or may be implemented in a different way. +There's no guarantee that it will continue to work with new +versions of LaTeX2HTML. LICENCE diff --git a/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-code.pdf b/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-code.pdf Binary files differindex f02689d526c..7da4d79d1dd 100644 --- a/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-code.pdf +++ 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 index be92120e8fa..b2c121f28d0 100644 --- a/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-manual.html +++ b/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-manual.html @@ -1,1720 +1,1393 @@ -<?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></title> -<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<meta name="generator" content="TeX4ht (https://tug.org/tex4ht/)" /> -<meta name="originator" content="TeX4ht (https://tug.org/tex4ht/)" /> -<!-- xhtml,fn-in,css-in,uni-html4,utf8 --> -<meta name="src" content="mfirstuc-manual.tex" /> +<!DOCTYPE html> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta name="generator" content="TeX Parser Library"> + <title>mfirstuc.sty v2.08: +sentence and title casing</title> <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,monospace;} -.cmtt-12{font-family: monospace,monospace;} -.cmtt-12{font-family: monospace,monospace;} -.cmtt-12{font-family: monospace,monospace;} -.cmtt-10{font-family: monospace,monospace;} -.cmtt-10{font-family: monospace,monospace;} -.cmtt-10{font-family: monospace,monospace;} -.cmtt-10{font-family: monospace,monospace;} -.cmss-10{ font-family: sans-serif;} -.cmss-10{ font-family: sans-serif;} -.cmtt-9{font-size:90%;font-family: monospace,monospace;} -.cmtt-9{font-family: monospace,monospace;} -.cmtt-9{font-family: monospace,monospace;} -.cmtt-9{font-family: monospace,monospace;} -.cmitt-10{font-family: monospace,monospace; font-style: italic;} -.cmti-10{ font-style: italic;} -.cmbx-10{ font-weight: bold;} -.cmbxti-10{ font-weight: bold; font-style: italic;} -.cmssi-10{ font-family: sans-serif; font-style: oblique;} -.cmssi-10{ font-family: sans-serif; font-style: oblique;} -p{margin-top:0;margin-bottom:0} -p.indent{text-indent:0;} -p + p{margin-top:1em;} -p + div, p + pre {margin-top:1em;} -div + p, pre + p {margin-top:1em;} -a { overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; hyphens: auto; } -@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;} -div.par-math-display, div.math-display{text-align:center;} -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:first-child{ margin-bottom:0; } -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;} -pre.verbatim {font-family: monospace,monospace; 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 : 0px; margin:0px; } -.hline td, .cline td{ padding: 0; } -.hline hr, .cline hr{border:none;border-top:1px solid black;} -.hline {border-top: 1px solid black;} -.tabbing-right {text-align:right;} -div.float, div.figure {margin-left: auto; margin-right: auto;} -div.float img {text-align:center;} -div.figure img {text-align:center;} -.marginpar,.reversemarginpar {width:20%; float:right; text-align:left; margin-left:auto; margin-top:0.5em; font-size:85%; text-decoration:underline;} -.marginpar p,.reversemarginpar p{margin-top:0.4em; margin-bottom:0.4em;} -.reversemarginpar{float:left;} -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%;} -.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; } -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;} -.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; } -h1.partHead{text-align: center} -div.abstract p {margin-left:5%; margin-right:5%;} -div.abstract {width:100%;} -.abstracttitle{text-align:center;margin-bottom:1em;} -.alltt P { margin-bottom : 0em; margin-top : 0em; } -.alltt { margin-bottom : 1em; margin-top : 1em; font-family:monospace,monospace; } -.warningsymbol { color: red; font-weight: bold;} -div.important { border : solid red; } -div.verbatim { font-family: monospace; white-space: nowrap; text-align:left; clear:both; padding-top: 2ex; padding-bottom: 2ex;} -span#textcolor1{color:#FF0000} -/* end css.sty */ - +#main {margin-left: 5%; margin-right: 15%} +div.tomain {position: absolute; left: 0pt; width: 5%; text-align: right; font-size: x-small;} +div.tomain a {text-decoration: none;} +div.labellink {display: inline; font-size: x-small; margin-left: 1em; margin-right: 1em;} +div.marginleft {position: absolute; left: 0pt; width: 5%;} +div.marginright {position: absolute; right: 0pt; width: 15%;} +div.displaymath { display: block; text-align: center; } +span.eqno { float: right; } +div.table { display: block; text-align: center; } +table.tabular-cm +{ + display: inline-table; + border-collapse: collapse; + align: center; + vertical-align: middle; +} +table.tabular-cb +{ + display: inline-table; + border-collapse: collapse; + align: center; + vertical-align: bottom; +} +table.tabular-ct +{ + display: inline-table; + border-collapse: collapse; + align: center; + vertical-align: top; +} +table.tabular-lm +{ + display: inline-table; + border-collapse: collapse; + align: left; + vertical-align: middle; +} +table.tabular-lb +{ + display: inline-table; + border-collapse: collapse; + align: left; + vertical-align: bottom; +} +table.tabular-lt +{ + display: inline-table; + border-collapse: collapse; + align: left; + vertical-align: top; +} +table.tabular-rm +{ + display: inline-table; + border-collapse: collapse; + align: right; + vertical-align: middle; +} +table.tabular-rb +{ + display: inline-table; + border-collapse: collapse; + align: right; + vertical-align: bottom; +} +table.tabular-rt +{ + display: inline-table; + border-collapse: collapse; + align: right; + vertical-align: top; +} +table.tabular-m +{ + display: inline-table; + border-collapse: collapse; + vertical-align: middle; +} +table.tabular-b +{ + display: inline-table; + border-collapse: collapse; + vertical-align: bottom; +} +table.tabular-t +{ + display: inline-table; + border-collapse: collapse; + vertical-align: top; +} +table.tabular-l +{ + display: inline-table; + border-collapse: collapse; + align: left; +} +table.tabular-c +{ + display: inline-table; + border-collapse: collapse; + align: center; +} +table.tabular-r +{ + display: inline-table; + border-collapse: collapse; + align: right; +} +pre { white-space: pre-wrap; } +div.figure { display: block; text-align: center; } +div.caption { display: block; text-align: center; } +div.marginpar { float: right; } +div.abstract { display: block; margin-right: 4em; margin-left: 4em;} +div.title { display: block; text-align: center; font-size: x-large;} +div.author { display: block; text-align: center; font-size: large;} +div.date { display: block; text-align: center; font-size: medium;} +div.bibliography { display: block; margin-left: 4em; } +div.bibitem { display: inline; float: left; text-indent: -3em; } +span.numberline { display: inline-block; width: 3em; } +.toc-subsection span.numberline { display: inline-block; width: 3em; } +.toc-subsubsection span.numberline { display: inline-block; width: 4em; } +.toc-paragraph span.numberline { display: inline-block; width: 5em; } +.toc-subparagraph span.numberline { display: inline-block; width: 6em; } +nav ul { list-style-type: none; } +.toc-part { padding-left: 0em; padding-bottom: 1ex; padding-top: 1ex; font-weight: bold; font-size: large;} +.toc-chapter { padding-left: 0em; padding-bottom: .25ex; padding-top: .25ex; font-weight: bold; } +.toc-section { padding-left: .5em; } +.toc-subsection { padding-left: 1.5em; } +.toc-subsubsection { padding-left: 2em; } +.toc-paragraph { padding-left: 2.5em; } +.toc-subparagraph { padding-left: 3em; } +.part { font-size: x-large; font-weight: bold; } +div.bigskip { padding-left: 0pt; padding-right: 0pt; padding-top: 0pt; padding-bottom: 2ex;} +div.medskip { padding-left: 0pt; padding-right: 0pt; padding-top: 0pt; padding-bottom: 1ex;} +div.smallskip { padding-left: 0pt; padding-right: 0pt; padding-top: 0pt; padding-bottom: .5ex;} +span.quad { padding-left: 0pt; padding-right: 1em; padding-top: 0pt; padding-bottom: 0pt;} +span.qquad { padding-left: 0pt; padding-right: 2em; padding-top: 0pt; padding-bottom: 0pt;} +.displaylist { display: block; list-style-type: none; } +.inlinelist { display: inline; } +dl.inlinetitle dt { display: inline-block; margin-left: 0; margin-right: 1em;} +dl.inlinetitle dd { display: inline; margin: 0; } +dl.inlinetitle dd::after { display: block; content: ''; } +dl.inlineblock dt { display: inline-block; margin-left: 0; margin-right: 1em;} +dl.inlineblock dd { display: inline; margin: 0; } +dl.inlineblock dd::after { display: block; content: ''; } +.clearfix::after { content: ""; clear: both; display: table; } +span.inlineitem { margin-right: .5em; margin-left: .5em; } +span.numitem { float: left; margin-left: -3em; text-align: right; min-width: 2.5em; } +span.bulletitem { float: left; margin-left: -1em; } +span.descitem { font: normal; font-weight: bold; } +div.indexspace { min-height: 2ex; } +.cell-noborder-nosep-r {border-top: none; border-right: none; border-left: none; padding-left: 0px; padding-right: 0px; text-align: right; } +.cell-noborder-bothsep-l {border-top: none; border-right: none; border-left: none; padding-left: 6.000000pt; padding-right: 6.000000pt; text-align: left; } +.cell-noborder-bothsep-r {border-top: none; border-right: none; border-left: none; padding-left: 6.000000pt; padding-right: 6.000000pt; text-align: right; } +.cell-noborder-bothsep-halfwidth {border-top: none; border-right: none; border-left: none; padding-left: 6.000000pt; width: 50.000000%; padding-right: 6.000000pt; text-align: left; } +.cell-noborder-nosep-l {border-top: none; border-right: none; border-left: none; padding-left: 0px; padding-right: 0px; text-align: left; } +.cell-noborder-rightsep-l {border-top: none; border-right: none; border-left: none; padding-left: 6.000000pt; padding-right: 0px; text-align: left; } +.cell-noborder-leftsep-r {border-top: none; border-right: none; border-left: none; padding-left: 6.000000pt; padding-right: 0px; text-align: right; } +.cell-noborder-bothsep-c {border-top: none; border-right: none; border-left: none; padding-left: 6.000000pt; padding-right: 6.000000pt; text-align: center; } +.cell-noborder-bothsep-eightypc {border-top: none; border-right: none; border-left: none; padding-left: 6.000000pt; width: 80.000000%; padding-right: 6.000000pt; text-align: left; } +.cell-noborder-rightsep-c {border-top: none; border-right: none; border-left: none; padding-left: 0px; padding-right: 6.000000pt; text-align: center; } +.cell-noborder-bothsep-threequarterwidth {border-top: none; border-right: none; border-left: none; padding-left: 6.000000pt; width: 75.000000%; padding-right: 6.000000pt; text-align: left; } +.cell-noborder-rightsep-r {border-top: none; border-right: none; border-left: none; padding-left: 0px; padding-right: 6.000000pt; text-align: right; } +.cell-noborder-bothsep-quarterwidth {border-top: none; border-right: none; border-left: none; padding-left: 6.000000pt; width: 25.000000%; padding-right: 6.000000pt; text-align: left; } +.cell-noborder-rightsep-c {border-top: none; border-right: none; border-left: none; padding-left: 6.000000pt; padding-right: 0px; text-align: center; } +.cell-noborder-rightsep-l {border-top: none; border-right: none; border-left: none; padding-left: 0px; padding-right: 6.000000pt; text-align: left; } +.cell-noborder-nosep-c {border-top: none; border-right: none; border-left: none; padding-left: 0px; padding-right: 0px; text-align: center; } +span.mbox {border-style: none; } +span.frame {border-style: solid; border-width: 1.000000pt; padding: 0.000000pt; } +span.boxed {text-align: center; vertical-align: middle; border-style: solid; border-width: 2.000000pt; padding: 0.000000pt; width: 1.000000em; height: 1.000000em; display: inline-block; } +span.circled {text-align: center; vertical-align: middle; border-style: solid; border-width: 2.000000pt; padding: 1.000000pt; border-radius: 5000.000000%;width: 1.000000em; height: 1.000000em; display: inline-block; } +span.overlapped {text-align: center; border-style: none; padding: 0.000000pt; width: 1.000000em; height: 1.000000em; display: inline-block; } +span.overlapper {text-align: center; border-style: none; padding: 0.000000pt; margin-left: -1.000000em; width: 1.000000em; height: 1.000000em; display: inline-block; } +span.overlappertop {text-align: center; vertical-align: top; border-style: none; padding: 0.000000pt; margin-left: -1.000000em; width: 1.000000em; height: 1.000000em; display: inline-block; } +span.partialoverlapper {text-align: center; border-style: none; padding: 0.000000pt; margin-left: -0.750000em; width: 1.000000em; height: 1.000000em; display: inline-block; } +span.quarterleft {text-align: center; vertical-align: middle; border-style: none; padding: 0.000000pt; transform: rotate(-90.000000deg); -ms-transform: rotate(-90.000000deg); -webkit-transform: rotate(-90.000000deg); display: inline-block; } +span.quarterright {text-align: center; vertical-align: middle; border-style: none; padding: 0.000000pt; transform: rotate(90.000000deg); -ms-transform: rotate(90.000000deg); -webkit-transform: rotate(90.000000deg); display: inline-block; } +span.eighthleft {text-align: center; vertical-align: middle; border-style: none; padding: 0.000000pt; transform: rotate(-45.000000deg); -ms-transform: rotate(-45.000000deg); -webkit-transform: rotate(-45.000000deg); display: inline-block; } +span.eighthright {text-align: center; vertical-align: middle; border-style: none; padding: 0.000000pt; transform: rotate(45.000000deg); -ms-transform: rotate(45.000000deg); -webkit-transform: rotate(45.000000deg); display: inline-block; } +span.halfturn {text-align: center; vertical-align: middle; border-style: none; padding: 0.000000pt; transform: rotate(180.000000deg); -ms-transform: rotate(180.000000deg); -webkit-transform: rotate(180.000000deg); display: inline-block; } +span.fwsdisabledicon {border-style: none; color: gray; } +span.fwsactiveicon {border-style: none; color: green; } +span.glsshowtargetfonttext {font-family: monospace; font-size: x-small; border-style: none; } +dfn { font-style: normal; font-weight: bold; } a { text-decoration: none; } a:hover { text-decoration: underline; } div.tablefns { border-top: solid; } div.example { border-bottom: solid silver; padding: 20px; } div.example div.title { font-weight: bold; font-size: large; } +div.sidenote {font-size: x-small; float: right; border-style: none; } +span.advantage {border-style: none; color: green; } +span.disadvantage {border-style: none; color: red; } +strong.strong {font-weight: bold; border-style: none; } +em.booktitle {font-style: italic; font-variant: normal; border-style: none; } +code.code {font-family: monospace; border-style: none; } +code.cmd {font-family: monospace; border-style: none; } +span.cmdfmt {font-family: monospace; border-style: none; } +span.comment {border-style: none; color: rgb(94,94,94); } +code.csfmt {font-family: monospace; border-style: none; color: rgb(84,111,26); } +span.csfmtfont {font-family: monospace; border-style: none; } +span.csfmtcolourfont {font-family: monospace; border-style: none; color: rgb(84,111,26); } +span.appfmt {font-family: monospace; border-style: none; } +span.styfmt {font-family: monospace; border-style: none; } +span.clsfmt {font-family: monospace; border-style: none; } +span.envfmt {font-family: monospace; border-style: none; } +span.optfmt {font-family: monospace; border-style: none; } +span.csoptfmt {font-family: monospace; border-style: none; color: rgb(104,34,139); } +span.styoptfmt {font-family: monospace; border-style: none; color: rgb(104,34,139); } +span.clsoptfmt {font-family: monospace; border-style: none; } +span.ctrfmt {font-family: monospace; border-style: none; } +span.filefmt {font-family: monospace; border-style: none; } +span.extfmt {font-family: monospace; border-style: none; } +span.deprecatedorbannedfmt {border-style: none; color: rgb(204,0,0); } +span.summarylocfmt {font-style: italic; font-variant: normal; border-style: none; } +span.menufmt {font-family: monospace; border-style: none; } +code.cbeg {font-family: monospace; border-style: none; } +code.cend {font-family: monospace; border-style: none; } +span.termslocfmt {font-style: italic; font-variant: normal; border-style: none; } +span.crossreftag {font-style: italic; font-variant: normal; border-style: none; } +div.crossref {border-style: none; margin-left: 1.000000em; } +span.longargfmt {font-family: monospace; border-style: none; } +span.shortargfmt {font-family: monospace; border-style: none; } +span.qt {border-style: none; } +code.qtt {font-family: monospace; border-style: none; } +em.metainner {font-style: italic; font-variant: normal; border-style: none; } +span.meta {font-family: serif; border-style: none; color: black; } +em.initvalnotefmtinner {font-style: italic; font-variant: normal; border-style: none; } +span.initvalnotefmt {font-family: serif; border-style: none; color: black; } +span.summarytag {font-style: italic; font-variant: normal; border-style: none; } +div.importanttitle {text-align: right; border-style: none; color: red; } +div.important {border-style: solid; border-color: red; border-width: 2.000000pt; padding: 2.000000pt; background-color: rgb(255,235,235); } +div.warningtitle {text-align: right; border-style: none; color: red; } +div.warning {border-style: solid; border-color: red; border-width: 2.000000pt; padding: 2.000000pt; background-color: rgb(255,235,235); } +div.informationtitle {text-align: right; border-style: none; color: rgb(0,128,128); } +div.information {border-style: solid; border-color: rgb(0,128,128); border-width: 2.000000pt; padding: 2.000000pt; background-color: rgb(240,255,255); } +div.pinnedboxtitle {text-align: right; border-style: none; color: black; } +div.pinnedbox {border-style: solid; border-color: black; border-width: 2.000000pt; padding: 2.000000pt; background-color: rgb(255,255,191); } +div.terminaltitle {text-align: right; border-style: none; color: black; } +pre.terminal {font-family: monospace; border-style: solid; border-color: black; border-width: 2.000000pt; padding: 2.000000pt; background-color: rgb(250,250,250); } +div.transcripttitle {text-align: right; border-style: none; color: black; } +pre.transcript {font-family: monospace; border-style: solid; border-color: black; border-width: 2.000000pt; padding: 2.000000pt; background-color: rgb(250,250,250); } +div.ctrboxtitle {text-align: right; border-style: none; color: black; } +div.ctrbox {border-style: solid; border-color: black; border-width: 2.000000pt; padding: 2.000000pt; background-color: rgb(255,255,191); } +div.codeboxtitle {text-align: right; border-style: none; color: black; } +pre.codebox {font-family: monospace; border-style: solid; border-color: black; border-width: 2.000000pt; padding: 2.000000pt; background-color: rgb(250,250,250); } +div.resultboxtitle {text-align: right; border-style: none; color: black; } +div.resultbox {border-style: solid; border-color: black; border-width: 2.000000pt; padding: 2.000000pt; } +div.badcodeboxtitle {text-align: right; border-style: none; color: black; } +pre.badcodebox {font-family: monospace; border-style: solid; border-color: black; border-width: 2.000000pt; padding: 2.000000pt; background-color: rgb(250,250,250); } +div.unicodeboxtitle {text-align: right; border-style: none; color: black; } +pre.unicodebox {font-family: monospace; border-style: solid; border-color: black; border-width: 2.000000pt; padding: 2.000000pt; background-color: rgb(250,250,250); } +pre.compactcodebox {font-family: monospace; border-style: solid; border-color: black; border-width: 1.000000pt; padding: 2.000000pt; background-color: rgb(250,250,250); } +pre.sidebysidecode {font-family: monospace; font-size: small; vertical-align: top; border-style: solid; border-color: black; border-width: 1.000000pt; padding: 2.000000pt; margin-right: 3.000000%; margin-top: 0.000000pt; background-color: rgb(250,250,250); width: 47.000000%; display: inline-block; } +div.sidebysideresult {vertical-align: top; border-style: solid; border-color: black; border-width: 1.000000pt; padding: 2.000000pt; margin-top: 0.000000pt; width: 47.000000%; display: inline-block; } +div.defnbox {border-style: solid; border-color: black; border-width: 1.000000pt; padding: 2.000000pt; background-color: rgb(255,255,191); } +div.optionsummarybox {border-style: solid; border-color: black; border-width: 1.000000pt; padding: 2.000000pt; background-color: rgb(255,255,191); } +div.optionvaluesummarybox {border-style: none; margin-left: 40.000000pt; } +span.floatrightbox {float: right; border-style: none; } +div.noteBox {border-style: none; } +div.settingsboxtitle {text-align: right; border-style: none; color: black; } +div.settingsbox {border-style: solid; border-color: black; border-width: 2.000000pt; padding: 2.000000pt; background-color: rgb(255,255,227); } +div.optionvalueboxtitle {text-align: right; border-style: none; color: black; } +div.optionvaluebox {border-style: solid; border-color: black; border-width: 2.000000pt; padding: 2.000000pt; background-color: rgb(255,255,245); } +div.nlctuserguideidx0 {border-style: none; margin-left: 0.000000pt; } +div.nlctuserguideidx1 {border-style: none; margin-left: 20.000000pt; } +div.nlctuserguideidx2 {border-style: none; margin-left: 40.000000pt; } +div.nlctusernavbox {border-style: none; } +div.abstractheader {font-weight: bold; text-align: center; border-style: none; } +div.filedef {font-family: monospace; text-align: left; border-style: none; } +div.tablefn {font-size: x-small; border-style: none; } +div.tablefns {text-align: left; border-style: none; width: 80.000000%; } </style> -</head><body -> -<!--l. 36--><p class="noindent" ><a - id="top"></a> -</p><!--l. 36--><p class="indent" > - - - -</p><!--l. 36--><p class="indent" > - - - -</p> -<div class="center" -> -<!--l. 36--><p class="noindent" > -</p><!--l. 36--><p class="noindent" ><span -class="cmr-17">mfirstuc.sty v2.07: uppercasing first letter</span> -</p> -<div class="tabular"> <table id="TBL-1" class="tabular" +</head> +<body> +<div id="main"> + <header><div class="title">mfirstuc.sty v2.08: sentence and title casing</div><!-- end of title --><div class="author">Nicola L.C. Talbot<br> + + Dickimaw Books<br> + + <a href="https://www.dickimaw-books.com/">dickimaw-books.com</a></div><!-- end of author --><div class="date">2022-10-14 </div><!-- end of date --></header><p> +<p> +<div class="information"><div class="informationtitle"><a id="wrglossary.1"></a><a href="#glo:sym.information"><span title="Information" class="icon">🛈</span></a></div><!-- end of informationtitle --> +The <a id="wrglossary.2"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> package was originally part of the <a id="wrglossary.3"></a><a href="#glo:pkg.glossaries"><span class="styfmt">glossaries</span></a> bundle (added to <a id="wrglossary.4"></a><a href="#glo:pkg.glossaries"><span class="styfmt">glossaries</span></a> v1.12 in 2008) for use with commands like <a id="wrglossary.5"></a><a href="#glo:Gls"><code class="csfmt">\Gls</code></a>, which need to have the first letter converted to uppercase (<a id="wrglossary.6"></a><a href="#glo:dual.sentence-case">sentence-case</a>), but as the commands provided by <a id="wrglossary.7"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> may be used without <a id="wrglossary.8"></a><a href="#glo:pkg.glossaries"><span class="styfmt">glossaries</span></a>, the two were split into separately maintained packages in 2015 (<a id="wrglossary.9"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v2.0 and <a id="wrglossary.10"></a><a href="#glo:pkg.glossaries"><span class="styfmt">glossaries</span></a> v4.18). </div><!-- end of information --> +<p> +Version 2.08 has reimplemented <a id="wrglossary.11"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a> using LaTeX3 commands. If there are any compatibility issues, you can rollback to v2.07: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.12"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><code class="cmd">\usepackage</code>{mfirstuc}[=2.07] +</pre><p> +<nav class="toc"> +<section id="toc"><!-- start of section toc --><div class="tomain"><a href="#main">[top]</a></div> +<h1><!-- start of chapter header -->Contents<div class="labellink"><a href="#toc">[link]</a></div></h1><!-- end of chapter header --> + +<ul> +<li class="toc-chapter"><a href="#sec:sentencecase"><span class="numberline">1</span>Sentence-Case</a></li><!-- end of toc-chapter --> + +<ul> +<li class="toc-section"><a href="#sec:sentencecaseex"><span class="numberline">1.1</span>Examples</a></li><!-- end of toc-section --> + +<li class="toc-section"><a href="#sec:sentencecasecmds"><span class="numberline">1.2</span>Sentence Case Commands</a></li><!-- end of toc-section --> + +<li class="toc-section"><a href="#sec:exclusions"><span class="numberline">1.3</span>Exclusions</a></li><!-- end of toc-section --> + +<li class="toc-section"><a href="#sec:blockers"><span class="numberline">1.4</span>Blockers</a></li><!-- end of toc-section --> + +<li class="toc-section"><a href="#sec:mappings"><span class="numberline">1.5</span>Mappings</a></li><!-- end of toc-section --> + +<li class="toc-section"><a href="#sec:pkgoptions"><span class="numberline">1.6</span>Package Options</a></li><!-- end of toc-section --> +</ul> +<li class="toc-chapter"><a href="#sec:capitalisewords"><span class="numberline">2</span>Title-Case</a></li><!-- end of toc-chapter --> + +<ul> +<li class="toc-section"><a href="#sec:nocap"><span class="numberline">2.1</span>Excluding Words From Case-Changing</a></li><!-- end of toc-section --> + +<li class="toc-section"><a href="#sec:pdfbookmarks"><span class="numberline">2.2</span>PDF Bookmarks</a></li><!-- end of toc-section --> + +<li class="toc-section"><a href="#sec:titlecaseexamples"><span class="numberline">2.3</span>Examples</a></li><!-- end of toc-section --> +</ul> +<li class="toc-chapter"><a href="#sec:misc"><span class="numberline">3</span>Miscellaneous</a></li><!-- end of toc-chapter --> + +<ul> +<li class="toc-section"><a href="#sec:savetoaux"><span class="numberline">3.1</span>Saving exclusions, blockers and mappings in the <span class="extfmt">aux</span> File</a></li><!-- end of toc-section --> + +<li class="toc-section"><a href="#sec:allcaps"><span class="numberline">3.2</span>All-Caps</a></li><!-- end of toc-section --> + +<li class="toc-section"><a href="#sec:utf8"><span class="numberline">3.3</span>UTF-8</a></li><!-- end of toc-section --> +</ul> +<li class="toc-chapter"><a href="#symbols">Symbols</a></li><!-- end of toc-chapter --> + +<li class="toc-chapter"><a href="#glossary">Glossary</a></li><!-- end of toc-chapter --> + +<li class="toc-chapter"><a href="#cmdsummary">Command Summary</a></li><!-- end of toc-chapter --> + +<ul> +<li class="toc-section"><a href="#summary.index@">Command Summary: @</a></li><!-- end of toc-section --> + +<li class="toc-section"><a href="#summary.index6684672">Command Summary: C</a></li><!-- end of toc-section --> + +<li class="toc-section"><a href="#summary.index6815744">Command Summary: E</a></li><!-- end of toc-section --> + +<li class="toc-section"><a href="#summary.index6946816">Command Summary: G</a></li><!-- end of toc-section --> + +<li class="toc-section"><a href="#summary.index7077888">Command Summary: I</a></li><!-- end of toc-section --> + +<li class="toc-section"><a href="#summary.index7340032">Command Summary: M</a></li><!-- end of toc-section --> + +<li class="toc-section"><a href="#summary.index8060928">Command Summary: X</a></li><!-- end of toc-section --> +</ul> +<li class="toc-chapter"><a href="#index">Index</a></li><!-- end of toc-chapter --> + </ul></nav><!-- end of toc --><p> + +</section><!-- end of section toc --> + +<section id="sec:sentencecase"><!-- start of section sec:sentencecase --><div class="tomain"><a href="#main">[top]</a></div> +<h1><!-- start of chapter header -->1. Sentence-Case<div class="labellink"><a href="#sec:sentencecase">[link]</a></div></h1><!-- end of chapter header --> +<p> +There are two <a id="wrglossary.13"></a><a href="#glo:dual.sentence-case">sentence-case</a> commands provided: <a id="wrglossary.14"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a> and <a id="wrglossary.15"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>. A summary of the principle features of the two commands is given in Table <a href="#tab:sentencecasesummary">1.1</a>.<p> +<div class="table"> <table class="tabular-c"> +<caption id="tab:sentencecasesummary">Table 1: Principle features of <code class="csfmt">\MFUsentencecase</code> and <code class="csfmt">\makefirstuc</code></caption><tr style=""><th class="cell-noborder-bothsep-l">Feature </th> +<td class="cell-noborder-bothsep-c"> <span style="font-weight: bold; "><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a> </span></td> +<td class="cell-noborder-bothsep-c"> <span style="font-weight: bold; "><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a></span></td> +</tr><tr style=""><td class="cell-noborder-bothsep-l">Can expand? </td> +<td class="cell-noborder-bothsep-c"> <span class="advantage"><span title="yes" class="icon">✔</span></span></td> +<td class="cell-noborder-bothsep-c"> <span class="disadvantage"><span title="no" class="icon">✖</span></span></td> +</tr><tr style=""><td class="cell-noborder-bothsep-l">Supports <a href="#glo:dual.exclusion">exclusions</a>? </td> +<td class="cell-noborder-bothsep-c"> <span class="advantage"><span title="yes" class="icon">✔</span></span></td> +<td class="cell-noborder-bothsep-c"> <span class="advantage"><span title="yes" class="icon">✔</span></span></td> +</tr><tr style=""><td class="cell-noborder-bothsep-l">Supports <a href="#glo:dual.blocker">blockers</a>? </td> +<td class="cell-noborder-bothsep-c"> <span class="disadvantage"><span title="no" class="icon">✖</span></span></td> +<td class="cell-noborder-bothsep-c"> <span class="advantage"><span title="yes" class="icon">✔</span></span></td> +</tr><tr style=""><td class="cell-noborder-bothsep-l">Supports <a href="#glo:dual.mapping">mappings</a>? </td> +<td class="cell-noborder-bothsep-c"> <span class="disadvantage"><span title="no" class="icon">✖</span></span></td> +<td class="cell-noborder-bothsep-c"> <span class="advantage"><span title="yes" class="icon">✔</span></span></td> +</tr><tr style=""><td class="cell-noborder-bothsep-l">Semantic commands must be robust? </td> +<td class="cell-noborder-bothsep-c"> <span class="disadvantage"><span title="yes" class="icon">✔</span></span></td> +<td class="cell-noborder-bothsep-c"> <span class="advantage"><span title="no" class="icon">✖</span></span></td> +</tr></table> + </div><p> + +</section><!-- end of section sec:sentencecase --> + +<section id="sec:sentencecaseex"><!-- start of section sec:sentencecaseex --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->1.1. Examples<div class="labellink"><a href="#sec:sentencecaseex">[link]</a></div></h2><!-- end of section header --> +<p> +Text only (leading <a id="wrglossary.16"></a><a href="#glo:dual.utf8">UTF-8</a> now supported): <div style="text-align: center; border-style: none; "><a id="wrglossary.17"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a><a id="wrglossary.18"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of frame@coderesult@title --> +<p> +<pre class="sidebysidecode"> +<a id="wrglossary.19"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{élite} / +<a id="wrglossary.20"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>{élite} +</pre><div class="sidebysideresult">Élite / Élite </div><p> +<p> +Leading <a id="wrglossary.21"></a><a href="#glo:idx.punctuation">punctuation</a> is ignored: <div style="text-align: center; border-style: none; "><a id="wrglossary.22"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a><a id="wrglossary.23"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of frame@coderesult@title --> +<p> +<pre class="sidebysidecode"> +<a id="wrglossary.24"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{`word'} / +<a id="wrglossary.25"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>{`word'} +</pre><div class="sidebysideresult">‘Word’ / ‘Word’ </div><p> + However, if the <a id="wrglossary.26"></a><a href="#glo:idx.punctuation">punctuation</a> character is followed by a <a id="wrglossary.27"></a><a href="#glo:dual.blocker">blocker</a> or <a id="wrglossary.28"></a><a href="#glo:dual.mapping">mapping</a> command, the <a id="wrglossary.29"></a><a href="#glo:idx.punctuation">punctuation</a> will need to be excluded otherwise the command will be treated as an <a id="wrglossary.30"></a><a href="#glo:dual.exclusion">exclusion</a>. If possible, use <a id="wrglossary.31"></a><a href="#glo:@@glslabel@semanticcommand">semantic markup</a> instead of directly including the <a id="wrglossary.32"></a><a href="#glo:idx.punctuation">punctuation</a>.<p> +Fragile commands need to be protected with <a id="wrglossary.33"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.34"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><code class="cmd">\newcommand</code>{<code class="cmd">\alert</code>}[1]{<code class="cmd">\textcolor</code>{red}{<code class="cmd">\textbf</code>{#1}}} +<a id="wrglossary.35"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{<code class="cmd">\alert</code>{élite}} / +<a id="wrglossary.36"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>{<strong class="strong"><code class="cmd">\protect</code></strong><code class="cmd">\alert</code>{élite}} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.37"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> + <span style="color: rgb(255,0,0)"><span style="font-weight: bold; ">Élite</span></span> / <span style="color: rgb(255,0,0)"><span style="font-weight: bold; ">Élite</span></span> </div><!-- end of resultbox --> +<p> +<a id="wrglossary.38"></a><a href="#glo:dual.exclusion">Exclusions</a> are supported by both <a id="wrglossary.39"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a> and <a id="wrglossary.40"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.41"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><a id="wrglossary.42"></a><a href="#glo:MFUexcl"><code class="csfmt">\MFUexcl</code></a>{<a id="wrglossary.43"></a><a href="#glo:index"><code class="csfmt">\index</code></a>} +<a id="wrglossary.44"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{<a id="wrglossary.45"></a><a href="#glo:index"><code class="csfmt">\index</code></a>{word}example} / +<a id="wrglossary.46"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>{<a id="wrglossary.47"></a><a href="#glo:index"><code class="csfmt">\index</code></a>{word}example} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.48"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> + Example / Example </div><!-- end of resultbox --> +<p> +<a id="wrglossary.49"></a><a href="#glo:dual.blocker">Blockers</a> are only supported by <a id="wrglossary.50"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>. They are treated as <a id="wrglossary.51"></a><a href="#glo:dual.exclusion">exclusions</a> with <a id="wrglossary.52"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>, which produces a different result: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.53"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><a id="wrglossary.54"></a><a href="#glo:MFUblocker"><code class="csfmt">\MFUblocker</code></a>{<a id="wrglossary.55"></a><a href="#glo:nameref"><code class="csfmt">\nameref</code></a>} +<a id="wrglossary.56"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{<a id="wrglossary.57"></a><a href="#glo:nameref"><code class="csfmt">\nameref</code></a>{sec:sentencecase} section} / +<a id="wrglossary.58"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>{<a id="wrglossary.59"></a><a href="#glo:nameref"><code class="csfmt">\nameref</code></a>{sec:sentencecase} section} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.60"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> + <a href="#sec:sentencecase">Sentence-Case</a> section / <a href="#sec:sentencecase">Sentence-Case</a> Section </div><!-- end of resultbox --> +<p> +<a id="wrglossary.61"></a><a href="#glo:dual.mapping">Mappings</a> are only supported by <a id="wrglossary.62"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>. They are treated as <a id="wrglossary.63"></a><a href="#glo:dual.exclusion">exclusions</a> with <a id="wrglossary.64"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>, which produces a different result: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.65"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><code class="cmd">\newrobustcmd</code>{<code class="cmd">\secref</code>}[1]{section~<code class="cmd">\ref</code>{#1}} +<code class="cmd">\newrobustcmd</code>{<code class="cmd">\Secref</code>}[1]{Section~<code class="cmd">\ref</code>{#1}} +<a id="wrglossary.66"></a><a href="#glo:MFUaddmap"><code class="csfmt">\MFUaddmap</code></a>{<code class="cmd">\secref</code>}{<code class="cmd">\Secref</code>} +<a id="wrglossary.67"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{<code class="cmd">\secref</code>{sec:sentencecase} example} / +<a id="wrglossary.68"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>{<code class="cmd">\secref</code>{sec:sentencecase} example} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.69"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> + Section <a href="#sec:sentencecase">1</a> example / section <a href="#sec:sentencecase">1</a> Example </div><!-- end of resultbox --> +<p> +Argument expansion: <a id="wrglossary.70"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a> expands its argument and then skips exclusions whereas <a id="wrglossary.71"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a> parses its argument without expansion and then passes the relevant content to <a id="wrglossary.72"></a><a href="#glo:glsmakefirstuc"><code class="csfmt">\glsmakefirstuc</code></a>. Note that different results will occur with the <a id="wrglossary.73"></a><a href="#glo:opt.expanded"><span class="optfmt">expanded</span></a> and <a id="wrglossary.74"></a><a href="#glo:opt.unexpanded"><span class="optfmt">unexpanded</span></a> package options. For example: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.75"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><code class="cmd">\usepackage</code>[<a id="wrglossary.76"></a><a href="#glo:opt.expanded"><span class="optfmt">expanded</span></a>]{mfirstuc} +<code class="cmd">\newcommand</code>{<code class="cmd">\testa</code>}{sample} +<code class="cmd">\newcommand</code>{<code class="cmd">\testb</code>}{<code class="cmd">\testa</code><code class="cmd">\ </code>test} +<code class="cbeg">\begin{document}</code> +<a id="wrglossary.77"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{<code class="cmd">\testb</code>} / <a id="wrglossary.78"></a><a href="#glo:xmakefirstuc"><code class="csfmt">\xmakefirstuc</code></a>{<code class="cmd">\testb</code>} / +<a id="wrglossary.79"></a><a href="#glo:emakefirstuc"><code class="csfmt">\emakefirstuc</code></a>{<code class="cmd">\testb</code>} / <a id="wrglossary.80"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>{<code class="cmd">\testb</code>} +<code class="cend">\end{document}</code> +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.81"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> +Sample test / Sample test / Sample test / Sample test </div><!-- end of resultbox --> + With the default <a id="wrglossary.82"></a><a href="#glo:opt.unexpanded"><span class="optfmt">unexpanded</span></a> option the result is: <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.83"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> + sample test / sample Test / Sample test / Sample test </div><!-- end of resultbox --> + Note that this is different from the result in earlier versions of <a id="wrglossary.84"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a>. <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.85"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><code class="cmd">\usepackage</code>{mfirstuc}[=v2.07] +<code class="cmd">\newcommand</code>{<code class="cmd">\testa</code>}{sample} +<code class="cmd">\newcommand</code>{<code class="cmd">\testb</code>}{<code class="cmd">\testa</code><code class="cmd">\ </code>test} +<code class="cbeg">\begin{document}</code> +<a id="wrglossary.86"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{<code class="cmd">\testb</code>} / <a id="wrglossary.87"></a><a href="#glo:xmakefirstuc"><code class="csfmt">\xmakefirstuc</code></a>{<code class="cmd">\testb</code>} / +<a id="wrglossary.88"></a><a href="#glo:emakefirstuc"><code class="csfmt">\emakefirstuc</code></a>{<code class="cmd">\testb</code>} +<code class="cend">\end{document}</code> +</pre> This produces: <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.89"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> +SAMPLE TEST / SAMPLE test / Sample test </div><!-- end of resultbox --> + If this old result is required, either use rollback or try the <a id="wrglossary.90"></a><a href="#glo:opt.grabfirst"><span class="optfmt">grabfirst</span></a> option.<p> +Argument expansion with <a id="wrglossary.91"></a><a href="#glo:dual.mapping">mappings</a> (and the default <a id="wrglossary.92"></a><a href="#glo:opt.unexpanded"><span class="optfmt">unexpanded</span></a> option): <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.93"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><code class="cmd">\newrobustcmd</code>{<code class="cmd">\secref</code>}[1]{section~<code class="cmd">\ref</code>{#1}} +<code class="cmd">\newrobustcmd</code>{<code class="cmd">\Secref</code>}[1]{Section~<code class="cmd">\ref</code>{#1}} +<a id="wrglossary.94"></a><a href="#glo:MFUaddmap"><code class="csfmt">\MFUaddmap</code></a>{<code class="cmd">\secref</code>}{<code class="cmd">\Secref</code>} +<code class="cmd">\newcommand</code>{<code class="cmd">\testa</code>}{<code class="cmd">\secref</code>{sec:sentencecase}} +<code class="cmd">\newcommand</code>{<code class="cmd">\testb</code>}{<code class="cmd">\testa</code><code class="cmd">\ </code>example} +<a id="wrglossary.95"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{<code class="cmd">\testb</code>} / <a id="wrglossary.96"></a><a href="#glo:xmakefirstuc"><code class="csfmt">\xmakefirstuc</code></a>{<code class="cmd">\testb</code>} / +<a id="wrglossary.97"></a><a href="#glo:emakefirstuc"><code class="csfmt">\emakefirstuc</code></a>{<code class="cmd">\testb</code>} / <a id="wrglossary.98"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>{<code class="cmd">\testb</code>} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.99"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> + section <a href="#sec:sentencecase">1</a> example / section <a href="#sec:sentencecase">1</a> Example / Section <a href="#sec:sentencecase">1</a> example / section <a href="#sec:sentencecase">1</a> Example </div><!-- end of resultbox --> +<p> + +</section><!-- end of section sec:sentencecaseex --> + +<section id="sec:sentencecasecmds"><!-- start of section sec:sentencecasecmds --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->1.2. Sentence Case Commands<div class="labellink"><a href="#sec:sentencecasecmds">[link]</a></div></h2><!-- end of section header --> +<p> +<div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.100"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.101"></a><code class="code"><dfn id="glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></dfn>{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code></div><!-- end of pinnedbox --> + This simply uses <a id="wrglossary.102"></a><a href="#glo:texttitlecasefirst:n"><code class="csfmt">\text_titlecase_first:n</code></a>, which is provided by the LaTeX3 kernel. Note that this fully expands the argument. If you use this command, ensure that your <a id="wrglossary.103"></a><a href="#glo:dual.semanticcommand">semantic commands</a> are robust. For example: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.104"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><code class="cmd">\newrobustcmd</code>{<code class="cmd">\alert</code>}[1]{<code class="cmd">\textcolor</code>{red}{<code class="cmd">\textbf</code>{#1}}} +<a id="wrglossary.105"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>{<code class="cmd">\alert</code>{sample} text} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.106"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> + <span style="color: rgb(255,0,0)"><span style="font-weight: bold; ">Sample</span></span> text </div><!-- end of resultbox --> + Note that the following will fail: <pre class="badcodebox"><div class="badcodeboxtitle"><a id="wrglossary.107"></a><a href="#glo:sym.badcode"><span title="Problematic Input" class="icon"><span class="overlapped">🖹</span><span class="overlapper"><span class="deprecatedorbannedfmt">🛇</span></span></span></a></div><code class="cmd">\newcommand</code>{<code class="cmd">\alert</code>}[1]{<code class="cmd">\textcolor</code>{red}{<code class="cmd">\textbf</code>{#1}}} +<a id="wrglossary.108"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>{<code class="cmd">\alert</code>{sample} text} +</pre> This is because the expansion that’s performed before the case-change will result in: <pre class="badcodebox"><div class="badcodeboxtitle"><a id="wrglossary.109"></a><a href="#glo:sym.badcode"><span title="Problematic Input" class="icon"><span class="overlapped">🖹</span><span class="overlapper"><span class="deprecatedorbannedfmt">🛇</span></span></span></a></div><code class="cmd">\textcolor</code>{Red}{<code class="cmd">\textbf</code>{sample}} text +</pre> This triggers an error since <code class="code">Red</code> isn’t a recognised colour name.<p> +<div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.110"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.111"></a><code class="code"><dfn id="glo:makefirstuc"><code class="csfmt">\makefirstuc</code></dfn>{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code></div><!-- end of pinnedbox --> + This is the original command provided by <a id="wrglossary.112"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a>, which was written to assist sentence-casing in the <a id="wrglossary.113"></a><a href="#glo:pkg.glossaries"><span class="styfmt">glossaries</span></a> package and had to take markup into account. It parses its argument to try to determine which part needs the case-change. The actual case-change is performed by <a id="wrglossary.114"></a><a href="#glo:glsmakefirstuc"><code class="csfmt">\glsmakefirstuc</code></a>.<p> +As from v2.08, the definition of <a id="wrglossary.115"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a> has been updated to use LaTeX3 code, but the argument is still parsed, which allows for non-robust <a id="wrglossary.116"></a><a href="#glo:dual.semanticcommand">semantic commands</a>, and now also takes <a id="wrglossary.117"></a><a href="#glo:dual.blocker">blockers</a> and <a id="wrglossary.118"></a><a href="#glo:dual.mapping">mappings</a> into account. For example: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.119"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><code class="cmd">\newcommand</code>{<code class="cmd">\alert</code>}[1]{<code class="cmd">\textcolor</code>{red}{<code class="cmd">\textbf</code>{#1}}} +<a id="wrglossary.120"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{<code class="cmd">\alert</code>{sample} text} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.121"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> + <span style="color: rgb(255,0,0)"><span style="font-weight: bold; ">Sample</span></span> text </div><!-- end of resultbox --> +<p> +The rules used when parsing <code class="code"><a id="wrglossary.122"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code> are as follows: +<ol class="displaylist"> + <li><span class="numitem">1.</span>if <span class="meta">〈<em class="metainner">text</em>〉</span> is empty do nothing;<p> +<li><span class="numitem">2.</span>if <span class="meta">〈<em class="metainner">text</em>〉</span> consists of a single item or starts with a group do <code class="code"><a id="wrglossary.123"></a><a href="#glo:glsmakefirstuc"><code class="csfmt">\glsmakefirstuc</code></a>{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code>;<p> +<li><span class="numitem">3.</span>if <span class="meta">〈<em class="metainner">text</em>〉</span> starts with a command <span class="meta">〈<em class="metainner">cs</em>〉</span>:<p> + +<ol class="displaylist"> + <li><span class="numitem">(a)</span>if <span class="meta">〈<em class="metainner">cs</em>〉</span> is <a id="wrglossary.124"></a><a href="#glo:protect"><code class="csfmt">\protect</code></a>, skip it and continue to the next step where the command <span class="meta">〈<em class="metainner">cs</em>〉</span> under inspection is now the one that follows <a id="wrglossary.125"></a><a href="#glo:protect"><code class="csfmt">\protect</code></a>:<p> +<li><span class="numitem">(b)</span>if <span class="meta">〈<em class="metainner">cs</em>〉</span> has been identified as a <a id="wrglossary.126"></a><a href="#glo:dual.blocker">blocker</a>, just do <span class="meta">〈<em class="metainner">text</em>〉</span> (that is, no case-change is applied);<p> +<li><span class="numitem">(c)</span>if <span class="meta">〈<em class="metainner">cs</em>〉</span> isn’t followed by a group then do <code class="code"><a id="wrglossary.127"></a><a href="#glo:glsmakefirstuc"><code class="csfmt">\glsmakefirstuc</code></a>{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code>;<p> +<li><span class="numitem">(d)</span>otherwise assume the format is <code class="code"><span class="meta">〈<em class="metainner">cs</em>〉</span>{<span class="meta">〈<em class="metainner">arg</em>〉</span>}<span class="meta">〈<em class="metainner">following</em>〉</span></code> (where <span class="meta">〈<em class="metainner">following</em>〉</span> may be empty) and then:<p> + +<ol class="displaylist"> + <li><span class="numitem">i.</span>if <span class="meta">〈<em class="metainner">cs</em>〉</span> has been <a id="wrglossary.128"></a><a href="#glo:@@glslabel@mapping">mapped</a> to <span class="meta">〈<em class="metainner">Cs</em>〉</span> then do <code class="code"><span class="meta">〈<em class="metainner">Cs</em>〉</span>{<span class="meta">〈<em class="metainner">arg</em>〉</span>}<span class="meta">〈<em class="metainner">following</em>〉</span></code>;<p> +<li><span class="numitem">ii.</span>if <span class="meta">〈<em class="metainner">cs</em>〉</span> has been identified as an <a id="wrglossary.129"></a><a href="#glo:dual.exclusion">exclusion</a>, do <code class="code"><span class="meta">〈<em class="metainner">cs</em>〉</span>{<span class="meta">〈<em class="metainner">arg</em>〉</span>}<a id="wrglossary.130"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{<span class="meta">〈<em class="metainner">following</em>〉</span>}</code>;<p> +<li><span class="numitem">iii.</span>otherwise do <code class="code"><span class="meta">〈<em class="metainner">cs</em>〉</span>{<a id="wrglossary.131"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{<span class="meta">〈<em class="metainner">arg</em>〉</span>}}<span class="meta">〈<em class="metainner">following</em>〉</span></code>. +</ol> +<p> + +</ol> +<p> +<li><span class="numitem">4.</span>otherwise do <code class="code"><a id="wrglossary.132"></a><a href="#glo:glsmakefirstuc"><code class="csfmt">\glsmakefirstuc</code></a>{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code>. +</ol> +<p> +Note that the above algorithm uses recursion. The termination points are: don’t implement a change, replace a command with another command, or apply the case-change via <a id="wrglossary.133"></a><a href="#glo:glsmakefirstuc"><code class="csfmt">\glsmakefirstuc</code></a>.<p> +For convenience, the following commands are also provided: <div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.134"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.135"></a><code class="code"><dfn id="glo:xmakefirstuc"><code class="csfmt">\xmakefirstuc</code></dfn>{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code></div><!-- end of pinnedbox --> + This is simply a shortcut for: <pre class="compactcodebox"><code class="cmd">\expandafter</code><a id="wrglossary.136"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a><code class="cmd">\expandafter</code>{<span class="meta">〈<em class="metainner">text</em>〉</span>} +</pre> This ensures the first token in <span class="meta">〈<em class="metainner">text</em>〉</span> is expanded before being passed to <a id="wrglossary.137"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>.<p> +<div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.138"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.139"></a><code class="code"><dfn id="glo:emakefirstuc"><code class="csfmt">\emakefirstuc</code></dfn>{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code></div><!-- end of pinnedbox --> + This fully expands its argument before passing it to <a id="wrglossary.140"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>. For example: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.141"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><code class="cmd">\newcommand</code>{<code class="cmd">\test</code>}[1]{sample #1} +<code class="cmd">\newcommand</code>{<code class="cmd">\tmp</code>}{<code class="cmd">\test</code>{text}} +<a id="wrglossary.142"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{<code class="cmd">\tmp</code>} / +<a id="wrglossary.143"></a><a href="#glo:xmakefirstuc"><code class="csfmt">\xmakefirstuc</code></a>{<code class="cmd">\tmp</code>} / +<a id="wrglossary.144"></a><a href="#glo:emakefirstuc"><code class="csfmt">\emakefirstuc</code></a>{<code class="cmd">\tmp</code>} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.145"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> + sample text / sample Text / Sample text </div><!-- end of resultbox --> + If you don’t have any mappings or blockers set up, it’s simpler to use <a id="wrglossary.146"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a> instead of <a id="wrglossary.147"></a><a href="#glo:emakefirstuc"><code class="csfmt">\emakefirstuc</code></a>.<p> +<div class="important"><div class="importanttitle"><a id="wrglossary.148"></a><a href="#glo:sym.important"><span title="Important" class="icon">ℹ</span></a></div><!-- end of importanttitle --> +With <a id="wrglossary.149"></a><a href="#glo:emakefirstuc"><code class="csfmt">\emakefirstuc</code></a>, mappings and blockers will only be detected if they are robust or protected, otherwise they will expand too soon to be detected. </div><!-- end of important --> +<p> +<div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.150"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.151"></a><code class="code"><dfn id="glo:glsmakefirstuc"><code class="csfmt">\glsmakefirstuc</code></dfn>{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code></div><!-- end of pinnedbox --> + This command is used by <a id="wrglossary.152"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a> to perform the case-change. The <span class="qt">“gls”</span> prefix is for historical reasons as the original code was part of the <a id="wrglossary.153"></a><a href="#glo:pkg.glossaries"><span class="styfmt">glossaries</span></a> package. With the default <a id="wrglossary.154"></a><a href="#glo:opt.unexpanded"><span class="optfmt">unexpanded</span></a> option, this command is defined as: <pre class="compactcodebox"><a id="wrglossary.155"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>{<a id="wrglossary.156"></a><a href="#glo:unexpanded"><code class="csfmt">\unexpanded</code></a>{<span class="meta">〈<em class="metainner">text</em>〉</span>}} +</pre> The use of <a id="wrglossary.157"></a><a href="#glo:unexpanded"><code class="csfmt">\unexpanded</code></a> inhibits the expansion of <span class="meta">〈<em class="metainner">text</em>〉</span> that would otherwise occur. This allows <a id="wrglossary.158"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a> to maintain as much backward-compatibility with version 2.07 as possible. This is particularly important when using the <a id="wrglossary.159"></a><a href="#glo:pkg.glossaries"><span class="styfmt">glossaries</span></a> package with a style that automatically converts the description to <a id="wrglossary.160"></a><a href="#glo:dual.sentence-case">sentence-case</a>, as there may well be documents with complex descriptions that contain fragile commands.<p> +The <a id="wrglossary.161"></a><a href="#glo:opt.expanded"><span class="optfmt">expanded</span></a> package option will redefine <a id="wrglossary.162"></a><a href="#glo:glsmakefirstuc"><code class="csfmt">\glsmakefirstuc</code></a> to use <a id="wrglossary.163"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a> without <a id="wrglossary.164"></a><a href="#glo:unexpanded"><code class="csfmt">\unexpanded</code></a>. The <a id="wrglossary.165"></a><a href="#glo:opt.grabfirst"><span class="optfmt">grabfirst</span></a> package option will redefine <a id="wrglossary.166"></a><a href="#glo:glsmakefirstuc"><code class="csfmt">\glsmakefirstuc</code></a> to use <a id="wrglossary.167"></a><a href="#glo:mfugrabfirstuc"><code class="csfmt">\mfugrabfirstuc</code></a> to emulates the behaviour of <a id="wrglossary.168"></a><a href="#glo:glsmakefirstuc"><code class="csfmt">\glsmakefirstuc</code></a> in v2.07 and below without using rollback.<p> +<div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.169"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.170"></a><code class="code"><dfn id="glo:mfugrabfirstuc"><code class="csfmt">\mfugrabfirstuc</code></dfn>{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code><p> +<div class="noteBox">avoid where possible</div><!-- end of noteBox --> +</div><!-- end of pinnedbox --> + This robust command is provided to emulate v2.07 and its use is discouraged. Note that you may still have different results compared to v2.07, so you may need to use rollback instead. (Note that the <a id="wrglossary.171"></a><a href="#glo:opt.grabfirst"><span class="optfmt">grabfirst</span></a> option additionally redefines <a id="wrglossary.172"></a><a href="#glo:mfirstucMakeUppercase"><code class="csfmt">\mfirstucMakeUppercase</code></a> to <a id="wrglossary.173"></a><a href="#glo:MakeUppercase"><code class="csfmt">\MakeUppercase</code></a>, which you will also need.)<p> +This applies <a id="wrglossary.174"></a><a href="#glo:mfirstucMakeUppercase"><code class="csfmt">\mfirstucMakeUppercase</code></a> to the first token in <span class="meta">〈<em class="metainner">text</em>〉</span> and leaves the remainder unchanged. This won’t work if <span class="meta">〈<em class="metainner">text</em>〉</span> starts with a <a id="wrglossary.175"></a><a href="#glo:utf8">UTF-8</a> character unless you use XeLaTeX or LuaLaTeX, so avoid using this method where possible. For example: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.176"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><code class="cmd">\renewcommand</code>{<a id="wrglossary.177"></a><a href="#glo:mfirstucMakeUppercase"><code class="csfmt">\mfirstucMakeUppercase</code></a>}[1]{<span class="comment">% </span> + <a id="wrglossary.178"></a><a href="#glo:MakeUppercase"><code class="csfmt">\MakeUppercase</code></a>{#1}<span class="comment">% </span> +} +<a id="wrglossary.179"></a><a href="#glo:mfugrabfirstuc"><code class="csfmt">\mfugrabfirstuc</code></a>{sample} +</pre> This is equivalent to: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.180"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><a id="wrglossary.181"></a><a href="#glo:mfirstucMakeUppercase"><code class="csfmt">\mfirstucMakeUppercase</code></a>{s}ample +</pre> Whereas <pre class="unicodebox"><div class="unicodeboxtitle"><a id="wrglossary.182"></a><a href="#glo:sym.unicode"><span title="Unicode Input" class="icon"><span class="overlapped">🗋</span><span class="overlapper">U</span></span></a></div><code class="cmd">\renewcommand</code>{<a id="wrglossary.183"></a><a href="#glo:mfirstucMakeUppercase"><code class="csfmt">\mfirstucMakeUppercase</code></a>}[1]{<span class="comment">% </span> + <a id="wrglossary.184"></a><a href="#glo:MakeUppercase"><code class="csfmt">\MakeUppercase</code></a>{#1}<span class="comment">% </span> +} +<a id="wrglossary.185"></a><a href="#glo:mfugrabfirstuc"><code class="csfmt">\mfugrabfirstuc</code></a>{élite} +</pre> only works with XeLaTeX or LuaLaTeX.<p> +<div class="warning"><div class="warningtitle"><a id="wrglossary.186"></a><a href="#glo:sym.warning"><span title="Warning" class="icon">⚠</span></a></div><!-- end of warningtitle --> +As with earlier implementations of <a id="wrglossary.187"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a> that tried to only apply the case-change to the first token, this won’t produce the desired result if the argument starts with a punctuation character. </div><!-- end of warning --> +<p> +For example: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.188"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><a id="wrglossary.189"></a><a href="#glo:mfugrabfirstuc"><code class="csfmt">\mfugrabfirstuc</code></a>{`sample'} +</pre> This is equivalent to: <pre class="compactcodebox"><a id="wrglossary.190"></a><a href="#glo:mfirstucMakeUppercase"><code class="csfmt">\mfirstucMakeUppercase</code></a>{`}sample' +</pre> so no case-change is applied.<p> + +</section><!-- end of section sec:sentencecasecmds --> + +<section id="sec:exclusions"><!-- start of section sec:exclusions --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->1.3. Exclusions<div class="labellink"><a href="#sec:exclusions">[link]</a></div></h2><!-- end of section header --> +<p> +<div class="information"><div class="informationtitle"><a id="wrglossary.191"></a><a href="#glo:sym.information"><span title="Information" class="icon">🛈</span></a></div><!-- end of informationtitle --> +Exclusions will apply to all LaTeX3 case-changing commands, so will also affect <a id="wrglossary.192"></a><a href="#glo:mfirstucMakeUppercase"><code class="csfmt">\mfirstucMakeUppercase</code></a>, but this is generally desirable. </div><!-- end of information --> +<p> +<div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.193"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.194"></a><code class="code"><dfn id="glo:MFUexcl"><code class="csfmt">\MFUexcl</code></dfn>{<span class="meta">〈<em class="metainner">cs</em>〉</span>}</code></div><!-- end of pinnedbox --> + Identifies the text-block command <code class="code"><span class="meta">〈<em class="metainner">cs</em>〉</span>{<span class="meta">〈<em class="metainner">arg</em>〉</span>}</code> as an <a id="wrglossary.195"></a><a href="#glo:dual.exclusion">exclusion</a>. That is, one that should have its argument excluded from a case-change.<p> +Internally, <a id="wrglossary.196"></a><a href="#glo:MFUexcl"><code class="csfmt">\MFUexcl</code></a> adds <span class="meta">〈<em class="metainner">cs</em>〉</span> to LaTeX3’s exclusion list <a id="wrglossary.197"></a><a href="#glo:ltextcaseexcludeargtl"><code class="csfmt">\l_text_case_exclude_arg_tl</code></a>, which means that <a id="wrglossary.198"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a> will skip the command and its argument and apply the case-change to the following content. Some common commands (<a id="wrglossary.199"></a><a href="#glo:begin"><code class="csfmt">\begin</code></a> <a id="wrglossary.200"></a><a href="#glo:cite"><code class="csfmt">\cite</code></a> <a id="wrglossary.201"></a><a href="#glo:end"><code class="csfmt">\end</code></a> <a id="wrglossary.202"></a><a href="#glo:label"><code class="csfmt">\label</code></a> and <a id="wrglossary.203"></a><a href="#glo:ref"><code class="csfmt">\ref</code></a>) are automatically added by the LaTeX3 kernel. The exclusions are also recognised by <a id="wrglossary.204"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a> when it parses its argument.<p> +<div class="information"><div class="informationtitle"><a id="wrglossary.205"></a><a href="#glo:sym.information"><span title="Information" class="icon">🛈</span></a></div><!-- end of informationtitle --> +The command <a id="wrglossary.206"></a><a href="#glo:NoCaseChange"><code class="csfmt">\NoCaseChange</code></a> is automatically treated as an exclusion by the LaTeX3 case-changing commands with recent LaTeX kernels. You may want to add it as a blocker for <a id="wrglossary.207"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a> and keep <a id="wrglossary.208"></a><a href="#glo:MFUskippunc"><code class="csfmt">\MFUskippunc</code></a> for exclusions.<p> +Note that <a id="wrglossary.209"></a><a href="#glo:ensuremath"><code class="csfmt">\ensuremath</code></a> is added as an exclusion by <a id="wrglossary.210"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> otherwise <a id="wrglossary.211"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a> will pass its argument to <a id="wrglossary.212"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>, which will cause a problem. </div><!-- end of information --> +<p> +Another way of identifying content that should be excluded with <a id="wrglossary.213"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a> is to encapsulate it with: <div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.214"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.215"></a><code class="code"><dfn id="glo:MFUskippunc"><code class="csfmt">\MFUskippunc</code></dfn>{<span class="meta">〈<em class="metainner">content</em>〉</span>}</code></div><!-- end of pinnedbox --> + This is a robust command that simply does its argument and is automatically added to the exclusion list. This may be used for cases where the excluded command isn’t a simple text-block command that only has one mandatory argument or where leading punctuation is followed by a <a id="wrglossary.216"></a><a href="#glo:dual.blocker">blocker</a> or <a id="wrglossary.217"></a><a href="#glo:dual.mapping">mapping</a>.<p> +The command name stems from earlier versions where leading <a id="wrglossary.218"></a><a href="#glo:idx.punctuation">punctuation</a> needed to be skipped. This is no longer necessary, but the command remains as a general purpose robust exclusion command.<p> +For example, <a id="wrglossary.219"></a><a href="#glo:glsadd"><code class="csfmt">\glsadd</code></a> (provided by <a id="wrglossary.220"></a><a href="#glo:pkg.glossaries"><span class="styfmt">glossaries</span></a>) should have its argument skipped, since its argument is a label, so the following will ensure that <code class="code"><a id="wrglossary.221"></a><a href="#glo:glsadd"><code class="csfmt">\glsadd</code></a>{<span class="meta">〈<em class="metainner">label</em>〉</span>}</code> will be skipped, and the case-change will be applied to the following text for both <a id="wrglossary.222"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a> and <a id="wrglossary.223"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>. <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.224"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><a id="wrglossary.225"></a><a href="#glo:MFUexcl"><code class="csfmt">\MFUexcl</code></a>{<a id="wrglossary.226"></a><a href="#glo:glsadd"><code class="csfmt">\glsadd</code></a>} +<a id="wrglossary.227"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{<a id="wrglossary.228"></a><a href="#glo:glsadd"><code class="csfmt">\glsadd</code></a>{ex}some text} +<a id="wrglossary.229"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>{<a id="wrglossary.230"></a><a href="#glo:glsadd"><code class="csfmt">\glsadd</code></a>{ex}some text} +</pre> This will be equivalent to: <pre class="compactcodebox"><a id="wrglossary.231"></a><a href="#glo:glsadd"><code class="csfmt">\glsadd</code></a>{ex}Some text +</pre> However, <a id="wrglossary.232"></a><a href="#glo:glsadd"><code class="csfmt">\glsadd</code></a> can take an optional argument which, if present, will cause a problem. For example: <pre class="badcodebox"><div class="badcodeboxtitle"><a id="wrglossary.233"></a><a href="#glo:sym.badcode"><span title="Problematic Input" class="icon"><span class="overlapped">🖹</span><span class="overlapper"><span class="deprecatedorbannedfmt">🛇</span></span></span></a></div><a id="wrglossary.234"></a><a href="#glo:MFUexcl"><code class="csfmt">\MFUexcl</code></a>{<a id="wrglossary.235"></a><a href="#glo:glsadd"><code class="csfmt">\glsadd</code></a>} +<a id="wrglossary.236"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{<a id="wrglossary.237"></a><a href="#glo:glsadd"><code class="csfmt">\glsadd</code></a>[counter=section]{ex}some text} +<a id="wrglossary.238"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>{<a id="wrglossary.239"></a><a href="#glo:glsadd"><code class="csfmt">\glsadd</code></a>[counter=section]{ex}some text} +</pre> Both commands will cause the following error: <pre class="transcript"><div class="transcripttitle"><a id="wrglossary.240"></a><a href="#glo:sym.transcript"><span title="Transcript" class="icon">🔎</span></a></div>! Package glossaries Error: Glossary entry `[' has not been defined. +</pre> This is because the open square bracket is assumed to be the argument of <a id="wrglossary.241"></a><a href="#glo:glsadd"><code class="csfmt">\glsadd</code></a>, so this effectively becomes: <pre class="compactcodebox"><a id="wrglossary.242"></a><a href="#glo:glsadd"><code class="csfmt">\glsadd</code></a>{[}Counter=section] exsome text +<a id="wrglossary.243"></a><a href="#glo:glsadd"><code class="csfmt">\glsadd</code></a>{[}Counter=section] exsome text +</pre> which means that now <code class="code">[</code> is considered the label and everything that follows is just text.<p> +For this situation to work, you need to encapsulate the problematic content with an exclusion command, such as <a id="wrglossary.244"></a><a href="#glo:NoCaseChange"><code class="csfmt">\NoCaseChange</code></a> or <a id="wrglossary.245"></a><a href="#glo:MFUskippunc"><code class="csfmt">\MFUskippunc</code></a>: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.246"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><a id="wrglossary.247"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{<a id="wrglossary.248"></a><a href="#glo:MFUskippunc"><code class="csfmt">\MFUskippunc</code></a>{<a id="wrglossary.249"></a><a href="#glo:glsadd"><code class="csfmt">\glsadd</code></a>[counter=section]{ex}}some text} +</pre> This will also work with <a id="wrglossary.250"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a> because <a id="wrglossary.251"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> automatically adds <a id="wrglossary.252"></a><a href="#glo:MFUskippunc"><code class="csfmt">\MFUskippunc</code></a> to the exclusion list.<p> +<div class="information"><div class="informationtitle"><a id="wrglossary.253"></a><a href="#glo:sym.information"><span title="Information" class="icon">🛈</span></a></div><!-- end of informationtitle --> +As from <a id="wrglossary.254"></a><a href="#glo:pkg.glossaries"><span class="styfmt">glossaries</span></a> v4.50, <a id="wrglossary.255"></a><a href="#glo:glsadd"><code class="csfmt">\glsadd</code></a> is automatically added as an exclusion, but be aware of the problem with using the optional argument, as described above. </div><!-- end of information --> +<p> +<a id="wrglossary.256"></a><a href="#glo:idx.punctuation">Punctuation</a> characters are skipped by <a id="wrglossary.257"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>. For example: <div style="text-align: center; border-style: none; "><a id="wrglossary.258"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a><a id="wrglossary.259"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of frame@coderesult@title --> +<p> +<pre class="sidebysidecode"> +<a id="wrglossary.260"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>{`word'} +</pre><div class="sidebysideresult">‘Word’ </div><p> + However, leading <a id="wrglossary.261"></a><a href="#glo:idx.punctuation">punctuation</a> will result in <a id="wrglossary.262"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a> passing its entire argument to <a id="wrglossary.263"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a> (since the argument doesn’t start with <code class="code"><span class="meta">〈<em class="metainner">cs</em>〉</span>{<span class="meta">〈<em class="metainner">arg</em>〉</span>}</code>), which means that <a id="wrglossary.264"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a> won’t detect any <a id="wrglossary.265"></a><a href="#glo:dual.blocker">blocker</a> or <a id="wrglossary.266"></a><a href="#glo:dual.mapping">mapping</a>.<p> +For example: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.267"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><a id="wrglossary.268"></a><a href="#glo:MFUblocker"><code class="csfmt">\MFUblocker</code></a>{<a id="wrglossary.269"></a><a href="#glo:nameref"><code class="csfmt">\nameref</code></a>} +<code class="cmd">\newcommand</code>*{<code class="cmd">\qt</code>}[1]{``#1''} +<a id="wrglossary.270"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{``<a id="wrglossary.271"></a><a href="#glo:nameref"><code class="csfmt">\nameref</code></a>{sec:sentencecase} section''} / +<a id="wrglossary.272"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{<a id="wrglossary.273"></a><a href="#glo:MFUskippunc"><code class="csfmt">\MFUskippunc</code></a>{``}<a id="wrglossary.274"></a><a href="#glo:nameref"><code class="csfmt">\nameref</code></a>{sec:sentencecase} section''} / +<a id="wrglossary.275"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{<code class="cmd">\qt</code>{<a id="wrglossary.276"></a><a href="#glo:nameref"><code class="csfmt">\nameref</code></a>{sec:sentencecase} section}} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.277"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> + “<a href="#sec:sentencecase">Sentence-Case</a> Section’’ / “<a href="#sec:sentencecase">Sentence-Case</a> section’’ / <span class="qt">“<a href="#sec:sentencecase">Sentence-Case</a> section”</span> </div><!-- end of resultbox --> + If you are using a package such as <a id="wrglossary.278"></a><a href="#glo:pkg.csquotes"><span class="styfmt">csquotes</span></a>, bear in mind that if the command is followed by an asterisk (a <span class="qt">“starred command”</span>) or an optional argument then it won’t fit the expected <code class="code"><span class="meta">〈<em class="metainner">cs</em>〉</span>{<span class="meta">〈<em class="metainner">arg</em>〉</span>}</code> format and unexpected results will occur.<p> + +</section><!-- end of section sec:exclusions --> + +<section id="sec:blockers"><!-- start of section sec:blockers --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->1.4. Blockers<div class="labellink"><a href="#sec:blockers">[link]</a></div></h2><!-- end of section header --> +<p> +A <a id="wrglossary.279"></a><a href="#glo:dual.blocker">blocker</a> is a command that prevents any case-change if it occurs at the start of <a id="wrglossary.280"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a> or after the argument of an <a id="wrglossary.281"></a><a href="#glo:dual.exclusion">exclusion</a>. Blockers are not supported by <a id="wrglossary.282"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a> but are instead treated as exclusions. <p> +<div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.283"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.284"></a><code class="code"><dfn id="glo:MFUblocker"><code class="csfmt">\MFUblocker</code></dfn>{<span class="meta">〈<em class="metainner">cs</em>〉</span>}</code></div><!-- end of pinnedbox --> + Identifies <span class="meta">〈<em class="metainner">cs</em>〉</span> as a <a id="wrglossary.285"></a><a href="#glo:dual.blocker">blocker</a>. Since <a id="wrglossary.286"></a><a href="#glo:dual.blocker">blockers</a> aren’t supported by <a id="wrglossary.287"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>, this automatically implements <code class="code"><a id="wrglossary.288"></a><a href="#glo:MFUexcl"><code class="csfmt">\MFUexcl</code></a>{<span class="meta">〈<em class="metainner">cs</em>〉</span>}</code> to protect its argument from <a id="wrglossary.289"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>, but it won’t prevent subsequent content from being changed.<p> +For example: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.290"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><a id="wrglossary.291"></a><a href="#glo:MFUblocker"><code class="csfmt">\MFUblocker</code></a>{<a id="wrglossary.292"></a><a href="#glo:nameref"><code class="csfmt">\nameref</code></a>} +<a id="wrglossary.293"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{<a id="wrglossary.294"></a><a href="#glo:nameref"><code class="csfmt">\nameref</code></a>{sec:sentencecase} section} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.295"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> + <a href="#sec:sentencecase">Sentence-Case</a> section </div><!-- end of resultbox --> +<p> +In the following, the <a id="wrglossary.296"></a><a href="#glo:dual.blocker">blocker</a> isn’t detected by <a id="wrglossary.297"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a> because the content doesn’t start with <code class="code"><span class="meta">〈<em class="metainner">cs</em>〉</span>{<span class="meta">〈<em class="metainner">arg</em>〉</span>}</code> or <code class="code"><span class="cmdfmt">\protect</span><span class="meta">〈<em class="metainner">cs</em>〉</span>{<span class="meta">〈<em class="metainner">arg</em>〉</span>}</code>. This means that the entire content is passed to <a id="wrglossary.298"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a> which treats <a id="wrglossary.299"></a><a href="#glo:nameref"><code class="csfmt">\nameref</code></a> as an <a id="wrglossary.300"></a><a href="#glo:dual.exclusion">exclusion</a>: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.301"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><a id="wrglossary.302"></a><a href="#glo:MFUblocker"><code class="csfmt">\MFUblocker</code></a>{<a id="wrglossary.303"></a><a href="#glo:nameref"><code class="csfmt">\nameref</code></a>} +<a id="wrglossary.304"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{<code class="cmd">\relax</code><a id="wrglossary.305"></a><a href="#glo:nameref"><code class="csfmt">\nameref</code></a>{sec:sentencecase} section} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.306"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> + <a href="#sec:sentencecase">Sentence-Case</a> Section </div><!-- end of resultbox --> +<p> +<div class="important"><div class="importanttitle"><a id="wrglossary.307"></a><a href="#glo:sym.important"><span title="Important" class="icon">ℹ</span></a></div><!-- end of importanttitle --> +If a <a id="wrglossary.308"></a><a href="#glo:@@glslabel@blocker">blocking command</a> is inside the definition of another command, it won’t be visible to <a id="wrglossary.309"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a> unless the other command is expanded before applying <a id="wrglossary.310"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>. For example, by using <a id="wrglossary.311"></a><a href="#glo:xmakefirstuc"><code class="csfmt">\xmakefirstuc</code></a> or <a id="wrglossary.312"></a><a href="#glo:emakefirstuc"><code class="csfmt">\emakefirstuc</code></a>. If it doesn’t get expanded until after it has been passed to <a id="wrglossary.313"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>, then it will be treated as an <a id="wrglossary.314"></a><a href="#glo:dual.exclusion">exclusion</a> instead. </div><!-- end of important --> +<p> +Recent LaTeX kernels provide <a id="wrglossary.315"></a><a href="#glo:NoCaseChange"><code class="csfmt">\NoCaseChange</code></a> and automatically add it as an <a id="wrglossary.316"></a><a href="#glo:dual.exclusion">exclusion</a>. You may want to add it as a <a id="wrglossary.317"></a><a href="#glo:dual.blocker">blocker</a> for <a id="wrglossary.318"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>. For example: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.319"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><a id="wrglossary.320"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{<a id="wrglossary.321"></a><a href="#glo:ensuremath"><code class="csfmt">\ensuremath</code></a>{<code class="cmd">\alpha</code>}-particle} / +<a id="wrglossary.322"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{<a id="wrglossary.323"></a><a href="#glo:idx.sym.dollar"><code class="code">$</code></a><code class="cmd">\alpha</code><a id="wrglossary.324"></a><a href="#glo:idx.sym.dollar"><code class="code">$</code></a>-particle} / +<a id="wrglossary.325"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>{<a id="wrglossary.326"></a><a href="#glo:ensuremath"><code class="csfmt">\ensuremath</code></a>{<code class="cmd">\alpha</code>}-particle} / +<a id="wrglossary.327"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>{<a id="wrglossary.328"></a><a href="#glo:idx.sym.dollar"><code class="code">$</code></a><code class="cmd">\alpha</code><a id="wrglossary.329"></a><a href="#glo:idx.sym.dollar"><code class="code">$</code></a>-particle} + +<a id="wrglossary.330"></a><a href="#glo:MFUblocker"><code class="csfmt">\MFUblocker</code></a>{<a id="wrglossary.331"></a><a href="#glo:NoCaseChange"><code class="csfmt">\NoCaseChange</code></a>}<span class="comment">% </span> +<a id="wrglossary.332"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{<a id="wrglossary.333"></a><a href="#glo:ensuremath"><code class="csfmt">\ensuremath</code></a>{<code class="cmd">\alpha</code>}-particle} / +<a id="wrglossary.334"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{<a id="wrglossary.335"></a><a href="#glo:NoCaseChange"><code class="csfmt">\NoCaseChange</code></a>{<a id="wrglossary.336"></a><a href="#glo:idx.sym.dollar"><code class="code">$</code></a><code class="cmd">\alpha</code><a id="wrglossary.337"></a><a href="#glo:idx.sym.dollar"><code class="code">$</code></a>}-particle} / +<a id="wrglossary.338"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>{<a id="wrglossary.339"></a><a href="#glo:ensuremath"><code class="csfmt">\ensuremath</code></a>{<code class="cmd">\alpha</code>}-particle} / +<a id="wrglossary.340"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>{<a id="wrglossary.341"></a><a href="#glo:NoCaseChange"><code class="csfmt">\NoCaseChange</code></a>{<a id="wrglossary.342"></a><a href="#glo:idx.sym.dollar"><code class="code">$</code></a><code class="cmd">\alpha</code><a id="wrglossary.343"></a><a href="#glo:idx.sym.dollar"><code class="code">$</code></a>}-particle} +</pre> Note that <a id="wrglossary.344"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> adds <a id="wrglossary.345"></a><a href="#glo:ensuremath"><code class="csfmt">\ensuremath</code></a> as an exclusion so <a id="wrglossary.346"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a> will skip it. Whereas the example above that starts with <a id="wrglossary.347"></a><a href="#glo:idx.sym.dollar"><code class="code">$</code></a> will have the entire argument passed to <a id="wrglossary.348"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>, which skips the maths content. In the first paragraph, <a id="wrglossary.349"></a><a href="#glo:NoCaseChange"><code class="csfmt">\NoCaseChange</code></a> is only an <a id="wrglossary.350"></a><a href="#glo:dual.exclusion">exclusion</a>, but in the second paragraph it’s also a <a id="wrglossary.351"></a><a href="#glo:dual.blocker">blocker</a>. <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.352"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> +Exclusion: 𝛼-Particle / 𝛼-Particle / 𝛼-Particle / 𝛼-Particle<p> +Blocker: 𝛼-Particle / 𝛼-particle / 𝛼-Particle / 𝛼-Particle </div><!-- end of resultbox --> +<p> + +</section><!-- end of section sec:blockers --> + +<section id="sec:mappings"><!-- start of section sec:mappings --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->1.5. Mappings<div class="labellink"><a href="#sec:mappings">[link]</a></div></h2><!-- end of section header --> +<p> +A <a id="wrglossary.353"></a><a href="#glo:dual.mapping">mapping</a> indicates that one command should be substituted for another, instead of applying a case-change. The assumption is that the substituted command should perform the case-change instead. <a id="wrglossary.354"></a><a href="#glo:dual.mapping">Mappings</a> are not supported by <a id="wrglossary.355"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a> but are instead treated as exclusions.<p> +<div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.356"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.357"></a><code class="code"><dfn id="glo:MFUaddmap"><code class="csfmt">\MFUaddmap</code></dfn>{<span class="meta">〈<em class="metainner">cs1</em>〉</span>}{<span class="meta">〈<em class="metainner">cs2</em>〉</span>}</code></div><!-- end of pinnedbox --> + Identifies a mapping which indicates that <a id="wrglossary.358"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a> should replace <span class="meta">〈<em class="metainner">cs1</em>〉</span> with <span class="meta">〈<em class="metainner">cs2</em>〉</span> and not apply a case-change. This automatically implements: <pre class="compactcodebox"><a id="wrglossary.359"></a><a href="#glo:MFUexcl"><code class="csfmt">\MFUexcl</code></a>{<span class="meta">〈<em class="metainner">cs1</em>〉</span>}<a id="wrglossary.360"></a><a href="#glo:MFUblocker"><code class="csfmt">\MFUblocker</code></a>{<span class="meta">〈<em class="metainner">cs2</em>〉</span>} +</pre> This means that <span class="meta">〈<em class="metainner">cs2</em>〉</span> is identified as a <a id="wrglossary.361"></a><a href="#glo:dual.blocker">blocker</a> (since it’s assumed to already be a <a id="wrglossary.362"></a><a href="#glo:dual.sentence-case">sentence-case</a> command) and <span class="meta">〈<em class="metainner">cs1</em>〉</span> is identified as an <a id="wrglossary.363"></a><a href="#glo:dual.exclusion">exclusion</a> to protect its argument from <a id="wrglossary.364"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>, which doesn’t support <a id="wrglossary.365"></a><a href="#glo:dual.mapping">mappings</a>.<p> +<div class="information"><div class="informationtitle"><a id="wrglossary.366"></a><a href="#glo:sym.information"><span title="Information" class="icon">🛈</span></a></div><!-- end of informationtitle --> +If either <span class="meta">〈<em class="metainner">cs1</em>〉</span> or <span class="meta">〈<em class="metainner">cs2</em>〉</span> is empty, no mapping is established, but an <a id="wrglossary.367"></a><a href="#glo:dual.exclusion">exclusion</a> or <a id="wrglossary.368"></a><a href="#glo:dual.blocker">blocker</a> will be set for the non-empty argument. </div><!-- end of information --> +<p> +For example (with <a id="wrglossary.369"></a><a href="#glo:pkg.glossaries"><span class="styfmt">glossaries</span></a>): <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.370"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><a id="wrglossary.371"></a><a href="#glo:MFUaddmap"><code class="csfmt">\MFUaddmap</code></a>{<a id="wrglossary.372"></a><a href="#glo:gls"><code class="csfmt">\gls</code></a>}{<a id="wrglossary.373"></a><a href="#glo:Gls"><code class="csfmt">\Gls</code></a>} +<a id="wrglossary.374"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{<a id="wrglossary.375"></a><a href="#glo:gls"><code class="csfmt">\gls</code></a>{ex} some text} +</pre> This will be converted to: <pre class="compactcodebox"><a id="wrglossary.376"></a><a href="#glo:Gls"><code class="csfmt">\Gls</code></a>{ex} some text +</pre> Note that this and similar <a id="wrglossary.377"></a><a href="#glo:dual.mapping">mappings</a> are automatically added in <a id="wrglossary.378"></a><a href="#glo:pkg.glossaries"><span class="styfmt">glossaries</span></a> v4.50+ and <a id="wrglossary.379"></a><a href="#glo:pkg.glossaries-extra"><span class="styfmt">glossaries-extra</span></a> v1.49+.<p> +<div class="important"><div class="importanttitle"><a id="wrglossary.380"></a><a href="#glo:sym.important"><span title="Important" class="icon">ℹ</span></a></div><!-- end of importanttitle --> +If a <a id="wrglossary.381"></a><a href="#glo:@@glslabel@mapping">mapped command</a> is inside the definition of another command, it won’t be visible to <a id="wrglossary.382"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a> unless the other command is expanded before applying <a id="wrglossary.383"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>. For example, by using <a id="wrglossary.384"></a><a href="#glo:xmakefirstuc"><code class="csfmt">\xmakefirstuc</code></a> or <a id="wrglossary.385"></a><a href="#glo:emakefirstuc"><code class="csfmt">\emakefirstuc</code></a>. If it doesn’t get expanded until after it has been passed to <a id="wrglossary.386"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>, then it will be treated as an <a id="wrglossary.387"></a><a href="#glo:dual.exclusion">exclusion</a> instead. </div><!-- end of important --> +<p> + +</section><!-- end of section sec:mappings --> + +<section id="sec:pkgoptions"><!-- start of section sec:pkgoptions --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->1.6. Package Options<div class="labellink"><a href="#sec:pkgoptions">[link]</a></div></h2><!-- end of section header --> +<p> +<div class="settingsbox"><div class="settingsboxtitle"><a id="wrglossary.388"></a><a href="#glo:sym.novaluesetting"><span title="Valueless Setting" class="icon">𝍢</span></a></div><!-- end of settingsboxtitle --> +<a id="wrglossary.389"></a><code class="code"><dfn id="glo:opt.expanded"><span class="optfmt">expanded</span></dfn></code></div><!-- end of settingsbox --> + Redefines <a id="wrglossary.390"></a><a href="#glo:glsmakefirstuc"><code class="csfmt">\glsmakefirstuc</code></a> to simply use <a id="wrglossary.391"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>.<p> +<div class="settingsbox"><div class="settingsboxtitle"><a id="wrglossary.392"></a><a href="#glo:sym.novaluesetting"><span title="Valueless Setting" class="icon">𝍢</span></a></div><!-- end of settingsboxtitle --> +<a id="wrglossary.393"></a><code class="code"><dfn id="glo:opt.unexpanded"><span class="optfmt">unexpanded</span></dfn></code></div><!-- end of settingsbox --> + Redefines <a id="wrglossary.394"></a><a href="#glo:glsmakefirstuc"><code class="csfmt">\glsmakefirstuc</code></a> to use <a id="wrglossary.395"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a> without expanding its argument.<p> +<div class="settingsbox"><div class="settingsboxtitle"><a id="wrglossary.396"></a><a href="#glo:sym.novaluesetting"><span title="Valueless Setting" class="icon">𝍢</span></a></div><!-- end of settingsboxtitle --> +<a id="wrglossary.397"></a><code class="code"><dfn id="glo:opt.grabfirst"><span class="optfmt">grabfirst</span></dfn></code><p> +<div class="noteBox">avoid where possible</div><!-- end of noteBox --> +</div><!-- end of settingsbox --> + Redefines <a id="wrglossary.398"></a><a href="#glo:glsmakefirstuc"><code class="csfmt">\glsmakefirstuc</code></a> to use <a id="wrglossary.399"></a><a href="#glo:mfugrabfirstuc"><code class="csfmt">\mfugrabfirstuc</code></a> and also redefines <a id="wrglossary.400"></a><a href="#glo:mfirstucMakeUppercase"><code class="csfmt">\mfirstucMakeUppercase</code></a> to use <a id="wrglossary.401"></a><a href="#glo:MakeUppercase"><code class="csfmt">\MakeUppercase</code></a>.<p> +This option is best avoided and is only provided to emulate the v2.07 behaviour of <a id="wrglossary.402"></a><a href="#glo:glsmakefirstuc"><code class="csfmt">\glsmakefirstuc</code></a>. However, you may still have different results compared to v2.07, so you may need to use rollback instead.<p> + +</section><!-- end of section sec:pkgoptions --> + +<section id="sec:capitalisewords"><!-- start of section sec:capitalisewords --><div class="tomain"><a href="#main">[top]</a></div> +<h1><!-- start of chapter header -->2. Title-Case<div class="labellink"><a href="#sec:capitalisewords">[link]</a></div></h1><!-- end of chapter header --> +<p> +The <a id="wrglossary.403"></a><a href="#glo:dual.title-case">title-case</a> commands are designed to convert the first letter of each word in a phrase to uppercase. These commands are robust. <div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.404"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.405"></a><code class="code"><dfn id="glo:capitalisewords"><code class="csfmt">\capitalisewords</code></dfn>{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code></div><!-- end of pinnedbox --> + This command applies a <a id="wrglossary.406"></a><a href="#glo:dual.sentence-case">sentence-case</a> command to each word in <span class="meta">〈<em class="metainner">text</em>〉</span> where the space character is used as the word separator. Note that it has to be an ordinary space character, not another form of space, such as <a id="wrglossary.407"></a><a href="#glo:idx.nbsp"><code class="code">~</code></a> or <a id="wrglossary.408"></a><a href="#glo:space"><code class="csfmt">\space</code></a>. Note that no expansion is performed on <span class="meta">〈<em class="metainner">text</em>〉</span>. For example: <div style="text-align: center; border-style: none; "><a id="wrglossary.409"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a><a id="wrglossary.410"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of frame@coderesult@title --> +<p> +<pre class="sidebysidecode"> +<a id="wrglossary.411"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>{a sample phrase} +</pre><div class="sidebysideresult">A Sample Phrase </div><p> + See §<a href="#sec:nocap">2.1</a> for excluding words (such as <span class="qt">“of”</span>) from the case-changing.<p> +<div class="information"><div class="informationtitle"><a id="wrglossary.412"></a><a href="#glo:sym.information"><span title="Information" class="icon">🛈</span></a></div><!-- end of informationtitle --> +This isn’t the same as the LaTeX3 command <a id="wrglossary.413"></a><a href="#glo:texttitlecase:n"><code class="csfmt">\text_titlecase:n</code></a>, which converts the first letter to <a id="wrglossary.414"></a><a href="#glo:idx.uppercase">uppercase</a> and all other letters to <a id="wrglossary.415"></a><a href="#glo:idx.lowercase">lowercase</a>. </div><!-- end of information --> +<p> +For convenience, there are shortcut commands if expansion is required before parsing the argument: <div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.416"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.417"></a><code class="code"><dfn id="glo:xcapitalisewords"><code class="csfmt">\xcapitalisewords</code></dfn>{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code></div><!-- end of pinnedbox --> + This is a shortcut for: <pre class="compactcodebox"><code class="cmd">\expandafter</code><a id="wrglossary.418"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a><code class="cmd">\expandafter</code>{<span class="meta">〈<em class="metainner">text</em>〉</span>} +</pre> <div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.419"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.420"></a><code class="code"><dfn id="glo:ecapitalisewords"><code class="csfmt">\ecapitalisewords</code></dfn>{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code></div><!-- end of pinnedbox --> + This fully expands <span class="meta">〈<em class="metainner">text</em>〉</span> before passing it to <a id="wrglossary.421"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>.<p> +The parser used by <a id="wrglossary.422"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a> first splits up the text on each space character. Each of these space-separated words may actually be a compound, so further parsing is performed on each <span class="qt">“word”</span>. The divisions within the compound word should be marked up with: <div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.423"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.424"></a><code class="code"><dfn id="glo:MFUwordbreak"><code class="csfmt">\MFUwordbreak</code></dfn>{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code></div><!-- end of pinnedbox --> + For example: <div style="text-align: center; border-style: none; "><a id="wrglossary.425"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a><a id="wrglossary.426"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of frame@coderesult@title --> +<p> +<pre class="sidebysidecode"> +<a id="wrglossary.427"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>{a +big<a id="wrglossary.428"></a><a href="#glo:MFUwordbreak"><code class="csfmt">\MFUwordbreak</code></a>{/}small idea} +</pre><div class="sidebysideresult">A Big/Small Idea </div><p> + Each sub-word within the compound word is encapsulated with: <div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.429"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.430"></a><code class="code"><dfn id="glo:MFUcapword"><code class="csfmt">\MFUcapword</code></dfn>{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code></div><!-- end of pinnedbox --> + Since it’s inconvenient to have to markup every hyphen, <a id="wrglossary.431"></a><a href="#glo:MFUcapword"><code class="csfmt">\MFUcapword</code></a> can be enabled to check for hyphens. <div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.432"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.433"></a><code class="code"><dfn id="glo:ifMFUhyphen"><code class="csfmt">\ifMFUhyphen</code></dfn> <span class="meta">〈<em class="metainner">true</em>〉</span><code class="csfmt">\else</code> <span class="meta">〈<em class="metainner">false</em>〉</span><code class="csfmt">\fi</code></code><span class="floatrightbox"><span class="summarytag">initial: </span><code class="cmd">\iffalse</code></span><span class="clearfix"></span></div><!-- end of pinnedbox --> + This conditional determines whether or not <a id="wrglossary.434"></a><a href="#glo:MFUcapword"><code class="csfmt">\MFUcapword</code></a> should consider a hyphen a word break. If this conditional is true, then <a id="wrglossary.435"></a><a href="#glo:MFUcapword"><code class="csfmt">\MFUcapword</code></a> will encapsulate its argument with: <div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.436"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.437"></a><code class="code"><dfn id="glo:MFUhyphencapword"><code class="csfmt">\MFUhyphencapword</code></dfn>{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code></div><!-- end of pinnedbox --> + This will parse <span class="meta">〈<em class="metainner">text</em>〉</span> for hyphen characters and apply the case change to each hyphen-separated word. Otherwise <a id="wrglossary.438"></a><a href="#glo:MFUcapword"><code class="csfmt">\MFUcapword</code></a> will treat its argument as a single word.<p> +The conditional can be set to true with: <div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.439"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.440"></a><code class="code"><dfn id="glo:MFUhyphentrue"><code class="csfmt">\MFUhyphentrue</code></dfn></code></div><!-- end of pinnedbox --> + and switched back off with: <div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.441"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.442"></a><code class="code"><dfn id="glo:MFUhyphenfalse"><code class="csfmt">\MFUhyphenfalse</code></dfn></code></div><!-- end of pinnedbox --> +<p> +For example: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.443"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><a id="wrglossary.444"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>{server-side includes} / +<a id="wrglossary.445"></a><a href="#glo:MFUhyphentrue"><code class="csfmt">\MFUhyphentrue</code></a> +<a id="wrglossary.446"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>{server-side includes} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.447"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> +Server-side Includes / Server-Side Includes </div><!-- end of resultbox --> +<p> +The actual case-change of each word is performed with: <div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.448"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.449"></a><code class="code"><dfn id="glo:MFUcapwordfirstuc"><code class="csfmt">\MFUcapwordfirstuc</code></dfn>{<span class="meta">〈<em class="metainner">word</em>〉</span>}</code></div><!-- end of pinnedbox --> + This defaults to <code class="code"><a id="wrglossary.450"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{<span class="meta">〈<em class="metainner">word</em>〉</span>}</code> but may be redefined to use <a id="wrglossary.451"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>, if preferred.<p> +<div class="important"><div class="importanttitle"><a id="wrglossary.452"></a><a href="#glo:sym.important"><span title="Important" class="icon">ℹ</span></a></div><!-- end of importanttitle --> +Hyphens and <a id="wrglossary.453"></a><a href="#glo:MFUwordbreak"><code class="csfmt">\MFUwordbreak</code></a> must be visible to the parser that searches for word breaks. This means they won’t be detected if they are within a group or in the definition of a command. </div><!-- end of important --> +<p> +Formatting for the entire phrase must go outside <a id="wrglossary.454"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a> (unlike <a id="wrglossary.455"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>). For example: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.456"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><a id="wrglossary.457"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>{<code class="cmd">\emph</code>{a sample phrase}} / +<code class="cmd">\emph</code>{<a id="wrglossary.458"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>{a sample phrase}} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.459"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> +<span style="font-style: italic; font-variant: normal; ">A sample phrase</span> / <span style="font-style: italic; font-variant: normal; ">A Sample Phrase</span> </div><!-- end of resultbox --> +<p> +If your phrase is likely to contain formatting commands, you can instead use: <div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.460"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.461"></a><code class="code"><dfn id="glo:capitalisefmtwords"><code class="csfmt">\capitalisefmtwords</code></dfn>{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code><span class="floatrightbox"><span class="summarytag">modifier: </span>* </span><span class="clearfix"></span></div><!-- end of pinnedbox --> + where <span class="meta">〈<em class="metainner">text</em>〉</span> may be just words (as with <a id="wrglossary.462"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>): <pre class="compactcodebox"><a id="wrglossary.463"></a><a href="#glo:capitalisefmtwords"><code class="csfmt">\capitalisefmtwords</code></a>{<span class="meta">〈<em class="metainner">words</em>〉</span>} +</pre> or may be entirely enclosed in a formatting command in the form: <pre class="compactcodebox"><a id="wrglossary.464"></a><a href="#glo:capitalisefmtwords"><code class="csfmt">\capitalisefmtwords</code></a>{<span class="meta">〈<em class="metainner">cs</em>〉</span>{<span class="meta">〈<em class="metainner">words</em>〉</span>}} +</pre> or contain formatted sub-phrases: <pre class="compactcodebox"><a id="wrglossary.465"></a><a href="#glo:capitalisefmtwords"><code class="csfmt">\capitalisefmtwords</code></a>{<span class="meta">〈<em class="metainner">words</em>〉</span> <span class="meta">〈<em class="metainner">cs</em>〉</span>{<span class="meta">〈<em class="metainner">sub-phrase</em>〉</span>} <span class="meta">〈<em class="metainner">words</em>〉</span>} +</pre> The starred form only permits a text-block command at the start of the phrase. See §<a href="#sec:titlecaseexamples">2.3</a> for examples.<p> +<div class="warning"><div class="warningtitle"><a id="wrglossary.466"></a><a href="#glo:sym.warning"><span title="Warning" class="icon">⚠</span></a></div><!-- end of warningtitle --> +Avoid declarations, such as <code class="cmd">\bfseries</code> or <code class="cmd">\em</code>. </div><!-- end of warning --> +<p> +If expansion is required, you can use: <div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.467"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.468"></a><code class="code"><dfn id="glo:xcapitalisefmtwords"><code class="csfmt">\xcapitalisefmtwords</code></dfn>{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code><span class="floatrightbox"><span class="summarytag">modifier: </span>* </span><span class="clearfix"></span></div><!-- end of pinnedbox --> + which is a shortcut for: <pre class="compactcodebox"><code class="cmd">\expandafter</code><a id="wrglossary.469"></a><a href="#glo:capitalisefmtwords"><code class="csfmt">\capitalisefmtwords</code></a><code class="cmd">\expandafter</code>{<span class="meta">〈<em class="metainner">text</em>〉</span>} +</pre> (The star modifier will be applied with <code class="code"><a id="wrglossary.470"></a><a href="#glo:xcapitalisefmtwords"><code class="csfmt">\xcapitalisefmtwords</code></a>*</code> in an appropriate manner.)<p> +<div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.471"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.472"></a><code class="code"><dfn id="glo:ecapitalisefmtwords"><code class="csfmt">\ecapitalisefmtwords</code></dfn>{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code><span class="floatrightbox"><span class="summarytag">modifier: </span>* </span><span class="clearfix"></span></div><!-- end of pinnedbox --> + This will fully expand its argument before passing it to <a id="wrglossary.473"></a><a href="#glo:capitalisefmtwords"><code class="csfmt">\capitalisefmtwords</code></a>. Again, the star modifier may be used.<p> +<div class="important"><div class="importanttitle"><a id="wrglossary.474"></a><a href="#glo:sym.important"><span title="Important" class="icon">ℹ</span></a></div><!-- end of importanttitle --> +The unstarred <a id="wrglossary.475"></a><a href="#glo:capitalisefmtwords"><code class="csfmt">\capitalisefmtwords</code></a> 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 <a id="wrglossary.476"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>. </div><!-- end of important --> +<p> + +</section><!-- end of section sec:capitalisewords --> + +<section id="sec:nocap"><!-- start of section sec:nocap --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->2.1. Excluding Words From Case-Changing<div class="labellink"><a href="#sec:nocap">[link]</a></div></h2><!-- end of section header --> +<p> +<a id="wrglossary.477"></a>Some words typically shouldn’t have their case changed unless they occur at the start. These words can be identified with: <div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.478"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.479"></a><code class="code"><dfn id="glo:MFUnocap"><code class="csfmt">\MFUnocap</code></dfn>{<span class="meta">〈<em class="metainner">word</em>〉</span>}</code></div><!-- end of pinnedbox --> + This only has a local effect. The global version is: <div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.480"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.481"></a><code class="code"><dfn id="glo:gMFUnocap"><code class="csfmt">\gMFUnocap</code></dfn>{<span class="meta">〈<em class="metainner">word</em>〉</span>}</code></div><!-- end of pinnedbox --> + The list of words that shouldn’t be capitalised can be cleared using: <div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.482"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.483"></a><code class="code"><dfn id="glo:MFUclear"><code class="csfmt">\MFUclear</code></dfn></code></div><!-- end of pinnedbox --> +<p> +For example: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.484"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><a id="wrglossary.485"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>{the wind in the willows} + +<a id="wrglossary.486"></a><a href="#glo:MFUnocap"><code class="csfmt">\MFUnocap</code></a>{in}<span class="comment">% </span> +<a id="wrglossary.487"></a><a href="#glo:MFUnocap"><code class="csfmt">\MFUnocap</code></a>{the}<span class="comment">% </span> + +<a id="wrglossary.488"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>{the wind in the willows} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.489"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> +The Wind In The Willows<p> +<p> +The Wind in the Willows </div><!-- end of resultbox --> +<p> +Since the case-change is ultimately performed by <a id="wrglossary.490"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>, you can also use an <a id="wrglossary.491"></a><a href="#glo:dual.exclusion">exclusion</a> to prevent an individual word from being changed. For example: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.492"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><code class="cmd">\newcommand</code>{<code class="cmd">\NoChange</code>}[1]{#1} +<a id="wrglossary.493"></a><a href="#glo:MFUexcl"><code class="csfmt">\MFUexcl</code></a>{<code class="cmd">\NoChange</code>} +<a id="wrglossary.494"></a><a href="#glo:MFUclear"><code class="csfmt">\MFUclear</code></a> +<a id="wrglossary.495"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>{the <code class="cmd">\NoChange</code>{wind} in the willows} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.496"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> + The wind In The Willows </div><!-- end of resultbox --> + This can also work if you redefine <a id="wrglossary.497"></a><a href="#glo:MFUcapwordfirstuc"><code class="csfmt">\MFUcapwordfirstuc</code></a> to use <a id="wrglossary.498"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a> provided the exclusion command doesn’t expand (so <code class="cmd">\NoChange</code> would need to be protected or made robust in the above example). <p> +<div class="important"><div class="importanttitle"><a id="wrglossary.499"></a><a href="#glo:sym.important"><span title="Important" class="icon">ℹ</span></a></div><!-- end of importanttitle --> +Exceptions only apply to (non-leading) whole words or words separated with <a id="wrglossary.500"></a><a href="#glo:MFUwordbreak"><code class="csfmt">\MFUwordbreak</code></a> but not to parts of a hyphenated word that are split by <a id="wrglossary.501"></a><a href="#glo:MFUhyphencapword"><code class="csfmt">\MFUhyphencapword</code></a>. </div><!-- end of important --> +<p> +Examples: +<ol class="displaylist"> + <li><span class="numitem">1.</span>Exceptions aren’t applied if <a id="wrglossary.502"></a><a href="#glo:MFUwordbreak"><code class="csfmt">\MFUwordbreak</code></a> occurs before the first space. <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.503"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><a id="wrglossary.504"></a><a href="#glo:MFUnocap"><code class="csfmt">\MFUnocap</code></a>{a}<a id="wrglossary.505"></a><a href="#glo:MFUnocap"><code class="csfmt">\MFUnocap</code></a>{the}<span class="comment">% </span> +<a id="wrglossary.506"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>{a<a id="wrglossary.507"></a><a href="#glo:MFUwordbreak"><code class="csfmt">\MFUwordbreak</code></a>{/}the something} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.508"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> +A/The Something </div><!-- end of resultbox --> +<p> +<li><span class="numitem">2.</span>Exceptions are applied for non-leading words: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.509"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><a id="wrglossary.510"></a><a href="#glo:MFUnocap"><code class="csfmt">\MFUnocap</code></a>{and}<a id="wrglossary.511"></a><a href="#glo:MFUnocap"><code class="csfmt">\MFUnocap</code></a>{or}<span class="comment">% </span> +<a id="wrglossary.512"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>{one and<a id="wrglossary.513"></a><a href="#glo:MFUwordbreak"><code class="csfmt">\MFUwordbreak</code></a>{/}or another} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.514"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> +One and/or Another </div><!-- end of resultbox --> +<p> +<li><span class="numitem">3.</span>Exceptions aren’t applied for hyphenated parts: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.515"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><a id="wrglossary.516"></a><a href="#glo:MFUhyphentrue"><code class="csfmt">\MFUhyphentrue</code></a> +<a id="wrglossary.517"></a><a href="#glo:MFUnocap"><code class="csfmt">\MFUnocap</code></a>{and}<a id="wrglossary.518"></a><a href="#glo:MFUnocap"><code class="csfmt">\MFUnocap</code></a>{or}<span class="comment">% </span> +<a id="wrglossary.519"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>{one and-or another} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.520"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> +One And-Or Another </div><!-- end of resultbox --> -><colgroup id="TBL-1-1g"><col -id="TBL-1-1" /></colgroup><tr - style="vertical-align:baseline;" id="TBL-1-1-"><td style="white-space:nowrap; text-align:center;" id="TBL-1-1-1" -class="td11"> <span -class="cmr-12">Nicola L.C. Talbot </span></td> -</tr><tr -class="vspace" style="font-size:10.0pt"><td -> </td></tr><tr - style="vertical-align:baseline;" id="TBL-1-2-"><td style="white-space:nowrap; text-align:center;" id="TBL-1-2-1" -class="td11"> <span -class="cmr-12">Dickimaw Books </span></td> -</tr><tr - style="vertical-align:baseline;" id="TBL-1-3-"><td style="white-space:nowrap; text-align:center;" id="TBL-1-3-1" -class="td11"><a -href="http://www.dickimaw-books.com/" class="url" ><span -class="cmtt-12">http://www.dickimaw-books.com/</span></a></td></tr></table> -</div> -<!--l. 36--><p class="noindent" ><span -class="cmr-12">2021-10-15</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="chapterToc" >2 <a -href="#sec:makefirstuc" id="QQ2-1-3">Capitalising the First Letter of a Word</a></span> -<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="sectionToc" >3.1 <a -href="#sec:pdfbookmarks" id="QQ2-1-5">PDF Bookmarks</a></span> -<br />  <span class="sectionToc" >3.2 <a -href="#sec:nocap" id="QQ2-1-6">Excluding Words From Case-Changing</a></span> -<br /> <span class="chapterToc" >4 <a -href="#sec:utf8" id="QQ2-1-7">UTF-8</a></span> - </div> - - - -<!--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="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. 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> -</p><!--l. 53--><p class="noindent" > -</p><!--l. 55--><p class="indent" > Here are some examples of semantic commands: - </p><ol class="enumerate1" > -<li - class="enumerate" id="x1-2002x1"> - <!--l. 57--><p class="noindent" >Quoted material: - - - -</p> - <pre class="verbatim" id="verbatim-1"> - \newcommand{\qt}[1]{``#1''} -</pre> - <!--l. 60--><p class="nopar" > (or use the <span -class="cmss-10">csquotes </span>package). With this, the following works: - - - -</p> - <pre class="verbatim" id="verbatim-2"> - \makefirstuc{\qt{word}} -</pre> - <!--l. 65--><p class="nopar" > This produces: <spacer type=vertical size=10><span class="obeylines-h"> - <br />“Word” - <br /><spacer type=vertical size=10></span> - Whereas - - - -</p> - <pre class="verbatim" id="verbatim-3"> - \makefirstuc{``word''} -</pre> - <!--l. 73--><p class="nopar" > fails (no case-change and double open quote becomes two single open quotes): - <spacer type=vertical size=10><span class="obeylines-h"> - <br />‘‘word” - <br /><spacer type=vertical size=10></span> - </p></li> -<li - class="enumerate" id="x1-2004x2"> - <!--l. 80--><p class="noindent" >Font styles or colours: - - - -</p> - <pre class="verbatim" id="verbatim-4"> - \newcommand*{\alert}[1]{\textcolor{red}{#1}} -</pre> - <!--l. 83--><p class="nopar" > Now the following is possible: - - - -</p> - <pre class="verbatim" id="verbatim-5"> - \makefirstuc{\alert{word}} -</pre> - <!--l. 87--><p class="nopar" > This produces <spacer type=vertical size=10><span class="obeylines-h"> - <br /><span id="textcolor1">Word</span> - <br /><spacer type=vertical size=10></span> - Note that <span class="obeylines-h"><span class="verb"><span -class="cmtt-10">\makefirstuc{\textcolor{red}{word}}</span></span></span> fails (with an error) because the - case-changing interferes with the label.</p></li></ol> -<!--l. 97--><p class="indent" > Define these semantic commands robustly if you intend using any of the commands -that fully expand their argument (<span -class="cmtt-10">\emakefirstuc</span>, <span -class="cmtt-10">\ecapitalisewords </span>and -<span -class="cmtt-10">\ecapitalisefmtwords</span>). - - - -</p> -<!--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 LaTeX upper casing command. -For example, - - - -</p> - <pre class="verbatim" id="verbatim-6"> -\MakeUppercase word -</pre> -<!--l. 109--><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. 114--><p class="indent" > <hr><div title="Definition"><span class="reversemarginpar"><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. 116--><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 argument.</span> -</p><!--l. 123--><p class="indent" > If ⟨<span -class="cmti-10">stuff </span>⟩ starts with punctuation that should be skipped over, use: -</p><!--l. 125--><p class="indent" > <hr><div title="Definition"><span class="reversemarginpar"><span -class="cmtt-9">\MFUskippunc</span><span -class="cmtt-9"> </span></span><a - id="dx1-3002"></a> <span -class="cmtt-10">\MFUskippunc{</span>⟨<span -class="cmitt-10">punctuation</span>⟩<span -class="cmtt-10">} </span></div><hr> -</p><!--l. 127--><p class="noindent" > -</p><!--l. 129--><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">\textcolor{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. 137--><p class="noindent" > -</p><!--l. 139--><p class="indent" > Examples: </p> - <ul class="itemize1"> - <li class="itemize"> - <!--l. 141--><p class="noindent" ><span class="obeylines-h"><span class="verb"><span -class="cmtt-10">\makefirstuc{abc}</span></span></span> produces Abc. - </p></li> - <li class="itemize"> - <!--l. 143--><p class="noindent" ><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-3003"></a> has been applied to the - letter “a” rather than <span -class="cmtt-10">\emph</span>). Note however that - - - -</p> - <pre class="verbatim" id="verbatim-7"> - \makefirstuc{{\em abc}} -</pre> - <!--l. 148--><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> - <pre class="verbatim" id="verbatim-8"> - {\makefirstuc{\em abc}} -</pre> - <!--l. 153--><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"> - <!--l. 158--><p class="noindent" ><span class="obeylines-h"><span class="verb"><span -class="cmtt-10">\makefirstuc{{\’a}bc}</span></span></span> produces Ábc. - </p></li> - <li class="itemize"> - <!--l. 160--><p class="noindent" ><span class="obeylines-h"><span class="verb"><span -class="cmtt-10">\makefirstuc{\ae</span><span -class="cmtt-10"> bc}</span></span></span> produces Æbc. - </p></li> - <li class="itemize"> - <!--l. 162--><p class="noindent" ><span class="obeylines-h"><span class="verb"><span -class="cmtt-10">\makefirstuc{{\ae}bc}</span></span></span> produces Æbc. - </p></li> - <li class="itemize"> - <!--l. 164--><p class="noindent" ><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. - </p></li> - <li class="itemize"> - <!--l. 166--><p class="noindent" ><span class="obeylines-h"><span class="verb"><span -class="cmtt-10">\makefirstuc{\MFUskippunc{’}tis</span><span -class="cmtt-10"> the</span><span -class="cmtt-10"> season}</span></span></span> produces ’Tis the season. -</p> - </li></ul> -<!--l. 171--><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-3004"></a> package). The reason for this restriction -is detailed in <a -href="#sec:utf8"><span -class="tcrm-1000">§</span><span -class="cmbx-10">4. </span></a><a -href="#sec:utf8">UTF-8<!--tex4ht:ref: sec:utf8 --></a>. -</p><!--l. 176--><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-3005"></a> package, provided that you load <span -class="cmss-10">datatool-base</span><a - id="dx1-3006"></a> (at least v2.24) before <span -class="cmss-10">mfirstuc</span> -(<span -class="cmss-10">datatool-base</span><a - id="dx1-3007"></a> is loaded automatically with newer versions of <span -class="cmss-10">glossaries</span><a - id="dx1-3008"></a>). If available <span -class="cmss-10">mfirstuc</span><a - id="dx1-3009"></a> -will now use <span -class="cmss-10">datatool-base</span><a - id="dx1-3010"></a>’s <span -class="cmtt-10">\dtl@getfirst@UTFviii</span><a - id="dx1-3011"></a> command which is still experimental. -See the <span -class="cmss-10">datatool </span>manual for further details. - - - -</p> - <pre class="verbatim" id="verbatim-9"> -\documentclass{article} -\usepackage[T1]{fontenc} -\usepackage[utf8]{inputenc} -\usepackage{datatool-base}[2016/01/12]% v2.24+ -\usepackage{mfirstuc} -\begin{document} -\makefirstuc{élite} -\end{document} -</pre> -<!--l. 197--><p class="nopar" > (Package ordering is important.) -</p><!--l. 200--><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. 206--><p class="noindent" > -</p><!--l. 208--><p class="indent" > Note also that - - - -</p> - <pre class="verbatim" id="verbatim-10"> -\newcommand{\abc}{abc} -\makefirstuc{\abc} -</pre> -<!--l. 212--><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> - <pre class="verbatim" id="verbatim-11"> -\newcommand{\abc}{abc} -\expandafter\makefirstuc\expandafter{\abc} -</pre> -<!--l. 219--><p class="nopar" > produces: Abc. There is a short cut command which will do this: -</p><!--l. 221--><p class="indent" > <hr><div title="Definition"><span class="reversemarginpar"><span -class="cmtt-9">\xmakefirstuc</span><span -class="cmtt-9"> </span></span><a - id="dx1-3012"></a> <span -class="cmtt-10">\xmakefirstuc{</span>⟨<span -class="cmitt-10">stuff</span>⟩<span -class="cmtt-10">} </span></div><hr> -</p><!--l. 223--><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> - <pre class="verbatim" id="verbatim-12"> -\newcommand{\abc}{abc} -\xmakefirstuc{\abc} -</pre> -<!--l. 228--><p class="nopar" > produces: Abc. -</p><!--l. 233--><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. 237--><p class="noindent" > -</p><!--l. 239--><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. 241--><p class="indent" > <hr><div title="Definition"><span class="reversemarginpar"><span -class="cmtt-9">\emakefirstuc</span><span -class="cmtt-9"> </span></span><a - id="dx1-3013"></a> <span -class="cmtt-10">\emakefirstuc{</span>⟨<span -class="cmitt-10">text</span>⟩<span -class="cmtt-10">} </span></div><hr> -</p><!--l. 243--><p class="noindent" > -</p><!--l. 245--><p class="indent" > Examples: - - - -</p> - <pre class="verbatim" id="verbatim-13"> -\newcommand{\abc}{\xyz a} -\newcommand{\xyz}{xyz} -No expansion: \makefirstuc{\abc}. -First object one-level expansion: \xmakefirstuc{\abc}. -Fully expanded: \emakefirstuc{\abc}. -</pre> -<!--l. 252--><p class="nopar" > produces: No expansion: XYZA. First object one-level expansion: XYZa. Fully expanded: -Xyza. -</p><!--l. 260--><p class="indent" > If you use <span -class="cmss-10">mfirstuc </span>without the <span -class="cmss-10">glossaries</span><a - id="dx1-3014"></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-3015"></a>, <span -class="cmtt-10">\MakeTextUppercase</span><a - id="dx1-3016"></a> (defined by the <span -class="cmss-10">textcase</span><a - id="dx1-3017"></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-3018"></a> instead, you can redefine -</p><!--l. 266--><p class="indent" > <hr><div title="Definition"><span class="reversemarginpar"><span -class="cmtt-9">\glsmakefirstuc</span><span -class="cmtt-9"> </span></span><a - id="dx1-3019"></a> <span -class="cmtt-10">\glsmakefirstuc{</span>⟨<span -class="cmitt-10">text</span>⟩<span -class="cmtt-10">} </span></div><hr> -</p><!--l. 268--><p class="noindent" > -For example: - - - -</p> - <pre class="verbatim" id="verbatim-14"> -\renewcommand{\glsmakefirstuc}[1]{\MakeTextUppercase #1} -</pre> -<!--l. 272--><p class="nopar" > Remember to also load <span -class="cmss-10">textcase</span><a - id="dx1-3020"></a> (<span -class="cmss-10">glossaries </span>loads this automatically). - - - -</p> -<!--l. 276--><p class="indent" > </div> -</p><!--l. 276--><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. 279--><p class="indent" > New to mfirstuc v1.06: -</p><!--l. 280--><p class="indent" > <hr><div title="Definition"><span class="reversemarginpar"><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. 282--><p class="noindent" > -This command applies <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>⟩. See <a -href="#sec:nocap"><span -class="tcrm-1000">§</span><span -class="cmbx-10">3.2 </span></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. 290--><p class="indent" > The actual capitalisation of each word is done using -</p><!--l. 291--><p class="indent" > <hr><div title="Definition"><span class="reversemarginpar"><span -class="cmtt-9">\MFUcapwordfirstuc</span><span -class="cmtt-9"> </span></span><a - id="dx1-4003"></a> <span -class="cmtt-10">\MFUcapwordfirstuc{</span>⟨<span -class="cmitt-10">word</span>⟩<span -class="cmtt-10">} </span></div><hr> -</p><!--l. 293--><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. There’s a conditional that determines -whether or not to consider a hyphen a word break: -</p><!--l. 297--><p class="indent" > <hr><div title="Definition"><span class="reversemarginpar"><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. 299--><p class="noindent" > -</p><!--l. 301--><p class="indent" > If you want to title case each part of a compound word containing hyphens, you can enable -this using -</p><!--l. 303--><p class="indent" > <hr><div title="Definition"><span class="reversemarginpar"><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. 305--><p class="noindent" > -or switch it back off again using: -</p><!--l. 307--><p class="indent" > <hr><div title="Definition"><span class="reversemarginpar"><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. 309--><p class="noindent" > -Compare - - - -</p> - <pre class="verbatim" id="verbatim-15"> -\capitalisewords{server-side includes} -</pre> -<!--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> -with - - - -</p> - <pre class="verbatim" id="verbatim-16"> -\MFUhyphentrue -\capitalisewords{server-side includes} -</pre> -<!--l. 322--><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> -Note that this won’t apply exceptions to each part of the hyphenated word. -</p><!--l. 331--><p class="indent" > For other punctuation you need to markup the character with: -</p><!--l. 332--><p class="indent" > <hr><div title="Definition"><span class="reversemarginpar"><span -class="cmtt-9">\MFUwordbreak</span><span -class="cmtt-9"> </span></span><a - id="dx1-4007"></a> <span -class="cmtt-10">\MFUwordbreak{</span>⟨<span -class="cmitt-10">punctuation</span>⟩<span -class="cmtt-10">} </span></div><hr> -</p><!--l. 334--><p class="noindent" > -For example: - - - -</p> - <pre class="verbatim" id="verbatim-17"> -\capitalisewords{a big\MFUwordbreak{/}small idea} -</pre> -<!--l. 338--><p class="nopar" > which produces: <spacer type=vertical size=10><span class="obeylines-h"> - <br />A Big/Small Idea - <br /><spacer type=vertical size=10></span> -In this case, exceptions are applied. For example, if <span -class="cmss-10">mfirstuc-english</span><a - id="dx1-4008"></a> is loaded then: - - - -</p> - <pre class="verbatim" id="verbatim-18"> -\capitalisewords{one and\MFUwordbreak{/}or another} -</pre> -<!--l. 347--><p class="nopar" > produces: <spacer type=vertical size=10><span class="obeylines-h"> - <br />One and/or Another - <br /><spacer type=vertical size=10></span> -Note that you can’t hide <span -class="cmtt-10">\MFUwordbreak </span>inside a command or group. -</p><!--l. 355--><p class="indent" > Exceptions aren’t applied if <span -class="cmtt-10">\MFUwordbreak </span>occurs before the first space. For -example: - - - -</p> - <pre class="verbatim" id="verbatim-19"> -\MFUnocap{a}\MFUnocap{the}% -\capitalisewords{a\MFUwordbreak{/}the something} -</pre> -<!--l. 360--><p class="nopar" > produces: <spacer type=vertical size=10><span class="obeylines-h"> - <br />A/The Something - <br /><spacer type=vertical size=10></span> -</p><!--l. 367--><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: - - - -</p> - <pre class="verbatim" id="verbatim-20"> -\capitalisewords{\textbf{a sample phrase}} -</pre> -<!--l. 371--><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> -with: - - - -</p> - <pre class="verbatim" id="verbatim-21"> -\textbf{\capitalisewords{a sample phrase}} -</pre> -<!--l. 379--><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. 385--><p class="indent" > As from version 2.03, there is now a command for phrases that may include a formatting -command: -</p><!--l. 388--><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. 389--><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 -formatting command in the form </p><div class="alltt"> -<div class="obeylines-v"> -<span -class="cmtt-10">\capitalisefmtwords</span><span -class="cmsy-10">{</span>⟨<span -class="cmitt-10">cs</span>⟩<span -class="cmtt-10">{</span>⟨<span -class="cmitt-10">phrase</span>⟩<span -class="cmtt-10">}</span><span -class="cmsy-10">}</span> -</div> -</div> or contain formatted sub-phrases <div class="alltt"> -<div class="obeylines-v"> -<span -class="cmtt-10">\capitalisefmtwords</span><span -class="cmsy-10">{</span>⟨<span -class="cmitt-10">words</span>⟩<span -class="cmtt-10"> </span>⟨<span -class="cmitt-10">cs</span>⟩<span -class="cmtt-10">{</span>⟨<span -class="cmitt-10">sub-phrase</span>⟩<span -class="cmtt-10">}</span><span -class="cmtt-10"> </span>⟨<span -class="cmitt-10">words</span>⟩<span -class="cmsy-10">}</span> -</div> -</div> Avoid scoped declarations. -<!--l. 401--><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. 407--><p class="noindent" > -</p><!--l. 409--><p class="indent" > The starred form only permits a text-block command at the start of the phrase. -</p><!--l. 412--><p class="indent" > Examples: - </p><ol class="enumerate1" > -<li - class="enumerate" id="x1-4010x1"> - <!--l. 414--><p class="noindent" >Phrase entirely enclosed in a formatting command: - - - -</p> - <pre class="verbatim" id="verbatim-22"> - \capitalisefmtwords{\textbf{a small book of rhyme}} -</pre> - <!--l. 417--><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> - </p></li> -<li - class="enumerate" id="x1-4012x2"> - <!--l. 423--><p class="noindent" >Sub-phrase enclosed in a formatting command: - - - -</p> - <pre class="verbatim" id="verbatim-23"> - \capitalisefmtwords{a \textbf{small book} of rhyme} -</pre> - <!--l. 426--><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> - </p></li> -<li - class="enumerate" id="x1-4014x3"> - <!--l. 432--><p class="noindent" >Nested text-block commands: - - - -</p> - <pre class="verbatim" id="verbatim-24"> - \capitalisefmtwords{\textbf{a \emph{small book}} of rhyme} -</pre> - <!--l. 435--><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> -<li - class="enumerate" id="x1-4016x4"> - <!--l. 441--><p class="noindent" >Indicating words that shouldn’t have the case changed (see <a -href="#sec:nocap"><span -class="tcrm-1000">§</span><span -class="cmbx-10">3.2 </span></a><a -href="#sec:nocap">Excluding - Words From Case-Changing<!--tex4ht:ref: sec:nocap --></a>): - - - -</p> - <pre class="verbatim" id="verbatim-25"> - \MFUnocap{of} - \capitalisefmtwords{\textbf{a \emph{small book}} of rhyme} -</pre> - <!--l. 446--><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> -<li - class="enumerate" id="x1-4018x5"> - <!--l. 453--><p class="noindent" >Starred form: - - - -</p> - <pre class="verbatim" id="verbatim-26"> - \MFUnocap{of} - \capitalisefmtwords*{\emph{a small book of rhyme}} -</pre> - <!--l. 457--><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-4020x6"> - <!--l. 464--><p class="noindent" >The starred form also works with just text (no text-block command): - - - -</p> - <pre class="verbatim" id="verbatim-27"> - \MFUnocap{of} - \capitalisefmtwords*{a small book of rhyme} -</pre> - <!--l. 469--><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> - </li></ol> -<!--l. 478--><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> - <pre class="verbatim" id="verbatim-28"> -\MFUnocap{of} -\capitalisefmtwords*{\emph{a small} book \textbf{of rhyme}} -</pre> -<!--l. 485--><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> - <pre class="verbatim" id="verbatim-29"> -\MFUnocap{of} -\capitalisefmtwords*{a \emph{very small} book of rhyme} -</pre> -<!--l. 497--><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. 506--><p class="indent" > Grouping causes interference: - - - -</p> - <pre class="verbatim" id="verbatim-30"> -\capitalisefmtwords{{a \emph{small book}} of rhyme} -</pre> -<!--l. 509--><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> -As with all the commands described here, avoid declarations. For example, the following -fails: - - - -</p> - <pre class="verbatim" id="verbatim-31"> -\capitalisefmtwords{{\bfseries a \emph{small book}} of rhyme} -</pre> -<!--l. 518--><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. 524--><p class="indent" > Avoid complicated commands in the unstarred version. For example, the following -breaks: - - - -</p> - <pre class="verbatim" id="verbatim-32"> -\newcommand*{\swap}[2]{{#2}{#1}} -\capitalisefmtwords{a \swap{bo}{ok} of rhyme} -</pre> -<!--l. 529--><p class="nopar" > However it works okay with the starred form and the simpler <span -class="cmtt-10">\capitalisewords</span>: - - - -</p> - <pre class="verbatim" id="verbatim-33"> -\newcommand*{\swap}[2]{{#2}{#1}} -\capitalisefmtwords*{a \swap{bo}{ok} of rhyme} -\capitalisewords{a \swap{bo}{ok} of rhyme} -</pre> -<!--l. 537--><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. 547--><p class="indent" > <hr><div title="Definition"><span class="reversemarginpar"><span -class="cmtt-9">\xcapitalisewords</span><span -class="cmtt-9"> </span></span><a - id="dx1-4021"></a> <span -class="cmtt-10">\xcapitalisewords{</span>⟨<span -class="cmitt-10">text</span>⟩<span -class="cmtt-10">} </span></div><hr> -</p><!--l. 549--><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. 553--><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. 555--><p class="indent" > <hr><div title="Definition"><span class="reversemarginpar"><span -class="cmtt-9">\ecapitalisewords</span><span -class="cmtt-9"> </span></span><a - id="dx1-4022"></a> <span -class="cmtt-10">\ecapitalisewords{</span>⟨<span -class="cmitt-10">text</span>⟩<span -class="cmtt-10">} </span></div><hr> -</p><!--l. 557--><p class="noindent" > -</p><!--l. 559--><p class="indent" > There are also similar shortcut commands for the version that allows text-block -commands: -</p><!--l. 561--><p class="indent" > <hr><div title="Definition"><span class="reversemarginpar"><span -class="cmtt-9">\xcapitalisefmtwords</span><span -class="cmtt-9"> </span></span><a - id="dx1-4023"></a> <span -class="cmtt-10">\xcapitalisefmtwords{</span>⟨<span -class="cmitt-10">text</span>⟩<span -class="cmtt-10">} </span></div><hr> -</p><!--l. 563--><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>. Similarly the starred version of <span -class="cmtt-10">\xcapitalisefmtwords </span>uses the starred version of -<span -class="cmtt-10">\capitalisefmtwords</span>. -</p><!--l. 569--><p class="indent" > For full expansion: -</p><!--l. 570--><p class="indent" > <hr><div title="Definition"><span class="reversemarginpar"><span -class="cmtt-9">\ecapitalisefmtwords</span><span -class="cmtt-9"> </span></span><a - id="dx1-4024"></a> <span -class="cmtt-10">\ecapitalisefmtwords{</span>⟨<span -class="cmitt-10">text</span>⟩<span -class="cmtt-10">} </span></div><hr> -</p><!--l. 572--><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. 579--><p class="indent" > Examples: - - - -</p> - <pre class="verbatim" id="verbatim-34"> -\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}. -</pre> -<!--l. 586--><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. 596--><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. 602--><p class="indent" > Examples: - </p><ol class="enumerate1" > -<li - class="enumerate" id="x1-4026x1"> - <!--l. 605--><p class="noindent" > - - - -</p> - <pre class="verbatim" id="verbatim-35"> - \capitalisewords{a book of rhyme.} -</pre> - <!--l. 607--><p class="nopar" > produces: A Book Of Rhyme. - </p></li> -<li - class="enumerate" id="x1-4028x2"> - <!--l. 612--><p class="noindent" > - - - -</p> - <pre class="verbatim" id="verbatim-36"> - \capitalisewords{a book\space of rhyme.} -</pre> - <!--l. 614--><p class="nopar" > produces: A Book of Rhyme. - </p></li> -<li - class="enumerate" id="x1-4030x3"> - <!--l. 619--><p class="noindent" > - - - -</p> - <pre class="verbatim" id="verbatim-37"> - \newcommand{\mytitle}{a book\space of rhyme.} - \capitalisewords{\mytitle} -</pre> - <!--l. 622--><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-4032x4"> - <!--l. 629--><p class="noindent" > - - - -</p> - <pre class="verbatim" id="verbatim-38"> - \newcommand{\mytitle}{a book\space of rhyme.} - \xcapitalisewords{\mytitle} -</pre> - <!--l. 632--><p class="nopar" > produces: A Book of Rhyme. - </p><!--l. 636--><p class="noindent" >However - - - -</p> - <pre class="verbatim" id="verbatim-39"> - \ecapitalisewords{\mytitle} -</pre> - <!--l. 639--><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-4034x5"> - <!--l. 645--><p class="noindent" > - - - -</p> - <pre class="verbatim" id="verbatim-40"> - \newcommand*{\swap}[2]{{#2}{#1}} - \capitalisewords{a \swap{bo}{ok} of rhyme} - \ecapitalisewords{a \swap{bo}{ok} of rhyme} -</pre> - <!--l. 650--><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> - <pre class="verbatim" id="verbatim-41"> - \capitalisewords{a {ok}{bo} of rhyme} -</pre> - <!--l. 663--><p class="nopar" ></p></li></ol> -<!--l. 666--><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. 669--><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 -class="cmtt-10">\capitalisefmtwords </span>or -<span -class="cmtt-10">\makefirstuc</span><a - id="dx1-5002"></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> - <pre class="verbatim" id="verbatim-42"> -Package hyperref Warning: Token not allowed in a PDF string +</ol> +<p> +<div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.521"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.522"></a><code class="code"><code class="cmd">\usepackage</code>{<dfn id="glo:pkg.mfirstuc-english"><span class="styfmt">mfirstuc-english</span></dfn>}</code></div><!-- end of pinnedbox --> + The supplementary package <a id="wrglossary.523"></a><a href="#glo:pkg.mfirstuc-english"><span class="styfmt">mfirstuc-english</span></a> loads <a id="wrglossary.524"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> and uses <a id="wrglossary.525"></a><a href="#glo:MFUnocap"><code class="csfmt">\MFUnocap</code></a> to add common English articles and conjunctions, such as <span class="qt">“a”</span>, <span class="qt">“an”</span>, <span class="qt">“and”</span>, <span class="qt">“but”</span>. 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. Note that you need to explicitly load <a id="wrglossary.526"></a><a href="#glo:pkg.mfirstuc-english"><span class="styfmt">mfirstuc-english</span></a> if you require it. There’s no automatic language detection performed by <a id="wrglossary.527"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a>.<p> +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="filefmt">.sty</span> that starts with: <pre class="compactcodebox"><code class="cmd">\NeedsTeXFormat</code>{LaTeX2e} +</pre> The next line should identify the package. For example, if you have called the file <span class="filefmt">mfirstuc-french.sty</span> then you need: <pre class="compactcodebox"><code class="cmd">\ProvidesPackage</code>{mfirstuc-french} +</pre> It’s a good idea to also add a version in the final optional argument, for example: <pre class="compactcodebox"><code class="cmd">\ProvidesPackage</code>{mfirstuc-french}[2014/07/30 v1.0] +</pre> Next load <a id="wrglossary.528"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a>: <pre class="compactcodebox"><code class="cmd">\RequirePackage</code>{mfirstuc} +</pre> Now add all your <a id="wrglossary.529"></a><a href="#glo:MFUnocap"><code class="csfmt">\MFUnocap</code></a> commands. For example: <pre class="compactcodebox"><a id="wrglossary.530"></a><a href="#glo:MFUnocap"><code class="csfmt">\MFUnocap</code></a>{de} +</pre> At the end of the file add: <pre class="compactcodebox"><code class="cmd">\endinput</code> +</pre><p> +Put the file somewhere on TeX’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> + +</section><!-- end of section sec:nocap --> + +<section id="sec:pdfbookmarks"><!-- start of section sec:pdfbookmarks --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->2.2. PDF Bookmarks<div class="labellink"><a href="#sec:pdfbookmarks">[link]</a></div></h2><!-- end of section header --> +<p> +If you are using <a id="wrglossary.531"></a><a href="#glo:pkg.hyperref"><span class="styfmt">hyperref</span></a> and want to use <a id="wrglossary.532"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a> or <a id="wrglossary.533"></a><a href="#glo:capitalisefmtwords"><code class="csfmt">\capitalisefmtwords</code></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: <pre class="transcript"><div class="transcripttitle"><a id="wrglossary.534"></a><a href="#glo:sym.transcript"><span title="Transcript" class="icon">🔎</span></a></div>Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding): -(hyperref)                removing `\capitalisewords' -</pre> -<!--l. 679--><p class="nopar" > </div> -</p><!--l. 680--><p class="noindent" > -</p><!--l. 682--><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 -class="cmtt-10">\texorpdfstring</span><a - id="dx1-5004"></a> command. For example: - - - -</p> - <pre class="verbatim" id="verbatim-43"> -\chapter{\texorpdfstring -  {\capitalisewords{a book of rhyme}}% TeX -  {A Book of Rhyme}% PDF +(hyperref) removing `<a id="wrglossary.535"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>' +</pre><p> +If you want to provide an alternative for the PDF bookmark, you can use <a id="wrglossary.536"></a><a href="#glo:pkg.hyperref"><span class="styfmt">hyperref</span></a>’s <a id="wrglossary.537"></a><a href="#glo:texorpdfstring"><code class="csfmt">\texorpdfstring</code></a> command. For example: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.538"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><code class="cmd">\chapter</code>{<a id="wrglossary.539"></a><a href="#glo:texorpdfstring"><code class="csfmt">\texorpdfstring</code></a> + {<a id="wrglossary.540"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>{a book of rhyme}}<span class="comment">% TeX</span> + {A Book of Rhyme}<span class="comment">% PDF</span> } -</pre> -<!--l. 689--><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: - - - -</p> - <pre class="verbatim" id="verbatim-44"> -\pdfstringdefDisableCommands{% - \let\capitalisewords\@firstofone +</pre> Alternatively, you can use <a id="wrglossary.541"></a><a href="#glo:pkg.hyperref"><span class="styfmt">hyperref</span></a>’s mechanism for disabling commands within the bookmarks. For example: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.542"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><a id="wrglossary.543"></a><a href="#glo:pdfstringdefDisableCommands"><code class="csfmt">\pdfstringdefDisableCommands</code></a>{<span class="comment">% </span> + <code class="cmd">\let</code><a id="wrglossary.544"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a><code class="cmd">\@firstofone</code> } -</pre> -<!--l. 696--><p class="nopar" > -</p><!--l. 698--><p class="indent" > See the <span -class="cmss-10">hyperref</span><a - id="dx1-5006"></a> manual for further details. -</p><!--l. 700--><p class="noindent" > -</p> -<!--l. 700--><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. 703--><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. 705--><p class="indent" > <hr><div title="Definition"><span class="reversemarginpar"><span -class="cmtt-9">\MFUnocap</span><span -class="cmtt-9"> </span></span><a - id="dx1-6001"></a> <span -class="cmtt-10">\MFUnocap{</span>⟨<span -class="cmitt-10">word</span>⟩<span -class="cmtt-10">} </span></div><hr> -</p><!--l. 707--><p class="noindent" > -This only has a local effect. The global version is: -</p><!--l. 709--><p class="indent" > <hr><div title="Definition"><span class="reversemarginpar"><span -class="cmtt-9">\gMFUnocap</span><span -class="cmtt-9"> </span></span><a - id="dx1-6002"></a> <span -class="cmtt-10">\gMFUnocap{</span>⟨<span -class="cmitt-10">word</span>⟩<span -class="cmtt-10">} </span></div><hr> -</p><!--l. 711--><p class="noindent" > -</p><!--l. 713--><p class="indent" > For example: - - - -</p> - <pre class="verbatim" id="verbatim-45"> -\capitalisewords{the wind in the willows} -\MFUnocap{in}% -\MFUnocap{the}% -\capitalisewords{the wind in the willows} -</pre> -<!--l. 721--><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. 732--><p class="indent" > <hr><div title="Definition"><span class="reversemarginpar"><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. 734--><p class="noindent" > -</p><!--l. 736--><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> - <pre class="verbatim" id="verbatim-46"> -\MFUclear -\capitalisewords{the {}wind in the willows} -</pre> -<!--l. 742--><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 -example: - - - -</p> - <pre class="verbatim" id="verbatim-47"> -\capitalisewords{this is section {}\nameref{sec:nocap}.} -</pre> -<!--l. 752--><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>. It just happens to already be in title -case.) -</p><!--l. 760--><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 -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. 767--><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> - <pre class="verbatim" id="verbatim-48"> -\NeedsTeXFormat{LaTeX2e} -</pre> -<!--l. 772--><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> - <pre class="verbatim" id="verbatim-49"> -\ProvidesPackage{mfirstuc-french} -</pre> -<!--l. 777--><p class="nopar" > It’s a good idea to also add a version in the final optional argument, for example: - - - -</p> - <pre class="verbatim" id="verbatim-50"> -\ProvidesPackage{mfirstuc-french}[2014/07/30 v1.0] -</pre> -<!--l. 782--><p class="nopar" > Next load <span -class="cmss-10">mfirstuc</span>: - - - -</p> - <pre class="verbatim" id="verbatim-51"> -\RequirePackage{mfirstuc} -</pre> -<!--l. 786--><p class="nopar" > Now add all your <span -class="cmtt-10">\MFUnocap </span>commands. For example: - - - -</p> - <pre class="verbatim" id="verbatim-52"> -\MFUnocap{de} -</pre> -<!--l. 790--><p class="nopar" > At the end of the file add: - - - -</p> - <pre class="verbatim" id="verbatim-53"> -\endinput -</pre> -<!--l. 794--><p class="nopar" > -</p><!--l. 796--><p class="indent" > Put the file somewhere on TeX’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. 801--><p class="indent" > </div> -</p><!--l. 801--><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. 804--><p class="indent" > (See <a -href="https://dickimaw-books.com/blog/binary-files-text-files-and-file-encodings/" >Binary Files, Text Files and File Encodings</a> if you are confused about how file -encodings such as UTF-8 relate to text files.) -</p><!--l. 809--><p class="indent" > The <span -class="cmtt-10">\makefirstuc </span>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, <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. 816--><p class="indent" > A simplistic version of the <span -class="cmtt-10">\makefirstuc </span>command is: - - - -</p> - <pre class="verbatim" id="verbatim-54"> -\newcommand*{\FirstUC}[1]{\MakeUppercase #1} -</pre> -<!--l. 819--><p class="nopar" > Here - - - -</p> - <pre class="verbatim" id="verbatim-55"> -\FirstUC{abc} -</pre> -<!--l. 823--><p class="nopar" > is equivalent to - - - -</p> - <pre class="verbatim" id="verbatim-56"> -\MakeUppercase abc -</pre> -<!--l. 827--><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. 832--><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 -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. 864--><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. 878--><p class="indent" > This will result in the error: - - - -</p> - <pre class="verbatim" id="verbatim-57"> -! Argument of \UTFviii@two@octets has an extra }. -</pre> -<!--l. 881--><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. 886--><p class="indent" > The reason for this error message is due to TeX having been written before Unicode was -invented. Although <span -class="cmtt-10">ã</span> may look like a single character in your text editor, from TeX’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> Over recent years the LaTeX kernel has changed to allow the use of UTF-8 characters within -labels but the fundamental problem of each octet been viewed as a separated token -remains. -<!--l. 905--><p class="indent" > 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: </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. 921--><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-7002"></a> <span -class="cmti-10">package</span>. -</p><!--l. 925--><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@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="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> - <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">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  <span class="underline">6</span>, <span class="underline">20</span> <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">13 </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">13 </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">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  <span class="underline">20</span> <br /></span> -</p><p class="theindex"> <span -class="cmbx-10">G</span> -<span class="index-item"><span -class="cmss-10">glossaries </span>package  <span class="underline">6, 7</span>, <span class="underline">18</span> <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">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">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  <span class="underline">15</span> <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">8 </span><br /></span> -<span class="index-item"><span -class="cmss-10">inputenc </span>package  <span class="underline">6</span> <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">5 </span><br /></span> -<span class="index-item"><span -class="cmss-10">mfirstuc </span>package  <span class="underline">6</span>, <span class="underline">20</span> <br /></span> - - - -<span class="index-item"><span -class="cmss-10">mfirstuc-english </span>package  <span class="underline">9</span>, <span class="underline">16</span> <br /></span> -<span class="index-item"><span class="obeylines-h"><span class="verb"><span -class="cmtt-10">\MFUcapwordfirstuc</span></span></span>  <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">16 </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">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">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">15 </span><br /></span> -<span class="index-item"><span class="obeylines-h"><span class="verb"><span -class="cmtt-10">\MFUskippunc</span></span></span>  <span -class="cmti-10">5 </span><br /></span> -<span class="index-item"><span class="obeylines-h"><span class="verb"><span -class="cmtt-10">\MFUwordbreak</span></span></span>  <span -class="cmti-10">9 </span><br /></span> -</p><p class="theindex"> <span -class="cmbx-10">T</span> -<span class="index-item"><span -class="cmss-10">textcase </span>package  <span class="underline">7</span> <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">13 </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">13 </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">7 </span><br /></span> -</p></div> - -</body></html> - - - - +</pre> The same applies to <a id="wrglossary.545"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>. You can, however, use the expandable <a id="wrglossary.546"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>. So you may prefer: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.547"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><a id="wrglossary.548"></a><a href="#glo:pdfstringdefDisableCommands"><code class="csfmt">\pdfstringdefDisableCommands</code></a>{<span class="comment">% </span> + <code class="cmd">\let</code><a id="wrglossary.549"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a><code class="cmd">\MFUsentencecase</code> + <code class="cmd">\let</code><a id="wrglossary.550"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a><code class="cmd">\MFUsentencecase</code> +} +</pre><p> +See the <a id="wrglossary.551"></a><a href="#glo:pkg.hyperref"><span class="styfmt">hyperref</span></a> manual for further details.<p> + +</section><!-- end of section sec:pdfbookmarks --> + +<section id="sec:titlecaseexamples"><!-- start of section sec:titlecaseexamples --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->2.3. Examples<div class="labellink"><a href="#sec:titlecaseexamples">[link]</a></div></h2><!-- end of section header --> +<p> + +<ol class="displaylist"> + <li><span class="numitem">1.</span>Text only: <div style="text-align: center; border-style: none; "><a id="wrglossary.552"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a><a id="wrglossary.553"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of frame@coderesult@title --> +<p> +<pre class="sidebysidecode"> +<a id="wrglossary.554"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>{a little book of rhyme} +</pre><div class="sidebysideresult">A Little Book Of Rhyme </div><p> +<p> +<li><span class="numitem">2.</span>Excluding words (see §<a href="#sec:nocap">2.1</a>): <div style="text-align: center; border-style: none; "><a id="wrglossary.555"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a><a id="wrglossary.556"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of frame@coderesult@title --> +<p> +<pre class="sidebysidecode"> +<a id="wrglossary.557"></a><a href="#glo:MFUnocap"><code class="csfmt">\MFUnocap</code></a>{of} +<a id="wrglossary.558"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>{a little book of rhyme} +</pre><div class="sidebysideresult"> A Little Book of Rhyme </div><p> +<p> +<li><span class="numitem">3.</span><a id="wrglossary.559"></a><a href="#glo:space"><code class="csfmt">\space</code></a> isn’t recognised as a word boundary: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.560"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><a id="wrglossary.561"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>{a book of rhyme.} + +<a id="wrglossary.562"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>{a book<a id="wrglossary.563"></a><a href="#glo:space"><code class="csfmt">\space</code></a> of rhyme.} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.564"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> +A Book Of Rhyme.<p> +A Book of Rhyme. </div><!-- end of resultbox --> +<p> +<li><span class="numitem">4.</span>Phrase entirely enclosed in a formatting command: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.565"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><a id="wrglossary.566"></a><a href="#glo:capitalisefmtwords"><code class="csfmt">\capitalisefmtwords</code></a>{<code class="cmd">\emph</code>{a small book of rhyme}} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.567"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> +<span style="font-style: italic; font-variant: normal; ">A Small Book Of Rhyme</span> </div><!-- end of resultbox --> +<p> +<li><span class="numitem">5.</span>Sub-phrase enclosed in a formatting command: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.568"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><a id="wrglossary.569"></a><a href="#glo:capitalisefmtwords"><code class="csfmt">\capitalisefmtwords</code></a>{a <code class="cmd">\emph</code>{small book} of rhyme} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.570"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> +A <span style="font-style: italic; font-variant: normal; ">Small Book</span> Of Rhyme </div><!-- end of resultbox --> +<p> +<li><span class="numitem">6.</span>Nested text-block commands: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.571"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><a id="wrglossary.572"></a><a href="#glo:capitalisefmtwords"><code class="csfmt">\capitalisefmtwords</code></a>{<code class="cmd">\textbf</code>{a <code class="cmd">\emph</code>{small book}} of rhyme} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.573"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> +<span style="font-weight: bold; ">A <span style="font-style: italic; font-variant: normal; ">Small Book</span></span> Of Rhyme </div><!-- end of resultbox --> +<p> +<li><span class="numitem">7.</span>Formatting and case-change exception (see §<a href="#sec:nocap">2.1</a>): <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.574"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><a id="wrglossary.575"></a><a href="#glo:MFUnocap"><code class="csfmt">\MFUnocap</code></a>{of} +<a id="wrglossary.576"></a><a href="#glo:capitalisefmtwords"><code class="csfmt">\capitalisefmtwords</code></a>{<code class="cmd">\textbf</code>{a <code class="cmd">\emph</code>{small book}} of rhyme} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.577"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> + <span style="font-weight: bold; ">A <span style="font-style: italic; font-variant: normal; ">Small Book</span></span> of Rhyme </div><!-- end of resultbox --> +<p> +<li><span class="numitem">8.</span>Starred form: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.578"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><a id="wrglossary.579"></a><a href="#glo:MFUnocap"><code class="csfmt">\MFUnocap</code></a>{of} +<a id="wrglossary.580"></a><a href="#glo:capitalisefmtwords"><code class="csfmt">\capitalisefmtwords</code></a>*{<code class="cmd">\emph</code>{a small book of rhyme}} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.581"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> + <span style="font-style: italic; font-variant: normal; ">A Small Book of Rhyme</span> </div><!-- end of resultbox --> +<p> +<li><span class="numitem">9.</span>The starred form also works with just text (no text-block command): <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.582"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><a id="wrglossary.583"></a><a href="#glo:MFUnocap"><code class="csfmt">\MFUnocap</code></a>{of} +<a id="wrglossary.584"></a><a href="#glo:capitalisefmtwords"><code class="csfmt">\capitalisefmtwords</code></a>*{a small book of rhyme} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.585"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> + A Small Book of Rhyme </div><!-- end of resultbox --> +<p> +<li><span class="numitem">10.</span>Expansion: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.586"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><code class="cmd">\newcommand</code>{<code class="cmd">\abc</code>}{<code class="cmd">\xyz</code><a id="wrglossary.587"></a><a href="#glo:space"><code class="csfmt">\space</code></a> four five} +<code class="cmd">\newcommand</code>{<code class="cmd">\xyz</code>}{one two three} +No expansion: <a id="wrglossary.588"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>{<code class="cmd">\abc</code>}. + +First object one-level expansion: <a id="wrglossary.589"></a><a href="#glo:xcapitalisewords"><code class="csfmt">\xcapitalisewords</code></a>{<code class="cmd">\abc</code>}. + +Fully expanded: <a id="wrglossary.590"></a><a href="#glo:ecapitalisewords"><code class="csfmt">\ecapitalisewords</code></a>{<code class="cmd">\abc</code>}. +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.591"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> + No expansion: one two three four five.<p> +First object one-level expansion: one two three Four Five.<p> +Fully expanded: One Two Three Four Five. </div><!-- end of resultbox --> +<p> +Remember that the spaces need to be explicit. In the second case above, using <a id="wrglossary.592"></a><a href="#glo:xcapitalisewords"><code class="csfmt">\xcapitalisewords</code></a>, the space before <span class="qt">“four”</span> has been hidden within <a id="wrglossary.593"></a><a href="#glo:space"><code class="csfmt">\space</code></a> so it’s not recognised as a word boundary, but in the third case, <a id="wrglossary.594"></a><a href="#glo:space"><code class="csfmt">\space</code></a> has been expanded to an actual space character.<p> + +</ol> +<p> +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: <pre class="badcodebox"><div class="badcodeboxtitle"><a id="wrglossary.595"></a><a href="#glo:sym.badcode"><span title="Problematic Input" class="icon"><span class="overlapped">🖹</span><span class="overlapper"><span class="deprecatedorbannedfmt">🛇</span></span></span></a></div><a id="wrglossary.596"></a><a href="#glo:MFUnocap"><code class="csfmt">\MFUnocap</code></a>{of} +<a id="wrglossary.597"></a><a href="#glo:capitalisefmtwords"><code class="csfmt">\capitalisefmtwords</code></a>*{<code class="cmd">\emph</code>{a small} book <code class="cmd">\textbf</code>{of rhyme}} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.598"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> + <span style="font-style: italic; font-variant: normal; ">A Small</span> Book <span style="font-weight: bold; ">Of rhyme</span> </div><!-- end of resultbox --> + In this case <code class="code"><span class="cmdfmt">\textbf</span>{of rhyme}</code> is considered a single word. Similarly if the text-block command occurs in the middle of the argument: <pre class="badcodebox"><div class="badcodeboxtitle"><a id="wrglossary.599"></a><a href="#glo:sym.badcode"><span title="Problematic Input" class="icon"><span class="overlapped">🖹</span><span class="overlapper"><span class="deprecatedorbannedfmt">🛇</span></span></span></a></div><a id="wrglossary.600"></a><a href="#glo:MFUnocap"><code class="csfmt">\MFUnocap</code></a>{of} +<a id="wrglossary.601"></a><a href="#glo:capitalisefmtwords"><code class="csfmt">\capitalisefmtwords</code></a>*{a <code class="cmd">\emph</code>{very small} book of rhyme} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.602"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> + A <span style="font-style: italic; font-variant: normal; ">Very small</span> Book of Rhyme </div><!-- end of resultbox --> + In this case <code class="code"><span class="cmdfmt">\emph</span>{very small}</code> is considered a single word.<p> +Grouping causes interference. As with all the commands described here, avoid declarations. <pre class="badcodebox"><div class="badcodeboxtitle"><a id="wrglossary.603"></a><a href="#glo:sym.badcode"><span title="Problematic Input" class="icon"><span class="overlapped">🖹</span><span class="overlapper"><span class="deprecatedorbannedfmt">🛇</span></span></span></a></div><a id="wrglossary.604"></a><a href="#glo:capitalisefmtwords"><code class="csfmt">\capitalisefmtwords</code></a>{{<code class="cmd">\bfseries</code> a <code class="cmd">\emph</code>{small book}} of rhyme} +</pre><p> +<div class="information"><div class="informationtitle"><a id="wrglossary.605"></a><a href="#glo:sym.information"><span title="Information" class="icon">🛈</span></a></div><!-- end of informationtitle --> +As a general rule, it’s better to define <a id="wrglossary.606"></a><a href="#glo:dual.semanticcommand">semantic commands</a> rather than directly using font commands and declarations within the document. </div><!-- end of information --> +<p> +Avoid complicated commands in the unstarred version. For example, the following breaks: <pre class="badcodebox"><div class="badcodeboxtitle"><a id="wrglossary.607"></a><a href="#glo:sym.badcode"><span title="Problematic Input" class="icon"><span class="overlapped">🖹</span><span class="overlapper"><span class="deprecatedorbannedfmt">🛇</span></span></span></a></div><code class="cmd">\newcommand</code>*{<code class="cmd">\swap</code>}[2]{{#2}{#1}} +<a id="wrglossary.608"></a><a href="#glo:capitalisefmtwords"><code class="csfmt">\capitalisefmtwords</code></a>{a <code class="cmd">\swap</code>{bo}{ok} of rhyme} +</pre> However it can work with the starred form and the simpler <a id="wrglossary.609"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.610"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><code class="cmd">\newcommand</code>*{<code class="cmd">\swap</code>}[2]{{#2}{#1}} +<a id="wrglossary.611"></a><a href="#glo:capitalisefmtwords"><code class="csfmt">\capitalisefmtwords</code></a>*{a <code class="cmd">\swap</code>{bo}{ok} of rhyme} + +<a id="wrglossary.612"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>{a <code class="cmd">\swap</code>{bo}{ok} of rhyme} +</pre> <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.613"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> + A okBo Of Rhyme<p> +A okBo Of Rhyme </div><!-- end of resultbox --> + Note that the case change is applied to the first argument.<p> + +</section><!-- end of section sec:titlecaseexamples --> + +<section id="sec:misc"><!-- start of section sec:misc --><div class="tomain"><a href="#main">[top]</a></div> +<h1><!-- start of chapter header -->3. Miscellaneous<div class="labellink"><a href="#sec:misc">[link]</a></div></h1><!-- end of chapter header --> +<p> + +</section><!-- end of section sec:misc --> + +<section id="sec:savetoaux"><!-- start of section sec:savetoaux --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->3.1. Saving exclusions, blockers and mappings in the <span class="extfmt">aux</span> File<div class="labellink"><a href="#sec:savetoaux">[link]</a></div></h2><!-- end of section header --> +<p> +If the <a id="wrglossary.614"></a><a href="#glo:dual.exclusion">exclusions</a>, <a id="wrglossary.615"></a><a href="#glo:dual.mapping">mappings</a> and <a id="wrglossary.616"></a><a href="#glo:dual.blocker">blockers</a> are required by some external tool, the information can be saved in the <a id="wrglossary.617"></a><a href="#glo:ext.aux"><span class="extfmt">aux</span></a> file.<p> +<div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.618"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.619"></a><code class="code"><dfn id="glo:MFUsaveatend"><code class="csfmt">\MFUsaveatend</code></dfn></code></div><!-- end of pinnedbox --> + This saves the information at the end of the document using a delayed write. This means that it can register all information identified throughout the document, but there’s a chance the document may end before the write takes place (for example, if the last page only contains floats). This command may be counteracted by: <div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.620"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.621"></a><code class="code"><dfn id="glo:MFUsave"><code class="csfmt">\MFUsave</code></dfn></code></div><!-- end of pinnedbox --> + This saves the information using a protected write at the point where this command occurs, which may be too soon if additional <a id="wrglossary.622"></a><a href="#glo:dual.exclusion">exclusions</a>, <a id="wrglossary.623"></a><a href="#glo:dual.mapping">mappings</a> or <a id="wrglossary.624"></a><a href="#glo:dual.blocker">blockers</a> are identified later. This command will counteract any instance of <a id="wrglossary.625"></a><a href="#glo:MFUsaveatend"><code class="csfmt">\MFUsaveatend</code></a>, regardless of whether or not <a id="wrglossary.626"></a><a href="#glo:MFUsaveatend"><code class="csfmt">\MFUsaveatend</code></a> comes before or after <a id="wrglossary.627"></a><a href="#glo:MFUsave"><code class="csfmt">\MFUsave</code></a>.<p> +The associated <a id="wrglossary.628"></a><a href="#glo:ext.aux"><span class="extfmt">aux</span></a> commands are listed below. In each case, a definition is provided in the <a id="wrglossary.629"></a><a href="#glo:ext.aux"><span class="extfmt">aux</span></a> file that does nothing. <div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.630"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.631"></a><code class="code"><dfn id="glo:@mfu@excls"><code class="csfmt">\@mfu@excls</code></dfn>{<span class="meta">〈<em class="metainner">exclusions</em>〉</span>}</code></div><!-- end of pinnedbox --> + Lists all <a id="wrglossary.632"></a><a href="#glo:dual.exclusion">exclusions</a>. For example: <pre class="compactcodebox"><a id="wrglossary.633"></a><a href="#glo:@mfu@excls"><code class="csfmt">\@mfu@excls</code></a>{<a id="wrglossary.634"></a><a href="#glo:begin"><code class="csfmt">\begin</code></a> <a id="wrglossary.635"></a><a href="#glo:cite"><code class="csfmt">\cite</code></a> <a id="wrglossary.636"></a><a href="#glo:end"><code class="csfmt">\end</code></a> <a id="wrglossary.637"></a><a href="#glo:label"><code class="csfmt">\label</code></a> +<a id="wrglossary.638"></a><a href="#glo:ref"><code class="csfmt">\ref</code></a> <a id="wrglossary.639"></a><a href="#glo:cite"><code class="csfmt">\cite</code></a> <a id="wrglossary.640"></a><a href="#glo:NoCaseChange"><code class="csfmt">\NoCaseChange</code></a> <a id="wrglossary.641"></a><a href="#glo:ensuremath"><code class="csfmt">\ensuremath</code></a> +<a id="wrglossary.642"></a><a href="#glo:MFUskippunc"><code class="csfmt">\MFUskippunc</code></a> <a id="wrglossary.643"></a><a href="#glo:gls"><code class="csfmt">\gls</code></a> <a id="wrglossary.644"></a><a href="#glo:glspl"><code class="csfmt">\glspl</code></a>} +</pre><p> +<div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.645"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.646"></a><code class="code"><dfn id="glo:@mfu@blockers"><code class="csfmt">\@mfu@blockers</code></dfn>{<span class="meta">〈<em class="metainner">blockers</em>〉</span>}</code></div><!-- end of pinnedbox --> + Lists all <a id="wrglossary.647"></a><a href="#glo:dual.blocker">blockers</a>. For example: <pre class="compactcodebox"><a id="wrglossary.648"></a><a href="#glo:@mfu@blockers"><code class="csfmt">\@mfu@blockers</code></a>{<a id="wrglossary.649"></a><a href="#glo:Gls"><code class="csfmt">\Gls</code></a> <a id="wrglossary.650"></a><a href="#glo:Glspl"><code class="csfmt">\Glspl</code></a> } +</pre><p> +<div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.651"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.652"></a><code class="code"><dfn id="glo:@mfu@mappings"><code class="csfmt">\@mfu@mappings</code></dfn>{<span class="meta">〈<em class="metainner">mappings</em>〉</span>}</code></div><!-- end of pinnedbox --> + Lists all <a id="wrglossary.653"></a><a href="#glo:dual.mapping">mappings</a> as a <span class="meta">〈<em class="metainner">key</em>〉</span>=<span class="meta">〈<em class="metainner">value</em>〉</span> list. For example: <pre class="compactcodebox"><a id="wrglossary.654"></a><a href="#glo:@mfu@mappings"><code class="csfmt">\@mfu@mappings</code></a>{ {<a id="wrglossary.655"></a><a href="#glo:gls"><code class="csfmt">\gls</code></a> }= {<a id="wrglossary.656"></a><a href="#glo:Gls"><code class="csfmt">\Gls</code></a> }, {<a id="wrglossary.657"></a><a href="#glo:glspl"><code class="csfmt">\glspl</code></a> }= {<a id="wrglossary.658"></a><a href="#glo:Glspl"><code class="csfmt">\Glspl</code></a> }} +</pre><p> + +</section><!-- end of section sec:savetoaux --> + +<section id="sec:allcaps"><!-- start of section sec:allcaps --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->3.2. All-Caps<div class="labellink"><a href="#sec:allcaps">[link]</a></div></h2><!-- end of section header --> +<p> +<div class="pinnedbox"><div class="pinnedboxtitle"><a id="wrglossary.659"></a><a href="#glo:sym.definition"><span title="Definition" class="icon">📌</span></a></div><!-- end of pinnedboxtitle --> +<a id="wrglossary.660"></a><code class="code"><dfn id="glo:mfirstucMakeUppercase"><code class="csfmt">\mfirstucMakeUppercase</code></dfn>{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code></div><!-- end of pinnedbox --> + This command was originally used to perform the actual conversion to <a id="wrglossary.661"></a><a href="#glo:idx.uppercase">uppercase</a> and was defined to use command <a id="wrglossary.662"></a><a href="#glo:MakeUppercase"><code class="csfmt">\MakeUppercase</code></a>. The <a id="wrglossary.663"></a><a href="#glo:pkg.glossaries"><span class="styfmt">glossaries</span></a> package (before v4.50) formerly loaded the <a id="wrglossary.664"></a><a href="#glo:pkg.textcase"><span class="styfmt">textcase</span></a> package and redefined <a id="wrglossary.665"></a><a href="#glo:mfirstucMakeUppercase"><code class="csfmt">\mfirstucMakeUppercase</code></a> to use <a id="wrglossary.666"></a><a href="#glo:MakeTextUppercase"><code class="csfmt">\MakeTextUppercase</code></a>, which was better than <a id="wrglossary.667"></a><a href="#glo:MakeUppercase"><code class="csfmt">\MakeUppercase</code></a>.<p> +The <a id="wrglossary.668"></a><a href="#glo:pkg.textcase"><span class="styfmt">textcase</span></a> package has been deprecated as from 2022 and it now simply sets <a id="wrglossary.669"></a><a href="#glo:MakeTextUppercase"><code class="csfmt">\MakeTextUppercase</code></a> to <a id="wrglossary.670"></a><a href="#glo:MakeUppercase"><code class="csfmt">\MakeUppercase</code></a> because the new kernel now defines <a id="wrglossary.671"></a><a href="#glo:MakeUppercase"><code class="csfmt">\MakeUppercase</code></a> to use the newer LaTeX3 command <a id="wrglossary.672"></a><a href="#glo:textuppercase:n"><code class="csfmt">\text_uppercase:n</code></a>. Although that command is expandable, <a id="wrglossary.673"></a><a href="#glo:MakeUppercase"><code class="csfmt">\MakeUppercase</code></a> is robust.<p> +As from v2.08, <a id="wrglossary.674"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> now defines <a id="wrglossary.675"></a><a href="#glo:mfirstucMakeUppercase"><code class="csfmt">\mfirstucMakeUppercase</code></a> so that it uses <a id="wrglossary.676"></a><a href="#glo:texttitlecasefirst:n"><code class="csfmt">\text_titlecase_first:n</code></a> directly, rather than indirectly through <a id="wrglossary.677"></a><a href="#glo:MakeUppercase"><code class="csfmt">\MakeUppercase</code></a>, which means that it’s now expandable. However, <a id="wrglossary.678"></a><a href="#glo:mfirstucMakeUppercase"><code class="csfmt">\mfirstucMakeUppercase</code></a> is no longer used by <a id="wrglossary.679"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> except in <a id="wrglossary.680"></a><a href="#glo:mfugrabfirstuc"><code class="csfmt">\mfugrabfirstuc</code></a>, which is provided to emulate v2.07. Note that the <a id="wrglossary.681"></a><a href="#glo:opt.grabfirst"><span class="optfmt">grabfirst</span></a> option will also redefine <a id="wrglossary.682"></a><a href="#glo:mfirstucMakeUppercase"><code class="csfmt">\mfirstucMakeUppercase</code></a> to use <a id="wrglossary.683"></a><a href="#glo:MakeUppercase"><code class="csfmt">\MakeUppercase</code></a>.<p> + +</section><!-- end of section sec:allcaps --> + +<section id="sec:utf8"><!-- start of section sec:utf8 --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->3.3. UTF-8<div class="labellink"><a href="#sec:utf8">[link]</a></div></h2><!-- end of section header --> +<p> +<div class="information"><div class="informationtitle"><a id="wrglossary.684"></a><a href="#glo:sym.information"><span title="Information" class="icon">🛈</span></a></div><!-- end of informationtitle --> +See <a href="https://www.dickimaw-books.com/blog/binary-files-text-files-and-file-encodings/">Binary Files, Text Files and File Encodings</a> if you are confused about how file encodings, such as <a id="wrglossary.685"></a><a href="#glo:utf8">UTF-8</a>, relate to text files. </div><!-- end of information --> +<p> +This section only applies to rollback or the use of <a id="wrglossary.686"></a><a href="#glo:mfugrabfirstuc"><code class="csfmt">\mfugrabfirstuc</code></a> (implemented via the <a id="wrglossary.687"></a><a href="#glo:opt.grabfirst"><span class="optfmt">grabfirst</span></a> option).<p> +Prior to version 2.08, the case-change applied by the <a id="wrglossary.688"></a><a href="#glo:glsmakefirstuc"><code class="csfmt">\glsmakefirstuc</code></a> command worked 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, <code class="code"><span class="cmdfmt">\frac</span>12</code> instead of <code class="code"><span class="cmdfmt">\frac</span>{1}{2}</code> or <code class="code">x^2</code> instead of <code class="code">x^{2}</code>, although this practice is discouraged by some.)<p> +A simplistic version of the original <a id="wrglossary.689"></a><a href="#glo:glsmakefirstuc"><code class="csfmt">\glsmakefirstuc</code></a> command is: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.690"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><code class="cmd">\newcommand</code>*{<code class="cmd">\FirstUC</code>}[1]{<a id="wrglossary.691"></a><a href="#glo:MakeUppercase"><code class="csfmt">\MakeUppercase</code></a> #1} +</pre> Here <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.692"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><code class="cmd">\FirstUC</code>{abc} +</pre> is equivalent to <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.693"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><a id="wrglossary.694"></a><a href="#glo:MakeUppercase"><code class="csfmt">\MakeUppercase</code></a> abc +</pre> and since <a id="wrglossary.695"></a><a href="#glo:MakeUppercase"><code class="csfmt">\MakeUppercase</code></a> requires an argument, it grabs the first token (the character <span class="qt">“a”</span> in this case) and uses that as the argument so that the result is <span class="qt">“Abc”</span>. This behaviour can be achieved with <a id="wrglossary.696"></a><a href="#glo:mfugrabfirstuc"><code class="csfmt">\mfugrabfirstuc</code></a>.<p> +Unfortunately, this will fail if the content starts with a <a id="wrglossary.697"></a><a href="#glo:utf8">UTF-8</a> character and you are using pdfLaTeX, where each octet of the <a id="wrglossary.698"></a><a href="#glo:utf8">UTF-8</a> character is a separate token. This isn’t a problem with XeLaTeX and LuaLaTeX which both treat the entire multibyte character as a single token.<p> +LaTeX3 now provides <a id="wrglossary.699"></a><a href="#glo:texttitlecasefirst:n"><code class="csfmt">\text_titlecase_first:n</code></a> to convert the first character to uppercase, so now the case-change can be applied with: <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.700"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div><code class="cmd">\ExplSyntaxOn</code> +<a id="wrglossary.701"></a><a href="#glo:texttitlecasefirst:n"><code class="csfmt">\text_titlecase_first:n</code></a>{élite} +<code class="cmd">\ExplSyntaxOff</code> +</pre> This is exactly what <a id="wrglossary.702"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a> does without the need to switch on LaTeX3 syntax. The difference with the default definition of <a id="wrglossary.703"></a><a href="#glo:glsmakefirstuc"><code class="csfmt">\glsmakefirstuc</code></a> is that it prevents its argument from being expanded.<p> + +</section><!-- end of section sec:utf8 --> + +<section id="symbols"><!-- start of section symbols --><div class="tomain"><a href="#main">[top]</a></div> +<h1><!-- start of chapter header -->Symbols<div class="labellink"><a href="#symbols">[link]</a></div></h1><!-- end of chapter header --> + +<dl class="inlineblock"> +<dt><dfn id="glo:sym.definition">📌</dfn></dt> +<dd>The syntax and usage of a command, environment or option etc.</dd> +<dt><dfn id="glo:sym.important">ℹ</dfn></dt> +<dd>An important message.</dd> +<dt><dfn id="glo:sym.information">🛈</dfn></dt> +<dd>Prominent information.</dd> +<dt><dfn id="glo:sym.code">🖹</dfn></dt> +<dd>LaTeX code to insert into your document.</dd> +<dt><dfn id="glo:sym.badcode"><span class="overlapped">🖹</span><span class="overlapper"><span class="deprecatedorbannedfmt">🛇</span></span></dfn></dt> +<dd>Problematic code which should be avoided.</dd> +<dt><dfn id="glo:sym.result">🖺</dfn></dt> +<dd>How the example code should appear in the PDF.</dd> +<dt><dfn id="glo:sym.transcript">🔎</dfn></dt> +<dd>Text in a transcript or log file or written to STDOUT or STDERR.</dd> +<dt><dfn id="glo:sym.unicode"><span class="overlapped">🗋</span><span class="overlapper">U</span></dfn></dt> +<dd>Code that requires a native Unicode engine (XeLaTeX or LuaLaTeX).</dd> +<dt><dfn id="glo:sym.novaluesetting">𝍢</dfn></dt> +<dd>An option that doesn’t take a value.</dd> +<dt><dfn id="glo:sym.warning">⚠</dfn></dt> +<dd>A warning.</dd> + +</dl> + +</section><!-- end of section symbols --> + +<section id="glossary"><!-- start of section glossary --><div class="tomain"><a href="#main">[top]</a></div> +<h1><!-- start of chapter header -->Glossary<div class="labellink"><a href="#glossary">[link]</a></div></h1><!-- end of chapter header --> + +<dl> +<dt><a id="wrglossary.704"></a><dfn id="glo:dual.blocker">Blocker</dfn></dt> +<dd>A command that prohibits case-changing. If encountered by <a id="wrglossary.705"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>, it won’t attempt to apply any case-changing. See §<a href="#sec:blockers">1.4</a>.</dd> +<dt><a id="wrglossary.706"></a><dfn id="glo:dual.exclusion">Exclusion command</dfn></dt> +<dd>A command whose argument should be skipped by the case-changer. The content that follows the command should have its case-changed instead. See §<a href="#sec:exclusions">1.3</a>.</dd> +<dt><a id="wrglossary.707"></a><dfn id="glo:dual.exclusion-word">Exclusion word</dfn></dt> +<dd>A word that shouldn’t have its case changed by <a id="wrglossary.708"></a><a href="#glo:dual.title-case">title-case</a> commands, unless the word occurs at the start.</dd> +<dt><a id="wrglossary.709"></a><dfn id="glo:dual.mapping">Mapping</dfn></dt> +<dd>A command that should be substituted by another, if encountered by <a id="wrglossary.710"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>, instead of applying a case-change. See §<a href="#sec:mappings">1.5</a>.</dd> +<dt><a id="wrglossary.711"></a><dfn id="glo:dual.semanticcommand">Semantic command</dfn></dt> +<dd>Essentially, this is a command associated with a particular element, idea or topic that hides the font and other stylistic formatting inside its definition. For example, Latin taxonomy is usually displayed in italic. Explicitly using font commands, for example <pre class="compactcodebox"><code class="cmd">\textit</code>{Clostridium}</pre> is syntactic markup. Whereas defining a command called, say, <code class="cmd">\bacteria</code> that displays its argument in italics is a semantic command. The actual styling is hidden and the command relates specifically to a particular concept. <pre class="codebox"><div class="codeboxtitle"><a id="wrglossary.712"></a><a href="#glo:sym.code"><span title="Input" class="icon">🖹</span></a></div>Syntactic: <code class="cmd">\textit</code>{Clostridium} + +<code class="cmd">\newrobustcmd</code>*{<code class="cmd">\bacteria</code>}[1]<code class="cmd">\emph</code>{#1}%<br>Semantic: <code class="cmd">\bacteria</code>{Clostridium} </pre> The end result is the same: <div class="resultbox"><div class="resultboxtitle"><a id="wrglossary.713"></a><a href="#glo:sym.result"><span title="Result" class="icon">🖺</span></a></div><!-- end of resultboxtitle --> +Syntactic: <span style="font-style: italic; font-variant: normal; ">Clostridium</span><p> +Semantic: <span style="font-style: italic; font-variant: normal; ">Clostridium</span> </div><!-- end of resultbox --> + The advantage with semantic commands is that it’s much easier to change the style, simply by adjusting the command definition. Note that I’ve used <code class="cmd">\newrobustcmd</code> to make the semantic command robust as the style commands can cause a problem if they expand too soon.</dd> +<dt><a id="wrglossary.714"></a><dfn id="glo:dual.sentence-case">Sentence-case</dfn></dt> +<dd>Content that should appear at the start of a sentence that needs to have its first significant character converted to <a id="wrglossary.715"></a><a href="#glo:idx.uppercase">uppercase</a>. See §<a href="#sec:sentencecase">1</a>.</dd> +<dt><a id="wrglossary.716"></a><dfn id="glo:dual.title-case">Title-case</dfn></dt> +<dd>Content that needs to appear in a title that should have each significant word converted to <a id="wrglossary.717"></a><a href="#glo:dual.sentence-case">sentence-case</a>. See §<a href="#sec:capitalisewords">2</a>.</dd> +<dt><a id="wrglossary.718"></a><dfn id="glo:dual.utf8">Unicode Transformation Format (8-bit) (UTF-8)</dfn></dt> +<dd>A variable-width encoding that uses 8-bit code units. This means that some characters are represented by more that one byte. XeLaTeX and LuaLaTeX treat the multi-byte sequence as a single token, but the older LaTeX formats have single-byte tokens, which can cause complications, although these have mostly been addressed with the newer kernels introduced over the past few years. Related blog article: <a href="https://www.dickimaw-books.com/blog/binary-files-text-files-and-file-encodings/">Binary Files, Text Files and File Encodings</a>.</dd> + +</dl> + +</section><!-- end of section glossary --> + +<section id="cmdsummary"><!-- start of section cmdsummary --><div class="tomain"><a href="#main">[top]</a></div> +<h1><!-- start of chapter header -->Command Summary<div class="labellink"><a href="#cmdsummary">[link]</a></div></h1><!-- end of chapter header --> + +</section><!-- end of section cmdsummary --> + +<section id="summary.index@"><!-- start of section summary.index@ --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->@<div class="labellink"><a href="#summary.index@">[link]</a></div></h2><!-- end of section header --> +<div class="defnbox"><a id="wrglossary.719"></a><a href="#glo:@mfu@blockers"><code class="csfmt">\@mfu@blockers</code></a><code class="code">{<span class="meta">〈<em class="metainner">blockers</em>〉</span>}</code><span class="floatrightbox"><a id="wrglossary.720"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v2.08+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +An <a id="wrglossary.721"></a><a href="#glo:ext.aux"><span class="extfmt">aux</span></a> file command that lists all the identified <a id="wrglossary.722"></a><a href="#glo:dual.blocker">blockers</a>. <a href="#sec:savetoaux">§3.1</a>; <a href="#wrglossary.646">27</a><p> +<div class="defnbox"><a id="wrglossary.723"></a><a href="#glo:@mfu@excls"><code class="csfmt">\@mfu@excls</code></a><code class="code">{<span class="meta">〈<em class="metainner">exclusions</em>〉</span>}</code><span class="floatrightbox"><a id="wrglossary.724"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v2.08+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +An <a id="wrglossary.725"></a><a href="#glo:ext.aux"><span class="extfmt">aux</span></a> file command that lists all the identified <a id="wrglossary.726"></a><a href="#glo:dual.exclusion">exclusions</a>. <a href="#sec:savetoaux">§3.1</a>; <a href="#wrglossary.631">26</a><p> +<div class="defnbox"><a id="wrglossary.727"></a><a href="#glo:@mfu@mappings"><code class="csfmt">\@mfu@mappings</code></a><code class="code">{<span class="meta">〈<em class="metainner">mappings</em>〉</span>}</code><span class="floatrightbox"><a id="wrglossary.728"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v2.08+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +An <a id="wrglossary.729"></a><a href="#glo:ext.aux"><span class="extfmt">aux</span></a> file command that lists all the identified <a id="wrglossary.730"></a><a href="#glo:dual.mapping">mappings</a> as a <span class="meta">〈<em class="metainner">key</em>〉</span>=<span class="meta">〈<em class="metainner">value</em>〉</span> list. <a href="#sec:savetoaux">§3.1</a>; <a href="#wrglossary.652">27</a><p> + +</section><!-- end of section summary.index@ --> + +<section id="summary.index6684672"><!-- start of section summary.index6684672 --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->C<div class="labellink"><a href="#summary.index6684672">[link]</a></div></h2><!-- end of section header --> +<div class="defnbox"><a id="wrglossary.731"></a><a href="#glo:capitalisefmtwords"><code class="csfmt">\capitalisefmtwords</code></a><code class="code">{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code><span class="floatrightbox"><span class="summarytag">modifier: </span>* <a id="wrglossary.732"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v2.03+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +Similar to <a id="wrglossary.733"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a> but for content that may contain formatting commands. <a href="#sec:capitalisewords">§2</a>; <a href="#wrglossary.461">16</a><p> +<div class="defnbox"><a id="wrglossary.734"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a><code class="code">{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code><span class="floatrightbox"><a id="wrglossary.735"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v1.06+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +Applies <a id="wrglossary.736"></a><a href="#glo:dual.title-case">title-case</a> to <span class="meta">〈<em class="metainner">text</em>〉</span>. This will apply <a id="wrglossary.737"></a><a href="#glo:MFUcapword"><code class="csfmt">\MFUcapword</code></a> to each word in <span class="meta">〈<em class="metainner">text</em>〉</span> (unless the word has been identified as an <a id="wrglossary.738"></a><a href="#glo:dual.exclusion-word">exclusion word</a> and doesn’t occur at the start of <span class="meta">〈<em class="metainner">text</em>〉</span>). <a href="#sec:capitalisewords">§2</a>; <a href="#wrglossary.405">14</a><p> + +</section><!-- end of section summary.index6684672 --> + +<section id="summary.index6815744"><!-- start of section summary.index6815744 --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->E<div class="labellink"><a href="#summary.index6815744">[link]</a></div></h2><!-- end of section header --> +<div class="defnbox"><a id="wrglossary.739"></a><a href="#glo:ecapitalisefmtwords"><code class="csfmt">\ecapitalisefmtwords</code></a><code class="code">{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code><span class="floatrightbox"><span class="summarytag">modifier: </span>* <a id="wrglossary.740"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v2.03+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +Fully expands <span class="meta">〈<em class="metainner">text</em>〉</span> and passes it to <a id="wrglossary.741"></a><a href="#glo:capitalisefmtwords"><code class="csfmt">\capitalisefmtwords</code></a> including the <code class="code">*</code> modifier, if provided. <a href="#sec:capitalisewords">§2</a>; <a href="#wrglossary.472">17</a><p> +<div class="defnbox"><a id="wrglossary.742"></a><a href="#glo:ecapitalisewords"><code class="csfmt">\ecapitalisewords</code></a><code class="code">{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code><span class="floatrightbox"><a id="wrglossary.743"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v1.10+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +Fully expands <span class="meta">〈<em class="metainner">text</em>〉</span> before passing it to <a id="wrglossary.744"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>. <a href="#sec:capitalisewords">§2</a>; <a href="#wrglossary.420">14</a><p> +<div class="defnbox"><a id="wrglossary.745"></a><a href="#glo:emakefirstuc"><code class="csfmt">\emakefirstuc</code></a><code class="code">{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code><span class="floatrightbox"><a id="wrglossary.746"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v1.10+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +Fully expands <span class="meta">〈<em class="metainner">text</em>〉</span> before passing it to <a id="wrglossary.747"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>. <a href="#sec:sentencecasecmds">§1.2</a>; <a href="#wrglossary.139">6</a><p> + +</section><!-- end of section summary.index6815744 --> + +<section id="summary.index6946816"><!-- start of section summary.index6946816 --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->G<div class="labellink"><a href="#summary.index6946816">[link]</a></div></h2><!-- end of section header --> +<div class="defnbox"><a id="wrglossary.748"></a><a href="#glo:glsmakefirstuc"><code class="csfmt">\glsmakefirstuc</code></a><code class="code">{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code><span class="floatrightbox"><a id="wrglossary.749"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v1.05+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +Used by <a id="wrglossary.750"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a> to perform the case-change. This uses <code class="code"><a id="wrglossary.751"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a>{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code> but by default will prevent its argument from being expanded. <a href="#sec:sentencecasecmds">§1.2</a>; <a href="#wrglossary.151">6</a><p> +<div class="defnbox"><a id="wrglossary.752"></a><a href="#glo:gMFUnocap"><code class="csfmt">\gMFUnocap</code></a><code class="code">{<span class="meta">〈<em class="metainner">word</em>〉</span>}</code><span class="floatrightbox"><a id="wrglossary.753"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v1.09+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +Globally adds <span class="meta">〈<em class="metainner">word</em>〉</span> to the <a id="wrglossary.754"></a><a href="#glo:dual.exclusion-word">exclusion word</a> list for <a id="wrglossary.755"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>. <a href="#sec:nocap">§2.1</a>; <a href="#wrglossary.481">18</a><p> + +</section><!-- end of section summary.index6946816 --> + +<section id="summary.index7077888"><!-- start of section summary.index7077888 --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->I<div class="labellink"><a href="#summary.index7077888">[link]</a></div></h2><!-- end of section header --> +<div class="defnbox"><a id="wrglossary.756"></a><a href="#glo:ifMFUhyphen"><code class="csfmt">\ifMFUhyphen</code></a><code class="code"> <span class="meta">〈<em class="metainner">true</em>〉</span><code class="csfmt">\else</code> <span class="meta">〈<em class="metainner">false</em>〉</span><code class="csfmt">\fi</code></code><span class="floatrightbox"><span class="summarytag">initial: </span><code class="cmd">\iffalse</code>; <a id="wrglossary.757"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v2.03+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +Conditional that determines whether or not hyphens should be considered word boundaries by the <a id="wrglossary.758"></a><a href="#glo:dual.title-case">title-case</a> commands. <a href="#sec:capitalisewords">§2</a>; <a href="#wrglossary.433">15</a><p> + +</section><!-- end of section summary.index7077888 --> + +<section id="summary.index7340032"><!-- start of section summary.index7340032 --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->M<div class="labellink"><a href="#summary.index7340032">[link]</a></div></h2><!-- end of section header --> +<div class="defnbox"><a id="wrglossary.759"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a><code class="code">{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code><span class="floatrightbox"><a id="wrglossary.760"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v1.0+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +Converts <span class="meta">〈<em class="metainner">text</em>〉</span> to <a id="wrglossary.761"></a><a href="#glo:dual.sentence-case">sentence-case</a> internally using <a id="wrglossary.762"></a><a href="#glo:glsmakefirstuc"><code class="csfmt">\glsmakefirstuc</code></a> to perform the case-change, but first parses <span class="meta">〈<em class="metainner">text</em>〉</span> to deal with special cases. <a href="#sec:sentencecasecmds">§1.2</a>; <a href="#wrglossary.111">4</a><p> +<div class="defnbox"><a id="wrglossary.763"></a><a href="#glo:mfirstucMakeUppercase"><code class="csfmt">\mfirstucMakeUppercase</code></a><code class="code">{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code><span class="floatrightbox"><a id="wrglossary.764"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v1.07+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +Converts <span class="meta">〈<em class="metainner">text</em>〉</span> to <a id="wrglossary.765"></a><a href="#glo:idx.uppercase">uppercase</a>. Now only used in <a id="wrglossary.766"></a><a href="#glo:mfugrabfirstuc"><code class="csfmt">\mfugrabfirstuc</code></a>. <a href="#sec:allcaps">§3.2</a>; <a href="#wrglossary.660">27</a><p> +<div class="defnbox"><a id="wrglossary.767"></a><a href="#glo:MFUaddmap"><code class="csfmt">\MFUaddmap</code></a><code class="code">{<span class="meta">〈<em class="metainner">cs1</em>〉</span>}{<span class="meta">〈<em class="metainner">cs2</em>〉</span>}</code><span class="floatrightbox"><a id="wrglossary.768"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v2.08+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +Identifies a <a id="wrglossary.769"></a><a href="#glo:dual.mapping">mapping</a> from the command <span class="meta">〈<em class="metainner">cs1</em>〉</span> to command <span class="meta">〈<em class="metainner">cs2</em>〉</span>. <a href="#sec:mappings">§1.5</a>; <a href="#wrglossary.357">12</a><p> +<div class="defnbox"><a id="wrglossary.770"></a><a href="#glo:MFUblocker"><code class="csfmt">\MFUblocker</code></a><code class="code">{<span class="meta">〈<em class="metainner">cs</em>〉</span>}</code><span class="floatrightbox"><a id="wrglossary.771"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v2.08+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +Locally identifies <span class="meta">〈<em class="metainner">cs</em>〉</span> as a <a id="wrglossary.772"></a><a href="#glo:dual.blocker">blocker</a> command. <a href="#sec:blockers">§1.4</a>; <a href="#wrglossary.284">11</a><p> +<div class="defnbox"><a id="wrglossary.773"></a><a href="#glo:MFUcapword"><code class="csfmt">\MFUcapword</code></a><code class="code">{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code><span class="floatrightbox"><a id="wrglossary.774"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v2.03+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +Uses either <a id="wrglossary.775"></a><a href="#glo:MFUhyphencapword"><code class="csfmt">\MFUhyphencapword</code></a> or <a id="wrglossary.776"></a><a href="#glo:MFUcapwordfirstuc"><code class="csfmt">\MFUcapwordfirstuc</code></a> depending on <a id="wrglossary.777"></a><a href="#glo:ifMFUhyphen"><code class="csfmt">\ifMFUhyphen</code></a>. <a href="#sec:capitalisewords">§2</a>; <a href="#wrglossary.430">15</a><p> +<div class="defnbox"><a id="wrglossary.778"></a><a href="#glo:MFUcapwordfirstuc"><code class="csfmt">\MFUcapwordfirstuc</code></a><code class="code">{<span class="meta">〈<em class="metainner">word</em>〉</span>}</code><span class="floatrightbox"><a id="wrglossary.779"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v2.07+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +Used by <a id="wrglossary.780"></a><a href="#glo:MFUcapword"><code class="csfmt">\MFUcapword</code></a> and <a id="wrglossary.781"></a><a href="#glo:MFUhyphencapword"><code class="csfmt">\MFUhyphencapword</code></a> to apply the case-change to the given word. This just does <code class="code"><a id="wrglossary.782"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a>{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code> by default. <a href="#sec:capitalisewords">§2</a>; <a href="#wrglossary.449">16</a><p> +<div class="defnbox"><a id="wrglossary.783"></a><a href="#glo:MFUclear"><code class="csfmt">\MFUclear</code></a><span class="floatrightbox"><a id="wrglossary.784"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v1.09+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +Locally clears the <a id="wrglossary.785"></a><a href="#glo:dual.exclusion-word">exclusion word</a> list for <a id="wrglossary.786"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>. <a href="#sec:nocap">§2.1</a>; <a href="#wrglossary.483">18</a><p> +<div class="defnbox"><a id="wrglossary.787"></a><a href="#glo:MFUexcl"><code class="csfmt">\MFUexcl</code></a><code class="code">{<span class="meta">〈<em class="metainner">cs</em>〉</span>}</code><span class="floatrightbox"><a id="wrglossary.788"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v2.08+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +Locally identifies <span class="meta">〈<em class="metainner">cs</em>〉</span> as an <a id="wrglossary.789"></a><a href="#glo:dual.exclusion">exclusion</a> command. <a href="#sec:exclusions">§1.3</a>; <a href="#wrglossary.194">8</a><p> +<div class="defnbox"><a id="wrglossary.790"></a><a href="#glo:mfugrabfirstuc"><code class="csfmt">\mfugrabfirstuc</code></a><code class="code">{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code><span class="floatrightbox"><a id="wrglossary.791"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v2.08+</span><span class="clearfix"></span><p> +<div class="noteBox">(avoid where possible)</div><!-- end of noteBox --> +</div><!-- end of defnbox --> +<p> +Provide to emulate <a id="wrglossary.792"></a><a href="#glo:glsmakefirstuc"><code class="csfmt">\glsmakefirstuc</code></a> in v2.07 and below, but can still produce different results to v2.07. This will attempt to grab only the first character of <span class="meta">〈<em class="metainner">text</em>〉</span> and convert it to <a id="wrglossary.793"></a><a href="#glo:idx.uppercase">uppercase</a>, leaving the rest of <span class="meta">〈<em class="metainner">text</em>〉</span> unchanged. This won’t work if <span class="meta">〈<em class="metainner">text</em>〉</span> starts with a <a id="wrglossary.794"></a><a href="#glo:utf8">UTF-8</a> character, unless you are using XeLaTeX or LuaLaTeX. <a href="#sec:sentencecasecmds">§1.2</a>; <a href="#wrglossary.170">7</a><p> +<div class="defnbox"><a id="wrglossary.795"></a><a href="#glo:MFUhyphencapword"><code class="csfmt">\MFUhyphencapword</code></a><code class="code">{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code><span class="floatrightbox"><a id="wrglossary.796"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v2.07+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +Used by <a id="wrglossary.797"></a><a href="#glo:MFUcapword"><code class="csfmt">\MFUcapword</code></a> to apply <a id="wrglossary.798"></a><a href="#glo:MFUcapwordfirstuc"><code class="csfmt">\MFUcapwordfirstuc</code></a> to each hyphen-separated word in <span class="meta">〈<em class="metainner">text</em>〉</span>, if hyphens should indicate a word-break. <a href="#sec:capitalisewords">§2</a>; <a href="#wrglossary.437">15</a><p> +<div class="defnbox"><a id="wrglossary.799"></a><a href="#glo:MFUhyphenfalse"><code class="csfmt">\MFUhyphenfalse</code></a><span class="floatrightbox"><a id="wrglossary.800"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v2.03+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +Sets <a id="wrglossary.801"></a><a href="#glo:ifMFUhyphen"><code class="csfmt">\ifMFUhyphen</code></a> to false. <a href="#sec:capitalisewords">§2</a>; <a href="#wrglossary.442">15</a><p> +<div class="defnbox"><a id="wrglossary.802"></a><a href="#glo:MFUhyphentrue"><code class="csfmt">\MFUhyphentrue</code></a><span class="floatrightbox"><a id="wrglossary.803"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v2.03+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +Sets <a id="wrglossary.804"></a><a href="#glo:ifMFUhyphen"><code class="csfmt">\ifMFUhyphen</code></a> to true. <a href="#sec:capitalisewords">§2</a>; <a href="#wrglossary.440">15</a><p> +<div class="defnbox"><a id="wrglossary.805"></a><a href="#glo:MFUnocap"><code class="csfmt">\MFUnocap</code></a><code class="code">{<span class="meta">〈<em class="metainner">word</em>〉</span>}</code><span class="floatrightbox"><a id="wrglossary.806"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v1.09+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +Locally adds <span class="meta">〈<em class="metainner">word</em>〉</span> to the <a id="wrglossary.807"></a><a href="#glo:dual.exclusion-word">exclusion word</a> list for <a id="wrglossary.808"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>. <a href="#sec:nocap">§2.1</a>; <a href="#wrglossary.479">17</a><p> +<div class="defnbox"><a id="wrglossary.809"></a><a href="#glo:MFUsave"><code class="csfmt">\MFUsave</code></a><span class="floatrightbox"><a id="wrglossary.810"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v2.08+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +Saves the list of <a id="wrglossary.811"></a><a href="#glo:dual.exclusion">exclusions</a>, <a id="wrglossary.812"></a><a href="#glo:dual.blocker">blockers</a> and <a id="wrglossary.813"></a><a href="#glo:dual.mapping">mappings</a> to the <a id="wrglossary.814"></a><a href="#glo:ext.aux"><span class="extfmt">aux</span></a> file (if required by some external tool). This command sets itself to <code class="cmd">\relax</code> so it doesn’t repeat the action if used multiple times, and counteracts any use of <a id="wrglossary.815"></a><a href="#glo:MFUsaveatend"><code class="csfmt">\MFUsaveatend</code></a>. <a href="#sec:savetoaux">§3.1</a>; <a href="#wrglossary.621">26</a><p> +<div class="defnbox"><a id="wrglossary.816"></a><a href="#glo:MFUsaveatend"><code class="csfmt">\MFUsaveatend</code></a><span class="floatrightbox"><a id="wrglossary.817"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v2.08+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +Saves the list of <a id="wrglossary.818"></a><a href="#glo:dual.exclusion">exclusions</a>, <a id="wrglossary.819"></a><a href="#glo:dual.blocker">blockers</a> and <a id="wrglossary.820"></a><a href="#glo:dual.mapping">mappings</a> to the <a id="wrglossary.821"></a><a href="#glo:ext.aux"><span class="extfmt">aux</span></a> file (if required by some external tool) at the end of the document. This command sets itself to <code class="cmd">\relax</code> so it doesn’t repeat the action if used multiple times, but it can be overridden by <a id="wrglossary.822"></a><a href="#glo:MFUsave"><code class="csfmt">\MFUsave</code></a>. <a href="#sec:savetoaux">§3.1</a>; <a href="#wrglossary.619">26</a><p> +<div class="defnbox"><a id="wrglossary.823"></a><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a><code class="code">{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code><span class="floatrightbox"><a id="wrglossary.824"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v2.08+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +Converts <span class="meta">〈<em class="metainner">text</em>〉</span> to <a id="wrglossary.825"></a><a href="#glo:dual.sentence-case">sentence-case</a> with expansion. <a href="#sec:sentencecasecmds">§1.2</a>; <a href="#wrglossary.101">4</a><p> +<div class="defnbox"><a id="wrglossary.826"></a><a href="#glo:MFUskippunc"><code class="csfmt">\MFUskippunc</code></a><code class="code">{<span class="meta">〈<em class="metainner">content</em>〉</span>}</code><span class="floatrightbox"><a id="wrglossary.827"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v2.07+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +An <a id="wrglossary.828"></a><a href="#glo:dual.exclusion">exclusion</a> command. <a href="#sec:exclusions">§1.3</a>; <a href="#wrglossary.215">8</a><p> +<div class="defnbox"><a id="wrglossary.829"></a><a href="#glo:MFUwordbreak"><code class="csfmt">\MFUwordbreak</code></a><code class="code">{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code><span class="floatrightbox"><a id="wrglossary.830"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v2.07+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +Used to markup a character or command that should be treated as a word break by the <a id="wrglossary.831"></a><a href="#glo:dual.title-case">title-case</a> commands. <a href="#sec:capitalisewords">§2</a>; <a href="#wrglossary.424">15</a><p> + +</section><!-- end of section summary.index7340032 --> + +<section id="summary.index8060928"><!-- start of section summary.index8060928 --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->X<div class="labellink"><a href="#summary.index8060928">[link]</a></div></h2><!-- end of section header --> +<div class="defnbox"><a id="wrglossary.832"></a><a href="#glo:xcapitalisefmtwords"><code class="csfmt">\xcapitalisefmtwords</code></a><code class="code">{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code><span class="floatrightbox"><span class="summarytag">modifier: </span>* <a id="wrglossary.833"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v2.03+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +Shortcut for <code class="code"><span class="cmdfmt">\expandafter</span><a id="wrglossary.834"></a><a href="#glo:capitalisefmtwords"><code class="csfmt">\capitalisefmtwords</code></a><span class="cmdfmt">\expandafter</span>{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code> including the <code class="code">*</code> modifier, if provided. <a href="#sec:capitalisewords">§2</a>; <a href="#wrglossary.468">17</a><p> +<div class="defnbox"><a id="wrglossary.835"></a><a href="#glo:xcapitalisewords"><code class="csfmt">\xcapitalisewords</code></a><code class="code">{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code><span class="floatrightbox"><a id="wrglossary.836"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v1.06+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +Shortcut for <code class="code"><span class="cmdfmt">\expandafter</span><a id="wrglossary.837"></a><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a><span class="cmdfmt">\expandafter</span>{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code>. <a href="#sec:capitalisewords">§2</a>; <a href="#wrglossary.417">14</a><p> +<div class="defnbox"><a id="wrglossary.838"></a><a href="#glo:xmakefirstuc"><code class="csfmt">\xmakefirstuc</code></a><code class="code">{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code><span class="floatrightbox"><a id="wrglossary.839"></a><a href="#glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span></a> v1.01+</span><span class="clearfix"></span></div><!-- end of defnbox --> +<p> +Shortcut for <code class="code"><span class="cmdfmt">\expandafter</span><a id="wrglossary.840"></a><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a><span class="cmdfmt">\expandafter</span>{<span class="meta">〈<em class="metainner">text</em>〉</span>}</code>. <a href="#sec:sentencecasecmds">§1.2</a>; <a href="#wrglossary.135">5</a><p> + +</section><!-- end of section summary.index8060928 --> + +<section id="index"><!-- start of section index --><div class="tomain"><a href="#main">[top]</a></div> +<h1><!-- start of chapter header -->Index<div class="labellink"><a href="#index">[link]</a></div></h1><!-- end of chapter header --> +<div class="nlctusernavbox"><a href="#indexglssymbols">Symbols</a> <a href="#index@">@</a> <a href="#index6619136">B</a> <a href="#index6684672">C</a> <a href="#index6815744">E</a> <a href="#index6881280">F</a> <a href="#index6946816">G</a> <a href="#index7012352">H</a> <a href="#index7077888">I</a> <a href="#index7274496">L</a> <a href="#index7340032">M</a> <a href="#index7405568">N</a> <a href="#index7536640">P</a> <a href="#index7667712">R</a> <a href="#index7733248">S</a> <a href="#index7798784">T</a> <a href="#index7864320">U</a> <a href="#index8060928">X</a></div><!-- end of nlctusernavbox --> + +</section><!-- end of section index --> + +<section id="indexglssymbols"><!-- start of section indexglssymbols --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->Symbols<div class="labellink"><a href="#indexglssymbols">[link]</a></div></h2><!-- end of section header --> +<div class="nlctuserguideidx0"><dfn id="glo:idx.nbsp"><code class="code">~</code></dfn><span class="qquad"></span><a href="#wrglossary.407">14</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:idx.sym.dollar"><code class="code">$</code></dfn><span class="qquad"></span><a href="#wrglossary.347">12</a></div><!-- end of nlctuserguideidx0 --> + +</section><!-- end of section indexglssymbols --> + +<section id="index@"><!-- start of section index@ --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->@<div class="labellink"><a href="#index@">[link]</a></div></h2><!-- end of section header --> +<div class="nlctuserguideidx0"><a href="#glo:@mfu@blockers"><code class="csfmt">\@mfu@blockers</code></a><span class="qquad"></span><a href="#sec:savetoaux">§3.1</a>; <a href="#wrglossary.646">27</a>, <span class="summarylocfmt"><a href="#wrglossary.719">33</a></span>, <div class="crossref"><span class="crossreftag">see also</span> <a href="#glo:MFUsave"><code class="csfmt">\MFUsave</code></a> & <a href="#glo:MFUsaveatend"><code class="csfmt">\MFUsaveatend</code></a></div><!-- end of crossref --> +</div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:@mfu@excls"><code class="csfmt">\@mfu@excls</code></a><span class="qquad"></span><a href="#sec:savetoaux">§3.1</a>; <a href="#wrglossary.631">26</a>, <span class="summarylocfmt"><a href="#wrglossary.723">33</a></span>, <div class="crossref"><span class="crossreftag">see also</span> <a href="#glo:MFUsave"><code class="csfmt">\MFUsave</code></a> & <a href="#glo:MFUsaveatend"><code class="csfmt">\MFUsaveatend</code></a></div><!-- end of crossref --> +</div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:@mfu@mappings"><code class="csfmt">\@mfu@mappings</code></a><span class="qquad"></span><a href="#sec:savetoaux">§3.1</a>; <a href="#wrglossary.652">27</a>, <span class="summarylocfmt"><a href="#wrglossary.727">33</a></span>, <div class="crossref"><span class="crossreftag">see also</span> <a href="#glo:MFUsave"><code class="csfmt">\MFUsave</code></a> & <a href="#glo:MFUsaveatend"><code class="csfmt">\MFUsaveatend</code></a></div><!-- end of crossref --> +</div><!-- end of nlctuserguideidx0 --> + +</section><!-- end of section index@ --> + +<section id="index6619136"><!-- start of section index6619136 --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->B<div class="labellink"><a href="#index6619136">[link]</a></div></h2><!-- end of section header --> +<div class="nlctuserguideidx0"><dfn id="glo:begin"><code class="csfmt">\begin</code></dfn><span class="qquad"></span><a href="#wrglossary.199">8</a>, <a href="#wrglossary.634">26</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:blocker">blocker</dfn><span class="qquad"></span><a href="#tab:sentencecasesummary">Table 1.1</a>; <a href="#wrglossary.27">1</a>, <a href="#wrglossary.49">2</a>, <a href="#wrglossary.117">5</a>, <a href="#wrglossary.216">9</a>–<a href="#wrglossary.351">12</a>, <a href="#wrglossary.616">26</a>, <a href="#wrglossary.647">27</a>, <span class="termslocfmt"><a href="#wrglossary.704">31</a></span>, <a href="#wrglossary.722">33</a>, <a href="#wrglossary.772">35</a>, <a href="#wrglossary.812">37</a></div><!-- end of nlctuserguideidx0 --> + +</section><!-- end of section index6619136 --> + +<section id="index6684672"><!-- start of section index6684672 --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->C<div class="labellink"><a href="#index6684672">[link]</a></div></h2><!-- end of section header --> +<div class="nlctuserguideidx0"><a href="#glo:capitalisefmtwords"><code class="csfmt">\capitalisefmtwords</code></a><span class="qquad"></span><a href="#sec:capitalisewords">§2</a>; <a href="#wrglossary.461">16</a>, <a href="#wrglossary.473">17</a>, <a href="#wrglossary.533">20</a>, <span class="summarylocfmt"><a href="#wrglossary.731">33</a></span>, <a href="#wrglossary.741">34</a>, <a href="#wrglossary.834">37</a>, <div class="crossref"><span class="crossreftag">see also</span> <a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a>, <a href="#glo:MFUnocap"><code class="csfmt">\MFUnocap</code></a>, <a href="#glo:gMFUnocap"><code class="csfmt">\gMFUnocap</code></a> & <a href="#glo:ifMFUhyphen"><code class="csfmt">\ifMFUhyphen</code></a></div><!-- end of crossref --> +</div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:capitalisewords"><code class="csfmt">\capitalisewords</code></a><span class="qquad"></span><a href="#sec:capitalisewords">§2</a>; <a href="#wrglossary.405">14</a>–<a href="#wrglossary.476">17</a>, <a href="#wrglossary.532">20</a>, <a href="#wrglossary.544">21</a>, <a href="#wrglossary.609">25</a>, <span class="summarylocfmt"><a href="#wrglossary.734">33</a></span>, <a href="#wrglossary.744">34</a>–<a href="#wrglossary.808">36</a>, <a href="#wrglossary.837">38</a>, <div class="crossref"><span class="crossreftag">see also</span> <a href="#glo:capitalisefmtwords"><code class="csfmt">\capitalisefmtwords</code></a>, <a href="#glo:MFUnocap"><code class="csfmt">\MFUnocap</code></a>, <a href="#glo:gMFUnocap"><code class="csfmt">\gMFUnocap</code></a> & <a href="#glo:ifMFUhyphen"><code class="csfmt">\ifMFUhyphen</code></a></div><!-- end of crossref --> +</div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:cite"><code class="csfmt">\cite</code></dfn><span class="qquad"></span><a href="#wrglossary.200">8</a>, <a href="#wrglossary.635">26</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:pkg.csquotes"><span class="styfmt">csquotes</span> package</dfn><span class="qquad"></span><a href="#wrglossary.278">10</a></div><!-- end of nlctuserguideidx0 --> + +</section><!-- end of section index6684672 --> + +<section id="index6815744"><!-- start of section index6815744 --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->E<div class="labellink"><a href="#index6815744">[link]</a></div></h2><!-- end of section header --> +<div class="nlctuserguideidx0"><a href="#glo:ecapitalisefmtwords"><code class="csfmt">\ecapitalisefmtwords</code></a><span class="qquad"></span><a href="#sec:capitalisewords">§2</a>; <a href="#wrglossary.472">17</a>, <span class="summarylocfmt"><a href="#wrglossary.739">34</a></span></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:ecapitalisewords"><code class="csfmt">\ecapitalisewords</code></a><span class="qquad"></span><a href="#sec:capitalisewords">§2</a>; <a href="#wrglossary.420">14</a>, <span class="summarylocfmt"><a href="#wrglossary.742">34</a></span></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:emakefirstuc"><code class="csfmt">\emakefirstuc</code></a><span class="qquad"></span><a href="#sec:sentencecasecmds">§1.2</a>; <a href="#wrglossary.139">6</a>, <a href="#wrglossary.312">11</a>, <a href="#wrglossary.385">13</a>, <span class="summarylocfmt"><a href="#wrglossary.745">34</a></span></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:end"><code class="csfmt">\end</code></dfn><span class="qquad"></span><a href="#wrglossary.201">8</a>, <a href="#wrglossary.636">26</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:ensuremath"><code class="csfmt">\ensuremath</code></dfn><span class="qquad"></span><a href="#wrglossary.209">8</a>, <a href="#wrglossary.345">12</a>, <a href="#wrglossary.641">26</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:exclusion">exclusion command</dfn><span class="qquad"></span><a href="#tab:sentencecasesummary">Table 1.1</a>; <a href="#wrglossary.30">1</a>, <a href="#wrglossary.38">2</a>, <a href="#wrglossary.129">5</a>, <a href="#wrglossary.195">8</a>, <a href="#wrglossary.281">10</a>–<a href="#wrglossary.387">13</a>, <a href="#wrglossary.491">18</a>, <a href="#wrglossary.614">26</a>, <span class="termslocfmt"><a href="#wrglossary.706">31</a></span>, <a href="#wrglossary.726">33</a>, <a href="#wrglossary.789">36</a>, <a href="#wrglossary.811">37</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:exclusion-word">exclusion word</dfn><span class="qquad"></span><a href="#wrglossary.477">17</a>, <span class="termslocfmt"><a href="#wrglossary.707">31</a></span>, <a href="#wrglossary.738">33</a>–<a href="#wrglossary.807">36</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:opt.expanded"><span class="optfmt">expanded</span></a><span class="qquad"></span><a href="#sec:pkgoptions">§1.6</a>; <a href="#wrglossary.73">2</a>, <a href="#wrglossary.161">6</a>, <a href="#wrglossary.389">13</a></div><!-- end of nlctuserguideidx0 --> + +</section><!-- end of section index6815744 --> + +<section id="index6881280"><!-- start of section index6881280 --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->F<div class="labellink"><a href="#index6881280">[link]</a></div></h2><!-- end of section header --> +<div class="nlctuserguideidx0"><dfn id="glo:fileformat">file formats</dfn></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx1"><dfn id="glo:ext.aux"><span class="extfmt">aux</span></dfn><span class="qquad"></span><a href="#wrglossary.617">26</a></div><!-- end of nlctuserguideidx1 --> + +</section><!-- end of section index6881280 --> + +<section id="index6946816"><!-- start of section index6946816 --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->G<div class="labellink"><a href="#index6946816">[link]</a></div></h2><!-- end of section header --> +<div class="nlctuserguideidx0"><dfn id="glo:pkg.glossaries-extra"><span class="styfmt">glossaries-extra</span> package</dfn><span class="qquad"></span><a href="#wrglossary.379">13</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:pkg.glossaries"><span class="styfmt">glossaries</span> package</dfn><span class="qquad"></span><a href="#wrglossary.3">a</a>, <a href="#wrglossary.113">4</a>, <a href="#wrglossary.153">6</a>, <a href="#wrglossary.220">9</a>, <a href="#wrglossary.254">10</a>, <a href="#wrglossary.369">12</a>, <a href="#wrglossary.378">13</a>, <a href="#wrglossary.663">27</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:Gls"><code class="csfmt">\Gls</code></dfn><span class="qquad"></span><a href="#wrglossary.5">a</a>, <a href="#wrglossary.373">13</a>, <a href="#wrglossary.649">27</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:gls"><code class="csfmt">\gls</code></dfn><span class="qquad"></span><a href="#wrglossary.372">13</a>, <a href="#wrglossary.643">26</a>, <a href="#wrglossary.655">27</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:glsadd"><code class="csfmt">\glsadd</code></dfn><span class="qquad"></span><a href="#wrglossary.219">9</a>, <a href="#wrglossary.255">10</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:glsmakefirstuc"><code class="csfmt">\glsmakefirstuc</code></a><span class="qquad"></span><a href="#sec:sentencecasecmds">§1.2</a>; <a href="#wrglossary.72">2</a>, <a href="#wrglossary.114">4</a>–<a href="#wrglossary.168">7</a>, <a href="#wrglossary.390">13</a>, <a href="#wrglossary.688">28</a>, <a href="#wrglossary.703">29</a>, <span class="summarylocfmt"><a href="#wrglossary.748">34</a></span>, <a href="#wrglossary.762">35</a>, <a href="#wrglossary.792">36</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:Glspl"><code class="csfmt">\Glspl</code></dfn><span class="qquad"></span><a href="#wrglossary.650">27</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:glspl"><code class="csfmt">\glspl</code></dfn><span class="qquad"></span><a href="#wrglossary.644">26</a>, <a href="#wrglossary.657">27</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:gMFUnocap"><code class="csfmt">\gMFUnocap</code></a><span class="qquad"></span><a href="#sec:nocap">§2.1</a>; <a href="#wrglossary.481">18</a>, <span class="summarylocfmt"><a href="#wrglossary.752">34</a></span>, <div class="crossref"><span class="crossreftag">see also</span> <a href="#glo:MFUnocap"><code class="csfmt">\MFUnocap</code></a> & <a href="#glo:MFUclear"><code class="csfmt">\MFUclear</code></a></div><!-- end of crossref --> +</div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:opt.grabfirst"><span class="optfmt">grabfirst</span></a><span class="qquad"></span><a href="#sec:pkgoptions">§1.6</a>; <a href="#wrglossary.90">3</a>, <a href="#wrglossary.165">6</a>, <a href="#wrglossary.171">7</a>, <a href="#wrglossary.397">13</a>, <a href="#wrglossary.681">27</a>, <a href="#wrglossary.687">28</a></div><!-- end of nlctuserguideidx0 --> + +</section><!-- end of section index6946816 --> + +<section id="index7012352"><!-- start of section index7012352 --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->H<div class="labellink"><a href="#index7012352">[link]</a></div></h2><!-- end of section header --> +<div class="nlctuserguideidx0"><dfn id="glo:pkg.hyperref"><span class="styfmt">hyperref</span> package</dfn><span class="qquad"></span><a href="#wrglossary.531">20</a>, <a href="#wrglossary.541">21</a></div><!-- end of nlctuserguideidx0 --> + +</section><!-- end of section index7012352 --> + +<section id="index7077888"><!-- start of section index7077888 --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->I<div class="labellink"><a href="#index7077888">[link]</a></div></h2><!-- end of section header --> +<div class="nlctuserguideidx0"><a href="#glo:ifMFUhyphen"><code class="csfmt">\ifMFUhyphen</code></a><span class="qquad"></span><a href="#sec:capitalisewords">§2</a>; <a href="#wrglossary.433">15</a>, <span class="summarylocfmt"><a href="#wrglossary.756">34</a></span>, <a href="#wrglossary.777">35</a>, <a href="#wrglossary.801">36</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:index"><code class="csfmt">\index</code></dfn><span class="qquad"></span><a href="#wrglossary.43">2</a></div><!-- end of nlctuserguideidx0 --> + +</section><!-- end of section index7077888 --> + +<section id="index7274496"><!-- start of section index7274496 --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->L<div class="labellink"><a href="#index7274496">[link]</a></div></h2><!-- end of section header --> +<div class="nlctuserguideidx0"><dfn id="glo:label"><code class="csfmt">\label</code></dfn><span class="qquad"></span><a href="#wrglossary.202">8</a>, <a href="#wrglossary.637">26</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:idx.lowercase">lowercase</dfn><span class="qquad"></span><a href="#wrglossary.415">14</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:ltextcaseexcludeargtl"><code class="csfmt">\l_text_case_exclude_arg_tl</code></dfn><span class="qquad"></span><a href="#wrglossary.197">8</a></div><!-- end of nlctuserguideidx0 --> + +</section><!-- end of section index7274496 --> + +<section id="index7340032"><!-- start of section index7340032 --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->M<div class="labellink"><a href="#index7340032">[link]</a></div></h2><!-- end of section header --> +<div class="nlctuserguideidx0"><a href="#glo:makefirstuc"><code class="csfmt">\makefirstuc</code></a><span class="qquad"></span><a href="#sec:sentencecasecmds">§1.2</a>; <a href="#tab:sentencecasesummary">Table 1.1</a>; <a href="#wrglossary.11">a</a>, <a href="#wrglossary.15">1</a>, <a href="#wrglossary.39">2</a>, <a href="#wrglossary.111">4</a>–<a href="#wrglossary.382">13</a>, <a href="#wrglossary.450">16</a>, <a href="#wrglossary.490">18</a>, <a href="#wrglossary.545">21</a>, <a href="#wrglossary.705">31</a>, <a href="#wrglossary.747">34</a>, <span class="summarylocfmt"><a href="#wrglossary.759">35</a></span>, <a href="#wrglossary.840">38</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:MakeTextUppercase"><code class="csfmt">\MakeTextUppercase</code></dfn><span class="qquad"></span><a href="#wrglossary.666">27</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:MakeUppercase"><code class="csfmt">\MakeUppercase</code></dfn><span class="qquad"></span><a href="#wrglossary.173">7</a>, <a href="#wrglossary.401">13</a>, <a href="#wrglossary.662">27</a>, <a href="#wrglossary.695">28</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:mapping">mapping</dfn><span class="qquad"></span><a href="#tab:sentencecasesummary">Table 1.1</a>; <a href="#wrglossary.28">1</a>–<a href="#wrglossary.91">3</a>, <a href="#wrglossary.118">5</a>, <a href="#wrglossary.217">9</a>, <a href="#wrglossary.266">10</a>, <a href="#wrglossary.353">12</a>, <a href="#wrglossary.377">13</a>, <a href="#wrglossary.615">26</a>, <a href="#wrglossary.653">27</a>, <span class="termslocfmt"><a href="#wrglossary.709">31</a></span>, <a href="#wrglossary.730">33</a>, <a href="#wrglossary.769">35</a>, <a href="#wrglossary.813">37</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:pkg.mfirstuc-english"><span class="styfmt">mfirstuc-english</span> package</a><span class="qquad"></span><a href="#sec:nocap">§2.1</a>; <a href="#wrglossary.522">19</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:pkg.mfirstuc"><span class="styfmt">mfirstuc</span> package</dfn><span class="qquad"></span><a href="#wrglossary.112">4</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:mfirstucMakeUppercase"><code class="csfmt">\mfirstucMakeUppercase</code></a><span class="qquad"></span><a href="#sec:allcaps">§3.2</a>; <a href="#wrglossary.172">7</a>, <a href="#wrglossary.192">8</a>, <a href="#wrglossary.400">13</a>, <a href="#wrglossary.660">27</a>, <span class="summarylocfmt"><a href="#wrglossary.763">35</a></span></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:MFUaddmap"><code class="csfmt">\MFUaddmap</code></a><span class="qquad"></span><a href="#sec:mappings">§1.5</a>; <a href="#wrglossary.357">12</a>, <span class="summarylocfmt"><a href="#wrglossary.767">35</a></span>, <div class="crossref"><span class="crossreftag">see also</span> <a href="#glo:MFUexcl"><code class="csfmt">\MFUexcl</code></a> & <a href="#glo:MFUblocker"><code class="csfmt">\MFUblocker</code></a></div><!-- end of crossref --> +</div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:MFUblocker"><code class="csfmt">\MFUblocker</code></a><span class="qquad"></span><a href="#sec:blockers">§1.4</a>; <a href="#wrglossary.284">11</a>, <span class="summarylocfmt"><a href="#wrglossary.770">35</a></span>, <div class="crossref"><span class="crossreftag">see also</span> <a href="#glo:MFUexcl"><code class="csfmt">\MFUexcl</code></a> & <a href="#glo:MFUaddmap"><code class="csfmt">\MFUaddmap</code></a></div><!-- end of crossref --> +</div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:MFUcapword"><code class="csfmt">\MFUcapword</code></a><span class="qquad"></span><a href="#sec:capitalisewords">§2</a>; <a href="#wrglossary.430">15</a>, <a href="#wrglossary.737">33</a>, <span class="summarylocfmt"><a href="#wrglossary.773">35</a></span>, <a href="#wrglossary.797">36</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:MFUcapwordfirstuc"><code class="csfmt">\MFUcapwordfirstuc</code></a><span class="qquad"></span><a href="#sec:capitalisewords">§2</a>; <a href="#wrglossary.449">16</a>, <a href="#wrglossary.497">18</a>, <span class="summarylocfmt"><a href="#wrglossary.778">35</a></span>, <a href="#wrglossary.798">36</a>, <div class="crossref"><span class="crossreftag">see also</span> <a href="#glo:MFUcapword"><code class="csfmt">\MFUcapword</code></a> & <a href="#glo:MFUhyphencapword"><code class="csfmt">\MFUhyphencapword</code></a></div><!-- end of crossref --> +</div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:MFUclear"><code class="csfmt">\MFUclear</code></a><span class="qquad"></span><a href="#sec:nocap">§2.1</a>; <a href="#wrglossary.483">18</a>, <span class="summarylocfmt"><a href="#wrglossary.783">35</a></span>, <div class="crossref"><span class="crossreftag">see also</span> <a href="#glo:gMFUnocap"><code class="csfmt">\gMFUnocap</code></a> & <a href="#glo:MFUnocap"><code class="csfmt">\MFUnocap</code></a></div><!-- end of crossref --> +</div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:MFUexcl"><code class="csfmt">\MFUexcl</code></a><span class="qquad"></span><a href="#sec:exclusions">§1.3</a>; <a href="#wrglossary.194">8</a>, <a href="#wrglossary.288">11</a>, <span class="summarylocfmt"><a href="#wrglossary.787">36</a></span>, <div class="crossref"><span class="crossreftag">see also</span> <a href="#glo:MFUblocker"><code class="csfmt">\MFUblocker</code></a> & <a href="#glo:MFUaddmap"><code class="csfmt">\MFUaddmap</code></a></div><!-- end of crossref --> +</div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:mfugrabfirstuc"><code class="csfmt">\mfugrabfirstuc</code></a><span class="qquad"></span><a href="#sec:sentencecasecmds">§1.2</a>; <a href="#wrglossary.170">7</a>, <a href="#wrglossary.399">13</a>, <a href="#wrglossary.680">27</a>, <a href="#wrglossary.686">28</a>, <a href="#wrglossary.766">35</a>, <span class="summarylocfmt"><a href="#wrglossary.790">36</a></span></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:MFUhyphencapword"><code class="csfmt">\MFUhyphencapword</code></a><span class="qquad"></span><a href="#sec:capitalisewords">§2</a>; <a href="#wrglossary.437">15</a>, <a href="#wrglossary.501">18</a>, <a href="#wrglossary.775">35</a>, <span class="summarylocfmt"><a href="#wrglossary.795">36</a></span>, <div class="crossref"><span class="crossreftag">see also</span> <a href="#glo:ifMFUhyphen"><code class="csfmt">\ifMFUhyphen</code></a> & <a href="#glo:MFUcapword"><code class="csfmt">\MFUcapword</code></a></div><!-- end of crossref --> +</div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:MFUhyphenfalse"><code class="csfmt">\MFUhyphenfalse</code></a><span class="qquad"></span><a href="#sec:capitalisewords">§2</a>; <a href="#wrglossary.442">15</a>, <span class="summarylocfmt"><a href="#wrglossary.799">36</a></span></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:MFUhyphentrue"><code class="csfmt">\MFUhyphentrue</code></a><span class="qquad"></span><a href="#sec:capitalisewords">§2</a>; <a href="#wrglossary.440">15</a>, <span class="summarylocfmt"><a href="#wrglossary.802">36</a></span></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:MFUnocap"><code class="csfmt">\MFUnocap</code></a><span class="qquad"></span><a href="#sec:nocap">§2.1</a>; <a href="#wrglossary.479">17</a>, <a href="#wrglossary.525">19</a>, <a href="#wrglossary.529">20</a>, <span class="summarylocfmt"><a href="#wrglossary.805">36</a></span>, <div class="crossref"><span class="crossreftag">see also</span> <a href="#glo:gMFUnocap"><code class="csfmt">\gMFUnocap</code></a> & <a href="#glo:MFUclear"><code class="csfmt">\MFUclear</code></a></div><!-- end of crossref --> +</div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:MFUsave"><code class="csfmt">\MFUsave</code></a><span class="qquad"></span><a href="#sec:savetoaux">§3.1</a>; <a href="#wrglossary.621">26</a>, <span class="summarylocfmt"><a href="#wrglossary.809">36</a></span>, <a href="#wrglossary.822">37</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:MFUsaveatend"><code class="csfmt">\MFUsaveatend</code></a><span class="qquad"></span><a href="#sec:savetoaux">§3.1</a>; <a href="#wrglossary.619">26</a>, <span class="summarylocfmt"><a href="#wrglossary.816">37</a></span></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:MFUsentencecase"><code class="csfmt">\MFUsentencecase</code></a><span class="qquad"></span><a href="#sec:sentencecasecmds">§1.2</a>; <a href="#tab:sentencecasesummary">Table 1.1</a>; <a href="#wrglossary.14">1</a>, <a href="#wrglossary.40">2</a>, <a href="#wrglossary.101">4</a>, <a href="#wrglossary.146">6</a>, <a href="#wrglossary.198">8</a>–<a href="#wrglossary.386">13</a>, <a href="#wrglossary.451">16</a>, <a href="#wrglossary.498">18</a>, <a href="#wrglossary.546">21</a>, <a href="#wrglossary.702">28</a>, <a href="#wrglossary.751">34</a>, <span class="summarylocfmt"><a href="#wrglossary.823">37</a></span></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:MFUskippunc"><code class="csfmt">\MFUskippunc</code></a><span class="qquad"></span><a href="#sec:exclusions">§1.3</a>; <a href="#wrglossary.215">8</a>–<a href="#wrglossary.252">10</a>, <a href="#wrglossary.642">26</a>, <span class="summarylocfmt"><a href="#wrglossary.826">37</a></span></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:MFUwordbreak"><code class="csfmt">\MFUwordbreak</code></a><span class="qquad"></span><a href="#sec:capitalisewords">§2</a>; <a href="#wrglossary.424">15</a>, <a href="#wrglossary.453">16</a>, <a href="#wrglossary.500">18</a>, <a href="#wrglossary.502">19</a>, <span class="summarylocfmt"><a href="#wrglossary.829">37</a></span></div><!-- end of nlctuserguideidx0 --> + +</section><!-- end of section index7340032 --> + +<section id="index7405568"><!-- start of section index7405568 --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->N<div class="labellink"><a href="#index7405568">[link]</a></div></h2><!-- end of section header --> +<div class="nlctuserguideidx0"><dfn id="glo:nameref"><code class="csfmt">\nameref</code></dfn><span class="qquad"></span><a href="#wrglossary.55">2</a>, <a href="#wrglossary.269">10</a>, <a href="#wrglossary.292">11</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:NoCaseChange"><code class="csfmt">\NoCaseChange</code></dfn><span class="qquad"></span><a href="#wrglossary.206">8</a>, <a href="#wrglossary.244">9</a>, <a href="#wrglossary.315">11</a>, <a href="#wrglossary.349">12</a>, <a href="#wrglossary.640">26</a></div><!-- end of nlctuserguideidx0 --> + +</section><!-- end of section index7405568 --> + +<section id="index7536640"><!-- start of section index7536640 --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->P<div class="labellink"><a href="#index7536640">[link]</a></div></h2><!-- end of section header --> +<div class="nlctuserguideidx0"><dfn id="glo:pdfstringdefDisableCommands"><code class="csfmt">\pdfstringdefDisableCommands</code></dfn><span class="qquad"></span><a href="#wrglossary.543">21</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:protect"><code class="csfmt">\protect</code></dfn><span class="qquad"></span><a href="#wrglossary.124">5</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:idx.punctuation">punctuation</dfn><span class="qquad"></span><a href="#wrglossary.21">1</a>, <a href="#wrglossary.218">9</a>, <a href="#wrglossary.256">10</a></div><!-- end of nlctuserguideidx0 --> + +</section><!-- end of section index7536640 --> + +<section id="index7667712"><!-- start of section index7667712 --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->R<div class="labellink"><a href="#index7667712">[link]</a></div></h2><!-- end of section header --> +<div class="nlctuserguideidx0"><dfn id="glo:ref"><code class="csfmt">\ref</code></dfn><span class="qquad"></span><a href="#wrglossary.203">8</a>, <a href="#wrglossary.638">26</a></div><!-- end of nlctuserguideidx0 --> + +</section><!-- end of section index7667712 --> + +<section id="index7733248"><!-- start of section index7733248 --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->S<div class="labellink"><a href="#index7733248">[link]</a></div></h2><!-- end of section header --> +<div class="nlctuserguideidx0"><dfn id="glo:semanticcommand">semantic command</dfn><span class="qquad"></span><a href="#wrglossary.31">1</a>, <a href="#wrglossary.103">4</a>, <a href="#wrglossary.116">5</a>, <a href="#wrglossary.606">24</a>, <span class="termslocfmt"><a href="#wrglossary.711">31</a></span></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:sentence-case">sentence-case</dfn><span class="qquad"></span><a href="#wrglossary.6">a</a>, <a href="#wrglossary.13">1</a>, <a href="#wrglossary.160">6</a>, <a href="#wrglossary.362">12</a>, <a href="#wrglossary.406">14</a>, <span class="termslocfmt"><a href="#wrglossary.714">32</a></span>, <a href="#wrglossary.761">35</a>, <a href="#wrglossary.825">37</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:space"><code class="csfmt">\space</code></dfn><span class="qquad"></span><a href="#wrglossary.408">14</a>, <a href="#wrglossary.559">21</a>, <a href="#wrglossary.587">23</a>, <a href="#wrglossary.593">24</a></div><!-- end of nlctuserguideidx0 --> + +</section><!-- end of section index7733248 --> + +<section id="index7798784"><!-- start of section index7798784 --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->T<div class="labellink"><a href="#index7798784">[link]</a></div></h2><!-- end of section header --> +<div class="nlctuserguideidx0"><dfn id="glo:texorpdfstring"><code class="csfmt">\texorpdfstring</code></dfn><span class="qquad"></span><a href="#wrglossary.537">20</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:pkg.textcase"><span class="styfmt">textcase</span> package</dfn><span class="qquad"></span><a href="#wrglossary.664">27</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:texttitlecase:n"><code class="csfmt">\text_titlecase:n</code></dfn><span class="qquad"></span><a href="#wrglossary.413">14</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:texttitlecasefirst:n"><code class="csfmt">\text_titlecase_first:n</code></dfn><span class="qquad"></span><a href="#wrglossary.102">4</a>, <a href="#wrglossary.676">27</a>, <a href="#wrglossary.699">28</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:textuppercase:n"><code class="csfmt">\text_uppercase:n</code></dfn><span class="qquad"></span><a href="#wrglossary.672">27</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:title-case">title-case</dfn><span class="qquad"></span><a href="#wrglossary.403">14</a>, <a href="#wrglossary.708">31</a>, <span class="termslocfmt"><a href="#wrglossary.716">32</a></span>, <a href="#wrglossary.736">33</a>, <a href="#wrglossary.758">34</a>, <a href="#wrglossary.831">37</a></div><!-- end of nlctuserguideidx0 --> + +</section><!-- end of section index7798784 --> + +<section id="index7864320"><!-- start of section index7864320 --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->U<div class="labellink"><a href="#index7864320">[link]</a></div></h2><!-- end of section header --> +<div class="nlctuserguideidx0"><dfn id="glo:unexpanded"><code class="csfmt">\unexpanded</code></dfn><span class="qquad"></span><a href="#wrglossary.156">6</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:opt.unexpanded"><span class="optfmt">unexpanded</span></a><span class="qquad"></span><a href="#sec:pkgoptions">§1.6</a>; <a href="#wrglossary.74">2</a>, <a href="#wrglossary.82">3</a>, <a href="#wrglossary.154">6</a>, <a href="#wrglossary.393">13</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:idx.uppercase">uppercase</dfn><span class="qquad"></span><a href="#wrglossary.414">14</a>, <a href="#wrglossary.661">27</a>, <a href="#wrglossary.715">32</a>, <a href="#wrglossary.765">35</a>, <a href="#wrglossary.793">36</a></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><dfn id="glo:utf8">UTF-8</dfn><span class="qquad"></span><a href="#wrglossary.16">1</a>, <a href="#wrglossary.175">7</a>, <a href="#wrglossary.685">28</a>, <span class="termslocfmt"><a href="#wrglossary.718">32</a></span>, <a href="#wrglossary.794">36</a></div><!-- end of nlctuserguideidx0 --> + +</section><!-- end of section index7864320 --> + +<section id="index8060928"><!-- start of section index8060928 --><div class="tomain"><a href="#main">[top]</a></div> +<h2><!-- start of section header -->X<div class="labellink"><a href="#index8060928">[link]</a></div></h2><!-- end of section header --> +<div class="nlctuserguideidx0"><a href="#glo:xcapitalisefmtwords"><code class="csfmt">\xcapitalisefmtwords</code></a><span class="qquad"></span><a href="#sec:capitalisewords">§2</a>; <a href="#wrglossary.468">17</a>, <span class="summarylocfmt"><a href="#wrglossary.832">37</a></span></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:xcapitalisewords"><code class="csfmt">\xcapitalisewords</code></a><span class="qquad"></span><a href="#sec:capitalisewords">§2</a>; <a href="#wrglossary.417">14</a>, <a href="#wrglossary.592">24</a>, <span class="summarylocfmt"><a href="#wrglossary.835">37</a></span></div><!-- end of nlctuserguideidx0 --> +<div class="nlctuserguideidx0"><a href="#glo:xmakefirstuc"><code class="csfmt">\xmakefirstuc</code></a><span class="qquad"></span><a href="#sec:sentencecasecmds">§1.2</a>; <a href="#wrglossary.135">5</a>, <a href="#wrglossary.311">11</a>, <a href="#wrglossary.384">13</a>, <span class="summarylocfmt"><a href="#wrglossary.838">38</a></span></div><!-- end of nlctuserguideidx0 --> +<p> + +</section><!-- end of section index8060928 --> +</div><!-- end of main --> +</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 differindex cc7cf0cf773..9a9a108bf86 100644 --- a/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-manual.pdf +++ 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 index e741c6d45da..c53b166eb41 100644 --- a/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-manual.tex +++ b/Master/texmf-dist/doc/latex/mfirstuc/mfirstuc-manual.tex @@ -1,933 +1,1758 @@ -\documentclass[report]{nlctdoc} - -\usepackage[a4paper,left=1.75in]{geometry} -\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} - -\IndexPrologue{% -\chapter*{\indexname}\markright{\indexname} -\addcontentsline{toc}{chapter}{\indexname}} +% arara: lualatex +% arara: bib2gls: { group: on, options: [ "--replace-quotes" ] } +% arara: lualatex +% arara: bib2gls: { group: on, options: [ "--replace-quotes" ] } if found ("log", "Glossary entry `sym.") +% arara: lualatex +% arara: lualatex if found ("log", "Rerun to") + +% This document requires glossaries-extra v1.49, bib2gls v3.0 +% and nlctuserguide.sty. If they haven't already +% been uploaded to CTAN, they will be in a few days. + +\documentclass[titlepage=false,oneside, + fontsize=12pt,captions=tableheading]{scrbook} + +\usepackage + %[debug=showwrgloss] + {nlctuserguide} + +\nlctuserguidegls +{ + % \MFUsentencecase + \gcmd{MFU\-sen\-tence\-case} + { + \providedby{\sty{mfirstuc} v2.08+} + \syntax{\margm{text}}% + \desc{converts \meta{text} to \idx+{sentence-case} with expansion} + } + % \MFUexcl + \gcmd{MFU\-excl} + { + \providedby{\sty{mfirstuc} v2.08+} + \syntax{\margm{cs}}% + \desc{locally identifies \meta{cs} as an \idx{exclusion} command} + \field{seealso}{MFUblocker,MFUaddmap} + } + % \MFUblocker + \gcmd{MFU\-blocker} + { + \providedby{\sty{mfirstuc} v2.08+} + \syntax{\margm{cs}}% + \desc{locally identifies \meta{cs} as a \idx{blocker} command} + \field{seealso}{MFUexcl,MFUaddmap} + } + % \MFUaddmap + \gcmd{MFU\-add\-map} + { + \providedby{\sty{mfirstuc} v2.08+} + \syntax{\margm{cs1}\margm{cs2}}% + \desc{identifies a \idx{mapping} from the command \meta{cs1} to + command \meta{cs2}} + \field{seealso}{MFUexcl,MFUblocker} + } + % \MFUsaveatend + \gcmd{MFU\-save\-at\-end} + { + \providedby{\sty{mfirstuc} v2.08+} + \desc{saves the list of \idxpl{exclusion}, \idxpl{blocker} + and \idxpl{mapping} to the \ext{aux} file (if required by some + external tool) at the end of the document. + This command sets itself to \cmd{relax} so it + doesn't repeat the action if used multiple times, but it can + be overridden by \gls{MFUsave}} + } + % \MFUsave + \gcmd{MFU\-save} + { + \providedby{\sty{mfirstuc} v2.08+} + \desc{saves the list of \idxpl{exclusion}, \idxpl{blocker} + and \idxpl{mapping} to the \ext{aux} file (if required by some + external tool). + This command sets itself to \cmd{relax} so it + doesn't repeat the action if used multiple times, and + counteracts any use of \gls{MFUsaveatend}} + } + % \@mfu@excls + \gcmd{@mfu\-@\-excls} + { + \providedby{\sty{mfirstuc} v2.08+} + \syntax{\margm{exclusions}} + \desc{an \ext{aux} file command that lists all the identified + \idxpl{exclusion}} + \field{seealso}{MFUsave,MFUsaveatend} + } + % \@mfu@blockers + \gcmd{@mfu\-@\-blockers} + { + \providedby{\sty{mfirstuc} v2.08+} + \syntax{\margm{blockers}} + \desc{an \ext{aux} file command that lists all the identified + \idxpl{blocker}} + \field{seealso}{MFUsave,MFUsaveatend} + } + % \@mfu@mappings + \gcmd{@mfu\-@\-mappings} + { + \providedby{\sty{mfirstuc} v2.08+} + \syntax{\margm{mappings}} + \desc{an \ext{aux} file command that lists all the identified + \idxpl{mapping} as a \keyval\ list} + \field{seealso}{MFUsave,MFUsaveatend} + } + % \mfirstucMakeUppercase + \gcmd{mfirst\-uc\-Make\-Up\-per\-case} + { + \providedby{\sty{mfirstuc} v1.07+} + \syntax{\margm{text}}% + \desc{converts \meta{text} to \idx{uppercase}. + Now only used in \gls{mfugrabfirstuc}} + } + % \emakefirstuc + \gcmd{e\-make\-first\-uc} + { + \providedby{\sty{mfirstuc} v1.10+} + \syntax{\margm{text}}% + \desc{fully expands \meta{text} before passing it to + \gls{makefirstuc}} + } + % \xmakefirstuc + \gcmd{x\-make\-first\-uc} + { + \providedby{\sty{mfirstuc} v1.01+} + \syntax{\margm{text}}% + \desc{shortcut for + \code{\cmd{expandafter}\gls{makefirstuc}\cmd{expandafter}\margm{text}}} + } + % \makefirstuc + \gcmd{make\-first\-uc} + { + \providedby{\sty{mfirstuc} v1.0+} + \syntax{\margm{text}}% + \desc{converts \meta{text} to \idx+{sentence-case} internally using + \gls{glsmakefirstuc} to perform the case-change, but first parses + \meta{text} to deal with special cases} + } + % \glsmakefirstuc + \gcmd{gls\-make\-first\-uc} + { + \providedby{\sty{mfirstuc} v1.05+} + \syntax{\margm{text}}% + \desc{used by \gls{makefirstuc} to perform the case-change. This + uses \code{\gls{MFUsentencecase}\margm{text}} but by default + will prevent its argument from being expanded} + } + % \mfugrabfirstuc + \gcmd{mfu\-grab\-first\-uc} + { + \providedby{\sty{mfirstuc} v2.08+} + \syntax{\margm{text}} + \note{avoid where possible} + \desc{provide to emulate \gls{glsmakefirstuc} in v2.07 and + below, but can still produce different results to v2.07. + This will attempt to grab only the first character of + \meta{text} and convert it to \idx{uppercase}, leaving the rest of + \meta{text} unchanged. This won't work if \meta{text} starts + with a \gls{utf8} character, unless you are using \XeLaTeX\ or + \LuaLaTeX} + } + % \MFUskippunc + \gcmd{MFU\-skip\-punc} + { + \providedby{\sty{mfirstuc} v2.07+} + \syntax{\margm{content}}% + \desc{an \idx{exclusion} command} + } + % \capitalisewords + \gcmd{cap\-i\-talise\-words} + { + \providedby{\sty{mfirstuc} v1.06+} + \syntax{\margm{text}}% + \desc{applies \idx+{title-case} to \meta{text}. This will apply + \gls{MFUcapword} to each word in \meta{text} (unless the word has been + identified as an \idx{exclusion-word} and doesn't occur at the start of + \meta{text})} + \field{seealso}{capitalisefmtwords,MFUnocap,gMFUnocap,ifMFUhyphen} + } + % \xcapitalisewords + \gcmd{x\-cap\-i\-talise\-words} + { + \providedby{\sty{mfirstuc} v1.06+} + \syntax{\margm{text}}% + \desc{shortcut for + \code{\cmd{expandafter}\gls{capitalisewords}\cmd{expandafter}\margm{text}}} + } + % \ecapitalisewords + \gcmd{e\-cap\-i\-talise\-words} + { + \providedby{\sty{mfirstuc} v1.10+} + \syntax{\margm{text}}% + \desc{fully expands \meta{text} before passing it to \gls{capitalisewords}} + } + % \capitalisefmtwords + \gcmd{cap\-i\-talise\-fmt\-words} + { + \providedby{\sty{mfirstuc} v2.03+} + \syntax{\margm{text}}% + \desc{similar to \gls{capitalisewords} but for content that may + contain formatting commands} + \field{modifiers}{*} + \field{seealso}{capitalisewords,MFUnocap,gMFUnocap,ifMFUhyphen} + } + % \xcapitalisefmtwords + \gcmd{x\-cap\-i\-talise\-fmt\-words} + { + \providedby{\sty{mfirstuc} v2.03+} + \syntax{\margm{text}}% + \desc{shortcut for + \code{\cmd{expandafter}\gls{capitalisefmtwords}\cmd{expandafter}\margm{text}} + including the \code{*} modifier, if provided} + \field{modifiers}{*} + } + % \ecapitalisefmtwords + \gcmd{e\-cap\-i\-talise\-fmt\-words} + { + \providedby{\sty{mfirstuc} v2.03+} + \syntax{\margm{text}}% + \desc{fully expands \meta{text} and passes it to + \gls{capitalisefmtwords} including the \code{*} modifier, if provided} + \field{modifiers}{*} + } + % \ifMFUhyphen + \gcond{if\-MFU\-hyphen} + { + \initval{\cmd{iffalse}} + \providedby{\sty{mfirstuc} v2.03+} + \desc{conditional that determines whether or not hyphens should + be considered word boundaries by the \idx{title-case} commands} + } + % \MFUhyphentrue + \gcmd{MFU\-hyphen\-true} + { + \providedby{\sty{mfirstuc} v2.03+} + \desc{sets \gls{ifMFUhyphen} to true} + } + % \MFUhyphenfalse + \gcmd{MFU\-hyphen\-false} + { + \providedby{\sty{mfirstuc} v2.03+} + \desc{sets \gls{ifMFUhyphen} to false} + } + % \MFUwordbreak + \gcmd{MFU\-word\-break} + { + \providedby{\sty{mfirstuc} v2.07+} + \syntax{\margm{text}}% + \desc{used to markup a character or command that should be + treated as a word break by the \idx{title-case} commands} + } + % \MFUcapword + \gcmd{MFU\-cap\-word} + { + \providedby{\sty{mfirstuc} v2.03+} + \syntax{\margm{text}}% + \desc{uses either \gls{MFUhyphencapword} or \gls{MFUcapwordfirstuc} + depending on \gls{ifMFUhyphen}} + } + % \MFUcapwordfirstuc + \gcmd{MFU\-cap\-word\-first\-uc} + { + \providedby{\sty{mfirstuc} v2.07+} + \syntax{\margm{word}}% + \desc{used by \gls{MFUcapword} and \gls{MFUhyphencapword} to + apply the case-change to the given word. This just does + \code{\gls{makefirstuc}\margm{text}} by default} + \field{seealso}{MFUcapword,MFUhyphencapword} + } + % \MFUhyphencapword + \gcmd{MFU\-hyphen\-cap\-word} + { + \providedby{\sty{mfirstuc} v2.07+} + \syntax{\margm{text}}% + \desc{used by \gls{MFUcapword} to apply \gls{MFUcapwordfirstuc} to + each hyphen-separated word in \meta{text}, if hyphens should + indicate a word-break} + \field{seealso}{ifMFUhyphen,MFUcapword} + } + % \MFUnocap + \gcmd{MFU\-no\-cap} + { + \providedby{\sty{mfirstuc} v1.09+} + \syntax{\margm{word}}% + \desc{locally adds \meta{word} to the \idx{exclusion-word} list for + \gls{capitalisewords}} + \field{seealso}{gMFUnocap,MFUclear} + } + % \gMFUnocap + \gcmd{gMFU\-no\-cap} + { + \providedby{\sty{mfirstuc} v1.09+} + \syntax{\margm{word}}% + \desc{globally adds \meta{word} to the \idx{exclusion-word} list for + \gls{capitalisewords}} + \field{seealso}{MFUnocap,MFUclear} + } + % \MFUclear + \gcmd{MFU\-clear} + { + \providedby{\sty{mfirstuc} v1.09+} + \desc{locally clears the \idx{exclusion-word} list for \gls{capitalisewords}} + \field{seealso}{gMFUnocap,MFUnocap} + } + % PACKAGE OPTIONS + % option grabfirst + \gopt{grab\-first} + {% + \providedby{\sty{mfirstuc} v2.08+} + \note{avoid where possible} + \desc{redefines \gls{glsmakefirstuc} to use \gls{mfugrabfirstuc} + and \gls{mfirstucMakeUppercase} to use \gls{MakeUppercase}} + } + % option expanded + \gopt{expanded} + {% + \providedby{\sty{mfirstuc} v2.08+} + \desc{redefines \gls{glsmakefirstuc} to use \gls{MFUsentencecase} + without inhibiting the expansion of its argument} + } + % option unexpanded + \gopt{unexpanded} + {% + \providedby{\sty{mfirstuc} v2.08+} + \desc{redefines \gls{glsmakefirstuc} to use \gls{MFUsentencecase} + but inhibits expansion of its argument} + } + % COMMANDS: index only + \gcmd{text\dsb title\-case\dsb first:n}{} + \gcmd{text\dsb title\-case:n}{} + \gcmd{text\dsb upper\-case:n}{} + \gcmd{l\dsb text\dsb case\dsb ex\-clude\dsb arg\dsb tl}{} + \gcmd{protect}{} + \gcmd{unexpanded}{} + \gcmd{glsadd}{} + \gcmd{gls}{} + \gcmd{Gls}{} + \gcmd{GLS}{} + \gcmd{glspl}{} + \gcmd{Glspl}{} + \gcmd{GLSpl}{} + \gcmd{Make\-Upper\-case}{}% \MakeUppercase + \gcmd{Make\-Text\-Upper\-case}{}% \MakeTextUppercase + \gcmd{No\-Case\-Change}{}% \NoCaseChange + \gcmd{ensure\-math}{} + \gcmd{begin}{} + \gcmd{end}{} + \gcmd{cite}{} + \gcmd{label}{} + \gcmd{ref}{} + \gcmd{index}{} + \gcmd{space}{} + \gcmd{name\-ref}{}% \nameref + \gcmd{tex\-or\-pdf\-string}{}% \texorpdfstring + \gcmd{pdf\-string\-def\-Dis\-able\-Commands}{}% \pdfstringdefDisableCommands + \gpunc{nbsp}{\name{\code{\textasciitilde}}}% ~ + % packages + \gpkg{mfirst\-uc}{\common} + \gpkg{mfirstuc\dhyphen english}{} + \gpkg{glossaries}{} + \gpkg{glossaries\dhyphen extra}{} + \gpkg{text\-case}{}% textcase + \gpkg{cs\-quotes}{}% csquotes + \gpkg{hyper\-ref}{}% hyperref + % file extensions + \gext{aux}{} + % terms + \gterm{exclusion}{\name{exclusion command}\field{text}{exclusion} + \desc{a command whose argument should be skipped + by the case-changer. The content that follows the command should + have its case-changed instead. See \sectionref{sec:exclusions}}} + \gterm{blocker}{\desc{a command that prohibits case-changing. If + encountered by \gls{makefirstuc}, it won't attempt to apply any + case-changing. See \sectionref{sec:blockers}}} + \gterm{mapping}{\desc{a command that should be substituted by + another, if encountered by \gls{makefirstuc}, instead of applying + a case-change. See \sectionref{sec:mappings}}} + \gterm{sentence-case}{\desc{content that should appear at the + start of a sentence that needs to have its first significant + character converted to \idx{uppercase}. See \sectionref{sec:sentencecase}}} + \gterm{title-case}{\desc{content that needs to appear in a title + that should have each significant word converted to + \idx{sentence-case}. See \sectionref{sec:capitalisewords}}} + \gterm{exclusion-word}{\name{exclusion word} + \desc{a word that shouldn't have its case changed by + \idx{title-case} commands, unless the word occurs at the start}} + \gtermacr{utf8}{UTF-8}{Unicode Transformation Format (8-bit)} + {% + \desc{a variable-width encoding that uses 8-bit code units. This + means that some characters are represented by more that one byte. + \XeLaTeX\ and \LuaLaTeX\ treat the multi-byte sequence as a single + token, but the older \LaTeX\ formats have single-byte tokens, which + can cause complications, although these have mostly been addressed with + the newer kernels introduced over the past few years. Related blog article: + \blog{binary-files-text-files-and-file-encodings/}{Binary Files, + Text Files and File Encodings}} + } + \gterm{semanticcommand}{\name{semantic command} + \desc{essentially, this is a command associated with a + particular element, idea or topic that hides the font + and other stylistic formatting inside its definition. For + example, Latin taxonomy is usually displayed in italic. + Explicitly using font commands, for example + \begin{compactcodebox}\cmd{textit}\marg{Clostridium}\end{compactcodebox} + is syntactic markup. + Whereas defining a command called, say, \cmd{bacteria} that + displays its argument in italics is a semantic command. The + actual styling is hidden and the command relates specifically to + a particular concept. +\begin{codebox} +Syntactic: \cmd{textit}\marg{Clostridium}^^J\codepar +\cmd{newrobustcmd}*\marg{\cmd{bacteria}}[1]{\cmd{emph}\marg{\#1}}\%\newline +Semantic: \cmd{bacteria}\marg{Clostridium} +\end{codebox} + The end result is the same: +\begin{resultbox} +Syntactic: \textit{Clostridium}\glspar +Semantic: \emph{Clostridium} +\end{resultbox} + The advantage with semantic commands is that it's much easier to + change the style, simply by adjusting the command definition. + Note that I've used \cmd{newrobustcmd} to make the semantic + command robust as the style commands can cause a problem if they + expand too soon} + } + % index only + \gidx{punctuation}{} + \gpunc{sym.dollar}{\name{\code{\$}}}% $ + \gidx{uppercase}{} + \gidx{lowercase}{} +} -\begin{document} -\MakeShortVerb{|} - \title{mfirstuc.sty v2.07: -uppercasing first letter} - \author{Nicola L.C. Talbot\\[10pt] +\title{mfirstuc.sty v2.08: +sentence and title casing} +\author{Nicola L.C. Talbot\\[10pt] Dickimaw Books\\ -\url{http://www.dickimaw-books.com/}} - - \date{2021-10-15} - \maketitle - \tableofcontents - - \chapter{Introduction} - \label{sec:intro} +\href{https://www.dickimaw-books.com/}{\nolinkurl{dickimaw-books.com}}} +\date{2022-10-14 +} -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. +\begin{document} +\maketitle + +\htmlavailable + +\begin{information} +The \sty{mfirstuc} package was originally part of the +\sty{glossaries} bundle (added to \sty{glossaries} v1.12 +in 2008) for use with commands like \gls{Gls}, +which need to have the first letter converted to uppercase +(\idx{sentence-case}), but as the commands provided by +\sty{mfirstuc} may be used without \sty{glossaries}, the two +were split into separately maintained packages in 2015 +(\sty{mfirstuc} v2.0 and \sty{glossaries} v4.18). +\end{information} + +Version 2.08 has reimplemented \gls{makefirstuc} using \LaTeX3 +commands. If there are any compatibility issues, you can rollback to +v2.07: +\begin{codebox} +\cmd{usepackage}\marg{mfirstuc}[=2.07] +\end{codebox} + +\frontmatter +\tableofcontents + +\mainmatter +\chapter{Sentence-Case} +\label{sec:sentencecase} + +There are two \idx{sentence-case} commands provided: \gls{MFUsentencecase} +and \gls{makefirstuc}. A summary of the principle features of +the two commands is given in +\tableref{tab:sentencecasesummary}. + +\begin{table}[htbp] +\caption{Principle features of +\glsfmttext{MFUsentencecase} and \glsfmttext{makefirstuc}} +\label{tab:sentencecasesummary} +\centering +\begin{tabular}{lcc} +\bfseries Feature & \bfseries \gls{MFUsentencecase}[] +& \bfseries \gls{makefirstuc}[]\\ +Can expand? & \proyes & \prono\\ +Supports \idxpl{exclusion}? & \proyes & \proyes\\ +Supports \idxpl{blocker}? & \prono & \proyes\\ +Supports \idxpl{mapping}? & \prono & \proyes\\ +Semantic commands must be robust? & \conyes & \conno +\end{tabular} +\end{table} + +\section{Examples} +\label{sec:sentencecaseex} + +Text only (leading \idx{utf8} now supported): +\begin{coderesult} +\gls{makefirstuc}\marg{élite} / +\gls{MFUsentencecase}\marg{élite} +\tcblower +\makefirstuc{élite} / +\MFUsentencecase{élite} +\end{coderesult} + +Leading \idx{punctuation} is ignored: +\begin{coderesult} +\gls{makefirstuc}\marg{`word'} / +\gls{MFUsentencecase}\marg{`word'} +\tcblower +\makefirstuc{`word'} / +\MFUsentencecase{`word'} +\end{coderesult} +However, if the \idx{punctuation} character is followed by a +\idx{blocker} or \idx{mapping} command, the \idx{punctuation} will +need to be excluded otherwise the command will be treated as an +\idx{exclusion}. If possible, use \idxc{semanticcommand}{semantic +markup} instead of directly including the \idx{punctuation}. + +Fragile commands need to be protected with +\gls{MFUsentencecase}: +\begin{codebox} +\cmd{newcommand}\marg{\cmd{alert}}[1]\marg{\cmd{textcolor}\marg{red}\marg{\cmd{textbf}\marg{\#1}}} +\gls{makefirstuc}\marg{\cmd{alert}\marg{élite}} / +\gls{MFUsentencecase}\marg{\strong{\cmd{protect}}\cmd{alert}\marg{élite}} +\end{codebox} +\begin{resultbox} +\newcommand{\alert}[1]{\textcolor{red}{\textbf{#1}}} +\makefirstuc{\alert{élite}} / +\MFUsentencecase{\protect\alert{élite}} +\end{resultbox} + +\Idxpl{exclusion} are supported by both \gls{makefirstuc} and +\gls{MFUsentencecase}: +\begin{codebox} +\gls{MFUexcl}\marg{\gls+{index}} +\gls{makefirstuc}\marg{\gls{index}\marg{word}example} / +\gls{MFUsentencecase}\marg{\gls{index}\marg{word}example} +\end{codebox} +\begin{resultbox} +\MFUexcl{\index} +\makefirstuc{\index{example}example} / +\MFUsentencecase{\index{example}example} +\end{resultbox} + +\Idxpl{blocker} are only supported by \gls{makefirstuc}. +They are treated as \idxpl{exclusion} with +\gls{MFUsentencecase}, which produces a different result: +\begin{codebox} +\gls{MFUblocker}\marg{\gls+{nameref}} +\gls{makefirstuc}\marg{\gls{nameref}\marg{sec:sentencecase} section} / +\gls{MFUsentencecase}\marg{\gls{nameref}\marg{sec:sentencecase} section} +\end{codebox} +\begin{resultbox} +\MFUblocker{\nameref} +\makefirstuc{\nameref{sec:sentencecase} section} / +\MFUsentencecase{\nameref{sec:sentencecase} section} +\end{resultbox} + +\Idxpl{mapping} are only supported by \gls{makefirstuc}. +They are treated as \idxpl{exclusion} with +\gls{MFUsentencecase}, which produces a different result: +\begin{codebox} +\cmd{newrobustcmd}\marg{\cmd{secref}}[1]\marg{section\glstildechar\cmd{ref}\marg{\#1}} +\cmd{newrobustcmd}\marg{\cmd{Secref}}[1]\marg{Section\glstildechar\cmd{ref}\marg{\#1}} +\gls{MFUaddmap}\marg{\cmd{secref}}\marg{\cmd{Secref}} +\gls{makefirstuc}\marg{\cmd{secref}\marg{sec:sentencecase} example} / +\gls{MFUsentencecase}\marg{\cmd{secref}\marg{sec:sentencecase} example} +\end{codebox} +\begin{resultbox} +\newrobustcmd{\secref}[1]{section~\ref{#1}} +\newrobustcmd{\Secref}[1]{Section~\ref{#1}} +\MFUaddmap{\secref}{\Secref} +\makefirstuc{\secref{sec:sentencecase} example} / +\MFUsentencecase{\secref{sec:sentencecase} example} +\end{resultbox} + +Argument expansion: \gls{MFUsentencecase} expands its argument +and then skips exclusions whereas \gls{makefirstuc} parses its +argument without expansion and then passes the relevant content to +\gls{glsmakefirstuc}. Note that different results will occur with +the \opt{expanded} and \opt{unexpanded} package options. +For example: +\begin{codebox} +\cmd{usepackage}[\opt{expanded}]\marg{mfirstuc} +\cmd{newcommand}\marg{\cmd{testa}}\marg{sample} +\cmd{newcommand}\marg{\cmd{testb}}\marg{\cmd{testa}\cmd{ }test} +\cbeg{document} +\gls{makefirstuc}\marg{\cmd{testb}} / \gls{xmakefirstuc}\marg{\cmd{testb}} / +\gls{emakefirstuc}\marg{\cmd{testb}} / \gls{MFUsentencecase}\marg{\cmd{testb}} +\cend{document} +\end{codebox} +\begin{resultbox} +\newcommand{\testa}{sample}% +\newcommand{\testb}{\testa\ test}% +\renewcommand*{\glsmakefirstuc}[1]{\MFUsentencecase{#1}}% +\makefirstuc{\testb} / \xmakefirstuc{\testb} / +\emakefirstuc{\testb} / \MFUsentencecase{\testb} +\end{resultbox} +With the default \opt{unexpanded} option the result is: +\begin{resultbox} +\newcommand{\testa}{sample} +\newcommand{\testb}{\testa\ test} +\makefirstuc{\testb} / \xmakefirstuc{\testb} / +\emakefirstuc{\testb} / \MFUsentencecase{\testb} +\end{resultbox} +Note that this is different from the result in earlier versions of +\sty{mfirstuc}. +\begin{codebox} +\cmd{usepackage}\marg{mfirstuc}[=v2.07] +\cmd{newcommand}\marg{\cmd{testa}}\marg{sample} +\cmd{newcommand}\marg{\cmd{testb}}\marg{\cmd{testa}\cmd{ }test} +\cbeg{document} +\gls{makefirstuc}\marg{\cmd{testb}} / \gls{xmakefirstuc}\marg{\cmd{testb}} / +\gls{emakefirstuc}\marg{\cmd{testb}} +\cend{document} +\end{codebox} +This produces: +\begin{resultbox} +SAMPLE TEST / SAMPLE test / Sample test +\end{resultbox} +If this old result is required, either use rollback or try +the \opt{grabfirst} option. + +Argument expansion with \idxpl{mapping} (and the default +\opt{unexpanded} option): +\begin{codebox} +\cmd{newrobustcmd}\marg{\cmd{secref}}[1]\marg{section\glstildechar\cmd{ref}\marg{\#1}} +\cmd{newrobustcmd}\marg{\cmd{Secref}}[1]\marg{Section\glstildechar\cmd{ref}\marg{\#1}} +\gls{MFUaddmap}\marg{\cmd{secref}}\marg{\cmd{Secref}} +\cmd{newcommand}\marg{\cmd{testa}}\marg{\cmd{secref}\marg{sec:sentencecase}} +\cmd{newcommand}\marg{\cmd{testb}}\marg{\cmd{testa}\cmd{ }example} +\gls{makefirstuc}\marg{\cmd{testb}} / \gls{xmakefirstuc}\marg{\cmd{testb}} / +\gls{emakefirstuc}\marg{\cmd{testb}} / \gls{MFUsentencecase}\marg{\cmd{testb}} +\end{codebox} +\begin{resultbox} +\newrobustcmd{\secref}[1]{section~\ref{#1}} +\newrobustcmd{\Secref}[1]{Section~\ref{#1}} +\MFUaddmap{\secref}{\Secref} +\newcommand{\testa}{\secref{sec:sentencecase}} +\newcommand{\testb}{\testa\ example} +\makefirstuc{\testb} / \xmakefirstuc{\testb} / +\emakefirstuc{\testb} / \MFUsentencecase{\testb} +\end{resultbox} + +\section{Sentence Case Commands} +\label{sec:sentencecasecmds} + +\cmddef{MFUsentencecase} +This simply uses \gls{texttitlecasefirst:n}, which is provided by +the \LaTeX3 kernel. Note that this fully expands the argument. +If you use this command, ensure that your \idxpl{semanticcommand} are +robust. For example: +\begin{codebox} +\cmd{newrobustcmd}\marg{\cmd{alert}}[1]\marg{\cmd{textcolor}\marg{red}\marg{\cmd{textbf}\marg{\#1}}} +\gls{MFUsentencecase}\marg{\cmd{alert}\marg{sample} text} +\end{codebox} +\begin{resultbox} +\newrobustcmd{\alert}[1]{\textcolor{red}{\textbf{#1}}} +\MFUsentencecase{\alert{sample} text} +\end{resultbox} +Note that the following will fail: +\begin{badcodebox} +\cmd{newcommand}\marg{\cmd{alert}}[1]\marg{\cmd{textcolor}\marg{red}\marg{\cmd{textbf}\marg{\#1}}} +\gls{MFUsentencecase}\marg{\cmd{alert}\marg{sample} text} +\end{badcodebox} +This is because the expansion that's performed before the case-change will result in: +\begin{badcodebox} +\cmd{textcolor}\marg{Red}\marg{\cmd{textbf}\marg{sample}} text +\end{badcodebox} +This triggers an error since \code{Red} isn't a recognised colour +name. + +\cmddef{makefirstuc} +This is the original command provided by \sty+{mfirstuc}, which was +written to assist sentence-casing in the \sty{glossaries} package +and had to take markup into account. It parses its argument to try +to determine which part needs the case-change. The actual +case-change is performed by \gls{glsmakefirstuc}. + +As from v2.08, the definition of \gls{makefirstuc} has been updated to use \LaTeX3 +code, but the argument is still parsed, which allows for non-robust +\idxpl{semanticcommand}, and now also takes \idxpl{blocker} and \idxpl{mapping} into +account. For example: +\begin{codebox} +\cmd{newcommand}\marg{\cmd{alert}}[1]\marg{\cmd{textcolor}\marg{red}\marg{\cmd{textbf}\marg{\#1}}} +\gls{makefirstuc}\marg{\cmd{alert}\marg{sample} text} +\end{codebox} +\begin{resultbox} +\newcommand{\alert}[1]{\textcolor{red}{\textbf{#1}}} +\makefirstuc{\alert{sample} text} +\end{resultbox} + +The rules used when parsing \code{\gls{makefirstuc}\margm{text}} are as follows: +\begin{enumerate} +\item if \meta{text} is empty do nothing; -\begin{important} -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. -\end{important} +\item if \meta{text} consists of a single item or starts +with a group do \code{\gls{glsmakefirstuc}\margm{text}}; -Here are some examples of semantic commands: -\begin{enumerate} -\item Quoted material: -\begin{verbatim} -\newcommand{\qt}[1]{``#1''} -\end{verbatim} -(or use the \styfmt{csquotes} package). With this, the following -works: -\begin{verbatim} -\makefirstuc{\qt{word}} -\end{verbatim} -This produces: -\begin{display} -\makefirstuc{\qt{word}} -\end{display} -Whereas -\begin{verbatim} -\makefirstuc{``word''} -\end{verbatim} -fails (no case-change and double open quote becomes two single open -quotes): -\begin{display} -\makefirstuc{``word''} -\end{display} - -\item Font styles or colours: -\begin{verbatim} -\newcommand*{\alert}[1]{\textcolor{red}{#1}} -\end{verbatim} -Now the following is possible: -\begin{verbatim} -\makefirstuc{\alert{word}} -\end{verbatim} -This produces -\begin{display} -\newcommand*{\alert}[1]{\textcolor{red}{#1}}% -\makefirstuc{\alert{word}} -\end{display} -Note that \verb|\makefirstuc{\textcolor{red}{word}}| fails -(with an error) because the case-changing interferes with the label. -\end{enumerate} +\item if \meta{text} starts with a command \meta{cs}: -Define these semantic commands robustly if you intend using -any of the commands that fully expand their argument -(\cs{emakefirstuc}, \cs{ecapitalisewords} and -\cs{ecapitalisefmtwords}). - -\chapter{Capitalising the First Letter of 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.} - -If \meta{stuff} starts with punctuation that should be skipped over, -use: -\begin{definition}[\DescribeMacro\MFUskippunc] -\cs{MFUskippunc}\marg{punctuation} -\end{definition} + \begin{enumerate} + \item if \meta{cs} is \gls{protect}, skip it and continue to + the next step where the command \meta{cs} under inspection + is now the one that follows \gls{protect}: -\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|\textcolor{red}{text}| -you need to define, say, \verb|\red| as \verb|\color{red}| and use -\verb|\red{text}|. -\end{important} + \item if \meta{cs} has been identified as a \idx{blocker}, just do + \meta{text} (that is, no case-change is applied); -Examples: -\begin{itemize} -\item |\makefirstuc{abc}| produces \makefirstuc{abc}. + \item if \meta{cs} isn't followed by a group then do + \code{\gls{glsmakefirstuc}\margm{text}}; -\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 otherwise assume the format is \code{\meta{cs}\margm{arg}\meta{following}} + (where \meta{following} may be empty) and then: -\item |\makefirstuc{{\'a}bc}| produces \makefirstuc{{\'a}bc}. + \begin{enumerate} + \item if \meta{cs} has been \idxc{mapping}{mapped} to + \meta{Cs} then do \code{\meta{Cs}\margm{arg}\meta{following}}; -\item |\makefirstuc{\ae bc}| produces \makefirstuc{\ae bc}. + \item if \meta{cs} has been identified as an \idx{exclusion}, + do \code{\meta{cs}\margm{arg}\gls{makefirstuc}\margm{following}}; -\item |\makefirstuc{{\ae}bc}| produces \makefirstuc{{\ae}bc}. + \item otherwise do \code{\meta{cs}\marg{\gls{makefirstuc}\margm{arg}}\meta{following}}. + \end{enumerate} -\item |\makefirstuc{{ä}bc}| produces \makefirstuc{{ä}bc}. + \end{enumerate} -\item |\makefirstuc{\MFUskippunc{'}tis the season}| produces -\makefirstuc{\MFUskippunc{'}tis the season}. +\item otherwise do \code{\gls{glsmakefirstuc}\margm{text}}. +\end{enumerate} -\end{itemize} +Note that the above algorithm uses recursion. The termination points +are: don't implement a change, replace a command with another +command, or apply the case-change via \gls{glsmakefirstuc}. + +For convenience, the following commands are also provided: +\cmddef{xmakefirstuc} +This is simply a shortcut for: +\begin{compactcodebox} +\cmd{expandafter}\gls{makefirstuc}\cmd{expandafter}\margm{text} +\end{compactcodebox} +This ensures the first token in \meta{text} is expanded before being +passed to \gls{makefirstuc}. + +\cmddef{emakefirstuc} +This fully expands its argument before passing it to +\gls{makefirstuc}. For example: +\begin{codebox} +\cmd{newcommand}\marg{\cmd{test}}[1]\marg{sample \#1} +\cmd{newcommand}\marg{\cmd{tmp}}\marg{\cmd{test}\marg{text}} +\gls{makefirstuc}\marg{\cmd{tmp}} / +\gls{xmakefirstuc}\marg{\cmd{tmp}} / +\gls{emakefirstuc}\marg{\cmd{tmp}} +\end{codebox} +\begin{resultbox} +\newcommand{\test}[1]{sample #1} +\newcommand{\tmp}{\test{text}} +\makefirstuc{\tmp} / +\xmakefirstuc{\tmp} / +\emakefirstuc{\tmp} +\end{resultbox} +If you don't have any mappings or blockers set up, it's simpler to +use \gls{MFUsentencecase} instead of \gls{emakefirstuc}. -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 \sty{inputenc} package). The reason for this restriction -is detailed in \sectionref{sec:utf8}. +\begin{important} +With \gls{emakefirstuc}, mappings and blockers will only be +detected if they are robust or protected, otherwise they will expand too soon to +be detected. +\end{important} -\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@getfirst@UTFviii} command which is still experimental. -See the \styfmt{datatool} manual for further details. +\cmddef{glsmakefirstuc} +This command is used by \gls{makefirstuc} to perform the +case-change. The \qt{gls} prefix is for historical reasons as the original code +was part of the \sty{glossaries} package. With the default +\opt{unexpanded} option, this command is defined as: +\begin{compactcodebox} +\gls{MFUsentencecase}\marg{\gls+{unexpanded}\margm{text}} +\end{compactcodebox} +The use of \gls{unexpanded} inhibits the expansion of \meta{text} +that would otherwise occur. This allows \gls{makefirstuc} to +maintain as much backward-compatibility with version 2.07 as +possible. This is particularly important when using the +\sty{glossaries} package with a style that automatically converts +the description to \idx{sentence-case}, as there may well be +documents with complex descriptions that contain fragile commands. + +The \opt{expanded} package option will redefine \gls{glsmakefirstuc} +to use \gls{MFUsentencecase} without \gls{unexpanded}. The +\opt{grabfirst} package option will redefine \gls{glsmakefirstuc} +to use \gls{mfugrabfirstuc} to emulates the behaviour of +\gls{glsmakefirstuc} in v2.07 and below without using rollback. + +\cmddef{mfugrabfirstuc} +This robust command is provided to emulate v2.07 and its use is discouraged. +Note that you may still have different results compared to v2.07, so +you may need to use rollback instead. (Note that the \opt{grabfirst} option +additionally redefines \gls{mfirstucMakeUppercase} to +\gls{MakeUppercase}, which you will also need.) + +This applies \gls{mfirstucMakeUppercase} to the first token in \meta{text} +and leaves the remainder unchanged. This won't work if \meta{text} +starts with a \gls{utf8} character unless you use \XeLaTeX\ or +\LuaLaTeX, so avoid using this method where possible. For example: +\begin{codebox} +\cmd{renewcommand}\marg{\gls{mfirstucMakeUppercase}}[1]\marg{\comment{} + \gls{MakeUppercase}\marg{\#1}\comment{} +} +\gls{mfugrabfirstuc}\marg{sample} +\end{codebox} +This is equivalent to: +\begin{codebox} +\gls{mfirstucMakeUppercase}\marg{s}ample +\end{codebox} +Whereas +\begin{unicodebox} +\cmd{renewcommand}\marg{\gls{mfirstucMakeUppercase}}[1]\marg{\comment{} + \gls{MakeUppercase}\marg{\#1}\comment{} +} +\gls{mfugrabfirstuc}\marg{\'elite} +\end{unicodebox} +only works with \XeLaTeX\ or \LuaLaTeX. -\begin{verbatim} -\documentclass{article} +\begin{warning} +As with earlier implementations of \gls{makefirstuc} that +tried to only apply the case-change to the first token, +this won't produce the desired result if the argument starts with a +punctuation character. +\end{warning} -\usepackage[T1]{fontenc} -\usepackage[utf8]{inputenc} +For example: +\begin{codebox} +\gls{mfugrabfirstuc}\marg{`sample'} +\end{codebox} +This is equivalent to: +\begin{compactcodebox} +\gls{mfirstucMakeUppercase}\marg{`}sample' +\end{compactcodebox} +so no case-change is applied. + +\section{Exclusions} +\label{sec:exclusions} + +\begin{information} +Exclusions will apply to all \LaTeX3 case-changing commands, so will +also affect \gls{mfirstucMakeUppercase}, but this is generally +desirable. +\end{information} + +\cmddef{MFUexcl} +Identifies the text-block command \code{\meta{cs}\margm{arg}} as +an \idx{exclusion}. That is, one that should have its argument +excluded from a case-change. + +Internally, \gls{MFUexcl} adds \meta{cs} to \LaTeX3's exclusion list +\gls{ltextcaseexcludeargtl}, which means that \gls{MFUsentencecase} +will skip the command and its argument and apply the case-change to +the following content. Some common commands (\gls{begin} \gls{cite} +\gls{end} \gls{label} and \gls{ref}) are automatically added by the +\LaTeX3 kernel. +The exclusions are also recognised by \gls{makefirstuc} when it +parses its argument. + +\begin{information} +The command \gls{NoCaseChange} is automatically treated as an +exclusion by the \LaTeX3 case-changing commands with recent \LaTeX\ +kernels. You may want to add it as a blocker for \gls{makefirstuc} +and keep \gls{MFUskippunc} for exclusions. + +Note that \gls{ensuremath} is added as an exclusion by \sty{mfirstuc} otherwise +\gls{makefirstuc} will pass its argument to \gls{MFUsentencecase}, +which will cause a problem. +\end{information} + +Another way of identifying content that should be excluded with +\gls{makefirstuc} is to encapsulate it with: +\cmddef{MFUskippunc} +This is a robust command that simply does its argument and is +automatically added to the exclusion list. This may be used for +cases where the excluded command isn't a simple text-block command +that only has one mandatory argument or where leading punctuation is +followed by a \idx{blocker} or \idx{mapping}. + +The command name stems from earlier versions where leading +\idx{punctuation} needed to be skipped. This is no longer necessary, +but the command remains as a general purpose robust exclusion command. + +For example, \gls{glsadd} (provided by \sty{glossaries}) should have +its argument skipped, since its argument is a label, so the +following will ensure that \code{\gls{glsadd}\margm{label}} will be +skipped, and the case-change will be applied to the following text +for both \gls{MFUsentencecase} and \gls{makefirstuc}. +\begin{codebox} +\gls{MFUexcl}\marg{\gls{glsadd}} +\gls{makefirstuc}\marg{\gls{glsadd}\marg{ex}some text} +\gls{MFUsentencecase}\marg{\gls{glsadd}\marg{ex}some text} +\end{codebox} +This will be equivalent to: +\begin{compactcodebox} +\gls{glsadd}\marg{ex}Some text +\end{compactcodebox} +However, \gls{glsadd} can take an optional argument which, if +present, will cause a problem. For example: +\begin{badcodebox} +\gls{MFUexcl}\marg{\gls{glsadd}} +\gls{makefirstuc}\marg{\gls{glsadd}\oarg{counter=section}\marg{ex}some text} +\gls{MFUsentencecase}\marg{\gls{glsadd}\oarg{counter=section}\marg{ex}some text} +\end{badcodebox} +Both commands will cause the following error: +\begin{transcript} +! Package glossaries Error: Glossary entry `\nlctopensqbracket' has not been defined. +\end{transcript} +This is because the open square bracket is assumed to be the +argument of \gls{glsadd}, so this effectively becomes: +\begin{compactcodebox} +\gls{glsadd}\marg{\nlctopensqbracket}Counter=section\nlctclosesqbracket exsome text +\gls{glsadd}\marg{\nlctopensqbracket}Counter=section\nlctclosesqbracket exsome text +\end{compactcodebox} +which means that now \code{\nlctopensqbracket} is considered the label and everything +that follows is just text. + +For this situation to work, you need to encapsulate the problematic +content with an exclusion command, such as \gls{NoCaseChange} or \gls{MFUskippunc}: +\begin{codebox} +\gls{makefirstuc}\marg{\gls{MFUskippunc}\marg{\gls{glsadd}\oarg{counter=section}\marg{ex}}some text} +\end{codebox} +This will also work with \gls{MFUsentencecase} because +\sty{mfirstuc} automatically adds \gls{MFUskippunc} to the exclusion +list. + +\begin{information} +As from \sty{glossaries} v4.50, \gls{glsadd} is automatically added +as an exclusion, but be aware of the problem with using the optional +argument, as described above. +\end{information} + +\Idx{punctuation} characters are skipped by \gls{MFUsentencecase}. +For example: +\begin{coderesult} +\gls{MFUsentencecase}\marg{`word'} +\tcblower +\MFUsentencecase{`word'} +\end{coderesult} +However, leading \idx{punctuation} will result in \gls{makefirstuc} +passing its entire argument to \gls{MFUsentencecase} (since the +argument doesn't start with \code{\meta{cs}\margm{arg}}), which +means that \gls{makefirstuc} won't detect any \idx{blocker} or +\idx{mapping}. -\usepackage{datatool-base}[2016/01/12]% v2.24+ -\usepackage{mfirstuc} +For example: +\begin{codebox} +\gls{MFUblocker}\marg{\gls+{nameref}} +\cmd{newcommand}*\marg{\cmd{qt}}[1]\marg{``\#1''} +\gls{makefirstuc}\marg{``\gls{nameref}\marg{sec:sentencecase} section''} / +\gls{makefirstuc}\marg{\gls{MFUskippunc}\marg{``}\gls{nameref}\marg{sec:sentencecase} section''} / +\gls{makefirstuc}\marg{\cmd{qt}\marg{\gls{nameref}\marg{sec:sentencecase} section}} +\end{codebox} +\begin{resultbox} +\MFUblocker{\nameref} +\makefirstuc{``\nameref{sec:sentencecase} section''} / +\makefirstuc{\MFUskippunc{``}\nameref{sec:sentencecase} section''} / +\makefirstuc{\qt{\nameref{sec:sentencecase} section}} +\end{resultbox} +If you are using a package such as \sty{csquotes}, bear in mind that +if the command is followed by an asterisk (a \qt{starred command}) +or an optional argument then it won't fit the expected +\code{\meta{cs}\margm{arg}} format and unexpected results will occur. + +\section{Blockers} +\label{sec:blockers} + +A \idx{blocker} is a command that prevents any case-change if it occurs at +the start of \gls{makefirstuc} or after the argument of an +\idx{exclusion}. Blockers are not supported by +\gls{MFUsentencecase} but are instead treated as exclusions. + +\cmddef{MFUblocker} +Identifies \meta{cs} as a \idx{blocker}. Since \idxpl{blocker} +aren't supported by \gls{MFUsentencecase}, this automatically +implements \code{\gls{MFUexcl}\margm{cs}} to protect its argument +from \gls{MFUsentencecase}, but it won't prevent subsequent content +from being changed. -\begin{document} -\makefirstuc{élite} -\end{document} -\end{verbatim} -(Package ordering is important.) +For example: +\begin{codebox} +\gls{MFUblocker}\marg{\gls+{nameref}} +\gls{makefirstuc}\marg{\gls{nameref}\marg{sec:sentencecase} section} +\end{codebox} +\begin{resultbox} +\MFUblocker{\nameref} +\makefirstuc{\nameref{sec:sentencecase} section} +\end{resultbox} + +In the following, the \idx{blocker} isn't detected by +\gls{makefirstuc} because the content doesn't start with +\code{\meta{cs}\margm{arg}} or +\code{\cmd{protect}\meta{cs}\margm{arg}}. This means that the entire +content is passed to \gls{MFUsentencecase} which treats +\gls{nameref} as an \idx{exclusion}: +\begin{codebox} +\gls{MFUblocker}\marg{\gls{nameref}} +\gls{makefirstuc}\marg{\cmd{relax}\gls{nameref}\marg{sec:sentencecase} section} +\end{codebox} +\begin{resultbox} +\MFUblocker{\nameref} +\makefirstuc{\relax\nameref{sec:sentencecase} section} +\end{resultbox} \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. +If a \idxc{blocker}{blocking command} is inside the definition of +another command, it won't be visible to \gls{makefirstuc} unless +the other command is expanded before applying \gls{makefirstuc}. +For example, by using \gls{xmakefirstuc} or \gls{emakefirstuc}. +If it doesn't get expanded until after it has been passed to +\gls{MFUsentencecase}, then it will be treated as an \idx{exclusion} +instead. \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}. +Recent \LaTeX\ kernels provide \gls{NoCaseChange} and automatically +add it as an \idx{exclusion}. You may want to add it as a +\idx{blocker} for \gls{makefirstuc}. For example: +\begin{codebox} +\gls{makefirstuc}\marg{\gls{ensuremath}\marg{\cmd{alpha}}-particle} / +\gls{makefirstuc}\marg{\idx{dollar}\cmd{alpha}\idx{dollar}-particle} / +\gls{MFUsentencecase}\marg{\gls{ensuremath}\marg{\cmd{alpha}}-particle} / +\gls{MFUsentencecase}\marg{\idx{dollar}\cmd{alpha}\idx{dollar}-particle} +\codepar +\gls{MFUblocker}\marg{\gls{NoCaseChange}}\comment{} +\gls{makefirstuc}\marg{\gls{ensuremath}\marg{\cmd{alpha}}-particle} / +\gls{makefirstuc}\marg{\gls{NoCaseChange}\marg{\idx{dollar}\cmd{alpha}\idx{dollar}}-particle} / +\gls{MFUsentencecase}\marg{\gls{ensuremath}\marg{\cmd{alpha}}-particle} / +\gls{MFUsentencecase}\marg{\gls{NoCaseChange}\marg{\idx{dollar}\cmd{alpha}\idx{dollar}}-particle} +\end{codebox} +Note that \sty{mfirstuc} adds \gls{ensuremath} as an exclusion so +\gls{makefirstuc} will skip it. Whereas the example above that +starts with \idx{dollar} will have the entire argument passed to +\gls{MFUsentencecase}, which skips the maths content. +In the first paragraph, \gls{NoCaseChange} is only an +\idx{exclusion}, but in the second paragraph it's also a +\idx{blocker}. +\begin{resultbox} +Exclusion: +\makefirstuc{\ensuremath{\alpha}-particle} / +\makefirstuc{$\alpha$-particle} / +\MFUsentencecase{\ensuremath{\alpha}-particle} / +\MFUsentencecase{$\alpha$-particle} + +Blocker: +\MFUblocker{\NoCaseChange}% +\makefirstuc{\ensuremath{\alpha}-particle} / +\makefirstuc{\NoCaseChange{$\alpha$}-particle} / +\MFUsentencecase{\ensuremath{\alpha}-particle} / +\MFUsentencecase{\NoCaseChange{$\alpha$}-particle} +\end{resultbox} + +\section{Mappings} +\label{sec:mappings} + +A \idx{mapping} indicates that one command should be substituted for +another, instead of applying a case-change. The assumption is that +the substituted command should perform the case-change instead. +\Idxpl{mapping} are not supported by \gls{MFUsentencecase} +but are instead treated as exclusions. + +\cmddef{MFUaddmap} +Identifies a mapping which indicates that \gls{makefirstuc} should +replace \meta{cs1} with \meta{cs2} and not apply a case-change. +This automatically implements: +\begin{compactcodebox} +\gls{MFUexcl}\margm{cs1}\gls{MFUblocker}\margm{cs2} +\end{compactcodebox} +This means that \meta{cs2} is identified as a \idx{blocker} (since +it's assumed to already be a \idx{sentence-case} command) and +\meta{cs1} is identified as an \idx{exclusion} to protect its +argument from \gls{MFUsentencecase}, which doesn't support +\idxpl{mapping}. + +\begin{information} +If either \meta{cs1} or \meta{cs2} is empty, no mapping is established, but an +\idx{exclusion} or \idx{blocker} will be set for the non-empty argument. +\end{information} + +For example (with \sty{glossaries}): +\begin{codebox} +\gls{MFUaddmap}\marg{\gls+{gls}}\marg{\gls+{Gls}} +\gls{makefirstuc}\marg{\gls{gls}\marg{ex} some text} +\end{codebox} +This will be converted to: +\begin{compactcodebox} +\gls{Gls}\marg{ex} some text +\end{compactcodebox} +Note that this and similar \idxpl{mapping} are automatically added +in \sty{glossaries} v4.50+ and \sty{glossaries-extra} v1.49+. \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. +If a \idxc{mapping}{mapped command} is inside the definition of +another command, it won't be visible to \gls{makefirstuc} unless +the other command is expanded before applying \gls{makefirstuc}. +For example, by using \gls{xmakefirstuc} or \gls{emakefirstuc}. +If it doesn't get expanded until after it has been passed to +\gls{MFUsentencecase}, then it will be treated as an \idx{exclusion} +instead. \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} +\section{Package Options} +\label{sec:pkgoptions} -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). +\optiondef{expanded} +Redefines \gls{glsmakefirstuc} to simply use \gls{MFUsentencecase}. -\chapter{Capitalise the First Letter of Each Word in a Phrase or Sentence (Title Case)} +\optiondef{unexpanded} +Redefines \gls{glsmakefirstuc} to use \gls{MFUsentencecase} +without expanding its argument. + +\optiondef{grabfirst} +Redefines \gls{glsmakefirstuc} to use \gls{mfugrabfirstuc} and also +redefines \gls{mfirstucMakeUppercase} to use \gls{MakeUppercase}. + +This option is best avoided and is only provided to emulate the v2.07 +behaviour of \gls{glsmakefirstuc}. However, you may still have +different results compared to v2.07, so you may need to use rollback +instead. + +\chapter{Title-Case} \label{sec:capitalisewords} -New to mfirstuc v1.06: -\begin{definition}[\DescribeMacro{\capitalisewords}] -\cs{capitalisewords}\marg{text} -\end{definition} -This command applies \ics{makefirstuc} to each word in \meta{text} +The \idx{title-case} commands are designed to convert the first letter of each +word in a phrase to uppercase. These commands are robust. +\cmddef{capitalisewords} +This command applies a \idx{sentence-case} command 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}. See \sectionref{sec:nocap} for excluding -words (such as \qt{of}) from the case-changing. - -The actual capitalisation of each word is done using -\begin{definition}[\DescribeMacro\MFUcapwordfirstuc] -\cs{MFUcapwordfirstuc}\marg{word} -\end{definition} -This just does \cs{makefirstuc}\marg{word} by default. -There's a conditional that determines whether or not to consider a -hyphen a word break: -\begin{definition}[\DescribeMacro\ifMFUhyphen] -\cs{ifMFUhyphen} -\end{definition} - -If you want to title case each part of -a compound word containing hyphens, you can enable this using -\begin{definition}[\DescribeMacro\MFUhyphentrue] -\cs{MFUhyphentrue} -\end{definition} -or switch it back off again using: -\begin{definition}[\DescribeMacro\MFUhyphenfalse] -\cs{MFUhyphenfalse} -\end{definition} -Compare -\begin{verbatim} -\capitalisewords{server-side includes} -\end{verbatim} -which produces: -\begin{display} -\capitalisewords{server-side includes} -\end{display} -with -\begin{verbatim} -\MFUhyphentrue -\capitalisewords{server-side includes} -\end{verbatim} -which produces: -\begin{display} -\MFUhyphentrue -\capitalisewords{server-side includes} -\end{display} -Note that this won't apply exceptions to each part of the hyphenated -word. - -For other punctuation you need to markup the character with: -\begin{definition}[\DescribeMacro\MFUwordbreak] -\cs{MFUwordbreak}\marg{punctuation} -\end{definition} +it has to be an ordinary space character, not another form of space, +such as \idx{nbsp} or \gls{space}. Note that no expansion is performed +on \meta{text}. For example: -\begin{verbatim} -\capitalisewords{a big\MFUwordbreak{/}small idea} -\end{verbatim} -which produces: -\begin{display} +\begin{coderesult} +\gls{capitalisewords}\marg{a sample phrase} +\tcblower +\capitalisewords{a sample phrase} +\end{coderesult} +See \sectionref{sec:nocap} for excluding words (such as \qt{of}) +from the case-changing. + +\begin{information} +This isn't the same as the \LaTeX3 command \gls{texttitlecase:n}, +which converts the first letter to \idx{uppercase} and all other +letters to \idx{lowercase}. +\end{information} + +For convenience, there are shortcut commands if expansion is +required before parsing the argument: +\cmddef{xcapitalisewords} +This is a shortcut for: +\begin{compactcodebox} +\cmd{expandafter}\gls{capitalisewords}\cmd{expandafter}\margm{text} +\end{compactcodebox} +\cmddef{ecapitalisewords} +This fully expands \meta{text} before passing it to +\gls{capitalisewords}. + +The parser used by \gls{capitalisewords} first splits up the text on +each space character. Each of these space-separated words may +actually be a compound, so further parsing is performed on each +\qt{word}. The divisions within the compound word should be marked +up with: +\cmddef{MFUwordbreak} +For example: +\begin{coderesult} +\gls{capitalisewords}\marg{a +big\gls{MFUwordbreak}\marg{/}small idea} +\tcblower \capitalisewords{a big\MFUwordbreak{/}small idea} -\end{display} -In this case, exceptions are applied. For example, if -\sty{mfirstuc-english} is loaded then: -\begin{verbatim} -\capitalisewords{one and\MFUwordbreak{/}or another} -\end{verbatim} -produces: -\begin{display} -\MFUnocap{and}\MFUnocap{or}% -\capitalisewords{one and\MFUwordbreak{/}or another} -\end{display} -Note that you can't hide \cs{MFUwordbreak} inside a command or group. +\end{coderesult} +Each sub-word within the compound word is encapsulated with: +\cmddef{MFUcapword} +Since it's inconvenient to have to markup every hyphen, +\gls{MFUcapword} can be enabled to check for hyphens. + +\cmddef{ifMFUhyphen} +This conditional determines whether or not \gls{MFUcapword} should +consider a hyphen a word break. If this conditional is true, then +\gls{MFUcapword} will encapsulate its argument with: +\cmddef{MFUhyphencapword} +This will parse \meta{text} for hyphen characters and apply the case +change to each hyphen-separated word. Otherwise \gls{MFUcapword} +will treat its argument as a single word. + +The conditional can be set to true with: +\cmddef{MFUhyphentrue} +and switched back off with: +\cmddef{MFUhyphenfalse} -Exceptions aren't applied if \cs{MFUwordbreak} occurs before the -first space. For example: -\begin{verbatim} -\MFUnocap{a}\MFUnocap{the}% -\capitalisewords{a\MFUwordbreak{/}the something} -\end{verbatim} -produces: -\begin{display} -\MFUnocap{a}\MFUnocap{the}% -\capitalisewords{a\MFUwordbreak{/}the something} -\end{display} +For example: +\begin{codebox} +\gls{capitalisewords}\marg{server-side includes} / +\gls{MFUhyphentrue} +\gls{capitalisewords}\marg{server-side includes} +\end{codebox} +\begin{resultbox} +\capitalisewords{server-side includes} / +\MFUhyphentrue +\capitalisewords{server-side includes} +\end{resultbox} + +The actual case-change of each word is performed with: +\cmddef{MFUcapwordfirstuc} +This defaults to \code{\gls{makefirstuc}\margm{word}} but may be +redefined to use \gls{MFUsentencecase}, if preferred. + +\begin{important} +Hyphens and \gls{MFUwordbreak} must be visible to the parser that +searches for word breaks. This means they won't be detected if they +are within a group or in the definition of a command. +\end{important} Formatting for the entire phrase must go outside -\cs{capitalisewords} (unlike \cs{makefirstuc}). Compare: -\begin{verbatim} -\capitalisewords{\textbf{a sample phrase}} -\end{verbatim} -which produces: -\begin{display} -\capitalisewords{\textbf{a sample phrase}} -\end{display} -with: -\begin{verbatim} -\textbf{\capitalisewords{a sample phrase}} -\end{verbatim} -which produces: -\begin{display} -\textbf{\capitalisewords{a sample phrase}} -\end{display} - -As from version 2.03, there is now a command for phrases that may -include a formatting command: -\begin{definition} -\cs{capitalisefmtwords}\marg{phrase} -\end{definition} -where \meta{phrase} may be just words (as with \cs{capitalisewords}) -or may be entirely enclosed in a formatting command in the form -\begin{alltt} -\cs{capitalisefmtwords}\{\meta{cs}\marg{phrase}\} -\end{alltt} -or contain formatted sub-phrases -\begin{alltt} -\cs{capitalisefmtwords}\{\meta{words} \meta{cs}\marg{sub-phrase} \meta{words}\} -\end{alltt} -Avoid scoped declarations. +\gls{capitalisewords} (unlike \gls{makefirstuc}). +For example: +\begin{codebox} +\gls{capitalisewords}\marg{\cmd{emph}\marg{a sample phrase}} / +\cmd{emph}\marg{\gls{capitalisewords}\marg{a sample phrase}} +\end{codebox} +\begin{resultbox} +\capitalisewords{\emph{a sample phrase}} / +\emph{\capitalisewords{a sample phrase}} +\end{resultbox} + +If your phrase is likely to contain formatting commands, you can instead use: +\cmddef{capitalisefmtwords} +where \meta{text} may be just words (as with \gls{capitalisewords}): +\begin{compactcodebox} +\gls{capitalisefmtwords}\margm{words} +\end{compactcodebox} +or may be entirely enclosed in a formatting command in the form: +\begin{compactcodebox} +\gls{capitalisefmtwords}\marg{\meta{cs}\margm{words}} +\end{compactcodebox} +or contain formatted sub-phrases: +\begin{compactcodebox} +\gls{capitalisefmtwords}\marg{\meta{words} \meta{cs}\margm{sub-phrase} \meta{words}} +\end{compactcodebox} +The starred form only permits a text-block command at the +start of the phrase. See \sectionref{sec:titlecaseexamples} for +examples. + +\begin{warning} +Avoid declarations, such as \cmd{bfseries} or \cmd{em}. +\end{warning} + +If expansion is required, you can use: +\cmddef{xcapitalisefmtwords} +which is a shortcut for: +\begin{compactcodebox} +\cmd{expandafter}\gls{capitalisefmtwords}\cmd{expandafter}\margm{text} +\end{compactcodebox} +(The star modifier will be applied with +\code{\gls{xcapitalisefmtwords}*} in an appropriate manner.) + +\cmddef{ecapitalisefmtwords} +This will fully expand its argument before passing it to +\gls{capitalisefmtwords}. Again, the star modifier may be used. \begin{important} -\cs{capitalisefmtwords} is only designed for phrases that contain -text-block commands with a single +The unstarred \gls{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}. +starred form or \gls{capitalisewords}. \end{important} -The starred form only permits a text-block command at the -start of the phrase. +\section{Excluding Words From Case-Changing} +\label{sec:nocap} + +\glsadd{exclusion-word}Some words typically shouldn't have their case changed unless they +occur at the start. These words can be identified with: +\cmddef{MFUnocap} +This only has a local effect. The global version is: +\cmddef{gMFUnocap} +The list of words that shouldn't be capitalised can be cleared +using: +\cmddef{MFUclear} + + +For example: +\begin{codebox} +\gls{capitalisewords}\marg{the wind in the willows} +\codepar +\gls{MFUnocap}\marg{in}\comment{} +\gls{MFUnocap}\marg{the}\comment{} +\codepar +\gls{capitalisewords}\marg{the wind in the willows} +\end{codebox} +\begin{resultbox} +\capitalisewords{the wind in the willows} + +\MFUnocap{in}% +\MFUnocap{the}% + +\capitalisewords{the wind in the willows} +\end{resultbox} + +Since the case-change is ultimately performed by \gls{makefirstuc}, +you can also use an \idx{exclusion} to prevent an individual word +from being changed. For example: +\begin{codebox} +\cmd{newcommand}\marg{\cmd{NoChange}}[1]\marg{\#1} +\gls{MFUexcl}\marg{\cmd{NoChange}} +\gls{MFUclear} +\gls{capitalisewords}\marg{the \cmd{NoChange}\marg{wind} in the willows} +\end{codebox} +\begin{resultbox} +\providecommand{\NoChange}[1]{#1} +\MFUexcl{\NoChange} +\MFUclear +\capitalisewords{the \NoChange{wind} in the willows} +\end{resultbox} +This can also work if you redefine \gls{MFUcapwordfirstuc} to use +\gls{MFUsentencecase} provided the exclusion command doesn't expand +(so \cmd{NoChange} would need to be protected or made robust in the above +example). + +\begin{important} +Exceptions only apply to (non-leading) whole words or words separated with +\gls{MFUwordbreak} but not to parts of a hyphenated +word that are split by \gls{MFUhyphencapword}. +\end{important} Examples: \begin{enumerate} +\item +Exceptions aren't applied if \gls{MFUwordbreak} occurs before the +first space. +\begin{codebox} +\gls{MFUnocap}\marg{a}\gls{MFUnocap}\marg{the}\comment{} +\gls{capitalisewords}\marg{a\gls{MFUwordbreak}\marg{/}the something} +\end{codebox} +\begin{resultbox} +\MFUnocap{a}\MFUnocap{the}% +\capitalisewords{a\MFUwordbreak{/}the something} +\end{resultbox} + +\item +Exceptions are applied for non-leading words: +\begin{codebox} +\gls{MFUnocap}\marg{and}\gls{MFUnocap}\marg{or}\comment{} +\gls{capitalisewords}\marg{one and\gls{MFUwordbreak}\marg{/}or another} +\end{codebox} +\begin{resultbox} +\MFUnocap{and}\MFUnocap{or}% +\capitalisewords{one and\MFUwordbreak{/}or another} +\end{resultbox} + +\item +Exceptions aren't applied for hyphenated parts: +\begin{codebox} +\gls{MFUhyphentrue} +\gls{MFUnocap}\marg{and}\gls{MFUnocap}\marg{or}\comment{} +\gls{capitalisewords}\marg{one and-or another} +\end{codebox} +\begin{resultbox} +\MFUhyphentrue +\MFUnocap{and}\MFUnocap{or}% +\capitalisewords{one and-or another} +\end{resultbox} +\end{enumerate} + +\pkgdef{mfirstuc-english} +The supplementary package \sty{mfirstuc-english} loads \sty{mfirstuc} and uses +\gls{MFUnocap} to add common English articles and conjunctions, such +as \qt{a}, \qt{an}, \qt{and}, \qt{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. Note that you need to explicitly +load \sty{mfirstuc-english} if you require it. There's no automatic +language detection performed by \sty{mfirstuc}. + +If you want to write a similar package for another language, all you +need to do is create a file with the extension \filefmt{.sty} +that starts with: +\begin{compactcodebox} +\cmd{NeedsTeXFormat}\marg{LaTeX2e} +\end{compactcodebox} +The next line should identify the package. For example, if you have +called the file \filefmt{mfirstuc-french.sty} then you need: +\begin{compactcodebox} +\cmd{ProvidesPackage}\marg{mfirstuc-french} +\end{compactcodebox} +It's a good idea to also add a version in the final optional +argument, for example: +\begin{compactcodebox} +\cmd{ProvidesPackage}\marg{mfirstuc-french}[2014/07/30 v1.0] +\end{compactcodebox} +Next load \sty{mfirstuc}: +\begin{compactcodebox} +\cmd{RequirePackage}\marg{mfirstuc} +\end{compactcodebox} +Now add all your \gls{MFUnocap} commands. For example: +\begin{compactcodebox} +\gls{MFUnocap}\marg{de} +\end{compactcodebox} +At the end of the file add: +\begin{compactcodebox} +\cmd{endinput} +\end{compactcodebox} + +Put the file somewhere on \TeX's path, and now you can use this +package in your document. You might also consider +\href{http://ctan.org/upload}{uploading it to CTAN} in case +other users find it useful. + + +\section{PDF Bookmarks} +\label{sec:pdfbookmarks} + +If you are using \sty{hyperref} and want to use +\gls{capitalisewords} or \gls{capitalisefmtwords} (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{transcript} +Package hyperref Warning: Token not allowed in a PDF string +(PDFDocEncoding): +(hyperref) removing `\gls{capitalisewords}' +\end{transcript} + +If you want to provide an alternative for the PDF bookmark, you can +use \sty{hyperref}'s \gls{texorpdfstring} command. For example: +\begin{codebox} +\cmd{chapter}\marg{\gls{texorpdfstring} + \marg{\gls{capitalisewords}\marg{a book of rhyme}}\comment{ TeX} + \marg{A Book of Rhyme}\comment{ PDF} +} +\end{codebox} +Alternatively, you can use \sty{hyperref}'s mechanism for +disabling commands within the bookmarks. For example: +\begin{codebox*} +\gls{pdfstringdefDisableCommands}\marg{\comment{} + \cmd{let}\gls{capitalisewords}\cmd{@firstofone} +} +\end{codebox*} +The same applies to \gls{makefirstuc}. You can, however, use +the expandable \gls{MFUsentencecase}. So you may prefer: +\begin{codebox*} +\gls{pdfstringdefDisableCommands}\marg{\comment{} + \cmd{let}\gls{capitalisewords}\cmd{MFUsentencecase} + \cmd{let}\gls{makefirstuc}\cmd{MFUsentencecase} +} +\end{codebox*} + +See the \sty{hyperref} manual for further details. + +\section{Examples} +\label{sec:titlecaseexamples} + +\begin{enumerate} +\item Text only: +\begin{coderesult} +\gls{capitalisewords}\marg{a little book of rhyme} +\tcblower +\capitalisewords{a little book of rhyme} +\end{coderesult} + +\item Excluding words (see \sectionref{sec:nocap}): +\begin{coderesult} +\gls{MFUnocap}\marg{of} +\gls{capitalisewords}\marg{a little book of rhyme} +\tcblower +\MFUnocap{of} +\capitalisewords{a little book of rhyme} +\end{coderesult} + +\item \gls{space} isn't recognised as a word boundary: +\begin{codebox} +\gls{capitalisewords}\marg{a book of rhyme.} +\codepar +\gls{capitalisewords}\marg{a book\gls{space} of rhyme.} +\end{codebox} +\begin{resultbox} +\capitalisewords{a book of rhyme.} + +\capitalisewords{a book\space of rhyme.} +\end{resultbox} + \item Phrase entirely enclosed in a formatting command: -\begin{verbatim} -\capitalisefmtwords{\textbf{a small book of rhyme}} -\end{verbatim} -produces: -\begin{display} -\capitalisefmtwords{\textbf{a small book of rhyme}} -\end{display} +\begin{codebox} +\gls{capitalisefmtwords}\marg{\cmd{emph}\marg{a small book of rhyme}} +\end{codebox} +\begin{resultbox} +\capitalisefmtwords{\emph{a small book of rhyme}} +\end{resultbox} \item Sub-phrase enclosed in a formatting command: -\begin{verbatim} -\capitalisefmtwords{a \textbf{small book} of rhyme} -\end{verbatim} -produces: -\begin{display} -\capitalisefmtwords{a \textbf{small book} of rhyme} -\end{display} +\begin{codebox} +\gls{capitalisefmtwords}\marg{a \cmd{emph}\marg{small book} of rhyme} +\end{codebox} +\begin{resultbox} +\capitalisefmtwords{a \emph{small book} of rhyme} +\end{resultbox} \item Nested text-block commands: -\begin{verbatim} +\begin{codebox} +\gls{capitalisefmtwords}\marg{\cmd{textbf}\marg{a \cmd{emph}\marg{small book}} of rhyme} +\end{codebox} +\begin{resultbox} \capitalisefmtwords{\textbf{a \emph{small book}} of rhyme} -\end{verbatim} -produces: -\begin{display} -\capitalisefmtwords{\textbf{a \emph{small book}} of rhyme} -\end{display} - -\item Indicating words that shouldn't have the case changed -(see \sectionref{sec:nocap}): -\begin{verbatim} +\end{resultbox} + +\item Formatting and case-change exception (see \sectionref{sec:nocap}): +\begin{codebox} +\gls{MFUnocap}\marg{of} +\gls{capitalisefmtwords}\marg{\cmd{textbf}\marg{a \cmd{emph}\marg{small book}} of rhyme} +\end{codebox} +\begin{resultbox} \MFUnocap{of} \capitalisefmtwords{\textbf{a \emph{small book}} of rhyme} -\end{verbatim} -produces: -\begin{display} -\MFUnocap{of} -\capitalisefmtwords{\textbf{a \emph{small book}} of rhyme} -\end{display} +\end{resultbox} \item Starred form: -\begin{verbatim} -\MFUnocap{of} -\capitalisefmtwords*{\emph{a small book of rhyme}} -\end{verbatim} -produces: -\begin{display} +\begin{codebox} +\gls{MFUnocap}\marg{of} +\gls{capitalisefmtwords}*\marg{\cmd{emph}\marg{a small book of rhyme}} +\end{codebox} +\begin{resultbox} \MFUnocap{of} \capitalisefmtwords*{\emph{a small book of rhyme}} -\end{display} +\end{resultbox} \item The starred form also works with just text (no text-block command): -\begin{verbatim} +\begin{codebox} +\gls{MFUnocap}\marg{of} +\gls{capitalisefmtwords}*\marg{a small book of rhyme} +\end{codebox} +\begin{resultbox} \MFUnocap{of} \capitalisefmtwords*{a small book of rhyme} -\end{verbatim} -produces: -\begin{display} -\MFUnocap{of} -\capitalisefmtwords*{a small book of rhyme} -\end{display} +\end{resultbox} + +\item Expansion: +\begin{codebox} +\cmd{newcommand}\marg{\cmd{abc}}\marg{\cmd{xyz}\gls+{space} four five} +\cmd{newcommand}\marg{\cmd{xyz}}\marg{one two three} +No expansion: \gls{capitalisewords}\marg{\cmd{abc}}. +\codepar +First object one-level expansion: \gls{xcapitalisewords}\marg{\cmd{abc}}. +\codepar +Fully expanded: \gls{ecapitalisewords}\marg{\cmd{abc}}. +\end{codebox} +\begin{resultbox} +\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{resultbox} + +Remember that the spaces need to be explicit. In the second case +above, using \gls{xcapitalisewords}, the space before \qt{four} has +been hidden within \gls{space} so it's not recognised as a word +boundary, but in the third case, \gls{space} has been expanded to an +actual space character. + \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} +For example: +\begin{badcodebox} +\gls{MFUnocap}\marg{of} +\gls{capitalisefmtwords}*\marg{\cmd{emph}\marg{a small} book \cmd{textbf}\marg{of rhyme}} +\end{badcodebox} +\begin{resultbox} \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 +\end{resultbox} +In this case \code{\cmd{textbf}\marg{of rhyme}} is considered a +single word. Similarly if the text-block command occurs in the middle of the argument: -\begin{verbatim} +\begin{badcodebox} +\gls{MFUnocap}\marg{of} +\gls{capitalisefmtwords}*\marg{a \cmd{emph}\marg{very small} book of rhyme} +\end{badcodebox} +\begin{resultbox} \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} -\end{verbatim} -produces: -\begin{display} -\capitalisefmtwords{{a \emph{small book}} of rhyme} -\end{display} +\end{resultbox} +In this case \code{\cmd{emph}\marg{very small}} is considered a +single word. + +Grouping causes interference. As with all the commands described here, avoid declarations. -For example, the following fails: -\begin{verbatim} -\capitalisefmtwords{{\bfseries a \emph{small book}} of rhyme} -\end{verbatim} -produces: -\begin{display} -\capitalisefmtwords{{\bfseries a \emph{small book}} of rhyme} -\end{display} +\begin{badcodebox} +\gls{capitalisefmtwords}\marg{\marg{\cmd{bfseries} a \cmd{emph}\marg{small book}} of rhyme} +\end{badcodebox} + +\begin{information} +As a general rule, it's better to define \idxpl{semanticcommand} rather +than directly using font commands and declarations within the +document. +\end{information} 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} +\begin{badcodebox} +\cmd{newcommand}*\marg{\cmd{swap}}[2]\marg{\marg{\#2}\marg{\#1}} +\gls{capitalisefmtwords}\marg{a \cmd{swap}\marg{bo}\marg{ok} of rhyme} +\end{badcodebox} +However it can work with the starred form and the simpler +\gls{capitalisewords}: +\begin{codebox} +\cmd{newcommand}*\marg{\cmd{swap}}[2]\marg{\marg{\#2}\marg{\#1}} +\gls{capitalisefmtwords}*\marg{a \cmd{swap}\marg{bo}\marg{ok} of rhyme} +\codepar +\gls{capitalisewords}\marg{a \cmd{swap}\marg{bo}\marg{ok} of rhyme} +\end{codebox} +\begin{resultbox} \newcommand*{\swap}[2]{{#2}{#1}} \capitalisefmtwords*{a \swap{bo}{ok} of rhyme} \capitalisewords{a \swap{bo}{ok} of rhyme} -\end{display} +\end{resultbox} Note that the case change is applied to the first argument. -\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} - -There are also similar shortcut commands for the version that allows -text-block commands: -\begin{definition}[\DescribeMacro{\xcapitalisefmtwords}] -\cs{xcapitalisefmtwords}\marg{text} -\end{definition} -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] -\cs{ecapitalisefmtwords}\marg{text} -\end{definition} -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. Again this has a starred version that uses -the starred form of \cs{capitalisefmtwords}. - -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: -\begin{display} -\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}. -\end{display} - -(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.) - -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} -(\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} - -\section{PDF Bookmarks} -\label{sec:pdfbookmarks} - -\begin{important} -If you are using \sty{hyperref} and want to use -\cs{capitalisewords}, \cs{capitalisefmtwords} -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} -\end{important} - -If you want to provide an alternative for the PDF bookmark, you can -use \sty{hyperref}'s \ics{texorpdfstring} command. For example: -\begin{verbatim} -\chapter{\texorpdfstring - {\capitalisewords{a book of rhyme}}% TeX - {A Book of Rhyme}% PDF -} -\end{verbatim} -Alternatively, you can use \sty{hyperref}'s mechanism for -disabling commands within the bookmarks. For example: -\begin{verbatim} -\pdfstringdefDisableCommands{% - \let\capitalisewords\@firstofone -} -\end{verbatim} - -See the \sty{hyperref} manual for further details. - -\section{Excluding Words From Case-Changing} -\label{sec:nocap} - -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} - +\chapter{Miscellaneous} +\label{sec:misc} + +\section{Saving \Glsfmtplural{exclusion}, \Glsfmtplural{blocker} and +\Glsfmtplural{mapping} in the \exttext{aux} File} +\label{sec:savetoaux} + +If the \idxpl{exclusion}, \idxpl{mapping} and \idxpl{blocker} are +required by some external tool, the information can be saved in the +\ext+{aux} file. + +\cmddef{MFUsaveatend} +This saves the information at the end of the document using a delayed +write. This means that it can register all information identified +throughout the document, but there's a chance the document may end +before the write takes place (for example, if the last page only +contains floats). This command may be counteracted by: +\cmddef{MFUsave} +This saves the information using a protected write at the point +where this command occurs, which may be too soon if additional +\idxpl{exclusion}, \idxpl{mapping} or \idxpl{blocker} are identified +later. This command will counteract any instance of +\gls{MFUsaveatend}, regardless of whether or not \gls{MFUsaveatend} +comes before or after \gls{MFUsave}. + +The associated \ext{aux} commands are listed below. In each case, a +definition is provided in the \ext{aux} file that does nothing. +\cmddef{@mfu@excls} +Lists all \idxpl{exclusion}. 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} - -You can also simply place an empty group in front of a word -if you don't want that specific instance to be capitalised. +\begin{compactcodebox*} +\gls{@mfu@excls}\marg{\gls{begin} \gls{cite} \gls{end} \gls{label} +\gls{ref} \gls{cite} \gls{NoCaseChange} \gls{ensuremath} +\gls{MFUskippunc} \gls{gls} \gls{glspl}} +\end{compactcodebox*} + +\cmddef{@mfu@blockers} +Lists all \idxpl{blocker}. For example: -\begin{verbatim} -\MFUclear -\capitalisewords{the {}wind in the willows} -\end{verbatim} -produces: -\begin{display} -\MFUclear -\capitalisewords{the {}wind in the willows} -\end{display} -This is also a useful way of protecting commands that -shouldn't be parsed. For example: -\begin{verbatim} -\capitalisewords{this is section {}\nameref{sec:nocap}.} -\end{verbatim} -produces -\begin{display} -\capitalisewords{this is section {}\nameref{sec:nocap}.} -\end{display} -(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 -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 \styfmt{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 -\href{http://ctan.org/upload}{uploading it to CTAN} in case -other users find it useful. +\begin{compactcodebox*} +\gls{@mfu@blockers}\marg{\gls{Gls} \gls{Glspl} } +\end{compactcodebox*} -\chapter{UTF-8} +\cmddef{@mfu@mappings} +Lists all \idxpl{mapping} as a \keyval\ list. +For example: +\begin{compactcodebox*} +\gls{@mfu@mappings}\marg{ \marg{\gls{gls} }= \marg{\gls{Gls} }, \marg{\gls{glspl} }= \marg{\gls{Glspl} }} +\end{compactcodebox*} + +\section{All-Caps} +\label{sec:allcaps} + +\cmddef{mfirstucMakeUppercase} +This command was originally used to perform the actual conversion to +\idx+{uppercase} and was defined to use command \gls{MakeUppercase}. +The \sty{glossaries} package (before v4.50) formerly loaded the +\sty{textcase} package and redefined \gls{mfirstucMakeUppercase} to +use \gls{MakeTextUppercase}, which was better than +\gls{MakeUppercase}. + +The \sty{textcase} package has been deprecated as from 2022 and +it now simply sets \gls{MakeTextUppercase} to \gls{MakeUppercase} +because the new kernel now defines \gls{MakeUppercase} to use the +newer \LaTeX3 command \gls{textuppercase:n}. Although that command +is expandable, \gls{MakeUppercase} is robust. + +As from v2.08, \sty{mfirstuc} now defines \gls{mfirstucMakeUppercase} +so that it uses \gls{texttitlecasefirst:n} directly, rather than +indirectly through \gls{MakeUppercase}, which means that it's now +expandable. However, \gls{mfirstucMakeUppercase} is no longer used +by \sty{mfirstuc} except in \gls{mfugrabfirstuc}, which is provided +to emulate v2.07. Note that the \opt{grabfirst} option will also +redefine \gls{mfirstucMakeUppercase} to use \gls{MakeUppercase}. + +\section{UTF-8} \label{sec:utf8} -(See -\href{https://dickimaw-books.com/blog/binary-files-text-files-and-file-encodings/}{Binary +\begin{information} +See \blog{binary-files-text-files-and-file-encodings/}{Binary Files, Text Files and File Encodings} if you are confused about how -file encodings such as UTF-8 relate to text files.) +file encodings, such as \gls{utf8}, relate to text files. +\end{information} + +This section only applies to rollback or the use of \gls{mfugrabfirstuc} +(implemented via the \opt{grabfirst} option). -The \cs{makefirstuc} command works by utilizing the fact that, in +Prior to version 2.08, the case-change applied by the +\gls{glsmakefirstuc} command worked 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} +can do, say, \code{\cmd{frac}12} instead of +\code{\cmd{frac}\marg{1}\marg{2}} or \code{x\char`\^2} +instead of \code{x\char`\^\marg{2}}, although this +practice is discouraged by some.) + +A~simplistic version of the original \gls{glsmakefirstuc} command is: +\begin{codebox} +\cmd{newcommand}*\marg{\cmd{FirstUC}}[1]\marg{\gls{MakeUppercase} \#1} +\end{codebox} Here -\begin{verbatim} -\FirstUC{abc} -\end{verbatim} +\begin{codebox} +\cmd{FirstUC}\marg{abc} +\end{codebox} 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} -Over recent years the \LaTeX\ kernel has changed to allow the use of -UTF-8 characters within labels but the fundamental problem of each -octet been viewed as a separated token remains. - -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}. - -Version 2.24 of \sty{datatool-base} added the -command \cs{dtl@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 +\begin{codebox} +\gls{MakeUppercase} abc +\end{codebox} +and since \gls{MakeUppercase} requires an argument, it grabs the +first token (the character \qt{a} in this case) and uses that as the +argument so that the result is \qt{Abc}. This behaviour can be +achieved with \gls{mfugrabfirstuc}. + +Unfortunately, this will fail if the content starts with a \gls{utf8} +character and you are using \pdfLaTeX, where each octet of the +\gls{utf8} character is a separate token. This isn't a problem +with \XeLaTeX\ and \LuaLaTeX\ which both treat the entire multibyte +character as a single token. + +\LaTeX3 now provides \gls{texttitlecasefirst:n} +to convert the first character to uppercase, so now the +case-change can be applied with: +\begin{codebox} +\cmd{ExplSyntaxOn} +\gls{texttitlecasefirst:n}\marg{élite} +\cmd{ExplSyntaxOff} +\end{codebox} +This is exactly what \gls{MFUsentencecase} does without the need to +switch on \LaTeX3 syntax. The difference with the default definition +of \gls{glsmakefirstuc} is that it prevents its argument from being +expanded. + +\backmatter +\printterms +\printsummary +\printuserguideindex + \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 differindex 4433af0c329..ff8780d555d 100644 --- a/Master/texmf-dist/doc/latex/mfirstuc/sample-mfirstuc.pdf +++ 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 index 7438c770cc9..3e7f74fe755 100644 --- a/Master/texmf-dist/doc/latex/mfirstuc/sample-mfirstuc.tex +++ b/Master/texmf-dist/doc/latex/mfirstuc/sample-mfirstuc.tex @@ -17,7 +17,32 @@ \tableofcontents -\section{First Letter Upper Case} +\section{Sentence Case (First Letter Upper Case)} +\label{sec:sentencecase} + +\verb|\MFUsentencecase{abc}.| +\MFUsentencecase{abc}. + +\verb|\MFUsentencecase{{\em abc}}.| +\MFUsentencecase{{\em abc}}. + +\verb|\MFUsentencecase{\emph{abc}}.| +\MFUsentencecase{\emph{abc}}. + +\verb|\MFUsentencecase{\ae bc}.| +\MFUsentencecase{\ae bc}. + +\verb|\MFUsentencecase{{\ae}bc}.| +\MFUsentencecase{{\ae}bc}. + +\verb|\newcommand{\abc}{abc}\MFUsentencecase{\abc}.| +\newcommand{\abc}{abc}% +\MFUsentencecase{\abc}. + +\verb|\MFUsentencecase{\ref{sec:sentencecase}bc}.| +\MFUsentencecase{\ref{sec:sentencecase}bc}. + +\verb|\makefirstuc| doesn't expand its argument and skips exclusions. \verb|\makefirstuc{abc}.| \makefirstuc{abc}. @@ -28,28 +53,29 @@ \verb|\makefirstuc{\emph{abc}}.| \makefirstuc{\emph{abc}}. -\verb|\makefirstuc{\ae bc}.| -\makefirstuc{\ae bc}. +\verb|\makefirstuc{\ref{sec:sentencecase}bc}.| +\makefirstuc{\ref{sec:sentencecase}bc}. -\verb|\makefirstuc{{\ae}bc}.| -\makefirstuc{{\ae}bc}. +\newcommand{\strong}[1]{\textcolor{red}{#1}} +\verb|\makefirstuc{\strong{abc}d}| +\makefirstuc{\strong{abc}d} -\verb|\newcommand{\abc}{abc}\xmakefirstuc{\abc}.| -\newcommand{\abc}{abc}% -\xmakefirstuc{\abc}. +\verb|\makefirstuc{\protect\strong{abc}d}| +\makefirstuc{\protect\strong{abc}d} + +Exclusions vs blockers: -\newcommand*{\mytext}{\protect\textbf{some text}} -Protected formatting: \xmakefirstuc{\mytext}. +\verb|\MFUsentencecase{\NoCaseChange{abc} xyz}| +\MFUsentencecase{\NoCaseChange{abc} xyz} -\renewcommand*{\mytext}{\ae\oe{some text}} -Sequential commands: \xmakefirstuc{\mytext}. +\verb|\makefirstuc{\NoCaseChange{abc} xyz}| +\makefirstuc{\NoCaseChange{abc} xyz} -\verb|\makefirstuc{\MFUskippunc{?`}c\'omo est\'as?}| -\makefirstuc{\MFUskippunc{?`}c\'omo est\'as?} +\begingroup +\verb|\MFUblocker{\NoCaseChange}\makefirstuc{\NoCaseChange{abc} xyz}| +\MFUblocker{\NoCaseChange}\makefirstuc{\NoCaseChange{abc} xyz} -\renewcommand{\mytext}{\MFUskippunc{?`}c\'omo est\'as?} -Fully expanded: -\emakefirstuc{\mytext} +\endgroup \section{Title Case (No Formatting Commands)} diff --git a/Master/texmf-dist/scripts/mfirstuc/mfirstuc.perl b/Master/texmf-dist/scripts/mfirstuc/mfirstuc.l2h index 7ab863d06f4..1115dfcbf13 100644 --- a/Master/texmf-dist/scripts/mfirstuc/mfirstuc.perl +++ b/Master/texmf-dist/scripts/mfirstuc/mfirstuc.l2h @@ -1,12 +1,20 @@ -# File : mfirstuc.perl +# File : mfirstuc.l2h # Author : Nicola L. C. Talbot -# Date : 2012-09-21 -# Version : 1.0 +# Version : 2.08 (2022-10-14) # Description : LaTeX2HTML (limited!) implementation of mfirstuc package # This is a LaTeX2HTML style implementing the mfirstuc package, and -# is distributed as part of the glossaries package. -# Copyright 2007 Nicola L.C. Talbot +# was distributed as part of the glossaries package, but is now +# distributed as part of the mfirstuc package. There's no guarantee +# that it still works with new versions of LaTeX2HTML. +# +# v2.08: +# - The version number has been updated +# - file extension changed from .perl to .l2h to more easily identify it as a +# LaTeX2HTML file rather than a standalone Perl script. +# - Added MFUsentencecase but it's identical to makefirstuc +# +# Copyright 2007-2022 Nicola L.C. Talbot # This work may be distributed and/or modified under the # conditions of the LaTeX Project Public License, either version 1.3 # of this license of (at your option) any later version. @@ -34,6 +42,17 @@ sub do_cmd_makefirstuc{ &translate_commands("\\glsmakefirstuc $text") . $_; } +sub do_cmd_MFUsentencecase{ + local($_) = @_; + + local($id,$text); + + $text = &missing_braces unless + s/$next_pair_pr_rx/$id=$1;$text=$2;''/eo; + + &translate_commands("\\glsmakefirstuc $text") . $_; +} + sub do_cmd_xmakefirstuc{ local($_) = @_; diff --git a/Master/texmf-dist/source/latex/mfirstuc/mfirstuc.dtx b/Master/texmf-dist/source/latex/mfirstuc/mfirstuc.dtx index 2aa2008f415..a88c20e131d 100644 --- a/Master/texmf-dist/source/latex/mfirstuc/mfirstuc.dtx +++ b/Master/texmf-dist/source/latex/mfirstuc/mfirstuc.dtx @@ -1,21 +1,22 @@ %\iffalse % mfirstuc.dtx generated using makedtx version 1.2 (c) Nicola Talbot % Command line args: -% -setambles ".*\.perl=>\nopreamble\nopostamble" -% -setambles ".*\.tex=>\nopreamble\nopostamble" +% -macrocode ".*\.l2h" +% -macrocode ".*\.tex" +% -comment ".*\.l2h" +% -comment ".*\.tex" +% -codetitle "Main Package Code" +% -doc "mfirstuc-codedoc.tex" % -author "Nicola Talbot" % -src "mfirstuc.sty\Z=>mfirstuc.sty" % -src "mfirstuc-english.sty\Z=>mfirstuc-english.sty" +% -src "(mfirstuc-[0-9]+-[0-9]+-[0-9]+.sty)\Z=>\1" % -src "(sample.*\.tex)\Z=>\1" -% -src "(.*\.perl)\Z=>\1" -% -macrocode ".*\.perl" -% -macrocode ".*\.tex" -% -codetitle "Main Package Code" -% -doc "mfirstuc-codedoc.tex" -% -comment ".*\.perl" -% -comment ".*\.tex" +% -src "(.*\.l2h)\Z=>\1" +% -setambles ".*\.l2h=>\nopreamble\nopostamble" +% -setambles ".*\.tex=>\nopreamble\nopostamble" % mfirstuc -% Created on 2021/10/15 17:46 +% Created on 2022/10/18 9:21 %\fi %\iffalse %<*package> @@ -38,66 +39,70 @@ %\fi % \iffalse % Doc-Source file to use with LaTeX2e -% Copyright (C) 2021 Nicola Talbot, all rights reserved. +% Copyright (C) 2022 Nicola Talbot, all rights reserved. % \fi % \iffalse %<*driver> -\documentclass{nlctdoc} - \iffalse mfirstuc-codedoc.tex is a stub file used by makedtx to create mfirstuc.dtx \fi -\usepackage[utf8]{inputenc} -\usepackage[T1]{fontenc} -\usepackage[colorlinks, - bookmarks, - hyperindex=false, - pdfauthor={Nicola L.C. Talbot}, - pdftitle={mfirstuc.sty: Documented code}]{hyperref} +\documentclass{article} +\usepackage{doc} + +\CheckSum{1753} \RecordChanges +\PageIndex +\SetupDoc{reportchangedates} +\setcounter{IndexColumns}{2} -\renewcommand*{\main}[1]{\hyperpage{#1}} +\usepackage[T1]{fontenc} +\usepackage{tcolorbox} -\setcounter{IndexColumns}{2} -\setlength\IndexMin{100pt} +\definecolor{defbackground}{rgb}{1,1,0.75} -\CheckSum{771} +\newtcolorbox{definition}{halign=flush left, + colframe=black,colback=defbackground, + fontupper=\ttfamily, + before upper={\frenchspacing\obeylines}, + after={\par\noindent\ignorespacesafterend} +} + +\NewDocElement{Option}{option} + +\providecommand{\sty}[1]{\textsf{#1}} + +\providecommand\marg[1]{% + \texorpdfstring{\allowbreak{\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}} + {\{#1\}}} +\providecommand\oarg[1]{% + \texorpdfstring{\allowbreak{\ttfamily[}\meta{#1}{\ttfamily]}} + {[#1]}} \begin{document} \DocInput{mfirstuc.dtx} \end{document} %</driver> %\fi -%\MakeShortVerb{"} -%\DeleteShortVerb{\|} % -% \title{Documented Code For mfirstuc v2.07} +% \title{Documented Code For mfirstuc v2.08} % \author{Nicola L.C. Talbot\\[10pt] %Dickimaw Books\\ %\url{http://www.dickimaw-books.com/}} % -% \date{2021-10-15} +% \date{2022-10-14} % \maketitle % %\tableofcontents % %\section{Introduction} % -%This is the documented code for the \styfmt{mfirstuc} package. +%This is the documented code for the \sty{mfirstuc} package. %See \texttt{mfirstuc-manual.pdf} for the main user guide. % -% -%\StopEventually{% -% \phantomsection -% \addcontentsline{toc}{section}{Change History}% -% \raggedright -% \PrintChanges -% \PrintIndex -%} -% +%\StopEventually{\clearpage\PrintChanges \clearpage\PrintIndex} % % %\section{Main Package Code} @@ -106,321 +111,390 @@ mfirstuc.dtx %<*mfirstuc.sty> % \end{macrocode} %\fi -%\subsection{Mfirstuc Documented Code} +%\section{Mfirstuc Documented Code} %\label{sec:code:mfirstuc} %\changes{2.0}{2015/09/09}{package split from glossaries} % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mfirstuc}[2021/10/15 v2.07 (NLCT)] +% \end{macrocode} +% Rollback releases: +% \begin{macrocode} +\DeclareRelease{v2.07}{2021-10-15}{mfirstuc-2021-10-15.sty} +\DeclareCurrentRelease{v2.08}{2022-10-14} +% \end{macrocode} +% Declare package: +% \begin{macrocode} +\ProvidesPackage{mfirstuc}[2022/10/14 v2.08 (NLCT)] % \end{macrocode} % Requires \sty{etoolbox}:\changes{1.06}{2012/05/21}{now requires % etoolbox} % \begin{macrocode} \RequirePackage{etoolbox} % \end{macrocode} -%\begin{macro}{\makefirstuc} -% Syntax: -%\begin{definition} -% \cs{makefirstuc}\marg{text} -%\end{definition} -% Makes the first letter uppercase, but will -% skip initial control sequences if they are followed by a group -% and make the first thing in the group uppercase, unless the group -% is empty. -% Thus \verb|\makefirstuc{abc}| will produce: Abc, -% \verb|\makefirstuc{\ae bc}| will produce: \AE bc, but -% \verb|\makefirstuc{\emph{abc}}| will produce \emph{Abc}. -% This is required by \ics{Gls} and \ics{Glspl}. -%\changes{1.08}{2013-11-04}{made robust} +%Version 2.07 has switched to LaTeX3 for the actual case-changing. +%The original \cs{makefirstuc} has been reimplemented to use LaTeX3 +%code. There is also a new command \cs{MFUsentencecase} which just +%uses \cs{text\_titlecase\_first:n}. Note that \cs{MFUsentencecase} is +%internally used by \cs{glsmakefirstuc}, which in turn is used by +%\cs{makefirstuc} to perform the actual case-change. +% +%\begin{macro}{\glsmakefirstuc} +%\changes{1.05}{2011/04/02}{new} +% Provide a user command to make it easier to customise. This is +% used internally by \cs{makefirstuc}. (The original commands +% provided by \sty{mfirstuc} were part of the \sty{glossaries} +% package, hence the ``gls'' prefix.) % \begin{macrocode} -\newif\if@glscs -\newtoks\@glsmfirst -\newtoks\@glsmrest -\newrobustcmd*{\makefirstuc}[1]{% +\newcommand*{\glsmakefirstuc}[1]{\MFUsentencecase{\unexpanded{#1}}} % \end{macrocode} -% Check if argument starts with \cs{protect} which needs to be -% skipped. -%\changes{2.01}{2015-12-08}{added check for \cs{protect}} +%\end{macro} +% +%\begin{macro}{\mfirstucMakeUppercase} +% This was originally provided to allow user to replace +%\cs{MakeUppercase} with another case-changing command. +% This is now only used with \cs{mfugrabfirstuc}. % \begin{macrocode} - \@MFU@p@makefirstuc#1\relax\relax\relax\@end@MFU@protected{#1}% -} +\ExplSyntaxOn +\newcommand*{\mfirstucMakeUppercase}[1]{\text_uppercase:n{#1}} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@MFU@protect} -%\changes{2.03}{2016-07-29}{new} +%\begin{option}{expanded} +%\changes{2.08}{2022-10-14}{new} +%Allow argument to expand. +%This also resets the definition of \cs{mfirstucMakeUppercase} +%in case it was changed by grabfirst. +% \begin{macrocode} +\DeclareOption{expanded}{% + \renewcommand*{\glsmakefirstuc}[1]{\MFUsentencecase{#1}}% + \renewcommand*{\mfirstucMakeUppercase}[1]{\text_uppercase:n{#1}}% +} +% \end{macrocode} +%\end{option} +% +%\begin{option}{unexpanded} +%\changes{2.08}{2022-10-14}{new} +%Prevent argument of \cs{glsmakefirstuc} from expanding. +%This also resets the definition of \cs{mfirstucMakeUppercase} +%in case it was changed by grabfirst, but note that it doesn't use +%\cs{unexpanded}. +% \begin{macrocode} +\DeclareOption{unexpanded}{% + \renewcommand*{\glsmakefirstuc}[1]{\MFUsentencecase{\unexpanded{#1}}}% + \renewcommand*{\mfirstucMakeUppercase}[1]{\text_uppercase:n{#1}}% +} +\ExplSyntaxOff +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\mfugrabfirstuc} +%\changes{2.08}{2022-10-14}{new} +%Used by the grabfirst option to emulate v2.07. % \begin{macrocode} -\newcommand*{\@MFU@protect}{\protect} +\newrobustcmd*{\mfugrabfirstuc}[1]{\@mfu@grabfirstuc#1\empty} % \end{macrocode} %\end{macro} % -%\begin{macro}{\@MFU@skippunc} -%\changes{2.07}{2021-10-15}{new} +%\begin{macro}{\@mfu@grabfirstuc} +%\changes{2.08}{2022-10-14}{new} % \begin{macrocode} -\newcommand*{\@MFU@skippunc}{\MFUskippunc} +\newcommand*{\@mfu@grabfirstuc}[2]{\mfirstucMakeUppercase{#1}#2} % \end{macrocode} %\end{macro} % -%\begin{macro}{\MFUskippunc} -%\changes{2.07}{2021-10-15}{new} +%\begin{option}{grabfirst} +%\changes{2.08}{2022-10-14}{new} +%Emulate v2.07 method. % \begin{macrocode} -\newrobustcmd*{\MFUskippunc}[1]{#1} +\DeclareOption{grabfirst}{% + \renewcommand*{\glsmakefirstuc}[1]{\mfugrabfirstuc{#1}}% + \renewcommand*{\mfirstucMakeUppercase}[1]{\MakeUppercase{#1}}% +} % \end{macrocode} -%\end{macro} +%\end{option} % -%\begin{macro}{\@MFU@p@makefirstuc} -% Internal command to do the required action. +%Process options. % \begin{macrocode} -\def\@MFU@p@makefirstuc#1#2#3\@end@MFU@protected#4{% +\ProcessOptions % \end{macrocode} -%\changes{2.03}{2016-07-29}{changed test} -%Test if the first argument is \cs{protect}. +% +%There are differences between \cs{makefirstuc} and +%\cs{MFUsentencecase}, the principle ones being expansion occurs differently and +%\cs{makefirstuc} stops at exclusions whereas +%\cs{MFUsentencecase} skips them. % \begin{macrocode} - \def\gls@argi{#1}% - \ifx\gls@argi\@MFU@protect - \@makefirstuc{#2#3}% - \else +\ExplSyntaxOn % \end{macrocode} -% v2.07+ also check for \cs{MFUskippunc} -%\changes{2.07}{2021-10-15}{check for \cs{MFUskippunc}} +%\begin{macro}{\MFUsentencecase} +%\changes{2.08}{2022-10-14}{new} +%New command provided that simply uses LaTeX3, which expands the +%content. This may be preferred over \cs{makefirstuc} depending on +%the content. % \begin{macrocode} - \ifx\gls@argi\@MFU@skippunc - #2\@makefirstuc{#3}% - \else - \@makefirstuc{#4}% - \fi - \fi +\newcommand{\MFUsentencecase}[1]{\text_titlecase_first:n{#1}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\MFUexcl} +%\changes{2.08}{2022-10-14}{new} +%Add a command to the exclusion list. This is used by +%\cs{text\_titlecase\_first:n} +%to skip commands that shouldn't have their argument changed (such +%as \cs{ref}). It's also used by \cs{makefirstuc}. +% \begin{macrocode} +\newcommand{\MFUexcl}[1]{ + \tl_if_empty:nF { #1 } + { + \tl_if_in:NnF \l_text_case_exclude_arg_tl {#1} + { + \tl_put_right:Nn \l_text_case_exclude_arg_tl {#1} + } + } } % \end{macrocode} %\end{macro} -% -%\begin{macro}{\@makefirstuc} -% Internal command to do the required action. +%Add \cs{ensuremath} as an exclusion otherwise \cs{makefirstuc} +%will try passing its argument to \cs{MFUsentencecase}, which will +%fail. % \begin{macrocode} -\newcommand*{\@makefirstuc}[1]{% - \def\gls@argi{#1}% - \ifx\gls@argi\@empty +\MFUexcl{\ensuremath} % \end{macrocode} -% If the argument is empty, do nothing. +% +%Test if the given command is in the exclusion list. % \begin{macrocode} - \else +\cs_new:Npn \mfirstuc_if_excluded:NTF #1 #2 #3 + { + \tl_if_in:NnTF \l_text_case_exclude_arg_tl {#1} {#2} {#3} + } % \end{macrocode} -%\changes{1.03}{2008/12/22}{changed \cs{protected@edef} to \cs{def}} +%Provide an implementation of \cs{makefirstuc} that matches +%older versions as much as possible. % \begin{macrocode} - \def\@gls@tmp{\ #1}% - \@onelevel@sanitize\@gls@tmp - \expandafter\@gls@checkcs\@gls@tmp\relax\relax - \if@glscs +\tl_new:N \l__mfirstuc_stack_tl +\tl_new:N \l__mfirstuc_head_tl +\tl_new:N \l__mfirstuc_next_tl % \end{macrocode} -% Check if we have two sequential control sequences. -%\changes{2.0}{2015/09/09}{added check for two control sequences} +%In addition to exclusions, also provide blockers. These are only +%supported by \cs{makefirstuc}. Exclusions and +%their argument are skipped, whereas blockers prevent case-change. +%For example, sentence-casing \verb|\label{ex}some text| should skip +%\verb|\label{ex}|, whereas \verb|\nameref{ex} some text| shouldn't +%have any case change applied. % \begin{macrocode} - \expandafter\def\expandafter\@gls@tmp\expandafter{\expandafter - \ \@gobble #1}% - \@onelevel@sanitize\@gls@tmp - \expandafter\@gls@checkcs\@gls@tmp\relax\relax - \if@glscs\@glscsfalse\else\@glscstrue\fi - \fi - \if@glscs - \@gls@getbody #1{}\@nil - \ifx\@gls@rest\@empty - \glsmakefirstuc{#1}% - \else - \expandafter\@gls@split\@gls@rest\@nil - \ifx\@gls@first\@empty - \glsmakefirstuc{#1}% - \else +\tl_new:N \l__mfirstuc_blocker_tl % \end{macrocode} -%\changes{2.06}{2017-11-14}{check for inner control sequence} -%Does \cs{@gls@first} start with a control sequence? -% \begin{macrocode} - \edef\@gls@tmp\expandafter{\noexpand\ \expandonce\@gls@first}% - \@onelevel@sanitize\@gls@tmp - \expandafter\@gls@checkcs\@gls@tmp\relax\relax - \if@glscs - \edef\@gls@domfirstuc{\expandonce\@gls@body - {\noexpand\makefirstuc{\expandonce\@gls@first - \expandonce\@gls@rest}% - }% - }% - \else - \expandafter\@glsmfirst\expandafter{\@gls@first}% - \expandafter\@glsmrest\expandafter{\@gls@rest}% -% \end{macrocode} -%\changes{2.06}{2017-11-14}{added braces to \cs{glsmakefirstuc} argument} -% \begin{macrocode} - \edef\@gls@domfirstuc{\noexpand\@gls@body - {\noexpand\glsmakefirstuc{\the\@glsmfirst}}% - \the\@glsmrest}% - \fi - \@gls@domfirstuc - \fi - \fi - \else - \glsmakefirstuc{#1}% - \fi - \fi +% +%\begin{macro}{\MFUblocker} +%\changes{2.08}{2022-10-14}{new} +%Add a command to the blocker list. +% \begin{macrocode} +\newcommand{\MFUblocker}[1]{ + \tl_if_empty:nF { #1 } + { + \tl_if_in:NnF \l__mfirstuc_blocker_tl {#1} + { + \tl_put_right:Nn \l__mfirstuc_blocker_tl {#1} + } + \MFUexcl { #1 } + } } % \end{macrocode} %\end{macro} -%\begin{macro}{\@gls@split} -% Put first argument in \cs{@gls@first} and second argument in -% \cs{@gls@rest}: -%\changes{2.03}{2016-07-29}{added check for datatool-base UTF-8 support} +%Test if the given command is in the blocker list. % \begin{macrocode} -\ifdef\dtl@getfirst@UTFviii -{% - \def\@gls@split#1#2\@nil{% - \ifbool{@dtl@utf8} - {% - \expandafter\dtl@if@two@octets#1#2\relax\dtl@end@if@two@octets - {% - \dtl@getfirst@UTFviii#1#2\@nil\end@dtl@getfirst@UTFviii - \let\@gls@first\dtl@first - \let\@gls@rest\dtl@rest - }% - {% - \def\@gls@first{#1}\def\@gls@rest{#2}% - }% - }% - {% +\cs_new:Npn \tl_if_mfirstuc_blocker:nTF #1 #2 #3 + { + \tl_if_in:NnTF \l__mfirstuc_blocker_tl {#1} {#2} {#3} + } % \end{macrocode} -%\changes{2.04}{2016-07-31}{added missing false part} +%Is there a way to do this without \cs{expandafter}? % \begin{macrocode} - \def\@gls@first{#1}\def\@gls@rest{#2}% - }% - } -}% -{% - \def\@gls@split#1#2\@nil{% - \def\@gls@first{#1}\def\@gls@rest{#2}% +\cs_new:Npn \tl_if_mfirstuc_blocker:VTF #1 #2 #3 + { + \expandafter \tl_if_mfirstuc_blocker:nTF \expandafter {#1} {#2} {#3} + } +% \end{macrocode} +% +%\begin{macro}{\makefirstuc} +%\begin{definition} +% \cs{makefirstuc}\marg{text} +%\end{definition} +%\changes{1.08}{2013-11-04}{made robust} +%\changes{2.08}{2022-10-14}{reimplement using \LaTeX3} +% \begin{macrocode} +\newrobustcmd{\makefirstuc}[1]{% + \tl_set:Nn \l__mfirstuc_stack_tl {#1} + \tl_if_empty:NF \l__mfirstuc_stack_tl + { + \tl_if_single:NTF \l__mfirstuc_stack_tl + { + \glsmakefirstuc{#1} + } + { + \tl_if_head_is_group:nTF {#1} + { + \glsmakefirstuc{#1} + } + { + \tl_if_head_eq_catcode:nNTF {#1} \relax + { + \tl_set:NV \l_tmpa_tl \l__mfirstuc_stack_tl + \tl_set:Nx \l__mfirstuc_head_tl { \tl_head:V \l_tmpa_tl } + \tl_set:Nx \l__mfirstuc_stack_tl { \tl_tail:N \l__mfirstuc_stack_tl } + \tl_if_eq:NnTF \l__mfirstuc_head_tl { \protect } + { + \tl_set:NV \l_tmpa_tl \l__mfirstuc_stack_tl + \tl_set:Nx \l__mfirstuc_head_tl { \tl_head:V \l_tmpa_tl } + \tl_set:Nx \l__mfirstuc_stack_tl { \tl_tail:N \l__mfirstuc_stack_tl } + } + {} + \tl_if_mfirstuc_blocker:VTF \l__mfirstuc_head_tl + { #1 } + { + \let \l_tmpa_tl \l__mfirstuc_stack_tl + \tl_set:Nx \l__mfirstuc_next_tl { \tl_head:N \l_tmpa_tl } + \tl_if_single:NTF \l__mfirstuc_next_tl + { + \glsmakefirstuc{#1} + } + { + \tl_set:Nx \l__mfirstuc_stack_tl { \tl_tail:N \l__mfirstuc_stack_tl } + \tl_clear:N \l_tmpa_tl + \tl_put_right:Nn \l_tmpa_tl { \__mfirstuc_inner:nnn } + \tl_put_right:NV \l_tmpa_tl \l__mfirstuc_head_tl + \tl_put_right:Nx \l_tmpa_tl + { + { \expandonce \l__mfirstuc_next_tl } + { \expandonce \l__mfirstuc_stack_tl } + } + \tl_use:N \l_tmpa_tl + } + } + } + { + \glsmakefirstuc{#1} + } + } + } } } % \end{macrocode} %\end{macro} +% % \begin{macrocode} -\def\@gls@checkcs#1 #2#3\relax{% - \def\@gls@argi{#1}\def\@gls@argii{#2}% - \ifx\@gls@argi\@gls@argii - \@glscstrue - \else - \@glscsfalse - \fi -} -% \end{macrocode} -% 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@applytofirst} -%\changes{2.03}{2016-07-29}{new} -% \begin{macrocode} -\ifdef\dtl@getfirst@UTFviii -{% - \def\@mfu@applytofirst#1#2\@mfu@end@applytofirst#3{% - \expandafter\dtl@if@two@octets#1#2\relax\dtl@end@if@two@octets - {% - \dtl@getfirst@UTFviii#1#2\@nil\end@dtl@getfirst@UTFviii - \expandafter#3\expandafter{\dtl@first}\dtl@rest - }% - {% +\cs_new_protected:Npn \__mfirstuc_inner:nnn #1 #2 #3 + { % \end{macrocode} -%First argument needs to be grouped in case it consists of more than -%one token. -%\changes{2.05}{2017-11-10}{grouped first argument} +% Mappings trump exclusions. % \begin{macrocode} - #3{#1}#2% - }% - }% -}% -{% + \mfirstuc_get_map:NN #1 \l_tmpb_tl + \quark_if_no_value:NTF \l_tmpb_tl + { + \mfirstuc_if_excluded:NTF #1 + { #1{#2}\makefirstuc{#3} } + { #1{\makefirstuc{#2}}#3 } + } + { + \l_tmpb_tl {#2} #3 + } + } % \end{macrocode} -%First argument needs to be grouped in case it consists of more than -%one token. -%\changes{2.05}{2017-11-10}{grouped first argument} +%Mappings. % \begin{macrocode} - \def\@mfu@applytofirst#1#2\@mfu@end@applytofirst#3{#3{#1}#2} -} +\prop_new:N \l__mfirstuc_mappings_prop % \end{macrocode} -%\end{macro} -% -%\begin{macro}{\MFUapplytofirst} -%\changes{2.03}{2016-07-29}{new} -%\begin{definition} -%\cs{MFUapplytofirst}\marg{cs}\marg{text} -%\end{definition} -% Apply \meta{cs} to first token of text, or first UTF-8 character -% if \sty{datatool-base} v2.24 above has been loaded with the utf8 -% support enabled. +%\begin{macro}{\MFUaddmap} +%\changes{2.08}{2022-10-14}{new} +%Adds a mapping from a control sequence to the appropriate sentence +%case version. No map is added if either argument is empty. % \begin{macrocode} -\ifdef\dtl@getfirst@UTFviii -{% - \newcommand*{\MFUapplytofirst}[2]{% - \ifbool{@dtl@utf8} - {% - \ifblank{#2}% - {#1{#2}}% - {% - \ifblank{#1}% - {#1#2}% - {% - \@mfu@applytofirst#2\@mfu@end@applytofirst#1\relax - }% - }% - }% - {% - #1#2% - }% +\newrobustcmd*{\MFUaddmap}[2]{% + \tl_if_empty:nF { #1 } + { + \tl_if_empty:nF { #2 } + { + \prop_put:Nnn \l__mfirstuc_mappings_prop {#1} {#2} + } } -}% -{% - \newcommand*{\MFUapplytofirst}[2]{#1#2} + \MFUexcl { #1 } + \MFUblocker { #2 } } % \end{macrocode} %\end{macro} -% -%\begin{macro}{\@gls@makefirstuc} -% Make first thing upper case: % \begin{macrocode} -\def\@gls@makefirstuc#1{\MFUapplytofirst\mfirstucMakeUppercase{#1}} +\cs_new:Npn \mfirstuc_get_map:NN #1 #2 + { + \prop_get:NnN \l__mfirstuc_mappings_prop {#1} #2 + } % \end{macrocode} -%\end{macro} -% -%\begin{macro}{\mfirstucMakeUppercase} -% Allow user to replace \cs{MakeUppercase} with another case -% changing command. +%\begin{macro}{\MFUsaveatend} +%\changes{2.08}{2022-10-14}{new} +%Save exclusions, blockers and mappings in the aux file, if required +%by some external tool, but delays action to the end of the document. % \begin{macrocode} -\newcommand*{\mfirstucMakeUppercase}{\MakeUppercase} +\newcommand{\MFUsaveatend}{ + \AtEndDocument { \@MFUsavetoaux } % \end{macrocode} -%\end{macro} -%\begin{macro}{\glsmakefirstuc} -%\changes{1.05}{2011/04/02}{new} -% Provide a user command to make it easier to customise. +%Disable this command. % \begin{macrocode} -\newcommand*{\glsmakefirstuc}[1]{\@gls@makefirstuc{#1}} + \let\MFUsaveatend\relax +} % \end{macrocode} %\end{macro} -% -% Get the first grouped argument and store in \cs{@gls@body}. +%\begin{macro}{\MFUsave} +%\changes{2.08}{2022-10-14}{new} +%As above but do now. % \begin{macrocode} -\def\@gls@getbody#1#{\def\@gls@body{#1}\@gls@gobbletonil} +\newcommand{\MFUsave}{ + \@MFUsavetoaux % \end{macrocode} -% Scoup up everything to \cs{@nil} and store in \cs{@gls@rest}: +%Disable further attempts. % \begin{macrocode} -\def\@gls@gobbletonil#1\@nil{\def\@gls@rest{#1}} + \let\@MFUsavetoaux\relax + \let\MFUsave\relax + \let\MFUsaveatend\relax +} % \end{macrocode} -% -%\begin{macro}{\xmakefirstuc} -% Expand argument once before applying \cs{makefirstuc} -% (added v1.01). -% \begin{macrocode} -\newcommand*{\xmakefirstuc}[1]{% - \expandafter\makefirstuc\expandafter{#1}% +%\end{macro} +%\begin{macro}{\@MFUsavetoaux} +%\changes{2.08}{2022-10-14}{new} +%Save exclusions, blockers and mappings in the aux file, if required +%by some external tool. +% \begin{macrocode} +\newcommand{\@MFUsavetoaux}{ + \protected@write\@auxout{} + { \tl_to_str:n { \providecommand{\@mfu@excls}[1]{} } } + \protected@write\@auxout{} + { \tl_to_str:n { \providecommand{\@mfu@blockers}[1]{} } } + \protected@write\@auxout{} + { \tl_to_str:n { \providecommand{\@mfu@mappings}[1]{} } } +% \end{macrocode} +%Save current values. +% \begin{macrocode} + \protected@write\@auxout{} + { + \string\@mfu@excls { \tl_to_str:V \l_text_case_exclude_arg_tl } + } + \protected@write\@auxout{} + { + \string\@mfu@blockers { \tl_to_str:V \l__mfirstuc_blocker_tl } + } + \protected@write\@auxout{} + { + \string\@mfu@mappings + { \expandonce { \prop_to_keyval:N \l__mfirstuc_mappings_prop } } + } } % \end{macrocode} %\end{macro} +% \begin{macrocode} +\ExplSyntaxOff +% \end{macrocode} +%The remaining code hasn't been converted to LaTeX3 yet, but may in +%the future, so don't rely on internal commands. % %\begin{macro}{\emakefirstuc} %\changes{1.10}{2015/05/03}{new} -% Fully expand argument before applying \cs{makefirstuc} +% Fully expand argument before applying case-change. % \begin{macrocode} \newrobustcmd*{\emakefirstuc}[1]{% \protected@edef\@MFU@caparg{#1}% @@ -429,6 +503,33 @@ mfirstuc.dtx % \end{macrocode} %\end{macro} % +%\begin{macro}{\xmakefirstuc} +% \begin{macrocode} +\newcommand*{\xmakefirstuc}[1]{\expandafter\makefirstuc\expandafter{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\MFUskippunc} +%\changes{2.07}{2021-10-15}{new} +% \begin{macrocode} +\newrobustcmd*{\MFUskippunc}[1]{#1} +\MFUexcl{\MFUskippunc} +% \end{macrocode} +%\end{macro} +% +%Title case commands. Each word has the first letter converted to +%upper case using \cs{MFUcapwordfirstuc}. This uses \cs{makefirstuc} +%by default. It may be redefined to use \cs{MFUsentencecase} or +%\cs{text\_titlecase:n} as applicable. +%\begin{macro}{\MFUcapwordfirstuc} +%\changes{2.07}{2021-10-15}{new} +% \begin{macrocode} +\newcommand*{\MFUcapwordfirstuc}[1]{% + \makefirstuc{#1}% +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\capitalisewords} %\changes{1.06}{2012/05/21}{new} % Capitalise each word in the argument. Words are considered to be @@ -520,15 +621,6 @@ mfirstuc.dtx % \end{macrocode} %\end{macro} % -%\begin{macro}{\MFUcapwordfirstuc} -%\changes{2.07}{2021-10-15}{new} -% \begin{macrocode} -\newcommand*{\MFUcapwordfirstuc}[1]{% - \makefirstuc{#1}% -} -% \end{macrocode} -%\end{macro} -% %\begin{macro}{\MFUwordbreak} %\changes{2.07}{2021-10-15}{new} %Markup a character (or command) that should be treated as a word @@ -614,7 +706,7 @@ mfirstuc.dtx % %\begin{macro}{\mfu@checkword} % Check if word should be capitalised. -% This originally used \sty{etoolbox}'s \ics{ifinlist} command +% This originally used \sty{etoolbox}'s \cs{ifinlist} command % but this doesn't work if the word contains grouping. %\changes{1.09}{2017-07-30}{new} %\changes{2.02}{2015-12-17}{modified to use loop instead of \cs{ifinlist}} @@ -1051,6 +1143,278 @@ mfirstuc.dtx } % \end{macrocode} %\end{macro} +% +%The remaining code is redundant and will be removed in future. +% +%\begin{macro}{\@org@makefirstuc} +% This is the original definition of \cs{makefirstuc}. It will be +% removed in later versions. +% Syntax: +%\begin{definition} +% \cs{makefirstuc}\marg{text} +%\end{definition} +%\changes{1.08}{2013-11-04}{made robust} +%\changes{2.08}{2022-10-14}{updated to use \cs{MFUsentencecase}} +% \begin{macrocode} +\newif\if@glscs +\newtoks\@glsmfirst +\newtoks\@glsmrest +\newrobustcmd*{\@org@makefirstuc}[1]{% +% \end{macrocode} +% Check if argument starts with \cs{protect} which needs to be +% skipped. +%\changes{2.01}{2015-12-08}{added check for \cs{protect}} +% \begin{macrocode} + \@MFU@p@makefirstuc#1\relax\relax\relax\@end@MFU@protected{#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@MFU@protect} +%\changes{2.03}{2016-07-29}{new} +% \begin{macrocode} +\newcommand*{\@MFU@protect}{\protect} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@MFU@skippunc} +%\changes{2.07}{2021-10-15}{new} +% \begin{macrocode} +\newcommand*{\@MFU@skippunc}{\MFUskippunc} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@MFU@p@makefirstuc} +% Internal command to do the required action. +% \begin{macrocode} +\def\@MFU@p@makefirstuc#1#2#3\@end@MFU@protected#4{% +% \end{macrocode} +%\changes{2.03}{2016-07-29}{changed test} +%Test if the first argument is \cs{protect}. +% \begin{macrocode} + \def\gls@argi{#1}% + \ifx\gls@argi\@MFU@protect + \@makefirstuc{#2#3}% + \else +% \end{macrocode} +% v2.07+ also check for \cs{MFUskippunc} +%\changes{2.07}{2021-10-15}{check for \cs{MFUskippunc}} +% \begin{macrocode} + \ifx\gls@argi\@MFU@skippunc + #2\@makefirstuc{#3}% + \else + \@makefirstuc{#4}% + \fi + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@makefirstuc} +% Internal command to do the required action. +% \begin{macrocode} +\newcommand*{\@makefirstuc}[1]{% + \def\gls@argi{#1}% + \ifx\gls@argi\@empty +% \end{macrocode} +% If the argument is empty, do nothing. +% \begin{macrocode} + \else +% \end{macrocode} +%\changes{1.03}{2008/12/22}{changed \cs{protected@edef} to \cs{def}} +% \begin{macrocode} + \def\@gls@tmp{\ #1}% + \@onelevel@sanitize\@gls@tmp + \expandafter\@gls@checkcs\@gls@tmp\relax\relax + \if@glscs +% \end{macrocode} +% Check if we have two sequential control sequences. +%\changes{2.0}{2015/09/09}{added check for two control sequences} +% \begin{macrocode} + \expandafter\def\expandafter\@gls@tmp\expandafter{\expandafter + \ \@gobble #1}% + \@onelevel@sanitize\@gls@tmp + \expandafter\@gls@checkcs\@gls@tmp\relax\relax + \if@glscs\@glscsfalse\else\@glscstrue\fi + \fi + \if@glscs + \@gls@getbody #1{}\@nil + \ifx\@gls@rest\@empty + \glsmakefirstuc{#1}% + \else + \expandafter\@gls@split\@gls@rest\@nil + \ifx\@gls@first\@empty + \glsmakefirstuc{#1}% + \else +% \end{macrocode} +%\changes{2.06}{2017-11-14}{check for inner control sequence} +%Does \cs{@gls@first} start with a control sequence? +% \begin{macrocode} + \edef\@gls@tmp\expandafter{\noexpand\ \expandonce\@gls@first}% + \@onelevel@sanitize\@gls@tmp + \expandafter\@gls@checkcs\@gls@tmp\relax\relax + \if@glscs + \edef\@gls@domfirstuc{\expandonce\@gls@body + {\noexpand\makefirstuc{\expandonce\@gls@first + \expandonce\@gls@rest}% + }% + }% + \else + \expandafter\@glsmfirst\expandafter{\@gls@first}% + \expandafter\@glsmrest\expandafter{\@gls@rest}% +% \end{macrocode} +%\changes{2.06}{2017-11-14}{added braces to \cs{glsmakefirstuc} argument} +% \begin{macrocode} + \edef\@gls@domfirstuc{\noexpand\@gls@body + {\noexpand\glsmakefirstuc{\the\@glsmfirst}}% + \the\@glsmrest}% + \fi + \@gls@domfirstuc + \fi + \fi + \else + \glsmakefirstuc{#1}% + \fi + \fi +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@gls@split} +% Put first argument in \cs{@gls@first} and second argument in +% \cs{@gls@rest}: +%\changes{2.03}{2016-07-29}{added check for datatool-base UTF-8 support} +% \begin{macrocode} +\ifdef\dtl@getfirst@UTFviii +{% + \def\@gls@split#1#2\@nil{% + \ifbool{@dtl@utf8} + {% + \expandafter\dtl@if@two@octets#1#2\relax\dtl@end@if@two@octets + {% + \dtl@getfirst@UTFviii#1#2\@nil\end@dtl@getfirst@UTFviii + \let\@gls@first\dtl@first + \let\@gls@rest\dtl@rest + }% + {% + \def\@gls@first{#1}\def\@gls@rest{#2}% + }% + }% + {% +% \end{macrocode} +%\changes{2.04}{2016-07-31}{added missing false part} +% \begin{macrocode} + \def\@gls@first{#1}\def\@gls@rest{#2}% + }% + } +}% +{% + \def\@gls@split#1#2\@nil{% + \def\@gls@first{#1}\def\@gls@rest{#2}% + } +} +% \end{macrocode} +%\end{macro} +% \begin{macrocode} +\def\@gls@checkcs#1 #2#3\relax{% + \def\@gls@argi{#1}\def\@gls@argii{#2}% + \ifx\@gls@argi\@gls@argii + \@glscstrue + \else + \@glscsfalse + \fi +} +% \end{macrocode} +% 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@applytofirst} +%\changes{2.03}{2016-07-29}{new} +% \begin{macrocode} +\ifdef\dtl@getfirst@UTFviii +{% + \def\@mfu@applytofirst#1#2\@mfu@end@applytofirst#3{% + \expandafter\dtl@if@two@octets#1#2\relax\dtl@end@if@two@octets + {% + \dtl@getfirst@UTFviii#1#2\@nil\end@dtl@getfirst@UTFviii + \expandafter#3\expandafter{\dtl@first}\dtl@rest + }% + {% +% \end{macrocode} +%First argument needs to be grouped in case it consists of more than +%one token. +%\changes{2.05}{2017-11-10}{grouped first argument} +% \begin{macrocode} + #3{#1}#2% + }% + }% +}% +{% +% \end{macrocode} +%First argument needs to be grouped in case it consists of more than +%one token. +%\changes{2.05}{2017-11-10}{grouped first argument} +% \begin{macrocode} + \def\@mfu@applytofirst#1#2\@mfu@end@applytofirst#3{% + #3{#1}#2% + } +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\MFUapplytofirst} +%\changes{2.03}{2016-07-29}{new} +%\changes{2.08}{2022-10-14}{deprecated} +%\begin{definition} +%\cs{MFUapplytofirst}\marg{cs}\marg{text} +%\end{definition} +% Apply \meta{cs} to first token of text, or first UTF-8 character +% if \sty{datatool-base} v2.24 above has been loaded with the utf8 +% support enabled. Deprecated as from v2.08. +% \begin{macrocode} +\ifdef\dtl@getfirst@UTFviii +{% + \newcommand*{\MFUapplytofirst}[2]{% + \ifbool{@dtl@utf8} + {% + \ifblank{#2}% + {#1{#2}}% + {% + \ifblank{#1}% + {#1#2}% + {% + \@mfu@applytofirst#2\@mfu@end@applytofirst#1\relax + }% + }% + }% + {% + #1#2% + }% + } +}% +{% + \newcommand*{\MFUapplytofirst}[2]{% + #1#2% + } +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@makefirstuc} +%\changes{2.08}{2022-10-14}{updated to use \cs{MFUsentencecase}} +%Deprecated. +% \begin{macrocode} +\def\@gls@makefirstuc#1{\MFUsentencecase{#1}} +% \end{macrocode} +%\end{macro} +% +% Get the first grouped argument and store in \cs{@gls@body}. +% \begin{macrocode} +\def\@gls@getbody#1#{\def\@gls@body{#1}\@gls@gobbletonil} +% \end{macrocode} +% Scoup up everything to \cs{@nil} and store in \cs{@gls@rest}: +% \begin{macrocode} +\def\@gls@gobbletonil#1\@nil{\def\@gls@rest{#1}} +% \end{macrocode} +% %\iffalse % \begin{macrocode} %</mfirstuc.sty> @@ -1065,7 +1429,7 @@ mfirstuc.dtx %\label{sec:code:mfirstuc-english} % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mfirstuc-english}[2021/10/15 v2.07 (NLCT)] +\ProvidesPackage{mfirstuc-english}[2022/10/14 v2.08 (NLCT)] % \end{macrocode} % Load \sty{mfirstuc} if not already loaded: % \begin{macrocode} @@ -1098,6 +1462,464 @@ mfirstuc.dtx %\fi %\iffalse % \begin{macrocode} +%<*mfirstuc-2021-10-15.sty> +% \end{macrocode} +%\fi +% \section{Rollback v2.07 (mfirstuc-2021-10-15.sty)} +% Version 2.07 preserved for rollback. +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{mfirstuc}[2021/10/15 v2.07 (NLCT)] +\RequirePackage{etoolbox} +\newif\if@glscs +\newtoks\@glsmfirst +\newtoks\@glsmrest +\newrobustcmd*{\makefirstuc}[1]{% + \@MFU@p@makefirstuc#1\relax\relax\relax\@end@MFU@protected{#1}% +} +\newcommand*{\@MFU@protect}{\protect} +\newcommand*{\@MFU@skippunc}{\MFUskippunc} +\newrobustcmd*{\MFUskippunc}[1]{#1} +\def\@MFU@p@makefirstuc#1#2#3\@end@MFU@protected#4{% + \def\gls@argi{#1}% + \ifx\gls@argi\@MFU@protect + \@makefirstuc{#2#3}% + \else + \ifx\gls@argi\@MFU@skippunc + #2\@makefirstuc{#3}% + \else + \@makefirstuc{#4}% + \fi + \fi +} +\newcommand*{\@makefirstuc}[1]{% + \def\gls@argi{#1}% + \ifx\gls@argi\@empty + \else + \def\@gls@tmp{\ #1}% + \@onelevel@sanitize\@gls@tmp + \expandafter\@gls@checkcs\@gls@tmp\relax\relax + \if@glscs + \expandafter\def\expandafter\@gls@tmp\expandafter{\expandafter + \ \@gobble #1}% + \@onelevel@sanitize\@gls@tmp + \expandafter\@gls@checkcs\@gls@tmp\relax\relax + \if@glscs\@glscsfalse\else\@glscstrue\fi + \fi + \if@glscs + \@gls@getbody #1{}\@nil + \ifx\@gls@rest\@empty + \glsmakefirstuc{#1}% + \else + \expandafter\@gls@split\@gls@rest\@nil + \ifx\@gls@first\@empty + \glsmakefirstuc{#1}% + \else + \edef\@gls@tmp\expandafter{\noexpand\ \expandonce\@gls@first}% + \@onelevel@sanitize\@gls@tmp + \expandafter\@gls@checkcs\@gls@tmp\relax\relax + \if@glscs + \edef\@gls@domfirstuc{\expandonce\@gls@body + {\noexpand\makefirstuc{\expandonce\@gls@first + \expandonce\@gls@rest}% + }% + }% + \else + \expandafter\@glsmfirst\expandafter{\@gls@first}% + \expandafter\@glsmrest\expandafter{\@gls@rest}% + \edef\@gls@domfirstuc{\noexpand\@gls@body + {\noexpand\glsmakefirstuc{\the\@glsmfirst}}% + \the\@glsmrest}% + \fi + \@gls@domfirstuc + \fi + \fi + \else + \glsmakefirstuc{#1}% + \fi + \fi +} +\ifdef\dtl@getfirst@UTFviii +{% + \def\@gls@split#1#2\@nil{% + \ifbool{@dtl@utf8} + {% + \expandafter\dtl@if@two@octets#1#2\relax\dtl@end@if@two@octets + {% + \dtl@getfirst@UTFviii#1#2\@nil\end@dtl@getfirst@UTFviii + \let\@gls@first\dtl@first + \let\@gls@rest\dtl@rest + }% + {% + \def\@gls@first{#1}\def\@gls@rest{#2}% + }% + }% + {% + \def\@gls@first{#1}\def\@gls@rest{#2}% + }% + } +}% +{% + \def\@gls@split#1#2\@nil{% + \def\@gls@first{#1}\def\@gls@rest{#2}% + } +} +\def\@gls@checkcs#1 #2#3\relax{% + \def\@gls@argi{#1}\def\@gls@argii{#2}% + \ifx\@gls@argi\@gls@argii + \@glscstrue + \else + \@glscsfalse + \fi +} +\ifdef\dtl@getfirst@UTFviii +{% + \def\@mfu@applytofirst#1#2\@mfu@end@applytofirst#3{% + \expandafter\dtl@if@two@octets#1#2\relax\dtl@end@if@two@octets + {% + \dtl@getfirst@UTFviii#1#2\@nil\end@dtl@getfirst@UTFviii + \expandafter#3\expandafter{\dtl@first}\dtl@rest + }% + {% + #3{#1}#2% + }% + }% +}% +{% + \def\@mfu@applytofirst#1#2\@mfu@end@applytofirst#3{#3{#1}#2} +} +\ifdef\dtl@getfirst@UTFviii +{% + \newcommand*{\MFUapplytofirst}[2]{% + \ifbool{@dtl@utf8} + {% + \ifblank{#2}% + {#1{#2}}% + {% + \ifblank{#1}% + {#1#2}% + {% + \@mfu@applytofirst#2\@mfu@end@applytofirst#1\relax + }% + }% + }% + {% + #1#2% + }% + } +}% +{% + \newcommand*{\MFUapplytofirst}[2]{#1#2} +} +\def\@gls@makefirstuc#1{\MFUapplytofirst\mfirstucMakeUppercase{#1}} +\newcommand*{\mfirstucMakeUppercase}{\MakeUppercase} +\newcommand*{\glsmakefirstuc}[1]{\@gls@makefirstuc{#1}} +\def\@gls@getbody#1#{\def\@gls@body{#1}\@gls@gobbletonil} +\def\@gls@gobbletonil#1\@nil{\def\@gls@rest{#1}} +\newcommand*{\xmakefirstuc}[1]{% + \expandafter\makefirstuc\expandafter{#1}% +} +\newrobustcmd*{\emakefirstuc}[1]{% + \protected@edef\@MFU@caparg{#1}% + \expandafter\makefirstuc\expandafter{\@MFU@caparg}% +} +\newrobustcmd*{\capitalisewords}[1]{% + \let\@mfu@checkword\@gobble + \def\gls@add@space{}% + \let\@mfu@domakefirstuc\@MFU@dofirst@capword + \mfu@capitalisewords#1 \@nil\mfu@endcap +} +\newcommand*{\@mfu@mid@capitalisewords}[1]{% + \def\gls@add@space{}% + \let\@mfu@domakefirstuc\@MFU@do@capword + \mfu@capitalisewords#1 \@nil\mfu@endcap +} +\def\mfu@capitalisewords#1 #2\mfu@endcap{% + \def\mfu@cap@first{#1}% + \def\mfu@cap@second{#2}% + \gls@add@space + \@mfu@checkword{#1}% + \@mfu@domakefirstuc{#1}% + \def\gls@add@space{ }% + \ifx\mfu@cap@second\@nnil + \let\next@mfu@cap\mfu@noop + \else + \let\next@mfu@cap\mfu@capitalisewords + \let\@mfu@checkword\mfu@checkword + \fi + \next@mfu@cap#2\mfu@endcap +} +\def\mfu@noop#1\mfu@endcap{} +\newif\ifMFUhyphen +\MFUhyphenfalse +\newcommand*{\@MFU@do@capword}[1]{% + \let\@MFU@cappingword\MFUcapword + \@MFUwordbreak#1\MFUwordbreak{}\@nil\@endMFUwordbreak +} +\newcommand*{\@MFU@dofirst@capword}[1]{% + \let\@MFU@cappingword\MFUcapword + \@MFUfirstwordbreak#1\MFUwordbreak{}\@nil\@endMFUfirstwordbreak +} +\newcommand*{\MFUcapword}[1]{% + \ifMFUhyphen + \MFUhyphencapword{#1}% + \else + \MFUcapwordfirstuc{#1}% + \fi +} +\newcommand*{\MFUcapwordfirstuc}[1]{% + \makefirstuc{#1}% +} +\newrobustcmd*{\MFUwordbreak}[1]{#1} +\newcommand*{\MFUhyphencapword}[1]{% + \@MFUcapword#1-\@nil\@endMFUcapword +} +\def\@MFUcapword#1-#2\@endMFUcapword{% + \MFUcapwordfirstuc{#1}% + \def\@mfu@argii{#2}% + \ifx\@mfu@argii\@nnil + \else + -\@MFUcapword#2\@endMFUcapword + \fi +} +\def\@MFUwordbreak#1\MFUwordbreak#2#3\@endMFUwordbreak{% + \def\@mfu@argiii{#3}% + \ifx\@mfu@argiii\@nnil + \@MFU@cappingword{#1}% + \else + \let\@MFU@cappingword\@MFU@wordbreakcapword + \@MFU@cappingword{#1}% + #2\@MFUwordbreak#3\@endMFUwordbreak + \fi +} +\newcommand*{\@MFU@wordbreakcapword}[1]{% + \mfu@checkword{#1}% + \@mfu@domakefirstuc{#1}% +} +\def\@MFUfirstwordbreak#1\MFUwordbreak#2#3\@endMFUfirstwordbreak{% + \def\@mfu@argiii{#3}% + \ifx\@mfu@argiii\@nnil + \@MFU@cappingword{#1}% + \else + \let\@MFU@cappingword\@MFU@firstwordbreakcapword + \@MFU@cappingword{#1}% + #2\@MFUfirstwordbreak#3\@endMFUfirstwordbreak + \fi +} +\newcommand*{\@MFU@firstwordbreakcapword}[1]{% + \@mfu@domakefirstuc{#1}% +} +\newcommand*\mfu@checkword[1]{% + \def\mfu@checkword@arg{#1}% + \let\@mfu@domakefirstuc\@MFU@do@capword + \forlistloop\mfu@checkword@do\@mfu@nocaplist +} +\newcommand*{\mfu@checkword@do}[1]{% + \def\mfu@checkword@argii{#1}% + \ifdefequal\mfu@checkword@arg\mfu@checkword@argii + {% + \let\@mfu@domakefirstuc\@firstofone + \listbreak + }% + {% + \def\mfu@checkword@argii{#1{\@mfu@terminator}}% + \ifdefequal\mfu@checkword@arg\mfu@checkword@argii + {% + \let\@mfu@domakefirstuc\@firstofone + \listbreak + }% + {}% + }% +} +\newcommand*{\@mfu@nocaplist}{} +\newcommand*{\MFUnocap}[1]{\listadd{\@mfu@nocaplist}{#1}} +\newcommand*{\gMFUnocap}[1]{\listgadd{\@mfu@nocaplist}{#1}} +\newcommand*{\MFUclear}{\renewcommand*{\@mfu@nocaplist}{}} +\newcommand*{\xcapitalisewords}[1]{% + \expandafter\capitalisewords\expandafter{#1}% +} +\newrobustcmd*{\ecapitalisewords}[1]{% + \protected@edef\@MFU@caparg{#1}% + \expandafter\capitalisewords\expandafter{\@MFU@caparg}% +} +\newcommand\@mfu@nil{\unskip} +\newcommand*\@mfu@nnil{\@mfu@nil} +\newcommand*{\capitalisefmtwords}{% + \@ifstar\@s@capitalisefmtwords\@ns@capitalisefmtwords +} +\newcommand*{\@s@capitalisefmtwords}[1]{% + \@@s@checkgrp@@capitalisefmtwords#1\@nil +} +\newcommand*{\@@s@checkgrp@@capitalisefmtwords}{% + \@ifnextchar\bgroup{\@@s@nocs@capitalisefmtwords}{\@@s@capitalisefmtwords}% +} +\def\@@s@nocs@capitalisefmtwords#1\@nil{% + \capitalisewords{#1}% +} +\newcommand*{\@@s@capitalisefmtwords}[1]{% + \def\gls@argi{#1}% + \ifx\gls@argi\@MFU@protect + \let\@mfu@capfmtwordsnext\@@s@capitalisefmtwords + \else + \ifx\gls@argi\@nnil + \let\@mfu@capfmtwordsnext\relax + \else + \def\@gls@tmp{\ #1}% + \@onelevel@sanitize\@gls@tmp + \expandafter\@gls@checkcs\@gls@tmp\relax\relax + \if@glscs + \def\@mfu@capfmtwordsnext{\@@s@cs@capitalisefmtwords#1}% + \else + \def\@mfu@capfmtwordsnext{\@@s@nocs@capitalisefmtwords#1}% + \fi + \fi + \fi + \@mfu@capfmtwordsnext +} +\newcommand*{\@@s@cs@capitalisefmtwords}[1]{% + \@ifnextchar\bgroup + {\@@s@cs@g@capitalisefmtwords#1}% + {\@@s@cs@ng@capitalisefmtwords#1}% +} +\def\@@s@cs@g@capitalisefmtwords#1#2#3\@nil{% + #1{\capitalisewords{#2}}% + \ifblank{#3}% + {}% + {% + \def\gls@add@space{}% + \let\@mfu@checkword\mfu@checkword + \mfu@capitalisewords#3 \@nil\mfu@endcap + }% +} +\def\@@s@cs@ng@capitalisefmtwords#1#2\@nil{% + \capitalisewords{#1#2}% +} +\newcommand*{\@ns@capitalisefmtwords}[1]{% + \let\@mfu@checkword\@gobble + \def\gls@add@space{}% + \@capitalisefmtwords#1 \@mfu@nil{} \unskip +} +\newcommand*{\@capitalisefmtwords}{% + \@ifnextchar\bgroup{\@capitalise@g@fmtwords}{\@capitalise@ng@fmtwords}% +} +\newcommand*{\@capitalise@g@fmtwords}[1]{% + \@capitalise@ng@fmtwords{{#1}}% +} +\def\@mfu@ifnil#1#2\@mfu@end@nil#3#4{% + \def\gls@argi{#1}% + \ifx\gls@argi\@mfu@nnil + #3% + \else + #4% + \fi +} +\def\@capitalise@ng@fmtwords#1 {% + \@mfu@ifnil#1\relax\relax\@mfu@end@nil + {% + \def\@mfu@capfmtwordsnext{#1}% + }% + {% + \def\@mfu@capfmtwordsnext{% + \@capitalise@fmtwords#1\@mfu@nil + \def\gls@add@space{ }% + \let\@mfu@checkword\mfu@checkword + \@@cap@nofmtphrase}% + }% + \@mfu@capfmtwordsnext +}% +\def\@capitalise@fmtwords#1{% + \@mfu@ifnil#1\relax\relax\@mfu@end@nil + {% + \def\@mfu@capfmtwordsnext{#1}% + }% + {% + \def\gls@argi{#1}% + \ifx\gls@argi\@MFU@protect + \def\@mfu@capfmtwordsnext{\@capitalise@fmtwords}% + \else + \def\@gls@tmp{\ #1}% + \@onelevel@sanitize\@gls@tmp + \expandafter\@gls@checkcs\@gls@tmp\relax\relax + \if@glscs + \def\@mfu@capfmtwordsnext{\@@capitalisefmtwords#1}% + \else + \ifx\gls@argi\@empty + \def\@mfu@capfmtwordsnext{\@@capnofmtphrase{}}% + \else + \def\@mfu@capfmtwordsnext{\@@capnofmtphrase#1}% + \fi + \fi + \fi + }% + \@mfu@capfmtwordsnext +} +\def\@@capitalisefmtwords#1{% + \@ifnextchar\bgroup{\@@capfmtsubphrase#1}{\@@capnofmtphrase#1}% +} +\def\@@capnofmtphrase{% + \@ifnextchar\bgroup{\@@cap@g@nofmtphrase}{\@@cap@ng@nofmtphrase}% +} +\def\@@cap@ng@nofmtphrase#1\@mfu@nil{% + \gls@add@space + \@mfu@mid@capitalisewords{#1}% + \def\gls@add@space{ }% +} +\def\@@cap@g@nofmtphrase#1{% + \@@cap@ng@nofmtphrase{{#1}}% +} +\newcommand*\@mfu@terminator{\hbox{}} +\def\@@capfmtsubphrase#1#2#3{% + #1{\@capitalisefmtwords#2{\@mfu@terminator} \@mfu@nil{} \unskip}% + \def\gls@add@space{ }% + \let\@mfu@checkword\mfu@checkword + \@mfu@ifnil#1\relax\relax\@mfu@end@nil + {\let\@mfu@fmtsubphrasenext\relax}% + {\def\@mfu@fmtsubphrasenext{#3}}% + \@mfu@fmtsubphrasenext +} +\def\@@cap@nofmtphrase#1 {% + \@mfu@ifnil#1\relax\relax\@mfu@end@nil + {% + \def\@mfu@capnofmtwordsnext{#1 }% + }% + {% + \def\@mfu@capnofmtwordsnext{% + \@capitalisefmtwords#1 \@mfu@nil{} \unskip + \def\gls@add@space{ }% + \let\@mfu@checkword\mfu@checkword + \@capitalisefmtwords + }% + }% + \@mfu@capnofmtwordsnext +} +\newcommand*{\xcapitalisefmtwords}{% + \@ifstar\@s@xcapitalisefmtwords\@ns@xcapitalisefmtwords +} +\newcommand*{\@s@xcapitalisefmtwords}[1]{% + \expandafter\@s@capitalisefmtwords\expandafter{#1}% +} +\newcommand*{\@ns@xcapitalisefmtwords}[1]{% + \expandafter\@ns@capitalisefmtwords\expandafter{#1}% +} +\newrobustcmd*{\ecapitalisefmtwords}{% + \@ifstar\@s@ecapitalisefmtwords\@ns@ecapitalisefmtwords +} +\newcommand*{\@s@ecapitalisefmtwords}[1]{% + \protected@edef\@MFU@caparg{#1}% + \expandafter\@s@capitalisefmtwords\expandafter{\@MFU@caparg}% +} +\newcommand*{\@ns@ecapitalisefmtwords}[1]{% + \protected@edef\@MFU@caparg{#1}% + \expandafter\@ns@capitalisefmtwords\expandafter{\@MFU@caparg}% +} +% \end{macrocode} +%\iffalse +% \begin{macrocode} +%</mfirstuc-2021-10-15.sty> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} %<*sample-mfirstuc.tex> % \end{macrocode} %\fi @@ -1122,7 +1944,32 @@ mfirstuc.dtx \tableofcontents -\section{First Letter Upper Case} +\section{Sentence Case (First Letter Upper Case)} +\label{sec:sentencecase} + +\verb|\MFUsentencecase{abc}.| +\MFUsentencecase{abc}. + +\verb|\MFUsentencecase{{\em abc}}.| +\MFUsentencecase{{\em abc}}. + +\verb|\MFUsentencecase{\emph{abc}}.| +\MFUsentencecase{\emph{abc}}. + +\verb|\MFUsentencecase{\ae bc}.| +\MFUsentencecase{\ae bc}. + +\verb|\MFUsentencecase{{\ae}bc}.| +\MFUsentencecase{{\ae}bc}. + +\verb|\newcommand{\abc}{abc}\MFUsentencecase{\abc}.| +\newcommand{\abc}{abc}% +\MFUsentencecase{\abc}. + +\verb|\MFUsentencecase{\ref{sec:sentencecase}bc}.| +\MFUsentencecase{\ref{sec:sentencecase}bc}. + +\verb|\makefirstuc| doesn't expand its argument and skips exclusions. \verb|\makefirstuc{abc}.| \makefirstuc{abc}. @@ -1133,31 +1980,29 @@ mfirstuc.dtx \verb|\makefirstuc{\emph{abc}}.| \makefirstuc{\emph{abc}}. -\verb|\makefirstuc{\ae bc}.| -\makefirstuc{\ae bc}. +\verb|\makefirstuc{\ref{sec:sentencecase}bc}.| +\makefirstuc{\ref{sec:sentencecase}bc}. -\verb|\makefirstuc{{\ae}bc}.| -\makefirstuc{{\ae}bc}. +\newcommand{\strong}[1]{\textcolor{red}{#1}} +\verb|\makefirstuc{\strong{abc}d}| +\makefirstuc{\strong{abc}d} -\verb|\newcommand{\abc}{abc}\xmakefirstuc{\abc}.| -\newcommand{\abc}{abc}% -\xmakefirstuc{\abc}. +\verb|\makefirstuc{\protect\strong{abc}d}| +\makefirstuc{\protect\strong{abc}d} + +Exclusions vs blockers: -% I know \textbf is robust already and doesn't need protecting. -% This is just to test what happens if the argument starts -% with \protect -\newcommand*{\mytext}{\protect\textbf{some text}} -Protected formatting: \xmakefirstuc{\mytext}. +\verb|\MFUsentencecase{\NoCaseChange{abc} xyz}| +\MFUsentencecase{\NoCaseChange{abc} xyz} -\renewcommand*{\mytext}{\ae\oe{some text}} -Sequential commands: \xmakefirstuc{\mytext}. +\verb|\makefirstuc{\NoCaseChange{abc} xyz}| +\makefirstuc{\NoCaseChange{abc} xyz} -\verb|\makefirstuc{\MFUskippunc{?`}c\'omo est\'as?}| -\makefirstuc{\MFUskippunc{?`}c\'omo est\'as?} +\begingroup +\verb|\MFUblocker{\NoCaseChange}\makefirstuc{\NoCaseChange{abc} xyz}| +\MFUblocker{\NoCaseChange}\makefirstuc{\NoCaseChange{abc} xyz} -\renewcommand{\mytext}{\MFUskippunc{?`}c\'omo est\'as?} -Fully expanded: -\emakefirstuc{\mytext} +\endgroup \section{Title Case (No Formatting Commands)} @@ -1412,20 +2257,28 @@ Compare with %\fi %\iffalse % \begin{macrocode} -%<*mfirstuc.perl> +%<*mfirstuc.l2h> % \end{macrocode} %\fi %\iffalse % \begin{macrocode} -# File : mfirstuc.perl +# File : mfirstuc.l2h # Author : Nicola L. C. Talbot -# Date : 2012-09-21 -# Version : 1.0 +# Version : 2.08 (2022-10-14) # Description : LaTeX2HTML (limited!) implementation of mfirstuc package # This is a LaTeX2HTML style implementing the mfirstuc package, and -# is distributed as part of the glossaries package. -# Copyright 2007 Nicola L.C. Talbot +# was distributed as part of the glossaries package, but is now +# distributed as part of the mfirstuc package. There's no guarantee +# that it still works with new versions of LaTeX2HTML. +# +# v2.08: +# - The version number has been updated +# - file extension changed from .perl to .l2h to more easily identify it as a +# LaTeX2HTML file rather than a standalone Perl script. +# - Added MFUsentencecase but it's identical to makefirstuc +# +# Copyright 2007-2022 Nicola L.C. Talbot # This work may be distributed and/or modified under the # conditions of the LaTeX Project Public License, either version 1.3 # of this license of (at your option) any later version. @@ -1453,6 +2306,17 @@ sub do_cmd_makefirstuc{ &translate_commands("\\glsmakefirstuc $text") . $_; } +sub do_cmd_MFUsentencecase{ + local($_) = @_; + + local($id,$text); + + $text = &missing_braces unless + s/$next_pair_pr_rx/$id=$1;$text=$2;''/eo; + + &translate_commands("\\glsmakefirstuc $text") . $_; +} + sub do_cmd_xmakefirstuc{ local($_) = @_; @@ -1550,7 +2414,7 @@ sub get_next_object{ %\fi %\iffalse % \begin{macrocode} -%</mfirstuc.perl> +%</mfirstuc.l2h> % \end{macrocode} %\fi %\Finale diff --git a/Master/texmf-dist/source/latex/mfirstuc/mfirstuc.ins b/Master/texmf-dist/source/latex/mfirstuc/mfirstuc.ins index 02e695dcc17..c928c1ffe96 100644 --- a/Master/texmf-dist/source/latex/mfirstuc/mfirstuc.ins +++ b/Master/texmf-dist/source/latex/mfirstuc/mfirstuc.ins @@ -1,10 +1,10 @@ -% mfirstuc.ins generated using makedtx version 1.2 2021/10/15 17:46 +% mfirstuc.ins generated using makedtx version 1.2 2022/10/18 9:21 \input docstrip \preamble mfirstuc.dtx - Copyright 2021 Nicola Talbot + Copyright 2022 Nicola Talbot This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 @@ -18,7 +18,7 @@ The Current Maintainer of this work is Nicola Talbot. - This work consists of the files mfirstuc.dtx and mfirstuc.ins and the derived files mfirstuc.sty, mfirstuc-english.sty, sample-mfirstuc.tex, mfirstuc.perl. + This work consists of the files mfirstuc.dtx and mfirstuc.ins and the derived files mfirstuc.sty, mfirstuc-english.sty, mfirstuc-2021-10-15.sty, sample-mfirstuc.tex, mfirstuc.l2h. \endpreamble @@ -28,8 +28,10 @@ \usepostamble\defaultpostamble\from{mfirstuc.dtx}{mfirstuc.sty,package}} \file{mfirstuc-english.sty}{\usepreamble\defaultpreamble \usepostamble\defaultpostamble\from{mfirstuc.dtx}{mfirstuc-english.sty,package}} +\file{mfirstuc-2021-10-15.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{mfirstuc.dtx}{mfirstuc-2021-10-15.sty,package}} \file{sample-mfirstuc.tex}{\nopreamble\nopostamble\from{mfirstuc.dtx}{sample-mfirstuc.tex}} -\file{mfirstuc.perl}{\nopreamble\nopostamble\from{mfirstuc.dtx}{mfirstuc.perl}} +\file{mfirstuc.l2h}{\nopreamble\nopostamble\from{mfirstuc.dtx}{mfirstuc.l2h}} } \endbatchfile diff --git a/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc-2021-10-15.sty b/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc-2021-10-15.sty new file mode 100644 index 00000000000..f33dbafe2b9 --- /dev/null +++ b/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc-2021-10-15.sty @@ -0,0 +1,487 @@ +%% +%% This is file `mfirstuc-2021-10-15.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% mfirstuc.dtx (with options: `mfirstuc-2021-10-15.sty,package') +%% +%% mfirstuc.dtx +%% Copyright 2022 Nicola Talbot +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Nicola Talbot. +%% +%% This work consists of the files mfirstuc.dtx and mfirstuc.ins and the derived files mfirstuc.sty, mfirstuc-english.sty, mfirstuc-2021-10-15.sty, sample-mfirstuc.tex, mfirstuc.l2h. +%% +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{mfirstuc}[2021/10/15 v2.07 (NLCT)] +\RequirePackage{etoolbox} +\newif\if@glscs +\newtoks\@glsmfirst +\newtoks\@glsmrest +\newrobustcmd*{\makefirstuc}[1]{% + \@MFU@p@makefirstuc#1\relax\relax\relax\@end@MFU@protected{#1}% +} +\newcommand*{\@MFU@protect}{\protect} +\newcommand*{\@MFU@skippunc}{\MFUskippunc} +\newrobustcmd*{\MFUskippunc}[1]{#1} +\def\@MFU@p@makefirstuc#1#2#3\@end@MFU@protected#4{% + \def\gls@argi{#1}% + \ifx\gls@argi\@MFU@protect + \@makefirstuc{#2#3}% + \else + \ifx\gls@argi\@MFU@skippunc + #2\@makefirstuc{#3}% + \else + \@makefirstuc{#4}% + \fi + \fi +} +\newcommand*{\@makefirstuc}[1]{% + \def\gls@argi{#1}% + \ifx\gls@argi\@empty + \else + \def\@gls@tmp{\ #1}% + \@onelevel@sanitize\@gls@tmp + \expandafter\@gls@checkcs\@gls@tmp\relax\relax + \if@glscs + \expandafter\def\expandafter\@gls@tmp\expandafter{\expandafter + \ \@gobble #1}% + \@onelevel@sanitize\@gls@tmp + \expandafter\@gls@checkcs\@gls@tmp\relax\relax + \if@glscs\@glscsfalse\else\@glscstrue\fi + \fi + \if@glscs + \@gls@getbody #1{}\@nil + \ifx\@gls@rest\@empty + \glsmakefirstuc{#1}% + \else + \expandafter\@gls@split\@gls@rest\@nil + \ifx\@gls@first\@empty + \glsmakefirstuc{#1}% + \else + \edef\@gls@tmp\expandafter{\noexpand\ \expandonce\@gls@first}% + \@onelevel@sanitize\@gls@tmp + \expandafter\@gls@checkcs\@gls@tmp\relax\relax + \if@glscs + \edef\@gls@domfirstuc{\expandonce\@gls@body + {\noexpand\makefirstuc{\expandonce\@gls@first + \expandonce\@gls@rest}% + }% + }% + \else + \expandafter\@glsmfirst\expandafter{\@gls@first}% + \expandafter\@glsmrest\expandafter{\@gls@rest}% + \edef\@gls@domfirstuc{\noexpand\@gls@body + {\noexpand\glsmakefirstuc{\the\@glsmfirst}}% + \the\@glsmrest}% + \fi + \@gls@domfirstuc + \fi + \fi + \else + \glsmakefirstuc{#1}% + \fi + \fi +} +\ifdef\dtl@getfirst@UTFviii +{% + \def\@gls@split#1#2\@nil{% + \ifbool{@dtl@utf8} + {% + \expandafter\dtl@if@two@octets#1#2\relax\dtl@end@if@two@octets + {% + \dtl@getfirst@UTFviii#1#2\@nil\end@dtl@getfirst@UTFviii + \let\@gls@first\dtl@first + \let\@gls@rest\dtl@rest + }% + {% + \def\@gls@first{#1}\def\@gls@rest{#2}% + }% + }% + {% + \def\@gls@first{#1}\def\@gls@rest{#2}% + }% + } +}% +{% + \def\@gls@split#1#2\@nil{% + \def\@gls@first{#1}\def\@gls@rest{#2}% + } +} +\def\@gls@checkcs#1 #2#3\relax{% + \def\@gls@argi{#1}\def\@gls@argii{#2}% + \ifx\@gls@argi\@gls@argii + \@glscstrue + \else + \@glscsfalse + \fi +} +\ifdef\dtl@getfirst@UTFviii +{% + \def\@mfu@applytofirst#1#2\@mfu@end@applytofirst#3{% + \expandafter\dtl@if@two@octets#1#2\relax\dtl@end@if@two@octets + {% + \dtl@getfirst@UTFviii#1#2\@nil\end@dtl@getfirst@UTFviii + \expandafter#3\expandafter{\dtl@first}\dtl@rest + }% + {% + #3{#1}#2% + }% + }% +}% +{% + \def\@mfu@applytofirst#1#2\@mfu@end@applytofirst#3{#3{#1}#2} +} +\ifdef\dtl@getfirst@UTFviii +{% + \newcommand*{\MFUapplytofirst}[2]{% + \ifbool{@dtl@utf8} + {% + \ifblank{#2}% + {#1{#2}}% + {% + \ifblank{#1}% + {#1#2}% + {% + \@mfu@applytofirst#2\@mfu@end@applytofirst#1\relax + }% + }% + }% + {% + #1#2% + }% + } +}% +{% + \newcommand*{\MFUapplytofirst}[2]{#1#2} +} +\def\@gls@makefirstuc#1{\MFUapplytofirst\mfirstucMakeUppercase{#1}} +\newcommand*{\mfirstucMakeUppercase}{\MakeUppercase} +\newcommand*{\glsmakefirstuc}[1]{\@gls@makefirstuc{#1}} +\def\@gls@getbody#1#{\def\@gls@body{#1}\@gls@gobbletonil} +\def\@gls@gobbletonil#1\@nil{\def\@gls@rest{#1}} +\newcommand*{\xmakefirstuc}[1]{% + \expandafter\makefirstuc\expandafter{#1}% +} +\newrobustcmd*{\emakefirstuc}[1]{% + \protected@edef\@MFU@caparg{#1}% + \expandafter\makefirstuc\expandafter{\@MFU@caparg}% +} +\newrobustcmd*{\capitalisewords}[1]{% + \let\@mfu@checkword\@gobble + \def\gls@add@space{}% + \let\@mfu@domakefirstuc\@MFU@dofirst@capword + \mfu@capitalisewords#1 \@nil\mfu@endcap +} +\newcommand*{\@mfu@mid@capitalisewords}[1]{% + \def\gls@add@space{}% + \let\@mfu@domakefirstuc\@MFU@do@capword + \mfu@capitalisewords#1 \@nil\mfu@endcap +} +\def\mfu@capitalisewords#1 #2\mfu@endcap{% + \def\mfu@cap@first{#1}% + \def\mfu@cap@second{#2}% + \gls@add@space + \@mfu@checkword{#1}% + \@mfu@domakefirstuc{#1}% + \def\gls@add@space{ }% + \ifx\mfu@cap@second\@nnil + \let\next@mfu@cap\mfu@noop + \else + \let\next@mfu@cap\mfu@capitalisewords + \let\@mfu@checkword\mfu@checkword + \fi + \next@mfu@cap#2\mfu@endcap +} +\def\mfu@noop#1\mfu@endcap{} +\newif\ifMFUhyphen +\MFUhyphenfalse +\newcommand*{\@MFU@do@capword}[1]{% + \let\@MFU@cappingword\MFUcapword + \@MFUwordbreak#1\MFUwordbreak{}\@nil\@endMFUwordbreak +} +\newcommand*{\@MFU@dofirst@capword}[1]{% + \let\@MFU@cappingword\MFUcapword + \@MFUfirstwordbreak#1\MFUwordbreak{}\@nil\@endMFUfirstwordbreak +} +\newcommand*{\MFUcapword}[1]{% + \ifMFUhyphen + \MFUhyphencapword{#1}% + \else + \MFUcapwordfirstuc{#1}% + \fi +} +\newcommand*{\MFUcapwordfirstuc}[1]{% + \makefirstuc{#1}% +} +\newrobustcmd*{\MFUwordbreak}[1]{#1} +\newcommand*{\MFUhyphencapword}[1]{% + \@MFUcapword#1-\@nil\@endMFUcapword +} +\def\@MFUcapword#1-#2\@endMFUcapword{% + \MFUcapwordfirstuc{#1}% + \def\@mfu@argii{#2}% + \ifx\@mfu@argii\@nnil + \else + -\@MFUcapword#2\@endMFUcapword + \fi +} +\def\@MFUwordbreak#1\MFUwordbreak#2#3\@endMFUwordbreak{% + \def\@mfu@argiii{#3}% + \ifx\@mfu@argiii\@nnil + \@MFU@cappingword{#1}% + \else + \let\@MFU@cappingword\@MFU@wordbreakcapword + \@MFU@cappingword{#1}% + #2\@MFUwordbreak#3\@endMFUwordbreak + \fi +} +\newcommand*{\@MFU@wordbreakcapword}[1]{% + \mfu@checkword{#1}% + \@mfu@domakefirstuc{#1}% +} +\def\@MFUfirstwordbreak#1\MFUwordbreak#2#3\@endMFUfirstwordbreak{% + \def\@mfu@argiii{#3}% + \ifx\@mfu@argiii\@nnil + \@MFU@cappingword{#1}% + \else + \let\@MFU@cappingword\@MFU@firstwordbreakcapword + \@MFU@cappingword{#1}% + #2\@MFUfirstwordbreak#3\@endMFUfirstwordbreak + \fi +} +\newcommand*{\@MFU@firstwordbreakcapword}[1]{% + \@mfu@domakefirstuc{#1}% +} +\newcommand*\mfu@checkword[1]{% + \def\mfu@checkword@arg{#1}% + \let\@mfu@domakefirstuc\@MFU@do@capword + \forlistloop\mfu@checkword@do\@mfu@nocaplist +} +\newcommand*{\mfu@checkword@do}[1]{% + \def\mfu@checkword@argii{#1}% + \ifdefequal\mfu@checkword@arg\mfu@checkword@argii + {% + \let\@mfu@domakefirstuc\@firstofone + \listbreak + }% + {% + \def\mfu@checkword@argii{#1{\@mfu@terminator}}% + \ifdefequal\mfu@checkword@arg\mfu@checkword@argii + {% + \let\@mfu@domakefirstuc\@firstofone + \listbreak + }% + {}% + }% +} +\newcommand*{\@mfu@nocaplist}{} +\newcommand*{\MFUnocap}[1]{\listadd{\@mfu@nocaplist}{#1}} +\newcommand*{\gMFUnocap}[1]{\listgadd{\@mfu@nocaplist}{#1}} +\newcommand*{\MFUclear}{\renewcommand*{\@mfu@nocaplist}{}} +\newcommand*{\xcapitalisewords}[1]{% + \expandafter\capitalisewords\expandafter{#1}% +} +\newrobustcmd*{\ecapitalisewords}[1]{% + \protected@edef\@MFU@caparg{#1}% + \expandafter\capitalisewords\expandafter{\@MFU@caparg}% +} +\newcommand\@mfu@nil{\unskip} +\newcommand*\@mfu@nnil{\@mfu@nil} +\newcommand*{\capitalisefmtwords}{% + \@ifstar\@s@capitalisefmtwords\@ns@capitalisefmtwords +} +\newcommand*{\@s@capitalisefmtwords}[1]{% + \@@s@checkgrp@@capitalisefmtwords#1\@nil +} +\newcommand*{\@@s@checkgrp@@capitalisefmtwords}{% + \@ifnextchar\bgroup{\@@s@nocs@capitalisefmtwords}{\@@s@capitalisefmtwords}% +} +\def\@@s@nocs@capitalisefmtwords#1\@nil{% + \capitalisewords{#1}% +} +\newcommand*{\@@s@capitalisefmtwords}[1]{% + \def\gls@argi{#1}% + \ifx\gls@argi\@MFU@protect + \let\@mfu@capfmtwordsnext\@@s@capitalisefmtwords + \else + \ifx\gls@argi\@nnil + \let\@mfu@capfmtwordsnext\relax + \else + \def\@gls@tmp{\ #1}% + \@onelevel@sanitize\@gls@tmp + \expandafter\@gls@checkcs\@gls@tmp\relax\relax + \if@glscs + \def\@mfu@capfmtwordsnext{\@@s@cs@capitalisefmtwords#1}% + \else + \def\@mfu@capfmtwordsnext{\@@s@nocs@capitalisefmtwords#1}% + \fi + \fi + \fi + \@mfu@capfmtwordsnext +} +\newcommand*{\@@s@cs@capitalisefmtwords}[1]{% + \@ifnextchar\bgroup + {\@@s@cs@g@capitalisefmtwords#1}% + {\@@s@cs@ng@capitalisefmtwords#1}% +} +\def\@@s@cs@g@capitalisefmtwords#1#2#3\@nil{% + #1{\capitalisewords{#2}}% + \ifblank{#3}% + {}% + {% + \def\gls@add@space{}% + \let\@mfu@checkword\mfu@checkword + \mfu@capitalisewords#3 \@nil\mfu@endcap + }% +} +\def\@@s@cs@ng@capitalisefmtwords#1#2\@nil{% + \capitalisewords{#1#2}% +} +\newcommand*{\@ns@capitalisefmtwords}[1]{% + \let\@mfu@checkword\@gobble + \def\gls@add@space{}% + \@capitalisefmtwords#1 \@mfu@nil{} \unskip +} +\newcommand*{\@capitalisefmtwords}{% + \@ifnextchar\bgroup{\@capitalise@g@fmtwords}{\@capitalise@ng@fmtwords}% +} +\newcommand*{\@capitalise@g@fmtwords}[1]{% + \@capitalise@ng@fmtwords{{#1}}% +} +\def\@mfu@ifnil#1#2\@mfu@end@nil#3#4{% + \def\gls@argi{#1}% + \ifx\gls@argi\@mfu@nnil + #3% + \else + #4% + \fi +} +\def\@capitalise@ng@fmtwords#1 {% + \@mfu@ifnil#1\relax\relax\@mfu@end@nil + {% + \def\@mfu@capfmtwordsnext{#1}% + }% + {% + \def\@mfu@capfmtwordsnext{% + \@capitalise@fmtwords#1\@mfu@nil + \def\gls@add@space{ }% + \let\@mfu@checkword\mfu@checkword + \@@cap@nofmtphrase}% + }% + \@mfu@capfmtwordsnext +}% +\def\@capitalise@fmtwords#1{% + \@mfu@ifnil#1\relax\relax\@mfu@end@nil + {% + \def\@mfu@capfmtwordsnext{#1}% + }% + {% + \def\gls@argi{#1}% + \ifx\gls@argi\@MFU@protect + \def\@mfu@capfmtwordsnext{\@capitalise@fmtwords}% + \else + \def\@gls@tmp{\ #1}% + \@onelevel@sanitize\@gls@tmp + \expandafter\@gls@checkcs\@gls@tmp\relax\relax + \if@glscs + \def\@mfu@capfmtwordsnext{\@@capitalisefmtwords#1}% + \else + \ifx\gls@argi\@empty + \def\@mfu@capfmtwordsnext{\@@capnofmtphrase{}}% + \else + \def\@mfu@capfmtwordsnext{\@@capnofmtphrase#1}% + \fi + \fi + \fi + }% + \@mfu@capfmtwordsnext +} +\def\@@capitalisefmtwords#1{% + \@ifnextchar\bgroup{\@@capfmtsubphrase#1}{\@@capnofmtphrase#1}% +} +\def\@@capnofmtphrase{% + \@ifnextchar\bgroup{\@@cap@g@nofmtphrase}{\@@cap@ng@nofmtphrase}% +} +\def\@@cap@ng@nofmtphrase#1\@mfu@nil{% + \gls@add@space + \@mfu@mid@capitalisewords{#1}% + \def\gls@add@space{ }% +} +\def\@@cap@g@nofmtphrase#1{% + \@@cap@ng@nofmtphrase{{#1}}% +} +\newcommand*\@mfu@terminator{\hbox{}} +\def\@@capfmtsubphrase#1#2#3{% + #1{\@capitalisefmtwords#2{\@mfu@terminator} \@mfu@nil{} \unskip}% + \def\gls@add@space{ }% + \let\@mfu@checkword\mfu@checkword + \@mfu@ifnil#1\relax\relax\@mfu@end@nil + {\let\@mfu@fmtsubphrasenext\relax}% + {\def\@mfu@fmtsubphrasenext{#3}}% + \@mfu@fmtsubphrasenext +} +\def\@@cap@nofmtphrase#1 {% + \@mfu@ifnil#1\relax\relax\@mfu@end@nil + {% + \def\@mfu@capnofmtwordsnext{#1 }% + }% + {% + \def\@mfu@capnofmtwordsnext{% + \@capitalisefmtwords#1 \@mfu@nil{} \unskip + \def\gls@add@space{ }% + \let\@mfu@checkword\mfu@checkword + \@capitalisefmtwords + }% + }% + \@mfu@capnofmtwordsnext +} +\newcommand*{\xcapitalisefmtwords}{% + \@ifstar\@s@xcapitalisefmtwords\@ns@xcapitalisefmtwords +} +\newcommand*{\@s@xcapitalisefmtwords}[1]{% + \expandafter\@s@capitalisefmtwords\expandafter{#1}% +} +\newcommand*{\@ns@xcapitalisefmtwords}[1]{% + \expandafter\@ns@capitalisefmtwords\expandafter{#1}% +} +\newrobustcmd*{\ecapitalisefmtwords}{% + \@ifstar\@s@ecapitalisefmtwords\@ns@ecapitalisefmtwords +} +\newcommand*{\@s@ecapitalisefmtwords}[1]{% + \protected@edef\@MFU@caparg{#1}% + \expandafter\@s@capitalisefmtwords\expandafter{\@MFU@caparg}% +} +\newcommand*{\@ns@ecapitalisefmtwords}[1]{% + \protected@edef\@MFU@caparg{#1}% + \expandafter\@ns@capitalisefmtwords\expandafter{\@MFU@caparg}% +} +\endinput +%% +%% End of file `mfirstuc-2021-10-15.sty'. diff --git a/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc-english.sty b/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc-english.sty index 3419261766c..5913b8cb303 100644 --- a/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc-english.sty +++ b/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc-english.sty @@ -7,7 +7,7 @@ %% mfirstuc.dtx (with options: `mfirstuc-english.sty,package') %% %% mfirstuc.dtx -%% Copyright 2021 Nicola Talbot +%% Copyright 2022 Nicola Talbot %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -21,7 +21,7 @@ %% %% The Current Maintainer of this work is Nicola Talbot. %% -%% This work consists of the files mfirstuc.dtx and mfirstuc.ins and the derived files mfirstuc.sty, mfirstuc-english.sty, sample-mfirstuc.tex, mfirstuc.perl. +%% This work consists of the files mfirstuc.dtx and mfirstuc.ins and the derived files mfirstuc.sty, mfirstuc-english.sty, mfirstuc-2021-10-15.sty, sample-mfirstuc.tex, mfirstuc.l2h. %% %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -39,7 +39,7 @@ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mfirstuc-english}[2021/10/15 v2.07 (NLCT)] +\ProvidesPackage{mfirstuc-english}[2022/10/14 v2.08 (NLCT)] \RequirePackage{mfirstuc} \MFUnocap{a} \MFUnocap{an} diff --git a/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty b/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty index 0efe161b1d7..d2dc6805054 100644 --- a/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty +++ b/Master/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty @@ -7,7 +7,7 @@ %% mfirstuc.dtx (with options: `mfirstuc.sty,package') %% %% mfirstuc.dtx -%% Copyright 2021 Nicola Talbot +%% Copyright 2022 Nicola Talbot %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -21,7 +21,7 @@ %% %% The Current Maintainer of this work is Nicola Talbot. %% -%% This work consists of the files mfirstuc.dtx and mfirstuc.ins and the derived files mfirstuc.sty, mfirstuc-english.sty, sample-mfirstuc.tex, mfirstuc.perl. +%% This work consists of the files mfirstuc.dtx and mfirstuc.ins and the derived files mfirstuc.sty, mfirstuc-english.sty, mfirstuc-2021-10-15.sty, sample-mfirstuc.tex, mfirstuc.l2h. %% %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -39,160 +39,194 @@ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mfirstuc}[2021/10/15 v2.07 (NLCT)] +\DeclareRelease{v2.07}{2021-10-15}{mfirstuc-2021-10-15.sty} +\DeclareCurrentRelease{v2.08}{2022-10-14} +\ProvidesPackage{mfirstuc}[2022/10/14 v2.08 (NLCT)] \RequirePackage{etoolbox} -\newif\if@glscs -\newtoks\@glsmfirst -\newtoks\@glsmrest -\newrobustcmd*{\makefirstuc}[1]{% - \@MFU@p@makefirstuc#1\relax\relax\relax\@end@MFU@protected{#1}% +\newcommand*{\glsmakefirstuc}[1]{\MFUsentencecase{\unexpanded{#1}}} +\ExplSyntaxOn +\newcommand*{\mfirstucMakeUppercase}[1]{\text_uppercase:n{#1}} +\DeclareOption{expanded}{% + \renewcommand*{\glsmakefirstuc}[1]{\MFUsentencecase{#1}}% + \renewcommand*{\mfirstucMakeUppercase}[1]{\text_uppercase:n{#1}}% +} +\DeclareOption{unexpanded}{% + \renewcommand*{\glsmakefirstuc}[1]{\MFUsentencecase{\unexpanded{#1}}}% + \renewcommand*{\mfirstucMakeUppercase}[1]{\text_uppercase:n{#1}}% +} +\ExplSyntaxOff +\newrobustcmd*{\mfugrabfirstuc}[1]{\@mfu@grabfirstuc#1\empty} +\newcommand*{\@mfu@grabfirstuc}[2]{\mfirstucMakeUppercase{#1}#2} +\DeclareOption{grabfirst}{% + \renewcommand*{\glsmakefirstuc}[1]{\mfugrabfirstuc{#1}}% + \renewcommand*{\mfirstucMakeUppercase}[1]{\MakeUppercase{#1}}% +} +\ProcessOptions +\ExplSyntaxOn +\newcommand{\MFUsentencecase}[1]{\text_titlecase_first:n{#1}} +\newcommand{\MFUexcl}[1]{ + \tl_if_empty:nF { #1 } + { + \tl_if_in:NnF \l_text_case_exclude_arg_tl {#1} + { + \tl_put_right:Nn \l_text_case_exclude_arg_tl {#1} + } + } } -\newcommand*{\@MFU@protect}{\protect} -\newcommand*{\@MFU@skippunc}{\MFUskippunc} -\newrobustcmd*{\MFUskippunc}[1]{#1} -\def\@MFU@p@makefirstuc#1#2#3\@end@MFU@protected#4{% - \def\gls@argi{#1}% - \ifx\gls@argi\@MFU@protect - \@makefirstuc{#2#3}% - \else - \ifx\gls@argi\@MFU@skippunc - #2\@makefirstuc{#3}% - \else - \@makefirstuc{#4}% - \fi - \fi +\MFUexcl{\ensuremath} +\cs_new:Npn \mfirstuc_if_excluded:NTF #1 #2 #3 + { + \tl_if_in:NnTF \l_text_case_exclude_arg_tl {#1} {#2} {#3} + } +\tl_new:N \l__mfirstuc_stack_tl +\tl_new:N \l__mfirstuc_head_tl +\tl_new:N \l__mfirstuc_next_tl +\tl_new:N \l__mfirstuc_blocker_tl +\newcommand{\MFUblocker}[1]{ + \tl_if_empty:nF { #1 } + { + \tl_if_in:NnF \l__mfirstuc_blocker_tl {#1} + { + \tl_put_right:Nn \l__mfirstuc_blocker_tl {#1} + } + \MFUexcl { #1 } + } } -\newcommand*{\@makefirstuc}[1]{% - \def\gls@argi{#1}% - \ifx\gls@argi\@empty - \else - \def\@gls@tmp{\ #1}% - \@onelevel@sanitize\@gls@tmp - \expandafter\@gls@checkcs\@gls@tmp\relax\relax - \if@glscs - \expandafter\def\expandafter\@gls@tmp\expandafter{\expandafter - \ \@gobble #1}% - \@onelevel@sanitize\@gls@tmp - \expandafter\@gls@checkcs\@gls@tmp\relax\relax - \if@glscs\@glscsfalse\else\@glscstrue\fi - \fi - \if@glscs - \@gls@getbody #1{}\@nil - \ifx\@gls@rest\@empty - \glsmakefirstuc{#1}% - \else - \expandafter\@gls@split\@gls@rest\@nil - \ifx\@gls@first\@empty - \glsmakefirstuc{#1}% - \else - \edef\@gls@tmp\expandafter{\noexpand\ \expandonce\@gls@first}% - \@onelevel@sanitize\@gls@tmp - \expandafter\@gls@checkcs\@gls@tmp\relax\relax - \if@glscs - \edef\@gls@domfirstuc{\expandonce\@gls@body - {\noexpand\makefirstuc{\expandonce\@gls@first - \expandonce\@gls@rest}% - }% - }% - \else - \expandafter\@glsmfirst\expandafter{\@gls@first}% - \expandafter\@glsmrest\expandafter{\@gls@rest}% - \edef\@gls@domfirstuc{\noexpand\@gls@body - {\noexpand\glsmakefirstuc{\the\@glsmfirst}}% - \the\@glsmrest}% - \fi - \@gls@domfirstuc - \fi - \fi - \else - \glsmakefirstuc{#1}% - \fi - \fi +\cs_new:Npn \tl_if_mfirstuc_blocker:nTF #1 #2 #3 + { + \tl_if_in:NnTF \l__mfirstuc_blocker_tl {#1} {#2} {#3} + } +\cs_new:Npn \tl_if_mfirstuc_blocker:VTF #1 #2 #3 + { + \expandafter \tl_if_mfirstuc_blocker:nTF \expandafter {#1} {#2} {#3} + } +\newrobustcmd{\makefirstuc}[1]{% + \tl_set:Nn \l__mfirstuc_stack_tl {#1} + \tl_if_empty:NF \l__mfirstuc_stack_tl + { + \tl_if_single:NTF \l__mfirstuc_stack_tl + { + \glsmakefirstuc{#1} + } + { + \tl_if_head_is_group:nTF {#1} + { + \glsmakefirstuc{#1} + } + { + \tl_if_head_eq_catcode:nNTF {#1} \relax + { + \tl_set:NV \l_tmpa_tl \l__mfirstuc_stack_tl + \tl_set:Nx \l__mfirstuc_head_tl { \tl_head:V \l_tmpa_tl } + \tl_set:Nx \l__mfirstuc_stack_tl { \tl_tail:N \l__mfirstuc_stack_tl } + \tl_if_eq:NnTF \l__mfirstuc_head_tl { \protect } + { + \tl_set:NV \l_tmpa_tl \l__mfirstuc_stack_tl + \tl_set:Nx \l__mfirstuc_head_tl { \tl_head:V \l_tmpa_tl } + \tl_set:Nx \l__mfirstuc_stack_tl { \tl_tail:N \l__mfirstuc_stack_tl } + } + {} + \tl_if_mfirstuc_blocker:VTF \l__mfirstuc_head_tl + { #1 } + { + \let \l_tmpa_tl \l__mfirstuc_stack_tl + \tl_set:Nx \l__mfirstuc_next_tl { \tl_head:N \l_tmpa_tl } + \tl_if_single:NTF \l__mfirstuc_next_tl + { + \glsmakefirstuc{#1} + } + { + \tl_set:Nx \l__mfirstuc_stack_tl { \tl_tail:N \l__mfirstuc_stack_tl } + \tl_clear:N \l_tmpa_tl + \tl_put_right:Nn \l_tmpa_tl { \__mfirstuc_inner:nnn } + \tl_put_right:NV \l_tmpa_tl \l__mfirstuc_head_tl + \tl_put_right:Nx \l_tmpa_tl + { + { \expandonce \l__mfirstuc_next_tl } + { \expandonce \l__mfirstuc_stack_tl } + } + \tl_use:N \l_tmpa_tl + } + } + } + { + \glsmakefirstuc{#1} + } + } + } + } } -\ifdef\dtl@getfirst@UTFviii -{% - \def\@gls@split#1#2\@nil{% - \ifbool{@dtl@utf8} - {% - \expandafter\dtl@if@two@octets#1#2\relax\dtl@end@if@two@octets - {% - \dtl@getfirst@UTFviii#1#2\@nil\end@dtl@getfirst@UTFviii - \let\@gls@first\dtl@first - \let\@gls@rest\dtl@rest - }% - {% - \def\@gls@first{#1}\def\@gls@rest{#2}% - }% - }% - {% - \def\@gls@first{#1}\def\@gls@rest{#2}% - }% +\cs_new_protected:Npn \__mfirstuc_inner:nnn #1 #2 #3 + { + \mfirstuc_get_map:NN #1 \l_tmpb_tl + \quark_if_no_value:NTF \l_tmpb_tl + { + \mfirstuc_if_excluded:NTF #1 + { #1{#2}\makefirstuc{#3} } + { #1{\makefirstuc{#2}}#3 } + } + { + \l_tmpb_tl {#2} #3 + } + } +\prop_new:N \l__mfirstuc_mappings_prop +\newrobustcmd*{\MFUaddmap}[2]{% + \tl_if_empty:nF { #1 } + { + \tl_if_empty:nF { #2 } + { + \prop_put:Nnn \l__mfirstuc_mappings_prop {#1} {#2} + } } -}% -{% - \def\@gls@split#1#2\@nil{% - \def\@gls@first{#1}\def\@gls@rest{#2}% + \MFUexcl { #1 } + \MFUblocker { #2 } +} +\cs_new:Npn \mfirstuc_get_map:NN #1 #2 + { + \prop_get:NnN \l__mfirstuc_mappings_prop {#1} #2 + } +\newcommand{\MFUsaveatend}{ + \AtEndDocument { \@MFUsavetoaux } + \let\MFUsaveatend\relax +} +\newcommand{\MFUsave}{ + \@MFUsavetoaux + \let\@MFUsavetoaux\relax + \let\MFUsave\relax + \let\MFUsaveatend\relax +} +\newcommand{\@MFUsavetoaux}{ + \protected@write\@auxout{} + { \tl_to_str:n { \providecommand{\@mfu@excls}[1]{} } } + \protected@write\@auxout{} + { \tl_to_str:n { \providecommand{\@mfu@blockers}[1]{} } } + \protected@write\@auxout{} + { \tl_to_str:n { \providecommand{\@mfu@mappings}[1]{} } } + \protected@write\@auxout{} + { + \string\@mfu@excls { \tl_to_str:V \l_text_case_exclude_arg_tl } } -} -\def\@gls@checkcs#1 #2#3\relax{% - \def\@gls@argi{#1}\def\@gls@argii{#2}% - \ifx\@gls@argi\@gls@argii - \@glscstrue - \else - \@glscsfalse - \fi -} -\ifdef\dtl@getfirst@UTFviii -{% - \def\@mfu@applytofirst#1#2\@mfu@end@applytofirst#3{% - \expandafter\dtl@if@two@octets#1#2\relax\dtl@end@if@two@octets - {% - \dtl@getfirst@UTFviii#1#2\@nil\end@dtl@getfirst@UTFviii - \expandafter#3\expandafter{\dtl@first}\dtl@rest - }% - {% - #3{#1}#2% - }% - }% -}% -{% - \def\@mfu@applytofirst#1#2\@mfu@end@applytofirst#3{#3{#1}#2} -} -\ifdef\dtl@getfirst@UTFviii -{% - \newcommand*{\MFUapplytofirst}[2]{% - \ifbool{@dtl@utf8} - {% - \ifblank{#2}% - {#1{#2}}% - {% - \ifblank{#1}% - {#1#2}% - {% - \@mfu@applytofirst#2\@mfu@end@applytofirst#1\relax - }% - }% - }% - {% - #1#2% - }% + \protected@write\@auxout{} + { + \string\@mfu@blockers { \tl_to_str:V \l__mfirstuc_blocker_tl } + } + \protected@write\@auxout{} + { + \string\@mfu@mappings + { \expandonce { \prop_to_keyval:N \l__mfirstuc_mappings_prop } } } -}% -{% - \newcommand*{\MFUapplytofirst}[2]{#1#2} -} -\def\@gls@makefirstuc#1{\MFUapplytofirst\mfirstucMakeUppercase{#1}} -\newcommand*{\mfirstucMakeUppercase}{\MakeUppercase} -\newcommand*{\glsmakefirstuc}[1]{\@gls@makefirstuc{#1}} -\def\@gls@getbody#1#{\def\@gls@body{#1}\@gls@gobbletonil} -\def\@gls@gobbletonil#1\@nil{\def\@gls@rest{#1}} -\newcommand*{\xmakefirstuc}[1]{% - \expandafter\makefirstuc\expandafter{#1}% } +\ExplSyntaxOff \newrobustcmd*{\emakefirstuc}[1]{% \protected@edef\@MFU@caparg{#1}% \expandafter\makefirstuc\expandafter{\@MFU@caparg}% } +\newcommand*{\xmakefirstuc}[1]{\expandafter\makefirstuc\expandafter{#1}} +\newrobustcmd*{\MFUskippunc}[1]{#1} +\MFUexcl{\MFUskippunc} +\newcommand*{\MFUcapwordfirstuc}[1]{% + \makefirstuc{#1}% +} \newrobustcmd*{\capitalisewords}[1]{% \let\@mfu@checkword\@gobble \def\gls@add@space{}% @@ -237,9 +271,6 @@ \MFUcapwordfirstuc{#1}% \fi } -\newcommand*{\MFUcapwordfirstuc}[1]{% - \makefirstuc{#1}% -} \newrobustcmd*{\MFUwordbreak}[1]{#1} \newcommand*{\MFUhyphencapword}[1]{% \@MFUcapword#1-\@nil\@endMFUcapword @@ -482,6 +513,152 @@ \protected@edef\@MFU@caparg{#1}% \expandafter\@ns@capitalisefmtwords\expandafter{\@MFU@caparg}% } +\newif\if@glscs +\newtoks\@glsmfirst +\newtoks\@glsmrest +\newrobustcmd*{\@org@makefirstuc}[1]{% + \@MFU@p@makefirstuc#1\relax\relax\relax\@end@MFU@protected{#1}% +} +\newcommand*{\@MFU@protect}{\protect} +\newcommand*{\@MFU@skippunc}{\MFUskippunc} +\def\@MFU@p@makefirstuc#1#2#3\@end@MFU@protected#4{% + \def\gls@argi{#1}% + \ifx\gls@argi\@MFU@protect + \@makefirstuc{#2#3}% + \else + \ifx\gls@argi\@MFU@skippunc + #2\@makefirstuc{#3}% + \else + \@makefirstuc{#4}% + \fi + \fi +} +\newcommand*{\@makefirstuc}[1]{% + \def\gls@argi{#1}% + \ifx\gls@argi\@empty + \else + \def\@gls@tmp{\ #1}% + \@onelevel@sanitize\@gls@tmp + \expandafter\@gls@checkcs\@gls@tmp\relax\relax + \if@glscs + \expandafter\def\expandafter\@gls@tmp\expandafter{\expandafter + \ \@gobble #1}% + \@onelevel@sanitize\@gls@tmp + \expandafter\@gls@checkcs\@gls@tmp\relax\relax + \if@glscs\@glscsfalse\else\@glscstrue\fi + \fi + \if@glscs + \@gls@getbody #1{}\@nil + \ifx\@gls@rest\@empty + \glsmakefirstuc{#1}% + \else + \expandafter\@gls@split\@gls@rest\@nil + \ifx\@gls@first\@empty + \glsmakefirstuc{#1}% + \else + \edef\@gls@tmp\expandafter{\noexpand\ \expandonce\@gls@first}% + \@onelevel@sanitize\@gls@tmp + \expandafter\@gls@checkcs\@gls@tmp\relax\relax + \if@glscs + \edef\@gls@domfirstuc{\expandonce\@gls@body + {\noexpand\makefirstuc{\expandonce\@gls@first + \expandonce\@gls@rest}% + }% + }% + \else + \expandafter\@glsmfirst\expandafter{\@gls@first}% + \expandafter\@glsmrest\expandafter{\@gls@rest}% + \edef\@gls@domfirstuc{\noexpand\@gls@body + {\noexpand\glsmakefirstuc{\the\@glsmfirst}}% + \the\@glsmrest}% + \fi + \@gls@domfirstuc + \fi + \fi + \else + \glsmakefirstuc{#1}% + \fi + \fi +} +\ifdef\dtl@getfirst@UTFviii +{% + \def\@gls@split#1#2\@nil{% + \ifbool{@dtl@utf8} + {% + \expandafter\dtl@if@two@octets#1#2\relax\dtl@end@if@two@octets + {% + \dtl@getfirst@UTFviii#1#2\@nil\end@dtl@getfirst@UTFviii + \let\@gls@first\dtl@first + \let\@gls@rest\dtl@rest + }% + {% + \def\@gls@first{#1}\def\@gls@rest{#2}% + }% + }% + {% + \def\@gls@first{#1}\def\@gls@rest{#2}% + }% + } +}% +{% + \def\@gls@split#1#2\@nil{% + \def\@gls@first{#1}\def\@gls@rest{#2}% + } +} +\def\@gls@checkcs#1 #2#3\relax{% + \def\@gls@argi{#1}\def\@gls@argii{#2}% + \ifx\@gls@argi\@gls@argii + \@glscstrue + \else + \@glscsfalse + \fi +} +\ifdef\dtl@getfirst@UTFviii +{% + \def\@mfu@applytofirst#1#2\@mfu@end@applytofirst#3{% + \expandafter\dtl@if@two@octets#1#2\relax\dtl@end@if@two@octets + {% + \dtl@getfirst@UTFviii#1#2\@nil\end@dtl@getfirst@UTFviii + \expandafter#3\expandafter{\dtl@first}\dtl@rest + }% + {% + #3{#1}#2% + }% + }% +}% +{% + \def\@mfu@applytofirst#1#2\@mfu@end@applytofirst#3{% + #3{#1}#2% + } +} +\ifdef\dtl@getfirst@UTFviii +{% + \newcommand*{\MFUapplytofirst}[2]{% + \ifbool{@dtl@utf8} + {% + \ifblank{#2}% + {#1{#2}}% + {% + \ifblank{#1}% + {#1#2}% + {% + \@mfu@applytofirst#2\@mfu@end@applytofirst#1\relax + }% + }% + }% + {% + #1#2% + }% + } +}% +{% + \newcommand*{\MFUapplytofirst}[2]{% + #1#2% + } +} +\def\@gls@makefirstuc#1{\MFUsentencecase{#1}} +\def\@gls@getbody#1#{\def\@gls@body{#1}\@gls@gobbletonil} +\def\@gls@gobbletonil#1\@nil{\def\@gls@rest{#1}} \endinput %% %% End of file `mfirstuc.sty'. |