Problem
I am using KOMA-Script report class scrreprt:
I am trying to change the beforeakip and afterskip of my Section titles:
\RedeclareSectionCommand[beforeskip=12pt,afterskip=-12pt]{chapter}
\setkomafont{chapter}{\sffamily\LARGE}
\RedeclareSectionCommand[beforeskip=10pt,afterskip=-10pt]{section}
\RedeclareSectionCommand[beforeskip=8pt,afterskip=-8pt]{subsection}
\RedeclareSectionCommand[beforeskip=10pt,afterskip=-6pt]{paragraph}
\setkomafont{paragraph}{\sffamily\normalsize}
This is what I do which comes up with the following error:
Missing \endcsname insertred. (3 times)
If I leave out the lines for \section and \subsection it works perfectly fine.
Hence the question: Why does the same command not work for subsection and section ? And what do I have to change in order for it to work?
The full LaTeX code
\documentclass[11pt,twoside,english,openright, bibliography=totoc]{scrreprt}
\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=2.5cm,bmargin=2.5cm,lmargin=2.75cm,rmargin=2.5cm,headheight=18pt,headsep=8pt,footskip=26pt}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\setlength{\parskip}{\smallskipamount}
\setlength{\parindent}{0pt}
\usepackage{verbatim}
\usepackage{setspace}
\usepackage[authoryear]{natbib}
\onehalfspacing
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage[hyphens]{url}
\usepackage[colorlinks=true, urlcolor=blue, linkcolor=black, citecolor=black]{hyperref}
\usepackage{lscape}
\usepackage[automark, headsepline, footsepline, plainfootsepline]{scrlayer-scrpage}
\pagestyle{scrheadings}
\clearscrheadfoot
\ohead{\headmark}
\ifoot[Test]{Test}
\cfoot[]{}
\ofoot[\pagemark]{\pagemark}
\ihead[]{}
\chead[]{}
%\ohead{\headmark}
\automark[chapter]{chapter}
\usepackage{pdfpages}
\RedeclareSectionCommand[beforeskip=12pt,afterskip=-12pt]{chapter}
\setkomafont{chapter}{\sffamily\LARGE}
\RedeclareSectionCommand[beforeskip=10pt,afterskip=-10pt]{section}
\RedeclareSectionCommand[beforeskip=8pt,afterskip=-8pt]{subsection}
\RedeclareSectionCommand[beforeskip=10pt,afterskip=-6pt]{paragraph}
\setkomafont{paragraph}{\sffamily\normalsize}
\usepackage {blindtext} %creates blindtext
\makeatother
\usepackage{babel}
\begin{document}
\begin{comment}
\end{comment}
\chapter{This is a Chapter}
\section{This is a Section}
\subsection{This is a Sub-section}
\subsubsection*{This is sub-sub-section}
\bibliographystyle{elsarticle-harv}
\nocite{*}
\bibliography{bib}
\end{document}
Log
Error line 57 !missing\endcsname inserted. \numexpr\end(document)
Warnining line 1 The marginal notes overrun the paper
\documentclass{...}and ending with\end{document}