I am writing a document in R markdown (.rmd). I would like to be able to knit both Word and PDF outputs. I am having difficulty with figure numbering. With PDF output, the f
Is there a way to suppress the automatic numbering for PDF?
Sure. Add a format
variable for your output format and a handler for that format within figref
. With RStudio preview edition you could use format <- knitr::opts_knit$get("out.format")
but with the release version you'd need to set it manually.
Then in figref()
add whatever you desire for the output...
if ( format == "latex" ) return( caption )
if (!missing(caption)) {
--- >8 ---
Personally I'd use the preview edition and a switch statement for the handling. Along the lines of https://stackoverflow.com/a/27321367/173985.