I have several issues with the glossaries-extra package that I want to customize. You can find the code and the corresponding output below:
- I want to make the list of abbreviations like the list of figures above. There are currently the following differences:
1.1 As you can see, the dot spacing is different, and the dots are not bold.
1.2 In front of the abbreviation is an indentation, which I do not want to have.
1.3 I would like to have the description of the abbreviation flush right.
1.4 I want to change the vertical spacing to 1ex
(like in the list of figures)
I know that you can change an existing glossary style with \newglossarystyle
, but I could not find the appropriate commands for it. I use the style listdotted
. Can I use the following code to customize my top points?
\newglossarystyle{mylist}{
\setglossarystyle{listdotted} % base this style on the listdotted style
% change goes here:
\renewcommand{}{}
}
This code is from here: https://ftp.mpi-inf.mpg.de/pub/tex/mirror/ftp.dante.de/pub/tex/macros/latex/contrib/glossaries/glossaries-user.html#sec:glossarystylecmds
Here you can find all predefined styles, but I think with listdotted
I have the least work?: https://www.dickimaw-books.com/gallery/glossaries-styles/
- My second problem is with the use of abbreviations in the text. In the output, the target and the actual state is shown.
What I want is that only the first time the abbreviation is used, the short form appears in bold text. All subsequent abbreviations should not be bold.
So: The first time the abbreviation is used, the long form is printed in bold with the initial letters and the short form is printed in brackets and bold after that.
At the second use, only the short form is used and not in bold text.
In the list of abbreviations, the short form should be bold, and the description is defined separately (see code).
I hope it is comprehensible and someone can help me with the customizations!
\documentclass[a4paper, 12pt]{article}
\usepackage{graphicx}
\usepackage[left=2.5cm, right=2.5cm, top=2.75cm, bottom=2cm]{geometry}
\usepackage{tocbasic}
\usepackage[ngerman]{babel}
\usepackage[hidelinks]{hyperref}
\usepackage[toc,nogroupskip,xindy,style=listdotted]{glossaries-extra}
% graphics
\graphicspath{ {./images/} }
% set default font
\usepackage{fontspec}
\setmainfont{Arial}
\newfontfamily\schola{TeX Gyre Schola}
\usepackage{setspace}
\onehalfspacing
% set default indent
\setlength{\parindent}{0pt}
% list of figures
\DeclareTOCStyleEntries[
beforeskip=1ex,
linefill=\bfseries\dotfill,
pagenumberformat=\bfseries\schola,
pagenumberbox=\pagenumberbox,
entrynumberformat=\bfseries\figurenumberformat,
numwidth=7em,
indent=0em,
]{tocline}{figure}
\newcommand*\pagenumberbox[1]{\mbox{\hspace{0em}#1}}
\newcommand*{\figurenumberformat}[1]{\mbox{Abbildung #1}:}
% list of abbreviations
\makeglossaries
\newabbreviation
[description={Federal Bureau of Investigation -- Investigative and National Security Components}]
{fbi}{\textbf{FBI-INC}}{\textbf{F}ederal \textbf{B}ureau of \textbf{I}nvestigation -- \textbf{I}nvestigative and \textbf{N}ational Security \textbf{C}omponents}
\newabbreviation
[description={LongDescriptionThatExtendsIntoTheMargin}]
{usa}{\textbf{USA}}{\textbf{U}nited \textbf{S}tates of \textbf{A}merica}
\newabbreviation
[description={United States}]
{us}{\textbf{US}}{\textbf{U}nited \textbf{S}tates}
\begin{document}
% Table of figures
\addcontentsline{toc}{section}{\listfigurename}
\listoffigures
% List of abbreviations
\printglossary[title={Abkürzungsverzeichnis}]
% TARGET-ACTUAL comparison
\section{TARGET}
First use: The \textbf{F}ederal \textbf{B}ureau of \textbf{I}nvestigation -- \textbf{I}nvestigative and \textbf{N}ational Security \textbf{C}omponents (\textbf{FBI-INC}) protects the \textbf{U}nited \textbf{S}tates (\textbf{US}) (or \textbf{U}nited \textbf{S}tates of \textbf{A}merica (\textbf{USA})) through investigations and national security.
\vspace{\baselineskip}
Second use: The FBI-INC protects the US (or USA) through investigations and national security.
\section{ACTUAL}
First use: The \gls{fbi} protects the \gls{us} (or \gls{usa}) through investigations and national security.
\vspace{\baselineskip}
Second use: The \gls{fbi} protects the \gls{us} (or \gls{usa}) through investigations and national security.
\begin{figure}[ht]
\centering
\includegraphics[height=1cm]{overleaf-logo}
\caption{Caption}
\end{figure}
\end{document}
Best Answer
You've pretty much solved the first part of your question concerning the list in your own answer. The one thing missing is that you can control the vertical separation through redefining the
theglossary
environment asusing
enumitem
for convenience.I'm less convinced that redefining
\gls
is either particularly effective or indeed a good idea at all. The more desirable approach would be to create a customabbreviationstyle
based on thelong-short
style which uses a bold font explicitly for the abbreviation in the first appearance.The approach is similar for
glossaries
, redefining\firstacronymfont
instead.Giving in full