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} 
Bob1990
  • 263
  • 1
    Please post the document, not just fragments. You should not use \newacronym after \printglossary, however. Better define the acronyms in the preamble! –  Apr 28 '16 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 '16 at 21:14
  • 1
    Then try to reduce the document (which is the usual procedure here ;-)) –  Apr 28 '16 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 '16 at 21:22
  • 2
    Well, you don't use \gls{LA} and \gls{un} -- unless you specify \glsaddall only ny will be printed. –  Apr 28 '16 at 21:41
  • It does seem to indicate that an entry is created if \printglossary is between \newacronym and \gls. Might be a misprint though, consider investigating on that. (If it's even still relevant, anyway.) – Egor Hans Apr 10 '20 at 07:39
  • Check out the following link, it will automatically creates acronym list. https://www.overleaf.com/latex/examples/automatic-acronym-list-in-latex/dzvxfzpsjrmm – ngh Aug 09 '22 at 18:03

3 Answers3

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

  • 1
    NY only appears still. The number is gone. – Bob1990 Apr 28 '16 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 –  Apr 28 '16 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 '16 at 22:03
  • 1
    @Bob1990: Do you really have \gls{la} etc. too? –  Apr 28 '16 at 22:06
  • 1
    Even if i write out \gls{la} or not it does not matter. LA will not appear in the list, only NY. NY always appears no matter what. – Bob1990 Apr 28 '16 at 22:08
  • 3
    @Bob1990: There's nothing I can do with invisible code -- sorry. –  Apr 28 '16 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

limlian
  • 151
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

Mensch
  • 65,388