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 have a quote that displays long chains of words, such as

hippopotamus/hippo

The quote environment does not break words, so I have text exceeding the right margin of the quote. How can I obtain word breaking?

share|improve this question
5  
You should provide a MWE. I'm pretty sure that the quote-environment does hyphenation. However, the first word of a paragraph doesn't get hyphenated. If that's your problem, inserting a \hbox to 0pt{} might help. Compounds like hippotamus/hippo are quite difficult to hyphenate for TeX, as TeX doesn't know that there might be a possible linebreak after the /. You'd better write hippotamus\slash hippo. –  Michael Aug 9 '12 at 21:45
2  
You can use \slash instead of / it uses the same character, but allows a line break –  David Carlisle Aug 9 '12 at 21:47
add comment

1 Answer

up vote 6 down vote accepted

The quote environment of LaTeX does hyphenation and the same is true for the display environments provided by the csquotes package. Your problem is that TeX turns hyphenation off the moment a word contains anything other than letters. So something like explicit hyphens turn this off or \accent commands (a real problem for many languages before TeX had fonts with accented characters), etc. Given your example, anyhting after / is not hyphenated (not that "hippo" is a great thing to hyphenate --- actually TeX would anyway refuse to do that :-) )

If you use \slash instead of / hyphenation at that point is allowed, but the following word is still not hyphenated (see example). So you need to do more to get hyphenation going there, I added a command \Slash below just to do that. The trick is to have the slash followed by some space (the width of this doesn't really matter) as this makes TeX restart its hyphenation for the next word.

\documentclass[draft]{article}

\newcommand\Slash{\slash\hspace{0pt}}  % a / that allows hyphenting next word

\begin{document}

\showhyphens{hippopotamus hippo}  % to see what hyphens we can expect

\parbox{2cm}{hippo/hippopotamus}              \vspace{5pt}  % no hyphenation

\parbox{2cm}{hippo\slash hippopotamus}      \vspace{5pt}  % no hyphenation after /

\parbox{2cm}{hippo\Slash hippopotamus}                          % full hyphenation

\end{document}

I have turned "hippopotamus/hippo" to get any hyphenation. We then get:

enter image description here

share|improve this answer
    
Thank you for turning my example. A nice idea; the problem is that hippopotamus/hippo was in a quote and I cannot really change it. –  Costanza Aug 13 '12 at 8:42
1  
@Costi you can still use \slashor \Slash in the quote and you can even add an explicit hyphen in Hip\-po (as TeX doesn't find that one --- and I assume it would be correct) –  Frank Mittelbach Aug 13 '12 at 9:32
add comment

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.