# Wrap text with both spaces and no spaces

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

\documentclass[pdftex]{report}
\usepackage[left=65pt,top=28pt,right=65pt,bottom=65pt]{geometry}
\usepackage{longtable}
\usepackage{seqsplit}

\begin{document}

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

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

\end{longtable}

\end{document}

-
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

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

\documentclass{report}
\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{document}
\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 \\
\end{longtable}
\end{document}


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

-
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