I am writing an article for MDPI journal and I would like to use my list of glossaries instead of typing them by hand (which is what is done in the template).
I have tried the solution provided here: List of Acronyms but nothing seems to work. I think that I am mixing glossary terms and acronyms and this is why it doesn't work, but I think this is a legitimate thing to do as a lot of glossary terms have acronyms.
My MWE is:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{import}
\usepackage[nopostdot,style=super,nonumberlist,toc]{glossaries}
% Tell glossaries package that glossaries start here
\makeglossaries
% Import the glossaries package
\subimport*{./}{glossary.tex}
\begin{document}
This is an acronym: \gls{dht}.\par
\section{This is how it should look like}
\noindent
\begin{tabular}{@{}ll}
MDPI & Multidisciplinary Digital Publishing Institute\\
DOAJ & Directory of open access journals\\
TLA & Three letter acronym\\
LD & linear dichroism
\end{tabular}
\section{This is how it looks like}
\printglossary[type=\acronymtype]
\end{document}
and glossary.tex contains:
\newglossaryentry{dht}
{
type=\acronymtype,
name={DHT},
first={Distributed Hash Table (DHT)},
long={Distributed Hash Table},
firstplural={Distributed Hash Tables (DHTs)},
plural={DHTs},
description={I want the long here, not the description}
}
I have two separate questions, one regarding style formatting and the other regarding what is shown in the abbreviations table. This SO question refers to the latter. I have also checked: Combined glossary and list of acronyms: Same backlinks for full entry and acronym, or none at all at the latter? but although I think it is related to my question, I can't come with a proper solution as I have not enough expertise.
Best Answer
Use
\newacronym
to define abbreviations with theglossaries
package. Theglossary.tex
file should look like:The document should input this file using just
\input
or\loadglsentries
. Fancier inclusion commands, such as\subimport
or\include
, should be avoided.The document:
The document build process (assuming the file is called
myDoc.tex
):Or (if you don't have Perl):
Result:
If you want all defined entries included, even if they haven't been used in the document, add
\glsaddallunused
at the end of the document:This produces:
The vertical gaps are caused by a change in letter group. Use
nogroupskip
to omit them:If you want the entries listed in order of definition, use
sort=def
:If you want to use the
glossaries-extra
extension package, you need to replace\setacronymstyle
with\setabbreviationstyle[acronym]
:In this case (all defined entries and in order of definition and
nonumberlist
) you can simplify the build process:The build process is now just:
Result:
With
glossaries-extra
, you can change\newacronym
to\newabbreviation
, in which case you also need to change\acronymtype
to\glsxtrabbrvtype
and just use\setabbreviationstyle{long-short}
(without the optional argument).If you have a mixture of some abbreviations with descriptions and some without, the best method is to use
glossaries-extra
, which allows multiple abbreviation styles.For example, use
\newacronym
for terms without a description:with the
acronym
style set tolong-short
:and use
\newabbreviation
for terms with a description:and use the
long-short-desc
style:You might need a different glossary style or split the entries into two glossaries, depending on how they need to be displayed.