In a project I'm working, all the files are in the same folder (source codes, papers, images, etc).

In the documentation, I'm including some code with minted which is really great, but I want to do something like this:


I know that won't work, but you can see what I want to do. The reason for this, is because I don't want to update documentation every time I change a source file, do you understand? The idea is to leave main.c as it is, and include that file automatically in the documentation.

3 Answers 3


Try \inputminted{c}{main.c} or generally \inputminted[options]{language}{filename} -- see page 4 of the minted manual.

  • 1
    That happens to me bacause of the fast-manual reading :S
    – Tomas
    Nov 8, 2010 at 7:14

I have used listings in the past and am pleased with the results. It support several different programming languages, and is simple, yet powerful:

  • Listings is great, but IMO it isn't as powerful as minted. Because minted relays on pygmentize to make the sintax.
    – Tomas
    Nov 8, 2010 at 15:54

You might consider \usepackage{fancyvrb}. It lets you do simple things like \VerbatimInput{hello.c} or fancy things like
\fvset{frame=single,numbers=left,numbersep=3pt} \VerbatimInput{hello.c} (see page 20 of the manual).

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.