gpt4 book ai didi

tex - Sweave 到 LaTeX "undefined control sequence"错误

转载 作者:行者123 更新时间:2023-12-01 19:54:51 27 4
gpt4 key购买 nike

我正在尝试使用 RStudio 将一些 R 结果包含在 TeX 文档中。我已经设法让 RStudio 生成(在我看来)一个很好的 tex 文件,但它无法编译 pdf。

我收到错误返回说!未定义的控制序列。 ' 这似乎是由于 str(data) 调用的第一行和显示显着性级别的行而返回的:

"! Undefined control sequence.
<argument> '
data.frame': 1980 obs. of 5 variables:
l.39 'data.frame': 1980 obs. of 5 variables:

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined."

"! Undefined control sequence. <argument>
Signif. codes: 0 '
***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
l.95 ...**' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined."

仅包含摘要(数据)的文件可以正常工作

查看其他邮件列表等我发现这可能是因为 tex 找不到 Sweave 包,因此将其复制到各个位置(与 Rnw 和 tex 文件相同的文件夹,以及路径中没有空格的目录)并且尝试重新运行该文件。似乎什么都不起作用。

同样,这不起作用,但使用summary(cars)而不是str(cars)可以。这对我来说表明它与 ' 字符有关。

\documentclass [a4paper]{article}
\usepackage{Sweave}
\title {Sweave Example 1}
\author {Friedrich Leisch}
\begin {document}
\maketitle
In this example we embed parts of the examples from the
\texttt {kruskal.test} help page into a \ LaTeX {} document :
<<>>=
data ( cars )
str(cars)
@
\end{document}

(改编自 sweave 手册)关于我做错了什么有什么想法吗?

如有任何建议,我们将不胜感激。

最佳答案

[noae] 包选项添加到 \usepackage{Sweave} 语句中。

关于tex - Sweave 到 LaTeX "undefined control sequence"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12585505/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com