1

I apologize for the long delay in updating this post. I misunderstood quite a bit at first, and wasn't very clear as to my original issue.

I am trying to make a table using the \begin{tabular} code. But I am receiving the following error message, which I believed to be activating at 17 columns, but is closer to 18. Now, I don't know if it's due to trying to make one column Left Aligned, while the rest are centered. Or if I am going about this the wrong way.

The Error is displayed not as a Red X, but a Yellow Caution in the coding side.

Overfull \hbox (43.00078pt too wide) in paragraph at lines 15--19

Link to Test Page: https://www.overleaf.com/read/rfpcmcsdprsf

Faheem Mitha
  • 7,778
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Nov 10 '21 at 21:28
  • Welcome to TeX.SE. did you get a chance to read the TeX.SX starter guide ? – Thruston Nov 10 '21 at 21:32
  • Sorry for the delay. Yes. I did read over it. I felt my situation and question was relevant for a post. Is there something that doesn't?

    As far as clarifying my post. I have a large amount of data I am trying to copy over from an excel spreadsheet. Is there an easier way to go about it other than \begin{tabular}?

    It would be best if I had a means to creating a table up to 128 columns in width.

    – Houshou Rattengod Nov 10 '21 at 21:41
  • 2
    I don't really think this question is answerable. if you have one data row to enter that's 32 items, if you enter them directly in latex you have to put one & between each item, that is pretty minimal overhead. Certainly less pverhead than writing the data in excel. on the other hand if you mean the data is already written in excel producing the latex is no effort at all just write it out as comma separated values from excell then one global edit to change ,to & and put \\ at the end of each lin ean dyou are done. – David Carlisle Nov 10 '21 at 21:48
  • 1
    latex can show tables with hundreds of columns (even if people can not read them). If you get errors then we can help but only if you show exactly the error that you get (copy from the log file and add to a code block in the question) and a sample document that produces the error. – David Carlisle Nov 10 '21 at 21:50
  • @DavidCarlisle Yes. The information already exists in an excel spreadsheet. That is where I did the leg-work. I am now trying to write a Proof of Concept Mathematics Tex Document and I am in need of transferring that data to the Tex Document. Up until now, I have been using the \begin{tabular} code and using the & between Columns and the \\ between rows. But because of the nature of my proof doubling in size. my next table is 32 columns in width. then 64. then 128. – Houshou Rattengod Nov 10 '21 at 21:56
  • but why is that an issue, as I say it should only be a few seconds editing and you will have a latex tabular for each table – David Carlisle Nov 10 '21 at 22:01
  • The only part of your question that is relevant here is But I am getting errors at 17 Columns. we don't need to know why you need tables, just need to know what input you made and what error you got. (You can change the data if it is sensitive). That is, you should add a complete document as in the answer I posted, but generating the error that you want to ask about. – David Carlisle Nov 10 '21 at 22:14
  • @HoushouRattengod Maybe you didn't read the comment clearly? It says "global search and replace", which takes the same amount of effort whatever the number of columns is (look at your editor documentation) – user202729 Nov 11 '21 at 01:27
  • please don't use external links, your question is archived here forever and will not make sense if you change that overleaf project. However there is no error in the project you link to just an overfull box warning telling you that your table is wider than the page. That's why I set the page in landscape with an ureadably small \tiny font in my answer. – David Carlisle Nov 11 '21 at 16:01
  • the warning is unrelated to the alignment in the table, it's simply that the table is too big to fit on the page, so you need to make the page bigger or the table smaller. It is not an error. – David Carlisle Nov 11 '21 at 16:15
  • Probably a duplicate of https://tex.stackexchange.com/questions/332902/my-table-doesnt-fit-what-are-my-options – Rmano Jul 23 '23 at 17:14

2 Answers2

2

This is a procedure that you can try with your wide tables.

I will generate a pdf file with the whole table, to share its results with others. But not for printing, which is limited by the available paper size.

1 Built the table in excel. (already done)

2 To generate the LaTeX code use the Excel2laTex add-in Excel2LaTex

3 Copy to the clipboard and paste it into a bare LaTeX document.

4 Add the package geometry and set the width and height of the page to accommodate the whole table.

5 Compile.

6 Correct the errors or make changes going back to Excel and then returning to LaTeX.

Example

Table generated in excel, 512 centered columns with a sequential series and some formatting: first 10 columns with lines, next 10 columns in bold.

Use excel2latex to generate the code.

z

Press the Copy to Clipboard button and paste it in a LaTeX simple document. Use geometry to enlarge the page to 190in.

\documentclass[landscape]{article}
\usepackage{geometry}
\geometry{paperwidth=190in,paperheight=10in,margin=2cm} % set the geometry of the pdf page

