# titlesec’s update 2.10.2 → 2.11 caused subparagraphs not working in scrbook+classicthesis

I read that classicthesis is somewhat incompatible with KOMA-script, nevertheless I am working on a large document that uses scrbook and classicthesis (that invokes titlesec) and this pair has been producing quite satisfactory results for my needs during the last two years. This has been until today when MiKTeX has updated some of its packages what rendered it unable to use \subparagraphs in my document (while other sectioning commands seem to still work).

I managed to trace the error to a specific update:
titlesec 2011’s version 2.10.2 → the current one: 2.11.

MWE for the problem is:

\documentclass{scrbook}

\usepackage{classicthesis}

\begin{document}
%\paragraph{Test} Test. % Works (together with \subsubsection, \subsection, …).
\subparagraph{Test} Test. % Does not work.
\end{document}


And the errors occuring in LaTeX are as below:

Actually I have just one \subparagraph in my document that has been intended to be changed to \paragraph anyway, what is a bit of a workaround for this. Nevertheless, I am curious whether it is just an inevitable consequence of the mentioned incompatibility between KOMA-script and titlesec. I suppose that there might be a bit more serious problem within the new version of package, as the previous one has not cause this kind of errors. I tried to manually compare the code of titlesec.sty of both versions, but I am still unable to find the direct cause or possible solution to fix this, so maybe someone here would be able to help.

• At the time classicthesis was first written, there were no obvious problems in using titlesec. After that, the KOMA-script classes introduced incompatibilities with titlesec that usually print long warnings in the log file saying, essentially, that using the package might one day or later break. Use the book class instead of scrbook. Jul 22 '19 at 15:53
• With 2.10.2 the following warning is shown: Class scrbook Warning: Activating an ugly workaround for a missing feature of package 'titlesec' on input line 362. With 2.11 the warning reads Class scrbook Info: Deactivating the 'titlesec' workaround, because package is newer than expected on input line 362. If I lie to scrbook with the new titlesec.sty but an old date, titlesec seems to work (and the log, with some tracing activated, is almost the same as with 2.10.2). Jul 22 '19 at 16:41

You could use \RedeclareSectionCommands{subparagraph} after \usepackage{classicthesis}:

\documentclass{scrbook}
\usepackage{classicthesis}
\RedeclareSectionCommands{subparagraph}

\usepackage{blindtext}
\begin{document}
\Blinddocument
\subparagraph{Test} Test.
\end{document}


Or you could use \titleformat and titlespacing provided by package titlesec:

\documentclass{scrbook}
\usepackage{classicthesis}
\titleformat{\subparagraph}[runin]
{\usekomafont{disposition}}{\thesubparagraph}{1ex}{}
\makeatletter
\titlespacing{\subparagraph}{\scr@parindent}{3.25ex plus 1ex minus .2ex}{1em}
\makeatother

\usepackage{blindtext}
\begin{document}
\Blinddocument
\subparagraph{Test} Test.
\end{document}


Starting with KOMA-Script 3.27.3175 (prerelaese of version 3.27) you can load package scrhack with the new option standardsections. Prereleases are available from the KOMA-Script website.

\documentclass{scrbook}[2019/07/23]
\usepackage[standardsections]{scrhack}% needs at least version 3.27.3175
\usepackage{classicthesis}
\usepackage{blindtext}
\begin{document}
\Blinddocument
\subparagraph{Test} Test. \KOMAScriptVersion
\end{document}


Additional remarks regarding the next KOMA-Script version (3.27):

Note that the titlesec workaround will be removed from the code of the KOMA-Script classes in their next version (version 3.27), see https://sourceforge.net/p/koma-script/code/3173/ and Geplante Änderungen in zukünftigen KOMA-Script-Versionen (German).

The suggestions above still work with prerelease 3.27.3175, but the usage of KOMA-Script classes together with titlesec can also result in error messages similar to the messages in your question.

Starting with prerelease version 3.27.3175 package scrhack provides option standardsections. With \usepackage[standardsections]{scrhack} the sectioning commands will be redefined using the same definitions as in the standard classes. Note that this also disables some KOMA-Script commands and features, eg. \RedeclareSectionCommand etc., \sectionformat etc. and option headings.

After Javier Bezos’s comment I managed to make a dirty hack, yet working as a quick fix to remove the error:

\documentclass{scrbook}

% From ‘scrkernel-miscellaneous.dtx’:
\makeatletter
\AfterPackage{titlesec}{%
% Hack getestet mit \textsf{titlesec} 2011/12/15 v2.10.0 bis 2017/07/16% Hack getestet mit \textsf{titlesec} 2011/12/15 v2.10.0 bis 2016/03/21
% v2.11. Daher bis zu diesem Datum freigeschaltet.% v2.10.2. Daher bis zu diesem Datum freigeschaltet.
%   \changes{v3.20}{2016/03/22}{\textsf{titlesec}-Hack auch für Version
%     2016/03/15}^^A
%   \changes{v3.20}{2016/03/24}{\textsf{titlesec}-Hack auch für Version
%     2016/03/21}^^A
%   \changes{v3.20}{2019/07/23}{\textsf{titlesec}-Hack auch für Version%%
%     2019/03/16}^^A%%
%    \begin{macrocode}
\@ifpackagelater{titlesec}{2019/07/17}{%\@ifpackagelater{titlesec}{2016/03/22}{%
\ClassInfo{\KOMAClassName}{%
Manual hack for https://tex.stackexchange.com/q/500970 problem has failed:\MessageBreak%%
Deactivating the titlesec' workaround,\MessageBreak
because package is newer than expected%
}%
}{%
\ClassWarning{\KOMAClassName}{%
Manual hack for https://tex.stackexchange.com/q/500970 problem:\MessageBreak%%
Activating an ugly workaround for a missing\MessageBreak
feature of package titlesec%
}%
\def\scr@ttl@@extract#1\scr@startsection#2#3#4#5#6#7#8{%
\@tempskipa=#5
\@tempskipb=#6
\ifdim\@tempskipa<\z@
\toks@{\titlespacing*#8{#4}}%
\@tempskipa-\@tempskipa
\else
\toks@{\titlespacing#8{#4}}%
\fi
\@ifundefined{ttl@space}{}{%
\ttl@assign\@tempskipa*\ttl@space\relax\beforetitleunit}%
\ifdim\@tempskipb<\z@
\if@tempswa
\titleformat#8[runin]%
{\ttl@fonts\ttl@sizes{#3}}{\@seccntformat{#2}}%
{\z@}\ttl@passexplicit
\else
\titleformat#8[runin]%
{#7}{\@seccntformat{#2}}%
{\z@}\ttl@passexplicit
\fi
\@tempskipb-\@tempskipb
\else
\if@tempswa
\titleformat#8%
{\ttl@fil\ttl@fonts\ttl@sizes{#3}}{\@seccntformat{#2}}%
{\z@}\ttl@passexplicit
\else
\titleformat#8%
{#7}{\@seccntformat{#2}}%
{\z@}\ttl@passexplicit
\fi
\@ifundefined{ttl@space}{}{%
\ttl@assign\@tempskipb*\ttl@space\relax\aftertitleunit}%
\fi
\edef\ttl@a{\the\toks@{\the\@tempskipa}{\the\@tempskipb}}
\ttl@a}%
\expandafter\scr@ttl@@extract\scr@ttl@saved@section\section
\expandafter\scr@ttl@@extract\scr@ttl@saved@subsection\subsection
\expandafter\scr@ttl@@extract\scr@ttl@saved@subsubsection\subsubsection
\expandafter\scr@ttl@@extract\scr@ttl@saved@paragraph\paragraph
\expandafter\scr@ttl@@extract\scr@ttl@saved@subparagraph\subparagraph
\let\scr@ttl@saved@section\relax
\let\scr@ttl@saved@subsection\relax
\let\scr@ttl@saved@subsubsection\relax
\let\scr@ttl@saved@paragraph\relax
\let\scr@ttl@saved@subparagraph\relax
\let\scr@ttl@@extract\relax
}%
}
\makeatother

\usepackage{classicthesis}

\begin{document}
\paragraph{Test} Test. % Works (together with \subsubsection, \subsection, …).
\subparagraph{Test} Test. % Now also works.
\end{document}
`