Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to add a language (Scheme) in the lstlisting package.

\section{Scheme}
\lstdefinelanguage{Scheme}
{morekeywords={,lambda, cond, case, display, let, import, quote, quasiquote, unquote,
define, begin, newline, if, list, apply, null?, car, cdr, or, not, and, for-each, 
make-vector, vector-length, vector-ref, vector-set!, eqv?, eq?, equal?, else, set!, 
define-record-type, fields, mutable, immutable, assert, parent, with-exception-handler, }
sensitive=false,
morecomment=[l]{;},
morecomment=[s]{/*}{*/},
morestring=[b]",
}

But, it does when I use a lstlisting it does not recognize the keyword with "!", "?", "-"...

Do you know how can I fix it?

Thank you,

share|improve this question

1 Answer

up vote 4 down vote accepted

Andreas Stuhlmüller (stuhlmueller) in github developed a Scheme syntax highlighting for the LaTeX listings package. Please, see:

https://github.com/stuhlmueller/scheme-listings

Another possibility is to use SLaTeX, available in http://evalwhen.com/slatex/slatxdoc.html

At http://evalwhen.com/slatex/slatxdoc-Z-H-3.html#node_sec_3 there are examples of use of the "?" for word termination.

share|improve this answer
Thanks, now it is better. But it still do not recognize the "?" ending words: like null?, list?, eq?, etc etc, also if i add them in the morekeywords list. Any idea? – user12818 Apr 25 '12 at 15:50
Did you try escaping the question marks? e.g. positive\?? – gmfawcett Apr 16 at 17:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.