Minimalbeispiele als Anhang sind suboptimal, weil sie nicht direkt im Online-Editor/Compiler verarbeitet werden können. Außerdem ist das Beispiel nicht ohne Änderung lauffähig, weil ein Kommentar ohne % am Zeilenanfang daher kommt. Der
OLD-Teil ist ohnehin nicht funktionsfähig, weil er ein Paket verwendet, das nicht geladen wird. Hier zur Demonstration einmal, wie das gleiche als echtes
Minimalbeispiel (verlinkte Anleitung beachten!) realisierbar wäre:
% First we generate the class from within the minimal working example
% using the filecontents environment as explained in
% <https://texwelt.de/fragen/569>.
\begin{filecontents}[force]{test-class.cls}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{fooClass}[]
\LoadClass{scrreprt}[]
\KOMAoptions{chapterprefix=true}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Changes the chapter mark in the header to "Chapter #:" instead
% of "Chapter #":
\renewcommand*{\chaptermarkformat}{\chapapp\nobreakspace\thechapter:\enskip}
% Create Chapter Headings separated by a line and with upper case prefix line.
\iftrue % change this to \iffalse to see a possible solution of the problem
% OLD: Code with \MakeUppercase issue
\RequirePackage{ifthen}% The old code uses package ifthen, which is not really
% needed, because KOMA-Script provides \IfArgIsEmpty
% and alternatively \Ifstr. However, we use the
% original code and therefore have to load the package.
\renewcommand{\chapterlineswithprefixformat}[3]{%
% if the chapter is unnumbered (prefix is empty)
\ifthenelse{\equal{#2}{}}%
% then only show the title text
{#3}%
% else if chapter is numbered
{%
% set numeration in uppercase letters right-aligned
{\raggedleft \MakeUppercase{#2}}\nobreak
% create a line spanning the whole page
\rule[.5\baselineskip]{\textwidth}{0.4pt}\\*
% insert the title text
#3
}%
}
\else
% NEW: Code without \MakeUppercase issue and several improvements.
\renewcommand*{\chapterformat}{\MakeUppercase{\chapapp~\thechapter\autodot}}% Uppercase prefix and number
\renewcommand{\chapterlineswithprefixformat}[3]{%
% if the chapter is unnumbered (prefix is empty)
\IfArgIsEmpty{#1}%
{#3}% then only show the title text
{% else if chapter is numbered
% set numeration right-aligned
{\raggedleft #2\par}\nobreak
% create a line spanning the whole page
\raggedchapter\noindent% \noindent only needed, if \raggedchapter is empty
\rule[.5\baselineskip]{\textwidth}{0.4pt}\par\nobreak
#3% last but not least the title text (with optionally additional formatting
}%
}
\fi
\end{filecontents}
% Now let's use it.
\documentclass{test-class}
\usepackage{blindtext}% Useful for small demonstration documents.
\begin{document}
\tableofcontents
\blinddocument
\end{document}
Aber genau genommen ist hier der Umweg über eine Wrapper-Klasse für
scrreprt überhaupt nicht notwendig. Stattdessen würde:
\documentclass[chapterprefix]{scrreprt}
% Changes the chapter mark in the header to "Chapter #:" instead
% of "Chapter #":
\renewcommand*{\chaptermarkformat}{\chapapp\nobreakspace\thechapter:\enskip}
% Create Chapter Headings separated by a line and with upper case prefix line.
\iftrue % change to \iffalse to see a possible solution of the problem
% OLD: Code with \MakeUppercase issue
\usepackage{ifthen}% The old code uses package ifthen, which is not really
% needed, because KOMA-Script provides \IfArgIsEmpty
% and alternatively \Ifstr. However, we use the
% original code and therefore have to load the package.
\renewcommand{\chapterlineswithprefixformat}[3]{%
% if the chapter is unnumbered (prefix is empty)
\ifthenelse{\equal{#2}{}}%
% then only show the title text
{#3}%
% else if chapter is numbered
{%
% set numeration in uppercase letters right-aligned
{\raggedleft \MakeUppercase{#2}}\nobreak
% create a line spanning the whole page
\rule[.5\baselineskip]{\textwidth}{0.4pt}\\*
% insert the title text
#3
}%
}
\else
% NEW: Code without \MakeUppercase issue and several improvements.
\renewcommand*{\chapterformat}{\MakeUppercase{\chapapp~\thechapter\autodot}}% Uppercase prefix and number
\renewcommand{\chapterlineswithprefixformat}[3]{%
% if the chapter is unnumbered (prefix is empty)
\IfArgIsEmpty{#1}%
{#3}% then only show the title text
{% else if chapter is numbered
% set numeration right-aligned
{\raggedleft #2\par}\nobreak
% create a line spanning the whole page
\raggedchapter\noindent% \noindent only needed, if \raggedchapter is empty
\rule[.5\baselineskip]{\textwidth}{0.4pt}\par\nobreak
#3% last but not least the title text (with optionally additional formatting
}%
}
\fi
\usepackage{blindtext}% Useful for small demonstration documents.
\begin{document}
\tableofcontents
\blinddocument
\end{document}
vollkommen genügen. Bei beiden Beispielen kann man direkt im Online-Editor das
\iftrue in
\iffalse ändern, um statt des Problems eine mögliche Lösung zu testen. Das ist also ein klarer Vorteil gegenüber irgendwelchen Bastel-Archiven. Dazu wäre ich sogar unterwegs in der Bahn mit meinem Tablet in der Lage gewesen, statt erst jetzt im Büro.
Und wie bereits gesagt: Für Linien in Überschriften hat der KOMA-Script-Autor mehrere Vorschläge im KOMA-Script-Wiki.