fixed figures by using Sweave environments in hooks 

instead of \begin{example}