fixed figures by using Sweave environments in hooks rather than \begin{example}
Merge pull request #4 from cwickham/master

fixed figures by using Sweave environments in hooks