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!

3
  • 3
    Sorry, I can't reproduce the problem. Could you provide a complete, minimal working example (MWE) that replicates the problem?
    – Werner
    Jan 10, 2014 at 18:05
  • Are you sure you want the table 15cm wide, it doesn't fit in a normal article class page Jan 10, 2014 at 18:42
  • @DavidCarlisle - Maybe the OP is using the geometry package with margin=1in? It sure would be nice if he/she had posted a actual MWE.
    – Mico
    Jan 10, 2014 at 18:47

2 Answers 2

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}
1
  • 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: tex.stackexchange.com/questions/70820/… 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, 2014 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.

1
  • 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 7, 2014 at 18:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .