2

The code it's not working on Overleaf when it comes to minted environment (or mint command) used in a file placed in a subdirectory. Note that the very same code works if placed in main directory. Tested on Chrome with LaTex,PdfLaTex,XeLaTex and LuaLaTex

You can test the example on Overleaf site but for your convenience I can add a MWE:

\documentclass{article}
\usepackage{minted}

\begin{document}
test
\begin{minted}{python}
import numpy as np

def incmatrix(genl1,genl2):
    m = len(genl1)

\end{minted}

\mint{html}|<h2>Something <b>here</b></h2>|

\end{document}

This will produce only the line "test".

Please note that \inputminted works as a charm; I adopted this as a workaround but there are cases in which it is really a nuisance.

Obviously with non trivial projects it is almost impossible for me to keep every file in the same (overleaf) folder.

The log says:(twice, another almost identical is for \mint)

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,
or may be using frozencache with a missing file.

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

l.12 \end{minted}

This could be caused by using -output-directory or -aux-directory 
without setting minted's outputdir, or by using a build tool that 
changes paths in ways minted cannot detect, 
or using frozencache with a missing file.
  • what error message do you get in the log? Your file (in texlive) runs without error producing this output – David Carlisle Mar 8 at 16:05
  • I edited my question to add the log output and to state clearly that code is working if placed in main directory. – massi Mar 8 at 16:27
  • oh yes overleaf renames its files in interesting ways, it's an overleaf question then I think you'd be better asking their support – David Carlisle Mar 8 at 16:50
3

(Tom from Overleaf Support Team speaking.)

Unfortunately, this is a limitation of the current setup of Overleaf, sorry for this. The main file should preferably be always placed in the main directory; this is essential in particular for any document that uses external tools, which is the case also for minted.

| improve this answer | |

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.