
m\\textsubscript{2}
를 사용하여 열 이름에 포함시키려고 합니다 kable
. escape=F
이 문제가 발생하도록 변경하면 PDF가 컴파일되지 않습니다.
암호:
library(kableExtra)
kable(table2.1,format="latex",row.names=NA,align="c",escape=T,
col.names=c("Survey","StationID","Latitude (degrees)",
"Latitude (minutes)","Longitude (degrees)","Longitude (minutes)","Scallops (number)","Scallops (lbs)","Scallops (baskets)","Scallop density (m\\textsubscript{2})","Nematode Prevalence (%)"),caption="Catch data for the commercial dredge from the VIMS/Industry cooperative surveys completed during May-July 2018. Nematode prevalence (percentage of scallops sampled at a given station infected with nematodes) is also provided for each station.",longtable = T) %>%
kable_styling(font_size=8,position="center",latex_options =c("repeat_header", "hold_position"),repeat_header_text="Table 2 continued",repeat_header_method="replace") %>%
column_spec(3:6,width = "0.50in") %>%
column_spec(7:9,width = "0.49in") %>%
column_spec(10:11,width = "0.65in")
가짜 작은 데이터 세트를 사용하여 다음 코드를 사용하여 위 첨자 형식으로 컴파일할 PDF를 얻을 수 있습니다.
A <- data.frame(round(replicate(11, runif(2)),2))
rownames(A) <- c("Hola\\textsubscript{123}", "Hola\\textsubscript{234}")
kable(A,
row.names = T,
col.names=c("Survey","StationID","Latitude (degrees)",
"Latitude (minutes)","Longitude (degrees)","Longitude (minutes)","Scallops (number)","Scallops (lbs)","Scallops (baskets)","Scallop density (m\\textsuperscript{2})","Nematode Prevalence"),escape = F)%>%
kable_styling(font_size=8,position="center",latex_options =c("repeat_header", "hold_position"),repeat_header_text="Table 2 continued",repeat_header_method="replace") %>%
column_spec(3:6,width = "0.25in") %>%
column_spec(7:9,width = "0.25in") %>%
column_spec(10:11,width = "0.65in")
@
내 데이터는 table2.1
R 소스 코드에서 생성됩니다. 구조는 다음과 같습니다.
data.frame': 770 obs. of 11 variables:
$ Survey : Factor w/ 3 levels "CAI_II","MAB",..: 2 2 2 2 2 2 2 2 2 2 ...
$ StationID : int 201801001 201801002 201801003 201801004 201801005 201801006 201801007 201801008 201801009 201801010 ...
$ Latitude_degrees : int 36 36 36 36 36 36 36 36 36 36 ...
$ Latitude_minutes : num 31 36.1 36.9 41.1 42.1 ...
$ Longitude_degrees: int 74 74 74 74 74 74 74 74 74 74 ...
$ Longitude_minutes: num 48.9 44.5 46.6 48.8 45.4 ...
$ Scallop_number : num 0 0 0 0 0 0 0 0 0 0 ...
$ Scallop_lbs : num 0 0 0 0 0 0 0 0 0 0 ...
$ Scallops_baskets : num 0 0 0 0 0 0 0 0 0 0 ...
$ Scallop_density : num 0 0 0 0 0 0 0 0 0 0 ...
$ Nematode : num 0 0 0 0 0 0 0 0 0 0
작업할 예제 코드를 실행하려고 table2.1
하면 escape=F
. 이로 인해 PDF 컴파일을 방해하는 것이 있다고 생각하게 되지만 table2.1
확실하지 않으며 조언을 구합니다. RStudio와 pdfLaTex를 고소합니다.