# Markdown, R code and dollar sign?

Here is a dummy piece of R code.

pca <- prcomp(matrix(rnorm(10*10), ncol=10))
pca$x pca$rotation


The third line appears indented, whereas it is not in the source. Removing the $ sign from the line unindents it, so it looks like a collision between MathJax and Markdwon (at least Showdown). How can I use the $ notation in R code while avoiding this?

I think this is a bug.

One work-around (which applies only to code not broken across lines) is to include an end-of-line comment containing an additional dollar sign: they cancel each other in pairs.

E.g.,

pca <- prcomp(matrix(rnorm(10*10), ncol=10))
pca$x # This dollar sign works around the mathjax bug:$
pca\$rotation

• I was afraid of that solution... :-( Sep 19 '12 at 13:01