SweaveListingUtils 和行号
我目前正在尝试使用 SweaveListingUtils。由于有小插图,第一步非常简单。
只有行号(包括引用)没有按预期/预期工作(相关的 Sweave/R/LaTeX 代码发布在下面):
<<exam001>>=
x <- rnorm(3) # comment (*\label{comment1}*)
print(round(x, 2))
a <- 2 # comment (*\label{comment2}*)
@
Note that line \ref{comment1} and \ref{comment2} contain comments.
输出应包含执行的代码和打印,包括从 1 到 3 的行号< /强>。 但是在打印命令后计数会重新开始!
引用也会受到影响:
Note that line 1 and 1 contain comment.
有谁知道如何使用 Sweave 和 SweaveListingUtils 获得正确的行编号? (我假设该解决方案适用于 R 代码中的打印、绘图等!)
I'm currently trying to use SweaveListingUtils. Because of the vignette, the first steps are quite easy.
Only the line numbers (including references) are not working as intended/expected (the relevant Sweave/R/LaTeX code is posted below):
<<exam001>>=
x <- rnorm(3) # comment (*\label{comment1}*)
print(round(x, 2))
a <- 2 # comment (*\label{comment2}*)
@
Note that line \ref{comment1} and \ref{comment2} contain comments.
The output should contain the executed code and the printing including line numbers from 1 to 3. But the numeration restarts after the print command!
Also the references are affected:
Note that line 1 and 1 contain comment.
Does anyone know how to get correct line numbering using Sweave and SweaveListingUtils? (I assume that the solution works with printing, plotting etc. from/in the R code!)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论