Access Keys:
Skip to content (Access Key - 0)

How can I 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

To include this file in your document:

  • Edit the output from tgrind to remove the first ("\input tgrindmac") and last ("\vfill\eject\end") lines from the file.
  • Make sure you have the tgrind documentstyle option specified. (Include tgrind in the square brackets in the \documentstyle command at the top of your file.)
  • Place the line
        \tgrindfile{mycode.m.tex}
    

    in your .tex file where you want to insert the formatted code.

IS&T Contributions

Documentation and information provided by IS&T staff members


Last Modified:

February 18, 2009

Get Help

Request help
from the Help Desk
Report a security incident
to the Security Team
Labels:
olc-matlab olc-matlab Delete
matlab matlab Delete
latex latex Delete
format format Delete
matlab-review matlab-review Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
Feedback
This product/service is:
Easy to use
Average
Difficult to use

This article is:
Helpful
Inaccurate
Obsolete
Adaptavist Theme Builder (4.2.3) Powered by Atlassian Confluence 3.5.13, the Enterprise Wiki