# VS Code - LaTeX Workshop usage of glossaries package

If you are wondering, I am aware of List of glossaries not displaying and VS Code - Latex Workshop - custom recipes file location. Unfortunately, neither solves my problem.

I am using the LaTeX Workshop extension of VS Code (on my Mac if that matters) and am trying to make a glossary from the glossaries package show up. Everything from said package except the glossary at the bottom of the document appears to be working. I believe, based on my reading on GitHub, that the problem is that the makeglossaries script is not being run when I compile my .tex file. Unfortunately, that GitHub link is more than a little above my head (actually I have next to no idea what it is saying), and could use some help implementing its solution (or would appreciate a different solution, if there is a better one).

By clicking on the Settings gear on the LaTeX Workshop extension, I have managed to open settings.json, which currently contains the following miscellaneous settings, which I guess I must have set at some point.

{
"latex-workshop.view.pdf.viewer": "tab",
"window.zoomLevel": 1,
"cSpell.userWords": [
"parameterizations",
"parameterizes"
],

"editor.snippetSuggestions": "top",
"editor.largeFileOptimizations": false
}


If you're curious about my current .tex file that is failing, it is the first MWE from the Overleaf Glossaries page, pasted below for convenience.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{glossaries}

\makeglossaries

\newglossaryentry{latex}
{
name=latex,
description={Is a mark up language specially suited
for scientific documents}
}

\newglossaryentry{maths}
{
name=mathematics,
description={Mathematics is what mathematicians do}
}

\title{How to create a glossary}
\author{ }
\date{ }

\begin{document}
\maketitle

The \Gls{latex} typesetting markup language is specially suitable
for documents that include \gls{maths}.

\clearpage

\printglossaries

\end{document}


I'm guessing that the things that I've listed may be helpful, but if I can provide anything else, please leave a comment letting me know! By the way, I managed to get the glossary to show up once by pasting something into settings.json, so I know its possible, but I'm not sure what that piece of code was, and I have not been able to replicate the result.

Thanks in advance!

• Which recipe do you use for compiling? latexmk? Apr 2, 2020 at 19:29
• @Wulle I'm not quite sure. I press Cmd + Alt + B to compile. If this doesn't answer your question, how can I find out which recipe I use? Apr 2, 2020 at 19:31
• Just as an fyi, you have to insert \gls{yourglosentry} somewhere to trigger it being displayed. Feb 16, 2021 at 14:48

## 1 Answer

When you compile with LaTeX Workshop, the extension needs to know, what commands it is supposed to run and in which order. Therefore you have to use so called "recipes" (defines which command, how often and in which order) which consist of different "tools" (one command with some options). You can define both in the settings.json (which you already found). What you want to do now is to define a recipe which runs pdflatex first, then makeglossaries and after that (maybe biber and) pdflatex (twice) again. This is described on the Github page of your third link. The minimum you would need is:

"latex-workshop.latex.recipes":[
{
"name": "pdflatex, makeglossaries, pdflatex (2x)",
"tools": [
"pdflatex",
"makeglossaries",
"pdflatex",
"pdflatex"
]
},
],
"latex-workshop.latex.tools":[
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
},
{
"name": "makeglossaries",
"command": "makeglossaries",
"args": [
"%DOCFILE%"
]
}
],


Put it in your settings.json and don't forget to "reload" the window (press CTRL+SHIFT+P and search for it). After that you will have the recipe under the TeX-Extension-Menu (in the left toolbar) under "Build LaTeX project"

You might also want to add other recipes. For example for only one pdflatex run (which will be faster).

{
"name": "pdflatex",
"tools":[
"pdflatex",
]
},


I hope it helps!

• This seemed to mostly work. I'm not quite sure what you mean by Ctrl + Shift + P to reload the window (I just quit the application entirely and reopened it and it seemed to have the same effect). I also found that it worked better if I kept the default recipes and added this one in as an extra. Regardless, thanks much for the expedient and correct reply, +1 and accept! Apr 2, 2020 at 19:57
• thanks for accepting the answer, @ShadyPuck! You are right. Restarting the application has the same effect. But if you change the settings more often, reloading is faster than quitting and reopening it every time. Apr 2, 2020 at 20:00