10

I want to add an list of acronyms that I can reference to continously in the text.

Say if I write in the glossary \newacronym{ny}{NY}{New York} NY will appear in the document when I type \gls{ny}.

I have the following code in the preamble:

\usepackage[acronym]{glossaries}
\makeglossaries

And inside the document where i want to place the list i type:

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

\newacronym{ny}{NY}{New York}
\newacronym{la}{LA}{Los Angeles}
\newacronym{un}{UN}{United Nations}

But only NY appears in the acronym list and it has a 1 after it:

NY New York. 1

But i want it to be:

NY New York

Neither LA nor UN appears in the list even if I write them in the text. Can someone explain why this is happening?

Complete code:

\documentclass{article} % Load the package 
\usepackage[acronym]{glossaries} 
\makeglossaries
\begin{document} 

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

 % abbreviations: 
\newacronym{ny}{NY}{New York}
\newacronym{la}{LA}{Los Angeles}
\newacronym{un} {UN}{United Nations}

\gls{ny}

\end{document} 
7
  • 1
    Please post the document, not just fragments. You should not use \newacronym after \printglossary, however. Better define the acronyms in the preamble!
    – user31729
    Apr 28, 2016 at 21:13
  • 1
    My document is really big, I cant post everything here. The usepackage part is inside a settings.tex file and the useacronym part is inside a acronym.tex file that is \input in the main.tex.
    – Bob1990
    Apr 28, 2016 at 21:14
  • 1
    Then try to reduce the document (which is the usual procedure here ;-))
    – user31729
    Apr 28, 2016 at 21:17
  • 1
    \documentclass{article} % Load the package \usepackage[acronym]{glossaries} \makeglossaries \begin{document} \printglossary[type=\acronymtype,title=Acronyms] % abbreviations: \newacronym{ny}{NY}{New York} \newacronym{la}{LA}{Los Angeles} \newacronym{un}{UN}{United Nations} \gls{ny} \end{document}
    – Bob1990
    Apr 28, 2016 at 21:22
  • 2
    Well, you don't use \gls{LA} and \gls{un} -- unless you specify \glsaddall only ny will be printed.
    – user31729
    Apr 28, 2016 at 21:41

3 Answers 3

11

No \gls{foo} or \glsaddall → no displayed glossary entry for this key.

Use nonumberlist to suppress the page number at the end of the displayed glossary entry.

\documentclass{article}

\usepackage[acronym,nomain,nonumberlist]{glossaries}
\makeglossaries


\newacronym{ny}{NY}{New York}
\newacronym{la}{LA}{Los Angeles}
\newacronym{un}{UN}{United Nations}


\begin{document}

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

enter image description here

6
  • 1
    NY only appears still. The number is gone.
    – Bob1990
    Apr 28, 2016 at 21:58
  • 2
    @Bob1990: Well, then something is wrong with your code that is not shown, however. As I said in the comments above: Do not use \newacronym in the document body, perhaps that's the cause. As you can see from my screen shot, the code I posted works. (Using TL 2015 (frozen state) on Linux
    – user31729
    Apr 28, 2016 at 22:00
  • 1
    I tried to put \newacronym outside the document body but it didn't help. I am clueless right now. It is strange that it doesn't work, it should be easy to fix.
    – Bob1990
    Apr 28, 2016 at 22:03
  • 1
    @Bob1990: Do you really have \gls{la} etc. too?
    – user31729
    Apr 28, 2016 at 22:06
  • 3
    @Bob1990: There's nothing I can do with invisible code -- sorry.
    – user31729
    Apr 28, 2016 at 22:10
4

It works for me!!!!

\documentclass[12pt,a4paper]{report}
\usepackage{acronym}
\begin{document}
\begin{acronym}[ NY]  
\acro { NY }        New York
\acro { LA }        Los Angeles
\acro { UN }        United Nations    
\end{acronym}
\end{document}

output

1
  • this package is much better. BTW how to add a title? Aug 22, 2022 at 12:07
3

A simple solution would be using nopostdot as option

\usepackage[acronym,nopostdot]{glossaries}

The reason only NY shows up in your Acronyms list is that you didn't use LA or UN with the \gls{} command. \glsaddall also mentions unused glossary entries

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .