2

I've got some problems with tabularx. I need a table with 4 columns and the last one should contain a lot of text so I need it to break rows automaticly. And from my reasearch I thought that it should work like shown in my example below.

But when I render this example the row gets broken before "even more..." and the row above only shows the text until "and on and on.... the"

Does anyone know why the row gets broken "too late"?

here is my example:

\begin{table}[hb]
\begin{tabularx}{15cm}{lllX}\\
\textbf{name1}  &  \textbf{name2}   &  \textbf{name3}& \textbf{name4}   \\  \hline
1   &  & some text & a really long text for a table and it goes on and on and on.... there is some more text and even more..... \\

\end{tabularx}
\caption{table cation}
\label{tab:tablecaption}
\end{table}

Thanks for any help!

samoncode
  • 121

2 Answers2

6

Please always post complete documents not just fragments. You haven't shown your page width, but most likely it is less than your specified table width.

enter image description here

\documentclass{article}
\usepackage{tabularx}
\begin{document}
\begin{table}[hb]
\noindent X\dotfill X

\begin{tabularx}{15cm}{lllX}\\
\textbf{name1}  &  \textbf{name2}   &  \textbf{name3}& \textbf{name4}   \\  \hline
1   &  & some text & a really long text for a table and it goes on and on and on.... there is some more text and even more..... \\

\end{tabularx}


\begin{tabularx}{\textwidth}{lllX}\\
\textbf{name1}  &  \textbf{name2}   &  \textbf{name3}& \textbf{name4}   \\  \hline
1   &  & some text & a really long text for a table and it goes on and on and on.... there is some more text and even more..... \\

\end{tabularx}

\caption{table cation}
\label{tab:tablecaption}
\end{table}
\end{document}
David Carlisle
  • 757,742
  • Thank you for your help David!

    I use someone elses document with lots of packeges already in. So I tried to create a minimal working example and noticed that the problem came from the pdfsync package. I read here: http://tex.stackexchange.com/questions/70820/is-the-pdfsync-package-still-relevant that this package should be avoided so I took it out and couldn't notice any sideeffect - the tables work now like expected.

    – samoncode Jan 10 '14 at 19:31
0

The problem here was the package pdfsync.

After I removed this package the tables worked as expected! I hope this helps some people with similar problems.

And since I read here: Is the pdfsync package still relevant? that you shouldn't use pdfsync anyway this is no problem.

samoncode
  • 121
  • It would have been helpful if you had posted a full MWE (minimum working example) up front, in you should have mentioned that you were loading the pdfsync package. Without this crucial bit of information, all attempts to help solve the problem you were experiencing turned out to be a waste of time. – Mico Dec 07 '14 at 18:25