5

一种不优雅的方法是在注释文本中添加几行 tex 代码。

但是,在 R 中,有没有一种更原生的方式来记录包的latex功能Hmisc

4

1 回答 1

0

有一种方法不在 Hmisc 中,而是使用starpolishr包,

install.packages("devtools")
library(devtools)
install_github("ChandlerLutz/starpolishr");library(starpolishr)

使用标题包插入脚注

la<-latex(mtcars[1:2,1:5],file="example.tex",caption = "table using caption",
    where="!htbp") 
file0<-readLines("example.tex") 
file0<-star_notes_tex(file0, note = "file using caption*") 
cat(file0, file = paste0(getwd(),"/file0.tex"),sep="\n")

使用threeparttable插入脚注

注意,你必须使用 Hmisc::latex 中的标题和标签参数

mt <- mtcars[1:2,1:5]
mt[1,1]<-paste0(mt[1,1],"\\tnote{*}")
la<-latex(mt,file="example1.tex",label=" ",caption="table using threeparttable",
    where="!htbp") 
file1<-readLines("example1.tex") 
file1<-star_notes_tex(file1, note.type = "threeparttable",
note = "* notes with threeparttable : For this example you must use both label and caption, the
 threepartable code is meant to be used with tables generated by
 stargazer where a row with label is present. Otherwise the threepart table 
 argument is badly positionned.")
cat(file1, file = paste0(getwd(),"/file1.tex"),sep="\n")

脚注

于 2017-11-18T19:38:51.567 回答