9

我正在为乳胶使用清单包。我正在使用 SQL 语言定义并添加一些我需要的新关键字,使用 morekeywords=。

我无法将一些特殊字符定义为关键字,例如,我需要将 []、<>、& 和 -> 视为关键字并使用关键字样式。

我尝试逐字添加这些内容或使用前面的反斜杠。
那没起效。

您的帮助将不胜感激。

谢谢。

4

1 回答 1

7

Try making those characters to normal letters via alsoletter={yourcharacters}. Later you can specify the special characters as keywords inside morekeywords.

Here is some code:

\lstset{
...
alsoletter={.},
...
}

\begin{lstlisting}[morekeywords={this.is.a.string.with.dots}]
于 2010-06-21T14:46:25.713 回答