How to cope with this error while compiling latex with vscode? - visual-studio-code

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.

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).

Related

VSCODE Latex, security risk: running with elevated privileges

Environment:
OS: Window 10,x64
VSCode: 1.69.1
Related VSCode Plugins installed: LaTeX,LaTeX Workshop,LaTeX Utilities,LaTeX language support
Latex: MiKTeX 21.12.10 Portable
The VSCode Configuration is below
"latex-workshop.latex.recipes": [
{
"name": "pdflatex -> bibtex -> pdflatex*2",
"tools": ["pdflatex", "bibtex", "pdflatex","pdflatex"]
},
{
"name": "xelatex",
"tools": ["xelatex"]
},
{
"name": "latexmk",
"tools": ["latexmk"]
},
],
"latex-workshop.latex.tools": [
{
"name": "latexmk",
"command": "latexmk",
"args": ["-synctex=1","-interaction=nonstopmode","-file-line-error","-pdf","-outdir=./output","%DOCFILE%"]
},
{
"name": "xelatex",
"command": "xelatex",
"args": [ "-synctex=1","-interaction=nonstopmode","-file-line-error","-output-directory=./output","%DOCFILE%"]
},
{
"name": "pdflatex",
"command": "pdflatex",
"args": [ "-synctex=1","-interaction=nonstopmode","-file-line-error","-output-directory=./output","%DOCFILE%"]
},
{
"name": "bibtex",
"command": "bibtex",
"args": [ "./output/%DOCFILE%"]
},
],
"latex-workshop.view.pdf.viewer": "tab",
"latex-workshop.latex.clean.fileTypes": [
"*.aux",
"*.bbl",
"*.blg",
"*.idx",
"*.ind",
"*.lof",
"*.lot",
"*.out",
"*.toc",
"*.acn",
"*.acr",
"*.alg",
"*.glg",
"*.glo",
"*.gls",
"*.ist",
"*.fls",
"*.log",
"*.fdb_latexmk"
],
"latex-workshop.latex.autoClean.run": "never",
"latex-workshop.latex.recipe.default": "first",
"latex-workshop.view.pdf.external.viewer.args": [
"./output/%PDF%"
],
"latex-workshop.latex.outDir": "./output",
I use VSCode to write latex. And it occurs the errors below:
chktex: security risk: running with elevated privileges
Cannot count words, code: 4294967295, texcount: security risk: running with elevated privileges
How to solve it?
I have tried to run VSCode with administrator, but it didn't help.
I solved it.
Only the plugin LaTeX Workshop is needed. Other plugins(LaTeX,LaTeX Utilities,LaTeX language support) can be uninstalled.

VS Code LaTeX Workshop Extension: 'docker' is not recognized as an internal or external command, operable program, or batch file

