I want create the section dynamically, not from .Rnw files. It can be done with stitle parameter of exams2moodle().
The stitle should based on directory structure and I want add the value of exname from .Rnw file.
I think should use read_metainfo which returns the value of exname too. It works well if don't use \Sexpr but if \Sexpr appears in \exsolution{...} drop an error:
Error in string2num(exsolution) :
all numeric items must be finite and non-missing
Calls: read_exercise -> read_metainfo -> string2num
In addition: Warning message:
In string2num(exsolution) : NAs introduced by coercion
Execution halted
The foo.Rnw file:
<<echo=FALSE, results=hide>>=
solution <- 10
@
\exname{foo}
\exsection{bar}
\extype{num}
\exsolution{\Sexpr{solution}}
\begin{question}
Foo text...
\end{question}
The read_metainfo("foo.Rnw") fails. Do I something wrong? Should I try another way?
EDIT: after update of exams only appears the warning message and doesn't halt.