1

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.

1

Use \newacronym to define abbreviations with the glossaries package. The glossary.tex file should look like:

\newacronym{dht}{DHT}{Distributed Hash Table}
\newacronym{mdpi}{MDPI}{Multidisciplinary Digital Publishing Institute}
\newacronym[longplural={Directories of open access journals}]
 {doaj}{DOAJ}{Directory of open access journals}
\newacronym{tla}{TLA}{Three letter acronym}
\newacronym{ld}{LD}{linear dichroism}

The document should input this file using just \input or \loadglsentries. Fancier inclusion commands, such as \subimport or \include, should be avoided.

The document:

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage[nopostdot,style=super,nonumberlist,toc]{glossaries}

\makeglossaries

\setacronymstyle{long-short}
\input{glossary}% input definitions

\begin{document}
First use: \gls{dht}. Next use: \gls{dht}.

Reset.\glsreset{dht}

First use plural \glspl{dht}. Next use plural: \glspl{dht}.

\printglossary[type=\acronymtype,title={List of Acronyms}]
\end{document}

The document build process (assuming the file is called myDoc.tex):

pdflatex myDoc
makeglossaries myDoc
pdflatex MyDoc

Or (if you don't have Perl):

pdflatex myDoc
makeglossaries-lite myDoc
pdflatex myDoc

Result:

image of document

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:

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage[nopostdot,style=super,nonumberlist,toc]{glossaries}

\makeglossaries

\setacronymstyle{long-short}
\input{glossary}% input definitions

\begin{document}
First use: \gls{dht}. Next use: \gls{dht}.

Reset.\glsreset{dht}

First use plural \glspl{dht}. Next use plural: \glspl{dht}.

\printglossary[type=\acronymtype,title={List of Acronyms}]
\glsaddallunused
\end{document}

This produces:

image of document

The vertical gaps are caused by a change in letter group. Use nogroupskip to omit them:

\usepackage[nopostdot,style=super,nonumberlist,toc,nogroupskip]{glossaries}

If you want the entries listed in order of definition, use sort=def:

\usepackage[nopostdot,style=super,nonumberlist,toc,nogroupskip,sort=def]{glossaries}

If you want to use the glossaries-extra extension package, you need to replace \setacronymstyle with \setabbreviationstyle[acronym]:

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage[style=super,nonumberlist,nogroupskip,sort=def]{glossaries-extra}

\makeglossaries

\setabbreviationstyle[acronym]{long-short}
\input{glossary}% input definitions

\begin{document}
First use: \gls{dht}. Next use: \gls{dht}.

Reset.\glsreset{dht}

First use plural \glspl{dht}. Next use plural: \glspl{dht}.

\printglossary[type=\acronymtype,title={List of Acronyms}]
\glsaddallunused
\end{document}

In this case (all defined entries and in order of definition and nonumberlist) you can simplify the build process:

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage[style=super,nogroupskip,sort=none]{glossaries-extra}

\setabbreviationstyle[acronym]{long-short}
\input{glossary}% input definitions

\begin{document}
First use: \gls{dht}. Next use: \gls{dht}.

Reset.\glsreset{dht}

First use plural \glspl{dht}. Next use plural: \glspl{dht}.

\printunsrtglossary[type=\acronymtype,title={List of Acronyms}]
\end{document}

The build process is now just:

pdflatex myDoc

Result:

image of document

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:

\newacronym{dht}{DHT}{Distributed Hash Table}

with the acronym style set to long-short:

\setabbreviationstyle[acronym]{long-short}

and use \newabbreviation for terms with a description:

\newabbreviation[description={description text here}]{tla}{TLA}{Three letter acronym}

and use the long-short-desc style:

\setabbreviationstyle{long-short-desc}

You might need a different glossary style or split the entries into two glossaries, depending on how they need to be displayed.

  • Thank you for the long response. What happens if I want acronyms to have a description? I mean, what happens if I also want to use them in a glossary? – vicaba Jan 25 '18 at 10:39
  • @vicaba I've updated my answer. If they all have descriptions, then just change the style from long-short to long-short-desc, otherwise if you want a mixture you can use glossaries-extra as in the appended part of my answer. There are a lot of styles to choose from. You might want to have a look at Abbreviation Styles – Nicola Talbot Jan 25 '18 at 10:53

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.