Search code examples
latexcoding-stylelistings

Searching in Latex for beginning of keywords


I wanna use listings in LATEX with my own style. Because I don't want to add any keyword in my preset, I want to search for beginning of keywords. Latex should know, that any keyword begins with NS or with UI. For my it is impossible to add all keywords of Cocoa Touch and Objective C to my \lstdefinelanguage{ObjectiveC} ... !

Is there any solution? :-(


Solution

  • The Listings package allows you to specify a keyword prefix so that all keywords starting with a character sequence are highlighted (see the manual p.43). Unfortunately, only a single prefix can be specified. Note listings has ObjectiveC suppor. for Objective C, you'd want to use \lstset{language=[Objective]C}.