1

I have the wish to use an effective method to create a glossary and be able to classify the different "types" of entries in different lists (abbreviations, acronyms, symbols, glossary, etc.).

I followed two posts that are fantastic and that I advise:

The first one, shows how to classify the different entries using .bib files for symbols. I followed it using the method 4. The second post shows how to follow this method generating a glossary that would contain symbols, acronyms, definitions, etc.

I am new with LaTex but I've learned a lot by following these methods (thanks a lot Nicola Talbot). I am almost there, but I still have some errors in the result. I've created test files to test what I would like to achieve.

Here is the code I am testing:

\documentclass{report}

\usepackage{amssymb}
\usepackage{siunitx}


\usepackage[record,abbreviations,acronyms,symbols,stylemods={tree},style=treegroup]{glossaries-extra}


% always set the abbreviation style before \GlsXtrLoadResources
\setabbreviationstyle{short-long-desc}
\setabbreviationstyle[acronym]{short-long}


% Assign group titles:
\glsxtrsetgrouptitle{latin}{Latin Symbols}
\glsxtrsetgrouptitle{greek}{Greek Symbols}

\GlsXtrLoadResources[
  src={no-interpret-preamble,glossary},% bib files
  sort={en-US},% sort according to this locale
  set-widest,% needed for 'alttree' styles
%  save-locations=false % use this command to pring only the acronyms you are using
  selection=all% select all entries in the .bib files
]


\GlsXtrLoadResources[
 src={symbols-greek},
 sort={letter-case}, % sort according Unicode value
 field-aliases={
   unitname=name,
   unitsymbol=symbol,
   measurement=description
 },
 symbol-sort-fallback=name,
 type=symbols,
 group=greek,
 set-widest,% needed for 'alttree' styles
 save-locations=false % pring only used symbols.
]

\GlsXtrLoadResources[
 src={symbols-latin},
  sort={letter-case},% sort according Unicode value
  symbol-sort-fallback=name,
  type=symbols,
  group=latin,
  set-widest,% needed for 'alttree' styles
  selection=all% select all entries in the .bib files
]




\begin{document}

\section*{Examples}
In this section, I will use the following greek symbols: \gls{alpha}, \gls{alphalin} and \gls{delta}.

One acronym is for example \glstext{ad} and one abbreviation is given by \glstext{html}.



\printunsrtglossary[type=acronyms,style=alttree,title={List of Acronyms}]
\printunsrtglossary[type=abbreviations,style=alttree,title={List of Abbreviations}]
\printunsrtglossary[style=alttree,title={Glossary}] % By not specifing the type, I pring only the entries
\printunsrtglossary[type=symbols,style=alttreegroup,title={List of Symbols}]
\end{document}

You can find the file no-interpret-preamble.bib here. The files glossary.bib, symbols-latin.bib and symbols-greek.bib look like that (inspired from the work of Nicola Talbot):

glossary.bib:

% glossary.bib

% This file is public domain. See the "Examples" chapter
% in the bib2gls user manual for a more detailed description
% of this file.

% Encoding: UTF-8

@preamble{"\providecommand{\abbrvtag}[1]{#1}"}
@string{markuplang="\abbrvtag{m}arkup \abbrvtag{l}anguage"}

@entry{TeX,
  name={{}\TeX},
  description={a format for describing complex type and page layout
    often used for mathematics, technical, and academic publications},
  identifier={markuplanguage}
}

@entry{LaTeX,
  name={{}\LaTeX},
  description={a format of \glstext{TeX} designed to separate
   content from style},
  identifier={markuplanguage}
}

@entry{markdown,
  name={markdown},
  description={a lightweight markup language with plain text
    formatting syntax},
  identifier={markuplanguage}
}


@acronym{ad,
  short={AD},
  long={Affinity Diagram},
  description={Tool that gathers large amounts of language data and organizes them into groupings based on their natural relationships},
  identifier={acronym}
}

@acronym{dom,
  short={DOM},
  long={Document Object Model},
  description={Cross-platform and language-independent application programming interface},
  identifier={acronym}
}


@acronym{spa,
  short={SPA},
  long={Single Page Application},
  description={Web applicaiton of web site that interacts with the user by dynanically rewriting the current page},
  identifier={acronym}
}


@acronym{svp,
  short={SVG},
  long={Scalable Vector Graphics},
  description={{}\glstext{xml}-based vector image format for two-dimensional graphics with support for interactivity and animation},
  identifier={acronym}
}

@abbreviation{xml,
  short={XML},
  long={e\abbrvtag{x}tensible }#markuplang,
  description={a markup language that defines a set of rules for
    encoding documents},
  identifier={markuplanguage}
}

@abbreviation{html,
  short={HTML},
  long={\abbrvtag{h}yper\abbrvtag{t}ext }#markuplang,
  description={the standard markup language for creating web pages},
  identifier={markuplanguage}
}

@abbreviation{mathml,
  short={MathML},
  long={\abbrvtag{m\NoCaseChange{ath}}ematical }#markuplang,
  description={markup language for describing mathematical notation},
  identifier={markuplanguage}
}

