MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

# Thread Subject: preview latex in the matlab editor

Subject: preview latex in the matlab editor

From: Uwe Brauer

### Uwe Brauer

Date: 9 Dec, 2012 21:12:15

Message: 1 of 5

Hello

I use most of the time (X)emacs with Eric L matlab-mode.
However Xemacs allows me to display math formula which I
add in the doc strings of my program, as png.

I have screenshots, but unfortunately I cannot attach them here.
Could such a feature be implemented.

It would so to speak be a sort of Matlab Notebook (MS Word) feature.

thanks

Uwe Brauer

Subject: preview latex in the matlab editor

From: Yair Altman

### Yair Altman

Date: 10 Dec, 2012 07:08:10

Message: 2 of 5

"Uwe Brauer" wrote in message <ka2urf$rgp$1@newscl01ah.mathworks.com>...
> Hello
>
> I use most of the time (X)emacs with Eric L matlab-mode.
> However Xemacs allows me to display math formula which I
> add in the doc strings of my program, as png.
>
> I have screenshots, but unfortunately I cannot attach them here.
> Could such a feature be implemented.
>
> It would so to speak be a sort of Matlab Notebook (MS Word) feature.
>
> thanks
>
> Uwe Brauer

Take a look at the publish function and its functionality, which is integrated in the Matlab Editor: http://www.mathworks.com/help/matlab/matlab_prog/marking-up-matlab-comments-for-publishing.html

Specifically, you can use it to create a doc with a LaTeX formula

Yair Altman
http://UndocumentedMatlab.com

Subject: preview latex in the matlab editor

From: Uwe Brauer

### Uwe Brauer

Date: 10 Dec, 2012 11:47:08

Message: 3 of 5

"Yair Altman" wrote in message <ka41oq$j94$1@newscl01ah.mathworks.com>...
> "Uwe Brauer" wrote in message <ka2urf$rgp$1@newscl01ah.mathworks.com>...
> > Hello
> >
> > I use most of the time (X)emacs with Eric L matlab-mode.
> > However Xemacs allows me to display math formula which I
> > add in the doc strings of my program, as png.
> >
> > I have screenshots, but unfortunately I cannot attach them here.
> > Could such a feature be implemented.
> >
> > It would so to speak be a sort of Matlab Notebook (MS Word) feature.
> >
> > thanks
> >
> > Uwe Brauer
>
>
> Take a look at the publish function and its functionality, which is integrated in the Matlab Editor: http://www.mathworks.com/help/matlab/matlab_prog/marking-up-matlab-comments-for-publishing.html
>
> Specifically, you can use it to create a doc with a LaTeX formula
>
> Yair Altman
> http://UndocumentedMatlab.com
>

Well I know about publish (I even have proposed some changes in the template in order to use the listings env instead of verbatim)

But publish is something very different from what I have in mind. publish
generates a LaTeX file, while I am talking of displaying LaTeX formula in the editor as png. If you want I send you a screenshot.

Subject: preview latex in the matlab editor

From: Nasser M. Abbasi

### Nasser M. Abbasi

Date: 10 Dec, 2012 12:29:00

Message: 4 of 5

On 12/10/2012 5:47 AM, Uwe Brauer wrote:

> LaTeX formula in the editor as png. If you want I send you a screenshot.
>

can't you just send it to a figure, then send that as .png? as in

close all
text(.2,.5,...
{'$\ddot{u}+2\xi\omega\dot{u}+\omega^{2}u=0$',...
'$u\left(t\right)=\left(u_{0}+\left(v_{0}+u_{0}\omega\right)t\right)e^{-\omega t}$'},...
'interpreter','latex','FontSize',14)

screen shot

http://12000.org/tmp/dec_10_2012/latex_matlab.png

--Nasser

Subject: preview latex in the matlab editor

From: Yair Altman

### Yair Altman

Date: 10 Dec, 2012 17:25:10

Message: 5 of 5

"Uwe Brauer" wrote in message <ka4i3s$bhb$1@newscl01ah.mathworks.com>...
[snip]
> publish generates a LaTeX file, while I am talking of displaying LaTeX formula in the editor as png.

This is not entirely correct. If you publish to an HTML webpage, for example, then the LaTeX formula is saved as a PNG image file.

However, if your point is that you want to embed LaTeX rendering for *display in* (as opposed to *generation by*) the Matlab Editor, then this is not possible (AFAIK). The Matlab Editor can only display text in documents (tabs) that display file contents.

You can display docked figures in the Editor as separate tabs (see the setFigDockGroup utility - http://www.mathworks.com/matlabcentral/fileexchange/16650-setfigdockgroup), but in an editable file tab you can only display text, not images.

Yair Altman
http://UndocumentedMatlab.com