40

I'm using the glossaries package with MikTeX 2.9 (using TeXnicCenter as my editor) and my document is setup as follows:

\documentclass[ebook,11pt,openany]{memoir}
\usepackage{color}
\usepackage{graphicx} 
\usepackage[toc]{glossaries}
\usepackage{float}
\usepackage[scaled]{berasans}
\usepackage[T1]{fontenc}
\usepackage{type1cm}
\usepackage{eso-pic}
\usepackage{mystyle}

\author{...} 
\title{...}

\makeatletter
  \AddToShipoutPicture{
    \setlength{\@tempdimb}{.5\paperwidth}
    \setlength{\@tempdimc}{.5\paperheight}
    \setlength{\unitlength}{1pt}
    \put(\strip@pt\@tempdimb,\strip@pt\@tempdimc){
      \makebox(0,0){\rotatebox{55}{\textcolor[gray]{0.85}
        {\fontsize{5cm}{5cm}\selectfont{DRAFT}}}}
    }
  }
\makeatother

\setcounter{tocdepth}{2}
\makeglossaries
\include{glossary}

\begin{document}
\maketitle

\frontmatter
\include{dedication}
\tableofcontents

\mainmatter
\include{introduction}
\include{chaptr1}
...
\backmatter 
\printglossaries

\end{document}

Unfortunately, when I generate my document my PDF doesn't contain a glossary at all. Here's a quick snippet from my glossary file:

\newglossaryentry{entry}
{
  name={entry},
  description={my entry description.}
}

I'm also referencing the glossary entry from my chaptr1.tex file, which is included above, using the \gls{entry} command. I'm not seeing any errors in my build output, so I'm not sure what's going on. Any help would be appreciated.

Werner
  • 603,163
John S
  • 567
  • Kind of. It answers why it's not being generated, but it doesn't quite answer how I can get it to generate. I"m scouring the net right now since this is a MikTeX/TeXnicCenter question, but so far I've had just some false positives. – John S Feb 08 '12 at 02:45
  • 1
    @Werner How about writing a short answer? – lockstep Mar 03 '12 at 22:48
  • I was having the same problem ... ran the multiple steps, no errors, the .glo and .gls files appeared with correct contents, mention of those files in the pdflatex log. Glossary appeared in the pdf ... linked to a blank page. So I finally asked our local latex whiz. He said "this is going to sound insulting, but ... did you try refreshing the pdf file?" For those beating head against desk ... try re-opening the pdf. Apparently some changes refresh on the fly ... others not so much :-) Anonymous –  Jun 27 '12 at 17:19
  • 1
    Here it is answered in detail: http://tex.stackexchange.com/a/112487/61241 – Niklas Peter Aug 25 '14 at 20:23
  • For me, the issue was using \RequirePackage[shortcuts,abbreviations]{glossaries-extra} instead of \RequirePackage[shortcuts]{glossaries-extra} – Sterling Mar 18 '22 at 23:11

2 Answers2

38

Section 6 Displaying the Glossary or List of Acronyms (p 6) of the glossaries documentation mentions the procedure to obtain a glossary. More specifically, you require a four-step compilation:

  1. pdflatex file
  2. makeglossaries file
  3. pdflatex file
  4. pdflatex file

The fourth step may not be required, depending on the size of the glossaries and your document structure.

It is possible to perform the above steps from within TeXnicCenter by adding your own output profile (similar to the existing LaTeX => PDF profile, say). For example, you can include steps 2-4 as part of a batch (.bat) file and then execute the batch file with file parameters as part of the "Postprocessor" sequence.

Another possible issue that is not limited to glossaries but perhaps valid for all (La)TeX usages: Avoid spaces in filenames. This is reported frequently to be the cause for functions refusing to operate properly, when an external program must be called.

Werner
  • 603,163
  • Good answer but how can I run the "makeglossaries" command? If I type it in the command line of Windows (cmd) then it gives me the message: "The Perl interpreter could not be found". I use TeXnicCenter, too. – Benny Code Jan 14 '13 at 16:49
  • @BennyNeugebauer Do you use MiKTeX? There are frequently problems regarding perl scripts in MiKTeX, but the makeglossaries.exe didn’t start perl.exe in a test here, though a Perl distribution is installed. For TeX Live there are no problems known at all. – Speravir Jan 20 '14 at 21:53
  • @Speravir Yes. I used MiKTeX. But I got around the problem now. Answer has been accepted. Thanks! – Benny Code Jan 21 '14 at 10:00
  • This seems very convoluted. Is there an easier (one-step) way to do it? Can it also be achieved with latexmk? – tommy.carstensen Dec 01 '17 at 12:20
  • @tommy.carstensen: I don't find it convoluted since TeX uses external files to work with cross-references. That implies that you have to run the processes separately. Either way, I've not tried it with latexmk, so I don't know whether it can pick up on that. – Werner Dec 01 '17 at 19:55
  • 2
    @Werner It can actually be achieved with latexmk without having to compile twice. The solution is here: https://tex.stackexchange.com/questions/1226/how-to-make-latexmk-use-makeglossaries I think automake in \usepackage[automake]{glossaries} is a necessity for it to work. I haven't tried without. – tommy.carstensen Dec 01 '17 at 20:08
  • @tommy.carstensen: Regarding "compiling twice"; are you referring to the final dual compilation? That may not be necessary; it's just a precaution to make sure any introduction of glossary items didn't cause references to change. If it works with latexmk, I'm sure it'll compile as many times as needed to ensure references are correct. – Werner Dec 01 '17 at 20:13
5

If you're using Texmaker, just create a new command by clicking users->own commands->edit own commands and add the line

pdflatex -synctex=1 -interaction=nonstopmode %.tex|makeglossaries %|pdflatex -synctex=1
-interaction=nonstopmode %.tex|pdflatex -synctex=1 -interaction=nonstopmode %.tex
  • 1
    I have added this command. This is unfortunately not working for me. The command keeps executing for a long time. I have to cancel the process at the end. Any suggestions? – ρss Aug 14 '14 at 12:58
  • It worked perfectly for me – Yacine Jul 01 '17 at 15:00