I am trying to make a simple document, showing MATLAB code, and some images. This is my template that I am using.
\documentclass{article}
\usepackage{graphicx}
\usepackage{float}
\usepackage{amsmath}
\usepackage{amsfonts}
% Correct bad hyphenation here
\hyphenation{}
\begin{document}
I want to put MATLAB code here.
\begin{figure}[H]
\begin{center}
\includegraphics[width=6in]{case2Rect.png}
\caption{Blah}
\label{fig1}
\end{center}
\end{figure}
\end{document}
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.
Thanks.
mcodeisn't part of either MikTeX or TeX Live, so either use plainlistingsor download and installmcode: http://www.mathworks.com/matlabcentral/fileexchange/8015-m-code-latex-package – Torbjørn T. Sep 30 '13 at 18:39%in your code with\%? – Francis Sep 30 '13 at 18:52mcode.mcodeis not on CTAN, and not in the databases of MikTeX, so it wouldn't work for that anyway. A one-time solution is to just placemcode.styin the same folder as your.texdocument. – Torbjørn T. Sep 30 '13 at 18:52mcodeat all, just plainlistingsas in http://tex.stackexchange.com/a/75124/586 – Torbjørn T. Sep 30 '13 at 18:53matlab-prettifierpackage; see this answer. – jub0bs Apr 28 '14 at 16:37