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.
\RequirePackage[letterpaper,margin=1in,includehead,nofoot]{geometry}
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.
\documentclass[print]{nuthesis}
\usepackage{indentfirst}
\usepackage{titlesec}
\usepackage{lipsum}
\usepackage{url}
\usepackage{ctable}
\usepackage{multirow}
\usepackage[singlelinecheck=off]{caption}
\usepackage{chngcntr}
\usepackage{graphicx}
\usepackage{placeins}
\usepackage{graphicx}
\usepackage{color}
\usepackage{multirow}
\usepackage{caption}
\usepackage{ragged2e}
\graphicspath{{./figuresfolder/}}
\definecolor{gray}{gray}{0.65}
\righthyphenmin=8
The template also includes these packages with the following settings, which I have not changed.
\documentclass{ltxdoc}
\usepackage{url}
\usepackage{booktabs}
\usepackage{fancyvrb}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\newcommand{\pkg}[1]{\textsf{#1}}
\setlength{\parskip}{.5\baselineskip}
\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.
\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. – Steven B. Segletes Aug 4 '15 at 20:28\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.) – barbara beeton Aug 4 '15 at 20:28ltxdoc
, 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 Aug 4 '15 at 21:59