minted는 출력 디렉터리 옵션이 주어졌을 때 캐시를 사용하지 않는 것 같습니다.

minted는 출력 디렉터리 옵션이 주어졌을 때 캐시를 사용하지 않는 것 같습니다.

소스 외부에서 빌드 중이므로 빌드 명령은 다음과 같습니다.

pdflatex -shell-escape --halt-on-error -output-directory="/tmp/build" book.tex

구문 강조를 위해 minted를 사용하고 있습니다.

\newcommand{\mintedoptions}{cachedir=/tmp/mint}
\usepackage[\mintedoptions]{minted}
\begin{document}
\inputminted{c}{program.c}
\end{document}

이 정도는 잘 작동했지만 소개하려고 할 때 \begin{minted}{c}...\end{minted}다음 오류가 발생했습니다.

! Package minted Error: Missing Pygments output; \inputminted was
probably given a file that does not exist--otherwise, you may need 
the outputdir package option, or may be using an incompatible build tool.

이 문제는해결되었습니다, 내 문서에 수정 사항을 적용했습니다.

\newcommand{\mintedoptions}{cachedir=/tmp/mint,outputdir=/tmp/build}

이제 문서는 분명히 올바르게 컴파일되지만 생성된 캐시는 사용되지 않는 것 같습니다. 생성된 모든 코드 조각이 매번 처음부터 다시 컴파일되기 때문에 컴파일 속도가 매우 느립니다.

출력 디렉터리를 지정하고 캐시를 계속 사용하려면 어떻게 해야 합니까?

전체 MWE는 다음과 같습니다.

\documentclass[a4paper,10pt]{scrbook}
\newcommand{\mintedoptions}{cachedir=/tmp/mint2,outputdir=/tmp/xxx}
\usepackage[\mintedoptions]{minted}
\begin{document}
\inputminted{c}{program.c}
\begin{minted}{c}
int main ();
\end{minted}
\end{document}

다음으로 컴파일됨

mkdir /tmp/xxx && pdflatex -shell-escape --halt-on-error -output-directory="/tmp/xxx" mwe.tex

관련 정보