Publish M-file in LaTeX

Convert m-files (or code in general) to LaTeX input that numbers lines, etc.
2.3K Downloads
Updated 5 Nov 2004

No License

This function was written specifically for importing algorithms quickly into LaTeX with little user interaction. It automatically numbers each line and maintains indenting. The user can optionally pass a cell array of keywords and a LaTeX command to apply to each of them (I usually use \textbf), and a shortcut exists for specifying MATLAB flow control commands as keywords. Output is stored in a file with a .tab extension.

Cite As

Tim Popham (2024). Publish M-file in LaTeX (https://www.mathworks.com/matlabcentral/fileexchange/6104-publish-m-file-in-latex), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14SP1
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0

After receiving several emails reporting incompatability with older MatLab versions, I revised the code to use an older data import function. The new implementation is slower so I have included both functions.