Code covered by the BSD License  

Highlights from
teximage.m

4.71429

4.7 | 29 ratings Rate this file 23 Downloads (last 30 days) File Size: 7.67 KB File ID: #1231
image thumbnail

teximage.m

by

 

13 Jan 2002 (Updated )

Displays a LaTeX string as an image.

| Watch this File

File Information
Description

If you have LaTeX already installed, this function will convert LaTeX strings into images and display them in figures.

MATLAB release MATLAB 5.3 (R11)
Other requirements either MiKTeX on PCs or Web2C7.2 or later on Unix.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (33)
17 Jun 2011 Ben

Very nice function!

06 Apr 2011 John de Leon

Hi Ben, does this also work with the latest releases of MATLAB?

12 Jul 2010 Pawel

Does not work under Ubuntu 10.04 with XeLaTex. Requires corrections in the code.

10 Jan 2010 Mohammed

so good !

08 Apr 2007 Luis Rozas  
14 Jan 2007 Clark W

Can we reduce the size of the exported result when using
print -deps ...

19 Oct 2005 jack nice

Can we add the package \usepackage[latin5]{inputenc}

02 Jun 2005 Eddie Fiorelli

Yup, I had to make the same change on line 340.

13 May 2005 Martin Mooslechner

In addition to the 'tex' -> 'latex' change I also had to change the format of the fullfile-String. it contained '\', latex thought of it as an escape character...

I added:
add to line 640: cmd=regexprep(cmd, '\', '/');

to change all the '\' to '/'.
works fine after that...

Martin

30 Jan 2005 Joaquin Orias  
04 Dec 2004 Jurgen Theiss

This is exactly what I was looking for. It works beautifully. However, I also had to make the change from 'tex' to 'latex' on line 340 as pointed out by Peter Lawrence below.

12 Nov 2004 Jeramy Ashlock

I made the change to line 340 (tex->latex) butI get the message

Error running Ghostscript: /bin/bash: /usr/local/matlab/sys/ghostscript/bin/glnx86/gs: /lib/ld-linux.so.1: bad ELF interpreter: No such file or directory

I make symlinks to the newer libraries, e.g.
ln -s /lib/ld-linux.so.2 /lib/ld-linux.so.1, etc... but this doesn't work. I aso tried to symlink the 'gs' binary in the matlab directory to /usr/bin/gs, with more error messages.

I'm using R12 on fedora core 2.

19 Oct 2004 Theodore Sande

Just what I require !

29 Sep 2004 Peter Lawrence

Very pleased, makes matlab plots look very professional.
As with Jøger's point, texpoint did not work for me in my newly installed WinXP+MiKTeX until I changed the string 'tex' to 'latex' in line 340.

17 Jun 2004 Jøger Hansegård

Nice! For Windows+Miktex, change 'tex' to 'latex' in line 340: fullfile(texbin,['tex' exe_ext]).
At least, this works for me.

12 May 2004 ZL Guo

excellent!!!

14 Apr 2004 Federico Forte

Great, great, great!!!

27 Feb 2004 John Long

I have MikTeX installed, but the m-file doesn't work. What executable should I define in the setup?

29 Jun 2003 Wang Gang

Very good!
Maybe you can add the following codes to enable AMSMATH package. A shortcoming is that the saved .fig file has a too big size.

\\documentclass{minimal}\\pagestyle{empty}\\usepackage{color,amsmath}\n

26 May 2003 Stefan Schlamp

There is a problem with the resizing function if the figure also contains a legend. You want to change the function "figuremoved" in the file to include the line

legend('ResizeLegend');

The whole function would then read:
function figuremoved(fig);
fpos = convertUnits(get(fig,'units'),get(fig,'position'),'inches');
H = findall(fig,'type','image','tag','teximage');
H=H(:)';
for h=H
ax = get(h,'parent');
hunits = getappdata(h,'units');
if hunits(1) == 'n'
apos = get(ax,'pos');
pos = getappdata(h,'position');
center = convertUnits(hunits,[pos 10 10],'inches',fpos,'inches');
apos(1:2) = center(1:2) - .5*apos(3:4);
set(ax,'pos',apos);
end
legend('ResizeLegend');
end

In my case, this did not cause problems when no legend was present.

25 May 2003 Madhusudhan Chellappa

Very usefull. And very easy to use.
Thanks Ben

06 May 2003 roby Zopope

It's great

06 May 2003 Steeve Ambroise  
06 May 2003 Steeve Ambroise  
29 Apr 2003 Daniel Zajfman

This is very good!

25 Apr 2003 Praveen Malhotra

This is great! I was looking for this for a long time.

27 Jan 2003 Byunghun Kim

Very good!

08 Jan 2003 Yordan Kyosev

Thanks !

18 Sep 2002 Rahul Shah

Great and nifty utility... I will now be using this regularly to plot figures and include Latex equations. Very easy to use. Absolutely recommended for Matlab/Latex users. Thanks, Ben!

05 Apr 2002 Philipp Baecker

Nice!

07 Feb 2002 Dingyu Xue

Perfectly done work. It is recommended that all the MATLAB/LaTeX users install this work to make their work graphics easier and beautiful.

It is suggested that one can interactively moves the image in the axis with a mouse.

18 Jan 2002 Sebastien PARIS

A Must Have !!!!. Works great !!!.

A Wish ?. Yes could matlab ha a better Latex support ?
because teximage is very usefull but size files increase
too much (due to the bitmap convertion of the Latex string)

14 Jan 2002  
Updates
16 Jan 2002

added quotes when calling the OS so that paths can have spaces in them.

14 Oct 2009

BSD update

28 Oct 2009

remove email address

Contact us