1

I am writing few acronyms in my text and I don't want to cross reference them. But just want to have their list printed in the pdf (pdfLatex) output .

I tried with \acro and [acronym]{glossaries} packages but didn't get an acronyms list. I just got the text "NY and LA are in US."

Suggestion please?

Here is a compilable example:

\documentclass[
fontsize=11pt,   % Schriftgröße
paper=a4    
%......
]{scrbook}
\usepackage[acronym]{glossaries}

\begin{document}

\newacronym{ny}{NY}{New York}
\newacronym{la}{LA}{Los Angeles}
\newacronym{us}{US}{United States}

 \section{A}
 NY and LA are in US. 

\printglossary[type=\acronymtype,title=Abbreviations]

 \end{document}
2

The glossaries package (and its extension glossaries-extra) provides commands to index and reference terms or abbreviations. This is done by first defining the entries and then using markup commands like \gls within the document.

Here's the modified MWE (thank you for providing one!)

\documentclass[fontsize=11pt,paper=a4]{scrbook}

\usepackage[acronym,automake]{glossaries}

\makeglossaries

\newacronym{ny}{NY}{New York}
\newacronym{la}{LA}{Los Angeles}
\newacronym{us}{US}{United States}

\begin{document}

 \section{A}
 \gls{ny} and \gls{la} are in \gls{us}. 

\printglossary[type=\acronymtype,title=Abbreviations]

 \end{document}

In order to make the glossary (list of abbreviations) appear. You need the following build sequence:

  1. pdflatex
  2. makeglossaries (a Perl script that automatically runs makeindex or xindy according to the document settings)
  3. pdflatex

The second step sometimes causes confusion, so there's an automake package option, which will use TeX's shell escape to automatically run makeindex or xindy for you.

If those steps are successful, the above produces:

New York (NY) and Los Angeles (LA) are in United States (US).

on the first page and

image of list of abbreviations

on the last page.

Note I've moved the \newacronym definitions to the preamble. If you want them in the document use the following instead:

\documentclass[fontsize=11pt,paper=a4]{scrbook}

\usepackage[acronym,automake,docdef=restricted]{glossaries-extra}

\makeglossaries

% set the "short" style:
\setabbreviationstyle[acronym]{short}

\begin{document}
\newacronym{ny}{NY}{New York}
\newacronym{la}{LA}{Los Angeles}
\newacronym{us}{US}{United States}


 \section{A}
 \gls{ny} and \gls{la} are in \gls{us}. 

\printglossary[type=\acronymtype,title=Abbreviations]

 \end{document}

Alternatively:

\documentclass[fontsize=11pt,paper=a4]{scrbook}

\usepackage[abbreviations,automake,docdef=restricted]{glossaries-extra}

\makeglossaries

% set the "short" style:
\setabbreviationstyle{short}

\begin{document}
\newabbreviation{ny}{NY}{New York}
\newabbreviation{la}{LA}{Los Angeles}
\newabbreviation{us}{US}{United States}


 \section{A}
 \gls{ny} and \gls{la} are in \gls{us}. 

\printabbreviations
\end{document}

Note that only those entries that have been explicitly marked with commands like \gls are added to the list.

If you get the error message:

LaTeX Error: Unknown option `automake' for package `glossaries'.

then your version of glossaries is too old. If you don't get this message and you are using automake but your list of abbreviations is still missing, check the log file for lines starting with runsystem. If it has disabled at the end of the line then the shell escape has been disabled, in which case you'll need to find a way to run makeindex or makeglossaries. Related resources:

If you're not interested in the indexing and referencing commands provided by glossaries (such as \gls), then you don't actually need glossaries. For example:

\documentclass[fontsize=11pt,paper=a4]{scrbook}

\newenvironment{abbrevlist}
{%
  \chapter*{List of Abbreviations}
  \newcommand\entry[2]{\item[##1] ##2}%
  \begin{description}%
}
{\end{description}}

\begin{document}


 \section{A}
 NY and LA are in US.

\begin{abbrevlist}
\entry{LA}{Los Angeles}
\entry{NY}{New York}
\entry{US}{United States}
\end{abbrevlist}

\end{document}

This only requires one run of pdflatex and no extra applications. This produces:

image of list of abbreviations

  • Thanks man. But as I mentioned in the question, I don't want to cross reference the acronyms. I don't want \gls{ny} and \gls{la} are in \gls{us}. but just the text and the list of acronyms. If I do the way you mentioned, it shows both the complete form and acronyms short form New York (NY). I just need NY in the main text and the complete description in the output acronyms list. @Nicola Talbot – Yousaf Oct 8 '16 at 15:00
  • 1
    @ArslanYousaf In the second example, change \setabbreviationstyle[acronym]{long-short} to \setabbreviationstyle[acronym]{short}. – Nicola Talbot Oct 9 '16 at 11:11
  • Please compile the above mentioned code. It does not generate any acronym list for me. Sometimes LaTex is just a pain for me! – Yousaf Oct 9 '16 at 19:35
  • Short or long-short comes after. But I didn't even get at-least an acronyms list. – Yousaf Oct 9 '16 at 19:42
  • 2
    @ArslanYousaf Did you run makeglossaries? You can add automake to the package options to do this automatically. – Nicola Talbot Oct 11 '16 at 9:18

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.