5

I have been generating a lot of data for a project and I wrote in TeX commands (via print statements) so that I get rows upon rows of data entries that look like

 a_{1} & a_{2} & a_{3} \\

This allows me to readily copy and paste over the data into an array environment, but when I typeset the data text runs to the bottom of the page and cuts part of it off, thereby not displaying all of it. I using the array environment and my TeX codes looks something like

\[
  \begin{array}{c c c}
    a_{1} & a_{2} & a_{3} \\
    a_{6} & a_{7} & a_{8} \\
    (many more such entries)
  \end{array}
\]
  • 1
    Consider to use longtable instead equation environment with array. Columns in this table of it can be set in math mode with >{$} c <{$}. – Zarko Jun 29 '16 at 4:23
3

You can make a longtable environment look very much like an array environment. The longtable environment provides for automatic page breaking, and you can give it a \caption, if need be.

If it's not possible to tell which of the following two arrays was created with longtable and which was created with array, that's by design. :-)

enter image description here

\documentclass{article}
\usepackage{array,longtable}
\newcolumntype{C}{>{$}c<{$}}  % automatic math mode, centered
\setlength\tabcolsep{5pt}     % match value of \arraycolsep 
\begin{document}

\begin{longtable}{CCC}
    a_{1} & a_{2} & a_{3} \\
    a_{6} & a_{7} & a_{8} \\
    \multicolumn{3}{l}{and so on}\\
\end{longtable}

\[
  \begin{array}{c c c}
    a_{1} & a_{2} & a_{3} \\
    a_{6} & a_{7} & a_{8} \\
    \multicolumn{3}{l}{$and so on$}\\
  \end{array}
\]

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.