在编译exams2pdf()
的练习时,我对这个错误感到困惑:
Exam 1: ICvar (srt) ... w! Missing $ inserted.
<inserted text>
$
l.7 ...rime 2}}{chi^2_{1-frac{alpha}{2};(n-1)}}
;frac{(n-1)S^{prime 2}}{...
Error: LaTeX failed to compile icvar1.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See icvar1.log for more info.
这是我的ICvar.Rmd
的代码(我从ICvar中的先前代码中获得变量的值)。RMD文件链接在这里,如果你想看到整个文件):
Solution
========
Para $n$ = `r length(v)` um I.C. a `r cilevel*100`% para a $sigma^2$ é:
$$bigg] frac{(n-1)S^{prime 2}}{chi^2_{1-frac{alpha}{2};(n-1)}};frac{(n-1)S^{prime 2}}{chi^2_{frac{alpha}{2};(n-1)}}bigg[$$
我正在生成latex文件:
exams2pdf(file="ICvar.Rmd",
name = "icvar",
engine="knitr",
verbose=T
)
我的latex (exercise01)文件是:
begin{question}
textbf{Um intervalo de confiança a 99% para variabilidade é:}
begin{answerlist}
item {]}1599.909; 24699.887{[}{]}1225.75; 49863.356{[}{]}24.685;
235.649{[}{]}33.179; 227.154{[}{]}129.822; 130.511{[}{]}
frac{(n-1)S^{prime 2}}{chi^2_{1-frac{alpha}{2};(n-1)}};frac{(n-1)S^{prime 2}}{chi^2_{frac{alpha}{2};(n-1)}}bigg[$$
Assim:
$bigg]frac{(6-1) times 64.079^2}{chi_{1- frac{0.01}{2};(6-1)}^2};frac{(6-1) times 64.079^2}{chi_{frac{0.01}{2};(6-1)}^2}
bigg[ iff$
$bigg]frac{5 times 4106.118}{chi_{1- 0.005;(5)}^2};frac{5 times 4106.118}{chi_{0.005;(5)}^2}bigg[ iff$
$bigg]frac{5 times 4106.118}{chi_{0.995;(5)}^2};frac{5 times 4106.118}{chi_{0.005;(5)}^2}bigg[ iff$
$bigg]frac{5 times 4106.118}{16.75};frac{5 times 4106.118}{0.412}bigg[ iff$
$bigg] 1225.736;49862.768bigg{[}$
end{answerlist}
end{question}
在回答列表之后缺少end{answerlist}
,并且不存在' begin{solution},我相信这会导致错误。但不明白为什么tinytex呈现的文件是这样的
我正在使用:
R version 4.1.1 (2021-08-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 11 x64 (build 22000)
other attached packages:
[1] tinytex_0.33 dplyr_1.0.7 exams_2.4-0
任何想法都会很感激…(顺便说一下,同样的文件"knits"在R工作室和…exams2pdf()在Ubuntu 20中生成pdf)。
解决方案:
- 安装R 4.1
- Unistall RStudio
- 重启电脑 安装R和Rstudio
现在它工作了…