Is it possible to break long words (note, not lines) in table cell without adding \- or \allowbreak?

Current code is:

Name & Name & Name & Name & Name & Name \\
 & & & & & \\

How to allow long word breaking in, for example, first cell? In case, when word does not have white spaces? Position of line break is not important, let text just fill the cell and break if necessary.

  • You can add >{\raggedright}p{3.5cm} so that line breaking in narrow columns is more reasonable, but it will break at white space, not add additional hyphenation points to words – David Carlisle Feb 4 '15 at 10:01
  • yeah David, i need a solution to break when there are no white-spaces. I will edit question to bold it. – marxin Feb 4 '15 at 10:05
  • You are making TeX do a lot of work to find the width of that middle column using tabularx, you could just use tabular and tell it the answer p{\dimexpr\textwidth-17cm-7\arrayrulewidth-12\tabcolsep} (how big is your paper, that's negative in most classes:-) – David Carlisle Feb 4 '15 at 10:07
  • There are answers to show how to break strings at an arbitrary character I'll see if I can spot the duplicate question – David Carlisle Feb 4 '15 at 10:08
  • See for example this for breaking at CamelCase, it could be adapted to allow breaking at other, or every, letter tex.stackexchange.com/questions/66593/… – David Carlisle Feb 4 '15 at 10:24

I know it's late for this particular question, but I had the exactly same necessity as the op and found a way to solve it. I share the solution so that it can be helpful for other people having the same problem.

Very simply, the seqsplit package offers the \seqsplit{} command, that allows for breaking of long words at any position where Tex would like to (e.g. at the end of a table).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.