..png)
오늘 출시된 TeX Live 2016을 설치했습니다(개발자에게 감사드립니다).
이제 다음과 같은 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}
실행할 때 pdflatex --shell-escape test.tex
파일을 실행하고 예상대로 PDF를 생성합니다. 같은 작업을 수행하면 lualatex --shell-escape test.tex
실패합니다.
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}{}
?
언급했듯이 새로 설치된 TeX Live 2016입니다. 또한 설치된 Pygmentize 버전인 2.1.3(pip를 통해 설치됨)을 확인했습니다. 그러나 위 코드는 TeX Live 2015로 테스트해 보면 pdflatex와 lualatex 모두에서 문제 없이 작동합니다.
이 문제를 해결하는 방법에 대한 힌트를 주는 사람이 있습니까? 아니면 보고해야 할 lualatex 또는 minted(또는 다른 패키지)의 버그입니까?
업데이트:버전 2.2(2016-06-08) 에서는 주석에서 @David Carlisle 및 @egreg가 언급한 대로 minted
패키지가 자동으로 패키지를 로드합니다 . shellesc
따라서 이 버전을 설치하면 더 이상 문제가 발생하지 않습니다.
답변1
LuaTeX 0.90에서 LuaLaTeX와의 호환성을 위해 를 사용하는 여러 패키지를 \write18
업데이트해야 합니다. minted
그 중에 있습니다.
그러나 shellesc
패키지는 필요한 해결 방법을 제공합니다.
\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}
(그것을 지적한 것은 ArtTourter의 공로입니다).
다음 은 의 재정의에 의존하지 않고 보다 안전한 방법 \immediate\write18
인 의 모든 모양을 로 대체하는 패치 세트입니다 .\ShellEsc
\write
이 패치에는 LuaLaTeX가 전혀 필요하지 않으므로 코드는 모든 엔진에서 작동합니다.
\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}
참고: Windows에서는 패치를 확인할 수 없으므로 이 경우 패치가 완전하지 않을 수 있습니다.
다음을 사용하는 경우 더 짧은 코드를 사용할 수 있습니다 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}