2

I would like to make a really broad table in LaTeX which automatically breaks when it reaches the right end of the page. As I am not so good in describing the problem, I made a sketch:

sketch

It is not important that it looks exactly the same (e.g. the dotted lines). The important thing is that it breaks automatically. Do you have an idea? I don't want to rotate the table since it would take too much space.

  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Moriambar Jun 6 '17 at 21:08
  • Crosspost on goLaTeX. – Johannes_B Jun 7 '17 at 1:22
4

It's a start...I just concatenate a bunch of single column tabular* blocks.

EDITED to give the OP an additional input format more akin to tabular.

\documentclass{article}
\usepackage{listofitems}
\newcommand\mycell[2]{%
  \begin{tabular*}{35pt}{c}$#1$\\\hline $#2$\end{tabular*}\allowbreak\ignorespaces}
\newcommand\mysep{%
  \begin{tabular*}{0pt}{|c}\strut\\\hline\strut\end{tabular*}\allowbreak\ignorespaces}
\newcommand\Startthistable[2]{%
  \par\noindent\leftskip35pt\leavevmode\llap{\mycell{#1}{#2}}\mysep}
\newcommand\Endthistable{\par\leftskip0pt\ignorespaces}
\newcommand\Setthistable[1]{%
  \setsepchar{\\/&}%
  \readlist*\mytabledata{#1}%
  \foreachitem\x\in\mytabledata[1]{%
    \mycell{\x}{\mytabledata[2,\xcnt]}%
  }%
}
\begin{document}

\Startthistable{x}{f(x)}
\Setthistable{
 1& 2& 3& 4& 5& 6& 7& 8& 9&10&11&12&13&14&15&16&17&18&19&20&21&22&23\\
 1& 1& 1& 1& 1& 1& 1& 1& 1& 1& 1& 1& 1& 1& 1& 1& 1& 1& 1& 1& 1& 1& 1
}
\Endthistable

\noindent or else one can do it the original way

\Startthistable{x}{f(x)}
\mycell{1}{1}
\mycell{2}{1}
\mycell{3}{1}
\mycell{4}{1}
\mycell{5}{1}
\mycell{6}{1}
\mycell{7}{1}
\mycell{8}{1}
\mycell{9}{1}
\mycell{10}{1}
\mycell{11}{1}
\mycell{12}{1}
\mycell{13}{1}
\mycell{14}{1}
\mycell{15}{1}
\mycell{16}{1}
\mycell{17}{1}
\mycell{18}{1}
\mycell{19}{1}
\mycell{20}{1}
\mycell{21}{1}
\mycell{22}{1}
\mycell{23}{1}
\Endthistable

\end{document} 

enter image description here

| improve this answer | |
  • Is there any possibility to make it that way I can use the standard '1&2&3...' format? – Kwazy Cupcake Jun 6 '17 at 21:27
  • @KwazyCupcake Please see my update. – Steven B. Segletes Jun 7 '17 at 1:11

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.