Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I encountered an issue with my description environments: If I use a label that almost is as long as the text width, the explanatory text afterwards is not wrapped correctly.

I am using the mdwlist package with the description* environment, but the problem is reproducible also with the normal description environment (see example below).

Searching for similar problems did not help me so far, because most topics deal with labels that are longer than the text width, which can be treated with the \desclabelwidth command of mdwlist.

What I found so far is that there is the command \desclabelwidth to control the width of the label, and \labelsep to control the width of the separator after the label. Now I think my problem is that the text in the first line after the label is longer than \textwidth - \desclabelwith - \labelsep. Is there any way to control this width, or do you know any other way to circumvent the problem?

EDIT: I found my problem has to do with my BCOR settings - I set the value to 15mm, then the problem occurs also with short words.

Many thanks!

Here my minimal working example - the word "text" does not fit into the line and in my opinion could as well go into the next one. Instead, I get this warning:

Overfull \hbox (12.03125pt too wide) in paragraph at lines 9--10

\documentclass[BCOR=15mm]{scrbook}

\begin{document}

  \chapter{Issues with descriptions}

  \begin{description}
    \item[A normal label.] A text with short words, nicely wrapped. One two three four five six seven eight nine ten.
    \item[A very long label that is almost as long as the text width, but not quiet.] A text with short words, not so nicely wrapped. One two three four five six seven eight nine ten.
  \end{description}

\end{document}

Output of the code shown below

share|improve this question

2 Answers 2

up vote 11 down vote accepted

You've found a very unfortunate combination: there's no possibility to hyphenate "text" and breaking the line after "A" would make the line underfull.

A reason for this is that the text in the description label is typeset in a box, so it doesn't participate in the possible stretching of spaces to justify the line.

With the enumitem package we can change this behavior, by "unboxing" the label. Such an adjustment is not necessary (neither desirable) if the label is short; when it's very long it may be.

If you say

\documentclass[BCOR=15mm]{scrbook}
\usepackage{enumitem}
\begin{document}

\chapter{Issues with descriptions}

\begin{description}[style=unboxed]
\item[A normal label.] A text with short words, nicely wrapped. One two
three four five six seven eight nine ten.
\item[A very long label that is almost as long as the text width, but not quite.] A text
with short words, not so nicely wrapped. One two three four five six
seven eight nine ten.
\end{description}

\end{document}

then the label text will participate in the distribution of spaces in the line and the overfull problem will disappear.

enter image description here

share|improve this answer
    
Thank you for this suggestion! I tried to use enumitem instead of mdwlist, but this does not work because I am working with paralist, which to my best knowledge cannot be used together with enumitem. In particular, I am getting the error > Undefined control sequence \end{enumerate} whenever I am using an enumerate environment if both enumitem and paralist are loaded. This is why I was using mdwlist in the first place... –  Jenny May 14 '12 at 8:15
    
Anyhow, reading the documentation of enumitem makes me believe that maybe exchanging both mdwlist and paralist for enumitem will be worth the effort... I will give it a try. –  Jenny May 14 '12 at 8:17
    
@Jenny It's definitely better to switch: mdwlist is not maintained (last version in 1996); enumitem is more powerful than paralist and is actively maintained and developed. –  egreg May 14 '12 at 8:20
    
You're definitely right - only 15 minutes of work, and I have replaced all uses of both mdwlist and paralist with the appropriate options in enumitem. It works and looks exactly as I wanted it to (inline lists and less spacing), only without the erroneous wrapping. Thanks a lot! –  Jenny May 14 '12 at 8:42

As you mentioned, this is reproducible for the standard description environment, and happens even outside that as well. Your warning is

Overfull \hbox (9.53209pt too wide) in paragraph at lines 9--10
[]\OT1/cmr/m/n/10.95 An ex-plana-

showing that TeX is struggling to properly break the word "explanatory" at the text block boundary. It can either hyphenate it as "ex-planatory" or as "explana-tory", both of which yield inappropriate spacing for that line (measured in "badness").

A solution would be to reword that particular phrase to avoid the problematic hyphenation. It's a simple fix for a common problem.

share|improve this answer
2  
you can add a hyphenation exception: \hyphenation{ex-plan-a-tory} ... but it may not be enough. (if this word isn't in the exceptions list that i maintain, it'll be added for the next iteration.) rephrasing is almost certainly a better idea here. –  barbara beeton May 11 '12 at 15:21
2  
If you (i) add the hyphenation exception instruction \hyphenation{ex-plan-a-tory} as per Barbara Beeton's suggestion above (TeX's hyphenation algorithm doesn't find the hyphenation point after the letter "n") and (ii) load the microtype package, you'll succeed in getting a line that's only 1.25pt too wide (rather than being nearly 10pt too wide). This situation, hopefully, will be barely noticeable to your readers. –  Mico May 11 '12 at 15:40
    
Alright, thank you! I noticed it's true that in my example, the problem is the word "explanatory", which is not occurring in my real work. So I tried to reproduce the example with shorter words and found it has to do with my BCOR settings. I will edit my question and the example. –  Jenny May 14 '12 at 6:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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