\usepackage{bigstrut} % expand the cells \begin{document}

% Table generated by Excel2LaTeX from sheet 'Sheet3' \begin{table}[htbp] \centering \caption{Add caption} \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc} \cline{1-10} 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & \textbf{11} & \textbf{12} & \textbf{13} & \textbf{14} & \textbf{15} & \textbf{16} & \textbf{17} & \textbf{18} & \textbf{19} & \textbf{20} & 21 & 22 & 23 & 24 & 25 & 26 & 27 & 28 & 29 & 30 & 31 & 32 & 33 & 34 & 35 & 36 & 37 & 38 & 39 & 40 & 41 & 42 & 43 & 44 & 45 & 46 & 47 & 48 & 49 & 50 & 51 & 52 & 53 & 54 & 55 & 56 & 57 & 58 & 59 & 60 & 61 & 62 & 63 & 64 & 65 & 66 & 67 & 68 & 69 & 70 & 71 & 72 & 73 & 74 & 75 & 76 & 77 & 78 & 79 & 80 & 81 & 82 & 83 & 84 & 85 & 86 & 87 & 88 & 89 & 90 & 91 & 92 & 93 & 94 & 95 & 96 & 97 & 98 & 99 & 100 & 101 & 102 & 103 & 104 & 105 & 106 & 107 & 108 & 109 & 110 & 111 & 112 & 113 & 114 & 115 & 116 & 117 & 118 & 119 & 120 & 121 & 122 & 123 & 124 & 125 & 126 & 127 & 128 & 129 & 130 & 131 & 132 & 133 & 134 & 135 & 136 & 137 & 138 & 139 & 140 & 141 & 142 & 143 & 144 & 145 & 146 & 147 & 148 & 149 & 150 & 151 & 152 & 153 & 154 & 155 & 156 & 157 & 158 & 159 & 160 & 161 & 162 & 163 & 164 & 165 & 166 & 167 & 168 & 169 & 170 & 171 & 172 & 173 & 174 & 175 & 176 & 177 & 178 & 179 & 180 & 181 & 182 & 183 & 184 & 185 & 186 & 187 & 188 & 189 & 190 & 191 & 192 & 193 & 194 & 195 & 196 & 197 & 198 & 199 & 200 & 201 & 202 & 203 & 204 & 205 & 206 & 207 & 208 & 209 & 210 & 211 & 212 & 213 & 214 & 215 & 216 & 217 & 218 & 219 & 220 & 221 & 222 & 223 & 224 & 225 & 226 & 227 & 228 & 229 & 230 & 231 & 232 & 233 & 234 & 235 & 236 & 237 & 238 & 239 & 240 & 241 & 242 & 243 & 244 & 245 & 246 & 247 & 248 & 249 & 250 & 251 & 252 & 253 & 254 & 255 & 256 & 257 & 258 & 259 & 260 & 261 & 262 & 263 & 264 & 265 & 266 & 267 & 268 & 269 & 270 & 271 & 272 & 273 & 274 & 275 & 276 & 277 & 278 & 279 & 280 & 281 & 282 & 283 & 284 & 285 & 286 & 287 & 288 & 289 & 290 & 291 & 292 & 293 & 294 & 295 & 296 & 297 & 298 & 299 & 300 & 301 & 302 & 303 & 304 & 305 & 306 & 307 & 308 & 309 & 310 & 311 & 312 & 313 & 314 & 315 & 316 & 317 & 318 & 319 & 320 & 321 & 322 & 323 & 324 & 325 & 326 & 327 & 328 & 329 & 330 & 331 & 332 & 333 & 334 & 335 & 336 & 337 & 338 & 339 & 340 & 341 & 342 & 343 & 344 & 345 & 346 & 347 & 348 & 349 & 350 & 351 & 352 & 353 & 354 & 355 & 356 & 357 & 358 & 359 & 360 & 361 & 362 & 363 & 364 & 365 & 366 & 367 & 368 & 369 & 370 & 371 & 372 & 373 & 374 & 375 & 376 & 377 & 378 & 379 & 380 & 381 & 382 & 383 & 384 & 385 & 386 & 387 & 388 & 389 & 390 & 391 & 392 & 393 & 394 & 395 & 396 & 397 & 398 & 399 & 400 & 401 & 402 & 403 & 404 & 405 & 406 & 407 & 408 & 409 & 410 & 411 & 412 & 413 & 414 & 415 & 416 & 417 & 418 & 419 & 420 & 421 & 422 & 423 & 424 & 425 & 426 & 427 & 428 & 429 & 430 & 431 & 432 & 433 & 434 & 435 & 436 & 437 & 438 & 439 & 440 & 441 & 442 & 443 & 444 & 445 & 446 & 447 & 448 & 449 & 450 & 451 & 452 & 453 & 454 & 455 & 456 & 457 & 458 & 459 & 460 & 461 & 462 & 463 & 464 & 465 & 466 & 467 & 468 & 469 & 470 & 471 & 472 & 473 & 474 & 475 & 476 & 477 & 478 & 479 & 480 & 481 & 482 & 483 & 484 & 485 & 486 & 487 & 488 & 489 & 490 & 491 & 492 & 493 & 494 & 495 & 496 & 497 & 498 & 499 & 500 & 501 & 502 & 503 & 504 & 505 & 506 & 507 & 508 & 509 & 510 & 511 & 512 \bigstrut\ \cline{1-10} \end{tabular}% \label{tab:addlabel}% \end{table}%

\end{document}

First part of the pdf generated.

x

Tail of the table.

y

Simon Dispa
  • 39,141
  • This appears to be what I am looking for. Is there support for this on Overleaf? – Houshou Rattengod Nov 11 '21 at 16:13
  • you don't need support on overleaf you run the convertor locally and just paste the generated table in to overleaf. It is perhaps slightly more convenient than using the default comma separate value excel output, although not very different. – David Carlisle Nov 11 '21 at 16:30
  • @Houshou Rattengod It keeps the format of the cells, multicolumn, lines, font size, etc. Do it in Overleaf or in your local machime. – Simon Dispa Nov 11 '21 at 17:01
0

You have not given any indication of the error you got or what input you wrote that produced the error. It certainly is not due to having 17 columns, this is a table with 128 columns for example. It is hard to imagine you could enter this table in a different format with less overhead, it just needs & between each item.

enter image description here

\documentclass[landscape]{article}
\usepackage[left=1cm,right=1cm]{geometry}
\usepackage{parskip}
\begin{document}

\tiny\setlength\tabcolsep{1pt} \begin{tabular}{*{128}{c}} 1&2&3&4&5&6&7&8&9&0& 1&2&3&4&5&6&7&8&9&0& 1&2&3&4&5&6&7&8&9&0& 1&2&3&4&5&6&7&8&9&0& 1&2&3&4&5&6&7&8&9&0& 1&2&3&4&5&6&7&8&9&0& 1&2&3&4&5&6&7&8&9&0& 1&2&3&4&5&6&7&8&9&0& 1&2&3&4&5&6&7&8&9&0& 1&2&3&4&5&6&7&8&9&0& 1&2&3&4&5&6&7&8&9&0& 1&2&3&4&5&6&7&8&9&0& 1&2&3&4&5&6&7&8\

a&b&c&4&5&6&7&8&9&0& a&b&c&4&5&6&7&8&9&0& a&b&c&4&5&6&7&8&9&0& a&b&c&4&5&6&7&8&9&0& a&b&c&4&5&6&7&8&9&0& a&b&c&4&5&6&7&8&9&0& a&b&c&4&5&6&7&8&9&0& a&b&c&4&5&6&7&8&9&0& a&b&c&4&5&6&7&8&9&0& a&b&c&4&5&6&7&8&9&0& a&b&c&4&5&6&7&8&9&0& a&b&c&4&5&6&7&8&9&0& a&b&c&4&5&6&7&8\ \end{tabular} \end{document}

David Carlisle
  • 757,742
  • I have updated the original post. I apologize it took so long to make the necessary edits. Things started happening at work, and before I knew it time had gotten away from me.

    I see your answer here. But I don't understand all of the in's & out's of how you did what you did.... I will try my best to reverse engineer this.

    – Houshou Rattengod Nov 11 '21 at 15:54
  • @HoushouRattengod there is no error in the link you added. I didn't do anything difficult here here I just wrote a 128 column table directly. – David Carlisle Nov 11 '21 at 16:02
  • I see a yellow caution tag on the left side next to line 15. when I hover over it it gives the text I posted above, the "Overfull" line. – Houshou Rattengod Nov 11 '21 at 16:04
  • I see you set the document to Landscape. Is there a means to adjust that for a single page, leaving the rest of the document in Portrait? Also, you did something with \tiny\setlength\tabcolsep I don't fully understand that, and what it is doing. – Houshou Rattengod Nov 11 '21 at 16:08
  • @HoushouRattengod yes errors are red an an overfull box is just telling you the table is wider than teh page, which is not a surprise – David Carlisle Nov 11 '21 at 16:10
  • @HoushouRattengod \tiny selects a very small font and \setlength\tabcolsep{1pt} sets the space around columns to 1pt, this squeeses the 128 column table so it just fits on the page, although you can only read it on screen where you can zoom in, if you printed this on paper it would be painful to read – David Carlisle Nov 11 '21 at 16:12