I am using knitr in R to write up a document in LaTex. Below a certain of code, I would like to refer to a variable I used in R.
<<chunk>>
var <- "ENSEMBL_MART_ENSEMBL"
@
In this chunk, we use the following parameters:
\begin{itemize}
\item first blah blah
\item parameter: \Sexpr{var}
\end{itemize}
When I try to compile, I keep on getting the errors:
"Missing $ inserted"
"LaTex Error: Command \item invalid in math mode"
"LaTeX Error: Something's wrong--perhaps a missing \item."
I think that it is the fact I have some "" in the variable name: I have had this problem before (although not when specifically using \Sexpr{}). I did some testing and indeed, if the variable doesn't have a "", I don't get an error.
For various reasons, I cannot rename my variable: it has to be named like so for my code to work. So my question is: how can I make LaTex understand it and not think I am going in math mode?
Thanks