I guess you need to differentiate between a) creating glossaries and b) controlling the process from your editor. With b) I can't help as I am not using TeXstudio.
Save the following document under the name sample.tex
(the name is important!)
\documentclass{article}
\usepackage[colorlinks,linkcolor=blue]{hyperref}
\usepackage[style=long,toc,acronym=true]{glossaries}
\newglossaryentry{Perl}{name=\texttt{Perl},sort=Perl,description=A scripting language}
\newacronym{svm}{SVM}{Support Vector Machine}
\newacronym{xml}{XML}{Extensible Markup Language}
\makeglossaries
\begin{document}
\gls{Perl}
\gls{svm}
\printglossaries
\end{document}
Run the sample.tex
through the LaTeX compiler of your choice, I usually use pdflatex
Run the next two commands from a) the command line or b) save them in a file with the extension .bat
makeindex -s sample.ist -t sample.glg -o sample.gls sample.glo
makeindex -s sample.ist -t sample.alg -o sample.acr sample.acn
Run LaTeX again on the TeX file. You should get the following PDF:
I nevertheless strongly recommend Nicolas manual, as the above code is a few years old (I took it from my example repository) and things may have changed in the meantime. Concerning arara
I have created a short description for TeXworks, it may help you as well: http://uweziegenhagen.de/?p=2928
If you are not able to open a command window and run arara.exe
I would guess the path setting is somehow corrupt. In this case locate arara.exe
on your computer and add the directory it is located in to the Windows path variable.
The glossaries
bundle also provides the mfirstuc
package, which provides the command \capitalisewords
, which converts the first letter of each word to uppercase. This can be adapted so that instead of converting the letter to uppercase, it turns it bold instead. A new command can be created to do this:
\newrobustcmd{\bffirst}[1]{{\let\mfirstucMakeUppercase\textbf\capitalisewords{#1}}}
The extra pair of braces ensures that the change to \mfirstucMakeUppercase
only has a local effect. (This is internally used by commands such as \Gls
, so it's important to restore it.)
A new acronym style can then be defined that puts the description inside the argument of this new custom \bffirst
command:
\newacronymstyle{bf-long-short}%
{%
\GlsUseAcrEntryDispStyle{long-short}%
}%
{%
\GlsUseAcrStyleDefs{long-short}%
\renewcommand*{\GenericAcronymFields}{description={\bffirst{\the\glslongtok}}}%
}
This new style should be set before defining the acronyms:
\setacronymstyle{bf-long-short}
(If you get an "undefined control sequence" error for \newacronymstyle
, then your version of glossaries
is too old and needs to be updated.) Note that the glossaries
user manual advises against defining entries inside the document
environment so I've moved \newacronym
into the preamble in the modified example below:
\documentclass{article}
% Load the package with the acronym option
\usepackage[acronym,nomain]{glossaries}
% Generate the glossary
\makeglossaries
\newrobustcmd{\bffirst}[1]{{\let\mfirstucMakeUppercase\textbf\capitalisewords{#1}}}
\newacronymstyle{bf-long-short}%
{%
\GlsUseAcrEntryDispStyle{long-short}%
}%
{%
\GlsUseAcrStyleDefs{long-short}%
\renewcommand*{\GenericAcronymFields}{description={\bffirst{\the\glslongtok}}}%
}
\setacronymstyle{bf-long-short}
% Acronym definitions
\newacronym{utc}{UTC}{Coordinated Universal Time}
\newacronym{adt}{ADT}{Atlantic Daylight Time}
\newacronym{est}{EST}{Eastern Standard Time}
\begin{document}
\section*{Section with acronyms}
% Use the acronyms
\gls{utc} is 3 hours behind \gls{adt} and 10 hours ahead of
\gls{est}.
\gls{utc} \gls{utc}
%Print the glossary
\printglossaries
\small\hfill Created by http://texblog.org
\end{document}
This makes the first letter bold for each word of the description when displayed in the list of acronyms but doesn't change the normal behaviour in the main text.
Edit:
If you additionally load the mfirstuc-english
package then \capitalisewords
will ignore words like "a", "an", "of", "in". (If you open mfirstuc-english.sty
in a text editor, you'll see which words have been defined using \MFUnocap
.¹) Additional words can be added, for example,
\MFUnocap{as}
In the case where you have a letter taken from the middle of the word (rather than the initial letter) you will have to manually override the description
for that case:
\newacronym[description={E\textbf{x}tensible \textbf{M}arkup \textbf{L}anguage}]{XML}{XML}{Extensible Markup Language}
Further information about \capitalisewords
, \MFUnocap
and related commands is available in the mfirstuc
user manual which should be located in the same directory as the glossaries
user manual.
¹ Disputed or context-dependent words (such as "up") aren't included by mfirstuc-english
and need to be explicitly added using \MFUnocap
if required.
Best Answer
\Gls
-like commands use\makefirstuc
to capitalize only the first letter of a sentence.I've redefined the meaning of
\makefirstuc
to be the same of\capitalisewords
which instead capitalizes all words in a sentence.So, add this in the preamble
and everything should be as you want.
Complete MWE:
Output: