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

I am using the minted package to highlight source code in LaTeX. It works well for a piece of code embedded in \begin{minted} ... \end{minted}. Now the question is if it is possible to highlight a whole file whose path is specified in .tex. Going further, is it possible to let minted to choose an appropriated lexer to use in according to the suffix of a file?

share|improve this question
up vote 5 down vote accepted

To quote the manual:

Finally, there’s the comment \inputminted command to read and format whole files. Its syntax is \inputminted[options]{language}{filename}.

share|improve this answer
Thanks for your comment... Do you have any idea about my last question? – SoftTimur Dec 14 '11 at 13:18
@SoftTimur Sorry, no, if I did I would have said so. I've never used minted. – Torbjørn T. Dec 14 '11 at 13:28
@SoftTimur: You could try to be clever with the \IfEndWith command of xstring or something like that, if you really can't select the lexer yourself every time. – You Dec 14 '11 at 14:11

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.