Skip to content
Prev 166487 / 398502 Next

longtable example

This is what I got.

\documentclass[11pt]{article}
\usepackage{longtable,lscape}
\usepackage{accents}
\usepackage[usenames,dvipsnames]{color} % load all the colors
\title{\color{Blue}How to transfer column names and add captions to pages in document}
\begin{document}
\maketitle
I am using Sweave and MikTex to generate my report but I am having problems with a table
that has 52 rows. I have no problem creating the 'longtable' but since my table is created dynamically,
I don't know how to transfer the column names to the second page of the PDF. I can name my column
names manually but since the table is created on the fly I wonder if there's a way that the column
headers from the first page be transferred automatically to the second or third pages and also have
captions on the header and footer of the pages ( something like 'Continued on next page').
Here's an example
<<tab.R,echo=FALSE,results=tex>>=
x <- matrix(rnorm(1000), ncol = 10)
x.big <- data.frame(x)
x.big <- xtable(x,label='big',align="c|cccccccccc|",caption='Example of longtable spanning several pages')
print(x.big,tabular.environment='longtable',latex.environments=c("center"),include.rownames=FALSE,floating=FALSE)
@
I want to add the column headers from the first page to the rest of the pages
and the caption 'Continued' to the top of each page. Thanks
\end{document}
--- On Thu, 1/8/09, Dieter Menne <dieter.menne at menne-biomed.de> wrote: