使用rticles包的Knitr错误:!未定义的控制序列。 <recent read =“”> \ checkmark

时间:2017-02-21 15:00:14

标签: r latex knitr

我有一大块,当我使用标准编织器将其编织到pdd时,就像我期望的那样出现:

---
title: "Test table"
author: "Derek Corcoran"
date: "February 20, 2017"
output: pdf_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_chunk$set(warning =  FALSE)
```

这是$ \ psi $

```{r, results='asis', echo = FALSE}
library(xtable)
Softwares <- structure(list(X = structure(c(9L, 5L, 7L, 4L, 1L, 8L, 6L, 2L, 
3L), .Label = c("Alpha diversity models", "Build in model selection", 
"Built in response plot", "Multiple Species Abundance", "Multiple Species Single Season occupancy", 
"Priority area selection", "Single Species Abundance", "Single Species Dynamic occupancy", 
"Single Species Single Season occupancy"), class = "factor"), 
Diversityoccupancy = structure(c(1L, 1L, 1L, 1L, 1L, NA, 
1L, 1L, 1L), .Label = "$\\checkmark$", class = "factor"), Unmarked = structure(c(1L, 
NA, 2L, NA, NA, 2L, NA, NA, NA), .Label = c("$\\checkmark$", 
"$\\checkmark$"), class = "factor"), stocc = structure(c(1L, NA, NA, 
NA, NA, NA, NA, NA, NA), .Label = "$\\checkmark$", class = "factor"), 
Presence = structure(c(1L, NA, 1L, NA, NA, 1L, NA, NA, NA
), .Label = "$\\checkmark$", class = "factor"), Pom = structure(c(1L, 
NA, NA, NA, NA, NA, NA, NA, NA), .Label = "$\\checkmark$", class = "factor"), 
camptrapR = structure(c(1L, NA, NA, NA, NA, NA, NA, NA, NA
), .Label = "$\\checkmark$", class = "factor")), .Names = c("X", "Diversityoccupancy", 
"Unmarked", "stocc", "Presence", "Pom", "camptrapR"), class = "data.frame", row.names = c(NA, 
-9L))

names <- colnames(Softwares[,-1])
colnames(Softwares) <- c("", names)
print(xtable(Softwares, align = rep("c", 8)), scalebox='0.75', type = "latex", sanitize.text.function = function (x) x, include.rownames = F, comment=FALSE)


```

当我编织这个pdf出来时 enter image description here

但是,如果我使用 rticles 包并使用JSS文章的模板并在其中插入相同的块,则会出现:

! Undefined control sequence.
<recently read> \checkmark 

1 个答案:

答案 0 :(得分:2)

您需要在YAML标头中添加on

\usepackage{amsfonts}

打开JSS模板时默认加载preamble: > \usepackage{amsmath} \usepackage{amsfonts} ,而不是amsfont包。