I am in the midst of moving from macOS to Windows 10, and in doing so have needed to move a number of LaTeX project workspaces from VS Code operating on macOS to VS Code operating on Windows 10, and it's come with a fair amount of resistance. In particular, each time I try to build the desired PDF, I am greeted with the following LaTeX workshop log.
[22:59:56] BUILD command invoked.
[22:59:56] The document of the active editor: file:///{PLACEHOLDER_DIRECTORY}
[22:59:56] The languageId of the document: latex
[22:59:56] Current workspace folders: undefined
[22:59:56] Current workspaceRootDir:
[22:59:56] Found root file from active editor: {PLACEHOLDER_DIRECTORY}
[22:59:56] Keep using the same root file: {PLACEHOLDER_DIRECTORY}
[22:59:56] Building root file: {PLACEHOLDER_DIRECTORY}
[22:59:56] Build root file d:{PLACEHOLDER_DIRECTORY}
[22:59:56] outDir: {PLACEHOLDER_DIRECTORY}
[22:59:56] Recipe step 1: latexmk, -synctex=1,-interaction=nonstopmode,-file-line-error,-pdf,-outdir={PLACEHOLDER_DIRECTORY},{PLACEHOLDER_DIRECTORY}
[22:59:56] Recipe step env: {}
[22:59:56] cwd: {PLACEHOLDER_DIRECTORY}
[22:59:56] LaTeX build process spawned. PID: 12076.
[22:59:56] Recipe returns with error: 1/null. PID: 12076. message: 'docker' is not recognized as an internal or external command,
operable program or batch file.
.
[22:59:56] The environment variable $PATH: undefined
[22:59:56] The environment variable $SHELL: undefined
[22:59:56] Cleaning auxiliary files and retrying build after toolchain error.
[22:59:56] Clean glob matched files: {"globs":["*.aux","*.bbl","*.blg","*.idx","*.ind","*.lof","*.lot","*.out","*.toc","*.acn","*.acr","*.alg","*.glg","*.glo","*.gls","*.fls","*.log","*.fdb_latexmk","*.snm","*.synctex(busy)","*.synctex.gz(busy)","*.nav"],"outdir":{PLACEHOLDER_DIRECTORY}}
[22:59:56] Recipe step 1: latexmk, -synctex=1,-interaction=nonstopmode,-file-line-error,-pdf,-outdir={PLACEHOLDER_DIRECTORY},{PLACEHOLDER_DIRECTORY}
[22:59:56] Recipe step env: {}
[22:59:56] cwd: {PLACEHOLDER_DIRECTORY}
[22:59:56] LaTeX build process spawned. PID: 9968.
[22:59:56] Recipe returns with error: 1/null. PID: 9968. message: 'docker' is not recognized as an internal or external command,
operable program or batch file.
.
[22:59:56] The environment variable $PATH: undefined
[22:59:56] The environment variable $SHELL: undefined
Now, in the past I've (perhaps luckily) managed to fix issues the likes of 'docker' is not recognized as an internal or external command, operable program, or batch file' by messing around with the directories listed under my device's paths, although this problem is one I've not been able to resolve thus far, and I'm at the end of my proverbial intellectual rope.
In the event that it helps solve the problem, I've attached also the LaTeX workshop logs as they are generated when opening VS Code.
[22:53:53] Initializing LaTeX Workshop.
[22:53:53] Extension root: {PLACEHOLDER_DIRECTORY}
[22:53:53] $PATH: {PLACEHOLDER_DIRECTORY};{PLACEHOLDER_DIRECTORY};{PLACEHOLDER_DIRECTORY};{PLACEHOLDER_DIRECTORY};{PLACEHOLDER_DIRECTORY};{PLACEHOLDER_DIRECTORY};{PLACEHOLDER_DIRECTORY};{PLACEHOLDER_DIRECTORY};{PLACEHOLDER_DIRECTORY};{PLACEHOLDER_DIRECTORY};{PLACEHOLDER_DIRECTORY};{PLACEHOLDER_DIRECTORY};{PLACEHOLDER_DIRECTORY};{PLACEHOLDER_DIRECTORY};{PLACEHOLDER_DIRECTORY};{PLACEHOLDER_DIRECTORY};.
[22:53:53] $SHELL: undefined
[22:53:53] vscode.env.appName: Visual Studio Code
[22:53:53] vscode.env.remoteName: undefined
[22:53:53] vscode.env.uiKind: 1
[22:53:53] latex-workshop.bind.enter.key: true
[22:53:53] latex-workshop.docker.enabled: false
[22:53:53] latex-workshop.docker.image.latex: ""
[22:53:53] latex-workshop.intellisense.package.enabled: true
[22:53:53] latex-workshop.intellisense.update.aggressive.enabled: false
[22:53:53] latex-workshop.intellisense.update.delay: 1000
[22:53:53] latex-workshop.latex.autoBuild.run: "onFileChange"
[22:53:53] latex-workshop.latex.outDir: "%DIR%"
[22:53:53] latex-workshop.latex.recipes: [
{
"name": "latexmk 🔃",
"tools": [
"latexmk"
]
},
{
"name": "latexmk (latexmkrc)",
"tools": [
"latexmk_rconly"
]
},
{
"name": "latexmk (lualatex)",
"tools": [
"lualatexmk"
]
},
{
"name": "pdflatex ➞ bibtex ➞ pdflatex × 2",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
},
{
"name": "Compile Rnw files",
"tools": [
"rnw2tex",
"latexmk"
]
},
{
"name": "Compile Jnw files",
"tools": [
"jnw2tex",
"latexmk"
]
},
{
"name": "tectonic",
"tools": [
"tectonic"
]
}
]
[22:53:53] latex-workshop.latex.tools: [
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"-outdir=%OUTDIR%",
"%DOC%"
],
"env": {}
},
{
"name": "lualatexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-lualatex",
"-outdir=%OUTDIR%",
"%DOC%"
],
"env": {}
},
{
"name": "latexmk_rconly",
"command": "latexmk",
"args": [
"%DOC%"
],
"env": {}
},
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
],
"env": {}
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"%DOCFILE%"
],
"env": {}
},
{
"name": "rnw2tex",
"command": "Rscript",
"args": [
"-e",
"knitr::opts_knit$set(concordance = TRUE); knitr::knit('%DOCFILE_EXT%')"
],
"env": {}
},
{
"name": "jnw2tex",
"command": "julia",
"args": [
"-e",
"using Weave; weave(\"%DOC_EXT%\", doctype=\"tex\")"
],
"env": {}
},
{
"name": "jnw2texmintex",
"command": "julia",
"args": [
"-e",
"using Weave; weave(\"%DOC_EXT%\", doctype=\"texminted\")"
],
"env": {}
},
{
"name": "tectonic",
"command": "tectonic",
"args": [
"--synctex",
"--keep-logs",
"%DOC%.tex"
],
"env": {}
}
]
Perhaps most interestingly is that the fourth line of the above block of code reads
[22:53:53] $SHELL: undefined
Which is something I've noticed isn't the case on, for example, my old macOS device, where the $SHELL path wasn't undefined.
One final thing that's worth noting is that I'm not launching VS Code here using the executable itself. Instead, I've set up a batch file that opens VS Code up from a particular Miniconda environment (since I am also using VS Code on my new Windows 10 device to the end of programming in Python). I am not entirely sure whether or not this makes a difference, although I have tried opening VS Code using the executable itself, and this has not seemed to resolve the issue. I've also tried disabling all additional extensions and replicating the behaviour that caused the issue, and said behaviour did indeed incur the same issue once again.
This is all I've managed to do thus far.
Any help on this issue is greatly appreciated!

