4.2

4.2 | 5 ratings Rate this file 87 Downloads (last 30 days) File Size: 5.71 KB File ID: #13277

Matlab 2 Latex

by Kevin Mader

 

06 Dec 2006 (Updated 11 Dec 2006)

A function to convert matlab functions to formatted colored .tex files .

| Watch this File

File Information
Description

m2tex converts a matlab file into a colored, tabbed .m file will all of the proper symbols converted to be latex compatible.
The latex files it produces can easily be included in other files by using /input{filename}
or /texttt{input{filename}} for more matlab look to the code
Remember latex assumes that the extension for any file used in the input command is .tex so you should not put it on.

There is another program on the site that lets you put .m files in latex that I did not find until I had already written this. This program is different because it is a matlab function that converts your code to .tex. The other is a latex style that lets you import matlab code.

MATLAB release MATLAB 7.3 (R2006b)
Other requirements Latex
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (10)
07 Dec 2006 Barun Mishra

Thats really amazing to know about converting .m file to TeX files. I was looking for this for a long time.

07 Dec 2006 Chris Buc

If you want to include .m file into LaTeX document you can use listings package. Maybe it isn't so full of colors but it gives same functionality and even more as your program.
However program is nice :)

28 Dec 2006 Pierre Bertrand

Great job.
Exactly what I needed :o)

29 Oct 2007 Matthias Hein

works nicely out of the box. Thanks !

01 Dec 2007 emma olsen

How do I get this file to work?? I have save the m2tex-file, but I just get error messages when I try to run it.. Can anyone help me out here?

06 May 2008 benno bernen

m.file is called root.m. I want to converte in a tex.file? But there are so many mistakes. how does it work??

24 Jul 2009 Mehmet Niyazi ÇANKAYA

Sorry this program does not work I take the following error meassage

??? Input argument "filein" is undefined.

Error in ==> m2tex at 22
    fileout=[filein(1:end-1) 'tex'];

05 Dec 2009 Josh Inya

Dear Mehmet Niyazi CANKAYA:

Try the follwing:

>>m2tex('Script.m')

where Script.m is the name of your m-file. and check the same folder where Script.m is stored for a new file titled: Script.tex.

hope this helps!

10 Dec 2009 Chirackel Yoonus  
26 Oct 2011 Harold

I was actually going to make something like this until I found this program. Now what would be cool is to convert the program to latex in real-time as you type the code. It would be nice to see the latex version of what you are typing in real-time because it looks better graphically.

Please login to add a comment or rating.
Updates
07 Dec 2006

Added the ability to input a string for conversion

11 Dec 2006

Fixed two bugs, one relating to { , } , _ characters. The other about indenting.

Tag Activity for this File
Tag Applied By Date/Time
development environment Kevin Mader 22 Oct 2008 08:51:33
matlab Kevin Mader 22 Oct 2008 08:51:33
publish Kevin Mader 22 Oct 2008 08:51:33
latex Kevin Mader 22 Oct 2008 08:51:33
latex Chetan 08 May 2009 20:22:47
latex Hua 14 Sep 2009 05:56:52
latex Christopher Zerafa 05 May 2011 05:52:49
development environment Henk 13 Jul 2011 13:55:54
latex Henk 13 Jul 2011 13:55:57
development environment Luca Cavazzana 17 Dec 2011 04:27:29

Contact us at files@mathworks.com