From 0aefd5fd7183f41ae0576febd7068f2ed9c6fefb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler=20=28via=20gitlab=20runner=29?= Date: Fri, 29 Oct 2021 09:28:01 +0200 Subject: [PATCH] conform to uniform macro usage --- src/environments/fancythm.pysty | 78 ++++++++++++++++----------------- src/lecture-notes/script.pycls | 12 ++--- src/math/mathfixes.pysty | 3 ++ src/wip/removed.pysty | 4 +- 4 files changed, 50 insertions(+), 47 deletions(-) diff --git a/src/environments/fancythm.pysty b/src/environments/fancythm.pysty index e362180..a03419a 100644 --- a/src/environments/fancythm.pysty +++ b/src/environments/fancythm.pysty @@ -122,7 +122,7 @@ __END_OPTIONS_X__ \NewDocumentCommand{\declarebigtheorem}{O{} O{} m m O{}}{ %First, store the name of the theorem in \theoremname - \if__PACKAGE_PREFIX__english + __IF__(english) \ifthenelse{\isempty{#2}}{\def\theoremname{#4}}{\def\theoremname{#2}} \else \ifthenelse{\isempty{#1}}{\def\theoremname{#4}}{\def\theoremname{#1}} @@ -132,58 +132,56 @@ __END_OPTIONS_X__ \ifthenelse{\isempty{#5}}{\declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}, sibling = __PACKAGE_PREFIX__dummy]{#4}}{} %Define the versions theorem*, theorem**, dtheorem - - \if__PACKAGE_PREFIX__lecturenumbers - \if__PACKAGE_PREFIX__numbersmallenvironments +__IF__(lecturenumbers) + __IF__(numbersmallenvironments) \declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}, sibling=__PACKAGE_PREFIX__smalldummy]{#4*} - \declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}\if__PACKAGE_PREFIX__showstars *\else\fi, sibling=__PACKAGE_PREFIX__smalldummy]{#4**} - \declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}\if__PACKAGE_PREFIX__showdaggers $^{\dagger}$\else\fi, sibling=__PACKAGE_PREFIX__smalldummy]{d#4} + \declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}__IF__(showstars) *\else\fi, sibling=__PACKAGE_PREFIX__smalldummy]{#4**} + \declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}__IF__(showdaggers) $^{\dagger}$\else\fi, sibling=__PACKAGE_PREFIX__smalldummy]{d#4} \else \declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}, numbered=no]{#4*} - \declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}\if__PACKAGE_PREFIX__showstars *\else\fi, numbered = no]{#4**} - \declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}\if__PACKAGE_PREFIX__showdaggers $^{\dagger}$\else\fi, numbered = no]{d#4} + \declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}__IF__(showstars) *\else\fi, numbered = no]{#4**} + \declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}__IF__(showdaggers) $^{\dagger}$\else\fi, numbered = no]{d#4} \fi \else \declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}, sibling=__PACKAGE_PREFIX__dummy]{#4*} - \declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}\if__PACKAGE_PREFIX__showstars *\else\fi, sibling=__PACKAGE_PREFIX__dummy]{#4**} - \declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}\if__PACKAGE_PREFIX__showdaggers $^{\dagger}$\else\fi, sibling=__PACKAGE_PREFIX__dummy]{d#4} + \declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}__IF__(showstars) *\else\fi, sibling=__PACKAGE_PREFIX__dummy]{#4**} + \declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}__IF__(showdaggers) $^{\dagger}$\else\fi, sibling=__PACKAGE_PREFIX__dummy]{d#4} \fi - \if__PACKAGE_PREFIX__includestars\else\renewenvironment{#4**}{\comment}{\endcomment}\fi + __IF__(includestars)\else\renewenvironment{#4**}{\comment}{\endcomment}\fi } \NewDocumentCommand{\declaresmalltheorem}{O{} O{} m m}{ %Get the name of the theorem and store it in \theoremname - \if__PACKAGE_PREFIX__english + __IF__(english) \ifthenelse{\isempty{#2}}{\def\theoremname{#4}}{\def\theoremname{#2}} \else \ifthenelse{\isempty{#1}}{\def\theoremname{#4}}{\def\theoremname{#1}} \fi - \if__PACKAGE_PREFIX__numbersmallenvironments - \if__PACKAGE_PREFIX__numbersmallenvironmentswiththeorem + __IF__(numbersmallenvironments) + __IF__(numbersmallenvironmentswiththeorem) \declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}, sibling = __PACKAGE_PREFIX__smalldummy]{#4} - \declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}\if__PACKAGE_PREFIX__showstars *\else\fi, sibling=__PACKAGE_PREFIX__smalldummy]{#4*} - \declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}\if__PACKAGE_PREFIX__showdaggers $^{\dagger}$\else\fi, sibling=__PACKAGE_PREFIX__smalldummy]{d#4} + \declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}__IF__(showstars) *\else\fi, sibling=__PACKAGE_PREFIX__smalldummy]{#4*} + \declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}__IF__(showdaggers) $^{\dagger}$\else\fi, sibling=__PACKAGE_PREFIX__smalldummy]{d#4} \else \declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}, sibling=__PACKAGE_PREFIX__dummy]{#4} - \declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}\if__PACKAGE_PREFIX__showstars *\else\fi, sibling=__PACKAGE_PREFIX__dummy]{#4*} - \declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}\if__PACKAGE_PREFIX__showdaggers $^{\dagger}$\else\fi, sibling=__PACKAGE_PREFIX__dummy]{d#4} + \declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}__IF__(showstars) *\else\fi, sibling=__PACKAGE_PREFIX__dummy]{#4*} + \declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}__IF__(showdaggers) $^{\dagger}$\else\fi, sibling=__PACKAGE_PREFIX__dummy]{d#4} \fi \else \declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}, numbered = no]{#4} - \declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}\if__PACKAGE_PREFIX__showstars *\else\fi, numbered = no]{#4*} - \declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}\if__PACKAGE_PREFIX__showdaggers $^{\dagger}$\else\fi, numbered = no]{d#4} + \declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}__IF__(showstars) *\else\fi, numbered = no]{#4*} + \declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}__IF__(showdaggers) $^{\dagger}$\else\fi, numbered = no]{d#4} \fi \declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}, sibling=__PACKAGE_PREFIX__dummy]{n#4} - \if__PACKAGE_PREFIX__includestars\else\renewenvironment{#4*}{\comment}{\endcomment}\fi + __IF__(includestars)\else\renewenvironment{#4*}{\comment}{\endcomment}\fi } %%%% If requested, now define some default theoremstyles -\if__PACKAGE_PREFIX__defaulttheorems - +__IF__(defaulttheorems) \RequirePackage[default styles]{mkessler-thmstyle} % Easy setup of mdframed styles - \declarebigtheorem[Satz][Theorem]{thmredmarginandfill}{theorem} \if__PACKAGE_PREFIX__english\else\AtBeginDocument{\def\theoremautorefname{Satz}}\fi + \declarebigtheorem[Satz][Theorem]{thmredmarginandfill}{theorem} __IF__(english)\else\AtBeginDocument{\def\theoremautorefname{Satz}}\fi \declarebigtheorem{thmredmarginandfill}{proposition} \declarebigtheorem[Korollar]{thmredmarginandfill}{corollary} \declarebigtheorem{thmorangemarginandfill}{lemma} @@ -210,9 +208,9 @@ __END_OPTIONS_X__ %%%% Specially treated stuff - \declaresmalltheorem[\if__PACKAGE_PREFIX__markoral Mündliche Anmerkung\else Bemerkung\fi][\if__PACKAGE_PREFIX__markoral Oral remark\else remark\fi]{thmyellowmargin}{oral} + \declaresmalltheorem[__IF__(markoral) Mündliche Anmerkung\else Bemerkung\fi][__IF__(markoral) Oral remark\else remark\fi]{thmyellowmargin}{oral} % Option to remove oral remarks when needed - \if__PACKAGE_PREFIX__includeoral\else + __IF__(includeoral)\else \renewenvironment{oral}{\comment}{\endcomment} \renewenvironment{oral*}{\comment}{\endcomment} \renewenvironment{doral}{\comment}{\endcomment} @@ -242,26 +240,26 @@ __END_OPTIONS_X__ %%%%%%%%%%%% Non-mdframed theorems \theoremstyle{plain} - \newtheorem{variant}{\if__PACKAGE_PREFIX__english Variant\else Variante\fi} - \newtheorem{assumption}{\if__PACKAGE_PREFIX__english Assumption\else Annahme\fi} + \newtheorem{variant}{__IF__(english) Variant\else Variante\fi} + \newtheorem{assumption}{__IF__(english) Assumption\else Annahme\fi} \theoremstyle{definition} - \newtheorem*{note}{\if__PACKAGE_PREFIX__english Note\else Anmerkung\fi} - \newtheorem*{warning}{\color{red}\if__PACKAGE_PREFIX__english Warning \else Warnung\fi} - \newtheorem*{goal}{\if__PACKAGE_PREFIX__english Goal \else Ziel\fi} - \newtheorem*{strategy}{\if__PACKAGE_PREFIX__english Proof Strategy \else Beweisstrategie\fi} - \newtheorem*{goal*}{\if__PACKAGE_PREFIX__english Goal* \else Ziel*\fi} + \newtheorem*{note}{__IF__(english) Note\else Anmerkung\fi} + \newtheorem*{warning}{\color{red}__IF__(english) Warning \else Warnung\fi} + \newtheorem*{goal}{__IF__(english) Goal \else Ziel\fi} + \newtheorem*{strategy}{__IF__(english) Proof Strategy \else Beweisstrategie\fi} + \newtheorem*{goal*}{__IF__(english) Goal* \else Ziel*\fi} \newtheorem*{problem}{Problem} \newtheorem*{info}{Information} - \newtheorem*{answer}{\if__PACKAGE_PREFIX__english Answer\else Antwort\fi} - \newtheorem{observe}[theorem]{\if__PACKAGE_PREFIX__english Observe\else Beobachte\fi} - \newtheorem*{property}{\if__PACKAGE_PREFIX__english Property\else Eigenschaft\fi} + \newtheorem*{answer}{__IF__(english) Answer\else Antwort\fi} + \newtheorem{observe}[theorem]{__IF__(english) Observe\else Beobachte\fi} + \newtheorem*{property}{__IF__(english) Property\else Eigenschaft\fi} \newtheorem*{intuition}{Intuition} - \newtheorem*{recall}{\if__PACKAGE_PREFIX__english Recall\else Erinnerung\fi} - \newtheorem*{idea}{\if__PACKAGE_PREFIX__english Idea\else Idee\fi} - \newtheorem{exercise}{\if__PACKAGE_PREFIX__english Exercise\else Aufgabe\fi}[section] - \newtheorem{reminder}{\if__PACKAGE_PREFIX__english Reminder\else Erinnerung\fi} + \newtheorem*{recall}{__IF__(english) Recall\else Erinnerung\fi} + \newtheorem*{idea}{__IF__(english) Idea\else Idee\fi} + \newtheorem{exercise}{__IF__(english) Exercise\else Aufgabe\fi}[section] + \newtheorem{reminder}{__IF__(english) Reminder\else Erinnerung\fi} \fi % end of default theorems diff --git a/src/lecture-notes/script.pycls b/src/lecture-notes/script.pycls index 2cbeb28..aef0b00 100644 --- a/src/lecture-notes/script.pycls +++ b/src/lecture-notes/script.pycls @@ -1,19 +1,21 @@ __HEADER__(Write up lecture notes as script) -__LANGUAGE_OPTIONS__ +\RequirePackage{xkeyval} + +__LANGUAGE_OPTIONS_X__ __NEW_IF__(showversion,true) -\DeclareOption{show version}{__SET_IF__(showversion,true)} -\DeclareOption{hideversion}{__SET_IF__(showversion,false)} +\DeclareOptionX{show version}{__SET_IF__(showversion,true)} +\DeclareOptionX{hideversion}{__SET_IF__(showversion,false)} __NEW_IF__(fancyfoot,false) -\DeclareOption{fancyfoot}{__SET_IF__(fancyfoot,true)} +\DeclareOptionX{fancyfoot}{__SET_IF__(fancyfoot,true)} __NEW_IF__(gitversion,false) \DeclareOption{git}{__SET_IF__(gitversion,true)} -__END_OPTIONS__ +__END_OPTIONS_X__ \RequirePackage{xifthen} diff --git a/src/math/mathfixes.pysty b/src/math/mathfixes.pysty index b3e3598..28bb750 100644 --- a/src/math/mathfixes.pysty +++ b/src/math/mathfixes.pysty @@ -24,8 +24,10 @@ __HEADER__(Hacky math packages for some (custom@) fixes) \let__PACKAGE_MACRO__(stored@varphi)\varphi \AtBeginDocument{ \let\phi__PACKAGE_MACRO__(stored@varphi) + \let\varphi__PACKAGE_MACRO__(stored@varphi) \let\uglyphi__PACKAGE_MACRO__(stored@phi) \let\oldphi__PACKAGE_MACRO__(stored@phi) + \let\goldenratio__PACKAGE_MACRO__(stored@phi) } \let__PACKAGE_MACRO__(stored@epsilon)\epsilon @@ -33,4 +35,5 @@ __HEADER__(Hacky math packages for some (custom@) fixes) \AtBeginDocument{ \let\epsilon__PACKAGE_MACRO__(stored@varepsilon) \let\uglyepsilon__PACKAGE_MACRO__(stored@epsilon) + \let\oldepsilon__PACKAGE_MACRO__(stored@epsilon) } diff --git a/src/wip/removed.pysty b/src/wip/removed.pysty index eed90e7..70c8005 100644 --- a/src/wip/removed.pysty +++ b/src/wip/removed.pysty @@ -1,8 +1,8 @@ -__HEADER__((For now) removed parts of other packages. Not intended for use right now.)% Quotations +__HEADER__((For now@) removed parts of other packages. Not intended for use right now.)% Quotations \RequirePackage{csquotes} % quotations %%%% Utilities -\RequirePackage{comment} %comments +\RequirePackage{commnt} %comments \RequirePackage{todonotes} % todo notes \RequirePackage{blindtext} % \blindtext filling