TransWikia.com

How can I get VS Code LaTeX Workshop to choose the correct Latex distribution?

TeX - LaTeX Asked by guluzhu on March 1, 2021

I have installed two Latex distributions on my PC, i.e., Ctex and Texlive 2020. VS Code LaTeX Workshop keeps using Ctex to compile latex files. How do I force VS Code to compile with Texlive 2020?

For some reason, I need to keep the Ctex on this PC. My settings.json of VS Code LaTeX Workshop is as follows. In particular, I have specified the path of Texlive 2020. However, it still cannot compile with Texlive 2020.

"latex-workshop.latex.tools": [

    {
    "name": "xelatex",
    "command": "xelatex",
    "args": [
    "-synctex=1",
    "-interaction=nonstopmode",
    "-file-line-error",
    "-pdf",
    "%DOCFILE%"
    ],
    "env": {"TEXMFHOME": "c:/texlive/2020"}
    },
    {
    "name": "pdflatex",
    "command": "pdflatex",
    "args": [
    "-synctex=1",
    "-interaction=nonstopmode",
    "-file-line-error",
    "%DOCFILE%"
    ],
    "env": {"TEXMFHOME": "c:/texlive/2020"}
    },
    {
    "name": "bibtex",
    "command": "bibtex",
    "args": [
    "%DOCFILE%"
    ],
    "env": {"TEXMFHOME": "c:/texlive/2020"}
    },
    {
    "name": "biber",
    "command": "biber",
    "args": [
    "%DOCFILE%"
    ],
    "env": {"TEXMFHOME": "c:/texlive/2020"}
    }
    ],
    "latex-workshop.latex.recipes": [
    {
    "name": "pdf",
    "tools": [
    "pdflatex"
    ]
    },
    {
    "name": "pdf->biber->pdf->pdf",
    "tools": [
    "pdflatex",
    "biber",
    "pdflatex",
    "pdflatex"
    ]
    },
    {
    "name": "pdf->bibtex->pdf->pdf",
    "tools": [
    "pdflatex",
    "bibtex",
    "pdflatex",
    "pdflatex"
    ]
    }
    ],

One Answer

I found a solution from here. Changing "command" instead of "env" in the settings.json file of VS Code works for me.

"latex-workshop.latex.tools": [

    {
    "name": "xelatex",
    "command": "C:/texlive/2020/bin/win32/xelatex.exe",
    "args": [
    "-synctex=1",
    "-interaction=nonstopmode",
    "-file-line-error",
    "-pdf",
    "%DOCFILE%"
    ]
    },
    {
    "name": "pdflatex",
    "command": "C:/texlive/2020/bin/win32/pdflatex.exe",
    "args": [
    "-synctex=1",
    "-interaction=nonstopmode",
    "-file-line-error",
    "%DOCFILE%"
    ]
    },
    {
    "name": "bibtex",
    "command": "C:/texlive/2020/bin/win32/bibtex.exe",
    "args": [
    "%DOCFILE%"
    ]
    },
    {
    "name": "biber",
    "command": "C:/texlive/2020/bin/win32/biber.exe",
    "args": [
    "%DOCFILE%"
    ]
    }
    ],
    "latex-workshop.latex.recipes": [
    {
    "name": "pdf",
    "tools": [
    "pdflatex"
    ]
    },
    {
    "name": "pdf->biber->pdf->pdf",
    "tools": [
    "pdflatex",
    "biber",
    "pdflatex",
    "pdflatex"
    ]
    },
    {
    "name": "pdf->bibtex->pdf->pdf",
    "tools": [
    "pdflatex",
    "bibtex",
    "pdflatex",
    "pdflatex"
    ]
    }
    ],

Answered by guluzhu on March 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP