[Tex/LaTex] Conflict between titlesec package and scrbook class after most recent update of TeXLive2019

koma-scriptscrbooktitlesec

I just performed a full TL update (--all) (1 hr ago) and noticed that one of my documents which used to compile OK now gives an error.

After trial and error, found the problem shows up when including titlesec with scrbook. But this used to work just fine before the update of the TeX distribution.

MWE

\documentclass[11pt]{scrbook}%
%\documentclass[11pt]{book}%
\usepackage[raggedright]{titlesec}

\errorcontextlines=200

\begin{document}
\mainmatter
\chapter{Introduction, Summary of results and lookup table}
\section{Introduction}

stuff

\end{document}

Now lualatex index.tex gives

>lualatex index.tex
This is LuaTeX, Version 1.10.0 (TeX Live 2019)
 restricted system commands enabled.
(./index.tex
LaTeX2e <2018-12-01>

luaotfload | main : initialization completed in 0.134 seconds
(/usr/local/texlive/2019/texmf-dist/tex/latex/koma-script/scrbook.cls
Document Class: scrbook 2019/02/01 v3.26b KOMA-Script document class (book)
(/usr/local/texlive/2019/texmf-dist/tex/latex/koma-script/scrkbase.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/koma-script/scrbase.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/koma-script/scrlfile.sty)))
(/usr/local/texlive/2019/texmf-dist/tex/latex/koma-script/tocbasic.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/koma-script/scrsize11pt.clo)
(/usr/local/texlive/2019/texmf-dist/tex/latex/koma-script/typearea.sty))

Class scrbook Warning: Usage of package `titlesec' together
(scrbook)              with a KOMA-Script class is not recommended.
(scrbook)              I'd suggest to use the package only
(scrbook)              if you really need it, because it breaks several
(scrbook)              KOMA-Script features, i.e., option `headings' and
(scrbook)              the extended optional argument of the section
(scrbook)              commands.
(scrbook)              Nevertheless, using requested
(scrbook)              package `titlesec' on input line 5.

(/usr/local/texlive/2019/texmf-dist/tex/latex/titlesec/titlesec.sty

Package titlesec Warning: Non standard sectioning command \section
(titlesec)                detected. Using default spacing and no format.


Package titlesec Warning: Non standard sectioning command \subsection
(titlesec)                detected. Using default spacing and no format.


Package titlesec Warning: Non standard sectioning command \subsubsection
(titlesec)                detected. Using default spacing and no format.


Package titlesec Warning: Non standard sectioning command \paragraph
(titlesec)                detected. Using default spacing and no format.


Package titlesec Warning: Non standard sectioning command \subparagraph
(titlesec)                detected. Using default spacing and no format.

) (./index.aux)
chapter 1.
! Missing number, treated as zero.
<to be read again>
}
\ttl@select ...@passexplicit \ttl@case \ttl@c {#2}
                                                  {#3}{#4}\fi \endgroup
\ttl@straight@ii ...t \ttl@select {#6}{#1}{#2}{#7}
                                                  \ttl@finmarks \@ifundefine...

l.13 \section{Introduction}

?

If I use the book class, the preceding MWE compiles with no errors.

What changed to make this fail? Can one no longer use titlesec with scrbook?

TL 2019 on Ubuntu (under windows 10 linux subsystem)

Best Answer

titlesec does not support KOMA-Script classes. So do not combine them. To change the layout of the chapter, section etc. titles you can use KOMA-Script options and \RedeclareSectionCommand & Co and you can redefine \partlineswithprefixformat, \chapterlineswithprefixformat, \chapterlinesformat, \sectionlinesformat and \sectioncatchphraseformat.

Until version 3.26b KOMA-Script has provided a dirty internal hack to make titlesec work with these classes, when the bundle was released. But it has checked the version of titlesec and has disabled the workaround if it was newer. See also https://komascript.de/release3.26b - »Bekannte Probleme« - »scrartcl, scrbook, scrreprt:« (German).

Since KOMA-Script version 3.27 the internal titlesec workaround is removed and there will be no such internal workaround in KOMA-Script version 3.27 or later versions. But 3.27 provides a new hack with the package scrhack that can be enabled using the package option standardsections (not set by default). Then the commands for the sectioning levels are compatible with the standard classes but several KOMA-Script features regarding the sectioning commands are disabled (resulting in warnings).

Example:

\documentclass[
  %11pt% default
]{scrbook}[2019/07/29]% needs prerelease of version 3.27 or newer
\usepackage[standardsections]{scrhack}
\usepackage[raggedright]{titlesec}

\begin{document}
\mainmatter
\chapter{Introduction, Summary of results and lookup table}
\KOMAScriptVersion
\section{Introduction}
stuff
\end{document}

enter image description here


Hack with KOMA-Script version 3.26b or 3.27 (not recommended): If you really want to use titlesec in combination with scrbook, then use \RedeclareSectionCommands for all section levels lower than chapter used in the document but not redefined by \titleformat:

\documentclass[
  %11pt% default
]{scrbook}
\usepackage[raggedright]{titlesec}
\RedeclareSectionCommands{section}

\begin{document}
\mainmatter
\chapter{Introduction, Summary of results and lookup table}
\KOMAScriptVersion
\section{Introduction}
stuff
\end{document}

enter image description here