R パッケージ (xtable
およびknitr
) と Latex パッケージ (longtable
およびhyperref
) を使用してドキュメントを準備しています。
テーブルの 1 つが非常に長く、複数のページに分割されています。「表のリスト」には、この表が表示されるすべてのページ番号が表示されますが、すべてのハイパーリンクでこの表の先頭に移動することがわかりました。
私の質問は、「テーブルのリスト」で、このテーブルが表示される最初のページ番号を表示するにはどうすればよいかということです。
\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}