Break or wrap a continuous text in Latex

The situation is that I have a long continuous text such as “adfadfadfasldfkasldfadfklasjhdfalkdfasldfahdlfad”, and it won’t break or wrap at the end of the line. To fix the problem, we need to define a new wrapletters command as follows.

\newcommand*\wrapletters[1]{\wr@pletters#1\@nil}
\def\wr@pletters#1#2\@nil{#1\allowbreak\if&#2&\else\wr@pletters#2\@nil\fi}

Then, to wrap a long continuous text, do the following.
\wrapletters{adfadfadfasldfkasldfadfklasjhdfalkdfasldfahdlfad}

This command can be applied to writing DNAs or Protein sequences in Latex.

Credit to the original post at http://www.latex-community.org/forum/viewtopic.php?f=44&t=3798.

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

One Response to Break or wrap a continuous text in Latex

  1. Josh B. says:

    Thank you

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s