I am trying to use VS Code on Windows 10 x64 with LaTeX Workshop 8.7.2 to compile documents in LaTeX.
I am facing three problems:
The PDF viewer that is displayed in a tab in VS Code does not update anymore when I compile the document again after having opened the PDF viewer. Opening the PDF file with another program shows that it gets updated, so it is just the viewer in VS Code that does not update on compilation. I have to close the tab and open it again (
LaTeX Workshop: View LaTeX PDF file in VSCode tab) to display the newest, i.e. current version of the PDF file.The file
tasks.jsonthat lies in the subfolder.vscodeof the folder in which mymyfilename.tex-file that I want to compile lies contains the line"myfilename.tex". I see in multiple places online (like the accepted answer here or here) that this should seemingly rather be%DOC%.texor%DOC%(although in the first link, they are referring to thesettings.jsonfile, which looks as below for me, i.e. completely different. When I compile this with%DOC%.texor just%DOC%, I get:
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (MiKTeX 2.9.7250 64-bit)
entering extended mode
! Emergency stop.
<*> %DOC%
! ==> Fatal error occurred, no output PDF file produced!
Transcript written on texput.log.
The terminal process terminated with exit code: 1
This problem means that if I want to compile two .tex-files in the same folder, I need to manually replace the filename in the tasks.json file each time. What I also tried, to no avail, is (following https://github.com/James-Yu/LaTeX-Workshop/issues/384) "%DOCFILE%.tex" and "%DOCFILE%").
- I want to also create an index within the PDF file. In TeXWorks, which I used before, I used
MakeIndexlike this:
or (preferably, combined with pdfLaTeX) like this
What would I have to do to run MakeIndex using VS Code?
Here are my files: tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "Run pdflatex",
"type": "shell",
"group": {
"kind": "build"
},
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"myfilename.tex"
]
},
{
"label": "Run bibtex",
"type": "shell",
"group": {
"kind": "test",
"isDefault": true
},
"command": "bibtex",
"args": [
"-terse",
"*.aux"
]
},
// {
// "label": "Run makeindex",
// "command": "makeindex",
// "args": [
// "myfilename.tex.nlo",
// "-s nomencl.ist",
// "-o myfilename.tex.nls%"
// ]
// },
{
"label": "update pdf",
"command": "${command:latex-workshop.refresh-viewer}",
"problemMatcher": []
},
{
"label": "Compile and update",
"group": {
"kind": "build",
"isDefault": true
},
"dependsOrder": "sequence",
"dependsOn": [
// "Run makeindex",
"Run pdflatex",
"update pdf"
],
"problemMatcher": []
}
]
}
settings.json
{
"latex-workshop.message.update.show": false,
"latex-workshop.latex.autoClean.run": "onBuilt",
"latex-workshop.latex.clean.fileTypes": [
"*.aux",
"*.toc",
// "*.blg",
// "*.lof",
// "*.lot",
// "*.out",
// "*.acn",
// "*.acr",
// "*.alg",
// "*.glg",
// "*.glo",
// "*.gls",
// "*.fls",
// "*.log",
// "*.fdb_latexmk",
// "*.snm",
"*.synctex(busy)",
"*.synctex.gz(busy)",
"*.nav"
],
"latex-workshop.view.pdf.ref.viewer": "tabOrBrowser",
"latex-workshop.view.pdf.viewer": "tab",
"latex-workshop.view.pdf.zoom": "page-fit",
"window.zoomLevel": 1,
"latex-workshop.latex.recipes": [
{
"name": "pdflatex ➞ bibtex ➞ pdflatex × 2",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
},
]
}

