Text FormattingIssue with wide table

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
herenvardo
Posts: 6
Joined: Sat May 02, 2009 2:24 pm

Issue with wide table

Post by herenvardo »

I'm trying to add a relatively wide table (9 columns) to my document, but I'm facing a weird issue. After shrinking the text and spacing to the readable minimum, I have ended with a header that looks like this:

Code: Select all

\begin{tabular}[|@{}p{2cm}@{}p{0.5cm}@{}p{0.5cm}@{}p{0.5cm}@{}p{0.5cm}@{}p{0.5cm}@{}p{0.5cm}@{}p{0.5cm}@{}p{0.5cm}@{}|]
That's a total 6 cm (2cm from the first column plus 0.5x8 columns), which should fit within the text width.
For some reason I can't understand, I'm getting each row split into many rows. For example, instead that something like this:

Code: Select all

a1 a2 a3 a4
b1 b2 b3 b4
c1 c2 c3 c4 ...
I'm getting something like

Code: Select all

a1
a2
a3
a4
b1
...
I have tried putting it into a \parbox or into a \makebox 12cm wide, and still I'm getting split rows. I have googled for several hours and tried several other ways of "boxing" the table, at no avail. I'm getting desperate, and I'm considering rendering the table somewhere else (such as in a WYSIWYG text processor), taking screenshots, and building it as an image, but I'd still prefer to have the text on the final document selectable and "copy-paste-able" if possible.
Any suggestion?
(Just in case it matters, I'm using MikTex 2.7 and TeXnicCenter on WinXP SP3)

Thanks in advance for any answer.

Regards,
Herenvardo

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

php1ic
Posts: 192
Joined: Wed Jan 28, 2009 8:17 pm

Issue with wide table

Post by php1ic »

If you have pasted the header direct from you code then that could be your problem. You have used [] instead of {} when defining the column alignment. I couldn't get you header to compile, it should be

Code: Select all

\begin{tabular}{|@{}p{2cm}@{}p{0.5cm}@{}p{0.5cm}@{}p{0.5cm}@{}p{0.5cm}@{}p{0.5cm}@{}p{0.5cm}@{}p{0.5cm}@{}p{0.5cm}@{}|}
herenvardo
Posts: 6
Joined: Sat May 02, 2009 2:24 pm

Re: Issue with wide table

Post by herenvardo »

Just fixed the code, now let me bang my head against the wall while latex compiles it...

Ok, everything is rendering sanely enough. I'll do some further tweaking to get the table looking as good as possible, but first a bit more of banging my head.
:cry: Two entire days for something as silly... why doesn't it surprise me?

Thanks a lot for your help! Now that I know where did the issue came from, I realize I could have been messing with the code for weeks without even noticing.

I wonder why did my latex installation take the square brackets without a complain, but I guess that's another mystery about my laptop's setup I'll never be able to clarify ^^;

Thanks again for your help.
Regards,
Herenvardo
Post Reply