TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 18 down vote accepted

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

share|improve this answer
That happens to me bacause of the fast-manual reading :S – Tomas Nov 8 '10 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:

share|improve this answer
Listings is great, but IMO it isn't as powerful as minted. Because minted relays on pygmentize to make the sintax. – Tomas Nov 8 '10 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).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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