Knit pdf 無法在 Mac OS X 上運行,錯誤“!插入了 $ 缺失。”

Knit pdf 無法在 Mac OS X 上運行,錯誤“!插入了 $ 缺失。”

我在 rmarkdown 有以下區塊

{r }
library(psych)
a  <- (matrix(c(1:1000), ncol=4))
f <- fa(a)

但是當我嘗試內聯列印以下輸出時:

`r f$null.chisq`

我收到以下錯誤訊息並且沒有產生 pdf

/usr/local/bin/pandoc +RTS -K512m -RTS prova2.utf8.md --to latex
--from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures
--output prova2.pdf --template /Library/Frameworks/R.framework/Versions/3.2/Resources/library/rmarkdown/rmd/latex/default-1.14.tex
--highlight-style tango --latex-engine /Library/TeX/texbin/pdflatex --variable 'geometry:margin=1in'

! Missing $ inserted. <inserted text> 
                $ l.162 1.6708458\times

pandoc: Error producing PDF from TeX source Error: pandoc document
conversion failed with error 43 Execution halted

我在 Windows 機器上測試了相同的程式碼,它工作正常,但在我的 Mac 上卻不行,這意味著我知道這個錯誤可能無法完全重現。另外,我甚至在保存可重現錯誤腳本的文件中沒有第 162 行,所以我很難理解它是什麼

$ l.162

實際上意味著。

但是,如果我省略最後一行程式碼,即

`r f$null.chisq`

然後一切正常。

答案1

$$數字加上,數字是用科學記數法寫出來的針織物

$`r f$null.chisq`$

相關內容