I'm trying to use vim / nvim as text editor in a (long) .tex file containing both minted and dsfont package. Here is an example:
% !TeX document-id = {f2e9e8a7-1386-4a73-9989-55350ce6c529}
% !TeX TXS-program:compile = txs:///xelatex/[--shell-escape]
%\documentclass[a4paper, 12pt]{book}
\documentclass{scrreprt}
%\usepackage{fontspec}
%\usepackage{pmboxdraw}
\usepackage{amssymb, amsmath, float, framed, geometry, listings, lmodern, mathtools,multirow,parskip, paralist,pgfplots, ragged2e,setspace,tcolorbox, threeparttable, upquote, url, tikz, enumitem}
\usepackage{bbm}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{xurl}
\usepackage{minted}
\usepackage{dsfont}
\usepackage{multirow}
\usepackage{tabto}
\usepackage{tabu}
\usepackage[english]{babel}
\usepackage{newtxmath}
\usetikzlibrary{positioning}
\usepackage{xcolor}
\definecolor{mypink1}{RGB}{0, 170, 0}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\fancyhf{}
\pagestyle{fancy}
\rfoot{Page \thepage}
\usepackage[LGR]{fontenc}
\usepackage[T1]{fontenc}
\usepackage[colorlinks]{hyperref}
\hypersetup{
colorlinks,
linkcolor=blue,
filecolor=magenta,
citecolor=mypink1,
urlcolor=cyan,
}
\geometry{
a4paper,
total={170mm,257mm},
left=20mm,
top=20mm,
}
\usepackage{caption}
%\usepackage{calrsfs}
%\DeclareMathAlphabet{\pazocal}{OMS}{zplm}{m}{n}
\begin{document}
blabla
\begin{minted}{Python}
print(“Hello world”)
\end{minted}
\end{document}
I can compile the document with both Texstudio and pdflatex in the terminal without problems. However trying to view it with :LLPStartPreview gives me a Failed to compile message and a the following message in the .log file:
l.13 \usepackage
{dsfont}
Pass the -shell-escape flag to LaTeX. Refer to the minted.sty documentation for
more information.
I had a look at the minted doc but couldn't find the solution to the problem What am I doing wrong?
Edit1
After having checked this other answer, I also tried to replace the line
% !TeX TXS-program:compile = txs:///xelatex/[--shell-escape]
by
% !TeX TXS-program:compile = txs:///pdflatex/[--shell-escape]
and
% !TeX TXS-program:pdflatex = pdflatex -synctex=1 -interaction=nonstopmode --shell-escape %.tex
but it didn't solve the problem
Edit 2
I try to insert (in .vimrc file)
let g:vimtex_compiler_latexmk.options += ['-shell-escape']
let g:vimtex_compiler_method = 'latexmk'
and
let g:vimtex_compiler_latexmk.options += ['-shell-escape']
let g:vimtex_compiler_method = 'latexmk'
but it didn't solve the problem
Edit 3
I tried (sequentially) to add the following command in the .vimrc file but it didn't solve the problem:
let g:livepreview_engine = 'evince' . [-shell-escape]let g:livepreview_engine = 'evince' . ['-shell-escape']let g:livepreview_engine = 'evince' . '[-shell-escape]'let g:livepreview_engine =. ' -shell-escape'
Edit 4
I tried also to add the following line in my .vimrc without success
let g:livepreview_engine = 'pdflatex' . '[-shell-escape]'
The problem didn't appear when I used :LLPStartPreview with the following code:
(where the following lines where commented out):
...
\usepackage{minted}
...
\begin{minted}{Python}
print(“Hello world”)
\end{minted}
% !TeX document-id = {f2e9e8a7-1386-4a73-9989-55350ce6c529}
% !TeX TXS-program:pdflatex = pdflatex -synctex=1 -interaction=nonstopmode --shell-escape %.tex
%\documentclass[a4paper, 12pt]{book}
\documentclass{scrreprt}
%\usepackage{fontspec}
%\usepackage{pmboxdraw}
\usepackage{amssymb, amsmath, float, framed, geometry, listings, lmodern, mathtools,multirow,parskip, paralist,pgfplots, ragged2e,setspace,tcolorbox, threeparttable, upquote, url, tikz, enumitem}
\usepackage{bbm}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{xurl}
%\usepackage{minted}
\usepackage{dsfont}
\usepackage{multirow}
\usepackage{tabto}
\usepackage{tabu}
\usepackage[english]{babel}
\usepackage{newtxmath}
\usetikzlibrary{positioning}
\usepackage{xcolor}
\definecolor{mypink1}{RGB}{0, 170, 0}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\fancyhf{}
\pagestyle{fancy}
\rfoot{Page \thepage}
\usepackage[LGR]{fontenc}
\usepackage[T1]{fontenc}
\usepackage[colorlinks]{hyperref}
\hypersetup{
colorlinks,
linkcolor=blue,
filecolor=magenta,
citecolor=mypink1,
urlcolor=cyan,
}
\geometry{
a4paper,
total={170mm,257mm},
left=20mm,
top=20mm,
}
\usepackage{caption}
%\usepackage{calrsfs}
%\DeclareMathAlphabet{\pazocal}{OMS}{zplm}{m}{n}
\begin{document}
blabla
%\begin{minted}{Python}
% print(“Hello world”)
%\end{minted}
\end{document}
dsfonthas nothing to do with this. You need to enable shell-escape for processing documents relying onminted. See https://tex.stackexchange.com/q/99475/4427 – egreg Feb 02 '20 at 16:26let g:livepreview_engine = 'evince' . [-shell-escape]requires the pdfengine, ie. something like latexmk or pdflatex, not evince. Evince is a pdfviewer – DG' Feb 03 '20 at 09:05