From 94072fb7d9eca2a9766d962ac5a00eb632fae2bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Wed, 6 Oct 2021 20:16:07 +0200 Subject: [PATCH] start migration to pysty files --- .gitignore | 1 + wip/bibliography.pysty | 32 ++++++ ...mkessler-enumerate.sty => enumerate.pysty} | 4 +- wip/exsheet.pysty | 24 +++++ wip/{mkessler-figures.sty => figures.pysty} | 3 +- wip/gag.pysty | 16 +++ wip/{lang-input.sty => lang-input.pysty} | 2 +- wip/mkessler-bibliography.sty | 38 ------- wip/mkessler-exsheet.sty | 25 ----- wip/mkessler-gag.sty | 15 --- wip/mkessler-proof.sty | 101 ------------------ wip/mkessler-restate.sty | 38 ------- wip/proof.pysty | 96 +++++++++++++++++ wip/{removed.sty => removed.pysty} | 2 +- wip/restate.pysty | 36 +++++++ 15 files changed, 209 insertions(+), 224 deletions(-) create mode 100644 wip/bibliography.pysty rename wip/{mkessler-enumerate.sty => enumerate.pysty} (63%) create mode 100644 wip/exsheet.pysty rename wip/{mkessler-figures.sty => figures.pysty} (56%) create mode 100644 wip/gag.pysty rename wip/{lang-input.sty => lang-input.pysty} (88%) delete mode 100644 wip/mkessler-bibliography.sty delete mode 100644 wip/mkessler-exsheet.sty delete mode 100644 wip/mkessler-gag.sty delete mode 100644 wip/mkessler-proof.sty delete mode 100644 wip/mkessler-restate.sty create mode 100644 wip/proof.pysty rename wip/{removed.sty => removed.pysty} (81%) create mode 100644 wip/restate.pysty diff --git a/.gitignore b/.gitignore index 1377554..85f404f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *.swp +build/* diff --git a/wip/bibliography.pysty b/wip/bibliography.pysty new file mode 100644 index 0000000..38c6c2b --- /dev/null +++ b/wip/bibliography.pysty @@ -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] + +} diff --git a/wip/mkessler-enumerate.sty b/wip/enumerate.pysty similarity index 63% rename from wip/mkessler-enumerate.sty rename to wip/enumerate.pysty index b6130d4..947f650 100644 --- a/wip/mkessler-enumerate.sty +++ b/wip/enumerate.pysty @@ -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}} } - diff --git a/wip/exsheet.pysty b/wip/exsheet.pysty new file mode 100644 index 0000000..47c82be --- /dev/null +++ b/wip/exsheet.pysty @@ -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}} + + diff --git a/wip/mkessler-figures.sty b/wip/figures.pysty similarity index 56% rename from wip/mkessler-figures.sty rename to wip/figures.pysty index 09a1afd..819391b 100644 --- a/wip/mkessler-figures.sty +++ b/wip/figures.pysty @@ -1,5 +1,4 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mkessler-figures} +__HEADER__(Packages related to inclusion of figures.) \RequirePackage{caption} \RequirePackage{subcaption} diff --git a/wip/gag.pysty b/wip/gag.pysty new file mode 100644 index 0000000..7a92847 --- /dev/null +++ b/wip/gag.pysty @@ -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 diff --git a/wip/lang-input.sty b/wip/lang-input.pysty similarity index 88% rename from wip/lang-input.sty rename to wip/lang-input.pysty index db1d407..5c6f0c2 100644 --- a/wip/lang-input.sty +++ b/wip/lang-input.pysty @@ -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} diff --git a/wip/mkessler-bibliography.sty b/wip/mkessler-bibliography.sty deleted file mode 100644 index d66c6ae..0000000 --- a/wip/mkessler-bibliography.sty +++ /dev/null @@ -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] - -} diff --git a/wip/mkessler-exsheet.sty b/wip/mkessler-exsheet.sty deleted file mode 100644 index f7c59f7..0000000 --- a/wip/mkessler-exsheet.sty +++ /dev/null @@ -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}} diff --git a/wip/mkessler-gag.sty b/wip/mkessler-gag.sty deleted file mode 100644 index c29aae4..0000000 --- a/wip/mkessler-gag.sty +++ /dev/null @@ -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 diff --git a/wip/mkessler-proof.sty b/wip/mkessler-proof.sty deleted file mode 100644 index 6579ad4..0000000 --- a/wip/mkessler-proof.sty +++ /dev/null @@ -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}} diff --git a/wip/mkessler-restate.sty b/wip/mkessler-restate.sty deleted file mode 100644 index ae21af3..0000000 --- a/wip/mkessler-restate.sty +++ /dev/null @@ -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 - } -} diff --git a/wip/proof.pysty b/wip/proof.pysty new file mode 100644 index 0000000..f224e50 --- /dev/null +++ b/wip/proof.pysty @@ -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}} diff --git a/wip/removed.sty b/wip/removed.pysty similarity index 81% rename from wip/removed.sty rename to wip/removed.pysty index 493f524..eed90e7 100644 --- a/wip/removed.sty +++ b/wip/removed.pysty @@ -1,4 +1,4 @@ -% Quotations +__HEADER__((For now) removed parts of other packages. Not intended for use right now.)% Quotations \RequirePackage{csquotes} % quotations %%%% Utilities diff --git a/wip/restate.pysty b/wip/restate.pysty new file mode 100644 index 0000000..3f3039b --- /dev/null +++ b/wip/restate.pysty @@ -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 + } +}