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

Currently, I have something like this:

public static void Main (string[] args)
  Console.WriteLine ("Hello World!");

Where the source code is copy/pasted from a source file.

Is there any way to include the full file within the minted section?

That way, when my code changes, my PDF will automatically update.

share|improve this question
up vote 31 down vote accepted

minted has \inputminted[<options>]{<language>}{<filename>} that might help you. According to the documentation, this command is used to read and format whole files.

Let's say you have your code inside hello.cs:

public static void Main (string[] args)
    Console.WriteLine ("Hello World!");

Then, in your LaTeX document:






The output is as expected:


Hope it helps. :)

share|improve this answer
Success! That worked for me, thank you very much. – Robert Greiner Feb 10 '12 at 19:20

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.