11

I know there is available in the MATLAB Central File Exchange site the mcode.sty package, which allows to put MATLAB codes into TeX files.

http://www.mathworks.com/matlabcentral/fileexchange/8015-m-code-latex-package

However, there is also available in LaTeX a package called listings.sty, which I guess does pretty much the same thing.

http://en.wikibooks.org/wiki/LaTeX/Source_Code_Listings

What is the difference between them? Are there any advantages or disadvantages?

1
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Ruben Nov 29 '14 at 22:40
13

mcode is customized to write matlab codes. It too uses listings for this job. Hence it is like a ready made shirt, you just wear it. listings is like cloth from which you have to stitch the shirt yourself. It is a general package for typesetting codes. You have to define the setting for matlab yourself and use it.

Hence the bottom line is, with mcode you have predefined settings for matlab code while with listings you have to define them. It is listings that is in action with both packages.

PS: There is matlab-prettifier by jubobs, that is recent and has much more than mcode to offer. I advice to try it for typesetting matlab codes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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