start migration to pysty files

This commit is contained in:
Maximilian Keßler 2021-10-06 20:16:07 +02:00
parent 94347728d2
commit 94072fb7d9
15 changed files with 209 additions and 224 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
*.swp
build/*

32
wip/bibliography.pysty Normal file
View file

@ -0,0 +1,32 @@
__HEADER__(Package to easily print bibliography and image attributions in document)
\RequirePackage{xkeyval}
__LANGUAGE_OPTIONS__
\def__PACKAGE_MACRO__(bibfile){bibliography.bib}
\def__PACKAGE_MACRO__(imagefile){images.bib}
\DeclareOptionX{bibfile}[bibliography.bib]{\def__PACKAGE_MACRO__(bibfile){#1}}
\DeclareOptionX{imagefile}[images.bib]{\def__PACKAGE_MACRO__(imagefile){#1}}
__END_OPTIONS_X__
%%%%Bibliography management
\RequirePackage[backend=biber,style=alphabetic]{biblatex}
\addbibresource{__PACKAGE_MACRO__(bibfile)}
\addbibresource{__PACKAGE_MACRO__(imagefile)}
%Provide simpler commands to properly print image attributions and literature
\DeclareRobustCommand*{\printimageattributions}{
\def\imageattributionstitle{\ifenglish Image attributions \else Bildquellen\fi}
\phantomsection
\addcontentsline{toc}{section}{\imageattributionstitle}
\printbibliography[title={\imageattributionstitle}, type=image]
}
\DeclareRobustCommand*{\printliterature}{
\def\literaturetitle{\ifenglish Literature\else Literatur\fi}
\phantomsection
\addcontentsline{toc}{section}{\literaturetitle}
\printbibliography[title={\literaturetitle}, nottype=image]
}

View file

@ -1,8 +1,6 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mkessler-enumerate}
__HEADER__(Simple enumeration package wrapper. Handles custom number setting and beamer class.)
\@ifclassloaded{beamer}{}{
\usepackage[shortlabels]{enumitem}
\newcommand\setItemnumber[1]{\setcounter{enum\romannumeral\@enumdepth}{\numexpr#1-1\relax}}
}

24
wip/exsheet.pysty Normal file
View file

@ -0,0 +1,24 @@
__HEADER__(Include exercise sheets into lecture notes easily.)
\RequirePackage{xkeyval}
__LANGUAGE_OPTIONS__
__END_OPTIONS__
\RequirePackage{mkessler-fancythm}
\newcounter{__PACKAGE_PREFIX__sheet}
\declaretheorem[style=thmgreenmargin, numberwithin=__PACKAGE_PREFIX__sheet, name=__IF__(english) Exercise\else Aufgabe\fi]{__PACKAGE_PREFIX__aufgabe}
\usepackage{xkeyval}
\NewDocumentEnvironment{aufgabe}{O{}}{
\begin{__PACKAGE_PREFIX__aufgabe\expandafter}\if\relax\detokenize{#1}\relax\else[#1]\fi\label{aufgabe-\the__PACKAGE_PREFIX__aufgabe}
}{
\end{__PACKAGE_PREFIX__aufgabe\expandafter}\relax
}
\newcommand\blatt{\refstepcounter{__PACKAGE_PREFIX__sheet}\subsection*{\the__PACKAGE_PREFIX__sheet. Übungsblatt}\addcontentsline{toc}{subsection}{\the__PACKAGE_PREFIX__sheet. Übungsblatt}}

View file

@ -1,5 +1,4 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mkessler-figures}
__HEADER__(Packages related to inclusion of figures.)
\RequirePackage{caption}
\RequirePackage{subcaption}

16
wip/gag.pysty Normal file
View file

@ -0,0 +1,16 @@
__HEADER__(Numbering of environments with a fractional environment number)
% For the stack exchange source, see
% https://tex.stackexchange.com/questions/598076/how-to-have-a-fractional-environment-number/598080?noredirect=1#comment1499689_598080
% However, for a reason i don't understand the posted answer does not work for me, but i had to replace theorem with definition in the definition of the gag environment (so apparently, i have to do this for each environment separately). It seems that the definitions of this document do use \thedefinition and not \thetheorem, although by default this is not the case.
\newcounter{gag}
\makeatletter
\newenvironment{gag}[1]{%
\let\savedthedefinition\thedefinition
\thm@headfont{\bfseries\boldmath}%
\stepcounter{gag}%
\renewcommand{\thedefinition}{\savedthedefinition#1}%
\renewcommand{\theHdefinition}{gag\thegag}%
\addtocounter{definition}{-1}\ignorespaces
}{\ignorespacesafterend}
\makeatother

View file

@ -1,4 +1,4 @@
% Input / encoding
__HEADER__(Packages related to language input. Still work in progress, not intended for use.)
\RequirePackage[\ifutf utf8\else utf8x\fi]{inputenc}
\RequirePackage[T1]{fontenc}

View file

@ -1,38 +0,0 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mkessler-bibliography}[2021-09-06 - Package to easily print bibliography and image attributions in document]
%%%%%%%%%%%%%%%%%%
\RequirePackage{xkeyval}
\newif\ifenglish\englishtrue
\DeclareOptionX{german}{\englishfalse}
\DeclareOptionX{english}{\englishtrue}
\def\mkessler@bibliography@bibfile{bibliography.bib}
\def\mkessler@bibliography@imagefile{images.bib}
\DeclareOptionX{bibfile}[bibliography.bib]{\def\mkessler@bibliography@bibfile{#1}}
\DeclareOptionX{imagefile}[images.bib]{\def\mkessler@bibliography@imagefile{#1}}
\DeclareOptionX*{\PackageWarning{mkessler-bibliography}{Unknown '\CurrentOption'}}
\ProcessOptionsX\relax
%%%%Bibliography management
\RequirePackage[backend=biber,style=alphabetic]{biblatex}
\addbibresource{\mkessler@bibliography@bibfile}
\addbibresource{\mkessler@bibliography@imagefile}
%Provide simpler commands to properly print image attributions and literature
\DeclareRobustCommand*{\printimageattributions}{
\def\imageattributionstitle{\ifenglish Image attributions \else Bildquellen\fi}
\phantomsection
\addcontentsline{toc}{section}{\imageattributionstitle}
\printbibliography[title={\imageattributionstitle}, type=image]
}
\DeclareRobustCommand*{\printliterature}{
\def\literaturetitle{\ifenglish Literature\else Literatur\fi}
\phantomsection
\addcontentsline{toc}{section}{\literaturetitle}
\printbibliography[title={\literaturetitle}, nottype=image]
}

View file

@ -1,25 +0,0 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mkessler-exsheet}
\newif\ifmkessler@exsheet@english\mkessler@exsheet@englishtrue
\DeclareOption{german}{\mkessler@exsheet@englishfalse}
\DeclareOption{english}{\mkessler@exsheet@englishtrue}
\DeclareOption*{\PackageWarning{mkessler-exsheet}{Unknown '\CurrentOption'}}
\ProcessOptions\relax
\RequirePackage{mkessler-fancythm}
\newcounter{mkessler@exsheet@sheet}
\declaretheorem[style=thmgreenmargin, numberwithin=mkessler@exsheet@sheet, name=\ifmkessler@exsheet@english Exercise\else Aufgabe\fi]{mkessler@exsheet@aufgabe}
\usepackage{xkeyval}
\NewDocumentEnvironment{aufgabe}{O{}}{
\begin{mkessler@exsheet@aufgabe\expandafter}\if\relax\detokenize{#1}\relax\else[#1]\fi\label{aufgabe-\themkessler@exsheet@aufgabe}
}{
\end{mkessler@exsheet@aufgabe\expandafter}\relax
}
\newcommand\blatt{\refstepcounter{mkessler@exsheet@sheet}\subsection*{\themkessler@exsheet@sheet. Übungsblatt}\addcontentsline{toc}{subsection}{\themkessler@exsheet@sheet. Übungsblatt}}

View file

@ -1,15 +0,0 @@
%Numbering of environments with a fractional environment number, see
% https://tex.stackexchange.com/questions/598076/how-to-have-a-fractional-environment-number/598080?noredirect=1#comment1499689_598080
%However, for a reason i don't understand the posted answer does not work for me, but i had to replace theorem with definition in the definition of the gag environment (so apparently, i have to do this for each environment separately). It seems that the definitions of this document do use \thedefinition and not \thetheorem, although by default this is not the case.
\newcounter{gag}
\makeatletter
\newenvironment{gag}[1]{%
\let\savedthedefinition\thedefinition
\thm@headfont{\bfseries\boldmath}%
\stepcounter{gag}%
\renewcommand{\thedefinition}{\savedthedefinition#1}%
\renewcommand{\theHdefinition}{gag\thegag}%
\addtocounter{definition}{-1}\ignorespaces
}{\ignorespacesafterend}
\makeatother

View file

@ -1,101 +0,0 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mkessler-proof}
%%%% This package will be developed for proofs with automatic references to theorems
% for claims numbered within these profos
% and for nice subproof / proof of claim environments
\newif\ifmkessler@proof@english\mkessler@proof@englishtrue
\DeclareOption{german}{\mkessler@proof@englishfalse}
\DeclareOption*{\PackageWarning{mkessler-proof}{Unknown '\CurrentOption'}}
\ProcessOptions\relax
\RequirePackage{amssymb}
\RequirePackage{amsthm}
\RequirePackage{etoolbox}
\RequirePackage{xparse}
%%Give claim an own counter and let it reset at each proof
%See also at:
%https://tex.stackexchange.com/questions/283502/reset-counter-at-beginning-of-proof
\newtheorem{claim}{\ifmkessler@proof@english Claim\else Behauptung\fi}
\newtheorem*{claim*}{\ifmkessler@proof@english Claim\else Behauptung\fi}
\AtBeginDocument{\def\claimautorefname{\ifmkessler@proof@english Claim\else Behauptung\fi}}
\newif\ifhyperref
\AtBeginDocument{
\@ifpackageloaded{hyperref}{
\hyperreftrue
\def\grab#1{\expandafter\@firstoffive#1}
\def\mkessler@proof@blankref#1{\expandafter\grab\csname r@#1\endcsname}
\let\mkessler@proof@autoref\autoref
}{
\hyperreffalse
\let\mkessler@proof@blankref\ref
\let\mkessler@proof@autoref\ref
}
}
\NewDocumentEnvironment{rproof}{m O{}}{\def\mkessler@proof@aster{\relax}\begin{mkessler@fancythm@rproof@impl}{#1}[#2]}{\end{mkessler@fancythm@rproof@impl}}
\NewDocumentEnvironment{rproof*}{m O{}}{\def\mkessler@proof@aster{*}\begin{mkessler@fancythm@rproof@impl}{#1}[#2]}{\end{mkessler@fancythm@rproof@impl}}
\NewDocumentEnvironment{mkessler@fancythm@rproof@impl}{m O{}}
{
% Restore correct counter for claim
\ifcsdef{themkessler@proof@#1@save@claim}{
\setcounter{claim}{\value{mkessler@proof@#1@save@claim}}
\def\mkessler@proof@proofprefix{\ifmkessler@proof@english Continuation of proof\mkessler@proof@aster\space of\else Fortsetzung des Beweises\mkessler@proof@aster\space zu\fi}
\edef\haha{\value{mkessler@proof@#1@part}}
}{
\newcounter{mkessler@proof@#1@save@claim}
\setcounter{claim}{0}
\def\mkessler@proof@proofprefix{\ifmkessler@proof@english Proof\mkessler@proof@aster\space of\else Beweis\mkessler@proof@aster\space von\fi}
}
% Set up counter number printing as subindexed by numbering of the reference
\let\mkessler@proof@theoldclaim\theclaim
\def\theclaim{\mkessler@proof@blankref{#1}.\mkessler@proof@theoldclaim}
% Now, start the actual proof
\begin{proof}[\mkessler@proof@proofprefix\space\mkessler@proof@autoref{#1}\if\relax\detokenize{#2}\relax\else\space(#2)\fi]
}
{
\end{proof} % End proof
% Save current claim counter for later restoration
\setcounter{mkessler@proof@#1@save@claim}{\value{claim}}
}
% Proof (with asterisk)
\NewDocumentEnvironment{proof*}{O{}}
{
\if\relax\detokenize{#1}\relax\begin{proof}[\ifmkessler@proof@english Proof\emph{*}\else Beweis\emph{*}\fi]\else\begin{proof}[#1\emph{*}]\fi
}
{
\end{proof}
}
%%subproof environment - essentially copied proof environment from amsthm and modified its name + symbol
\DeclareRobustCommand{\blackqed}{%
\ifmmode \mathqed
\else
\leavevmode\unskip\penalty9999 \hbox{}\nobreak\hfill
\quad\hbox{$\blacksquare$}%
\fi
}
\newenvironment{subproof}[1][\ifmkessler@proof@english Subproof\else Unterbeweis\fi]{\par
\pushQED{\blackqed}%
\normalfont \topsep6\p@\@plus6\p@\relax
\trivlist
\item[\hskip\labelsep
\itshape
#1\@addpunct{.}]\ignorespaces
}{%
\popQED\endtrivlist\@endpefalse
}
%%%% This might be dropped, but for now is collected here
%%Solution (for exercises)
\newenvironment{solution}[1][]{\begin{proof}[\ifmkessler@proof@english{}Solution\else{}Lösung\fi{}#1]}{\end{proof}}

View file

@ -1,38 +0,0 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mkessler-restate}
\RequirePackage{xkeyval}
\RequirePackage{todonotes}
\RequirePackage{xparse}
\RequirePackage{etoolbox}
\newif\ifmkessler@restate@english\mkessler@restate@englishtrue
\DeclareOptionX{english}{\mkessler@restate@englishtrue}
\DeclareOptionX{german}{\mkessler@restate@englishfalse}
\DeclareOptionX{ngerman}{\mkessler@restate@englishfalse}
\define@boolkey+{mkessler-restate.sty}[mkessler@restate@]{strict}[true]{
\ifmkessler@restate@strict
\PackageInfo{mkessler-restate}{Strict mode enabled. Undefined restates will throw errors.}%
\else
\PackageInfo{mkessler-restate}{Strict mode disabled. Undefined restates will now print placeholder boxes}%
\fi
}{
\PackageWarning{mkessler-restate}{Erroneous input to key 'strict' ignored. Provide =true or =false.}
}
\ProcessOptionsX*\relax
\newcommand\restatesetup[1]{\setkeys{mkessler-restate.sty}{#1}}
\NewDocumentCommand{\restatetheorem}{s m}{
\ifcsdef{#2}{
\ifx#1\BooleanTrue\csname#2\endcsname*\else\csname#2\endcsname\fi
}{
\ifmkessler@restate@strict
\PackageError{mkessler-restate}{Strict mode enabled but restate command not defined}{The theorem you tried to restate is not defined. Either make sure it is so that it can be printed or disable the strict mode with \noexpand\restatesetup{strict=false} to print a placeholder instead}
\else
\missingfigure{\ifmkessler@restate@english Here theorem \textbf{#2} is missing, since it is not part of this document.\else Hier fehlt die Wiederholung von Satz \textbf{#2}, der nicht Teil dieses Dokumentes ist.\fi}
\fi
}
}

96
wip/proof.pysty Normal file
View file

@ -0,0 +1,96 @@
__HEADER__(Automatic references to theorems in proofs. Claim counters within proofs)
\RequirePackage{xkeyval}
__LANGUAGE_OPTIONS__
__END_OPTIONS_X__
\RequirePackage{amssymb}
\RequirePackage{amsthm}
\RequirePackage{etoolbox}
\RequirePackage{xparse}
%%Give claim an own counter and let it reset at each proof
%See also at:
%https://tex.stackexchange.com/questions/283502/reset-counter-at-beginning-of-proof
\newtheorem{claim}{__IF__(english) Claim\else Behauptung\fi}
\newtheorem*{claim*}{__IF__(english) Claim\else Behauptung\fi}
\AtBeginDocument{\def\claimautorefname{__IF__(english) Claim\else Behauptung\fi}}
\newif\ifhyperref
\AtBeginDocument{
\@ifpackageloaded{hyperref}{
\hyperreftrue
\def\grab#1{\expandafter\@firstoffive#1}
\def__PACKAGE_MACRO__(blankref)#1{\expandafter\grab\csname r@#1\endcsname}
\let__PACKAGE_MACRO__(autoref)\autoref
}{
\hyperreffalse
\let__PACKAGE_MACRO__(blankref)\ref
\let__PACKAGE_MACRO__(autoref)\ref
}
}
\NewDocumentEnvironment{rproof}{m O{}}{\def__PACKAGE_MACRO__(aster){\relax}\begin{__PACKAGE_PREFIX__rproof@impl}{#1}[#2]}{\end{__PACKAGE_PREFIX__rproof@impl}}
\NewDocumentEnvironment{rproof*}{m O{}}{\def__PACKAGE_MACRO__(aster){*}\begin{__PACKAGE_PREFIX__rproof@impl}{#1}[#2]}{\end{__PACKAGE_PREFIX__rproof@impl}}
\NewDocumentEnvironment{__PACKAGE_PREFIX__rproof@impl}{m O{}}
{
% Restore correct counter for claim
\ifcsdef{the__PACKAGE_PREFIX__#1@save@claim}{
\setcounter{claim}{\value{__PACKAGE_PREFIX__#1@save@claim}}
\def__PACKAGE_MACRO__(proofprefix){__IF__(english) Continuation of proof__PACKAGE_MACRO__(aster)\space of\else Fortsetzung des Beweises__PACKAGE_MACRO__(aster)\space zu\fi}
\edef\haha{\value{__PACKAGE_PREFIX__#1@part}}
}{
\newcounter{__PACKAGE_PREFIX__#1@save@claim}
\setcounter{claim}{0}
\def__PACKAGE_MACRO__(proofprefix){__IF__(english) Proof__PACKAGE_MACRO__(aster)\space of\else Beweis__PACKAGE_MACRO__(aster)\space von\fi}
}
% Set up counter number printing as subindexed by numbering of the reference
\let__PACKAGE_MACRO__(theoldclaim)\theclaim
\def\theclaim{__PACKAGE_MACRO__(blankref){#1}.__PACKAGE_MACRO__(theoldclaim)}
% Now, start the actual proof
\begin{proof}[__PACKAGE_MACRO__(proofprefix)\space__PACKAGE_MACRO__(autoref){#1}\if\relax\detokenize{#2}\relax\else\space(#2)\fi]
}
{
\end{proof} % End proof
% Save current claim counter for later restoration
\setcounter{__PACKAGE_PREFIX__#1@save@claim}{\value{claim}}
}
% Proof (with asterisk)
\NewDocumentEnvironment{proof*}{O{}}
{
\if\relax\detokenize{#1}\relax\begin{proof}[__IF__(english) Proof\emph{*}\else Beweis\emph{*}\fi]\else\begin{proof}[#1\emph{*}]\fi
}
{
\end{proof}
}
%%subproof environment - essentially copied proof environment from amsthm and modified its name + symbol
\DeclareRobustCommand{\blackqed}{%
\ifmmode \mathqed
\else
\leavevmode\unskip\penalty9999 \hbox{}\nobreak\hfill
\quad\hbox{$\blacksquare$}%
\fi
}
\newenvironment{subproof}[1][__IF__(english) Subproof\else Unterbeweis\fi]{\par
\pushQED{\blackqed}%
\normalfont \topsep6\p@\@plus6\p@\relax
\trivlist
\item[\hskip\labelsep
\itshape
#1\@addpunct{.}]\ignorespaces
}{%
\popQED\endtrivlist\@endpefalse
}
%%%% This might be dropped, but for now is collected here
%%Solution (for exercises)
\newenvironment{solution}[1][]{\begin{proof}[__IF__(english){}Solution\else{}Lösung\fi{}#1]}{\end{proof}}

View file

@ -1,4 +1,4 @@
% Quotations
__HEADER__((For now) removed parts of other packages. Not intended for use right now.)% Quotations
\RequirePackage{csquotes} % quotations
%%%% Utilities

36
wip/restate.pysty Normal file
View file

@ -0,0 +1,36 @@
__HEADER__(Replacement package)
\RequirePackage{xkeyval}
\RequirePackage{todonotes}
\RequirePackage{xparse}
\RequirePackage{etoolbox}
__NEW_IF__(english, true)
\DeclareOptionX{english}{__SET_IF__(english,true)}
\DeclareOptionX{german}{__SET_IF__(english,false)}
\DeclareOptionX{ngerman}{__SET_IF__(english,false)}
\define@boolkey+{__FILE_NAME__}[__PACKAGE_PREFIX__]{strict}[true]{
\if__PACKAGE_PREFIX__strict
__INFO__(Strict mode enabled. Undefined restates will throw errors.)%
\else
__INFO__(Strict mode disabled. Undefined restates will now print placeholder boxes)%
\fi
}{
__WARNING__({Erroneous input to key 'strict' ignored. Provide =true or =false.)
}
\ProcessOptionsX*\relax
\newcommand\restatesetup[1]{\setkeys{__FILE_NAME__}{#1}}
\NewDocumentCommand{\restatetheorem}{s m}{
\ifcsdef{#2}{
\ifx#1\BooleanTrue\csname#2\endcsname*\else\csname#2\endcsname\fi
}{
__IF__(strict)
\PackageError{__PACKAGE_NAME__}{Strict mode enabled but restate command not defined}{The theorem you tried to restate is not defined. Either make sure it is so that it can be printed or disable the strict mode with \noexpand\restatesetup{strict=false} to print a placeholder instead}
\else
\missingfigure{__IF__(english) Here theorem \textbf{#2} is missing, since it is not part of this document.\else Hier fehlt die Wiederholung von Satz \textbf{#2}, der nicht Teil dieses Dokumentes ist.\fi}
\fi
}
}