@abbreviation{xhtml,
  short={XHTML},
  long={e\abbrvtag{x}tensible \abbrvtag{h}yper\abbrvtag{t}ext }
    # markuplang,
  description={{}\glstext{xml} version of \glstext{html}},
  identifier={markuplanguage}
}

symbols-greek.bib:

% symbols-greek.bib

% Put here all greek symbols
% Encoding: UTF-8

@symbol{alpha,
 name={\ensuremath{\alpha}},
 description={angular acceleration},
 indentifier={mathgreek}
}
@symbol{alphalin,
 name={\ensuremath{\alpha_{L}}},
 description={linear coefficient of thermal expansion},
 indentifier={mathgreek}
}
@symbol{delta,
 name={\ensuremath{\delta}},
 description={Kronecker delta},
 indentifier={mathgreek}
}
@symbol{lambda,
 name={\ensuremath{\lambda}},
 description={Lagrange multiplier},
 indentifier={mathgreek}
}
@symbol{chi,
 name={\ensuremath{\chi}},
 description={chromatic number},
 indentifier={mathgreek}
}
@symbol{rho,
 name={\ensuremath{\rho}},
 description={density},
 indentifier={mathgreek}
}
@symbol{zeta,
 name={\ensuremath{\zeta}},
 description={Riemann zeta function},
 indentifier={mathgreek}
}

symbols-latin.bib:

% symbols-latin.bib

% Put here all latin symbols
% Encoding: UTF-8

@symbol{x,
 name={\ensuremath{x}},
 description={position},
 indentifier={mathlatin}
}
@symbol{v,
 name={\ensuremath{v}},
 description={velocity},
 indentifier={mathlatin}
}
@symbol{a,
 name={\ensuremath{a}},
 description={acceleration},
 indentifier={mathlatin}
}
@symbol{t,
 name={\ensuremath{t}},
 description={time},
 indentifier={mathlatin}
}
@symbol{E,
 name={\ensuremath{E}},
 description={Young's modulus},
 indentifier={mathlatin}
}
@symbol{F,
 name={\ensuremath{F}},
 description={force},
 indentifier={mathlatin}
}
@symbol{Tm,
 name={\ensuremath{T_{m}}},
 description={melting point temperature},
 indentifier={mathlatin}
}
@symbol{KIC,
 name={\ensuremath{K_{IC}}},
 description={stress intensity factor},
 indentifier={mathlatin}
}
@symbol{Z,
 name={\ensuremath{Z}},
 description={atomic number},
 indentifier={mathlatin}
}

However, the obtained result is not satisfactory.

What am I doing wrong? Why I cannot obtain a list of acronyms? How can I make the list of abbreviations readable?

I would be very thankful for your help. I am almost there...

1

You should find some warnings in the transcript:

Package glossaries-extra Warning: Glossary type `acronyms' doesn't exist on input line 65.
Package glossaries-extra Warning: No entries defined in glossary `acronyms' on input line 65.

The label for the acronyms glossary is acronym not acronyms so you need:

\printunsrtglossary[type=acronym,style=alttree,title={List of Acronyms}]

or

\printunsrtglossary[type=\acronymtype,style=alttree,title={List of Acronyms}]

The set-widest option tries to determine which entry has the widest name, but bib2gls doesn't know the name for abbreviations/acronyms (since it doesn't have access to the style information set in the document) so it assumes that the name is just the short form by default so it doesn't take the long form into account when performing the measurements. However, the alttree style isn't suitable for abbreviations with descriptions because you'd end up with only a tiny amount of space for the description. It's better to use a running style (such as tree) or a style that puts a break before the description (such as altlist).

For example:

\printunsrtglossary[type=abbreviations,style=altlist,title={List of Abbreviations}]

Incidentally, it's best not to use \glstext with abbreviations. If you only want the short form shown (regardless of whether the abbreviation has been used) then use \gls with one of the short-nolong styles.¹ (If you want to ensure the short form for captions or headings use \glsfmtshort.) Using \gls rather than \glstext helps to ensure the abbreviation style is correct.


¹There's a bug in the short-nolong-desc style that's fixed in glossaries-extra v1.39.

  • Hi Nicola, thanks for the answer. I implemented your suggestions. However, there is still a problem with the list of acronyms. Despite of '\setabbreviationstyle[acronym]{short-long}', the list of acronyms is printed with short and description, instead of short and long. Where does the problem come from? – Elfo2285 Mar 22 at 19:23
  • @Elfo2285 The short-long style is designed for terms that don't have the description field explicitly set. If you have a separate description then you need to use the short-long-desc style. – Nicola Talbot Mar 23 at 10:12
  • Hi Nicola. Ok, I removed the description of acronyms and now it works. However, I still have a small problem. It is just cosmetic. For the list of acronyms, all my acronyms are separate with the same line space, except when I have acronyms starting with the same letter. In this case I do not have a line space anymore. In my example, AD, DOM and SPA are separate with the same line space, while for SPA and SVG, there is no line space. Is there a way to have the same line space everywhere? – Elfo2285 Mar 26 at 10:30
  • @Elfo2285 Use the nogroupskip option. – Nicola Talbot Mar 30 at 10:01

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.