Reputation: 23898
I want to use the R chunk code output as the Chapter Name but could not figured out how to do this. Below is my minimum working example.
\documentclass{book}
\usepackage[T1]{fontenc}
\begin{document}
\chapter{cat(
<< label=Test1, echo=FALSE, results="asis">>=
2+1
@
)
}
Chapter name is the output of R chunk Code.
\end{document}
Upvotes: 1
Views: 168
Reputation: 70623
This works for me
<< label=Test1, echo=FALSE>>=
cn <- 2+1
@
\chapter*{Chapter \Sexpr{cn}}
Upvotes: 3