LaTeX in Igor Pro (via Local Compilation)

This is the opening point of discussions about ways to use LaTeX in Igor Pro. This restarts a thread from 2013 posted here.

We currently have two methods to incorporate LaTeX in Igor Pro.

LaTeX Pictures is a package. The package supports an extensive range of options but requires an internet connection.

LaTeX Escape Codes are defined in the Igor Pro help ...

DisplayHelpTopic "Textbox"
DisplayHelpTopic "Annotation Escape Codes"

The escape codes are limited.

Neither of the above options allow a full implementation of LaTeX in Igor Pro. By example, they do not allow a user to define custom commands or perhaps incorporate graphics created by such packages as pfgplots or tikz.

A proposal has been made at various times that Igor Pro should have an option to send LaTeX commands to a local LaTeX installation. Proof of concept has been developed recently at this thread.

I propose that this thread continue the discussions with a focus on whether development to support local compilation of LaTeX commands is worthwhile and if so, how it might best be accomplished.

The attached procedure provides the command LaTeX2PICT. The command only works on macOS.

LaTeX2PICT(LTXstr, fsize, style, iname, [ptrerr])

LTXstr - LaTeX string
fsize - font size for encoding
style - 0 is raw, 1 is in-line equation
iname - name of picture that is stored (as PDF)
ptrerr - 0: no report if fail, 1: notice if fail, 2: full error report if fail

You must have a valid LaTeX install to make this work.

I post this in the hopes that someone might provide the commands for this to run properly on Windows. You will see the framework is already in place. All that is needed is to complete the function call that generates the command for ExecuteScriptText and use an appropriate LoadPICT command to capture the result. I also seek recommendations to improve the operation, for example in the preamble.

My next idea is to add a [packages] optional input. This would take a comma-separated list of packages to add via \usepackage{..}. The intent is to allow sophisticated inputs created using such packages as tikz and pfgplots.

LaTeX2PICT.ipf

I have version 0.2 attached. This provides three commands.

ltxs2p(latexstr)

ltxn2p(notebook)

LaTeX2PICT(lstr,... (options) ...)

I am especially excited by the second command. It allows you to write a notebook entirely in LaTeX and convert that to a PICT. I have used it to generate this image as an Igor Pro PICT.

http://www.texample.net/tikz/examples/credit-rationing/

I did a copy+paste of the LaTeX to an Igor Pro notebook and ran ltxn2p(...) on the notebook. Cool!!!!

--> I would really appreciate when someone (Joerg Kunze ???) would take charge to add the Windows code. Although beggars should not be choosers, I might insist that whatever is added be what we call a MWE (minimum working example). IOW, it should be entirely generic in the structure of the command for ExecuteScriptText. I realize that folks can come up with a million ways to generate preambles and code to create a LaTeX image that exactly fits what _they_ want. The purpose of ltxn2p(...) is to allow you to go wild on your LaTeX. The purpose of ltxs2p(...) is to give a fast conversion using a default setting that WILL apply in ALL cases. Everything filters through LaTeX2PICT using one switch, fulldoc = 0 or 1. Some tweaks are allowed in LaTeX2PICT. You might think this way

  • conversant beginner or quick-and-dirty: ltxs2p
  • intermediate user: LaTeX2PICT with switches
  • full on power user: ltxn2p
LaTeX2PICT.ipf