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:


import numpy as np

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


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


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 Mar 8, 2020 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, 2020 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 Mar 8, 2020 at 16:50

2 Answers 2


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

  • 1
    Is this something that could be worked around with a change to minted?
    – Eric
    Nov 16, 2020 at 13:14
  • 1
    Hi Eric! No, I'm afraid this is a given by our setup. We are looking into ways how to remove this burden, and we have ideas how to do that, but none of them is fully backwards-compatible; we know that if we change the ways how we call LaTeX, we'll break something for someone :-/
    – yo'
    Nov 16, 2020 at 13:25
  • In the meantime, is there some way to point an overleaf project to a subdirectory of a larger github project?
    – Eric
    Nov 16, 2020 at 13:45
  • @Eric I'm afraid not directly, sorry for this. But you should be able to do it relaying via a local repo using the git bridge (not the GitHub sync). You would sync the whole GitHub repo with local, and then only sync a subdir with Overleaf.
    – yo'
    Nov 16, 2020 at 14:29
  • 1
    @Eric That was basically the idea, yes. It's not optimal, but it provides more control than the GitHub sync, which really only synces the whole repo with the project, without any finer control. (Btw, I hate to flood the comments here with unrelated issues as that's not probably a proper thing to do :) , so I suggest you contact us at support@overleaf.com if you have any more questions. Thanks!)
    – yo'
    Nov 16, 2020 at 15:37

It is an actual bug, and the proposed workaround by @yo' using outputdir option is not working

I already reported this on github: https://github.com/gpoore/minted/issues/233

New contributor
Sebastián Cea is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • 1
    I won't be that sure until the developer states it's a bug (or e.g. you point out where the bug is and how to fix it). Maybe you're just using the option incorrectly.
    – user202729
    23 hours ago

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.