.png)
Instalé TeX Live 2016 tal como se lanzó hoy (gracias a los desarrolladores por eso).
Ahora tengo el siguiente 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}
Cuando se ejecuta pdflatex --shell-escape test.tex
, revisa el archivo y produce el PDF como se esperaba. Hacer lo mismo con lualatex --shell-escape test.tex
falla con
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 se mencionó, es un TeX Live 2016 recién instalado; También verifiqué la versión instalada de Pygmentize, que es 2.1.3 (instalada mediante pip). Sin embargo, al probar con TeX Live 2015, el código anterior funciona sin problemas tanto con pdflatex como con lualatex.
¿Alguien tiene una pista para mí sobre cómo solucionar este problema, o es un error en lualatex o minted (o cualquier otro paquete) que deba informarse?
Actualizar:Con minted
la versión 2.2 (08/06/2016), el paquete se carga shellesc
automáticamente, como lo mencionan @David Carlisle y @egreg en los comentarios; por lo tanto, el problema no debería volver a ocurrir si tiene instalada esta versión.
Respuesta1
Varios paquetes que lo utilicen \write18
deberán actualizarse para que sean compatibles con LuaLaTeX en LuaTeX 0.90; minted
está entre ellos.
Sin embargo, el shellesc
paquete proporciona la solución necesaria:
\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 a ArTourter por notarlo).
Aquí hay un conjunto de parches que reemplazan todas las apariencias de \immediate\write18
con \ShellEsc
, de la manera más segura sin depender de redefiniciones de \write
.
Estos parches no necesitan LuaLaTeX en absoluto, por lo que el código funciona con todos los 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}
Nota: No puedo comprobar los parches en Windows, por lo que es posible que no estén completos en ese caso.
Hay un código más corto disponible si se usa 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}