Document Classeslstlisting - language R- special character

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
eerie1972
Posts: 6
Joined: Wed Oct 15, 2008 10:44 pm

lstlisting - language R- special character

Post by eerie1972 »

\lstset{
basicstyle=\ttfamily,
keywordstyle=\bfseries,
showstringspaces=false,
columns = fullflexible,
mathescape = true,
language=R
}

\begin{lstlisting}
lst$val<-val
\end{lstlisting}

./software.tex:16:Extra }, or forgotten \endgroup. lst$

the culprit here is the $ sign. that's aproblem because xxx$y is a common command in R.

thanks.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
User avatar
Stefan Kottwitz
Site Admin
Posts: 10308
Joined: Mon Mar 10, 2008 9:44 pm

lstlisting - language R- special character

Post by Stefan Kottwitz »

Hi,

do you need mathescape? It would work if you didn't set mathescape = true.

Stefan
LaTeX.org admin
eerie1972
Posts: 6
Joined: Wed Oct 15, 2008 10:44 pm

Re: lstlisting - language R- special character

Post by eerie1972 »

Thanks, it works.
Post Reply