[texhax] Adding a New Programming Language in LaTeX listings package

Na'im R. Tyson ntyson at clovermail.net
Thu Jan 13 17:11:42 CET 2011


Hi TeX Hackers,

I hate to bother you about this package, but I'm having real trouble  
defining a new programming language in LaTeX's listings package.

The language is for the Praat scripting language.  It's very similar  
to Basic, but the name of string variable ends with a dollar sign.   
I'm using the following command to define it:

\lstdefinelanguage{Praat}
{keywords={call,clearinfo,comment,Create,else,endfor,endform,endif,endproc,exit,fileappend,filedelete,fileReadable,for,form,Get,if,index_regex,length,nocheck,pause,plus,procedure,print,printline,Read,Remove,repeat,right,select,sentence,Set,system,system_nocheck,text,to,To,until,Write},%
sensitive=true,%
alsoletter={\$},%
comment=[l]{\#},%
string=[b]",%
string=[b]'%
}

When I call to the file using \lstinputlisting, I get an error  
'Missing $ inserted'.  I am no LaTeX expert, so I really do not know  
what I need to do to fix this.

Any help anyone could provide would really appreciated.  I have  
include some Praat code below to give you an idea of what I was doing.

PRAAT CODE

# reads from *.phn files of the form (on each line): <label> <start>  
<end>
# (supposedly) downloads directory from repository to find

form Make TextGrids for text files
	sentence Directory /home/ntyson/devl/thesis-dev/trunk/data/formant-data
	# sentence Sound_file_extension .wav
	sentence Text_file_extension .phn
endform

overwrite = 0

clearinfo
# Check the contents of the user-specified directory and open  
appropriate files:
phnPath$ = "'directory$'/*'text_file_extension$'"
Create Strings as file list... list 'phnPath$'

Yours truly,


Na'im


More information about the texhax mailing list