7

There is one problem that currently seems insolvable to me. I am typesetting a book in Russian language and I noticed that, in some cases, an overfull box appears which cannot be solved via manual \hyphenation or \linebreak or even \emergencystretch, because an em-dash is causing it. Due to the typesetting rules, the em-dash MUST stay at the end of the line if the line is about to break at this point, which is why moving it to the beginning of the next line cannot be considered.

I tried applying microtype, but it seems not being able to condense the em-dash ONLY in case it is positioned at the end of the line AND is causing an overfull. Or to condense it at all, to be honest. If I re-define the width of the em-dash-symbol, the same problem will occur at other positions in the book.

Changing the width of the text body didn't bring the desired effect either, because same situation came up as described above.

Here comes the MWE:

\documentclass[fontsize=11pt,russian,open=any]{scrbook} 
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}
\usepackage{fancyhdr} 
\usepackage[paperwidth=14.2cm, paperheight=20.4cm, top=1cm, bottom=1.3cm, twoside, inner=1.0cm, outer=1.2cm, bindingoffset=0.5cm, footskip=0.65cm, headsep=0cm, headheight=0cm, voffset=0pt, hoffset=0pt]{geometry}
\usepackage[kerning=true, tracking=true, spacing=true, selected=true, babel=true, stretch=10, shrink=10]{microtype}

\deffootnote[1.5em]{0.5em}{0em}{
\textsuperscript{\thefootnotemark}}

\setlength{\parindent}{1.25em}
\setlength{\emergencystretch}{1pt}

\frenchspacing 
\righthyphenmin=2 

\renewcommand{\baselinestretch}{0.9}

\clubpenalty=10000 
\widowpenalty=10000
\flushbottom 

\pagestyle{fancy}
\fancyhf{}
\fancyfoot[EC,OC]{\thepage} 
\renewcommand{\headrulewidth}{0pt}

\begin{document}

Когда его вопль, отражаясь испуганной белкой от пустых котлов и голых стен, замер, завязнув в тягучей темноте, снова воцарилась тишина, нарушить которую было не в силах даже потрескивание дров в одиноком камине. Конечно, надо было бы пойти бросить в него ещё несколько поленьев, но за это время эти подонки смогут улизнуть или спрятаться получше!..

--- Да. Его так зовут. Забавно, правда? Царство Костей. Костей~--- правитель Царства Костей. 

Агафон насупился, поколебался несколько секунд между <<Именно секрет>> и <<А тебе зачем?>>, но вздохнул подавленно, махнул рукой и признался.

--- В Царство Костей,~--- с надеждой вскинул на него глаза Иван~--- уж не вспомнит ли дед ещё что-нибудь полезное?

--- Ну хорошо. А как насчёт неразговаривания с набитым ртом?~--- не сдавался Костей.

\end{document}

Oh, and I'm using TeXstudio 2.5.2.

If you take a closer look at the screenshot you'll see that sometimes even the hyphenation symbol is protruding into the margin, which also causes an overfull hbox:

enter image description here

I'd like to know how to handle these overfull boxes. Is there a way to narrow those symbols depending on their position in text or something like this?

20
  • 1
    Welcome to TeX.sx!
    – egreg
    Commented May 6, 2013 at 15:04
  • 1
    I don't get overfull boxes if I use microtype with the default settings \usepackage{microtype}. Commented May 6, 2013 at 15:08
  • 1
    I would not use longword~--- longword. I would use longword---longword or longword --- longword. Furthermore, in the first case, if you found that TeX is given problems, you can use \- for each word width problems to make it hyphenate properly, long\-word---long\-word. In the second, you can use \hyphenation{long-word} in the preamble and keep longword --- \longword in the text.
    – cacamailg
    Commented May 6, 2013 at 15:34
  • 1
    @Aaliyah: You can try to loosen the settings in the paragraphs affected. tex.ac.uk/cgi-bin/texfaq2html?label=overfull. I personally wouldn't care if there is 1pt overfull, that's so small that it isn't seen anyway. Commented May 6, 2013 at 16:22
  • 1
    @Aaliyah -- if a smaller (unbreakable) space before the em-dash is acceptable, you could use the thin space (\,) instead of ~. Commented May 6, 2013 at 18:45

1 Answer 1

5

You can make the space before and after the dash have more flexibility than a normal wrod space. The setting here leaves just one overfull box, not caused by the dash but just that TeX could not find a good place to break the line, I added one \- to add an extra hyphenation option which might not be appropriate place as I can not read the script unfortunately. It is in any case not connected with the spacing around ---

enter image description here

\documentclass[fontsize=11pt,russian,open=any]{scrbook} 
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}
\usepackage{fancyhdr} 
\usepackage[paperwidth=14.2cm, paperheight=20.4cm, top=1cm, bottom=1.3cm, twoside, inner=1.0cm, outer=1.2cm, bindingoffset=0.5cm, footskip=0.65cm, headsep=0cm, headheight=0cm, voffset=0pt, hoffset=0pt]{geometry}
\usepackage[kerning=true, tracking=true, spacing=true, selected=true, babel=true, stretch=10, shrink=10]{microtype}

\deffootnote[1.5em]{0.5em}{0em}{
\textsuperscript{\thefootnotemark}}

\setlength{\parindent}{1.25em}
\setlength{\emergencystretch}{1pt}

\frenchspacing 
\righthyphenmin=2 

\renewcommand{\baselinestretch}{0.9}

\clubpenalty=10000 
\widowpenalty=10000
\flushbottom 
\def\mydash{\ifhmode\nobreak\hspace{.33em plus .1em minus .25em}\fi---\hspace{ .33em plus .1em minus .25em}}
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[EC,OC]{\thepage} 
\renewcommand{\headrulewidth}{0pt}

\begin{document}

Когда его вопль, отражаясь испуганной белкой от пустых котлов и голых стен, замер, завязнув в тягучей темноте, снова воцарилась тишина, нарушить которую было не в силах даже потрескивание дров в одиноком камине. Конечно, надо было бы пойти бросить в него ещё несколько поленьев, но за это время эти подонки смогут улизнуть или спрятаться получше!..

\mydash Да. Его так зовут. Забавно, правда? Царство Костей. Костей\mydash правитель Царства Костей. 

Агафон насупился, поколебался несколько секунд между <<Име\-нно секрет>> и <<А тебе зачем?>>, но вздохнул подавленно, махнул рукой и признался.

\mydash В Царство Костей,\mydash с надеждой вскинул на него глаза Иван\mydash уж не вспомнит ли дед ещё что-нибудь полезное?

\mydash Ну хорошо. А как насчёт неразговаривания с набитым ртом?\mydash не сдавался Костей.

\end{document}
1
  • This is IT, thank you so much! BTW, is the "normal" space amount of 0.33em an approximation or some standard for space width? The \- you added is, unfortunately, at the spot where this word cannot be broken, but I still can insert some smaller spaces instead or normal ones along the text line, maybe this will save me the space needed to place one additional letter without Overfull.
    – Aaliyah
    Commented Jul 7, 2013 at 10:36

You must log in to answer this question.

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