Igor Pro Language for Listings in LaTeX?

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
}

 

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.

\lstset{language=C,
    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.

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….

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:

\usepackage{listings}
\usepackage{color}
\definecolor{igorgreen}{RGB}{0,156,0}
\definecolor{igorbrown}{RGB}{195,78,0}
\definecolor{igorturquoise}{RGB}{0,117,117}
\definecolor{igorviolet}{rgb}{0.74, 0.2, 0.64}
\lstset{language=C,
    tabsize=2,
    basicstyle=\sffamily\footnotesize,showstringspaces=false,breaklines=true,
    commentstyle=\color{red},
    stringstyle=\color{igorgreen},
    literate={^}{{\string^}}1,
    keywordstyle=[1]\color{blue},
    keywordstyle=[2]\color{igorbrown},
    keywordstyle=[3]\color{igorturquoise},
    keywordstyle=[4]\color{igorviolet},
    morekeywords=[1]{Function, Structure, function, end, variable,Variable,String,string,wave,Static,Constant,STRUCT,strswitch,switch,endswitch,endif,return,endfor,display,append,appendtograph,prompt,submenu,Menu,Threadsafe,ThreadSafe,killwaves,rename,doprompt},%blue keywords
    morekeywords=[2]{GetDataFolder,DimDelta,DimOffset,DimSize, GetBrowserSelection,itemsinlist,stringfromlist,removeending,removeEnding,ItemsInList,IndexedFile,num2str,str2num,GrepString,round,stringmatch,strlen,stringfromlist,strsearch,waveexists,abs,GetWavesDataFolder,ThreadProcessorCount,ThreadGroupWait,ThreadGroupRelease,nameofwave,numtype,csrWaveRef,pcsr,qcsr,datafolderExists,exp,Secs2Date,date,datetime,DateTime,Secs2Time,secs2time,replacestring,GetWavesDataFolderDFR,interp,ceil,floor,indextoscale,scaletoindex,startMSTimer,ScaleToIndex,stopMSTimer,IgorInfo},%brown keywords
     morekeywords=[3]{beam,SaveExperiment,CreateBrowser,make,Make,print,wavestats,NaN,newdataFolder,setdataFolder,setscale,FuncFit,funcfit},%turquoise keywords
     morekeywords=[4]{name_of_functions},%violet keywords = user defined functions
    }

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")

 

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

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.

Igor Pro LaTeX Listings v210425_1.zip (74.42 KB)

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.