This has something to do with the default built-in hook, I understand that I tried to get it (hook), and also read this topic and the Yihui page about hooks , but I could not solve my problem. I even tried this suggestion from Sacha Epskamp, ββbut in my case it did not help.
I use \Sexpr and do something on the lines \Sexpr{load("meta.data.saved"); meta.data[1,7]} \Sexpr{load("meta.data.saved"); meta.data[1,7]} to print a keyword in my report, the problem is that people writing these keywords (people I canβt control) use special LaTeX characters ($, &,%, # etc.), and when they are transferred to my .tex file without \ , I have a bad time.
I have a .Rnw file with this code,
\documentclass{article} \begin{document} Look \Sexpr{foo <- "me&you"; foo} at this. \end{document}
Thsi creates a .tex file with the illegal LaTeX symbol. Like this,
\begin{document} Look me&you at this. \end{document}
I am interested in getting an output that looks like this:
\begin{document} Look me\&you at this. \end{document}
Sorry for the simple question, but can someone help me, and possibly others, start by changing the default hook for \Sexpr ?
source share