4

After spending lots of time searching for a solution, I still haven't found anything that really suits my problem. The goal is pretty simple: I would like to generate a List of Acronyms which consist of a title, description and acronym entries. With the following code I have almost achieved desired results except the distance between acronym entries and the description is not vertically aligned. Here is the code for setting up the glossary design:


% Preamble
\documentclass[11pt, a4paper, twoside]{report}

% Package for acronyms
\usepackage[acronym, automake, nopostdot, nogroupskip]{glossaries}

\makeglossaries

\renewcommand*{\glsnamefont}[1]{\normalfont#1}
\renewcommand\glstreepredesc{\hspace{4cm}}          
\setglossarypreamble[acronym]{\textbf{Acronym}\hspace{3.3cm}\textbf{Description\vspace*{0.3cm}}}

\newacronym{ADF}{ADF}{Automatic Direction Finder}
\newacronym{ADI}{ADI}{Automatic Direction Indicator}

\begin{document}

\printglossary[type=\acronymtype, title={Table of Acronyms}, nonumberlist, style=index]
\bigskip
Here, we use the acronym \acrfull{ADF}. The second acronym is \acrfull{ADI}. After the first usage of the 1st acronym, only the short version is used: \acrshort{ADF}.

\end{document}

In the following result picture one can see that the first letters of both descriptions are not vertically aligned:

enter image description here

The question is: how to make them vertically aligned? Thanks in advance!

4
  • Please convert your code into a complete minimal working example (MWE) including the document class etc. needed to reproduce the current behaviour.
    – epR8GaYuh
    Dec 18, 2019 at 11:44
  • @epR8GaYuh, I just edited my original question, now it contains a working MWE.
    – nickname
    Dec 18, 2019 at 12:04
  • Have you tried the option style=longheader?
    – Enzo
    Dec 18, 2019 at 12:18
  • @Enzo, This looks like a nice option. Thank you! Do you know how to make it left justified and increase space between acronym entries and descriptions? And also how to adjust vertical spacing betwen the header and the acronym list?
    – nickname
    Dec 18, 2019 at 13:02

1 Answer 1

1

The longraggedheader style is what you are looking for. It is similar to the longheader style but aligns everything left.

In order to change the vertical spacing you can redefine \glossaryheader to your liking:

% Set the table's header:
\def\spacing{10pt}% Here you can change the vertical spacing after the header
\renewcommand*{\glossaryheader}{%
    \bfseries Acronym & \bfseries Description \\[\spacing]\endhead%
}%

If you want to change the horizontal spacing, you need to redefine how the style calls longtable:

% put the glossary in a longtable environment:
\def\acrowidth{1cm}% This is the spacing
\renewenvironment{theglossary}%
{\begin{longtable}{p{\acrowidth}p{\glsdescwidth}}%
{\end{longtable}}%
2
  • Thanks for the answer. However, the first code block doesn't seem to make any difference. And the second one outputs following error: ! File ended while scanning use of \@newenv. in the first line. Could you please explain how to use them?
    – nickname
    Dec 23, 2019 at 6:53
  • Both code snippets must be placed outside the \begin{document} ... \end{document}. I don't know if that is the case but it's worth double checking
    – Enzo
    Jan 6, 2020 at 9:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.