This is to reopen my issue #913.
To invoke shell-escape flag I tried this in my user settings:
"latex-workshop.latex.recipes": [
{
"name": "latexmk",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
},
],
"latex-workshp.latex.tools":[{
"name": "latexmk",
"command": "pdflatex",
"--shell-escape",
"%O",
"%S"
}],
But I got errors. Is this right?
I tried this but I got problems with the bibliography. What have I done wrong?
"latex-workshop.latex.recipes": [
{
"name": "latexmk",
"tools": [
"latexmk",
"bibtex",
"latexmk",
"latexmk"
]
},
"latex-workshp.latex.tools": [
{
"name": "latexmk",
"command": "pdflatex",
"args ": [
"-pdf",
"-pdflatex=\"pdflatex --shell-escape %O %S\""
}
]
Sorry, there was a typo in my previous post. latexmk already takes care of the bibliography.
"latex-workshop.latex.recipes": [
{
"name": "latexmk",
"tools": [
"latexmk"
]
},
"latex-workshp.latex.tools": [
{
"name": "latexmk",
"command": "latexmk",
"args ": [
"-pdf",
"-pdflatex=pdflatex -shell-escape %O %S"
}
]
There were some typos also in latex-workshop.latex.tools. Now corrected:
```
"latex-workshop.latex.tools": [
{
"name": "latexmk",
"command": "latexmk",
"args ": [
"-pdf",
"-pdflatex=\"pdflatex --shell-escape %O %S\""
]
}
]
But problems remain. Here is part of the output:
Latexmk: This is Latexmk, John Collins, 7 August 2018, version: 4.59.
Rule 'latex': Rules & subrules not known to be previously run:
latex
Rule 'latex': The following rules & subrules became out-of-date:
Running 'latex -recorder "paper_OL_LNCS.tex"'
(and so on...). And ends with:
Package ifplatform Warning:
shell escape is disabled, so I can only detect \ifwindows.
) (/usr/local/texlive/2018/texmf-dist/tex/generic/xstring/xstring.sty (/usr/local/texlive/2018/texmf-dist/tex/generic/xstring/xstring.tex)) (/usr/local/texlive/2018/texmf-dist/tex/latex/framed/framed.sty))
! Package minted Error: You must invoke LaTeX with the -shell-escape flag.
See the minted package documentation for explanation.
Type H
...
l.31 \usepackage
{csquotes}
?
```
I must say that the same file compiles well with Emacs (AucTeX).
Does it work if you directly run latexmk -pdf -pdflatex="pdflatex --shell-escape %O %S" from the command line?
From the log, latexmk is not running withe the right arguments. Are you sure you do not have a second tool with the same name?
Yes, now it compiles well from the command line. I don't understand what happens when I don't use the command line. I don't see any second tool with the same name (latexmk).
These are the first lines of the output (they are different from those above):
Latexmk: This is Latexmk, John Collins, 7 August 2018, version: 4.59.
Latexmk: applying rule 'bibtex paper_OL_LNCS'...
Rule 'bibtex paper_OL_LNCS': File changes, etc:
Non-existent destination files:
'paper_OL_LNCS.bbl'
------------
Run number 1 of rule 'bibtex paper_OL_LNCS'
------------
For rule 'bibtex paper_OL_LNCS', running '&run_bibtex( )' ...
------------
Running 'bibtex "paper_OL_LNCS"'
------------
This is BibTeX, Version 0.99d (TeX Live 2018)
The top-level auxiliary file: paper_OL_LNCS.aux
The style file: apalike.bst
Database file #1: sbphd.bib
Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex': File changes, etc:
Changed files, or newly in use since previous run(s):
'/Users/sergiobacelar/Dropbox/PhD/Papers/Generational-political-dynamics-LNCS-/paper_OL_LNCS.tex'
'paper_OL_LNCS.aux'
'paper_OL_LNCS.bbl'
'paper_OL_LNCS.tex'
------------
Run number 1 of rule 'pdflatex'
------------
------------
Running 'pdflatex --shell-escape -recorder "paper_OL_LNCS.tex"'
Clearly, latex-workshop does not launch the correct tool, so there must be something wrong in there.
I found the solution in StackExchange:
// in USER SETTINGS add the following
"latex-workshop.latex.tools": [
{
"name": "latexmk",
"command": "latexmk",
"args": [
"--shell-escape", // added arg to default
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"%DOC%"
]
},
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"--shell-escape", // added arg to default
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"%DOCFILE%"
]
}
]
Most helpful comment
I found the solution in StackExchange: