5

In my text I am using lots of dates. Now I have the following problem: 1480–1541 (two figures and between them a dash) appears at the end of one line and extends over the line into the margin space without being properly broken into the next line. I guess this is caused by the dash. Something like 1480–\-1541 does not work, since it adds an extra hyphen. So, how I can achieve the proper result:

... ... ... 1480–
1541?
3
  • 1
    You don't want to split an en-dash into two halves, do you? Overfull lines happen, the better way to handle them is often to rewrite the passage. But leave this for the final revision. In some cases \linebreak[2] (or in absolute emergency \linebreak) can solve the problem.
    – egreg
    Jan 21, 2012 at 22:19
  • Is it a typographical thing not to do it?
    – Moked
    Jan 21, 2012 at 22:27
  • It can be done, but I would prefer either not splitting it at all or simply breaking at the dash.
    – egreg
    Jan 21, 2012 at 22:30

2 Answers 2

4

Sebastian,

I believe what you want for this is \emergencystretch, for example \emergencystretch=3em. This allows TeX a bit more flexibility when it applies its line-breaking algorithm.

Here is a simple example, followed by a picture. Try it out with different values between 0em (the LaTeX default) and 5em and let us know if that works for you.

 \documentclass{article}
 \usepackage{amsmath}
 \setlength{\topmargin}{-1.3in}
 \setlength{\textheight}{11in}
 \begin{document}

 \newcommand{\composers}{\noindent
 A short list of famous composers includes Bach (1685--1750),
 Beethoven (1770--1827), Brahms (1833--1897), Chopin (1810--1849),
 Elgar (1857--1934), Handel (1685--1759), Haydn (1732--1809),
 Holst (1874--1934), Gustav (1860--1911), Mendelssohn (1809--1847),
 Mozart (1756--1791), Scarlatti (1685--1757), Schubert (1797--1828),
 Schumann (1810--1856), Shostakovich (1906--1975), Sibelius (1865--1957),
 Tchaikovsky (1840--1893), and Vivaldi (1678--1741).\par}

 \emergencystretch=3em
 \composers\narrower\composers\narrower\composers\narrower\composers
 \narrower\composers\narrower\composers\narrower\composers

 \end{document}

And here's how that looks — no more overfull or underfull boxes. :)    It's not perfect, but it may just do the trick for the text you are typesetting. How wide/narrow are your margins? This sample output below progresses through several narrowings:

4

You can try \nobreakdash before the hyphen to stop it from breaking at end of line. So your example will be

1480\nobreakdash-1541
1
  • 2
    \nobreakdash is in package amsmath. Jan 22, 2012 at 10:04

You must log in to answer this question.

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