Skip to content

Commit

Permalink
fix #132 and fix #6: put JSS code chunks in a raw latex block ```{=la…
Browse files Browse the repository at this point in the history
…tex}, which requires Pandoc 2.x

this is a less hackish fix than #161

also fixes rstudio/rmarkdown#398
  • Loading branch information
yihui committed Jul 3, 2018
1 parent 064153c commit 8da3d29
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: rticles
Type: Package
Title: Article Formats for R Markdown
Version: 0.4.4
Version: 0.4.5
Authors@R: c(
person("JJ", "Allaire", role = c("aut", "cre"), email = "jj@rstudio.com"),
person(family = "R Foundation", role = c("aut", "cph")),
Expand Down
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ rticles 0.5 (unreleased)

- Add MDPI journal template

- Fixed #6 and #132: dollar signs can be used in code chunks in JSS articles
now, but it will require Pandoc 2.2.1 (you can use the Preview version of
RStudio if you do not want to install Pandoc separately).

rticles 0.4.1
---------------------------------------------------------------------

Expand Down
4 changes: 3 additions & 1 deletion R/jss_article.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#' @export
jss_article <- function(..., keep_tex = TRUE, citation_package = 'natbib') {

rmarkdown::pandoc_available('2.2.1', TRUE)

template <- find_resource("jss_article", "template.tex")

base <- inherit_pdf_document(
Expand All @@ -40,7 +42,7 @@ jss_article <- function(..., keep_tex = TRUE, citation_package = 'natbib') {
base$knitr$opts_chunk$fig.align <- "center"
hook_chunk <- function(x, options) {
if (output_asis(x, options)) return(x)
paste0('\\begin{CodeChunk}\n', x, '\\end{CodeChunk}')
paste0('```{=latex}\n\\begin{CodeChunk}\n', x, '\\end{CodeChunk}\n```')
}
hook_input <- function(x, options) {
if (options$prompt && length(x)) {
Expand Down

0 comments on commit 8da3d29

Please sign in to comment.