我正在使用 R 包 ( xtable
and knitr
) 和 Latex 包 ( longtable
and hyperref
) 来准备文档。
我的一张桌子很长,分成多页。事实证明,“表列表”显示了该表出现的每个页码,但所有超链接都将我带到了该表的开头。
我的问题是,在“表格列表”中,我怎样才能显示该表格出现的第一页码。
\documentclass{article}
\usepackage{longtable}
\usepackage{hyperref}
<<setup, include=FALSE, cache=FALSE>>=
library(knitr)
library(xtable)
@
\begin{document}
\listoftables
\newpage
<<echo=FALSE,results='asis'>>=
## some customerized settings for "longtable"
addtorow <- list()
addtorow$pos <- list()
addtorow$pos[[1]] <- c(0)
addtorow$command <- c(paste("\\hline \n",
"\\endhead \n",
"\\hline \n",
"{\\footnotesize Continued on next page} \n",
"\\endfoot \n",
"\\endlastfoot \n",sep=""))
## create a long table
d <- data.frame(ID=rep(1:300), LAB=rnorm(300))
## execute "xtable"
dTab <- xtable(d, caption="This is Table 1")
print(dTab,
tabular.environment = "longtable",
floating = FALSE,
include.colnames = TRUE,
include.rownames = FALSE, #addtorow substitute default row names
add.to.row = addtorow, # make the substitution here
hline.after=c(-1), # addtorow substitute default hline for first row
caption.placement="top"
)
@
\end{document}