summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/mfirstuc/mfirstuc.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/mfirstuc/mfirstuc.dtx')
-rw-r--r--Master/texmf-dist/source/latex/mfirstuc/mfirstuc.dtx521
1 files changed, 407 insertions, 114 deletions
diff --git a/Master/texmf-dist/source/latex/mfirstuc/mfirstuc.dtx b/Master/texmf-dist/source/latex/mfirstuc/mfirstuc.dtx
index 3f3887401ad..2c7299fba08 100644
--- a/Master/texmf-dist/source/latex/mfirstuc/mfirstuc.dtx
+++ b/Master/texmf-dist/source/latex/mfirstuc/mfirstuc.dtx
@@ -1,21 +1,21 @@
%\iffalse
% mfirstuc.dtx generated using makedtx version 1.1 (c) Nicola Talbot
% Command line args:
+% -doc "mfirstuc-codedoc.tex"
+% -macrocode ".*\.perl"
+% -macrocode ".*\.tex"
% -codetitle "Main Package Code"
+% -comment ".*\.perl"
+% -comment ".*\.tex"
+% -setambles ".*\.perl=>\nopreamble\nopostamble"
+% -setambles ".*\.tex=>\nopreamble\nopostamble"
% -author "Nicola Talbot"
-% -doc "mfirstuc-codedoc.tex"
% -src "mfirstuc.sty\Z=>mfirstuc.sty"
% -src "mfirstuc-english.sty\Z=>mfirstuc-english.sty"
% -src "(sample.*\.tex)\Z=>\1"
% -src "(.*\.perl)\Z=>\1"
-% -comment ".*\.perl"
-% -comment ".*\.tex"
-% -macrocode ".*\.perl"
-% -macrocode ".*\.tex"
-% -setambles ".*\.perl=>\nopreamble\nopostamble"
-% -setambles ".*\.tex=>\nopreamble\nopostamble"
% mfirstuc
-% Created on 2016/7/29 22:54
+% Created on 2016/7/31 20:20
%\fi
%\iffalse
%<*package>
@@ -64,7 +64,7 @@ mfirstuc.dtx
\setcounter{IndexColumns}{2}
\setlength\IndexMin{100pt}
-\CheckSum{519}
+\CheckSum{664}
\begin{document}
\DocInput{mfirstuc.dtx}
@@ -74,12 +74,12 @@ mfirstuc.dtx
%\MakeShortVerb{"}
%\DeleteShortVerb{\|}
%
-% \title{Documented Code For mfirstuc v2.03}
+% \title{Documented Code For mfirstuc v2.04}
% \author{Nicola L.C. Talbot\\[10pt]
%Dickimaw Books\\
%\url{http://www.dickimaw-books.com/}}
%
-% \date{2016-07-29}
+% \date{2016-07-31}
% \maketitle
%
%\tableofcontents
@@ -111,7 +111,7 @@ mfirstuc.dtx
%\changes{2.0}{2015/09/09}{package split from glossaries}
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{mfirstuc}[2016/07/29 v2.03 (NLCT)]
+\ProvidesPackage{mfirstuc}[2016/07/31 v2.04 (NLCT)]
% \end{macrocode}
% Requires \sty{etoolbox}:\changes{1.06}{2012/05/21}{now requires
% etoolbox}
@@ -226,7 +226,7 @@ mfirstuc.dtx
%\begin{macro}{\@gls@split}
% Put first argument in \cs{@gls@first} and second argument in
% \cs{@gls@rest}:
-%\changes{??}{??}{added check for datatool-base UTF-8 support}
+%\changes{2.03}{2016-07-29}{added check for datatool-base UTF-8 support}
% \begin{macrocode}
\ifdef\dtl@getfirst@UTFviii
{%
@@ -243,6 +243,12 @@ mfirstuc.dtx
\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}%
+ }%
}
}%
{%
@@ -265,7 +271,7 @@ mfirstuc.dtx
% 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{??}{??}{new}
+%\changes{2.03}{2016-07-29}{new}
% \begin{macrocode}
\ifdef\dtl@getfirst@UTFviii
{%
@@ -287,7 +293,7 @@ mfirstuc.dtx
%\end{macro}
%
%\begin{macro}{\MFUapplytofirst}
-%\changes{??}{??}{new}
+%\changes{2.03}{2016-07-29}{new}
%\begin{definition}
%\cs{MFUapplytofirst}\marg{cs}\marg{text}
%\end{definition}
@@ -478,12 +484,24 @@ mfirstuc.dtx
%\changes{2.02}{2015-12-17}{new}
% \begin{macrocode}
\newcommand*{\mfu@checkword@do}[1]{%
- \ifdefstring{\mfu@checkword@arg}{#1}%
- {%
- \let\@mfu@domakefirstuc\@firstofone
- \listbreak
- }%
- {}%
+ \def\mfu@checkword@argii{#1}%
+ \ifdefequal\mfu@checkword@arg\mfu@checkword@argii
+ {%
+ \let\@mfu@domakefirstuc\@firstofone
+ \listbreak
+ }%
+ {%
+% \end{macrocode}
+%Need to check if \cs{@mfu@terminator} has been tacked onto the end.
+% \begin{macrocode}
+ \def\mfu@checkword@argii{#1{\@mfu@terminator}}%
+ \ifdefequal\mfu@checkword@arg\mfu@checkword@argii
+ {%
+ \let\@mfu@domakefirstuc\@firstofone
+ \listbreak
+ }%
+ {}%
+ }%
}
% \end{macrocode}
%\end{macro}
@@ -498,6 +516,7 @@ mfirstuc.dtx
%
%\begin{macro}{\MFUnocap}
% Provide the user with a means to add a word to the list.
+% (No expansion performed on the argument.)
% \begin{macrocode}
\newcommand*{\MFUnocap}[1]{\listadd{\@mfu@nocaplist}{#1}}
% \end{macrocode}
@@ -539,31 +558,167 @@ mfirstuc.dtx
% \end{macrocode}
%\end{macro}
%
+%\begin{macro}{\@mfu@nil}
+% \begin{macrocode}
+\newcommand\@mfu@nil{\unskip}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@mfu@nnil}
+% \begin{macrocode}
+\newcommand*\@mfu@nnil{\@mfu@nil}
+% \end{macrocode}
+%\end{macro}
+%
%\begin{macro}{\capitalisefmtwords}
%\changes{2.03}{2016-07-29}{new}
%Like \cs{capitalisewords} but assumes that the phrase contains
%formatting text-block commands.
% \begin{macrocode}
-\newcommand*{\capitalisefmtwords}[1]{%
+\newcommand*{\capitalisefmtwords}{%
+ \@ifstar\@s@capitalisefmtwords\@ns@capitalisefmtwords
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@s@capitalisefmtwords}
+%\changes{2.04}{2016-07-31}{new}
+% Starred form.
+% \begin{macrocode}
+\newcommand*{\@s@capitalisefmtwords}[1]{%
+ \@@s@checkgrp@@capitalisefmtwords#1\@nil
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@@s@checkgrp@capitalisefmtwords}
+%\changes{2.04}{2016-07-31}{new}
+% \begin{macrocode}
+\newcommand*{\@@s@checkgrp@@capitalisefmtwords}{%
+ \@ifnextchar\bgroup{\@@s@nocs@capitalisefmtwords}{\@@s@capitalisefmtwords}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@@s@nocs@capitalisefmtwords}
+%\changes{2.04}{2016-07-31}{new}
+%Argument starts with a group.
+% \begin{macrocode}
+\def\@@s@nocs@capitalisefmtwords#1\@nil{%
+ \capitalisewords{#1}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@@s@capitalisefmtwords}
+%\changes{2.04}{2016-07-31}{new}
+% \begin{macrocode}
+\newcommand*{\@@s@capitalisefmtwords}[1]{%
+ \def\gls@argi{#1}%
+ \ifx\gls@argi\@MFU@protect
+% \end{macrocode}
+%Skip \cs{protect}
+% \begin{macrocode}
+ \let\@mfu@capfmtwordsnext\@@s@capitalisefmtwords
+ \else
+ \ifx\gls@argi\@nnil
+% \end{macrocode}
+%Nothing to do.
+% \begin{macrocode}
+ \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
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@@s@cs@capitalisefmtwords}
+%\changes{2.04}{2016-07-31}{new}
+% \begin{macrocode}
+\newcommand*{\@@s@cs@capitalisefmtwords}[1]{%
+ \@ifnextchar\bgroup
+ {\@@s@cs@g@capitalisefmtwords#1}%
+ {\@@s@cs@ng@capitalisefmtwords#1}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@@s@cs@g@capitalisefmtwords}
+%\changes{2.04}{2016-07-31}{new}
+% \begin{macrocode}
+\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
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@@s@cs@ng@capitalisefmtwords}
+%\changes{2.04}{2016-07-31}{new}
+% \begin{macrocode}
+\def\@@s@cs@ng@capitalisefmtwords#1#2\@nil{%
+ \capitalisewords{#1#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@ns@capitalisefmtwords}
+%\changes{2.04}{2016-07-31}{new}
+% Unstarred form.
+% \begin{macrocode}
+\newcommand*{\@ns@capitalisefmtwords}[1]{%
\let\@mfu@checkword\@gobble
\def\gls@add@space{}%
- \@capitalisefmtwords#1 \@nil\relax
+ \@capitalisefmtwords#1 \@mfu@nil{} \unskip
}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\@capitalisefmtwords}
%\changes{2.03}{2016-07-29}{new}
+%Take care of group at the start of the word.
% \begin{macrocode}
-\def\@capitalisefmtwords#1 #2{%
- \def\gls@argi{#2}%
- \ifx\gls@argi\@nnil
- \def\@mfu@capfmtwordsnext{\@capitalise@fmtwords#1\@nil}%
+\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
- \def\@mfu@capfmtwordsnext{\@capitalise@fmtwords#1\@nil
- \def\gls@add@space{ }%
- \let\@mfu@checkword\mfu@checkword
- \@@cap@nofmtphrase#2}%
+ #4%
\fi
+}
+\def\@capitalise@ng@fmtwords#1 {%
+ \@mfu@ifnil#1\relax\relax\@mfu@end@nil
+ {%
+ \def\@mfu@capfmtwordsnext{#1}%
+ }%
+ {%
+ \def\@mfu@capfmtwordsnext{%
+ \@capitalise@fmtwords#1\@mfu@nil
+ \def\gls@add@space{ }%
+ \let\@mfu@checkword\mfu@checkword
+ \@@cap@nofmtphrase}%
+ }%
\@mfu@capfmtwordsnext
}%
% \end{macrocode}
@@ -572,13 +727,15 @@ mfirstuc.dtx
%\changes{2.03}{2016-07-29}{new}
% \begin{macrocode}
\def\@capitalise@fmtwords#1{%
- \def\gls@argi{#1}%
- \ifx\gls@argi\@nnil
+ \@mfu@ifnil#1\relax\relax\@mfu@end@nil
+ {%
% \end{macrocode}
%Do nothing.
% \begin{macrocode}
- \let\@mfu@capfmtwordsnext\relax
- \else
+ \def\@mfu@capfmtwordsnext{#1}%
+ }%
+ {%
+ \def\gls@argi{#1}%
\ifx\gls@argi\@MFU@protect
% \end{macrocode}
%Skip \cs{protect}
@@ -598,75 +755,91 @@ mfirstuc.dtx
\fi
\fi
\fi
- \fi
+ }%
\@mfu@capfmtwordsnext
}
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\@capitalisefmtwords}
+%\begin{macro}{\@@capitalisefmtwords}
%\changes{2.03}{2016-07-29}{new}
%Check for a group following argument.
% \begin{macrocode}
\def\@@capitalisefmtwords#1{%
- \@ifnextchar\bgroup{\@@capfmtphrase#1}{\@@capnofmtphrase#1}%
+ \@ifnextchar\bgroup{\@@capfmtsubphrase#1}{\@@capnofmtphrase#1}%
}
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\@@capfmtphrase}
+%\begin{macro}{\@@capnofmtphrase}
%\changes{2.03}{2016-07-29}{new}
% \begin{macrocode}
-\def\@@capfmtphrase#1#2#3{%
- \def\@gls@tmp{#3}%
- \ifx\@gls@tmp\@nnil
- \def\@mfu@capfmtwordsnext{#1{\@capitalisefmtwords#2 \@nil}}%
- \else
- \def\@mfu@capfmtwordsnext{\@@capfmtsubphrase#1{#2}#3}%
- \fi
- \@mfu@capfmtwordsnext
+\def\@@capnofmtphrase{%
+ \@ifnextchar\bgroup{\@@cap@g@nofmtphrase}{\@@cap@ng@nofmtphrase}%
}
% \end{macrocode}
%\end{macro}
-%
-%\begin{macro}{\@@capnofmtphrase}
-%\changes{2.03}{2016-07-29}{new}
+%\begin{macro}{\@@cap@ng@nofmtphrase}
+%\changes{2.04}{2016-07-31}{new}
% \begin{macrocode}
-\def\@@capnofmtphrase#1\@nil{%
+\def\@@cap@ng@nofmtphrase#1\@mfu@nil{%
\gls@add@space
\@mfu@mid@capitalisewords{#1}%
\def\gls@add@space{ }%
}
% \end{macrocode}
%\end{macro}
+%\begin{macro}{\@@cap@g@nofmtphrase}
+%\changes{2.04}{2016-07-31}{new}
+% \begin{macrocode}
+\def\@@cap@g@nofmtphrase#1{%
+ \@@cap@ng@nofmtphrase{{#1}}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@mfu@terminator}
+%\changes{2.04}{2016-07-31}{new}
+% \begin{macrocode}
+\newcommand*\@mfu@terminator{\hbox{}}
+% \end{macrocode}
+%\end{macro}
%
%\begin{macro}{\@@capfmtsubphrase}
%\changes{2.03}{2016-07-29}{new}
% \begin{macrocode}
-\def\@@capfmtsubphrase#1#2#3\@nil{%
- \gls@add@space
- #1{\@mfu@mid@capitalisewords{#2}}%
+\def\@@capfmtsubphrase#1#2#3{%
+% \end{macrocode}
+%Protect any trailing space at the end of the second argument.
+% \begin{macrocode}
+ #1{\@capitalisefmtwords#2{\@mfu@terminator} \@mfu@nil{} \unskip}%
\def\gls@add@space{ }%
\let\@mfu@checkword\mfu@checkword
- #3%
+ \@mfu@ifnil#1\relax\relax\@mfu@end@nil
+ {\let\@mfu@fmtsubphrasenext\relax}%
+ {\def\@mfu@fmtsubphrasenext{#3}}%
+ \@mfu@fmtsubphrasenext
}
% \end{macrocode}
%\end{macro}
%
-%
%\begin{macro}{\@@cap@nofmtphrase}
%\changes{2.03}{2016-07-29}{new}
% \begin{macrocode}
-\def\@@cap@nofmtphrase#1 #2\@nil{%
- \def\gls@arg{#2}%
- \ifx\gls@arg\@empty
- \@capitalisefmtwords#1 \@nil
- \else
- \@capitalisefmtwords#1 \@nil
- \def\gls@add@space{ }%
- \let\@mfu@checkword\mfu@checkword
- \@capitalisefmtwords#2 \@nil
- \fi
+\def\@@cap@nofmtphrase#1 {%
+ \@mfu@ifnil#1\relax\relax\@mfu@end@nil
+ {%
+ \def\@mfu@capnofmtwordsnext{#1 }%
+ }%
+ {%
+ \def\@mfu@capnofmtwordsnext{%
+ \@capitalisefmtwords#1 \@mfu@nil{} \unskip
+ \def\gls@add@space{ }%
+ \let\@mfu@checkword\mfu@checkword
+ \@capitalisefmtwords
+ }%
+ }%
+ \@mfu@capnofmtwordsnext
}
% \end{macrocode}
%\end{macro}
@@ -675,8 +848,27 @@ mfirstuc.dtx
%\changes{2.03}{2016-07-29}{new}
% Short-cut command:
% \begin{macrocode}
-\newcommand*{\xcapitalisefmtwords}[1]{%
- \expandafter\capitalisefmtwords\expandafter{#1}%
+\newcommand*{\xcapitalisefmtwords}{%
+ \@ifstar\@s@xcapitalisefmtwords\@ns@xcapitalisefmtwords
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@s@xcapitalisefmtwords}
+%\changes{2.04}{2016-07-31}{new}
+% Starred version
+% \begin{macrocode}
+\newcommand*{\@s@xcapitalisefmtwords}[1]{%
+ \expandafter\@s@capitalisefmtwords\expandafter{#1}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@ns@xcapitalisefmtwords}
+%\changes{2.04}{2016-07-31}{new}
+% Unstarred version
+% \begin{macrocode}
+\newcommand*{\@ns@xcapitalisefmtwords}[1]{%
+ \expandafter\@ns@capitalisefmtwords\expandafter{#1}%
}
% \end{macrocode}
%\end{macro}
@@ -684,13 +876,32 @@ mfirstuc.dtx
%\begin{macro}{\ecapitalisefmtwords}
%\changes{2.03}{2016-07-29}{new}
% \begin{macrocode}
-\newrobustcmd*{\ecapitalisefmtwords}[1]{%
+\newrobustcmd*{\ecapitalisefmtwords}{%
+ \@ifstar\@s@ecapitalisefmtwords\@ns@ecapitalisefmtwords
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@s@ecapitalisefmtwords}
+%\changes{2.04}{2016-07-31}{new}
+%Starred version
+% \begin{macrocode}
+\newcommand*{\@s@ecapitalisefmtwords}[1]{%
\protected@edef\@MFU@caparg{#1}%
- \expandafter\capitalisefmtwords\expandafter{\@MFU@caparg}%
+ \expandafter\@s@capitalisefmtwords\expandafter{\@MFU@caparg}%
}
% \end{macrocode}
%\end{macro}
%
+%\begin{macro}{\@ns@ecapitalisefmtwords}
+%\changes{2.04}{2016-07-31}{new}
+%Unstarred version
+% \begin{macrocode}
+\newcommand*{\@ns@ecapitalisefmtwords}[1]{%
+ \protected@edef\@MFU@caparg{#1}%
+ \expandafter\@ns@capitalisefmtwords\expandafter{\@MFU@caparg}%
+}
+% \end{macrocode}
+%\end{macro}
%\iffalse
% \begin{macrocode}
%</mfirstuc.sty>
@@ -705,7 +916,7 @@ mfirstuc.dtx
%\label{sec:code:mfirstuc-english}
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{mfirstuc-english}[2016/07/29 v2.03 (NLCT)]
+\ProvidesPackage{mfirstuc-english}[2016/07/31 v2.04 (NLCT)]
% \end{macrocode}
% Load \sty{mfirstuc} if not already loaded:
% \begin{macrocode}
@@ -746,14 +957,21 @@ mfirstuc.dtx
% This file is public domain
% If you want to use arara, you need the following directive:
% arara: pdflatex: { synctex: on }
+ % arara: pdflatex: { synctex: on }
\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage{color}
\usepackage{mfirstuc-english}% also loads mfirstuc.sty
+\usepackage[hidelinks]{hyperref}
+
+\title{Sample Document Illustrating the mfirstuc Package}
+\author{Nicola Talbot}
\begin{document}
-This is a sample document illustrating the mfirstuc package.
+\maketitle
+
+\tableofcontents
\section{First Letter Upper Case}
@@ -785,23 +1003,82 @@ Protected formatting: \xmakefirstuc{\mytext}.
\renewcommand*{\mytext}{\ae\oe{some text}}
Sequential commands: \xmakefirstuc{\mytext}.
-\section{Title Case (Formatting)}
+\section{Title Case (No Formatting Commands)}
+
+\bgroup
+%Clearing ``nocap'' words.
+%\verb|\MFUclear|
+%\MFUclear
+%(localised by group)
+
+\verb|\capitalisewords{the wind in the willows}|
+\capitalisewords{the wind in the willows}
+
+\verb|\capitalisewords{a small book of rhyme.}|
+\capitalisewords{a small book of rhyme.}
+
+\medskip
+
+\verb|\space| isn't considered a word boundary for
+\verb|\capitalisewords| as shown below:
+
+\begin{verbatim}
+\capitalisewords{a small\space book of rhyme.}
+\end{verbatim}
+\capitalisewords{a small\space book of rhyme.}
+
+\medskip
+No expansion is performed on the argument of
+\verb|\capitalisewords|:
+
+\verb|\newcommand{\mytitle}{a small book of rhyme.}|
+\newcommand{\mytitle}{a small book of rhyme.}
+
+\verb|\capitalisewords{\mytitle}|
+\capitalisewords{\mytitle}
+
+\verb|\xcapitalisewords{\mytitle}|
+\xcapitalisewords{\mytitle}
+
+\egroup
Formatting for the entire phrase must go outside
\verb|\capitalisewords| (unlike \verb|\makefirstuc|). Compare:
-\verb|\capitalisewords{\textbf{a small book of rhyme.}}|
+\begin{verbatim}
+\capitalisewords{\textbf{a small book of rhyme.}}
+\end{verbatim}
\capitalisewords{\textbf{a small book of rhyme.}}
-with:
-
-\verb|\textbf{\capitalisewords{a small book of rhyme.}}|
+\begin{verbatim}
+\textbf{\capitalisewords{a small book of rhyme.}}
+\end{verbatim}
\textbf{\capitalisewords{a small book of rhyme.}}
\medskip
-Use \verb|\capitalisefmtwords| instead (full stop outside
-argument to check for spurious spaces):
+Use \verb|\capitalisefmtwords| instead. The starred form
+is limited to one text-block command at the start of the argument.
+
+\begin{verbatim}
+\capitalisefmtwords*{\emph{a small book of rhyme}}
+\end{verbatim}
+\capitalisefmtwords*{\emph{a small book of rhyme}}
+
+Additional text-block commands can cause unexpected results.
+
+\begin{verbatim}
+\capitalisefmtwords*{\emph{a small} book \textbf{of rhyme}}
+\end{verbatim}
+\capitalisefmtwords*{\emph{a small} book \textbf{of rhyme}}
+
+
+\section{Title Case (Contains Text-Block Formatting Commands)}
+
+The unstarred form of \verb|\capitalisefmtwords| is still a bit
+experimental and is only designed
+for phrases that contain text-block commands with a single
+argument, which should be a word or sub-phrase.
\verb|\capitalisefmtwords{\textbf{a small book of rhyme}}.|
\capitalisefmtwords{\textbf{a small book of rhyme}}.
@@ -812,17 +1089,28 @@ argument to check for spurious spaces):
\verb|\capitalisefmtwords{a \textbf{small book} of rhyme}.|
\capitalisefmtwords{a \textbf{small book} of rhyme}.
-\verb|\capitalisefmtwords{\textbf{a} book of rhyme}.|
+\verb|\capitalisefmtwords{\textbf{a} small book of rhyme}.|
\capitalisefmtwords{\textbf{a} small book of rhyme}.
-\verb|\capitalisefmtwords{\textbf{a book }of rhyme}.|
-\capitalisefmtwords{\textbf{a small book }of rhyme}.
-
\verb|\capitalisefmtwords{a small book \textbf{of rhyme}}.|
\capitalisefmtwords{a small book \textbf{of rhyme}}.
\medskip
+Be careful of trailing spaces at the end a group. They can confuse
+things.
+
+\verb|\capitalisefmtwords{\textbf{a small }book of rhyme}.|
+\capitalisefmtwords{\textbf{a small }book of rhyme}.
+
+\verb|\capitalisefmtwords{\textbf{a small book }of rhyme}.|
+\capitalisefmtwords{\textbf{a small book }of rhyme}.
+
+\verb|\capitalisefmtwords{\textbf{a small book of }rhyme}.|
+\capitalisefmtwords{\textbf{a small book of }rhyme}.
+
+\medskip
+
Use semantic commands for things like quotations:
\begin{verbatim}
@@ -836,6 +1124,25 @@ Use semantic commands for things like quotations:
(But make them robust if you intend using commands like
\verb|\ecapitalisefmtwords|.)
+Similarly for other types of punctuation:
+\begin{verbatim}
+\newcommand*{\esq}[1]{'?#1?}
+\capitalisefmtwords{\esq{D\'onde est\'a libro}}
+\end{verbatim}
+\newcommand*{\esq}[1]{?`#1?}
+\capitalisefmtwords{\esq{D\'onde est\'a libro}}
+
+\medskip
+
+Anything more complicated than a simple one-argument text-block
+command requires the starred version.
+
+\begin{verbatim}
+\newcommand*{\swap}[2]{{#2}{#1}}
+\capitalisefmtwords*{\textbf{an \swap{un}{usually} small book of} rhyme}.
+\end{verbatim}
+\newcommand*{\swap}[2]{{#2}{#1}}
+\capitalisefmtwords*{\textbf{an \swap{un}{usually} small book of} rhyme}.
\medskip
@@ -916,43 +1223,29 @@ As illustrated next:
\verb|\capitalisefmtwords{\relax a book of rhyme.}|
\capitalisefmtwords{\relax a book of rhyme.}
-\section{Title Case (No Formatting)}
-
-\bgroup
-%Clearing ``nocap'' words.
-%\verb|\MFUclear|
-%\MFUclear
-
-\verb|\capitalisewords{the wind in the willows}|
-\capitalisewords{the wind in the willows}
-
-\verb|\capitalisewords{a small book of rhyme.}|
-\capitalisewords{a small book of rhyme.}
-
-\medskip
+\section{Compound Words}
-\verb|\space| isn't considered a word boundary for
-\verb|\capitalisewords| as shown below:
+Use \verb|\MFUhyphentrue| to title case each part of
+a compound word.
+Default:
\begin{verbatim}
-\capitalisewords{a small\space book of rhyme.}
+\capitalisewords{a fast-paced book of rhyme}.
+\capitalisefmtwords{a \textbf{fast-paced} book of rhyme}.
\end{verbatim}
-\capitalisewords{a small\space book of rhyme.}
-
-\medskip
-No expansion is performed on the argument of
-\verb|\capitalisewords|:
+\capitalisewords{a fast-paced book of rhyme}.
+\capitalisefmtwords{a \textbf{fast-paced} book of rhyme}.
-\verb|\newcommand{\mytitle}{a small\space book of rhyme.}|
-\newcommand{\mytitle}{a small\space book of rhyme.}
-
-\verb|\capitalisewords{\mytitle}|
-\capitalisewords{\mytitle}
-
-\verb|\xcapitalisewords{\mytitle}|
-\xcapitalisewords{\mytitle}
+Compare with
+\begin{verbatim}
+\MFUhyphentrue
+\capitalisewords{a fast-paced book of rhyme}.
+\capitalisefmtwords{a \textbf{fast-paced} book of rhyme}.
+\end{verbatim}
+\MFUhyphentrue
+\capitalisewords{a fast-paced book of rhyme}.
+\capitalisefmtwords{a \textbf{fast-paced} book of rhyme}.
-\egroup
\end{document}
% \end{macrocode}
%\fi