fixed figures by using Sweave environments in hooks rather than \begin{example}