TeX - LaTeX Asked by parsa2820 on March 10, 2021
I want to compile a tex document using xelatex in LaTeX Workshop extension in visual studio code. How can I change compiler from default one to xetex? I put my current setting.json file bellow.
{
"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": {}
}
]
}
Maybe all you were looking for was:
{
"latex-workshop.latex.recipe.default": "name of recipe",
}
which sets the default build recipe for LaTeX-Workshop. But I came across this question when trying to figure out how to build my file with xelatex, which I have now figured out:
I use latexmk with -xelatex option, which I have installed on Windows via MiKTeX. I used the command line in my project folder to find what arguments got me the result I wanted. In my case, the following did the trick:
D:pathtoproject>latexmk -xelatex -outdir=out file.tex
Since this result is usually fixed for a certain project, I just override tools and recipes in
D:pathtoproject.vscodesettings.json:
{
"latex-workshop.latex.recipe.default": "latexmk (xelatex)",
"latex-workshop.latex.tools": [
{
"name": "xelatexmk",
"command": "latexmk",
"args": [
"-xelatex",
"-outdir=out",
"file.tex"
]
}
],
"latex-workshop.latex.recipes": [
{
"name": "latexmk (xelatex)",
"tools": [
"xelatexmk"
]
}
]
}
I have chosen to just hard-code my root file and output directory in the tool, but you can also use Placeholders.
Answered by mbockstael on March 10, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP