[R] Off-Topic: LaTeX package listings

Kjetil Brinchmann Halvorsen
Mon, 04 Oct 2004 14:02:46 -0000

Toby Popenfoose wrote:

>Kjetil Brinchmann Halvorsen <kjetil <at> acelerate.com> writes:
>
>
>
>>Hola!
>>
>>I ask here since I learnt from this list that the LaTeX package listings
>>should be good
>>for typesetting R code. I encountered one problem:
>>\begin{lstlisting}
>>      X %*% V
>>\end{lstlisting}
>>
>>in the output the * in %*% disappears! same with %/%, etc, the /
>>disappears.
>>
>>Any ideas?
>>
>>Kjetil
>>
>>
>>

Answering myself, this seems to be a problem with babel and spanish. I have

\usepackage[spanish]{babel}

replacing this with
\usepackage[english]{babel}
(or removing babel)
problem disappears. The maintainers of [spanish] are known to be
hyperactive!

Kjetil

>
>I use the following and it displays fine
>
>\lstset{numbers=left, stepnumber=5,breaklines=true}
>\lstset{basicstyle=\footnotesize,frame=single}
>\lstset{language=R}
>
>This is a test
>\begin{lstlisting}
>X in %*% V
>%%
>\end{lstlisting}
>
>HTH
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
>
>
>
>


--

Kjetil Halvorsen.

Peace is the most effective weapon of mass construction.
               --  Mahdi Elmandjra