.png)
Instalei o TeX Live 2016 conforme foi lançado hoje (graças aos desenvolvedores por isso).
Agora tenho o seguinte MWE:
\documentclass{article}
\usepackage{minted}
\begin{document}
\begin{minted}{ruby}
class Foo
def init
pi = Math::PI
@var = "Pi is approx. #{pi}"
end
end
\end{minted}
\end{document}
Ao ser executado, pdflatex --shell-escape test.tex
ele percorre o arquivo e produz o PDF conforme o esperado. Fazer o mesmo com lualatex --shell-escape test.tex
falha com
This is LuaTeX, Version 0.95.0 (TeX Live 2016)
system commands enabled.
(./test.tex
LaTeX2e <2016/03/31>
Babel <3.9r> and hyphenation patterns for 1 language(s) loaded.
(/opt/texlive/2016/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/opt/texlive/2016/texmf-dist/tex/latex/base/size10.clo))
(/opt/texlive/2016/texmf-dist/tex/latex/minted/minted.sty
(/opt/texlive/2016/texmf-dist/tex/latex/graphics/keyval.sty)
(/opt/texlive/2016/texmf-dist/tex/latex/oberdiek/kvoptions.sty
(/opt/texlive/2016/texmf-dist/tex/generic/oberdiek/ltxcmds.sty)
(/opt/texlive/2016/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
(/opt/texlive/2016/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/opt/texlive/2016/texmf-dist/tex/generic/oberdiek/etexcmds.sty
(/opt/texlive/2016/texmf-dist/tex/generic/oberdiek/ifluatex.sty))))
(/opt/texlive/2016/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty
Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix
<2008/02/07> (tvz)) (/opt/texlive/2016/texmf-dist/tex/latex/float/float.sty)
(/opt/texlive/2016/texmf-dist/tex/latex/base/ifthen.sty)
(/opt/texlive/2016/texmf-dist/tex/latex/tools/calc.sty)
(/opt/texlive/2016/texmf-dist/tex/latex/ifplatform/ifplatform.sty
(/opt/texlive/2016/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty
(/opt/texlive/2016/texmf-dist/tex/generic/oberdiek/ifpdf.sty)
(/opt/texlive/2016/texmf-dist/tex/generic/oberdiek/luatex-loader.sty
(/opt/texlive/2016/texmf-dist/scripts/oberdiek/oberdiek.luatex.lua)))
(/opt/texlive/2016/texmf-dist/tex/generic/oberdiek/catchfile.sty)
uname -s > "test.w18"
! Package catchfile Error: File `test.w18' not found.
See the catchfile package documentation for explanation.
Type H <return> for immediate help.
...
l.93 \CatchFileDef\@tempa{\ip@file}{}
?
Como mencionado, é um TeX Live 2016 recém-instalado; Também verifiquei a versão instalada do Pygmentize, que é 2.1.3 (instalada via pip). Testando com TeX Live 2015, o código acima, entretanto, funciona sem problemas tanto com pdflatex quanto com lualatex.
Alguém tem uma dica para mim sobre como consertar isso, ou é um bug no lualatex ou no minted (ou qualquer outro pacote) que deve ser relatado?
Atualizar:Com minted
a versão 2.2 (08/06/2016), o pacote carrega o shellesc
pacote automaticamente, conforme mencionado por @David Carlisle e @egreg nos comentários; portanto, o problema não deverá mais ocorrer se você tiver esta versão instalada.
Responder1
Vários pacotes em uso \write18
precisarão ser atualizados para compatibilidade com LuaLaTeX no LuaTeX 0.90; minted
está entre eles.
No entanto, o shellesc
pacote fornece a solução necessária:
\documentclass{article}
\usepackage{shellesc}
\usepackage{minted}
\begin{document}
\begin{minted}{ruby}
class Foo
def init
pi = Math::PI
@var = "Pi is approx. #{pi}"
end
end
\end{minted}
\end{document}
(crédito ao ArTourter por notá-lo).
Aqui está um conjunto de patches que substituem todas as aparências de \immediate\write18
, \ShellEsc
da maneira mais segura, sem depender de redefinições de \write
.
Esses patches não precisam do LuaLaTeX, então o código funciona com todos os motores.
\documentclass{article}
\usepackage{shellesc,xpatch}
\usepackage{minted}
\makeatletter
\xpatchcmd{\DeleteFile}
{\immediate\write18}
{\ShellEscape}
{}{}
\xpatchcmd{\DeleteFile}
{\immediate\write18}
{\ShellEscape}
{}{}
\xpatchcmd{\ProvideDirectory}
{\immediate\write18}
{\ShellEscape}
{}{}
\xpatchcmd{\TestAppExists}
{\immediate\write18}
{\ShellEscape}
{}{}
\xpatchcmd{\TestAppExists}
{\immediate\write18}
{\ShellEscape}
{}{}
\xpatchcmd{\minted@checkstyle}
{\immediate\write18}
{\ShellEscape}
{}{}
\xpatchcmd{\minted@checkstyle}
{\immediate\write18}
{\ShellEscape}
{}{}
\xpatchcmd{\minted@checkstyle}
{\immediate\write18}
{\ShellEscape}
{}{}
\xpatchcmd{\minted@checkstyle}
{\immediate\write18}
{\ShellEscape}
{}{}
\xpatchcmd{\minted@pygmentize}
{\immediate\write18}
{\ShellEscape}
{}{}
\xpatchcmd{\minted@pygmentize}
{\immediate\write18}
{\ShellEscape}
{}{}
\xpatchcmd{\minted@pygmentize}
{\immediate\write18}
{\ShellEscape}
{}{}
\xpatchcmd{\minted@pygmentize}
{\immediate\write18}
{\ShellEscape}
{}{}
\xpatchcmd{\minted@pygmentize}
{\immediate\write18}
{\ShellEscape}
{}{}
\makeatother
\begin{document}
\begin{minted}{ruby}
class Foo
def init
pi = Math::PI
@var = "Pi is approx. #{pi}"
end
end
\end{minted}
\end{document}
Observação: não consigo verificar os patches no Windows, portanto, nesse caso, eles podem não estar completos.
Um código mais curto está disponível se alguém usar regexpatch
:
\documentclass{article}
\usepackage{shellesc,regexpatch}
\usepackage{minted}
\makeatletter
\xpatchcmd*{\DeleteFile}
{\immediate\write18}
{\ShellEscape}
{}{}
\xpatchcmd*{\ProvideDirectory}
{\immediate\write18}
{\ShellEscape}
{}{}
\xpatchcmd*{\TestAppExists}
{\immediate\write18}
{\ShellEscape}
{}{}
\xpatchcmd*{\minted@checkstyle}
{\immediate\write18}
{\ShellEscape}
{}{}
\xpatchcmd*{\minted@pygmentize}
{\immediate\write18}
{\ShellEscape}
{}{}
\makeatother
\begin{document}
\begin{minted}{ruby}
class Foo
def init
pi = Math::PI
@var = "Pi is approx. #{pi}"
end
end
\end{minted}
\end{document}