build Sweave generated tex file correctly