I have a template, which defines all the typesetting recommendations for thesis, but it uses xelatex for compilation. I want to continue using VS Code with Latex Workshops, question is how to change compiler to xelatex from pdflatex. The last one cause next error log:
C:\Users\User\AppData\Local\Programs\MiKTeX 2.9\tex/latex/fontspec\fontspec.sty:45: Fatal Package fontspec Error: The
fontspec package requires either XeTeX or
(fontspec) LuaTeX.
(fontspec)
(fontspec) You must change your typesetting engine to,
(fontspec) e.g., "xelatex" or "lualatex"instead of
(fontspec) "latex" or "pdflatex".
Copy and paste the source code into a new LaTeX source file, press “cmd+option+b” to compile, and click the “View PDF Latex file” button on the top-right corner of the VSCode. You can also select “LaTeX Workshop: View LaTeX pdf in external viewer” in the dropdown menu after pressing “cmd+option+p”.
After saving the file, click on the magnifying glass icon on the top right corner. Now it should display the PDF view of your latex document on the right side of the VS Code window. If it doesn't show up, click the TeX icon on the left horizontal menu, and click on "View LaTeX PDF" under the COMMANDS palette.
The simplest solution found in issues here, but in more common formulation:
Copying the content, simply go to Preferences → Extensions → LaTeX (meaning LaTeX is LaTeX workshops), find gear-wheel button with name Manage
, then find in the list link to settings.json
under any tag, open and type next:
"latex-workshop.latex.tools": [{
"name": "latexmk",
"command": "latexmk",
"args": [
"-xelatex",
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
}],
Reloading the VSCode may be needed.
Also setting.json
file could be found in C:\Users\*\AppData\Roaming\Code\User\settings.json
.
Use magic comments
add the following line to the beginning of your document.
% !TEX program = xelatex
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With