見出し: 番号なしのセクションと番号付きの「Kapitel」

見出し: 番号なしのセクションと番号付きの「Kapitel」

こんにちは。見出しの左側に「Kapitel X」のみを配置したいと思います。X はセクションの番号 (「Kapitel 3」など) です。右側には、マークなしでセクション名のみを配置したいと思います。現在、2 番目の方法が機能することがわかりました...

\documentclass[12pt]{scrartcl}
\usepackage[a4paper]{geometry}
\geometry{left=3.5cm,right=3.5cm,top=3cm,bottom=3cm}
\usepackage[T1]{fontenc}        
\usepackage[utf8]{inputenc}     
\usepackage[ngerman]{babel}     
\usepackage{lmodern}            

%% Kopf- und Fußzeile
\usepackage[headsepline,footsepline,automark]{scrlayer-scrpage}
\renewcommand*{\sectionmarkformat}{%
}
\clearscrheadfoot                           
\ohead[]{\headmark}     
\ihead[]{Kapitel \sectionmark}
\setkomafont{pageheadfoot}{\sffamily}

\begin{document}

    
    \section{Hauptteil}
    

\end{document}
   

ここに画像の説明を入力してください

答え1

\documentclass[12pt]{scrartcl}
\usepackage[a4paper]{geometry}
\geometry{left=3.5cm,right=3.5cm,top=3cm,bottom=3cm}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{lmodern}

%% Kopf- und Fußzeile
\usepackage[headsepline,footsepline,automark]{scrlayer-scrpage}
\renewcommand*{\sectionmarkformat}{Kapitel~\thesection\hfill}
\clearscrheadfoot
\ihead[]{\headmark}
\setkomafont{pageheadfoot}{\sffamily}

\begin{document}

\section{Hauptteil}

\end{document}

関連情報