Having a problem somewhat akin to "How to put section number into the right side of section title in LaTeX" (and neither of the two answers there floating my boat), I was tinkering with titlesec
, and came across an error message I cannot fathom.
Ignoring good looks of the example for the sake of brevity, this works:
\documentclass{scrbook}
\usepackage[german]{babel}
\usepackage[utf8]{inputenc}
\usepackage{titlesec}
\titleformat{\section}[hang]{}{\thesection}{0pt}{}{} %% <--
\begin{document}
\section{Section}
\end{document}
(Yields "0.1Section".)
Switching the marked line to this also works:
\titleformat{\section}[hang]{}{}{0pt}{\thesection}{}
(Yields "0.1Section".)
However, the following line does not work:
\titleformat{\section}[hang]{}{}{0pt}{}{\thesection}
(Expected "Section0.1", but yields LaTeX Error, "Missing \begin{document}".)
Apparently the "after"-Field of \titleformat
handles things differently. Why does this happen, and can it be avoided?