For example, I would like to store the string below (including the endlines), but I cannot figure out what the function is. I thought quote() would work:
mystring <- quote(
\documentclass{article}
\usepackage{graphicx}
\begin{document}
%\tableofcontents
\addcontentsline{toc}{chapter}{List of Figures}
\listoffigures
\newpage
\stepcounter{figure}
)
but no luck.
Thank you, Xu.
You need to escape the backslashes: