LaTeX tip: plural, capitalized letter etc. of a word

Say you want derivatives of the word ‘foot’, such as in ‘Footing the bill gives me cold feet’ that can be invoked with a command. One approach is to use \newcommand*{\foot}{foot} and declare the derivatives with \WithSuffix. That’s extremely tedious. Package makeglossaries already does the job. All that’s needed create a ‘helper’ glossary, but not display it, and invoke \gls[hyper=false]{} or, equivalently, \gls*{}.

Input:

\documentclass{article}
\usepackage{hyperref}
\usepackage{glossaries}
\newglossary[hll]{helper}{hli}{hlo}{Helper}
\newglossaryentry{helper:f}{
name= {foot}
, description = {\nopostdesc}
, plural = {feet}
, type = {helper}
}
\makeglossaries
\begin{document}
\noindent
\Gls*{helper:f}[ing] the bill gives me \glspl*{helper:f}.
%\printglossary[type = helper] %don't uncomment
\end{document}

Output:

Footing the bill gives me cold feet.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s