Graphics, Figures & TablesTrouble with table environments

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
dannyjor
Posts: 10
Joined: Sun Feb 08, 2009 7:08 pm

Trouble with table environments

Post by dannyjor »

Hi all

I have a problem with the table environment in LaTeX.

If I create a relative large table and then compile the document,
the table exceeds the sides of my paper. The right side of the table is not
visible simply because it is beyond the boundary of the paper.
Why cant TexnicCenter "fit" the table to the selected papersize?
Is there a fancy package that can solve the 'fitting' problem?

At present I fix the problem simply by cutting the lenghts of my
table entries. But this strikes me as a stupid solution. :)

Danny
Attachments
preamble.tex
My preamble. Dont know if it is needed..
(12.14 KiB) Downloaded 279 times

Recommended reading 2024:

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

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

fatra2
Posts: 126
Joined: Fri May 01, 2009 1:43 pm

Re: Trouble with table environments

Post by fatra2 »

Hi there,

Could you give a bit more information on the table declaration. I suspect that you use something like t or r as table column. You might want to try using p{column width} instead. This should fix your problem.

Cheers
dannyjor
Posts: 10
Joined: Sun Feb 08, 2009 7:08 pm

Trouble with table environments

Post by dannyjor »

Well, usually i just code something like:

Code: Select all

\begin{table}[H]
	\centering
		\begin{tabular}{|l|r|r|r|r|l|p{0.4\textwidth}|}
			
		\end{tabular}
	\caption{TESTING}
	\label{tab:TESTING}
\end{table}
Is it perhaps the the capitol letter "H" thats causing the problem?

Cheers
fatra2
Posts: 126
Joined: Fri May 01, 2009 1:43 pm

Re: Trouble with table environments

Post by fatra2 »

Hi there,

I don't believe so, eventhough I believe it is not necessary. If you want to force your table to be here, you just need to add [h!].

Your problem comes from the \begin{tabular}{|l|r|r|r|r|l|. This command says to the compiler to make columns as wide a necessary to have the whole line without break. Either, you insert line breaks manually, or you use the p{0.2\textwidth}

Cheers
User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

Trouble with table environments

Post by Stefan Kottwitz »

Hi Danny,
dannyjor wrote: Why cant TexnicCenter "fit" the table to the selected papersize?
Is there a fancy package that can solve the 'fitting' problem?
you could use the tabularx package.

Stefan
LaTeX.org admin
dannyjor
Posts: 10
Joined: Sun Feb 08, 2009 7:08 pm

Re: Trouble with table environments

Post by dannyjor »

Thanks :)

Both hints works smoothly.

/Danny
Post Reply