\RedeclareSectionCommand 不适用于部分 - KOMA-Script 报告 - Lyx

\RedeclareSectionCommand 不适用于部分 - KOMA-Script 报告 - Lyx

问题

我正在使用 KOMA-Script 报告类scrreprt

我正在尝试更改beforeakipafterskip的章节标题:

\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}

这是我所做的,但出现了以下错误:

缺少 \endcsname insertred。(3 次)

如果我省略这些线条\section\subsection它就可以正常工作。

因此问题是:为什么相同的命令对 subsection 和 section 不起作用?我必须进行哪些更改才能使其正常工作?

完整的 LaTeX 代码

\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}

日志

错误行 57 !missing\endcsname 插入。\numexpr\end(document)

警告线 1 边注超出纸张范围

相关内容