latex/main/style/counters.tex

76 lines
3.9 KiB
TeX

% ▄▄· ▄• ▄▌ ▐ ▄ ▄▄▄▄▄▄▄▄ .▄▄▄
% ▐█ ▌▪ ▄█▀▄ █▪██▌•█▌▐█•██ ▀▄.▀·▀▄ █·
% ██ ▄▄▐█▌.▐▌█▌▐█▌▐█▐▐▌ ▐█.▪▐▀▀▪▄▐▀▀▄
% ▐███▌▐█▌.▐▌▐█▄█▌██▐█▌ ▐█▌·▐█▄▄▌▐█•█▌
% ·▀▀▀ ▀█▄▀▪ ▀▀▀ ▀▀ █▪ ▀▀▀ ▀▀▀ .▀ ▀
% tcolorbox and other stylistic elements (i.e. inline versions of them) that have counters
\newcounter{lemmas}
\newcounter{definitions}
\newcounter{corollaries}
\newcounter{theorems}
\newcounter{axioms}
\newcounter{examples}
\newcounter{all}
\newcommand{\usenumberArabic}[1]{
\arabic{section}.\ifnum{numberingConfig}<3{
\ifnum{numberingConfig}<2{\arabic{#1}\stepcounter{#1}}\else{
\ifx#1definitions
\arabic{#1}\stepcounter{#1}
\else
\arabic{all}\stepcounter{all}
\fi
}\fi
}\else{\arabic{all}\stepcounter{all}}\fi
}
% Reset definition, lemma, etc counters, add a new page
\newcommand{\newsection}{
\newpage
\newsectionNoPB
}
% Reset definitions, lemma, etc counters, do not add new page
\newcommand{\newsectionNoPB}{
\setcounter{lemmaCount}{1}
\setcounter{definitionCount}{1}
\setcounter{corollaryCount}{1}
\setcounter{theoremCount}{1}
\setcounter{axiomCount}{1}
\setcounter{exampleCount}{1}
}
\newsectionNoPB
% Definitions
\newtcolorbox{definition}[2][]{mainboxstyle,colback=blue!5!white,colframe=blue!75!black,colbacktitle=blue!75!black,title={\large #2},overlay={\node[overlaystyle,draw=blue!75!black,fill=blue!75!black] at (frame.north east) {\large Definition \usenumberArabic{definitions}};},#1}
% Theorems
\newtcolorbox{theorem}[2][]{mainboxstyle,colback=ForestGreen!5!white,colframe=ForestGreen!75!black,colbacktitle=ForestGreen!75!black,title={\large #2},
overlay={\node[draw=ForestGreen!75!black,fill=ForestGreen!75!black] at (frame.north east) {\large Theorem \usenumberArabic{theorems}};},#1}
\newtcolorbox{lemma}[2][]{mainboxstyle,colback=Aquamarine!5!white,colframe=Aquamarine!75!black,colbacktitle=Aquamarine!75!black,title={\large #2},
overlay={\node[draw=Aquamarine!75!black,fill=Aquamarine!75!black] at (frame.north east) {\large Lemma \usenumberArabic{lemmas}};},#1}
\newtcolorbox{corollary}[2][]{mainboxstyle,colback=teal!5!white,colframe=teal!75!black,colbacktitle=teal!75!black,title={\large #2},
overlay={\node[draw=teal!75!black,fill=teal!75!black] at (frame.north east) {\large \translate{Corollary}{Korollar} \usenumberArabic{corollaries}};},#1}
\newtcolorbox{axiom}[2][]{mainboxstyle,colback=JungleGreen!5!white,colframe=JungleGreen!75!black,colbacktitle=JungleGreen!75!black,title={\large #2},
overlay={\node[draw=JungleGreen!75!black,fill=JungleGreen!75!black] at (frame.north east) {\large Axiom \usenumberArabic{axioms}};},#1}
\newtcolorbox{example}[2][]{mainboxstyle,colback=gray!5!white,colframe=gray!75!black,colbacktitle=gray!75!black,title={\large #2},
overlay={\node[draw=gray!75!black,fill=gray!75!black] at (frame.north east) {\large \translate{Example }{Beispiel } \usenumberArabic{examples}};},#1}
% Shortened environments (inline)
\newcommand{\inlineex}{\textbf{\translate{Example }{Beispiel } \hspace{0mm} \usenumberArabic{examples}}}
\newcommand{\inlinedef}{\backdrop{Definition \hspace{0mm} \usenumberArabic{definitions}:} }
\newcommand{\inlinelemma}{\backdrop{Lemma \hspace{0mm} \usenumberArabic{lemmas}:} }
\newcommand{\inlinetheorem}{\backdrop{Theorem \hspace{0mm} \usenumberArabic{theorems}:} }
\newcommand{\inlineaxiom}{\backdrop{Axiom \hspace{0mm} \usenumberArabic{axioms}:} }
\newcommand{\inlinecorollary}{\backdrop{\translate{Corollary}{Korollar} \hspace{0mm} \usenumberArabic{corollaries}}:}
\newcommand{\inlineproof}{\backdrop{\ifnum\value{lang}<2{Proof}\else {Beweis}\fi \hspace{0mm}:} }