Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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:

\begin{minted}{c}
    \input{main.c}
\end{minted}

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

3 Answers 3

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
1  
That happens to me bacause of the fast-manual reading :S –  Tomas Nov 8 '10 at 7:14

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

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

\lstset{language=C}
\input{funkyalg.c}
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

Your Answer

 
discard

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.