2

This code won't compile:

\documentclass[12pt,a4paper]{book}

\usepackage[]{classicthesis}
\usepackage{enumitem}

\begin{document}
\begin{description}
\item[hello] Hi
\item[what] why
\end{description}
\end{document}

Here is the relevant part of the log:

! Missing number, treated as zero. } l.8 \item[hello] Hi A number should have been here; I inserted 0'. (If you can't figure out why I needed to see a number, look upweird error' in the index to The TeXbook.)

The following code instead compile without errors:

\documentclass[12pt,a4paper]{book}

\usepackage[pdfspacing]{classicthesis}
\usepackage{enumitem}

\begin{document}
\begin{description}
\item[hello] Hi
\item[what] why
\end{description}
\end{document}

Is this a classicthesis bug?

I have miktex-tex-bin 3.14159265 classicthesis 4.2 enumitem 3.5.2 koma-script 3.24

  • What does this have to do with enumitem? The .log is about a font which doesn't have smallcaps. – Bernard Sep 24 '17 at 21:24
  • That is a warning. The error is "missing number treated as zero". I have no problem with smallcaps in chapters and sections headers. So how to fix the problem other that pdfspacing option? – raffamaiden Sep 24 '17 at 21:26
  • Also it was falling back to the "normal" font, and forcing the fallback with \DeclareFontShape{TU}{pplj}{m}{sc} { <-> ssub * pplj/m/n }{} isolated the error. I am removing that part of the log – raffamaiden Sep 24 '17 at 21:37
3

Well it's not really a bug (although the code could be better) just two packages redefining the same thing (description label formatting) and tripping over each other.

classicthesis defines the description label format

% descriptionlabels
   \renewcommand{\descriptionlabel}[1]{%
   \hspace*{\labelsep}\spacedlowsmallcaps{#1}} % spacedlowsmallcaps textit textsc    

Where \spacedlowsmallcaps is from soul and is expecting a list of characters hello in your example.

But enumitem adds formatting hooks at that point (because that's what the package is designed to do) so #1 is

\enit@align {\enit@format {hello}}

so when soul tries to step through each token it sees \enit@align rather than h.

The pdfspacing option tells classicthesis to use microtype rather than soul for letterspacing, which seems a reasonable workaround in this case.

  • I always wondered why Latex does not give errors or at least warnigs in those cases, like e.g. C does when you define 2 functions with the same name. Do you ny any chance now where enumitem set the hooks? – raffamaiden Sep 24 '17 at 22:08
  • 1
    @raffamaiden is a macro processor it has almost no information about the body of a definition it's not like a compiled function compare it to the C pre-processor, not to C. – David Carlisle Sep 24 '17 at 22:15
  • 1
    @raffamaiden also in this case where would you want a warning? the description environment is already defined by the class. classicthesis redefines it (presumably you don't want to be warned) and enumitem redefines it (you presumably don't want to be warned) the fact that these two definitions cause a third package, soul, to get handed data it can't handle is just unfortunate. classicthesis could detect enumitem and use its hooks to customise the lists rather than patch them directly but you can't expect a package author to test for every other package, ctan has thousands of packages. – David Carlisle Sep 24 '17 at 22:19
  • Well something like "description environment for re-defined for the second time" would definitely be better for me than "missing number treated as zero". Thanks for the answer anyway. Do you still know where enumitem doe the hook? Just to improve my learning of the language – raffamaiden Sep 25 '17 at 7:34
  • @raffamaiden they just define different parts of latex list internals which don't then work together. Hard to answer your question about enumitem, adding hooks so that list formatting can be parameterised without needing low level patches as done by classicthesis is the whole point of the package \enit@align appears in 22 lines but here for description I suppose mostly the definition at line 1283 \def\makelabel##1... – David Carlisle Sep 25 '17 at 8:06

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.