To change the order of section text and number in the page header or footer redefine \sectionmark
\renewcommand*\sectionmark[1]{%
\markright{#1 \ifnumbered{section}{\sectionmarkformat}{}}%
}
\renewcommand*\sectionmarkformat{\thesection}
But note that it is not recommended to use titlesec
together with a KOMA-Script class. You can redefine \sectionlinesformat
to change the order of text and number for section and subsection headings:
\makeatletter
\renewcommand\sectionlinesformat[4]{%
\ifstr{#1}{section}{\@hangfrom{\hskip #2}{#4 #3}}{%
\ifstr{#1}{subsection}{\@hangfrom{\hskip #2}{#4 #3}}{%
\@hangfrom{\hskip #2#3}{#4}}}%
}
\makeatother
To redefine the format of the numbers in section and subsection headings use
\renewcommand*\sectionformat{\thesection}
\renewcommand*\subsectionformat{\thesubsection)}
\renewcommand*{\thesubsection}{\alph{subsection}}
To change or set the font of the section and subsection headings use
\addtokomafont{disposition}{\rmfamily}
\setkomafont{section}{\Large}
\setkomafont{subsection}{\large}
To change the order of section text and number in the page header or footer redefine \sectionmark
as suggested above
\renewcommand*\sectionmark[1]{%
\markright{#1 \ifnumbered{section}{\sectionmarkformat}{}}%
}
\renewcommand*\sectionmarkformat{\sectionformat}
The last line ensures that the section number in the page header/footer is formatted in the same way as in the section heading.
Code:
\documentclass[
fontsize=10pt,
headsepline,
footsepline,
abstract=on
]{scrartcl}[2015/10/03]
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[automark]{scrlayer-scrpage}
\makeatletter
\renewcommand\sectionlinesformat[4]{%
\ifstr{#1}{section}{\@hangfrom{\hskip #2}{#4 #3}}{%
\ifstr{#1}{subsection}{\@hangfrom{\hskip #2}{#4 #3}}{%
\@hangfrom{\hskip #2#3}{#4}}}%
}
\makeatother
\renewcommand*\sectionformat{\thesection}
\renewcommand*\subsectionformat{\thesubsection)}
\renewcommand*{\thesubsection}{\alph{subsection}}
\addtokomafont{disposition}{\rmfamily}
\setkomafont{section}{\Large}
\setkomafont{subsection}{\large}
\renewcommand*\sectionmark[1]{%
\markright{#1 \ifnumbered{section}{\sectionmarkformat}{}}%
}
\renewcommand*\sectionmarkformat{\sectionformat}
\clearpairofpagestyles
\ihead{Author}
\ohead{\today}
\ifoot{\rightmark}
\cfoot{Course xxx }
\ofoot{\pagemark}
\author{Chuck Norris}
\date{\today}
\title{xxx - Sheet 42}
\usepackage{lipsum}% dummy text
\begin{document}
\maketitle
\begin{abstract}
\lipsum[1]
\end{abstract}
\clearpage
\section{Exercise}
\lipsum
\subsection{Part}
\lipsum[2]
\section{Exercise}
\subsection{Part}
\lipsum[3]
\subsection{Part}
\lipsum
\end{document}
To indent the whole subsection part you could use addmargin
.
\documentclass[
fontsize=10pt,
headsepline,
footsepline,
abstract=on
]{scrartcl}[2015/10/03]
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[automark]{scrlayer-scrpage}
\newcommand*\exercisepartindent{20pt}
\RedeclareSectionCommand[
afterskip=.5\baselineskip
]{section}
\RedeclareSectionCommand[
beforeskip=-.5\baselineskip,
afterskip=1sp,
indent=\exercisepartindent
]{subsection}
\makeatletter
\renewcommand\sectionlinesformat[4]{%
\ifstr{#1}{section}{\@hangfrom{\hskip #2}{#4 #3}}{%
\ifstr{#1}{subsection}{\@hangfrom{\hskip #2}{#4 #3}}{%
\@hangfrom{\hskip #2#3}{#4}}}%
}
\makeatother
\renewcommand*\sectionformat{\thesection}
\renewcommand*\subsectionformat{\thesubsection)}
\renewcommand*{\thesubsection}{\alph{subsection}}
\addtokomafont{disposition}{\rmfamily}
\setkomafont{section}{\Large}
\setkomafont{subsection}{\large}
\automark{section}
\renewcommand*\sectionmark[1]{%
\markright{#1 \ifnumbered{section}{\sectionmarkformat}{}}%
}
\renewcommand*\sectionmarkformat{\sectionformat}
\clearpairofpagestyles
\ihead{Author}
\ohead{\today}
\ifoot{\rightmark}
\cfoot{Course xxx }
\ofoot{\pagemark}
\author{Chuck Norris}
\date{\today}
\title{xxx - Sheet 42}
\newenvironment{exercisepart}{%
\subsection{Part}
\begin{addmargin}[\exercisepartindent]{0cm}%
}{%
\end{addmargin}
}
\usepackage{lipsum}% dummy text
\begin{document}
\maketitle
\begin{abstract}
\lipsum[1]
\end{abstract}
\clearpage
\section{Exercise}
\lipsum[1-2]
\begin{exercisepart}
\lipsum[2]
\end{exercisepart}
\section{Exercise}
\begin{exercisepart}
\lipsum[3]
\end{exercisepart}
\begin{exercisepart}
\lipsum
\end{exercisepart}
\end{document}
Result
With a KOMA-Script Version older than 3.19 (current is 3.21) you have to use titlesec
to change the order of the section number and text. Note that this is not recommended for version 3.19 or newer (see above).
\documentclass[
fontsize=10pt,
headsepline,
footsepline,
abstract=on
]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[automark]{scrlayer-scrpage}
\newcommand*\exercisepartindent{20pt}
\usepackage[explicit]{titlesec}
\titleformat{\section}{\usekomafont{disposition}\usekomafont{section}}{}{0pt}{#1\ \sectionformat}
\titleformat{\subsection}{\usekomafont{disposition}\usekomafont{section}}{}{0pt}{#1\ \subsectionformat}
\titlespacing*{\section}{0pt}{3.5ex plus 1ex minus .2ex}{.5\baselineskip}
\titlespacing*{\subsection}{\exercisepartindent}{.5\baselineskip}{0pt}
\def\sectionformat{\thesection}
\def\subsectionformat{\thesubsection}
\renewcommand*{\thesubsection}{\alph{subsection}}
\addtokomafont{disposition}{\rmfamily}
\setkomafont{section}{\Large}
\setkomafont{subsection}{\large}
\automark{section}
\renewcommand*\sectionmark[1]{%
\markright{#1 \ifnumbered{section}{\sectionmarkformat}{}}%
}
\renewcommand*\sectionmarkformat{\sectionformat}
\clearpairofpagestyles
\ihead{Author}
\ohead{\today}
\ifoot{\rightmark}
\cfoot{Course xxx }
\ofoot{\pagemark}
\author{Chuck Norris}
\date{\today}
\title{xxx - Sheet 42}
\newenvironment{exercisepart}{%
\subsection{Part}
\begin{addmargin}[\exercisepartindent]{0cm}%
}{%
\end{addmargin}
}
\usepackage{lipsum}% dummy text
\begin{document}
\maketitle
\begin{abstract}
\lipsum[1]
\end{abstract}
\clearpage
\section{Exercise}
\lipsum[1-2]
\begin{exercisepart}
\lipsum[2]
\end{exercisepart}
\section{Exercise}
\begin{exercisepart}
\lipsum[3]
\end{exercisepart}
\begin{exercisepart}
\lipsum
\end{exercisepart}
\end{document}