How to Format Matlab Code for Latex


A program called tgrind is available in the sipb locker to help you convert matlab program listings to a form easily includable in a LaTeX document. To use this program, type at the prompt:

athena% add sipb
athena% add consult
athena% tgrind -d /mit/consult/lib/matlab/vgrindefs -latex -lmatlab
filename.m > filename.tex
Type the last two lines all on one line.

To include this file in your document:

That's all there is to it. For more information on using tgrind to format other languages, refer to the following stock answer.
10. LATEX Answers
21. How to include SOURCE CODE in documents
For other general information, type
man tgrind
at the athena prompt (after typing add sipb).