Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Syntax Highlighting Themes for HTML #179

Merged
merged 34 commits into from

3 participants

@ramnathv

I made some modifications to the file themes.R so that syntax highlighting themes work for html output as well. I tested it and it works. There is a lot of scope to refactor the code here, but for now I focused on keeping the changes to a minimal.

Let me know when you have a chance to review the code and pull in the changes.

inst/themes/.knitr.css
@@ -0,0 +1,19 @@
+.knitr {
+ background-color: #fdf6e3;
+ border-style:solid;
+ border-width:1px;
+ border-color: #B0B0B0;
@yihui Owner
yihui added a note

these 3 lines can be merged as border: solid 1px #B0B0B0;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@yihui
Owner

this looks pretty good; I'll be happy to merge it after you made the small change above

you can also try to refactor the code as you wish; thanks a lot!

@ramnathv

I made the changes. I also reverted the background-color to the light gray that was used as the default before.

@ramnathv

I did not realize that these changes would be added to the pull request as well. I just refactored the code. Let me know if you want to pull these as well, or you will be able to selectively pull the user-visible changes first and pull these after you have had a chance to review.

@yihui
Owner

I can wait until you finish the work; at least I have not seen knitr.sty yet.

My original plan for #140 was to write the header into a separate file in the last step in insert_header() in header.R, so I do not actually need to move the text into a file beforehand.

R/header.R
@@ -62,55 +62,7 @@ set_header = function(...) {
}
## many thanks to Donald Arseneau
-.header.framed = '\\usepackage{framed}
-\\makeatletter
-\\newenvironment{kframe}{%
- \\def\\FrameCommand##1{\\hskip\\@totalleftmargin \\hskip-\\fboxsep
- \\colorbox{shadecolor}{##1}\\hskip-\\fboxsep
- % There is no \\@totalrightmargin, so:
- \\hskip-\\linewidth \\hskip-\\@totalleftmargin \\hskip\\columnwidth}%
- \\MakeFramed {\\advance\\hsize-\\width
- \\@totalleftmargin\\z@ \\linewidth\\hsize
- \\@setminipage}}%
- {\\par\\unskip\\endMakeFramed}
-\\makeatother
+## COMMIT: move .header.framed to a style file of its own so that it can be ## included or copied directly to the tex file
+.knit.sty <- system.file('misc', 'knitr.sty', package = 'knitr')
+.header.framed <- paste(readLines(.knit.sty), collapse = "\n")
@yihui Owner
yihui added a note

I'm not sure if this really works, because the code will be run before knitr is installed, i.e. there is no knitr.sty at that time.

Good point. The alternative would be to move these lines directly inside the functions that use them. That way, they would be invoked only after knitr is installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ramnathv

I like the idea of pulling the headers into a style file in case of latex or a css file in case of html. I think you should provide users two options. Option 1 would be status quo, where the headers are included directly in the document making it standalone. Option 2 would be to put the header in an external file and include it in the parent document.

On a different note, I think it would be useful if you can add an option highlight.theme that would take a theme name as input. This would simplify the code considerably,as you can set the default theme based on the output format (for example default for html and edit-eclipse for latex) and not have to deal with special cases.

Let me know if you think this might be a good idea. If you think it is, and you agree with the two options, I can put together a patch addressing this and send you a pull request. If you think other ways of doing it might be better, do let me know so that we agree on a specification before further work.

@yihui yihui commented on the diff
R/hooks.R
@@ -280,8 +280,17 @@ render_latex = function() {
if (child_mode()) return()
test_latex_pkg('framed', system.file('misc', 'framed.sty', package = 'knitr'))
h = opts_knit$get('header')
- if (!nzchar(h['framed'])) set_header(framed = .header.framed)
- if (!nzchar(h['highlight'])) set_header(highlight = .header.hi.tex)
+ if (!nzchar(h['framed'])) {
+ .knit.sty <- system.file('misc', 'knitr.sty', package = 'knitr')
+ .header.framed <- paste(readLines(.knit.sty), collapse = "\n")
+ set_header(framed = .header.framed)
+ }
+ if (!nzchar(h['highlight'])) {
+ # header for Latex Syntax Highlighting
+ .header.hi.tex = paste(theme_to_header_latex('edit-eclipse')$highlight,
@yihui Owner
yihui added a note

why is edit-eclipse the default theme for LaTeX output?

This is the default that you had used previously. I remember reading a note of yours sometime, where you indicated that you found the colors of the default highlight theme too flashy for pdfs.

@yihui Owner
yihui added a note

Yes I think I mentioned it at some time, but I'm not actually using edit-eclipse. The default theme has a light gray background, and the background of edit-eclipse is white.

In that event, I will create a default.latex.css theme which has the gray background.

@yihui Owner
yihui added a note

Actually I do not see much gain of moving the two objects .header.framed and .header.hi.tex to two files respectively; I mean they are simply string constants and it is probably not worth it to read and write through extra files. At the end of the day, they will be concatenated in insert_header(), and that will be the time to write the header into a separate file if opts_knit$get('self.contained') == TRUE.

First, to some extent it is a style issue, since I don't prefer latex and other markups contaminating my R code. Second, these are just defaults. So pulling them inside default files helps keep the code clean without cluttering them up with a lot of if.. else statements. For instance, if we implement highlight.style as an option, you can set it to default and the headers would automatically correspond to them. Just my two cents :-)

@yihui Owner
yihui added a note

OK, .header.hi.tex can go to a file like default.css. For .header.framed, I'd rather leave it as is at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@yihui
Owner

You can add include to opts_knit, but is there a better name? It might be confusing because it is also in opts_chunk.

For highlight.theme, I guess it is not of high priority, so let's put it aside at the moment.

@ramnathv

It might be a bad idea to use include since it is already an option in opts_chunk. I am thinking of mimicking pandoc and using the option self_contained which is TRUE by default implying headers are directly contained in the document. It is the same reason why I think adding highlight_style as an option would be neat.

The use case for these options is that very often I generate multiple versions of my document, and I don't want to be tampering with the base document. I know, I can use knit_theme$set(), but it is an extra function to remember. Is there any reason you think adding highlight_style as a global option is a bad idea?

@yihui
Owner

I think self.contained and highlight.style are good to be put in opts_knit.

@ramnathv

I have made the changes to get (a) syntax highlighting in html and (b) allowing the header to be written to an external file using opts_knit$set(self.contained = TRUE).

You will notice a few commits involving addition/removal of hooks for reSt files. The reason is that I wanted to do a few more tests before adding them. I was thinking that for the purposes of easier maintenance, it might make sense to write a sister package knitrExtra which can contain user contributed hooks. If you think it is a good idea, I can set up a github repository for knitrExtra. Let me know.

@ramnathv

On a different note, I think there might be an opportunity to refactor the overall code of knitr significantly. One idea is to use S3 methods. For instance, if you set the class of a document to its output format, it would be easier to extend knitr by adding generic functions pat, render, make_header, insert_header etc.

Let me know what you think.

@yihui
Owner

Oops... I made some changes to header.R and hooks.R, and this pull request cannot be automatically merged now. Is it possible for you to pull my changes and resolve the conflicts? Sorry for the trouble.

Regarding S3 methods, you can experiment with it after this pull request or do it in another branch. Thanks!

@ramnathv

Done! You should be able to pull this now. Let me know if you still find some conflicts.

@yihui
Owner

It looks good now. I will take a look tonight. Thanks!

@yihui yihui merged commit 6aa2d1f into yihui:master
@vsbuffalo

Is there an option to turn on these HTML themes with knit2html()?

@ramnathv

No. But you can do it by using knit_theme$set('acid') in your document, where acid is the theme name. You can also decide whether you want to keep the stylesheet as a part of the html file, or an external css file.

@yihui
Owner

currently themes only work for LaTeX and HTML output; knit2html() is essentially for markdown, so these themes do not apply

if you want different themes for markdown-->html, you probably need to write your own css depending on which converter you use (sundown, pandoc, ...)

I have seen your own tweak on twitter which looks very nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 25, 2012
  1. @ramnathv
  2. @ramnathv
  3. @ramnathv
  4. @ramnathv
  5. @ramnathv

    minor changes to .knitr.css

    ramnathv authored
  6. @ramnathv
  7. @ramnathv

    add background to default css

    ramnathv authored
  8. @ramnathv
  9. @ramnathv
  10. @ramnathv
Commits on Mar 26, 2012
  1. @ramnathv
  2. @ramnathv
  3. @ramnathv
  4. @ramnathv
  5. @ramnathv
Commits on Mar 27, 2012
  1. @ramnathv
  2. @ramnathv
Commits on Mar 28, 2012
  1. @ramnathv

    add graphicx package

    ramnathv authored
Commits on Mar 30, 2012
  1. @ramnathv
Commits on Apr 1, 2012
  1. @ramnathv
  2. @ramnathv

    add myhooks.R to collate

    ramnathv authored
  3. @ramnathv
Commits on Apr 9, 2012
  1. @ramnathv
  2. @ramnathv
  3. @ramnathv
  4. @ramnathv
  5. @ramnathv

    adjust spacing in css file

    ramnathv authored
  6. @ramnathv
  7. @ramnathv
  8. @ramnathv
Commits on Apr 11, 2012
  1. @ramnathv
  2. @ramnathv

    Merge remote branch 'upstream/master'

    ramnathv authored
    Conflicts:
    	R/hooks.R
  3. @ramnathv
  4. @ramnathv

    allow ```{r} fixes #195

    ramnathv authored
This page is out of date. Refresh to see the latest.
View
1  .Rbuildignore
@@ -12,3 +12,4 @@ knitr-minimal.html
knitr-minimal.md
knitr-latex.tex
png$
+^\.Rproj\.user$
View
4 .gitignore
@@ -8,4 +8,6 @@ inst/examples/figure
inst/examples/ex-out*
knitr-minimal.html
knitr-latex.tex
-
+.Rproj.user
+misc
+knitr.Rproj
View
4 R/defaults.R
@@ -108,7 +108,7 @@ all_patterns =
header.begin = '\n*\\s*<head>',
ref.label = '^## @knitr (.*)$'),
- `md` = list(chunk.begin = '^``` \\{r(.*)\\}\\s*$',
+ `md` = list(chunk.begin = '^```\\s*\\{r(.*)\\}\\s*$',
chunk.end = '^```\\s*$',
chunk.end.is.terminator = TRUE,
ref.chunk = '^\\s*<<(.*)>>\\s*$',
@@ -135,7 +135,7 @@ opts_knit =
all.patterns = all_patterns, tangle = FALSE,
child = FALSE, parent = FALSE,
cache.extra = NULL, aliases = NULL,
-
+ self.contained = TRUE,
header = c(highlight = '', tikz = '', framed = ''))
)
## header should not be set by hand unless you know what you are doing
View
140 R/header.R
@@ -1,27 +1,66 @@
-## x is the output of processed document
-insert_header = function(x) {
- if (is.null(b <- knit_patterns$get('header.begin'))) return(x)
- h = opts_knit$get('header')
- i = which(str_detect(x, b))
- if (length(i) == 1L) {
- fmt = opts_knit$get('out.format')
- if (fmt %in% c('markdown', 'gfm', 'jekyll')) return(x)
- if (identical('latex', fmt))
- h = c('\\usepackage{graphicx, color}', h)
- if (identical('html', fmt))
- h = h['highlight']
- h = h[nzchar(h)]; if (length(h) == 0) h = ''
- loc = str_locate(x[i], b)
- str_sub(x[i], loc[, 1], loc[, 2]) =
- str_c(str_sub(x[i], loc[, 1], loc[, 2]), '\n', str_c(h, collapse = '\n'))
- } else if (length(i) == 0L) {
- if (parent_mode()) {
- h = c('\\usepackage{graphicx, color}', h)
- x = c(getOption('tikzDocumentDeclaration'), str_c(h, collapse = '\n'),
- .knitEnv$tikzPackages, '\\begin{document}', x, '\\end{document}')
- }
- }
- x
+## doc is the output of processed document
+insert_header <- function(doc){
+ fmt = opts_knit$get('out.format')
+ switch(fmt,
+ html = insert_header_html(doc),
+ latex = insert_header_latex(doc),
+ doc
+ )
+}
+
+## Makes latex header with macros required for highlighting, tikz and framed
+make_header_latex <- function(){
+ h <- "\\usepackage{graphicx, color}"
+ h <- paste(c(h, opts_knit$get('header')), collapse = "\n")
+ if (opts_knit$get('self.contained')){
+ return(h)
+ } else {
+ writeLines(h, 'knitr.sty')
+ return('\\usepackage{knitr}')
+ }
+}
+
+insert_header_latex <- function(doc){
+ # TODO: is this really required since b will never be NULL for latex.
+ if (is.null(b <- knit_patterns$get('header.begin'))){
+ return(doc)
+ }
+ h <- make_header_latex()
+ i <- which(str_detect(doc, b))
+ l <- str_locate(doc[i], b)
+ if (length(i) == 1L){
+ tmp <- str_sub(doc[i], l[, 1], l[, 2])
+ str_sub(doc[i], l[,1], l[,2]) <- str_c(tmp, "\n", h)
+ } else if (length(i) == 0L) {
+ doc <- str_c(getOption('tikzDocumentDeclaration'), h, .knitEnv$packages,
+ "\\begin{document}", doc, "\\end{document}")
+ }
+ return(doc)
+}
+
+make_header_html <- function(){
+ h <- opts_knit$get('header')[['highlight']]
+ if (opts_knit$get('self.contained')){
+ h <- str_c('<style type="text/css">', h, '</style>', collapse = "\n")
+ return(h)
+ } else {
+ writeLines(h, 'knitr.css')
+ return('<link rel="stylesheet" href="knitr.css" type="text/css" />')
+ }
+}
+
+insert_header_html <- function(doc){
+ if (is.null(b <- knit_patterns$get('header.begin'))){
+ return(doc)
+ }
+ h <- make_header_html()
+ i <- which(str_detect(doc, b))
+ l <- str_locate(doc[i], b)
+ if (length(i) == 1L){
+ tmp <- str_sub(doc[i], l[, 1], l[, 2])
+ str_sub(doc[i], l[,1], l[,2]) <- str_c(tmp, "\n", h)
+ }
+ return(doc)
}
#' Set the header information
@@ -61,56 +100,3 @@ set_header = function(...) {
opts_knit$set(header = h)
}
-## many thanks to Donald Arseneau
-.header.framed = '\\usepackage{framed}
-\\makeatletter
-\\newenvironment{kframe}{%
- \\def\\FrameCommand##1{\\hskip\\@totalleftmargin \\hskip-\\fboxsep
- \\colorbox{shadecolor}{##1}\\hskip-\\fboxsep
- % There is no \\@totalrightmargin, so:
- \\hskip-\\linewidth \\hskip-\\@totalleftmargin \\hskip\\columnwidth}%
- \\MakeFramed {\\advance\\hsize-\\width
- \\@totalleftmargin\\z@ \\linewidth\\hsize
- \\@setminipage}}%
- {\\par\\unskip\\endMakeFramed}
-\\makeatother
-
-\\definecolor{shadecolor}{rgb}{.97, .97, .97}
-\\newenvironment{knitrout}{}{} % an empty environment to be redefined in TeX
-
-\\newcommand{\\SweaveOpts}[1]{} % do not interfere with LaTeX
-\\newcommand{\\SweaveInput}[1]{} % because they are not real TeX commands
-\\newcommand{\\Sexpr}[1]{} % will only be parsed by R
-'
-
-## LaTeX styles for highlight
-.header.hi.tex =
- str_c(c("\\newcommand{\\hlnumber}[1]{\\textcolor[rgb]{0,0,0}{#1}}%",
- "\\newcommand{\\hlfunctioncall}[1]{\\textcolor[rgb]{.5,0,.33}{\\textbf{#1}}}%",
- "\\newcommand{\\hlstring}[1]{\\textcolor[rgb]{.6,.6,1}{#1}}%",
- "\\newcommand{\\hlkeyword}[1]{\\textbf{#1}}%",
- "\\newcommand{\\hlargument}[1]{\\textcolor[rgb]{.69,.25,.02}{#1}}%",
- "\\newcommand{\\hlcomment}[1]{\\textcolor[rgb]{.18,.6,.34}{#1}}%",
- "\\newcommand{\\hlroxygencomment}[1]{\\textcolor[rgb]{.44,.48,.7}{#1}}%",
- "\\newcommand{\\hlformalargs}[1]{\\hlargument{#1}}%",
- "\\newcommand{\\hleqformalargs}[1]{\\hlargument{#1}}%",
- "\\newcommand{\\hlassignement}[1]{\\textbf{#1}}%",
- "\\newcommand{\\hlpackage}[1]{\\textcolor[rgb]{.59,.71,.145}{#1}}%",
- "\\newcommand{\\hlslot}[1]{\\textit{#1}}%",
- "\\newcommand{\\hlsymbol}[1]{#1}%",
- "\\newcommand{\\hlprompt}[1]{\\textcolor[rgb]{.5,.5,.5}{#1}}%",
- boxes_latex(), "\\definecolor{fgcolor}{rgb}{0,0,0}"), collapse = '\n')
-
-.header.hi.html =
- str_c(c('<style type="text/css">', '.knitr {
- background-color: #F7F7F7;
-}', '.error {
- font-weight: bold;
- color: #FF0000;
-}', '.warning {
- font-weight: bold;
-}', '.message {
- font-style: italic;
-}', '.source, .output, .warning, .error, .message {
- padding: 0.5em 1em;
-}', styler('default'), '</style>'), collapse = '\n')
View
21 R/hooks.R
@@ -282,8 +282,17 @@ render_latex = function() {
if (child_mode()) return()
test_latex_pkg('framed', system.file('misc', 'framed.sty', package = 'knitr'))
h = opts_knit$get('header')
- if (!nzchar(h['framed'])) set_header(framed = .header.framed)
- if (!nzchar(h['highlight'])) set_header(highlight = .header.hi.tex)
+ if (!nzchar(h['framed'])) {
+ .knit.sty <- system.file('misc', 'knitr.sty', package = 'knitr')
+ .header.framed <- paste(readLines(.knit.sty), collapse = "\n")
+ set_header(framed = .header.framed)
+ }
+ if (!nzchar(h['highlight'])) {
+ # header for Latex Syntax Highlighting
+ .header.hi.tex = paste(theme_to_header_latex('edit-eclipse')$highlight,
@yihui Owner
yihui added a note

why is edit-eclipse the default theme for LaTeX output?

This is the default that you had used previously. I remember reading a note of yours sometime, where you indicated that you found the colors of the default highlight theme too flashy for pdfs.

@yihui Owner
yihui added a note

Yes I think I mentioned it at some time, but I'm not actually using edit-eclipse. The default theme has a light gray background, and the background of edit-eclipse is white.

In that event, I will create a default.latex.css theme which has the gray background.

@yihui Owner
yihui added a note

Actually I do not see much gain of moving the two objects .header.framed and .header.hi.tex to two files respectively; I mean they are simply string constants and it is probably not worth it to read and write through extra files. At the end of the day, they will be concatenated in insert_header(), and that will be the time to write the header into a separate file if opts_knit$get('self.contained') == TRUE.

First, to some extent it is a style issue, since I don't prefer latex and other markups contaminating my R code. Second, these are just defaults. So pulling them inside default files helps keep the code clean without cluttering them up with a lot of if.. else statements. For instance, if we implement highlight.style as an option, you can set it to default and the headers would automatically correspond to them. Just my two cents :-)

@yihui Owner
yihui added a note

OK, .header.hi.tex can go to a file like default.css. For .header.framed, I'd rather leave it as is at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ collapse = '\n')
+ set_header(highlight = .header.hi.tex)
+ }
knit_hooks$restore()
knit_hooks$set(source = function(x, options) {
if (options$highlight) {
@@ -339,7 +348,13 @@ render_html = function() {
force(name)
function (x, options) sprintf('<div class="%s">%s</div>', name, x)
}
- set_header(highlight = .header.hi.html)
+ h = opts_knit$get('header')
+ if (!nzchar(h['highlight'])) {
+ # CSS for html syntax highlighting
+ .header.hi.html = paste(theme_to_header_html('default')$highlight,
+ collapse = '\n')
+ set_header(highlight = .header.hi.html)
+ }
z = list()
for (i in c('source', 'output', 'warning', 'message', 'error'))
z[[i]] = html.hook(i)
View
50 R/themes.R
@@ -2,16 +2,20 @@
#' @noRd
#' @author Ramnath Vaidyanathan
set_theme = function(theme) {
+ fmt = opts_knit$get('out.format')
header = if (is.list(theme)) theme else theme_to_header(theme)
- highlight = paste(c(header$highlight, boxes_latex()), collapse = "\n")
- opts_chunk$set(background = header$background)
+ highlight = paste(header$highlight, collapse = "\n")
+ if(fmt == 'latex') {
+ opts_chunk$set(background = header$background)
+ }
set_header(highlight = highlight)
## par(col = theme$foreground)
}
get_theme = function(theme = NULL) {
if (is.null(theme)) {
- f = list.files(system.file("themes", package = "knitr"), pattern = "\\.css$")
- gsub("\\.css$", "", basename(f))
+ theme_dir = system.file("themes", package = "knitr")
+ theme_files = list.files(theme_dir, pattern = "\\.css$")
+ gsub("\\.css$", "", basename(theme_files))
} else {
theme_to_header(theme)
}
@@ -41,11 +45,23 @@ get_theme = function(theme = NULL) {
#' knit_theme$set(thm)
knit_theme = list(set = set_theme, get = get_theme)
+
+#' Generates header based on a theme and output format of document
+#' @author Ramnath Vaidyanathan
+#' @noRd
+theme_to_header = function(theme){
+ fmt <- opts_knit$get('out.format')
+ if (fmt == 'latex'){
+ theme_to_header_latex(theme)
+ } else
+ theme_to_header_html(theme)
+}
+
#' Generates latex header based on a theme
#' @importFrom highlight css.parser styler_assistant_latex
#' @author Ramnath Vaidyanathan
#' @noRd
-theme_to_header = function(theme) {
+theme_to_header_latex = function(theme) {
css_file = if (file.exists(theme)) theme else {
system.file("themes", sprintf("%s.css", theme), package = "knitr")
}
@@ -57,7 +73,27 @@ theme_to_header = function(theme) {
## write latex highlight header
fgheader = color_def(foreground, "fgcolor")
- highlight = c(fgheader, styler_assistant_latex(css_out[-1]))
-
+ highlight = c(fgheader, styler_assistant_latex(css_out[-1]), boxes_latex())
list(highlight = highlight, background = background, foreground = foreground)
}
+
+#' Generates css header based on a theme
+#' @author Ramnath Vaidyanathan
+#' @noRd
+# HACK: replace ugly sub hack to match knitr background with theme
+# TODO: warning, error, source etc. are still black, an issue for dark themes
+# TODO: might be a good idea to regenerate the css files appending the
+# .knitr.css template to the existing templates
+theme_to_header_html <- function(theme){
+ css_file = if (file.exists(theme)) theme else {
+ system.file("themes", sprintf("%s.css", theme), package = "knitr")
+ }
+ bgcolor <- css.parser(css_file)$background$color
+ css_knitr = system.file('themes', '.knitr.css', package = 'knitr')
+ css_knitr_lines <- readLines(css_knitr)
+ css_knitr_lines <- sub('^([[:space:]]+background-color:\\s+)(.*)$',
+ sprintf('\\1%s;', bgcolor), css_knitr_lines)
+ css <- c(css_knitr_lines, readLines(css_file))
+ return(list(highlight = css))
+}
+
View
19 inst/misc/knitr.sty
@@ -0,0 +1,19 @@
+\usepackage{framed}
+\makeatletter
+\newenvironment{kframe}{%
+ \def\FrameCommand##1{\hskip\@totalleftmargin \hskip-\fboxsep
+ \colorbox{shadecolor}{##1}\hskip-\fboxsep
+ % There is no \\@totalrightmargin, so:
+ \hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
+ \MakeFramed {\advance\hsize-\width
+ \@totalleftmargin\z@ \linewidth\hsize
+ \@setminipage}}%
+ {\par\unskip\endMakeFramed}
+\makeatother
+
+\definecolor{shadecolor}{rgb}{.97, .97, .97}
+\newenvironment{knitrout}{}{} % an empty environment to be redefined in TeX
+
+\newcommand{\SweaveOpts}[1]{} % do not interfere with LaTeX
+\newcommand{\SweaveInput}[1]{} % because they are not real TeX commands
+\newcommand{\Sexpr}[1]{} % will only be parsed by R
View
17 inst/themes/.knitr.css
@@ -0,0 +1,17 @@
+.knitr {
+ background-color: #F7F7F7;
+ border:solid 1px #B0B0B0;
+}
+.error {
+ font-weight: bold;
+ color: #FF0000;
+},
+.warning {
+ font-weight: bold;
+}
+.message {
+ font-style: italic;
+}
+.source, .output, .warning, .error, .message {
+ padding: 0.5em 1em;
+}
View
61 inst/themes/default.css
@@ -0,0 +1,61 @@
+.background{
+ color: #eeeeee ;
+}
+.number{
+ color: rgb(21,20,181) ;
+}
+
+.functioncall{
+ color: red ;
+}
+
+.string{
+ color: rgb(153,153,255) ;
+}
+
+.keyword{
+ font-weight: bolder ;
+ color: black;
+}
+
+.argument{
+ color: rgb( 177,63,5) ;
+}
+
+.comment{
+ color: rgb( 204,204,204) ;
+}
+
+.roxygencomment{
+ color: rgb(0,151,255);
+}
+
+.formalargs{
+ color: rgb(18,182,18);
+}
+
+.eqformalargs{
+ color: rgb(18,182,18);
+}
+
+.assignement{
+ font-weight: bolder;
+ color: rgb(55,55,98);
+}
+
+.package{
+ color: rgb(150,182,37);
+}
+
+.slot{
+ font-style:italic;
+}
+
+.symbol{
+ color: black ;
+}
+
+.prompt{
+ color: black ;
+}
+
Something went wrong with that request. Please try again.