Latex-workshop: Automatically run makeglossaries when the glossaries package is in use

Created on 16 Aug 2017  ·  9Comments  ·  Source: James-Yu/LaTeX-Workshop

Description

Automatically run makeglossaries when the glossaries package is in use

How to reproduce

  1. Include \usepackage{glossaries} in preamble and add terms or acronyms.
  2. Save the file/build the LaTeX project.
  3. PDF does not include (updated) glossaries.

Expected behavior

Latex-Workshop automagically runs makeglossaries when it sees that the glossaries package is in use like I think it does with other packages.

Actual behavior

Latex-Workshop does not execute the command and one has to do it themselves.

Additional Information


MWE from https://de.sharelatex.com/learn/glossaries

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

\makeglossaries

\newacronym{gcd}{GCD}{Greatest Common Divisor}

\newacronym{lcm}{LCM}{Least Common Multiple}

\begin{document}
Given a set of numbers, there are elementary methods to compute 
its \acrlong{gcd}, which is abbreviated \acrshort{gcd}. This process 
is similar to that used for the \acrfull{lcm}.

\clearpage

\printglossary[type=\acronymtype]

\end{document}

Most helpful comment

Just add these two elements to your VS Code config. This considers the binaries to be available in your PATH, if this isn't the case, specify the path in the "command": "pdflatex", lines.

  "latex-workshop.latex.recipes": [
    {
      "name": "pdflatex, biber, makeglossaries, pdflatex",
      "tools": [
        "pdflatex",
        "biber",
        "makeglossaries",
        "pdflatex"
      ]
    }
  ],
  "latex-workshop.latex.tools": [
    {
      "name": "pdflatex",
      "command": "pdflatex",
      "args": [
        "-synctex=1",
        "-interaction=nonstopmode",
        "-undump=pdflatex",
        "%DOCFILE%"
      ]
    },
    {
      "name": "biber",
      "command": "biber",
      "args": [
        "%DOC%"
      ]
    },
    {
      "name": "makeglossaries",
      "command": "makeglossaries",
      "args": [
        "%DOCFILE%"
      ]
    }
  ]

All 9 comments

Possibly latex-workshop never did any of this, if so, please close this iusse :)

Thanks for the issue. Unfortunately your guess is correct. Additional compilers should either be entertained by auto-toolchain tools like latexmk, or be explicit included in latex-workshop toolchain. There can be a thousand latex packages that might need additional compiler, and it can be quite overwhelming for the extension to consider all of them. Especially that this issue should be considered by latexmk.

Welp this is crazy, having this issue again, but now wondering how to make makeglossaries work^^

Just add these two elements to your VS Code config. This considers the binaries to be available in your PATH, if this isn't the case, specify the path in the "command": "pdflatex", lines.

  "latex-workshop.latex.recipes": [
    {
      "name": "pdflatex, biber, makeglossaries, pdflatex",
      "tools": [
        "pdflatex",
        "biber",
        "makeglossaries",
        "pdflatex"
      ]
    }
  ],
  "latex-workshop.latex.tools": [
    {
      "name": "pdflatex",
      "command": "pdflatex",
      "args": [
        "-synctex=1",
        "-interaction=nonstopmode",
        "-undump=pdflatex",
        "%DOCFILE%"
      ]
    },
    {
      "name": "biber",
      "command": "biber",
      "args": [
        "%DOC%"
      ]
    },
    {
      "name": "makeglossaries",
      "command": "makeglossaries",
      "args": [
        "%DOCFILE%"
      ]
    }
  ]

@carstenhag

When running pdflatex, biber, makeglossaries, pdflatex I get this one:

Skipping undefined tool "biber" in recipe "pdflatex, biber, makeglossaries, pdflatex."

Any idea if I do something wrong?

Here is my config:

 "latex-workshop.latex.recipes":[
        {
            "name": "latexmk",
            "tools": [
                "latexmk"
            ]
        },
        {
            "name": "pdflatex -> bibtex -> pdflatex*2",
            "tools": [
                "pdflatex",
                "bibtex",
                "pdflatex",
                "pdflatex"
            ]
        },
        {
            "name": "pdflatex, biber, makeglossaries, pdflatex",
            "tools": [
              "pdflatex",
              "biber",
              "makeglossaries",
              "pdflatex"
            ]
          }
    ],
    "latex-workshop.latex.tools":[
        {
            "name": "latexmk",
            "command": "latexmk",
            "args": [
                "-shell-escape",
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "-pdf",
                "-outdir=%OUTDIR%",
                "%DOC%"
            ]
        },
        {
            "name": "pdflatex",
            "command": "pdflatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOC%"
            ]
        },
        {
            "name": "bibtex",
            "command": "bibtex",
            "args": [
                "%DOCFILE%"
            ]
        },
        {
            "name": "makeglossaries",
            "command": "makeglossaries",
            "args": [
              "%DOCFILE%"
            ]
          }
    ]

You need a biber entry in latex-workshop.latex.tools.

Refer to this part of my comment:

This considers the binaries to be available in your PATH, if this isn't the case, specify the path in the "command": "pdflatex", lines.

Try to run Biber from your terminal. Very likely it's not in your path. You can either include it in your PATH or specify the path to the Biber binary in the command field of the config.

Your are totally right 🤦🏻‍♂️ Thank you guys!

I ran into this problem as well, but instead of modifying the recipes/tools I found a solution adding a .latexmkrc-file:
https://tex.stackexchange.com/a/1228

Was this page helpful?
0 / 5 - 0 ratings