summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/mfirstuc/mfirstuc.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/mfirstuc/mfirstuc.dtx')
-rw-r--r--macros/latex/contrib/mfirstuc/mfirstuc.dtx168
1 files changed, 148 insertions, 20 deletions
diff --git a/macros/latex/contrib/mfirstuc/mfirstuc.dtx b/macros/latex/contrib/mfirstuc/mfirstuc.dtx
index 708531ba48..2aa2008f41 100644
--- a/macros/latex/contrib/mfirstuc/mfirstuc.dtx
+++ b/macros/latex/contrib/mfirstuc/mfirstuc.dtx
@@ -1,21 +1,21 @@
%\iffalse
% mfirstuc.dtx generated using makedtx version 1.2 (c) Nicola Talbot
% Command line args:
-% -codetitle "Main Package Code"
+% -setambles ".*\.perl=>\nopreamble\nopostamble"
+% -setambles ".*\.tex=>\nopreamble\nopostamble"
% -author "Nicola Talbot"
-% -macrocode ".*\.perl"
-% -macrocode ".*\.tex"
% -src "mfirstuc.sty\Z=>mfirstuc.sty"
% -src "mfirstuc-english.sty\Z=>mfirstuc-english.sty"
% -src "(sample.*\.tex)\Z=>\1"
% -src "(.*\.perl)\Z=>\1"
-% -setambles ".*\.perl=>\nopreamble\nopostamble"
-% -setambles ".*\.tex=>\nopreamble\nopostamble"
+% -macrocode ".*\.perl"
+% -macrocode ".*\.tex"
+% -codetitle "Main Package Code"
+% -doc "mfirstuc-codedoc.tex"
% -comment ".*\.perl"
% -comment ".*\.tex"
-% -doc "mfirstuc-codedoc.tex"
% mfirstuc
-% Created on 2017/11/14 12:21
+% Created on 2021/10/15 17:46
%\fi
%\iffalse
%<*package>
@@ -38,7 +38,7 @@
%\fi
% \iffalse
% Doc-Source file to use with LaTeX2e
-% Copyright (C) 2017 Nicola Talbot, all rights reserved.
+% Copyright (C) 2021 Nicola Talbot, all rights reserved.
% \fi
% \iffalse
%<*driver>
@@ -64,7 +64,7 @@ mfirstuc.dtx
\setcounter{IndexColumns}{2}
\setlength\IndexMin{100pt}
-\CheckSum{691}
+\CheckSum{771}
\begin{document}
\DocInput{mfirstuc.dtx}
@@ -74,12 +74,12 @@ mfirstuc.dtx
%\MakeShortVerb{"}
%\DeleteShortVerb{\|}
%
-% \title{Documented Code For mfirstuc v2.06}
+% \title{Documented Code For mfirstuc v2.07}
% \author{Nicola L.C. Talbot\\[10pt]
%Dickimaw Books\\
%\url{http://www.dickimaw-books.com/}}
%
-% \date{2017-11-14}
+% \date{2021-10-15}
% \maketitle
%
%\tableofcontents
@@ -111,7 +111,7 @@ mfirstuc.dtx
%\changes{2.0}{2015/09/09}{package split from glossaries}
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{mfirstuc}[2017/11/14 v2.06 (NLCT)]
+\ProvidesPackage{mfirstuc}[2021/10/15 v2.07 (NLCT)]
% \end{macrocode}
% Requires \sty{etoolbox}:\changes{1.06}{2012/05/21}{now requires
% etoolbox}
@@ -154,6 +154,20 @@ mfirstuc.dtx
% \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}{\MFUskippunc}
+%\changes{2.07}{2021-10-15}{new}
+% \begin{macrocode}
+\newrobustcmd*{\MFUskippunc}[1]{#1}
+% \end{macrocode}
+%\end{macro}
+%
%\begin{macro}{\@MFU@p@makefirstuc}
% Internal command to do the required action.
% \begin{macrocode}
@@ -166,7 +180,15 @@ mfirstuc.dtx
\ifx\gls@argi\@MFU@protect
\@makefirstuc{#2#3}%
\else
- \@makefirstuc{#4}%
+% \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}
@@ -419,7 +441,7 @@ mfirstuc.dtx
\newrobustcmd*{\capitalisewords}[1]{%
\let\@mfu@checkword\@gobble
\def\gls@add@space{}%
- \let\@mfu@domakefirstuc\MFUcapword
+ \let\@mfu@domakefirstuc\@MFU@dofirst@capword
\mfu@capitalisewords#1 \@nil\mfu@endcap
}
% \end{macrocode}
@@ -431,7 +453,7 @@ mfirstuc.dtx
% \begin{macrocode}
\newcommand*{\@mfu@mid@capitalisewords}[1]{%
\def\gls@add@space{}%
- \let\@mfu@domakefirstuc\MFUcapword
+ \let\@mfu@domakefirstuc\@MFU@do@capword
\mfu@capitalisewords#1 \@nil\mfu@endcap
}
% \end{macrocode}
@@ -465,24 +487,71 @@ mfirstuc.dtx
% \end{macrocode}
%\end{macro}
%
+%\begin{macro}{\@MFU@do@capword}
+%\changes{2.07}{2021-10-15}{new}
+% \begin{macrocode}
+\newcommand*{\@MFU@do@capword}[1]{%
+ \let\@MFU@cappingword\MFUcapword
+ \@MFUwordbreak#1\MFUwordbreak{}\@nil\@endMFUwordbreak
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@MFU@dofirst@capword}
+%\changes{2.07}{2021-10-15}{new}
+% \begin{macrocode}
+\newcommand*{\@MFU@dofirst@capword}[1]{%
+ \let\@MFU@cappingword\MFUcapword
+ \@MFUfirstwordbreak#1\MFUwordbreak{}\@nil\@endMFUfirstwordbreak
+}
+% \end{macrocode}
+%\end{macro}
+%
%\begin{macro}{\MFUcapword}
%\changes{2.03}{2016-07-29}{new}
% \begin{macrocode}
\newcommand*{\MFUcapword}[1]{%
\ifMFUhyphen
- \@MFUcapword#1-\@nil\@endMFUcapword
+ \MFUhyphencapword{#1}%
\else
- \makefirstuc{#1}%
+ \MFUcapwordfirstuc{#1}%
\fi
}
% \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
+%break.
+% \begin{macrocode}
+\newrobustcmd*{\MFUwordbreak}[1]{#1}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\MFUhyphencapword}
+%\changes{2.07}{2021-10-15}{new}
+% \begin{macrocode}
+\newcommand*{\MFUhyphencapword}[1]{%
+ \@MFUcapword#1-\@nil\@endMFUcapword
+}
+% \end{macrocode}
+%\end{macro}
+%
%\begin{macro}{\@MFUcapword}
%\changes{2.03}{2016-07-29}{new}
% \begin{macrocode}
\def\@MFUcapword#1-#2\@endMFUcapword{%
- \makefirstuc{#1}%
+ \MFUcapwordfirstuc{#1}%
\def\@mfu@argii{#2}%
\ifx\@mfu@argii\@nnil
\else
@@ -492,6 +561,57 @@ mfirstuc.dtx
% \end{macrocode}
%\end{macro}
%
+%\begin{macro}{\@MFUwordbreak}
+%\changes{2.07}{2021-10-15}{new}
+% \begin{macrocode}
+\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
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@MFU@wordbreakcapword}
+%\changes{2.07}{2021-10-15}{new}
+% \begin{macrocode}
+\newcommand*{\@MFU@wordbreakcapword}[1]{%
+ \mfu@checkword{#1}%
+ \@mfu@domakefirstuc{#1}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@MFUfirstwordbreak}
+%\changes{2.07}{2021-10-15}{new}
+% \begin{macrocode}
+\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
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@MFU@firstwordbreakcapword}
+%\changes{2.07}{2021-10-15}{new}
+% \begin{macrocode}
+\newcommand*{\@MFU@firstwordbreakcapword}[1]{%
+ \@mfu@domakefirstuc{#1}%
+}
+% \end{macrocode}
+%\end{macro}
+%
%\begin{macro}{\mfu@checkword}
% Check if word should be capitalised.
% This originally used \sty{etoolbox}'s \ics{ifinlist} command
@@ -501,7 +621,7 @@ mfirstuc.dtx
% \begin{macrocode}
\newcommand*\mfu@checkword[1]{%
\def\mfu@checkword@arg{#1}%
- \let\@mfu@domakefirstuc\MFUcapword
+ \let\@mfu@domakefirstuc\@MFU@do@capword
\forlistloop\mfu@checkword@do\@mfu@nocaplist
}
% \end{macrocode}
@@ -545,6 +665,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.)
+%\changes{1.09}{2017-07-30}{new}
% \begin{macrocode}
\newcommand*{\MFUnocap}[1]{\listadd{\@mfu@nocaplist}{#1}}
% \end{macrocode}
@@ -944,7 +1065,7 @@ mfirstuc.dtx
%\label{sec:code:mfirstuc-english}
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{mfirstuc-english}[2017/11/14 v2.06 (NLCT)]
+\ProvidesPackage{mfirstuc-english}[2021/10/15 v2.07 (NLCT)]
% \end{macrocode}
% Load \sty{mfirstuc} if not already loaded:
% \begin{macrocode}
@@ -1031,6 +1152,13 @@ Protected formatting: \xmakefirstuc{\mytext}.
\renewcommand*{\mytext}{\ae\oe{some text}}
Sequential commands: \xmakefirstuc{\mytext}.
+\verb|\makefirstuc{\MFUskippunc{?`}c\'omo est\'as?}|
+\makefirstuc{\MFUskippunc{?`}c\'omo est\'as?}
+
+\renewcommand{\mytext}{\MFUskippunc{?`}c\'omo est\'as?}
+Fully expanded:
+\emakefirstuc{\mytext}
+
\section{Title Case (No Formatting Commands)}
\bgroup