My first question here, so it may sound rambling. So far I've found the answers about preventing hyphenation across lines and for setting margins, but I'm having trouble putting it together.

This is for my dissertation which has strict formatting requirements and which is otherwise finished. A committee member told me to stop the words from splitting across the lines with the automatically-inserted hyphens, but when I use the commands to prevent it, the words often cross the 1-inch right margin. I have the file set as ragged right (which is also required in my formatting). I used a template (designated as the document class) that already had the margins and most other formatting set appropriately for my university's requirements. Unfortunately since I didn't create that file, I'm not sure what other settings have been changed from the default. Before I tried changing the hyphenation, the margins seemed perfect. But when I try preventing the hyphenation (which technically worked), this problem with the margins arose. The document is very long and going through to discover every problematic word is not feasible.

I believe this is the line in the master template .dtx file that sets the margins, which I have not changed.


In my own preamble, I use a bunch of packages, including ragged2e, and in certain places include the \raggedright command where needed. (I'm including my complete list in case a conflict between them is the issue.) I'm currently setting the \righthyphenmin command =8 because that seems to be the smallest number that produces conservative hyphenation.


The template also includes these packages with the following settings, which I have not changed.

\newlength{\codeSkip} \setlength{\codeSkip}{2ex}

I have tried so many of the suggested answers and each of them produce some problem. I am not totally sure about how the template is working in conjunction with the files I've created or edited, which complicates my ability to apply the existing answers successfully. Thanks for your help.

  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.
    – Ruben
    Commented Aug 4, 2015 at 20:16
  • 2
    Try using \sloppy in the preamble. It changes the parameters of the paragraph optimization which will allow larger inter-word spaces, but produce less/eliminate overfull lines. Commented Aug 4, 2015 at 20:28
  • 3
    a different method for absolutely suppressing hyphenation is to set \hyphenpenalty=10000 \exhyphenpenalty=10000. the first suppresses ordinary hyphenation, and the second prohibits line breaks at explicit hyphens. if un-hyphenated words now extend out into the margins, you probably need to increase the "tolerance" and allow more stretch between words; \tolerance=1000 \emergencystretch=2em should help with that. (this is stricter than latex's \sloppy setting, so should be a little tidier while still allowing additional flexibility.) Commented Aug 4, 2015 at 20:28
  • I'm quite surprised about the loading of ltxdoc, which is very strange for a dissertation. Of course I'm surprised also about not allowing hyphenation: it has been a common practice in typography for some centuries in order to avoid bad lines, particularly for languages with long words. A dissertation, even in English, often uses long words. Probably the committee member is afraid that wrong hyphenation is used; this is quite rare for TeX: what language is your dissertation in?
    – egreg
    Commented Aug 4, 2015 at 21:59
  • 1
    @Carina The only sensible way to avoid hyphenation is typesetting ragged right.
    – egreg
    Commented Aug 5, 2015 at 10:52

1 Answer 1


hyphenation can be suppressed more directly by setting \hyphenpenalty=10000 to suppress ordinary hyphenation, and \exhyphenpenalty=10000 to prohibit line breaks at explicit hyphens.

if un-hyphenated words now extend out into the margins, you probably need to increase the "tolerance" and allow more stretch between words; \tolerance=1000 \emergencystretch=2em should help with that.

the result will still be ragged right, but less so than what results from latex's \sloppy setting. varying the values of these four parameters after viewing the output can allow quite a bit of flexibility in order to achieve an optimally pleasing result.

in a comment, the original poster reported that these values were chosen after experimentation as yielding the most satisfying result:

  • Yes, thank you for writing the final answer. To clarify for future users, \raggedright was already employed before I asked this question. The question was about modifying the standard ragged right settings to hyphenate words less frequently with more conservative settings. I am using package {ragged2e}.
    – Carina
    Commented Aug 7, 2015 at 19:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .