How to cope with this error while compiling latex with vscode?

6k Views Asked by At

I followed several tutorials on the Internet and tried to build a latex environment in vscode. However, after I've installed everything and started running a .tex file, it came up with the following error:

Qt: Untested Windows version 6.2 detected!
xelatex: Bad parameter value.
xelatex: Data: font_mem_size

source code test.tex: (I put it in a folder on desktop)

\documentclass{article}
\begin{document}
    Hello World!
\end{document}

I tried Google, but didn't find any effective approach. I also restarted my computer and reinstalled MiKTeX, but nothing changed.

By the way: I installed LaTeX workshop, MiKTeX and Strawberry Perl (just following the tutorial) and added this into the settings.json of vscode.

"latex-workshop.latex.tools": [
        {
            "name": "xelatex",
            "command": "xelatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOCFILE%"
            ]
        },
        {
            "name": "pdflatex",
            "command": "pdflatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOCFILE%"
            ]
        },
        {
            "name": "bibtex",
            "command": "bibtex",
            "args": [
                "%DOCFILE%"
            ]
        }
    ],
    "latex-workshop.latex.recipes": [
        {
            "name": "xelatex",
            "tools": [
                "xelatex"
            ],
        },
        {
            "name": "pdflatex",
            "tools": [
                "pdflatex"
            ]
        },
        {
            "name": "xe->bib->xe->xe",
            "tools": [
                "xelatex",
                "bibtex",
                "xelatex",
                "xelatex"
            ]
        },
        {
            "name": "pdf->bib->pdf->pdf",
            "tools": [
                "pdflatex",
                "bibtex",
                "pdflatex",
                "pdflatex"
            ]
        }
    ],
    "latex-workshop.view.pdf.viewer": "tab",
    "latex-workshop.latex.autoBuild.run": "onFileChange",
    "latex-workshop.message.error.show": false,
    "latex-workshop.message.warning.show": false,

Update: the issue was solved by reinstalling MiKTeX and resetting its environment variables in PATH.

2

There are 2 best solutions below

0
erpxyr2001 On

The issue was eventually solved by reinstalling MiKTeX and resetting its environment variables in PATH. (Another way is to directly install MiKTeX in its recommended directory, which is how I solved the problem.) In addition, the code I added in the settings.json should be discarded (or vscode will report errors).

0
Stefano Maruelli On

RUN as Administrator (and check in the properties of the mik-tex.exe file "always run as Administrator"). It finally works for me.