[Tex/LaTex] Make \part in scrartcl

koma-scriptpartssectioning

I am using the scrartcl of well-known KOMA-script (to those that know it well). As you know the article class has an environment called Abstract. Great, I like this and I use it. However, what I actually a making (and I have asked many questions here about the same and I am sorry I do not really answer questions because I am way more incompetent than the people that can actually answer them. Perhaps soon after I learn more!)

What I have is an document called Puzzles.tex that is basically a template for each puzzle which is in a <description of puzzle>.tex file. Great!

However, I also have different categories of these puzzles. What I would like is a page in between that states say: APPLES!! for problems related to apples. That could be named I. APPLES!! on the page and for the rest an empty pagestyle (or whatever). The next files are included and the title is a section and the parts are subsections.

Summary:
So, basically the problem is: How do I make a \part for the scrartcl class? I also would like to have it in the TOC. Another option would be to implement an abstract in the book class (and then do section -> chapter and subsection -> section), but using the book class seems weird as I probably have less than 30 pages.

Any option that would give me what I need would be interesting, even the ones I did not mention. My ignorance can contribute to the fact that I miss better solutions.

Best Answer

The command \part is already implemented in the scrartcl document class, so you can just redefine how this command behaves. You can redefine \partheadstartvskip, \partheadmidtvskip, and \partheadstartvskip so that \part titles for scrartcl are typeset in their own page using, for example, the empty pagestyle. Redefining \raggedpart (used in scrartcl.cls to have raggedright title for parts) to be \centering, you will get centered titles:

\documentclass{scrartcl}

\renewcommand\partheadstartvskip{\clearpage\null\vfil}
\renewcommand\partheadmidvskip{\par\nobreak\vskip 20pt\thispagestyle{empty}}
\renewcommand\partheadendvskip{\vfil\clearpage}
\renewcommand\raggedpart{\centering}

\begin{document}

\tableofcontents
\part{Test Part}
\section{Test Section}

\end{document}

An image of the first two pages:

enter image description here

Since the page style for the modified \part pages was declared to be empty, it doesn't make sense to have a page numbers for the ToC entries associated to \part; to suppress the page number in the ToC, you can add to the preamble the following lines:

\usepackage{etoolbox}

\makeatletter
\patchcmd{\l@part}{\hss#2}{}{}{}
\makeatother

If you want to suppress the word "Part" from the title, simply add to the preamble the line

\renewcommand*\partformat{\thepart\autodot}

Here's an example illustrating the suggested modifications:

\documentclass{scrartcl}
\usepackage{etoolbox}

\makeatletter
\patchcmd{\l@part}{\hss#2}{}{}{}
\makeatother

\renewcommand\partheadstartvskip{\clearpage\null\vfil}
\renewcommand\partheadmidvskip{\par\nobreak\vskip 20pt\thispagestyle{empty}}
\renewcommand\partheadendvskip{\vfil\clearpage}
\renewcommand\raggedpart{\centering}
\renewcommand*\partformat{\thepart\autodot}

\begin{document}

\tableofcontents
\part{Apples}
\section{Test Apple Section}

\end{document}

And the image of the first two pages:

enter image description here