[Tex/LaTex] Glossary acronym without references

glossaries

Seems silly that I have to ask for such a simple thing but this glossary library is driving me up the wall. What I want to do is to simply display all the acronyms that I have defined after my table of content without having any references to them in my text. So something like this:

...
\usepackage[nonumberlist, acronym]{glossaries}
\newacronym{Foobar}{Foobar}{foo bar}
...
\begin{document}
    \tableofcontents
    \printglossaries
    ...
\end{document}

But no matter how I twist and turn the order it just doesn't display correctly. The few times I got it to display it somehow had ghost entries from previous test.

Best Answer

The \makeglossaries is necessary as well as \glsaddall to show all defined acronyms.

Compilation can be done with several methods, but the easiest way is (assuming the source file is called foo.tex)

pdflatex foo

makeglossaries foo

\documentclass{article}
\usepackage[nonumberlist, acronym]{glossaries}
\newacronym{Foobar}{Foobar}{foo bar}
\newacronym{UNESCO}{Unesco}{United Nations Educational, Scientific and Cultural Organization}
\makeglossaries
\begin{document}
\glsaddall
\tableofcontents
\printglossaries
\end{document}

enter image description here