Capitalize first letter of each word when printing list of acronyms
Here's an alternative approach that uses glossaries-extra
(an extension to the glossaries
package):
\documentclass[a4paper,oneside,12pt]{report}
% Abbreviations
\usepackage[acronym,style=super,nogroupskip,nonumberlist]{glossaries-extra}
\makeglossaries
\setabbreviationstyle[acronym]{long-short}
\loadglsentries{def_abr} % file with acronyms
\glssetcategoryattribute{acronym}{glossdesc}{title}
\begin{document}
% abstract, toc, list of figures here
\renewcommand{\glsnamefont}[1]{\textbf{#1}}
\printglossary[type=\acronymtype,title={List of Abbreviations}]
\chapter*{Example Usage}
\gls{brdf}, \gls{awgn}, \gls{psnr}, \gls{cnn}
% chapters
\end{document}
(I've omitted the toc
option as it's the default for glossaries-extra
).
This produces on page 1:
and page 2:
The glossaries
package automatically loads mfirstuc
(which was originally developed as part of the glossaries
package). The title
attribute uses \capitalisewords
to convert the case. You can control whether or not to capitalise the hyphenated parts of words using \MFUhyphentrue
and \MFUhyphenfalse
. The default is the false setting, which is why the above has "Peak-signal-to-noise".
The following switches it on:
\documentclass[a4paper,oneside,12pt]{report}
% Abbreviations
\usepackage[acronym,style=super,nogroupskip,nonumberlist]{glossaries-extra}
\makeglossaries
\setabbreviationstyle[acronym]{long-short}
\loadglsentries{def_abr} % file with acronyms
\glssetcategoryattribute{acronym}{glossdesc}{title}
\MFUhyphentrue
\begin{document}
% abstract, toc, list of figures here
\renewcommand{\glsnamefont}[1]{\textbf{#1}}
\printglossary[type=\acronymtype,title={List of Abbreviations}]
\chapter*{Example Usage}
\gls{brdf}, \gls{awgn}, \gls{psnr}, \gls{cnn}
% chapters
\end{document}
This produces:
To prevent words like "to" from being changed use the mfirstuc-english
package or set up exceptions with \MFUnocap
(for example, \MFUnocap{to}
).
You can use \titlecap
to capitalize the 1st letter of each word in the List of Abbreviations. You can even exclude words like to
from being capitalized. The key is to turn on the meaning of \titlecap
for the glossary print, and turn it off elsewhere.
I am not a glossaries user, but I am sure there is a way to automate the process so that the \titlecap
macro need not be added to each entry.
\documentclass[a4paper,oneside,12pt]{report}
\usepackage{titlecaps}
\Addlcwords{to}
\usepackage{filecontents}
\begin{filecontents*}{glsfile}
\newacronym{brdf}{BRDF}{\titlecap{bidirectional reflectance distribution function}}
\newacronym{cnn}{CNN}{\titlecap{convolutional neural network}}
\newacronym{psnr}{PSNR}{\titlecap{peak-signal-\relax to-noise ratio}}
\newacronym{snr}{SNR}{\titlecap{signal to noise ratio}}
\newacronym{awgn}{AWGN}{\titlecap{additive white Gaussian noise}}
\end{filecontents*}
% Abbreviations
\usepackage[acronym,style=super,nogroupskip,nonumberlist,toc]{glossaries}
\loadglsentries{glsfile} % file with acronyms
\makenoidxglossaries
\begin{document}
% abstract, toc, list of figures here
\renewcommand{\glsnamefont}[1]{\textbf{#1}}
\printnoidxglossary[type=\acronymtype,title={List of Abbreviations}]
\renewcommand\titlecap[1]{#1}
\chapter*{Example Usage}
\gls{brdf}, \gls{awgn}, \gls{psnr}, \gls{cnn}, \gls{snr}
% chapters
\end{document}