# Latex in Igor?

There have been a few attempts to get Igor to use Latex output. Some seem to work but are cumbersome (e.g., loading an image). Direct support in igor would be nice. In the maillist, a recent exchange highlights the need. As one can see from Jim Prouty's response, the equivalent Igor way of including a fraction is a long, difficult to learn / remember string. Moreover, it does not begin to approach Latex's range and control over formatting. For example, with packages, one can distinguish in Latex among \frac, \tfrac, \sfrac, etc. -- each of which does something slightly different. The range of symbols is far larger, etc.

So, having an option to replace Igor's system of control for labels, etc. with Latex syntax would improve the program (and make it easier to learn for those who already know Latex).

________________________________________________________

On Feb 2, 2012, at 5:18 PM, David Nicholls wrote:

> I've been trying to insert a "vertical" fraction character into an annotation on a graph. i.e. I want the equivalent of the LaTex $\frac{1}{2}$
>

From: Jim Prouty
Subject: Re: Vertical fractions in annotations? LaTeX? (Mac)

You can use the escape codes to do this directly:

This is \[1\S1\y-15\L1400\X1\Y1\M\B2\M of the total
________________________________________________________

I too would like to see that, and I think many would.

Out of curiosity, do you know of any programs that do this?
Add my vote here.

I could settle for something akin to LinkBack on the Mac using LaTeXiT, where an annotation text would become a dynamic link to an engine that parses the LaTeX code. The inverse of this process is what many want Igor to be able to do after they paste a graph in to a Word document -- have that graph serve as a dynamic link back to Igor for making changes.

ps -- The ability of (annotation) objects in Igor to serve as "buttons" that call out to scripts and then fill their contents with the return contents would be a generally useful thing all around.

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
Sure, it'd be great to have better LaTeX integration in Igor, but this new project release might be useful now:

The LaTeX Pictures.ipf procedure file implements a "LaTeX Pictures" panel which uses a web site to render LaTeX math equations into PNG bitmaps. Igor 6.20 or later is required.

This version generates only PNG pictures that can be drawn in Igor annotations and with DrawPICT (Igor's drawing tools).

This is mostly a proof-of-concept project that would be improved by finding or establishing an online LaTeX-to-PDF renderer to provide high-resolution equations.

See the project page for more details and to download the procedure file.

http://www.igorexchange.com/project/LaTeXPictures

--Jim Prouty
Software Engineer, WaveMetrics, Inc.
Check this out for saving PDF images. THere are other options, for size, inlineness, etc.
Function getexample(formula)
String formula, picture = ""
formula = replacestring(" ", formula, "&space;")
print formula
formula = + formula
EasyHttp/TIME=10/File="foobar:Users:anz:Desktop:eqn.pdf" formula
//alternatively
//EasyHttp/TIME=10 formula, picture
print V_flag
End

Function test()
getexample("x=\frac{-b\pm\\sqrt{b^2-4ac}}{2a }")
End
On the Mac, yes.

Not so much on Windows, where Igor can't load PDFs as pictures. Perhaps EMF can work, though what I've seen from that site looks pretty bad in EMF format.

--Jim Prouty
Software Engineer, WaveMetrics, Inc.
JimProuty wrote:
On the Mac, yes.
Not so much on Windows

Oh dear, when will Microsoft learn how to create proper screen display.

How about PNG, that seems to work ok.
andyfaff wrote:
... How about PNG, that seems to work ok.

Isn't that still BITMAPPED though?

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
So any chance I can get the following in escape code format? :

theta = base + (max - base) / (1 + (K_d/x)^rate)

It is the hill equation which I have entered in the user defined function section. Annoyingly, Igor presents the formula nicely in the fitting GUI, but there is no way to lift or otherwise export this to, for example, an annotation. Ive been digging thru the escape codes thanks to this thread, but have yet to find any documentation that explains just exactly what each code is doing, and trying to work backwards from the example given in the OP here resulted in many headaches.

Ultimately I suppose I will just paste in a picture of the formula from another program, but it sure would be neat to have the same matching text etc as Igor and not have to bandage things like that.

EDIT: Microsoft paint to the rescue. made a copy graph with all the required symbols etc and just copy pasted them into place in the final image file. Ugh.
daggaz wrote:
So any chance I can get the following in escape code format? :

theta = base + (max - base) / (1 + (K_d/x)^rate)

It is the hill equation which I have entered in the user defined function section. Annoyingly, Igor presents the formula nicely in the fitting GUI, but there is no way to lift or otherwise export this to, for example, an annotation. Ive been digging thru the escape codes thanks to this thread, but have yet to find any documentation that explains just exactly what each code is doing, and trying to work backwards from the example given in the OP here resulted in many headaches.

The Curve Fitting dialog displays images of the built-in equations that are stored as application resources. It is not possible for a user to access these directly.

The escape codes used in annotations and text boxes are explained in the command help entry for TextBox. Look in the details section. You can execute the following command to bring up the help:
DisplayHelpTopic "TextBox"

daggaz wrote:

Ultimately I suppose I will just paste in a picture of the formula from another program, but it sure would be neat to have the same matching text etc as Igor and not have to bandage things like that.

In case you missed Jim's post above, you can use the LaTeX Pictures package to assist with this.
Thanks, but the codes in that help file are not the same as those used in the example in the OP. For starters, they use forward slash, not back slash. So /S=1 is give me a frame around my annotation, but in the example \S1 is putting the 1 in the numerator of the fraction. I cant find explicit helpfiles for these back slash escape codes in any of the relevant igor documentation.
daggaz wrote:
Thanks, but the codes in that help file are not the same as those used in the example in the OP. For starters, they use forward slash, not back slash. So /S=1 is give me a frame around my annotation, but in the example \S1 is putting the 1 in the numerator of the fraction. I cant find explicit helpfiles for these back slash escape codes in any of the relevant igor documentation.

Look in the Details section of the help topic that follows the Flags section - the various escape codes, such as \S = Subscript, are listed there.
Doh, just noticed that. Sorry, I must be completely blind. Thanks guys.