TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Trying to wrap text using longtable combined with seqsplit but it won't format correctly for something like thisisareallylongexamplethisisareallylongexamplethisisareallylongexamplethisisareallylongexample with a space because seqsplit removes all spaces



\begin{longtable}{p{50pt} p{360pt} p{50pt}}

& \seqsplit{thisisareallylongexamplethisisareallylongexamplethisisareallylongexamplethisisareallylongexample with a space} & test \\


share|improve this question
Howsabout adding a backslash before seqsplit? – Marc van Dongen Feb 21 '12 at 19:45
sorry, that was just a typo. seqsplit removes spaces so i assume i need to use a different package – Joel Feb 21 '12 at 19:53
I don't know the seqsplit package, but the way you use it with non-existing very long strings of letters, how is it supposed to work in combination with LaTeX's hyphenation algorithm. – Marc van Dongen Feb 21 '12 at 19:58
If you use control spaces \ or ties ~, they're not removed. Does this solve your problem? – Werner Feb 21 '12 at 20:03
up vote 2 down vote accepted

To preserve the spaces, use a control space \ or a tie ~ between the words:

enter image description here

\usepackage[left=65pt,top=28pt,right=65pt,bottom=65pt]{geometry}% http://ctan.org/pkg/geometry
\usepackage{longtable}% http://ctan.org/pkg/longtable
\usepackage{seqsplit}% http://ctan.org/pkg/seqsplit
\begin{longtable}{p{50pt} p{360pt} p{50pt}}
  & \seqsplit{thisisareallylongexamplethisisareallylongexamplethisisareallylongexamplethisisareallylongexample with a space} & test1 \\
  & \seqsplit{thisisareallylongexamplethisisareallylongexamplethisisareallylongexamplethisisareallylongexample\ with\ a\ space} & test2 \\
  & \seqsplit{thisisareallylongexamplethisisareallylongexamplethisisareallylongexamplethisisareallylongexample~with~a~space} & test3 \\

The first row shows the original, the second uses a control space \ while the third row uses a tie ~ to preserve the spacing.

share|improve this answer
Awesome thanks, it was a little tricky because it's being generated through php but $string = str_replace(" ","~",$string), did the trick – Joel Feb 21 '12 at 20:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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