In Visual Studio Code, can I refer to a configuration element from c_cpp_properties.json in tasks.json?

I'm working on a C project that should compile under both Linux and MacOS using their respective compilers. I have installed the C/C++ extension in VS Code and I would like the compilation task in tasks.json to pick up the right compiler based on the OS I'm currently on.
If, in my c_cpp_properties.json file I have the following (I removed the irrelevant elements):
{
"configurations": [
{
"name": "Mac",
"compilerPath": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++",
},
{
"name": "Linux",
"compilerPath": "/usr/bin/gcc",
}
],
"version": 4
}
Would it be possible to refer to the compilerPath variable in tasks.json? And especially without having to state which OS-based configuration? What I 'd like to do is this:
"tasks": [
{
"label": "compilation",
"type": "shell",
"command": "${config:compilerPath} -g main.c"
}
]

sources assets files in js-debug missing with visual studio code on Apache Royale

I use visual studio code and setup it following theses instructions :
https://github.com/apache/royale-asjs/wiki/Visual-Studio-Code
Everythings worked fine.
For now I deleted bin folder in main project, and when launch debug, then bin and js-debug and others stuffs are right generated, but my assets dir with used jpg are not copied.
For exemple in the code I use <j:Image src="assets/logo.png" percentHeight="100"/> but the is no assets/logo.png in js-debug. So I must copy it manualy...
Here is my asconfig.json :
{
"compilerOptions": {
"targets": [
"JSRoyale"
],
"theme": "${royalelib}/themes/JewelTheme/src/main/resources/defaults.css",
//"html-template": "src/main/resources/jewel-example-index-template.html",
"source-map": true,
"source-path": [
"src"
],
},
"files":
[
"src/main/royale/App.mxml"
]
}
and tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"type": "actionscript",
"clean": true,
"problemMatcher": []
},
{
"label": "build",
"type": "actionscript",
"debug": true,
"problemMatcher": []
}
]
}
Could someone tell me how to copy assets folder automatically ?
thanks
Regards
Add to your asconfig.json file:
"copySourcePathAssets": true

C++ in Visual Studio Code: Include path not found

I use Visual Studio code with the extensions "C/C++ for Visual Studio Code" (ms-vscode.cpptools) for developing simple C++ programs. I have added the configuration file cpp_properties.json to the .vscode subfolder to get intellisense support (see below). Unfortunately VS code does not honor the include path defined herein. I always get green swiggles under #include directives saying #include errors detected. Please update your includePath. ....
What's strange is, that the before mentioned error disappears when I select the correct configuration using the command C/Cpp: Select a configuration .... I have to repeat this command everytime I reopen the project. So obviously the include paths seems to be correct.
Is it possible to make VS Code or the CPP extension store the active configuration? Or is it at least possible to define a default configuration?
c_cpp_properties.json:
{
"configurations": [{
"name": "MinGW on Windows",
"includePath": [
"${workspaceRoot}",
"${MINGW_HOME}\\include\\c++\\7.1.0",
"${MINGW_HOME}\\include\\c++\\7.1.0\\x86_64-w64-mingw32",
"${MINGW_HOME}\\include\\c++\\7.1.0\\backward",
"${MINGW_HOME}\\lib\\gcc\\x86_64-w64-mingw32\\7.1.0\\include",
"${MINGW_HOME}\\include",
"${MINGW_HOME}\\x86_64-w64-mingw32\\include"
],
"defines": [],
"browse": {
"path": [
"${workspaceRoot}",
"${MINGW_HOME}\\include\\c++\\7.1.0",
"${MINGW_HOME}\\include\\c++\\7.1.0\\x86_64-w64-mingw32",
"${MINGW_HOME}\\include\\c++\\7.1.0\\backward",
"${MINGW_HOME}\\lib\\gcc\\x86_64-w64-mingw32\\7.1.0\\include",
"${MINGW_HOME}\\include",
"${MINGW_HOME}\\x86_64-w64-mingw32\\include"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"intelliSenseMode": "clang-x64"
},
{
"name": "GCC on Linux",
"includePath": [
"${workspaceRoot}",
"/usr/include/c++/6",
"/usr/include/x86_64-linux-gnu/c++/6",
"/usr/include/c++/6/backward",
"/usr/lib/gcc/x86_64-linux-gnu/6/include",
"/usr/local/include",
"/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed",
"/usr/include"
],
"defines": [],
"browse": {
"path": [
"/usr/include/c++/6",
"/usr/include/x86_64-linux-gnu/c++/6",
"/usr/include/c++/6/backward",
"/usr/lib/gcc/x86_64-linux-gnu/6/include",
"/usr/local/include",
"/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed",
"/usr/include",
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"intelliSenseMode": "clang-x64"
}
],
"version": 2
}