1

Related:

I want to use a simple custom CSS for code highlighting in knitted .Rnw/.tex/.pdf documents. However only a select few rules seem to be implemented upon knitting.

For the moment I am focusing on colorless highlighting, consequently I would like to manipulate rules such as text-decoration, font-weight, font-style and - for grays - color; cf. the theme "print" here. But, even with the simplest examples, I can only get a certain few to be implemented, e.g., color and font-style; specifically, I've found that font-weight does nothing, nor does text-decoration. E.g.:

.background {
    color:#F6F6F6;
}

...

.kwc {/* e.g., parameters */
    font-weight:100;
    color:#8C8C8C;
}


.kwd {/* e.g., methods */
    text-decoration:underline;
}

...

.com {/* comments */
    font-style:italic;
}

...

(The sets of three dots indicate that my CSS file contains more than the example above.)

With the above in my style sheet, in the output PDF the code block background and parameters are colored accordingly and the comments italicized, however the parameters do not have a font weight of 100 nor are methods underlined.

Is there some sort of limitation as to the rules custom knitr themes may use? What else may be the problem here?

N.B.:

  • Mac 10.9.3
  • knitr v1.6.3.
  • I have the CSS in the same directory as my Rnw document and I pass it to knitr in a chunk at the beginning of my document via:

    theme <- knit_theme$get('./my_css.css')
    knit_theme$set(theme)
    
Community
  • 1
  • 1
user109114
  • 403
  • 4
  • 10

0 Answers0