Skip to content

Commit

Permalink
added out.width argument
Browse files Browse the repository at this point in the history
  • Loading branch information
jvanheld committed Aug 8, 2018
1 parent b7f19b6 commit 4db9628
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions scripts/RSnakeChunks/R/index_figure.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@
#' @author Jacques van Helden
#' @param name name of the chunk
#' @param file file continaing the figure
#' @param out.width="75%" figure width, relative to page width
#' @param index.text=NULL if spcified, the chunk will be appended to it
#' @param chunk_opt=", eval=TRUE" a string specifying one or more options to append to the chunk declaration line. Must start with a comma.
#' @param chunk_opt=", eval=TRUE" a string specifying one or more options to append to the chunk declaration line. Must start with a comma.
#' @export
index.figure <- function(name, file, index.text = NULL, chunk.opt = ", eval=TRUE") {
index.figure <- function(name, file,
index.text = NULL,
out.width="75%",
chunk.opt = ", eval=TRUE") {
fig.chunk <- paste(sep = "",
"
```{r fig='", name, "' ", chunk.opt, " }
```{r fig='", name, "', out.width = '", out.width, "'", chunk.opt, " }
knitr::include_graphics(path = '", file, "', auto_pdf = TRUE)
```
")
```")

if (is.null(index.text)) {
return(fig.chunk)
} else {
Expand Down

0 comments on commit 4db9628

Please sign in to comment.