0

I would like to recreate the following behaviour using the scrartcl class:

\documentclass{article}
\usepackage{titlesec}
\titleformat{\section}{}{Aufgabe \thesection}{1em}{}
\titleformat{\subsection}[runin]{}{\alph{subsection})}{1em}{}
\begin{document}
\section{}
\subsection{}
\end{document}

Which then looks like this:

enter image description here

I did not for the life of it find a way to achieve the same using a KOMA-class (scrartcl, to be precise), so I resorted to doing this:

\documentclass{scrartcl}
\begin{document}
\section*{Aufgabe 1}
\subsection*{a)}
\end{document}

Which is feasible because we're only talking 3–5 pages long assignments and I don't need a TOC, but it's of course horribly un-LaTeX-ish and part of me is dying when I do it.

2

koma

\documentclass{scrartcl}
\renewcommand{\thesubsection}{\alph{subsection}}
\renewcommand*\sectionformat{Aufgabe \thesection}
\renewcommand*\subsectionformat{\thesubsection)\hspace*{1em}}
\RedeclareSectionCommand[afterskip=0pt]{subsection}
\setkomafont{section}{\rmfamily\mdseries}
\setkomafont{subsection}{\rmfamily\mdseries}
\begin{document}
\section{}
\subsection{}
Blub
\end{document}

Update: An alternative approach would be enumerations:

enumerations

\documentclass{scrartcl}
\usepackage{enumitem}
\usepackage{needspace}

\newcounter{aufgabecnt}
\newenvironment{aufgabe}{
    \needspace{3\baselineskip}\bfseries Aufgabe \stepcounter{aufgabecnt}\theaufgabecnt:\mdseries\nopagebreak
    \begin{enumerate}[label={\alph*)}]
}{\end{enumerate}}

\begin{document}
\begin{aufgabe}
    \item Test
    \item Test
\end{aufgabe}
\end{document}

This approach uses the package needspace for preventing page breaks (as \nopagebreak is kind of tricky).

  • I do highlight them in the actual document. I removed all formatting from the mwe because it's not part of the issue. Point taken for the break though. I took care of that in the document but accidentally removed it from the mwe. I'll add it. – prestoaghitato May 14 '17 at 17:03
  • »Issuing empty sections and subsections does not make much sense.« – why not? – cgnieder May 14 '17 at 17:11
  • @clemens Well, because a simple new command with so much hassle of redefinitions would have been sufficient. But I have already removed those points as they were not that important. – TeXnician May 14 '17 at 17:12
  • @TeXnician I don't get it but I guess it's not so important… – cgnieder May 14 '17 at 17:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.