# How to automatically break “a long word with underscore” in a cell of table, using longtabu package?

I use longtabu package for creating tables, because the table can be very long (several pages) and i need automatic linebreak(or wordbreak) if the sentence(or a single word) in certain cell is too long.

In most cases, longtabu works well for my purpose. But, if a long word contains underscore, for example, AAA_BB_CCC_D_EEEEEE_FFF_GGGGG_HHHHHH (I replace _ as \\_ in latex), then the word can not be linebreaked and it cross out of the border of the cell to the next cell.

How can longtabu automatically break a long word with underscore? I want the very long word can automatically fit the length of a cell.

You can add some potential breaking points to the long word by adding \- (if you want a hyphen when breaking} or \allowbreak (if you don't).

Examples

\fbox{\parbox[b]{5cm}{AAA\_BB\_CCC\_D\_EEE\-EEE\_FFF\_GGGGG\_HHHHHH}}
\fbox{\parbox[b]{5cm}{AAA\_BB\_CCC\_D\_EEEEEE\allowbreak \_FFF\_GGGGG\_HHHHHH}}


resulting in

\documentclass[a4paper]{article}