I am trying to make a simple document, showing MATLAB code, and some images. This is my template that I am using.


% Correct bad hyphenation here


I want to put MATLAB code here.



The problem is that MATLAB code is full of comments that use '%', and so when I try to compile using pdfLaTeX, it crashes. I am using TexMaker btw. Anyway, I was wondering what technique might be used to go around this problem. I simply need to show MATLAB code, along with some images. I am relatively new to LaTeX.



You can use the Listings package to include all kinds of code into Latex. The listings package supports syntax highlighting of a number of languages. You can also define own styles.

A good place to start

  • 1
    I think what you wrote in your answer has been extensively said in the above comments... Sep 30 '13 at 20:15

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