0

I'm using the listings package with a custom language definition. In my language, I have types of the form:

Foo@Bar>>Baz

Bar and Baz are keywords in the language and should therefore be highlighted. Foo is an arbitrary identifier and needs no special highlighting treatment.

If I separate the above tokens with whitespace, everything is fine. But if I do not separate them with whitespace (as in the above example), I only get appropriate highlighting for Baz, not for Bar.

I've looked at the documentation (http://texdoc.net/texmf-dist/doc/latex/listings/listings.pdf), but haven't found a way to specify that the @ sign should not be part of the identifier. I tried including @ as a keyword:

keywords=[5]{@},
keywordstyle=[5]\bfseries,

but that didn't seem to help.

Any suggestions?

1 Answer 1

1

Never mind — I found the answer! The trick is to denote @ as an "other" character; by default, it is a "letter" and therefore included in identifiers. This suffices:

    alsoother={@},

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .