From: leichter@zodiac.rutgers.edu
Newsgroups: comp.text.tex
Subject: Re: Two LateX hyphenation questions
Date: 1 Jan 93 22:23:55 GMT
Organization: Rutgers University Department of Computer Science

In article <1992Dec30.195318.5975@gallant.apple.com>, rose@gallant.apple.com
(Dan Rose) writes:
| I have two hyphenation problems in LaTeX.
| 
| First, I have a long section heading that requires two lines to print.
| I'd like it to print like this:
| 
| 	3.4 Foobar foobar foobar foobar
| 	    foobar
| 
| but LaTeX insists on doing this:
| 
| 	3.4 Foobar foobar foobar foobar foo-
| 	    bar
| 
| Does anyone know how to *prevent* a word from being hyphenated just once?

If you put the word in an \mbox; it cannot be hyphenated.

| (Alternatively, is there a way to force a line break in a section heading?
| This wouldn't be as elegant a solution, but I'll take it.)

You should be able to use \\ in a section name - use the optional argument
to provide the section name WITHOUT \\ for use in the table of contents.

Neither of these solutions is really very good.  The first will almost
certainly result in either an overful or an underful hbox.  The second will,
too, unless you fill the line (\hfil\\).

On a deeper level, these solutions are unsatisfactory because they are
specifying style (formatting) information within the text.  The standard
LaTeX styles have chosen to define section heads and such as justified to
the full width of the text.  This will often require hyphenation.

Personally, I conside this the single poorest typographical decision in all
of the LaTeX styles.  My references all say that headings should typically
be narrower than the text - the usual rule of thumb is 2/3rd's the text width.
Headings are also rarely set justified.  None of this is likely to be an issue
for single-column typsetting - do you really WANT section headings that long -
but for multi-column texts, it's a significant issue.  (For multicolumn texts,
you want to make sure that the following can't happen:

	BOLD HEADING ANOTHER BOLD HEADING
	CONTINUED
	text	     text

since the inter-column space is typically small enough that if headings come
that close, the eye will track across the columns.)

One of my co-authors has a penchant for long section headings.  Rather than
either try to change his style, or put up with ugly hyphenated words in
headings, I came up with the following modifications (which should got in a
style file):

%
% Re-define section commands to set text ragged right.  Also, distinguish
% between \paragraph and \subparagraph with different section level numbers.
% Note:  We can't use \raggedright to make things ragged right because it
% sets \parskip to 0, in addition to doing other things that are unnecessary.
% For us, the \parskip change is bad because it screws up the indentation for
% \subparagraph.
\def\@rgd{\@rightskip\@flushglue\rightskip\@rightskip\leftskip\z@}
\def\section{\@startsection {section}{1}{\z@}{-3.5ex plus -1ex minus
    -.2ex}{2.3ex plus .2ex}{\Large\bf\@rgd}}
\def\subsection{\@startsection{subsection}{2}{\z@}{-3.25ex plus -1ex minus
   -.2ex}{1.5ex plus .2ex}{\large\bf\@rgd}}
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-3.25ex plus
-1ex minus -.2ex}{1.5ex plus .2ex}{\normalsize\bf\@rgd}}
\def\paragraph{\@startsection
     {paragraph}{4}{\z@}{3.25ex plus 1ex minus .2ex}{-1em}%
     {\normalsize\bf\@rgd}}
\def\subparagraph{\@startsection
     {subparagraph}{5}{\parindent}{3.25ex plus 1ex minus
     .2ex}{-1em}{\normalsize\bf\@rgd}}

The constants used are from art10, but they happen to be the same for all the
article sizes; I don't know about the other styles.

I *think* the change that's part of the paragraph/subparagraph business is in
the second argument to \@startsection for \subparagraph, which is 4 in the
original.  (In addition to liking long section titles, my co-author also likes
deeper nesting.)

Looking at this now, since paragraph and subparagraph are run-in, they
probably should NOT be ragged right.  I guess this never came up in our
papers....

| 
| Second, I have a block of text displayed in tt font.  (Before anyone flames
| me for that, it's supposed to represent text a user would see on an ASCII
| terminal.)  LaTeX normally won't hyphenate tt text.  Is there a way to
| override this?

The tt font normally has its hyphenchar set to -1, preventing any hyphenation.
You can change this, but be aware that a change to the hyphenchar is global
in effect - it is not restricted by grouping.  The easiest way to do it is:
{\tt\hyphenchar\the\font=45}.  From there on, all material set in \tt at the
current size will be hyphenatable.  (45 is the code for "-" in ASCII.) To turn
it off, just execute the same code with -1 in place of 45.

							-- Jerry