TeX - LaTeX Asked by Thili on April 22, 2021
documentclass{report}
usepackage[acronym]{glossaries}
makeglossary
newacronym{svm}{SVM}{Support Vector Machine}
newacronym{wasn}{WASN}{Wireless Sensor Networks}
begin{document}
printglossaries
newpage
using gls{svm} blah blah gls{wasn}blah blah.....gls{svm}
end{document}
I am testing with above MWE. The acronyms are correctly displayed in the document body when compiled, but nothing gets printed where I need the List of Acronyms.
I am using TexMakerX as my IDE on Windows 7.
Once I compile the above code a .glo
file is created but it is empty. I think this is the problem but I don’t know why it is happening.
Creating a list of acronyms (or glossary) is a three stage process (at least):
makeglossaries
Perl script or the makeglossaries-lite
Lua script.(You may need to repeat step 3.) Every time you modify the document in a way that alters the list (for example, adding or deleting instances of gls
, or removing or inserting text that results in a change in the associated page numbers) then you need to repeat all three steps in order to update the list.
The command makeglossaries
in your document creates some glossary-related files (.glo
or .acn
) and each time you use commands like gls
an entry is added to the relevant file when the document is typeset (in step 1).
In step 2 a special indexing application is run that reads in those glossary-related files and writes another file (.gls
or .acr
) with the LaTeX code required to typeset the glossary or list of acronyms. This file is then input in your document in step 3.
Step 2 causes the most confusion as it requires running a command line script. However, most front-ends have a button or menu item you can click that will run the script for you. Most front-ends need to be configured to run makeglossaries
or makeglossaries-lite
. The following TeX.SE answers provide instructions for integrating makeglossaries
on various front-ends.
For WinEdt, have a look at the comp.text.tex thread Executing Glossaries' makeindex from a WinEdt macro.
For other front-ends, see Incorporating makeglossaries or makeglossaries-lite or bib2gls into the document build.
In each of the above cases, you need to have Perl installed if you use makeglossaries
(but not makeglossaries-lite
) or if you want to use xindy
instead of the default makeindex
.
Since makeglossaries-lite
is a Lua script, you should already have a Lua interpreter if you have a modern TeX distribution with LuaTeX. If you want to use makeglossaries-lite
instead, you should just be able to replace all references to makeglossaries
with makeglossaries-lite
, although it has fewer options and doesn't provide diagnostic tools, so it's not as useful if things go wrong. (Note that makeglossaries-lite
was added to glossaries
version 4.16, so it won't be available for older versions.)
Another possibility if you are having difficulty with step 2 is to add the package option automake
to glossaries
:
usepackage[automake]{glossaries}
(Introduced in glossaries
version 4.08.) This will try to get TeX to run the external applications (step 3 is still required) but this won't work if the shell escape is disabled. This option also won't work with xindy
in the restricted mode, since xindy
isn't on the list of trusted applications.¹ With both xindy
and automake
, you would need the less secure unrestricted mode, which I don't recommend for security reasons.
Alternatively, there's a GUI approach that uses Java rather than Perl. See also What can interfere with glossaries to prevent printing?
¹This is the case with TeX Live. I don't know about MiKTeX.
Answered by Nicola Talbot on April 22, 2021
Your MWE can be compiled even without the need of makeglossaries
application (and so without the need of having Perl installed), exploiting makeindex
.
In fact, running
pdflatex <yourfile>
makeindex.exe -s <yourfile>.ist -o <yourfile>.acr <yourfile>.acn
pdflatex <yourfile>
pdflatex <yourfile>
works the same.
Answered by karlkoeller on April 22, 2021
I'll add an answer that worked for me, since there appears to be no accepted answer to this question and this question was the first one to pop up in a web-search.
The glossaries package documentation states the following about using Hyperref:
Take care if you use the glossaries package with hyperref. Contrary to the usual advice that hyperref should be loaded last, glossaries (and glossaries-extra) must be loaded after hyperref.
and the following about displaying entries:
- Add
makenoidxglossaries
to your preamble (before you start defining your entries, as described in Section 2).- Put:
printnoidxglossary[sort=〈order〉,〈other options〉]
where you want your list of entries to appear. Alternatively, useprintnoidxglossaries
Following these instructions resolved the issue for me.
Note: I'm using Overleaf so I have no control over package versions. They seem to use package version v4.41+. Which is why this works for me. I cannot confirm if this works for lower version numbers.
Answered by Byebye on April 22, 2021
I am also an overleaf user, and had a similar issue. I find Byebye's answer useful.
An alternative to using makenoidxglossaries
and printnoidxglossary
is adding option 'automake', which worked for me: usepackage[automake]{glossaries}
(preamble) + makeglossaries
(preamble) + printglossaries
(where you want to print glossary).
Answered by Ziiiii on April 22, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP