Here is the document:
%!TEX program = xelatex
\documentclass[UTF8,a4paper]{article}
\title{Sample Title}
\author{Margatroid}
\begin{document}
\maketitle
\end{document}
Everything should be good.
I've got an error. See logs for details.
LaTeX Workshop Output
[17:49:46] Initializing LaTeX Workshop.
[17:49:46] Creating LaTeX Workshop http and websocket server.
[17:49:46] LaTeX Workshop initialized.
[17:49:46] Found root file from active editor: d:\Projects\LaTeXDocs\group-ver-2\test.tex
[17:49:46] Root file changed from: undefined. Find all dependencies.
[17:49:46] Instatiating new file watcher for d:\Projects\LaTeXDocs\group-ver-2\test.tex
[17:49:46] Parsing d:\Projects\LaTeXDocs\group-ver-2\test.tex
[17:49:46] Server created on 127.0.0.1:59125
[17:49:46] LaTeX Workshop version: 5.0.4
[17:49:46] Default data loaded.
[17:49:50] Parsing d:\Projects\LaTeXDocs\group-ver-2\test.tex for outline
[17:49:50] File watcher: responding to change in d:\Projects\LaTeXDocs\group-ver-2\test.tex
[17:49:50] Parsing d:\Projects\LaTeXDocs\group-ver-2\test.tex
[17:49:50] BUILD command invoked.
[17:49:50] Found root file from active editor: d:\Projects\LaTeXDocs\group-ver-2\test.tex
[17:49:50] Root file remains unchanged from: d:\Projects\LaTeXDocs\group-ver-2\test.tex.
[17:49:50] Building root file: d:\Projects\LaTeXDocs\group-ver-2\test.tex
[17:49:50] Build root file d:\Projects\LaTeXDocs\group-ver-2\test.tex
[17:49:50] Found TeX program by magic comment: xelatex
[17:49:50] Recipe step 1: xelatex, -synctex=1,-interaction=nonstopmode,-file-line-error,d:/Projects/LaTeXDocs/group-ver-2/test
[17:49:50] Parsing d:\Projects\LaTeXDocs\group-ver-2\test.tex for outline
[17:49:52] LaTeX log parsed with 0 messages.
[17:49:52] Recipe step 2: bibtex, test
[17:49:52] Recipe returns with error: 2/null.
[17:49:52] Cleaning auxillary files and retrying build after toolchain error.
[17:49:52] CLEAN command invoked.
[17:49:52] Found root file from active editor: d:\Projects\LaTeXDocs\group-ver-2\test.tex
[17:49:52] Root file remains unchanged from: d:\Projects\LaTeXDocs\group-ver-2\test.tex.
[17:49:52] Found root file from active editor: d:\Projects\LaTeXDocs\group-ver-2\test.tex
[17:49:52] Root file remains unchanged from: d:\Projects\LaTeXDocs\group-ver-2\test.tex.
[17:49:52] File cleaned: d:\Projects\LaTeXDocs\group-ver-2\test.bbl
[17:49:52] File cleaned: d:\Projects\LaTeXDocs\group-ver-2\test.aux
[17:49:52] File cleaned: d:\Projects\LaTeXDocs\group-ver-2\test.log
[17:49:52] File cleaned: d:\Projects\LaTeXDocs\group-ver-2\test.blg
[17:49:52] Recipe step 1: xelatex, -synctex=1,-interaction=nonstopmode,-file-line-error,d:/Projects/LaTeXDocs/group-ver-2/test
[17:49:53] LaTeX log parsed with 0 messages.
[17:49:53] Recipe step 2: bibtex, test
[17:49:54] Recipe returns with error: 2/null.
[17:49:56] Root file remains unchanged from: d:\Projects\LaTeXDocs\group-ver-2\test.tex.
Developer Tools Console
workbench.main.js:sourcemap:2217 Recipe terminated with error.
e.onDidNotificationChange @ workbench.main.js:sourcemap:2217
(anonymous) @ workbench.main.js:sourcemap:2217
e.fire @ workbench.main.js:sourcemap:166
e.notify @ workbench.main.js:sourcemap:2210
e.notify @ workbench.main.js:sourcemap:3037
e._showMessage @ workbench.main.js:sourcemap:2829
e._showMessage @ workbench.main.js:sourcemap:2828
e.$showMessage @ workbench.main.js:sourcemap:2828
e._doInvokeHandler @ workbench.main.js:sourcemap:2848
e._invokeHandler @ workbench.main.js:sourcemap:2848
e._receiveRequest @ workbench.main.js:sourcemap:2847
e._receiveOneMessage @ workbench.main.js:sourcemap:2847
(anonymous) @ workbench.main.js:sourcemap:2846
(anonymous) @ workbench.main.js:sourcemap:2849
e.fire @ workbench.main.js:sourcemap:166
(anonymous) @ workbench.main.js:sourcemap:291
emitOne @ events.js:96
emit @ events.js:191
readableAddChunk @ _stream_readable.js:178
Readable.push @ _stream_readable.js:136
onread @ net.js:560
The problem seems to be caused by the magic comment in the first line. If you delete it, everything will be fine. However, I have to use xelatex to deal with languages except English. And that means I have to use this magic comment.
What's more, according to the running log, the problem seems to be caused by BibTeX. And I've tried to disable it by deleting BibTeX in the config "latex-workshop.latex.tools" and the recipe "name": "pdflatex -> bibtex -> pdflatex*2",. Sadly, all those don't work for me.
After I delete my magic comment and change my config like this:(delete the "-pdf" and add "-xelatex"), it finally works well for me.
"latex-workshop.latex.tools": [
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-xelatex",
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
},
Remove the file head โ%!TEX program = xelatexโ mybe works
Most helpful comment
After I delete my magic comment and change my config like this:(delete the "-pdf" and add "-xelatex"), it finally works well for me.