lundi 30 mars 2015

knitr syntax highlighting: numbers and logical values are not highlighted


Vote count:

0




This is a minimal example for Rwn taken from Yihui Xie website. All I did was to add an expression involving logical values and to delete some of the text to make the example a bit shorter.



\documentclass{article}
\usepackage[sc]{mathpazo}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\geometry{verbose,tmargin=2.5cm,bmargin=2.5cm,lmargin=2.5cm,rmargin=2.5cm}
\setcounter{secnumdepth}{2}
\setcounter{tocdepth}{2}
\usepackage{url}
\usepackage[unicode=true,pdfusetitle,
bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=2,
breaklinks=false,pdfborder={0 0 1},backref=false,colorlinks=false]
{hyperref}
\hypersetup{
pdfstartview={XYZ null null 1}}

\begin{document}
<<setup, include=FALSE, cache=FALSE>>=
library(knitr)
# set global chunk options
opts_chunk$set(fig.path='figure/minimal-', fig.align='center', fig.show='hold')
options(formatR.arrow=TRUE,width=90)
@
\title{A Minimal Demo of knitr}
\author{Yihui Xie}
\maketitle
You can test if \textbf{knitr} works with this minimal demo. OK, let's
get started with some boring random numbers:

<<boring-random>>=
set.seed(1121)
(x=rnorm(20))
mean(x)
y <- c(TRUE,FALSE,NA)
@
\end{document}


The weird thing is that when I knit/compile this minimal example (even when I leave the original example unaltered) the R code highlighting I in my pdf is different to the highlighting scheme of the pdf output that can be found on Yihui Xie website here. To be precise: in my pdf neither numbers nor logical values nor function arguments are highlighted. However, R functions, characters and commands (after the #) are properly highlighted.


Has anyone experienced a similar issue, or even better: does anyone know how to fix this?


Greetings, M.



asked 32 secs ago







knitr syntax highlighting: numbers and logical values are not highlighted

Aucun commentaire:

Enregistrer un commentaire