I am trying to break a very very long number, 128 in length, to fit into a table cell so it won't go over the page.
I've looked up methods using longtabu
, tabular with p{5cm}
commend, \makecell
, \parbox{}
, \multicolumn
with p{5cm}
, but non of those works. It seems like they only line break at "space" but does not line break one whole word, in my case is number.
I know it is possible to manually break line with \\
or \newline
, but this doesn't seem practical in the long-run as I need to manually change this as the format of my document may change depending on the requirements given to me.
The only way I have in mind now, is to screenshot the long numbers into a figure, and insert it into the table. But if there is a better solution, I would like to use it.
Code that I use to longtabu
attempt
\begin{longtabu} to \textwidth {
|X[1,c]
|X[10,l]|}
\hline
\textbf{Head 1} &
\textbf{Head 2}
\\ \hline
12:18:52 & this is a description for the event \\\hline
12:18:52 & this is a description for the event \\\hline
12:18:52 & this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event this is a description for the event \\\hline
12:18:52 & 11111111111111111111111111111111111111222222222222222222222222222222222222222223333333333333333333333333333333333344444444444444444444455555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888\\\hline
\end{longtabu}
Using p{}
\begin{tabular}{|p{1cm}|p{5cm}|}
This text will be wrapped & Some more text \\\hline
this & 11111111111111111111111111111111111111222222222222222222222222222222222222222223333333333333333333333333333333333344444444444444444444455555555555555555555555555555555666666666666666666666666666777777777777777777777778888888888888888\\\hline
\end{tabular}
Herbert solution at Break long word in tabular