Hello,
I've got a problem writing a thesis in Latex
I have to show a text message sent through the Internet. The message has no spaces. Say it is "THIS_IS_A_VERY_LONG_MESSAGE_WITHOUT_SPACES_THAT_CAUSED_ME_A_LOT_OF_PROBLEMS"
The message is shown in Typewrites (with the \texttt{text} command) and is contained in a parbox.
By default, \texttt disables the hyphenation, so most of the longest lines go beyond the page border. I tried adding \hyphenchar\font45\relax before the text. This re-enables the hyphenation (and words are split by the '-' char). But this did not solve my problem, since big words with no spaces does not get split.
I'd like to find a way to make the message splittable at any character, so that the long strings would be printed in a line until the space ends, and then just continue on the next line, splitting the string in a random point when the space ends.
Do you think it's possible? (Sure it is!)
(A possible workaround would be to put \hyphenchar\font45\relax and put a \- after every character, so that strings could split anywhere, and write something like "T\-H\-I\-S\-_\-I\-S\-_\-A\-_...", but i'm sure there's a better way!)
Thanks!
Text Formatting ⇒ String splitting at the end of the line
NEW: TikZ book now 40% off at Amazon.com for a short time.
String splitting at the end of the line
Hi,
the first idea that comes to my mind is to use the \url command provided by the url package:
The package documentation can be found at the end of url.sty file.
the first idea that comes to my mind is to use the \url command provided by the url package:
url documentation wrote: % Changing linebreaks:
% The list of characters that allow line-breaks is given by "\UrlBreaks"
% and "\UrlBigBreaks", which have the format "\do\c" for character "c"...
The package documentation can be found at the end of url.sty file.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
String splitting at the end of the line
Thanks for your reply. Unfortunately, the \url command did not solve my problem, since urls are not line-broken by default. You can set the list of characters where to brake but, in my case, I have to brake at any character, so I would need something like \UrlBreaks{abcdefg...}. Of course I will use this way if i won't be able to find a better onegmedina wrote: the first idea that comes to my mind is to use the \url command

Re: String splitting at the end of the line
Hello,
have a look at the listings package. It provides an option to do line breaks.
have a look at the listings package. It provides an option to do line breaks.
String splitting at the end of the line
Neither this solved my problem. If I set lstset{breaklines=true}, the lines get broken but only at some special charachers (=, -, whitespace, ...) still making the lines longer than the page.phi wrote:have a look at the listings package. It provides an option to do line breaks.