Problem with recent babel package and language "spanish"
KOMA-Script is a bundle of versatile LaTeX classes and packages
Brought to you by:
kohm
The recent update of KOMA-Script seems to have a problem with option spanish from babel (v25.17). The error is LaTeX hooks Error: Generic hooks cannot be added to '\@startsection'. Changing to another language or switching to standard book class resolves the problem.
\documentclass{scrbook}
\usepackage[spanish]{babel}
\begin{document}
Test
\end{document}
You get the same error with:
So IMHO this is a
babel-spanishissue not a KOMA-Script issue.BTW: KOMA-Script does not use
\@startsectionanymore and the new version does no longer redefine it but only adds a hook to warn that several features are no longer available, when using\@startsection. See also [wiki-en:Release 3.49] resp. [wiki-de:Release 3.49].Related
Wiki (Deutsch): Release 3.49
Wiki (English): Release 3.49
Last edit: Markus Kohm 2025-12-22
In some sense it is a KOMA issue, as KOMA is the one doing the patching. Command hooks are quite nice, but they are no fully safe if catcode changes are involved and personally I try to avoid them for long term code. See e.g. https://github.com/latex3/latex2e/issues/1099
The alternative would be to once again redefine
\@startsection, which has been removed to avoid several other issues. So this is not really an option.Workaround added in [r4254].
Related
Commit: [r4254]