1

I am trying to use memoir class with longtable environment, but no success:

\documentclass{memoir}
\usepackage{longtable}

\begin{document}

\begin{longtable}
    \centering
    \caption{Caption of the normal \texttt{table} environment.}
    \begin{tabular}{rrrrrrrrr}
        1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\
        1 & 1 & 1 & 1 & 1 & 1 & 1 & 1
    \end{tabular}
    \label{table}
\end{longtable}

\end{document}

Do the error:

 test2.tex:7: Class memoir Error:  Illegal pream-token (\centering): `c' used. [    \centering]

Changing longtable by table does work correctly with no errors or warnings. How to make the longtable to also work?


Related questions:

  1. How can I make a table that takes up more than a single page?
  2. Make a table span multiple pages
  3. Formatting captions in longtable tables
6
  • Do you need longtable?
    – Werner
    Aug 15, 2017 at 17:48
  • Well, the table by itself does not fit in only one page. So would be nice if it split by itself.
    – user
    Aug 15, 2017 at 17:49
  • 1
    I'd suggest starting with longtable by using the example code at the end of the longtable doumentation.
    – Werner
    Aug 15, 2017 at 17:54
  • @Werner, the one at the page 10?
    – user
    Aug 15, 2017 at 18:01
  • Indeed. Start there, and remove the content you don't need, and change whatever you want to keep. You won't see the construction you started with. Starting with the documentation is always good.
    – Werner
    Aug 15, 2017 at 18:46

1 Answer 1

2

\centering is automatic for long tables, and the caption is part of the environment. So try with this syntax:

\begin{longtable}{*{8}{c}}
    \caption{Caption of the normal \texttt{table} environment.}
    \label{table}\\
  \endfirsthead
\multicolumn{8}{c}{\tablename~\thetable\enspace(continued)}\\
  \endhead
        1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\
        1 & 1 & 1 & 1 & 1 & 1 & 1 & 1
\end{longtable}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .