LaTeX forum ⇒ Text Formattingword wrapping of continuous text

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Posts: 2
Joined: Sat Jan 24, 2009 1:20 am

word wrapping of continuous text

Postby Mima » Sat Jan 24, 2009 1:26 am

I have a continuous sequence of letters (no special characters or breaks) and TeX writes it over the right border of the page. How can I wrap this sequence such that line breaks are introduced where the page ends?

Thanks a lot for your help!!

Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Postby phi » Wed Feb 04, 2009 12:46 am

A crude but simple hack (that destroys ligatures and hyphenation) would be to split up the letters and allow breaking everywhere:
  1. \documentclass{article}
  2. \makeatletter
  3. \newcommand*\wrapletters[1]{\wr@pletters#1\@nil}
  4. \def\wr@pletters#1#2\@nil{#1\allowbreak\if&#2&\else\wr@pletters#2\@nil\fi}
  5. \makeatother
  6. \begin{document}
  7. \wrapletters{akjhghjerbhkjgxhdrjgkbhyxksrfihcgbwaemklcjtnhwabketrbmshrkncgaervbetjkewhbgrkjavkjdkvbkjsjkbtkgvnsetbjsrhtservjbtbjkhtvy}
  8. \end{document}

Posts: 2
Joined: Sat Jan 24, 2009 1:20 am

Postby Mima » Thu Feb 05, 2009 11:37 pm

Dear phi

Thanks a lot, that works very well! You helped me a lot.

Return to “Text Formatting”

Who is online

Users browsing this forum: No registered users and 2 guests