1

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

closed as off-topic by Mensch, Zarko, Torbjørn T., Werner, ebosi Feb 6 '17 at 14:28

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Make a complete example instead of showing only snippets and show the log-file. – Ulrike Fischer Jul 20 '16 at 15:02
  • Please check my edit... the error is the output I get out of lyx. The hole log would be a bit long I assume – KiW Jul 20 '16 at 15:07
  • 1
    Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document} – Runar Jul 20 '16 at 15:57
  • 2
    Lyx can export your code, so you have a latex example. You will have to produce a full example and show the log. I expanded your snippet to a small document and it compiles without error. Also be aware that it was your choice to use lyx. If this now makes it more difficult and time consuming to get support, this your problem and not mine. – Ulrike Fischer Jul 20 '16 at 17:22
  • 4
    I'm voting to close this question as off-topic because it was solved by comments. – Mensch Feb 6 '17 at 13:37