# multi-page two column table in a single column document

I have looked through and tried quite a few probable solutions but am unable to get this right. I am posting the best minimal example I currently have of what I am trying to accomplish here. Being new, I am not allowed to post images, so please do copy the two files and compile.

I want the title to be at the top of both the sides/columns of the table and also to manage the extra whitespace at the end of table.

\documentclass{article}
\usepackage[left=2cm, top=3cm, right=2cm, bottom=3cm]{geometry}
\usepackage{tabularx}
\usepackage{xtab}

\begin{document}

\section{List}

\topcaption{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
\label{tab:xxxxx}

\twocolumn

\tablehead{\hline x & x*x \\ \hline}

\begin{xtabular}{| l || c |}
\input{squares.tex}
\end{xtabular}
\end{document}


Data File to test the script above :: squares.tex

101 & 10201 \\
102 & 10404 \\
103 & 10609 \\
104 & 10816 \\
105 & 11025 \\
106 & 11236 \\
107 & 11449 \\
108 & 11664 \\
109 & 11881 \\
110 & 12100 \\
111 & 12321 \\
112 & 12544 \\
113 & 12769 \\
114 & 12996 \\
115 & 13225 \\
116 & 13456 \\
117 & 13689 \\
118 & 13924 \\
119 & 14161 \\
120 & 14400 \\
121 & 14641 \\
122 & 14884 \\
123 & 15129 \\
124 & 15376 \\
125 & 15625 \\
126 & 15876 \\
127 & 16129 \\
128 & 16384 \\
129 & 16641 \\
130 & 16900 \\
131 & 17161 \\
132 & 17424 \\
133 & 17689 \\
134 & 17956 \\
135 & 18225 \\
136 & 18496 \\
137 & 18769 \\
138 & 19044 \\
139 & 19321 \\
140 & 19600 \\
141 & 19881 \\
142 & 20164 \\
143 & 20449 \\
144 & 20736 \\
145 & 21025 \\
146 & 21316 \\
147 & 21609 \\
148 & 21904 \\
149 & 22201 \\
150 & 22500 \\
151 & 22801 \\
152 & 23104 \\
153 & 23409 \\
154 & 23716 \\
155 & 24025 \\
156 & 24336 \\
157 & 24649 \\
158 & 24964 \\
159 & 25281 \\
160 & 25600 \\
161 & 25921 \\
162 & 26244 \\
163 & 26569 \\
164 & 26896 \\
165 & 27225 \\
166 & 27556 \\
167 & 27889 \\
168 & 28224 \\
169 & 28561 \\
170 & 28900 \\
171 & 29241 \\
172 & 29584 \\
173 & 29929 \\
174 & 30276 \\
175 & 30625 \\
176 & 30976 \\
177 & 31329 \\
178 & 31684 \\
179 & 32041 \\
180 & 32400 \\
181 & 32761 \\
182 & 33124 \\
183 & 33489 \\
184 & 33856 \\
185 & 34225 \\
186 & 34596 \\
187 & 34969 \\
188 & 35344 \\
189 & 35721 \\
190 & 36100 \\
191 & 36481 \\
192 & 36864 \\
193 & 37249 \\
194 & 37636 \\
195 & 38025 \\
196 & 38416 \\
197 & 38809 \\
198 & 39204 \\
199 & 39601 \\
200 & 40000 \\

-
Welcome to TeX.sx! – Marco Daniel Sep 29 '12 at 8:56
This question is very similar to tex.stackexchange.com/questions/13895/…. Please take a look at it as the information there might help you. If so, that's great, and we'll probably close this question as a duplicate just to keep the place tidy and to help people find answers quickly. If not, please edit your question here to explain why so that people can better focus their attention to help you. – lockstep Sep 30 '12 at 10:11
Try using longtable. See here tex.stackexchange.com/questions/45980/… – mythealias Sep 30 '12 at 21:23
Thanks for the suggestion and apologies for the tardiness in my reply. Both the solutions got me almost where I wanted to be, but fell short - Probably due to my limited experience in LaTex. Solution pointed out by lockstep had the effect that if a short portion of the table went to the next page, it would occupy just one column and not split itself up into 2. Also it started a new page at the end. Solution pointed out by mythealias has the table head entries missing for the subsequent pages/table breaks. This misaligns the next table entry with the original table head. – mukesh Oct 6 '12 at 1:42
I ended up breaking the input tex file into symmetric segments. And then used multiple tabulars inside a table, It seems to give the table the appearance I want, but then I haven't tested it as part of a larger document yet. – mukesh Oct 6 '12 at 1:49

longtable can in fact work in two column mode, it just needs a bit of encouragement not to give up and issue an error message:

\documentclass{article}
\usepackage[left=2cm, top=3cm, right=2cm, bottom=3cm]{geometry}
\usepackage{longtable}

\makeatletter
\let\saved@longtable\longtable
\long\def\foo#1\LT@err#2#3#4!!{\def\longtable{#1#4}}
\expandafter\foo\longtable!!

\long\def\foo#1\@outputpage#2\@outputpage#3!!{%
\def\LT@output{#1\@opcol#2\@opcol#3}}
\expandafter\foo\LT@output!!
\makeatother

\begin{document}

\twocolumn[\section{List}]

\begin{longtable}{| l || c |}
\caption{Some square numbers\label{tab:xxx}}\\
$n$&$n$-squared\\
\hline
$n$&$n$-squared\\

+1. Will this patch appear in next version of longtable? – Harish Kumar Dec 22 '12 at 16:31
Though I use only longtable, when it comes to two columns, I am forced to switch to supertabular. This patch is really welcome. Hope it gets into the main package. :-) – Harish Kumar Dec 22 '12 at 16:34