Igor Pro Language for Listings in LaTeX?
jjweimer
Does anyone have an already-built Igor Pro language file for the listings package in LaTeX that they would share? Alternatively, perhaps someone can suggest an equivalent \lstset settings that works nicely with the built-in language sets. I am starting with this one:
\lstset{language=C,
tabsize=2,
basicstyle=\footnotesize,
keywordstyle=\color{blue},
commentstyle=\color{olive},
stringstyle=\ttfamily\color{red!50!brown},
showstringspaces=false
}
I can't help with using the listings packge, but minted, via pygmentize, does support Igor Pro out of the box see https://github.com/byte-physics/igor-pro-coding-conventions/ for some tex and pdfs.
April 11, 2021 at 01:21 pm - Permalink
Thanks. I tried minted + pygmentize. It failed for me. One reason is perhaps that I have at some point messed up my python default install or PATH options on my macOS to work properly with LaTeX (I am a bit befuddled at times between running homebrew and/or pip to manage python/JupterLabs as well as to connect the macOS default python or the python3 beyond that point). I am also reluctant (granted for no objective reason since I am the only one on my machine) to use the -shell-escape method in LaTeX (also since this means remembering to set it but then afterward to unset it and/or to write a compile macro for it as an optional method).
In the meantime, I'm expanding on listings with xcolor and this approach.
tabsize=2,
basicstyle=\footnotesize,
showstringspaces=false,
commentstyle=\color{OliveGreen},
classoffset=0,
morekeywords={Function, Structure},keywordstyle=\color{Red},
classoffset=1,
morekeywords={variable,string,wave,Static,Constant,STRUCT},keywordstyle=\color{Blue},
classoffset=2,
morekeywords={strswitch,switch,endswitch},keywordstyle=\color{RoyalBlue}
}
While this may not capture everything, it gives me a reasonable starting point. I believe that it may be possible to translate this approach to write a preference file for Igor Pro and simply invoke it with language=IgorPro.
April 11, 2021 at 05:09 pm - Permalink
Well if your python installation is borked up and you don't want to use shell-escape, I'll guess you are stuck with listings ;)
If you want to get it completely into listings I would start with the list of keywords from https://github.com/pygments/pygments/blob/master/pygments/lexers/igor.py. It is mostly only keyword matching, only when you want to get really fancy (folding regions, etc) the highlighter needs some understanding of IP code.
The "official" colors are listed at https://github.com/t-b/igor-pro-vim/blob/5ad36f9a975633799a583794591c73….
April 14, 2021 at 05:16 am - Permalink
There is the problem that Latex seems to be case sensitive. With this you have to consider every variant you use. I have done a little optimization:
And you would have to take care that all used special characters are defined. As an example I have used the circumflex here. It becomes more difficult with the function names. They have to be inserted individually using:
print FunctionList("*",",","KIND:2")
April 24, 2021 at 02:25 pm - Permalink
@g.germer: Can't you specify that the keywors should be used case insensitive? In https://latex.ugent.be/files/documenten/listings.pdf page 20 says
| Additionally you need to specify whether they are case sensitive or not.
I haven't tried it though.
April 25, 2021 at 06:35 am - Permalink
The switch for case sensitive/insensitive should be sensitive=false. I will try soon and report back.
==> sensitive = false works to remove the need to put case sensitive and case insensitive terms
April 25, 2021 at 09:26 am - Permalink
Here is a ZIP archive with a LaTeX example (tex file and PDF file). I believe that this captures the basic functions to the second level as well as the compiler directives. I invite others to expand on it to level 3 (igorbrown colors) and post updates as desired.
Thanks for the inputs so far!
Edit: I made an immediate change to remove basic style settings from the language definition.
April 25, 2021 at 11:07 am - Permalink
The following commands can be used to display the corresponding keywords (and copy into latex):
Turquoise words:
print OperationList("*",",","internal")
Brown words:
print FunctionList("*",",","KIND:1")
Violet words (color of user functions in Igor Pro 9 Beta):
print FunctionList("*",",","KIND:2")
The output of the violet functions is of course different user by user.
Edit: I recommend using Textedit (or Editor) to remove the line breaks and to remove one-letter keywords.
April 26, 2021 at 11:36 am - Permalink