
Ich habe versucht, für alle Abschnitte eines Dokuments ein Aufzählungszeichen in den Rand einzufügen, aber KOMA-Befehle scheinen nur nummerierte Abschnitte zu beeinflussen, nicht die unnummerierten. Übersehe ich hier etwas? (Alle Abschnitte werden am Ende unnummeriert sein und nur ein Aufzählungszeichen haben.)
\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\renewcommand*{\sectionformat}{%
\makebox[0pt][r]{\textcolor{gray}{\textbullet}~}}
\begin{document}
\section{Section}
\section*{Unnumbered section}
\end{document}
Antwort1
Sie könnten neu definieren \sectionlinesformat
:
\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\makeatletter
\renewcommand\sectionlinesformat[4]{%
\ifstr{#1}{section}{\makebox[0pt][r]{\normalfont\textcolor{gray}{\textbullet}~}}%
\@hangfrom{\hskip #2#3}{#4}% original definition
}
\makeatother
\usepackage{lipsum}% only for dummy text
\begin{document}
\section{Section}
\lipsum[1]
\addsec*{Unnumbered section}
\lipsum[2]
\end{document}
Oder Sie könnten diesen Befehl verwenden:
\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\usepackage{xpatch}
\xpretocmd\sectionlinesformat
{\ifstr{#1}{section}{\makebox[0pt][r]{\normalfont\textcolor{gray}{\textbullet}~}}}
{}{\PatchFailed}
\usepackage{lipsum}% only for dummy text
\begin{document}
\section{Section}
\lipsum[1]
\addsec*{Unnumbered section}
\lipsum[2]
\end{document}
Das Ergebnis ist das gleiche wie oben.
Antwort2
Aus einer alten Antwort von mir mit Abschnittsneudefinition (kann verbessert werden, wenn es Ihren Anforderungen entspricht, da es sonst zu Problemen mit dem „Inhaltsverzeichnisabschnitt“ (sofern vorhanden) usw. kommen kann):
\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
%\renewcommand*{\sectionformat}{%
%\makebox[0pt][r]{\textcolor{gray}{\textbullet}~}}
\let\oldsection\section
\makeatletter
\def\section{%
\@ifstar{\def\thesection{~}\@Starred}{\@nonStarred}%
}
\def\@Starred{%
\setkomafont{section}{\sectionformat}%
\@ifnextchar[%
{\GenericWarning{}{Warning: A starred section can not have parameters. I am going to ignore them!}\@StarredWith}%
{\@StarredWithout}%
}
\def\@StarredWith[#1]#2{%
\oldsection*{\makebox[0pt][r]{\textcolor{gray}{\textbullet}~}#2}%
}
\def\@StarredWithout#1{
\oldsection*{\makebox[0pt][r]{\textcolor{gray}{\textbullet}~}#1}%
}
\def\@nonStarred{%
\@ifnextchar[%
{\@nonStarredWith}%
{\@nonStarredWithout}%
}
\def\@nonStarredWith[#1]#2{%
\oldsection[#1]{\textcolor{gray}{\textbullet}~#2}%
}
\def\@nonStarredWithout#1{%
\oldsection{\textcolor{gray}{\textbullet}~#1}%
}
\makeatother
\begin{document}
\section{Section}
\section*{Unnumbered section}
\end{document}
Ausgabe:
Warten Sie auf bessere Antworten, da ich diese Dokumentklasse nicht wirklich verwende