See https://github.com/yihui/knitr-examples/blob/master/036-latex-if.Rnw
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{article} | |
% change the space between paragraphs in chunks | |
\parindent = 0.0in | |
\parskip = 0.125in | |
\ifdefined\knitrout | |
\renewenvironment{knitrout}{ | |
\setlength{\parskip}{0in} | |
}{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{article} | |
\DefineVerbatimEnvironment{Sinput}{Verbatim}{xleftmargin=2em, | |
fontsize=\footnotesize, fontshape=sl} | |
\DefineVerbatimEnvironment{Soutput}{Verbatim}{xleftmargin=2em, | |
fontsize=\footnotesize} | |
\fvset{listparameters={\setlength{\topsep}{0pt}}} | |
\renewenvironment{Schunk}{\vspace{\topsep}}{\vspace{\topsep}} | |
\begin{document} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{article} | |
\begin{document} | |
This demo shows you how to use the Palatino font in the Cairo PDF device. | |
<<setup>>= | |
my_cairo = function(file, width, height) { | |
cairo_pdf(file, width, height, family = 'Palatino') | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{article} | |
<<adjust-preamble, echo=FALSE, results='asis'>>= | |
if (opts_knit$get('use.highlight')) cat('\\def\\usehighlightdefs{1}\n') | |
@ | |
\ifx\highlightexists\undefined | |
\newcommand{\hlstd}[1]{\textcolor[rgb]{0,0,0}{#1}} | |
\newcommand{\hlnum}[1]{\textcolor[rgb]{0.69,0.49,0}{#1}} | |
\newcommand{\hlesc}[1]{\textcolor[rgb]{1,0,1}{#1}} | |
\newcommand{\hlstr}[1]{\textcolor[rgb]{0.75,0.01,0.01}{#1}} | |
\newcommand{\hlpps}[1]{\textcolor[rgb]{0.51,0.51,0}{#1}} |
This has been incorporated into the highr package: https://github.com/yihui/highr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install.packages(c('gWidgetsRGtk2', 'gWidgetstcltk', 'gWidgetsrJava')) | |
library(gWidgets) | |
## different interfaces | |
options(guiToolkit = 'RGtk2') | |
g = gwindow('RGtk2') | |
gtext('RGtk2', container = g) | |
gbutton('RGtk2', container = g) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
makeStaticHTMLHelp <- function(libs = .libPaths()) { | |
make.packages.html(lib.loc = libs) | |
links <- findHTMLlinks() | |
for (lib in libs) { | |
message('* Generating static HTML for packages in library ', lib) | |
for (pkg in rownames(installed.packages(lib))) { | |
message('** package', pkg) | |
pkgRdDB <- tools:::fetchRdDB(file.path(lib, pkg, 'help', pkg)) |