그누플로텍스와 루아라텍스

그누플로텍스와 루아라텍스

편집하다:이 질문은 다음의 버그를 다룹니다.gnuplottex이는 TeXLive 2013에서 수정될 예정입니다. 그래도 버그를 수정하려면 CTAN에서 최신 업스트림 버전을 다운로드하여 직접 컴파일하세요.


허락하다gnu.tex

\documentclass[border=3mm]{standalone}
\usepackage{gnuplottex} % use gnuplot
\usepackage{epstopdf} % convert resulting eps to pdf
\begin{document}

\begin{gnuplot}[terminal=epslatex,terminaloptions=color]
    set xlabel '$x$'
    set ylabel '$y$'
    plot sin(x) title '$\sin x$'
\end{gnuplot}

\end{document}

지금은 다음과 같이 컴파일하려고 합니다 lualatex. 불행히도 이것은 작동하지 않습니다. 나는 lualatex그런 식으로 전화를 걸었다.

$ lualatex --shell-escape gnu.tex

로그 파일을 읽습니다.

...
 \write18 enabled.
...
Package gnuplottex Warning: Shell escape not enabled.
(gnuplottex)                You'll need to convert the graphs yourself..
...

pdflatex및 명령줄을 사용하여 컴파일하면

$ pdflatex --shell-escape gnu.tex

그것은 잘 작동합니다.

요약:gnuplottex와 호환되지 않습니까 lualatex?

답변1

나는 이것을 버그라고 생각합니다 gnuplottex.sty. 패키지는 파일을 작성 /tmp하고 이름을 할당하여 쉘 탈출을 테스트합니다.없이확대. TeX 구현은 파일 이름에서 누락된 확장자를 처리하는 방식이 다를 수 있지만 확장자가 발견되면 동일한 작업을 수행해야 합니다. 그렇다면 테스트는

%% test if shell escape really works
\ifShellEscape
  \def\tmpfile{/tmp/w18-test-\the\year\the\month\the\day\the\time.tex}
  \ifmiktex
    \def\tmpfile{w18-test-\the\year\the\month\the\day\the\time.tex}
    \immediate\write18{echo t > "\tmpfile"}
  \else
    \immediate\write18{touch \tmpfile}
  \fi
  \IfFileExists{\tmpfile}{\ShellEscapetrue}{\ShellEscapefalse}
  \ifmiktex
    \immediate\write18{del "\tmpfile"}
  \else
    \immediate\write18{rm -f \tmpfile}
  \fi
\fi

모두 작동합니다(명시적인 확장을 추가했습니다 .tex).

자체 테스트를 추가하여 이 버그를 해결할 수 있습니다.

\documentclass[border=3mm]{standalone}
\usepackage{gnuplottex} % use gnuplot
\usepackage{pdftexcmds,ifluatex}
\makeatletter
\ifluatex
  \ifnum\pdf@shellescape=\@ne
    \ShellEscapetrue
  \fi
\fi
\makeatother

\usepackage{epstopdf} % convert resulting eps to pdf
\begin{document}

\begin{gnuplot}[terminal=epslatex,terminaloptions=color]
    set xlabel '$x$'
    set ylabel '$y$'
    plot sin(x) title '$\sin x$'
\end{gnuplot}

\end{document}

메시지는 계속 표시되지만 -shell-escape명령줄에 를 입력하면 문서가 올바르게 컴파일됩니다. 하지만 이 해결 방법을 위해서는 LuaTeX 버전 >0.67이 필요합니다.

관련 정보