From 2f990b97bec45e0033832029570fcdff45d4c626 Mon Sep 17 00:00:00 2001 From: Michael Braun Date: Thu, 4 Apr 2019 17:05:46 -0500 Subject: [PATCH 1/7] add patterns for Rlatex --- R/output.R | 8 +++++--- R/pattern.R | 15 ++++++++++++++- tests/testit/test-rlatex.R | 22 ++++++++++++++++++++++ 3 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 tests/testit/test-rlatex.R diff --git a/R/output.R b/R/output.R index e65c50512d..bd25d78d27 100644 --- a/R/output.R +++ b/R/output.R @@ -232,10 +232,11 @@ knit = function(input, output = NULL, tangle = FALSE, text = NULL, quiet = FALSE ext, "' in built-in pattern lists; ", 'see ?knit_patterns on how to set up customized patterns') set_pattern(pattern) - if (pattern == 'rnw' && length(sweave_lines <- which_sweave(text)) > 0) + if (pattern %in% c('rnw','rlatex') && length(sweave_lines <- which_sweave(text)) > 0) remind_sweave(if (in.file) input, sweave_lines) opts_knit$set(out.format = switch( - pattern, rnw = 'latex', tex = 'latex', html = 'html', md = 'markdown', + pattern, rnw = 'latex', tex = 'latex', html = 'html', md = 'markdown', + rlatex = 'latex', rst = 'rst', brew = 'brew', asciidoc = 'asciidoc', textile = 'textile' )) } @@ -344,7 +345,7 @@ process_file = function(text, output) { auto_out_name = function(input, ext = tolower(file_ext(input))) { base = sans_ext(input) name = if (opts_knit$get('tangle')) c(base, '.R') else - if (ext %in% c('rnw', 'snw')) c(base, '.tex') else + if (ext %in% c('rnw', 'snw', 'rlatex')) c(base, '.tex') else if (ext %in% c('rmd', 'rmarkdown', 'rhtml', 'rhtm', 'rtex', 'stex', 'rrst', 'rtextile')) c(base, '.', substring(ext, 2L)) else if (grepl('_knit_', input)) sub('_knit_', '', input) else @@ -355,6 +356,7 @@ auto_out_name = function(input, ext = tolower(file_ext(input))) { # determine output format based on file extension ext2fmt = c( rnw = 'latex', snw = 'latex', tex = 'latex', rtex = 'latex', stex = 'latex', + rlatex = 'latex', htm = 'html', html = 'html', rhtml = 'html', rhtm = 'html', md = 'markdown', markdown = 'markdown', rmd = 'markdown', rmarkdown = 'markdown', brew = 'brew', rst = 'rst', rrst = 'rst' diff --git a/R/pattern.R b/R/pattern.R index 1899c6fafa..ba335aedd2 100644 --- a/R/pattern.R +++ b/R/pattern.R @@ -49,7 +49,16 @@ all_patterns = list( chunk.end = '^###[.]\\s+end[.]rcode\\s*$', ref.chunk = '^\\s*<<(.+)>>\\s*$', inline.code = '@r +([^@]+)\\s*@', - inline.comment = '^###[.].*') + inline.comment = '^###[.].*'), + + `rlatex` = list( + chunk.begin = "^\\s*\\\\begin\\{Rcode\\}\\[(.*)?\\].*$", + chunk.end = "^\\s*\\\\end\\{Rcode\\}\\s*(%+.*|)$", + inline.code = "\\\\Sexpr\\{([^}]+)\\}", + inline.comment = "^\\s*%.*", + header.begin = "(^|\n)\\s*\\\\documentclass[^}]+\\}", + document.begin = "\\s*\\\\begin\\{document\\}", + ref.chunk = "^\\s*\\\\begin\\{Rcode\\}\\[(.*)\\].*$") ) .sep.label = '^(#|--)+\\s*(@knitr|----+)(.*?)-*\\s*$' # pattern for code chunks in an R script @@ -128,6 +137,9 @@ pat_rst = function() set_pattern('rst') pat_asciidoc = function() set_pattern('asciidoc') #' @rdname pat_fun pat_textile = function() set_pattern('textile') +#' @rdname pat_fun +pat_rlatex = function() set_pattern('rlatex') + # helper functions @@ -146,6 +158,7 @@ detect_pattern = function(text, ext) { if (ext %in% c('rmd', 'rmarkdown', 'markdown', 'md')) return('md') if (ext %in% c('rst', 'rrst')) return('rst') if (ext %in% c('asciidoc', 'rasciidoc', 'adoc', 'radoc')) return('asciidoc') + if (ext %in% c('rlatex', 'Rlatex', 'RLatex')) return('rlatex') } for (p in names(all_patterns)) { for (i in c('chunk.begin', 'inline.code')) { diff --git a/tests/testit/test-rlatex.R b/tests/testit/test-rlatex.R new file mode 100644 index 0000000000..8f63542559 --- /dev/null +++ b/tests/testit/test-rlatex.R @@ -0,0 +1,22 @@ +library(testit) + +assert( + 'detect_pattern() automatically detects syntax patterns', + identical(detect_pattern('<<>>='), 'rnw'), + identical(detect_pattern('<>='), 'rnw'), + identical(detect_pattern('\begin{Rcode}'), 'rlatex'), + identical(detect_pattern('\begin{Rcode}[foo, bar=TRUE]'), 'rlatex'), + identical(detect_pattern('asdf', 'rlatex'), 'rlatex'), + detect_pattern('foo') %==% NULL +) + + +ce = all_patterns$rlatex$chunk.end +assert( + 'patterns for rlatex', + identical(grep(ce, ' \\end{Rcode}'), 1L), # spaces before @ + identical(grep(ce, '\\end{Rcode} '), 1L), # spaces after @ + identical(grep(ce, '\\end{Rcode} %asdf'), 1L), # comments after % + identical(grep(ce, '\\end{Rcode} asdf'), integer()), # only spaces/comments allowed + identical(grep(ce, ' \\end{Rcode} a% sdf'), integer()) +) From 5efa487f109342d562c31ed6164d3f89a5ba7aef Mon Sep 17 00:00:00 2001 From: Michael Braun Date: Sun, 7 Apr 2019 00:29:38 -0500 Subject: [PATCH 2/7] fixed pattern.R --- R/pattern.R | 2 +- inst/misc/tweak_bib.csv | 24 ++++++++++++------------ tests/testit/test-rlatex.R | 6 +++--- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/R/pattern.R b/R/pattern.R index ba335aedd2..07a578d2ce 100644 --- a/R/pattern.R +++ b/R/pattern.R @@ -52,7 +52,7 @@ all_patterns = list( inline.comment = '^###[.].*'), `rlatex` = list( - chunk.begin = "^\\s*\\\\begin\\{Rcode\\}\\[(.*)?\\].*$", + chunk.begin = "^\\s*\\\\begin\\{Rcode\\}(?:\\[(.*)?\\])?\\s*(%.*)?$", chunk.end = "^\\s*\\\\end\\{Rcode\\}\\s*(%+.*|)$", inline.code = "\\\\Sexpr\\{([^}]+)\\}", inline.comment = "^\\s*%.*", diff --git a/inst/misc/tweak_bib.csv b/inst/misc/tweak_bib.csv index 119f58884e..a167151df9 100644 --- a/inst/misc/tweak_bib.csv +++ b/inst/misc/tweak_bib.csv @@ -1,33 +1,28 @@ "package","author" -"BiplotGUI","Anthony la Grange and N. J. le Roux and P.J. Rousseeuw and I. Ruts and J. W. Tukey" -"CircStats","Ulric Lund and Claudio Agostinelli" -"ElemStatLearn","Kjetil Halvorsen" -"Fahrmeir","Kjetil Halvorsen" -"Hmisc","Harrell, Jr., Frank E" -"Hmisc","Frank E. {Harrell, Jr.}" -"R2SWF","Yixuan Qiu and Yihui Xie and Cameron Bracken" -"R2WinBUGS","Andrew Gelman and Sibylle Sturtz and Uwe Ligges and Gregor Gorjanc and Jouni Kerman" -"RODBC","Brian Ripley and Michael Lapsley" -"RgoogleMaps","Markus Loecher" -"Sleuth2","F. L. Ramsey and D. W. Schafer and Jeannie Sifneos and Berwin A. Turlach" "ade4","Stéphane Dray and Anne-Béatrice Dufour and Jean Thioulouse and Thibaut Jombart and Sandrine Pavoine and Jean R. Lobry and Sébastien Ollier and Aurélie Siberchicot and Daniel Chessel" "akima","H. Akima and Albrecht Gebhardt and Thomas Petzoldt and Martin Maechler" "ash","David W. Scott and Albrecht Gebhardt and Stephen Kaluzny" "bcpa","Jose Claudio Faria and Clarice Garcia Borges Demetrio" +"BiplotGUI","Anthony la Grange and N. J. le Roux and P.J. Rousseeuw and I. Ruts and J. W. Tukey" "bitops","Steve Dutky and Martin Maechler" "cacheSweave","Roger D. Peng" "cat","Ted Harding and Fernando Tusell and Joseph L. Schafer" +"CircStats","Ulric Lund and Claudio Agostinelli" "contrast","Max Kuhn and Steve Weston and Jed Wing and James Forester" "date","Terry Therneau and Thomas Lumley and Kjetil Halvorsen and Kurt Hornik" "digest","Dirk Eddelbuettel" +"ElemStatLearn","Kjetil Halvorsen" "epiR","Mark Stevenson and Telmo Nunes and Cord Heuer and Jonathon Marshall and Javier Sanchez and Ron Thornton and Jeno Reiczigel and Jim Robison-Cox and Paola Sebastiani and Peter Solymos" +"Fahrmeir","Kjetil Halvorsen" "flashClust","Fionn Murtagh and {R development team} and Peter Langfelder" "foreach","{Revolution Analytics} and Steve Weston}" "fortunes","Achim Zeileis and the R community" -"gWidgets","John Verzani" "gee","Vincent J Carey and Thomas Lumley and Brian Ripley" "gmodels","Gregory R. Warnes andBen Bolker and Thomas Lumley and Randall C Johnson and Randall C. Johnson" +"gWidgets","John Verzani" "hexbin","Dan Carr and Nicholas Lewin-Koh and Martin Maechler" +"Hmisc","Harrell, Jr., Frank E" +"Hmisc","Frank E. {Harrell, Jr.}" "leaps","Thomas Lumley" "mapproj","Doug McIlroy and Ray Brownrigg and Thomas P Minka and Roger Bivand" "maps","Ray Brownrigg" @@ -36,9 +31,14 @@ "pbivnorm","Alan Genz and Brenton Kenkel" "pscl","Simon Jackman and Alex Tahk and Achim Zeileis and Christina Maimone and Jim Fearon" "quadprog","Berwin A. Turlach and Andreas Weingessel" +"R2SWF","Yixuan Qiu and Yihui Xie and Cameron Bracken" +"R2WinBUGS","Andrew Gelman and Sibylle Sturtz and Uwe Ligges and Gregor Gorjanc and Jouni Kerman" "randomForest","Leo Breiman and Adele Cutler and Andy Liaw and Matthew Wiener" "rgl","Daniel Adler and Duncan Murdoch" +"RgoogleMaps","Markus Loecher" "rms","Frank E. {Harrell, Jr.}" "robustbase","Valentin Todorov and Andreas Ruckstuhl and Matias Salibian-Barrera and Tobias Verbeke and Manuel Koller and Martin Maechler" +"RODBC","Brian Ripley and Michael Lapsley" +"Sleuth2","F. L. Ramsey and D. W. Schafer and Jeannie Sifneos and Berwin A. Turlach" "sm","Adrian Bowman and Adelchi Azzalini" "tuneR","Uwe Ligges" diff --git a/tests/testit/test-rlatex.R b/tests/testit/test-rlatex.R index 8f63542559..1923b8ed27 100644 --- a/tests/testit/test-rlatex.R +++ b/tests/testit/test-rlatex.R @@ -4,9 +4,9 @@ assert( 'detect_pattern() automatically detects syntax patterns', identical(detect_pattern('<<>>='), 'rnw'), identical(detect_pattern('<>='), 'rnw'), - identical(detect_pattern('\begin{Rcode}'), 'rlatex'), - identical(detect_pattern('\begin{Rcode}[foo, bar=TRUE]'), 'rlatex'), - identical(detect_pattern('asdf', 'rlatex'), 'rlatex'), +## identical(detect_pattern('\begin{Rcode}'), 'rlatex'), +## identical(detect_pattern('\begin{Rcode}[foo, bar=TRUE]'), 'rlatex'), +## identical(detect_pattern('asdf', 'rlatex'), 'rlatex'), detect_pattern('foo') %==% NULL ) From 327711806999acf3c5f0720d20a8ff96259a601b Mon Sep 17 00:00:00 2001 From: Michael Braun Date: Sun, 7 Apr 2019 00:43:42 -0500 Subject: [PATCH 3/7] test-rlatex --- tests/testit/test-rlatex.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/testit/test-rlatex.R b/tests/testit/test-rlatex.R index 1923b8ed27..bc636a2225 100644 --- a/tests/testit/test-rlatex.R +++ b/tests/testit/test-rlatex.R @@ -4,9 +4,9 @@ assert( 'detect_pattern() automatically detects syntax patterns', identical(detect_pattern('<<>>='), 'rnw'), identical(detect_pattern('<>='), 'rnw'), -## identical(detect_pattern('\begin{Rcode}'), 'rlatex'), -## identical(detect_pattern('\begin{Rcode}[foo, bar=TRUE]'), 'rlatex'), -## identical(detect_pattern('asdf', 'rlatex'), 'rlatex'), + identical(detect_pattern('\\begin{Rcode}'), 'rlatex'), + identical(detect_pattern('\\begin{Rcode}[foo, bar=TRUE]'), 'rlatex'), + identical(detect_pattern('asdf', 'rlatex'), 'rlatex'), detect_pattern('foo') %==% NULL ) From 8ad6b5238b4ed88f96d85b070a32899a4e5bf2ce Mon Sep 17 00:00:00 2001 From: Michael Braun Date: Sun, 7 Apr 2019 18:31:24 -0500 Subject: [PATCH 4/7] reverted inst/misc/tweak_bib.csv --- inst/misc/tweak_bib.csv | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/inst/misc/tweak_bib.csv b/inst/misc/tweak_bib.csv index a167151df9..119f58884e 100644 --- a/inst/misc/tweak_bib.csv +++ b/inst/misc/tweak_bib.csv @@ -1,28 +1,33 @@ "package","author" +"BiplotGUI","Anthony la Grange and N. J. le Roux and P.J. Rousseeuw and I. Ruts and J. W. Tukey" +"CircStats","Ulric Lund and Claudio Agostinelli" +"ElemStatLearn","Kjetil Halvorsen" +"Fahrmeir","Kjetil Halvorsen" +"Hmisc","Harrell, Jr., Frank E" +"Hmisc","Frank E. {Harrell, Jr.}" +"R2SWF","Yixuan Qiu and Yihui Xie and Cameron Bracken" +"R2WinBUGS","Andrew Gelman and Sibylle Sturtz and Uwe Ligges and Gregor Gorjanc and Jouni Kerman" +"RODBC","Brian Ripley and Michael Lapsley" +"RgoogleMaps","Markus Loecher" +"Sleuth2","F. L. Ramsey and D. W. Schafer and Jeannie Sifneos and Berwin A. Turlach" "ade4","Stéphane Dray and Anne-Béatrice Dufour and Jean Thioulouse and Thibaut Jombart and Sandrine Pavoine and Jean R. Lobry and Sébastien Ollier and Aurélie Siberchicot and Daniel Chessel" "akima","H. Akima and Albrecht Gebhardt and Thomas Petzoldt and Martin Maechler" "ash","David W. Scott and Albrecht Gebhardt and Stephen Kaluzny" "bcpa","Jose Claudio Faria and Clarice Garcia Borges Demetrio" -"BiplotGUI","Anthony la Grange and N. J. le Roux and P.J. Rousseeuw and I. Ruts and J. W. Tukey" "bitops","Steve Dutky and Martin Maechler" "cacheSweave","Roger D. Peng" "cat","Ted Harding and Fernando Tusell and Joseph L. Schafer" -"CircStats","Ulric Lund and Claudio Agostinelli" "contrast","Max Kuhn and Steve Weston and Jed Wing and James Forester" "date","Terry Therneau and Thomas Lumley and Kjetil Halvorsen and Kurt Hornik" "digest","Dirk Eddelbuettel" -"ElemStatLearn","Kjetil Halvorsen" "epiR","Mark Stevenson and Telmo Nunes and Cord Heuer and Jonathon Marshall and Javier Sanchez and Ron Thornton and Jeno Reiczigel and Jim Robison-Cox and Paola Sebastiani and Peter Solymos" -"Fahrmeir","Kjetil Halvorsen" "flashClust","Fionn Murtagh and {R development team} and Peter Langfelder" "foreach","{Revolution Analytics} and Steve Weston}" "fortunes","Achim Zeileis and the R community" +"gWidgets","John Verzani" "gee","Vincent J Carey and Thomas Lumley and Brian Ripley" "gmodels","Gregory R. Warnes andBen Bolker and Thomas Lumley and Randall C Johnson and Randall C. Johnson" -"gWidgets","John Verzani" "hexbin","Dan Carr and Nicholas Lewin-Koh and Martin Maechler" -"Hmisc","Harrell, Jr., Frank E" -"Hmisc","Frank E. {Harrell, Jr.}" "leaps","Thomas Lumley" "mapproj","Doug McIlroy and Ray Brownrigg and Thomas P Minka and Roger Bivand" "maps","Ray Brownrigg" @@ -31,14 +36,9 @@ "pbivnorm","Alan Genz and Brenton Kenkel" "pscl","Simon Jackman and Alex Tahk and Achim Zeileis and Christina Maimone and Jim Fearon" "quadprog","Berwin A. Turlach and Andreas Weingessel" -"R2SWF","Yixuan Qiu and Yihui Xie and Cameron Bracken" -"R2WinBUGS","Andrew Gelman and Sibylle Sturtz and Uwe Ligges and Gregor Gorjanc and Jouni Kerman" "randomForest","Leo Breiman and Adele Cutler and Andy Liaw and Matthew Wiener" "rgl","Daniel Adler and Duncan Murdoch" -"RgoogleMaps","Markus Loecher" "rms","Frank E. {Harrell, Jr.}" "robustbase","Valentin Todorov and Andreas Ruckstuhl and Matias Salibian-Barrera and Tobias Verbeke and Manuel Koller and Martin Maechler" -"RODBC","Brian Ripley and Michael Lapsley" -"Sleuth2","F. L. Ramsey and D. W. Schafer and Jeannie Sifneos and Berwin A. Turlach" "sm","Adrian Bowman and Adelchi Azzalini" "tuneR","Uwe Ligges" From 30557be5f96cda41288030bb416d75ba5162dfed Mon Sep 17 00:00:00 2001 From: Michael Braun Date: Thu, 4 Apr 2019 17:05:46 -0500 Subject: [PATCH 5/7] add patterns for Rlatex fixed pattern.R test-rlatex reverted inst/misc/tweak_bib.csv --- R/output.R | 8 +++++--- R/pattern.R | 15 ++++++++++++++- tests/testit/test-rlatex.R | 22 ++++++++++++++++++++++ 3 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 tests/testit/test-rlatex.R diff --git a/R/output.R b/R/output.R index e65c50512d..bd25d78d27 100644 --- a/R/output.R +++ b/R/output.R @@ -232,10 +232,11 @@ knit = function(input, output = NULL, tangle = FALSE, text = NULL, quiet = FALSE ext, "' in built-in pattern lists; ", 'see ?knit_patterns on how to set up customized patterns') set_pattern(pattern) - if (pattern == 'rnw' && length(sweave_lines <- which_sweave(text)) > 0) + if (pattern %in% c('rnw','rlatex') && length(sweave_lines <- which_sweave(text)) > 0) remind_sweave(if (in.file) input, sweave_lines) opts_knit$set(out.format = switch( - pattern, rnw = 'latex', tex = 'latex', html = 'html', md = 'markdown', + pattern, rnw = 'latex', tex = 'latex', html = 'html', md = 'markdown', + rlatex = 'latex', rst = 'rst', brew = 'brew', asciidoc = 'asciidoc', textile = 'textile' )) } @@ -344,7 +345,7 @@ process_file = function(text, output) { auto_out_name = function(input, ext = tolower(file_ext(input))) { base = sans_ext(input) name = if (opts_knit$get('tangle')) c(base, '.R') else - if (ext %in% c('rnw', 'snw')) c(base, '.tex') else + if (ext %in% c('rnw', 'snw', 'rlatex')) c(base, '.tex') else if (ext %in% c('rmd', 'rmarkdown', 'rhtml', 'rhtm', 'rtex', 'stex', 'rrst', 'rtextile')) c(base, '.', substring(ext, 2L)) else if (grepl('_knit_', input)) sub('_knit_', '', input) else @@ -355,6 +356,7 @@ auto_out_name = function(input, ext = tolower(file_ext(input))) { # determine output format based on file extension ext2fmt = c( rnw = 'latex', snw = 'latex', tex = 'latex', rtex = 'latex', stex = 'latex', + rlatex = 'latex', htm = 'html', html = 'html', rhtml = 'html', rhtm = 'html', md = 'markdown', markdown = 'markdown', rmd = 'markdown', rmarkdown = 'markdown', brew = 'brew', rst = 'rst', rrst = 'rst' diff --git a/R/pattern.R b/R/pattern.R index 1899c6fafa..07a578d2ce 100644 --- a/R/pattern.R +++ b/R/pattern.R @@ -49,7 +49,16 @@ all_patterns = list( chunk.end = '^###[.]\\s+end[.]rcode\\s*$', ref.chunk = '^\\s*<<(.+)>>\\s*$', inline.code = '@r +([^@]+)\\s*@', - inline.comment = '^###[.].*') + inline.comment = '^###[.].*'), + + `rlatex` = list( + chunk.begin = "^\\s*\\\\begin\\{Rcode\\}(?:\\[(.*)?\\])?\\s*(%.*)?$", + chunk.end = "^\\s*\\\\end\\{Rcode\\}\\s*(%+.*|)$", + inline.code = "\\\\Sexpr\\{([^}]+)\\}", + inline.comment = "^\\s*%.*", + header.begin = "(^|\n)\\s*\\\\documentclass[^}]+\\}", + document.begin = "\\s*\\\\begin\\{document\\}", + ref.chunk = "^\\s*\\\\begin\\{Rcode\\}\\[(.*)\\].*$") ) .sep.label = '^(#|--)+\\s*(@knitr|----+)(.*?)-*\\s*$' # pattern for code chunks in an R script @@ -128,6 +137,9 @@ pat_rst = function() set_pattern('rst') pat_asciidoc = function() set_pattern('asciidoc') #' @rdname pat_fun pat_textile = function() set_pattern('textile') +#' @rdname pat_fun +pat_rlatex = function() set_pattern('rlatex') + # helper functions @@ -146,6 +158,7 @@ detect_pattern = function(text, ext) { if (ext %in% c('rmd', 'rmarkdown', 'markdown', 'md')) return('md') if (ext %in% c('rst', 'rrst')) return('rst') if (ext %in% c('asciidoc', 'rasciidoc', 'adoc', 'radoc')) return('asciidoc') + if (ext %in% c('rlatex', 'Rlatex', 'RLatex')) return('rlatex') } for (p in names(all_patterns)) { for (i in c('chunk.begin', 'inline.code')) { diff --git a/tests/testit/test-rlatex.R b/tests/testit/test-rlatex.R new file mode 100644 index 0000000000..bc636a2225 --- /dev/null +++ b/tests/testit/test-rlatex.R @@ -0,0 +1,22 @@ +library(testit) + +assert( + 'detect_pattern() automatically detects syntax patterns', + identical(detect_pattern('<<>>='), 'rnw'), + identical(detect_pattern('<>='), 'rnw'), + identical(detect_pattern('\\begin{Rcode}'), 'rlatex'), + identical(detect_pattern('\\begin{Rcode}[foo, bar=TRUE]'), 'rlatex'), + identical(detect_pattern('asdf', 'rlatex'), 'rlatex'), + detect_pattern('foo') %==% NULL +) + + +ce = all_patterns$rlatex$chunk.end +assert( + 'patterns for rlatex', + identical(grep(ce, ' \\end{Rcode}'), 1L), # spaces before @ + identical(grep(ce, '\\end{Rcode} '), 1L), # spaces after @ + identical(grep(ce, '\\end{Rcode} %asdf'), 1L), # comments after % + identical(grep(ce, '\\end{Rcode} asdf'), integer()), # only spaces/comments allowed + identical(grep(ce, ' \\end{Rcode} a% sdf'), integer()) +) From 9f8b17d3d38aa255e3a29709663509f187e8b272 Mon Sep 17 00:00:00 2001 From: Michael Braun Date: Sun, 7 Apr 2019 18:56:18 -0500 Subject: [PATCH 6/7] updated NEWS.md and DESCRIPTION --- DESCRIPTION | 1 + NEWS.md | 2 ++ inst/misc/tweak_bib.csv | 24 ++++++++++++------------ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 68bcf6ace0..7dc25a674e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -65,6 +65,7 @@ Authors@R: c( person("Lorenz", "Walthert", role = "ctb"), person("Lucas", "Gallindo", role = "ctb"), person("Martin", "Modrák", role = "ctb"), + person("Michael", "Braun", role = "ctb"), person("Michael", "Chirico", role = "ctb"), person("Michael", "Friendly", role = "ctb"), person("Michal", "Bojanowski", role = "ctb"), diff --git a/NEWS.md b/NEWS.md index 6bdd6971f7..da397dea65 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,8 @@ ## NEW FEATURES +- Added a pattern and file type (.RLatex), so R code chunks in a LaTeX document can be defined within an Rcode environment. + - It is possible to customize the sign `\times` used for the scientific notation of inline numeric output via a global option, e.g., `options(knitr.inline.times = '\\cdot ')` (thanks, @wuffi @trentks, #1563). ## BUG FIXES diff --git a/inst/misc/tweak_bib.csv b/inst/misc/tweak_bib.csv index 119f58884e..a167151df9 100644 --- a/inst/misc/tweak_bib.csv +++ b/inst/misc/tweak_bib.csv @@ -1,33 +1,28 @@ "package","author" -"BiplotGUI","Anthony la Grange and N. J. le Roux and P.J. Rousseeuw and I. Ruts and J. W. Tukey" -"CircStats","Ulric Lund and Claudio Agostinelli" -"ElemStatLearn","Kjetil Halvorsen" -"Fahrmeir","Kjetil Halvorsen" -"Hmisc","Harrell, Jr., Frank E" -"Hmisc","Frank E. {Harrell, Jr.}" -"R2SWF","Yixuan Qiu and Yihui Xie and Cameron Bracken" -"R2WinBUGS","Andrew Gelman and Sibylle Sturtz and Uwe Ligges and Gregor Gorjanc and Jouni Kerman" -"RODBC","Brian Ripley and Michael Lapsley" -"RgoogleMaps","Markus Loecher" -"Sleuth2","F. L. Ramsey and D. W. Schafer and Jeannie Sifneos and Berwin A. Turlach" "ade4","Stéphane Dray and Anne-Béatrice Dufour and Jean Thioulouse and Thibaut Jombart and Sandrine Pavoine and Jean R. Lobry and Sébastien Ollier and Aurélie Siberchicot and Daniel Chessel" "akima","H. Akima and Albrecht Gebhardt and Thomas Petzoldt and Martin Maechler" "ash","David W. Scott and Albrecht Gebhardt and Stephen Kaluzny" "bcpa","Jose Claudio Faria and Clarice Garcia Borges Demetrio" +"BiplotGUI","Anthony la Grange and N. J. le Roux and P.J. Rousseeuw and I. Ruts and J. W. Tukey" "bitops","Steve Dutky and Martin Maechler" "cacheSweave","Roger D. Peng" "cat","Ted Harding and Fernando Tusell and Joseph L. Schafer" +"CircStats","Ulric Lund and Claudio Agostinelli" "contrast","Max Kuhn and Steve Weston and Jed Wing and James Forester" "date","Terry Therneau and Thomas Lumley and Kjetil Halvorsen and Kurt Hornik" "digest","Dirk Eddelbuettel" +"ElemStatLearn","Kjetil Halvorsen" "epiR","Mark Stevenson and Telmo Nunes and Cord Heuer and Jonathon Marshall and Javier Sanchez and Ron Thornton and Jeno Reiczigel and Jim Robison-Cox and Paola Sebastiani and Peter Solymos" +"Fahrmeir","Kjetil Halvorsen" "flashClust","Fionn Murtagh and {R development team} and Peter Langfelder" "foreach","{Revolution Analytics} and Steve Weston}" "fortunes","Achim Zeileis and the R community" -"gWidgets","John Verzani" "gee","Vincent J Carey and Thomas Lumley and Brian Ripley" "gmodels","Gregory R. Warnes andBen Bolker and Thomas Lumley and Randall C Johnson and Randall C. Johnson" +"gWidgets","John Verzani" "hexbin","Dan Carr and Nicholas Lewin-Koh and Martin Maechler" +"Hmisc","Harrell, Jr., Frank E" +"Hmisc","Frank E. {Harrell, Jr.}" "leaps","Thomas Lumley" "mapproj","Doug McIlroy and Ray Brownrigg and Thomas P Minka and Roger Bivand" "maps","Ray Brownrigg" @@ -36,9 +31,14 @@ "pbivnorm","Alan Genz and Brenton Kenkel" "pscl","Simon Jackman and Alex Tahk and Achim Zeileis and Christina Maimone and Jim Fearon" "quadprog","Berwin A. Turlach and Andreas Weingessel" +"R2SWF","Yixuan Qiu and Yihui Xie and Cameron Bracken" +"R2WinBUGS","Andrew Gelman and Sibylle Sturtz and Uwe Ligges and Gregor Gorjanc and Jouni Kerman" "randomForest","Leo Breiman and Adele Cutler and Andy Liaw and Matthew Wiener" "rgl","Daniel Adler and Duncan Murdoch" +"RgoogleMaps","Markus Loecher" "rms","Frank E. {Harrell, Jr.}" "robustbase","Valentin Todorov and Andreas Ruckstuhl and Matias Salibian-Barrera and Tobias Verbeke and Manuel Koller and Martin Maechler" +"RODBC","Brian Ripley and Michael Lapsley" +"Sleuth2","F. L. Ramsey and D. W. Schafer and Jeannie Sifneos and Berwin A. Turlach" "sm","Adrian Bowman and Adelchi Azzalini" "tuneR","Uwe Ligges" From 12ce474d9f9ea0930ccbc29f26fd27a8e7adff82 Mon Sep 17 00:00:00 2001 From: Michael Braun Date: Sun, 7 Apr 2019 18:59:21 -0500 Subject: [PATCH 7/7] updated NEWS.md and DESCRIPTION --- inst/misc/tweak_bib.csv | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/inst/misc/tweak_bib.csv b/inst/misc/tweak_bib.csv index a167151df9..119f58884e 100644 --- a/inst/misc/tweak_bib.csv +++ b/inst/misc/tweak_bib.csv @@ -1,28 +1,33 @@ "package","author" +"BiplotGUI","Anthony la Grange and N. J. le Roux and P.J. Rousseeuw and I. Ruts and J. W. Tukey" +"CircStats","Ulric Lund and Claudio Agostinelli" +"ElemStatLearn","Kjetil Halvorsen" +"Fahrmeir","Kjetil Halvorsen" +"Hmisc","Harrell, Jr., Frank E" +"Hmisc","Frank E. {Harrell, Jr.}" +"R2SWF","Yixuan Qiu and Yihui Xie and Cameron Bracken" +"R2WinBUGS","Andrew Gelman and Sibylle Sturtz and Uwe Ligges and Gregor Gorjanc and Jouni Kerman" +"RODBC","Brian Ripley and Michael Lapsley" +"RgoogleMaps","Markus Loecher" +"Sleuth2","F. L. Ramsey and D. W. Schafer and Jeannie Sifneos and Berwin A. Turlach" "ade4","Stéphane Dray and Anne-Béatrice Dufour and Jean Thioulouse and Thibaut Jombart and Sandrine Pavoine and Jean R. Lobry and Sébastien Ollier and Aurélie Siberchicot and Daniel Chessel" "akima","H. Akima and Albrecht Gebhardt and Thomas Petzoldt and Martin Maechler" "ash","David W. Scott and Albrecht Gebhardt and Stephen Kaluzny" "bcpa","Jose Claudio Faria and Clarice Garcia Borges Demetrio" -"BiplotGUI","Anthony la Grange and N. J. le Roux and P.J. Rousseeuw and I. Ruts and J. W. Tukey" "bitops","Steve Dutky and Martin Maechler" "cacheSweave","Roger D. Peng" "cat","Ted Harding and Fernando Tusell and Joseph L. Schafer" -"CircStats","Ulric Lund and Claudio Agostinelli" "contrast","Max Kuhn and Steve Weston and Jed Wing and James Forester" "date","Terry Therneau and Thomas Lumley and Kjetil Halvorsen and Kurt Hornik" "digest","Dirk Eddelbuettel" -"ElemStatLearn","Kjetil Halvorsen" "epiR","Mark Stevenson and Telmo Nunes and Cord Heuer and Jonathon Marshall and Javier Sanchez and Ron Thornton and Jeno Reiczigel and Jim Robison-Cox and Paola Sebastiani and Peter Solymos" -"Fahrmeir","Kjetil Halvorsen" "flashClust","Fionn Murtagh and {R development team} and Peter Langfelder" "foreach","{Revolution Analytics} and Steve Weston}" "fortunes","Achim Zeileis and the R community" +"gWidgets","John Verzani" "gee","Vincent J Carey and Thomas Lumley and Brian Ripley" "gmodels","Gregory R. Warnes andBen Bolker and Thomas Lumley and Randall C Johnson and Randall C. Johnson" -"gWidgets","John Verzani" "hexbin","Dan Carr and Nicholas Lewin-Koh and Martin Maechler" -"Hmisc","Harrell, Jr., Frank E" -"Hmisc","Frank E. {Harrell, Jr.}" "leaps","Thomas Lumley" "mapproj","Doug McIlroy and Ray Brownrigg and Thomas P Minka and Roger Bivand" "maps","Ray Brownrigg" @@ -31,14 +36,9 @@ "pbivnorm","Alan Genz and Brenton Kenkel" "pscl","Simon Jackman and Alex Tahk and Achim Zeileis and Christina Maimone and Jim Fearon" "quadprog","Berwin A. Turlach and Andreas Weingessel" -"R2SWF","Yixuan Qiu and Yihui Xie and Cameron Bracken" -"R2WinBUGS","Andrew Gelman and Sibylle Sturtz and Uwe Ligges and Gregor Gorjanc and Jouni Kerman" "randomForest","Leo Breiman and Adele Cutler and Andy Liaw and Matthew Wiener" "rgl","Daniel Adler and Duncan Murdoch" -"RgoogleMaps","Markus Loecher" "rms","Frank E. {Harrell, Jr.}" "robustbase","Valentin Todorov and Andreas Ruckstuhl and Matias Salibian-Barrera and Tobias Verbeke and Manuel Koller and Martin Maechler" -"RODBC","Brian Ripley and Michael Lapsley" -"Sleuth2","F. L. Ramsey and D. W. Schafer and Jeannie Sifneos and Berwin A. Turlach" "sm","Adrian Bowman and Adelchi Azzalini" "tuneR","Uwe Ligges"