# How to add linebreaks automatically? [duplicate]

I want to have latex automatically add line breaks to long sequences of characters that do not contain spaces. For instance:

...................................................................................................................................................................................

into

 ................................... ................................... ................................... ................................... ................................... ..... 

I also need to be able to manipulate the color of some of the periods using \textcolor{red}{.}, for instance. I am aware of the seqsplit package but can't seem to change fonts, sizes, colors of the text within it.

## marked as duplicate by Mico, Schweinebacke, gernot, Maarten Dhondt, egreg line-breaking StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Mar 6 '17 at 9:05

• Welcome to TeX.SE! Your question is not very clear. Please ilustrate it with small, complete document with \documentclass{...} on the begin and \end{document} on the end, which will demonstrate your problem. In normal circumstance LaTeX break lines to the specified text width. – Zarko Mar 6 '17 at 1:56
• With respect to the 'linebreaks', are you looking for things like \parbox or the minipage environment? These are covered in introductory materials. Or, does your reference to the seqsplit package mean those dots are all characters of one long 'word'? I think more information is needed at this point.... – jon Mar 6 '17 at 4:01

All you need will be satisfied with seqsplit and minipage or parbox. see the code below.

\documentclass{article}
\usepackage{seqsplit}
\usepackage{color}
\begin{document}

\begin{minipage}{.7\textwidth}
\seqsplit{%
agtcctttggggatctgtccactcctgatgctgttatgggcaaccctaaggtgaaggctc%
atggcaagaaagtgctcggt{\textcolor{red}{\LARGE g}}cctttagtgatggcctggctcacctggacaacctcaagg%
gcacctttgccacactgagtgagctgcactgtgacaagctgcacgtggatcctgagaact%
taataaaaaacatttattttcattgc}
\end{minipage}

\end{document}


If you want to automatically add line breaks in a section, you can change the line width by using \parbox{<linewidth>}{<content>}. If you want to change the color of some of the periods you just have to use what you've figured out for that.