Search code examples
rlatexbigtablesweavextable

header on each page of big table of xtable?


How do you put on a big table of xtable the table header on each page?, So that is easier to read the table the table between pages.

I use the following in Sweave:

test.big<- xtable(test,label="table",caption='test')
align(test.big) <- "|c|c|c|c|l|c|c|c|"
print(test.big,tabular.environment='longtable',include.colnames = TRUE,floating=FALSE)

Thanks for your answers


Solution

  • The longtable (LaTeX) package specification can be found at that URL. The section of code in the examples whose output appears on pages 2 and 3 is in section 8 and I have reproduced bit of it below:

    \caption[]{(continued)}\\ 
    \hline\hline 
    \multicolumn{2}{@{*}c@{*}}% 
    {This part appears at the top of every other page}\\ 
    \textbf{First}&\textbf{Second}\\ 
    \hline\hline 
    \endhead 
    

    When they say on "every other page", they mean every page other than the first, which had a different header. If the xtable call is not working out of the box without any editing, then you should first check that you have the longtable package specified in your LaTeX preamble:

    \usepackage{longtable}