Last active
October 15, 2022 20:01
-
-
Save Quintus/1e209765b961f8d92dac51b53b0ffac5 to your computer and use it in GitHub Desktop.
Juristische Gliederungsnummern mit LaTeX und KOMA-Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% Zählerformatierung für griechische Buchstaben | |
% durch neudefiniertes Kommando \greek{<zähler>}. | |
% Informativ: | |
% - https://devtut.github.io/latex/counters-if-statements-and-loops-with-latex.html | |
% - https://www.matthiaspospiech.de/blog/2008/04/13/latex-variablen-if-abfragen-und-schleifen/ | |
% | |
% \greek nutzt „echte“ griechische Buchstaben in UTF-8 und passt sich | |
% daher bestens in die umgebende Schriftformatierung ein; die im | |
% Internet kursierenden Beispiele nutzen den kursiven Mathematik-Font, | |
% was untunlich für Gliederungsnummern ist. | |
\newcommand\greek[1]{% | |
\ifcase\value{#1}% Wert 0 kommt nicht vor, ignorieren | |
\or% | |
α% | |
\or% | |
β% | |
\or% | |
γ% | |
\or% | |
δ | |
\or% | |
ε% | |
\or% | |
ζ% | |
\or% | |
η% | |
\or% | |
θ% | |
\or% | |
ι% | |
\or% | |
κ% | |
\or% | |
λ% | |
\or% | |
μ% | |
\or% | |
ν% | |
\or% | |
ξ% | |
\or% | |
ο% | |
\or% | |
ρ% | |
\or% | |
π% | |
\or% | |
σ% | |
\or% | |
τ% | |
\or% | |
υ% | |
\or% | |
φ% | |
\or% | |
χ% | |
\or% | |
ψ% | |
\or% | |
ω% | |
\else\@ctrerr\fi% | |
} | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% Formatierung der Gliederungsebenen | |
% | |
% Die juristische Gliederungsnummerierung lautet: | |
% | |
% A.I.1.a.aa.α | |
% | |
% Wobei Ebenen unterhalb von aa bekanntlich individuell gehandhabt | |
% werden; hier werden griechische Buchstaben mithilfe des oben | |
% definierten \greek-Zählerrepräsentators genutzt. | |
% | |
% Die nachfolgenden Kommando definieren die Hauptzähler-Druckbefehle | |
% \the... um, sodass sie diese alphanumerische Zählung verwenden, | |
% behält aber die Punkte zur Trennung bei. Das ist wichtig, damit das | |
% Kommando \ref immer den kompletten Pfad ausgibt. Damit im Text | |
% selbst nur das letzte Element des Zählers in der Überschrift genutzt | |
% wird, werden unten die KOMA-Script-spezifischen Zwischenbefehle | |
% \...format so umdefiniert, dass nur der jeweils letzte Teil des | |
% \the...-Befehls genutzt wird, wofür \StrCut aus dem xstring-Paket | |
% zum Einsatz kommt. | |
% | |
% Mit der Option "startalph" kann als Startebene A. statt I. gewählt | |
% werden. Normalerweise sollten Aufsätze aber I. als Startebene wählen. | |
% | |
% Dieser Code tut, was er soll. Er führt auch dazu, dass \ref noch | |
% ordentlich funktioniert und den absoluten Pfad ausgibt, was bei | |
% vielen im Internet kursierenden Lösungen nicht der Fall ist. | |
% Er versagt allerdings beim Inhaltsverzeichnis: dort wird auch | |
% immer der absolute Pfad ausgegeben, wo es nur der relative | |
% (= letzte Gliederungsebenennummer) sein dürfte. | |
\ifthenelse{\boolean{startalph}}{% | |
\renewcommand\thesection{\Alph{section}} | |
\renewcommand\thesubsection{\Alph{section}.\Roman{subsection}} | |
\renewcommand\thesubsubsection{\Alph{section}.\Roman{subsection}.\arabic{subsubsection}} | |
\renewcommand\theparagraph{\Alph{section}.\Roman{subsection}.\arabic{subsubsection}.\alph{paragraph}} | |
\renewcommand\thesubparagraph{\Alph{section}.\Roman{subsection}.\arabic{subsubsection}.\alph{paragraph}.\alph{subparagraph}\alph{subparagraph}} | |
\renewcommand\subsectionformat{\StrCut[1]{\thesubsection}{.}\suplevel\sdownlevel% | |
\sdownlevel\autodot\enskip} | |
\renewcommand\subsubsectionformat{\StrCut[2]{\thesubsubsection}{.}\suplevel\sdownlevel% | |
\sdownlevel)\autodot\enskip} | |
\renewcommand\paragraphformat{\StrCut[3]{\theparagraph}{.}\suplevel\sdownlevel% | |
\sdownlevel)\enskip} | |
\renewcommand\subparagraphformat{\StrCut[4]{\thesubparagraph}{.}\suplevel\sdownlevel% | |
\sdownlevel)\enskip} | |
}{ | |
\renewcommand\thesection{\Roman{section}} | |
\renewcommand\thesubsection{\Roman{section}.\arabic{subsection}} | |
\renewcommand\thesubsubsection{\Roman{section}.\arabic{subsection}.\alph{subsubsection}} | |
\renewcommand\theparagraph{\Roman{section}.\arabic{subsection}.\alph{subsubsection}.\alph{paragraph}\alph{paragraph}} | |
\renewcommand\thesubparagraph{\Roman{section}.\arabic{subsection}.\alph{subsubsection}.\alph{paragraph}\alph{paragraph}.\greek{subparagraph}} | |
\renewcommand\subsectionformat{\StrCut[1]{\thesubsection}{.}\suplevel\sdownlevel% | |
\sdownlevel\autodot\enskip} | |
\renewcommand\subsubsectionformat{\StrCut[2]{\thesubsubsection}{.}\suplevel\sdownlevel% | |
\sdownlevel)\enskip} | |
\renewcommand\paragraphformat{\StrCut[3]{\theparagraph}{.}\suplevel\sdownlevel% | |
\sdownlevel)\enskip} | |
\renewcommand\subparagraphformat{\StrCut[4]{\thesubparagraph}{.}\suplevel\sdownlevel% | |
\sdownlevel)\enskip} | |
} | |
% Vielleicht sollte man einfach das Paket `alnumsec' verwenden. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment