Latex knitr:fig.height在新版本中必须是数字?

Latex knitr:fig.height在新版本中必须是数字?,latex,knitr,rnw,Latex,Knitr,Rnw,我下载了knitr软件包的新版本,在尝试将绘图包含在Rnw文件中时,突然出现以下错误: Error in options[[sprintf("fig.%s", i)]] * options$dpi : non-numeric argument to binary operator Calls: knit ... process_group.block -> call_block -> fix_options -> %n% 经过大量实验,我发现问题出在fig.height

我下载了knitr软件包的新版本,在尝试将绘图包含在Rnw文件中时,突然出现以下错误:

Error in options[[sprintf("fig.%s", i)]] * options$dpi : 
  non-numeric argument to binary operator
Calls: knit ... process_group.block -> call_block -> fix_options -> %n%
经过大量实验,我发现问题出在fig.height命令上,显然它应该是数字。此代码产生以下错误:

\documentclass{article}

\begin{document}

<<cat, fig.cap="dog", fig.height='\\textheight'>>=
plot(c(1, 2, 3), c(2, 1, 3))
@

\end{document}
\documentclass{article}
\开始{document}
=
地块(c(1,2,3),c(2,1,3))
@
\结束{document}
此代码不包括:

\documentclass{article}

\begin{document}

<<cat, fig.cap="dog", fig.height=6>>=
plot(c(1, 2, 3), c(2, 1, 3))
@

\end{document}
\documentclass{article}
\开始{document}
=
地块(c(1,2,3),c(2,1,3))
@
\结束{document}
不幸的是,我不知道这6的计量单位是什么

此代码:

\documentclass{article}

\begin{document}

<<cat, fig.cap="dog", fig.height=6cm>>=
plot(c(1, 2, 3), c(2, 1, 3))
@

\end{document}    
\documentclass{article}
\开始{document}
=
地块(c(1,2,3),c(2,1,3))
@
\结束{document}
产生不同的错误:

Error in base::parse(text = code, srcfile = NULL) : 
  1:44: unexpected symbol
1: alist( 'cat', fig.cap="dog", fig.height=6cm
                                           ^
Calls: knit ... withCallingHandlers -> eval -> parse_only -> <Anonymous>
Execution halted 
base::parse中出现错误(text=code,srcfile=NULL): 1:44:意外符号 1:alist('cat',fig.cap=“dog”,fig.height=6cm ^ 调用:knit…with callinghandlers->eval->parse_only-> 停止执行 总而言之,knitr似乎真的希望fig.height有一个数值,这有点烦人,因为我已经在我的文档中输入了很多
fig.height='\\texthheight'
命令(回到那些仍然有效的日子)我也不知道Latex的
\textheight
对应的数值是多少

有什么建议吗


更新:我做了更多的实验,结果发现你输入到fig.height的数字在Latex文件中没有出现,相反,它们直接影响knitr生成的cat.pdf图像的尺寸。这种情况表明,完全忽略
fig.height
可能是最好的策略。但这并没有告诉我们怎么做要在tex文档中获取
[height=\textheight]

请使用区块选项
out.height
而不是
fig.height

使用区块选项
out.height
而不是
fig.height
,谢谢您的快速回复!谢谢您的快速回复!