Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I m writing one article in which i need to write a paragraph full of medical terms. How can i wrap a text in a line without using line break (or hyphen)?

Regards

share|improve this question
7  
To prevent a word from breaking you may put it in a \mbox{....}. To avoid hyphens you may also use \usepackage{hyphenat} and use \nohyphens{<text>}. To make it global use \usepackage[none]{hyphenat} –  Harish Kumar Mar 1 '13 at 2:23
1  
Another technique is to typeset the paragraph in question in \raggedright mode. This may be preferable to maintaining full justification. The latter is likely to produce some lines with huge inter-word gaps when hyphenation is turned off. –  Mico Mar 1 '13 at 3:17
2  
This may or may not be what the OP is asking, but one question is how to line-break a word without the hyphen character, i.e. hyphenation without a hyphen. If this is not what the OP means, it might be useful to change the title from "wrap a word" to something like "wrap text" to prevent a misreading. –  Lover of Structure Mar 1 '13 at 3:48
2  
related question? –  Marc van Dongen Mar 1 '13 at 6:31
1  
Maybe this is what you want: Wrapping long lines that contain no spaces. –  Hendrik Vogt Mar 1 '13 at 11:54

3 Answers 3

up vote 4 down vote accepted

You can break a word with no hyphen at the end of the line (see the other answers), but then it doesn't look like a broken word. It might be a good idea to use some other symbol there instead of the hyphen, for instance $\bm\cdot$ (with \usepackage{bm}). This can be done by defining:

\newcommand{\+}{\discretionary{\mbox{${\bm\cdot}\mkern-1mu$}}{}{}}

I strongly recommend using the package microtype too, which helps a lot here. I added a small negative \mkern after the dot, to make it protrude a bit to the right margin.

\documentclass{article}

\usepackage{bm}
\newcommand{\+}{\discretionary{\mbox{${\bm\cdot}\mkern-1mu$}}{}{}}
\usepackage{microtype}

\begin{document}

\hsize 4.75cm

x\hfill x

This is my\-very\-long\-word\-that\-I\-want\-to\-break\-at\-any\-of\-these\-given\-points

This is my\+very\+long\+word\+that\+I\+want\+to\+break\+at\+any\+of\+these\+given\+points

\renewcommand\+{\discretionary{}{}{}}

This is my\+very\+long\+word\+that\+I\+want\+to\+break\+at\+any\+of\+these\+given\+points

\end{document}
share|improve this answer
    
Is there any way to add spaces within text instead of using hyphen for line breaking. –  user15662 Mar 13 '13 at 3:25
    
@user15662 Sorry, but I got completely lost and I don't understand what you want. –  tohecz Mar 13 '13 at 13:16

If you want to split a word but don't want a hyphen to be used where the split happens, you can define a new hyphenation style:

\def\+{\discretionary{}{}{}}

Now you can use it as in a\+very\+long\+word. However, this still requires to place this new non-hyphen manually.

From the TeXBook:

A discretionary break consists of three sequences of characters called the pre- break, post-break, and no-break texts. The idea is that if a line break occurs here, the pre-break text will appear at the end of the current line and the post-break text will occur at the beginning of the next line; but if no break occurs, the no-break text will appear in the current line. Users can specify discretionary breaks in complete generality by writing

\discretionary{⟨pre-break text⟩}{⟨post-break text⟩}{⟨no-break text⟩}

where the three texts consist entirely of characters, boxes, and kerns. For example, TEX can hyphenate the word ‘difficult’ between the f’s, even though this requires breaking the ‘ffi’ ligature into ‘f-’ followed by an ‘fi’ ligature, if the horizontal list contains di\discretionary{f-}{fi}{ffi}cult.

share|improve this answer
    
When using the babel package, the same effect (text breaking without hyphen) is accomplished with the notation "". –  mpy Mar 2 '13 at 14:00

You can use

\usepackage{seqsplit}

and then use

\seqsplit{ATGTCCACTGATAAAAGTACACGCTATAATTTTCAGATTGAGAAAGCCCC
CTCGTTGGCGTACGCTGCAGGTCGAC}

this can be used for displaying DNA sequences, but probably does an alright job in your case as well

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.