Skip to content

Instantly share code, notes, and snippets.

@cameronbracken
Created May 4, 2011 22:28
Show Gist options
  • Save cameronbracken/956177 to your computer and use it in GitHub Desktop.
Save cameronbracken/956177 to your computer and use it in GitHub Desktop.
Example increasing the font size of highlighted output
\documentclass{article}
\usepackage{tikz}
\usepackage[margin=1in]{geometry}
\title{Minimal pgfSweave Example}
\author{Cameron Bracken}
\renewenvironment{Hinput}{\begin{trivlist}\item\LARGE}{\end{trivlist}}
\begin{document}
<<setup,echo=F>>=
setCacheDir("cache")
options(keep.space=TRUE)
options(highlight.size="LARGE")
@
\maketitle
This example is identical to that in the Sweave manual and is intended to
introduce pgfSweave and highlight the basic differences. Please refer to
the pgfSweave vignette for more usage instructions.
We embed parts of the examples from the \texttt{kruskal.test} help page
into a \LaTeX{} document:
<<data,cache=T,tidy=T>>=
# hey, a comment
data(airquality)
print(kruskal.test( Ozone ~ Month, data = airquality )) # and another
@
\noindent which shows that the location parameter of the Ozone distribution varies
significantly from month to month. Finally we include a boxplot of the data:
\begin{figure}[!ht]
\centering
%notice the new options
{\pgfkeys{/pgf/images/include external/.code={\includegraphics[width=3in]{#1}}}
<<boxplot,echo=T,fig=T,width=3,height=3,tikz=T,external=T,highlight=T>>=
boxplot(Ozone ~ Month, data = airquality,
main='Ozone distribution',xlab='Month',ylab='Concentration')
@
}% this brace ends the effect of ‘include external’
\caption{This is from pgfSweave. Text is typset by \LaTeX\ and so matches the
font of the document.}
\end{figure}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment