4

Given the following LaTeX document (minimal.tex):

\documentclass{article}
\usepackage{minted}
\begin{document} 
\begin{minted}{c} 
int main() {
    printf("hello, world");
    return 0;
}
\end{minted} 
\end{document}

I can build it with:

pdflatex -shell-escape  minimal.tex

But I would like to put the build files in another directory, so I use -output-directory=build, like:

pdflatex -shell-escape -output-directory=build minimal.tex

But this way I get:

...
(/usr/local/texlive/2016/texmf-dist/tex/latex/xcolor/xcolor.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics-cfg/color.cfg)
(/usr/local/texlive/2016/texmf-dist/tex/latex/pdftex-def/pdftex.def
(/usr/local/texlive/2016/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
))) (./_minted-minimal/default-pyg-prefix.pygstyle)Error: cannot read infile: [Errno 2] No such file or directory: 'minimal.pyg'
system returned with code 256


! 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.

See the minted package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.9 \end{minted}

The minimal.pyg actually is inside build directory, but it seems not to be found.

What can I do?

4

You need \usepackage[outputdir=build]{minted} to tell minted where the files went.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.