yihui 用knitr,一个钩子搞定它,无非是把%替换为\%而已。示例: https://github.com/yihui/knitr-examples/blob/master/043-percent.Rnw Sweave没有可编程性,你只能接受它给你的结果。