0

I have the following issue with a hyphen going into the margin:

output

As you can see, the Spatio-Temporal word has crossed the margin. How can I fix it in LaTeX? I am using the TeX template at www.biostat.umn.edu/~brad/8400/HQuick_cv.tex.

  • 2
    You can use a local hyphenation suggestion: Spatio-Tem\-poral where \- denotes the hyphenation points. See LaTeX not hyphenating properly, text running off page. – Werner Feb 4 '14 at 0:15
  • 2
    by default latex doesn't hyphenate explicitly hyphenated words (but the referenced file does not have the phrase you show in the image) babel gives a "- shortkut to a hyphen that does allow the word to be further hyphenated (or use -\hspace{0pt}Temporal – David Carlisle Feb 4 '14 at 0:19
2

With babel, some languages:

Spatio"=Temporal

With babel, some other languages:

Spatio"-Temporal

with babel 3.9+:

Spatio\babelhyphen{hard}Temporal

with hyphenat:

Spatio\hyp{}Temporal

otherwise:

Spatio-\hspace{0pt}Temporal

Overview of hyphens and hyphenation points

These always show a (hard) hyphen:

  • - restrict to these hyphenation points (U+002D / U+2010)
    • \babelhyphen*{hard}
  • "= allows other hyphenation points
    • \babelhyphen{hard}
    • \nobreak\-\nobreak\hskip\z@skip
    • \hyp{} from the hyphenat package: \leavevmode\nobreak\hskip\z@skip-\discretionary{}{}{}\nobreak\hskip\z@skip
  • "~ not a valid hyphenation point, usually at the beginning or end of a word (NBHY U+2011)
    • \babelhyphen*{nobreak}, possibly \babelhyphen{nobreak} (-suffix) or \babelhyphen{hard} (prefix-)
    • \leavevmode\hbox{-}

These only show a (soft) hyphen at the end of a line:

  • \- restrict to these hyphenation points (~ SHY U+00AD), but \IUPAC
    • \babelhyphen*{soft}
  • "- allows other hyphenation points (~ SHY U+00AD)
    • \babelhyphen{soft}
    • \penalty\@M-\hskip\z@skip
    • -\hspace{0pt}
  • "| suppresses ligation (ZWNJ U+200C)
    • \babelhyphen{}
    • \penalty\@M\discretionary{-}{}{\kern.03em}\allowhyphens
    • \/

This never shows a hyphen:

  • "" usually in combination with another hyphen (ZWSP U+200B)
    • \babelhyphen{empty}
    • \hskip\z@skip

(Note: \@M = 10000, z@skip = 0pt plus 0pt minus 0pt; some macros have been expanded)

Using shorthands in English

The ones beginning with " are available in german variants of the babel package by default, other ldf files may deviate, e.g. "- may be a hard hyphen elsewhere. They can be enabled for English like this:

\usepackage[ngerman,english]{babel}
\useshorthands{"}
\addto\extrasenglish{\languageshorthands{ngerman}}

Since babel version 3.9 you can also do:

\usepackage[english]{babel}
\useshorthands*{"}
\defineshorthand{"-}{\babelhyphen{hard}}
  • I'm confused by the use of \nobreak\-\nobreak\hskip\z@skip, could you explain why we need a glue after the penalty \nobreak? – Tuff Contender Jan 25 '17 at 8:43
  • @TuffContender I don’t remember where that code came from, it’s probably Babel’s \babelhyphen{hard} (as it was 2 years ago). – Crissov Jan 25 '17 at 15:00
  • Thank you for response, and I just found the answer in TeXbook that TeX only starts hyphenation with word immediately following a glue. – Tuff Contender Feb 3 '17 at 3:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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