# Wrap word in table cell

I have such table:

\begin{tabularx}{\textwidth}{ |p{0.5cm}|X|p{1cm}|p{0.8cm}|p{1.1cm}|p{0.9cm}|p{0.9cm}|p{1.2cm}|p{0.9cm}|p{0.9cm}|p{1.5cm}| }
\hline
No. & Compound & Storage place & Shelf & Number & Calc mol & Cacl wt & Calc amount & Real mol & Real wt & Real amount \\
\hline
1 & lasdsdasdasdasdasddasdllasfsdjfsd & Lab1 & 2 & 355235 & 85.000 & 92.006 & 1.33620 & 85.000 & 92.006 & 1.33620 g \\
\hline
\end{tabularx}


How to wrap long word in second column? I would like to have table where text never ever overflow.

What I have now is:

What I would like to have:

Note: I'm using xelatex as compiler, I dont know if it makes difference.

• First your table is too wide to fit in. Second, you may use \hspace{0pt} lasdsdasdasdasdasddasdllasfsdjfsd so that the long word is hyphenated. TeX doesn't hyphenate the first word. When you add \hspace{0pt}, you trick TeX to treat the long word as not the first word. – user11232 Aug 28 '14 at 9:53
• @HarishKumar - I doubt that there are any hyphenation rules that provide sensible guidance regarding the hyphenation of the remarkable string "lasdsdasdasdasdasddasdllasfsdjfsd"... – Mico Aug 28 '14 at 9:58
• @Mico TeX hypheantes "lasdsdasdasdasdasddasdllasfsdjfsd" but, no rules followed ;-) – user11232 Aug 28 '14 at 10:01
• @HarishKumar - great, works as intended. Please post your answer so I can accept it. – marxin Aug 28 '14 at 10:14

TeX doesn't hyphenate the first word. You can add \hspace{0pt}, and trick TeX to treat the long word as not the first word. Using \hspace{0pt} lasdsdasdasdasdasddasdllasfsdjfsd should do the job in the present case.
You may prefer to put it in the column definition itself like >{\hspace{0pt}}X thereby avoiding its specification in (each) cell.
• >{\hspace{0pt}}X for the second column should avoid the need of specifying it explicitly in the cell. – egreg Aug 28 '14 at 10:57