# NOT RUN {
cat("\\documentclass{article}",
"\\usepackage[labelsep=period, labelfont=bf]{caption}",
"\\usepackage{subcaption}",
"\\captionsetup[figure]{skip=10pt}",
"\\captionsetup[subfigure]{skip=0pt, labelfont={bf, it}}",
"\\renewcommand{\\thesubfigure}{\\Alph{subfigure}}",
"\\begin{document}",
"<<id, echo=FALSE, fig.width=3, fig.height=2, results='asis'>>=",
"par(mar=c(2.1, 2.1, 1.1, 1.1))",
"n <- 10",
"fig <- sprintf('inlmisc::PlotGraph(runif(%s))', 2:n)",
"headings <- sprintf('Subfigure caption, $n=%s$', 2:n)",
"PrintFigure(fig, 3, 2, 'id', title='Caption', headings=headings)",
"@",
"\\end{document}",
file = "test-figure.Rnw", sep = "\n")
knitr::knit2pdf("test-figure.Rnw", clean = TRUE) # requires LaTeX
system("open test-figure.pdf")
unlink(c("test-figure.*", "figure"), recursive = TRUE)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab