From 3ced92d0c135cd514ca018acca93067091130823 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Mon, 20 Sep 2021 12:48:59 +0200 Subject: [PATCH 01/36] fix a bug in fancythm option --- environments/mkessler-fancythm.sty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environments/mkessler-fancythm.sty b/environments/mkessler-fancythm.sty index 4ec44fc..391d132 100644 --- a/environments/mkessler-fancythm.sty +++ b/environments/mkessler-fancythm.sty @@ -14,7 +14,7 @@ \DeclareOptionX{ownenvironments}{\setkeys{mkesslerfancythm}{ownenvironments=#1}} \DeclareOptionX{oralremarks}{\setkeys{mkesslerfancythm}{oralremarks=#1}} -\DeclareOptionX{mkessler@fancythm@lecturenumbers}{\setkeys{mkesslerfancythm}{mkessler@fancythm@lecturenumbers=#1}} +\DeclareOptionX{lecturenumbers}{\setkeys{mkesslerfancythm}{mkessler@fancythm@lecturenumbers=#1}} \DeclareOptionX{numbersmallenvironments}{\setkeys{mkesslerfancythm}{mkessler@fancythm@numbersmallenvironments=#1}} \DeclareOptionX*{\PackageWarning{mkesslerfancythm}{Unknown X \CurrentOption}}% For unknown options From 94347728d2c9127d7cb621ef90078114bc5fe69c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Mon, 4 Oct 2021 17:59:36 +0200 Subject: [PATCH 02/36] fix options and theorem name in restate package --- wip/mkessler-restate.sty | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wip/mkessler-restate.sty b/wip/mkessler-restate.sty index 495ed7a..ae21af3 100644 --- a/wip/mkessler-restate.sty +++ b/wip/mkessler-restate.sty @@ -2,6 +2,9 @@ \ProvidesPackage{mkessler-restate} \RequirePackage{xkeyval} +\RequirePackage{todonotes} +\RequirePackage{xparse} +\RequirePackage{etoolbox} \newif\ifmkessler@restate@english\mkessler@restate@englishtrue \DeclareOptionX{english}{\mkessler@restate@englishtrue} @@ -21,8 +24,6 @@ \newcommand\restatesetup[1]{\setkeys{mkessler-restate.sty}{#1}} -\RequirePackage{todonotes} -\RequirePackage{xparse} \NewDocumentCommand{\restatetheorem}{s m}{ \ifcsdef{#2}{ @@ -31,7 +32,7 @@ \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 #1 is missing, since it is not part of this document.\else Hier fehlt die Wiederholung von Satz #1, der nicht Teil dieses Dokumentes ist.\fi} + \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 } } 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 03/36] 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 + } +} From af9f6cb2452b8ee7b8a0447b7e1e1260fb352182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Wed, 6 Oct 2021 20:16:43 +0200 Subject: [PATCH 04/36] rename files --- math/{mkessler-faktor.sty => faktor.sty} | 0 math/{mkessler-math.sty => math.sty} | 0 math/{mkessler-mathalias.sty => mathalias.sty} | 0 math/{mkessler-mathfig.sty => mathfig.sty} | 0 math/{mkessler-mathfixes.sty => mathfixes.sty} | 0 math/{mkessler-mathfont.sty => mathfont.sty} | 0 math/{mkessler-mathop.sty => mathop.sty} | 0 math/{mkessler-mathsymb.sty => mathsymb.sty} | 0 math/{mkessler-unicodechar.sty => unicodechar.sty} | 0 9 files changed, 0 insertions(+), 0 deletions(-) rename math/{mkessler-faktor.sty => faktor.sty} (100%) rename math/{mkessler-math.sty => math.sty} (100%) rename math/{mkessler-mathalias.sty => mathalias.sty} (100%) rename math/{mkessler-mathfig.sty => mathfig.sty} (100%) rename math/{mkessler-mathfixes.sty => mathfixes.sty} (100%) rename math/{mkessler-mathfont.sty => mathfont.sty} (100%) rename math/{mkessler-mathop.sty => mathop.sty} (100%) rename math/{mkessler-mathsymb.sty => mathsymb.sty} (100%) rename math/{mkessler-unicodechar.sty => unicodechar.sty} (100%) diff --git a/math/mkessler-faktor.sty b/math/faktor.sty similarity index 100% rename from math/mkessler-faktor.sty rename to math/faktor.sty diff --git a/math/mkessler-math.sty b/math/math.sty similarity index 100% rename from math/mkessler-math.sty rename to math/math.sty diff --git a/math/mkessler-mathalias.sty b/math/mathalias.sty similarity index 100% rename from math/mkessler-mathalias.sty rename to math/mathalias.sty diff --git a/math/mkessler-mathfig.sty b/math/mathfig.sty similarity index 100% rename from math/mkessler-mathfig.sty rename to math/mathfig.sty diff --git a/math/mkessler-mathfixes.sty b/math/mathfixes.sty similarity index 100% rename from math/mkessler-mathfixes.sty rename to math/mathfixes.sty diff --git a/math/mkessler-mathfont.sty b/math/mathfont.sty similarity index 100% rename from math/mkessler-mathfont.sty rename to math/mathfont.sty diff --git a/math/mkessler-mathop.sty b/math/mathop.sty similarity index 100% rename from math/mkessler-mathop.sty rename to math/mathop.sty diff --git a/math/mkessler-mathsymb.sty b/math/mathsymb.sty similarity index 100% rename from math/mkessler-mathsymb.sty rename to math/mathsymb.sty diff --git a/math/mkessler-unicodechar.sty b/math/unicodechar.sty similarity index 100% rename from math/mkessler-unicodechar.sty rename to math/unicodechar.sty From 6ad0a2b411579f5e858a5cb842c83b4fe5201932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Wed, 6 Oct 2021 20:35:06 +0200 Subject: [PATCH 05/36] update math packages to pysty --- math/{faktor.sty => faktor.pysty} | 5 +- math/{math.sty => math.pysty} | 21 ++++----- math/mathalias.pysty | 41 ++++++++++++++++ math/mathalias.sty | 45 ------------------ math/{mathfig.sty => mathfig.pysty} | 5 +- math/mathfixes.pysty | 36 ++++++++++++++ math/mathfixes.sty | 39 ---------------- math/mathfont.pysty | 24 ++++++++++ math/mathfont.sty | 27 ----------- math/{mathop.sty => mathop.pysty} | 52 ++++++++++----------- math/{mathsymb.sty => mathsymb.pysty} | 8 +--- math/{unicodechar.sty => unicodechar.pysty} | 6 +-- 12 files changed, 137 insertions(+), 172 deletions(-) rename math/{faktor.sty => faktor.pysty} (94%) rename math/{math.sty => math.pysty} (54%) create mode 100644 math/mathalias.pysty delete mode 100644 math/mathalias.sty rename math/{mathfig.sty => mathfig.pysty} (85%) create mode 100644 math/mathfixes.pysty delete mode 100644 math/mathfixes.sty create mode 100644 math/mathfont.pysty delete mode 100644 math/mathfont.sty rename math/{mathop.sty => mathop.pysty} (72%) rename math/{mathsymb.sty => mathsymb.pysty} (90%) rename math/{unicodechar.sty => unicodechar.pysty} (88%) diff --git a/math/faktor.sty b/math/faktor.pysty similarity index 94% rename from math/faktor.sty rename to math/faktor.pysty index 3fab7a7..81b3a6a 100644 --- a/math/faktor.sty +++ b/math/faktor.pysty @@ -1,6 +1,4 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mkessler-faktor}[2021-09-06 - Faktor package] -%%%%%%%%%%%%%%%%%% +__HEADER__(Faktor package that also handles cofaktors) % Extension the faktor package for % - cofaktor command that provides A \ B notation @@ -13,7 +11,6 @@ % % This package only packages the corresponding answer and provides an analoguous way of a \cofactor command - %Dependencies \RequirePackage{xparse} \RequirePackage{amssymb} % provides \diagup and \diagdown diff --git a/math/math.sty b/math/math.pysty similarity index 54% rename from math/math.sty rename to math/math.pysty index 49b2c19..03725ff 100644 --- a/math/math.sty +++ b/math/math.pysty @@ -1,17 +1,12 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mkessler-math}[2021/03/31 - Math package] -%%%%%%Collects the basic math packages used for my lecture-note write-ups +__HEADER__(Main math package.) +% Collects the basic math packages used for my lecture-note write-ups +% This just imports all the packages I use for writing up mathematics +% Probably, you will just want to load them separately for more +% customization -%% This just imports all the packages I use for writing up mathematics +__LANGUAGE_OPTIONS__ - -\newif\if@mkessler@math@english\@mkessler@math@englishtrue -\DeclareOption{german}{\@mkessler@math@englishfalse} -\DeclareOption{ngerman}{\@mkessler@math@englishfalse} -\DeclareOption{english}{\@mkessler@math@englishtrue} - -\DeclareOption*{\PackageWarning{mkessler-math}{Unknown '\CurrentOption'}} -\ProcessOptions\relax +__END_OPTIONS__ %%%% Import the other custom math packages \RequirePackage{mkessler-mathfont} % Load this first to ensure untouched fonts @@ -36,7 +31,7 @@ \RequirePackage{mkessler-mathsymb} \RequirePackage[basic]{mkessler-mathalias} % mkessler-mathfont has already been imported -\RequirePackage[\if@mkessler@math@english english\else german\fi]{mkessler-mathop} +\RequirePackage[__IF__(english) english\else german\fi]{mkessler-mathop} \RequirePackage{mkessler-mathfig} \RequirePackage{mkessler-unicodechar} \RequirePackage{mkessler-mathfixes} % Load this last since it renews behaviour diff --git a/math/mathalias.pysty b/math/mathalias.pysty new file mode 100644 index 0000000..c368508 --- /dev/null +++ b/math/mathalias.pysty @@ -0,0 +1,41 @@ +__HEADER__(Easy aliasing for math style commands) + +__NEW_IF__(basic,false) +__NEW_IF__(extended,false) + +\DeclareOption{basic}{__SET_IF__(basic,true)} +\DeclareOption{extended}{__SET_IF__(extended,true)__SET_IF__(basic,true)} + +__END_OPTIONS__ + +%Usage: \makealiasesforwith\{}{} +% to declare commands of form \ as \{} for each +% of the specfied letters +% +% E.g. \makealiasesforwith\mathcal{c}{ABC} will declare +% \cA \cB \cC \cD as \mathcal{A}, \mathcal{B}, \mathcal{C} +% This is also ensuring math context, so that +% \cA will be valid even in normal text. + +\def\makealiasesforwith#1#2#3{ + \def__PACKAGE_MACRO__(makealias)##1{ + \expandafter\def\csname #2##1\endcsname{\ensuremath{#1{##1}}} + } + \def__PACKAGE_MACRO__(recurse)##1{ + \ifx##1__PACKAGE_MACRO__(dummy)\else + __PACKAGE_MACRO__(makealias){##1}\expandafter__PACKAGE_MACRO__(recurse)\fi + } + __PACKAGE_MACRO__(recurse) #3__PACKAGE_MACRO__(dummy) +} + +\def__PACKAGE_MACRO__(all){ABCDEFGHIJKLMNOPQRSTUVWXYZ} + +__IF__(basic) + \RequirePackage{amsfonts} + \makealiasesforwith\mathbb{}{CFKNQRZ} +\fi + +__IF__(extended) + \expandafter\makealiasesforwith\expandafter\mathcal\expandafter{\expandafter c\expandafter}\expandafter{__PACKAGE_MACRO__(all)} + \expandafter\makealiasesforwith\expandafter\mathfrak\expandafter{\expandafter f\expandafter}\expandafter{__PACKAGE_MACRO__(all)} +\fi diff --git a/math/mathalias.sty b/math/mathalias.sty deleted file mode 100644 index 6f73daf..0000000 --- a/math/mathalias.sty +++ /dev/null @@ -1,45 +0,0 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mkessler-mathalias}[2021/09/09 Easy aliasing for math style commands] - -%%%%%% - -\newif\ifmkessler@mathalias@basic\mkessler@mathalias@basicfalse -\DeclareOption{basic}{\mkessler@mathalias@basictrue} - -\newif\ifmkessler@mathalias@extended\mkessler@mathalias@extendedfalse -\DeclareOption{extended}{\mkessler@mathalias@extendedtrue\mkessler@mathalias@basictrue} - -\DeclareOption*{\PackageWarning{mkessler-mathalias}{Unknown '\CurrentOption'}} -\ProcessOptions\relax - -%Usage: \makealiasesforwith\{}{} -% to declare commands of form \ as \{} for each -% of the specfied letters -% -% E.g. \makealiasesforwith\mathcal{c}{ABC} will declare -% \cA \cB \cC \cD as \mathcal{A}, \mathcal{B}, \mathcal{C} -% This is also ensuring math context, so that -% \cA will be valid even in normal text. - -\def\makealiasesforwith#1#2#3{ - \def\mkessler@aliases@makealias##1{ - \expandafter\def\csname #2##1\endcsname{\ensuremath{#1{##1}}} - } - \def\mkessler@aliases@recurse##1{ - \ifx##1\mkessler@dummy\else - \mkessler@aliases@makealias{##1}\expandafter\mkessler@aliases@recurse\fi - } - \mkessler@aliases@recurse #3\mkessler@dummy -} - -\def\mkessler@mathalias@all{ABCDEFGHIJKLMNOPQRSTUVWXYZ} - -\ifmkessler@mathalias@basic - \RequirePackage{amsfonts} - \makealiasesforwith\mathbb{}{CFKNQRZ} -\fi - -\ifmkessler@mathalias@extended - \expandafter\makealiasesforwith\expandafter\mathcal\expandafter{\expandafter c\expandafter}\expandafter{\mkessler@mathalias@all} - \expandafter\makealiasesforwith\expandafter\mathfrak\expandafter{\expandafter f\expandafter}\expandafter{\mkessler@mathalias@all} -\fi diff --git a/math/mathfig.sty b/math/mathfig.pysty similarity index 85% rename from math/mathfig.sty rename to math/mathfig.pysty index 9fbe017..849f129 100644 --- a/math/mathfig.sty +++ b/math/mathfig.pysty @@ -1,7 +1,4 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mkessler-mathfig}[2021/03/31 - Math figures with TikZ / pgfplots / xy] - -%%%%%%%% +__HEADER__(Math figures with TikZ / pgfplots / xy) % This is just a collection of the packages I use to typeset mathematical figures % most commonly plots, commutative diagrams or geometry diff --git a/math/mathfixes.pysty b/math/mathfixes.pysty new file mode 100644 index 0000000..88683ce --- /dev/null +++ b/math/mathfixes.pysty @@ -0,0 +1,36 @@ +__HEADER__(Hacky math packages for some (custom) fixes) +% This just brings together some (possibly ugly) hacks that I use when writing math. Likely, you do not want to use this except when building around this package (like I did), or already have similar shortcuts + +%Proper Degree command +\def__PACKAGE_MACRO__(degree){\ensuremath{^\circ}} +\AtBeginDocument{\let\degree__PACKAGE_MACRO__(degree)} + +% Always put limits under \limit +\let\oldlim\lim\def\lim{\oldlim\limits} + +% Print equal sign under subset by default to not confuse people +% (I still write \subset, because this enables me remove this renewcommand and have the default \subset command evaluated instead +\let__PACKAGE_MACRO__(subseteq)\subseteq +\let__PACKAGE_MACRO__(supseteq)\supseteq +\AtBeginDocument{ + \let\subset__PACKAGE_MACRO__(subseteq) + \let\supset__PACKAGE_MACRO__(supseteq) +} + +%%Renew phi and epsilon to their proper versions, make the old ones available as +% uglyphi and uglyepsilon + +\let__PACKAGE_MACRO__(stored@phi)\phi +\let__PACKAGE_MACRO__(stored@varphi)\varphi +\AtBeginDocument{ + \let\phi__PACKAGE_MACRO__(stored@varphi) + \let\uglyphi__PACKAGE_MACRO__(stored@phi) + \let\oldphi__PACKAGE_MACRO__(stored@phi) +} + +\let__PACKAGE_MACRO__(stored@epsilon)\epsilon +\let__PACKAGE_MACRO__(stored@varepsilon)\varepsilon +\AtBeginDocument{ + \let\epsilon__PACKAGE_MACRO__(stored@varepsilon) + \let\uglyepsilon__PACKAGE_MACRO__(stored@epsilon) +} diff --git a/math/mathfixes.sty b/math/mathfixes.sty deleted file mode 100644 index cbf80e5..0000000 --- a/math/mathfixes.sty +++ /dev/null @@ -1,39 +0,0 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mkessler-mathfixes}[2021-04-27 - Hacky math packages for some (custom) fixes] -%%%%% - -% This just brings together some (possibly ugly) hacks that I use when writing math. Likely, you do not want to use this except when building around this package (like I did), or already have similar shortcuts - -%Proper Degree command -\def\mkessler@mathfixes@degree{\ensuremath{^\circ}} -\AtBeginDocument{\let\degree\mkessler@mathfixes@degree} - -% Always put limits under \limit -\let\oldlim\lim\def\lim{\oldlim\limits} - -% Print equal sign under subset by default to not confuse people -% (I still write \subset, because this enables me remove this renewcommand and have the default \subset command evaluated instead -\let\mkessler@mathfixes@subseteq\subseteq -\let\mkessler@mathfixes@supseteq\supseteq -\AtBeginDocument{ - \let\subset\mkessler@mathfixes@subseteq - \let\supset\mkessler@mathfixes@supseteq -} - -%%Renew phi and epsilon to their proper versions, make the old ones available as -% uglyphi and uglyepsilon - -\let\mkessler@mathfixes@stored@phi\phi -\let\mkessler@mathfixes@stored@varphi\varphi -\AtBeginDocument{ - \let\phi\mkessler@mathfixes@stored@varphi - \let\uglyphi\mkessler@mathfixes@stored@phi - \let\oldphi\mkessler@mathfixes@stored@phi -} - -\let\mkessler@mathfixes@stored@epsilon\epsilon -\let\mkessler@mathfixes@stored@varepsilon\varepsilon -\AtBeginDocument{ - \let\epsilon\mkessler@mathfixes@stored@varepsilon - \let\uglyepsilon\mkessler@mathfixes@stored@epsilon -} diff --git a/math/mathfont.pysty b/math/mathfont.pysty new file mode 100644 index 0000000..9f8d9ec --- /dev/null +++ b/math/mathfont.pysty @@ -0,0 +1,24 @@ +__HEADER__(Collects several math fonts together) +%%% Store away the several (partially conflicting) fonts in internal macros + +\let__PACKAGE_MACRO__(none@mathcal)\mathcal + +\RequirePackage{mathrsfs} +\let__PACKAGE_MACRO__(mathrsfs@mathscr)\mathscr + +\RequirePackage[mathscr]{eucal} +\let__PACKAGE_MACRO__(eucal@optionmathscr@mathscr)\mathscr + +\RequirePackage{amsfonts} +\let__PACKAGE_MACRO__(amsfonts@mathfrak)\mathfrak + +%%% Provide user commands to internally stored macros +\def__PACKAGE_MACRO__(restorefonts){ + \let\mathcal__PACKAGE_MACRO__(none@mathcal) % Set \mathcal to default calligrapic + \let\mathfrak__PACKAGE_MACRO__(amsfonts@mathfrak) % Set \mathfrak to mathfrak from amsfonts + \let\mathscr__PACKAGE_MACRO__(mathrsfs@mathscr) % Set \mathscr to mathscript from mathrsfs package + \let\mathcat__PACKAGE_MACRO__(mathrsfs@mathscr) % Set \mathcat to mathscript from mathrsfs package + \let\mathcalo__PACKAGE_MACRO__(eucal@optionmathscr@mathscr) % Set \mathcom (for comic) to \mathscr from [mathscr]{eucal} package +} + +\AtBeginDocument{__PACKAGE_MACRO__(restorefonts)} diff --git a/math/mathfont.sty b/math/mathfont.sty deleted file mode 100644 index 69ad8f7..0000000 --- a/math/mathfont.sty +++ /dev/null @@ -1,27 +0,0 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mkessler-mathfont}[2021/09/06 - Collects several math fonts together] - - -%%% Store away the several (partially conflicting) fonts in internal macros - -\let\mkessler@mathfonts@none@mathcal\mathcal - -\RequirePackage{mathrsfs} -\let\mkessler@mathfonts@mathrsfs@mathscr\mathscr - -\RequirePackage[mathscr]{eucal} -\let\mkessler@mathfonts@eucal@optionmathscr@mathscr\mathscr - -\RequirePackage{amsfonts} -\let\mkessler@mathfonts@amsfonts@mathfrak\mathfrak - -%%% Provide user commands to internally stored macros -\def\mkessler@mathfonts@restorefonts{ - \let\mathcal\mkessler@mathfonts@none@mathcal % Set \mathcal to default calligrapic - \let\mathfrak\mkessler@mathfonts@amsfonts@mathfrak % Set \mathfrak to mathfrak from amsfonts - \let\mathscr\mkessler@mathfonts@mathrsfs@mathscr % Set \mathscr to mathscript from mathrsfs package - \let\mathcat\mkessler@mathfonts@mathrsfs@mathscr % Set \mathcat to mathscript from mathrsfs package - \let\mathcalo\mkessler@mathfonts@eucal@optionmathscr@mathscr % Set \mathcom (for comic) to \mathscr from [mathscr]{eucal} package -} - -\AtBeginDocument{\mkessler@mathfonts@restorefonts} diff --git a/math/mathop.sty b/math/mathop.pysty similarity index 72% rename from math/mathop.sty rename to math/mathop.pysty index f0d4b30..7bd8337 100644 --- a/math/mathop.sty +++ b/math/mathop.pysty @@ -1,13 +1,9 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mkessler-mathop}[2021-04-27 - Operator Package] -%%%%%%%%%%%%%%%%% +__HEADER__(Math Operator Package) %Provides some commonly used Operators used in the write-ups of my lecture notes -\newif\if@mkessler@operators@english\@mkessler@operators@englishtrue -\DeclareOption{german}{\@mkessler@operators@englishfalse} -\DeclareOption{english}{\@mkessler@operators@englishtrue} -\DeclareOption*{\PackageWarning{mkessler-operators}{Unknown '\CurrentOption'}} -\ProcessOptions\relax +__LANGUAGE_OPTIONS__ + +__END_OPTIONS__ %%%%%Package dependencies \RequirePackage{amsmath} @@ -23,15 +19,15 @@ %%%For distributions %Introduce synonym for \operatorname -\newcommand\mkessler@operators@distribution[1]{\operatorname{#1}} +\newcommand__PACKAGE_MACRO__(distribution)[1]{\operatorname{#1}} %Easily declare new distributions -\newcommand\DeclareDistribution[1]{\expandafter\def\csname #1\endcsname{\mkessler@operators@distribution{#1}}} +\newcommand\DeclareDistribution[1]{\expandafter\def\csname #1\endcsname{__PACKAGE_MACRO__(distribution){#1}}} %%%For categories %Introduce synonym for \operatorname -\newcommand\mkessler@operators@category[1]{\operatorname{\textbf{#1}}} +\newcommand__PACKAGE_MACRO__(category)[1]{\operatorname{\textbf{#1}}} %Easily declare new categories -\newcommand\DeclareCategory[1]{\expandafter\def\csname #1\endcsname{\mkessler@operators@category{#1}}} +\newcommand\DeclareCategory[1]{\expandafter\def\csname #1\endcsname{__PACKAGE_MACRO__(category){#1}}} %%%%%%%%%%% Operators @@ -51,27 +47,27 @@ % \lcm would print 'kgV' % The starred versions of the four commands will ignore the language option and print their % exact names (without the *, of course) -\DeclareMathOperator{\@mkessler@operators@ggT}{ggT} -\DeclareMathOperator{\@@mkessler@operators@ggT}{\if@mkessler@operators@english gcd\else ggT\fi} -\def\ggT{\@ifstar\@mkessler@operators@ggT\@@mkessler@operators@ggT} +\DeclareMathOperator{\@__PACKAGE_PREFIX__ggT}{ggT} +\DeclareMathOperator{\@@__PACKAGE_PREFIX__ggT}{\if@__PACKAGE_PREFIX__english gcd\else ggT\fi} +\def\ggT{\@ifstar\@__PACKAGE_PREFIX__ggT\@@__PACKAGE_PREFIX__ggT} -\DeclareMathOperator{\@mkessler@operators@gcd}{gcd} -\DeclareMathOperator{\@@mkessler@operators@gcd}{\if@mkessler@operators@english gcd\else ggT\fi} -\def\gcd{\@ifstar\@mkessler@operators@gcd\@@mkessler@operators@gcd} +\DeclareMathOperator{\@__PACKAGE_PREFIX__gcd}{gcd} +\DeclareMathOperator{\@@__PACKAGE_PREFIX__gcd}{\if@__PACKAGE_PREFIX__english gcd\else ggT\fi} +\def\gcd{\@ifstar\@__PACKAGE_PREFIX__gcd\@@__PACKAGE_PREFIX__gcd} -\DeclareMathOperator{\@mkessler@operators@kgV}{kgV} -\DeclareMathOperator{\@@mkessler@operators@kgV}{\if@mkessler@operators@english lcm\else kgV\fi} -\def\kgV{\@ifstar\@mkessler@operators@kgV\@@mkessler@operators@kgV} +\DeclareMathOperator{\@__PACKAGE_PREFIX__kgV}{kgV} +\DeclareMathOperator{\@@__PACKAGE_PREFIX__kgV}{\if@__PACKAGE_PREFIX__english lcm\else kgV\fi} +\def\kgV{\@ifstar\@__PACKAGE_PREFIX__kgV\@@__PACKAGE_PREFIX__kgV} -\DeclareMathOperator{\@mkessler@operators@lcm}{lcm} -\DeclareMathOperator{\@@mkessler@operators@lcm}{\if@mkessler@operators@english lcm\else kgV\fi} -\def\lcm{\@ifstar\@mkessler@operators@lcm\@@mkessler@operators@lcm} +\DeclareMathOperator{\@__PACKAGE_PREFIX__lcm}{lcm} +\DeclareMathOperator{\@@__PACKAGE_PREFIX__lcm}{\if@__PACKAGE_PREFIX__english lcm\else kgV\fi} +\def\lcm{\@ifstar\@__PACKAGE_PREFIX__lcm\@@__PACKAGE_PREFIX__lcm} %Complex numbers -\DeclareMathOperator{\mkessler@impart}{Im} -\renewcommand\Im\mkessler@impart -\DeclareMathOperator{\mkessler@repart}{Re} -\renewcommand\Re\mkessler@impart +\DeclareMathOperator{__PACKAGE_MACRO__(impart)}{Im} +\renewcommand\Im__PACKAGE_MACRO__(impart) +\DeclareMathOperator{__PACKAGE_MACRO__(repart)}{Re} +\renewcommand\Re__PACKAGE_MACRO__(repart) %Linear Algebra \DeclareSimpleMathOperator{Sym} diff --git a/math/mathsymb.sty b/math/mathsymb.pysty similarity index 90% rename from math/mathsymb.sty rename to math/mathsymb.pysty index 2f48cc3..372ec07 100644 --- a/math/mathsymb.sty +++ b/math/mathsymb.pysty @@ -1,15 +1,9 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mkessler-mathsymb}[2021-09-06 - Some extra math-related symbols] - -%%%%%%%%%%%%%%%%%% +__HEADER__(Some extra math-related symbols.) % A collection of math-related symbols / tools I often use, mainly collected together from Stack Overflow or hacked together myself - %Dependencies \RequirePackage{tikz} - - % noloc command by % user 'egreg' (https://tex.stackexchange.com/users/4427/egreg) % posted on diff --git a/math/unicodechar.sty b/math/unicodechar.pysty similarity index 88% rename from math/unicodechar.sty rename to math/unicodechar.pysty index c3448eb..303fc69 100644 --- a/math/unicodechar.sty +++ b/math/unicodechar.pysty @@ -1,8 +1,4 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mkessler-unicodechar}[2021/09/08 - Wrapper for the newunicodchar package with defined unicode symbols] - -%%%%%%%% - +__HEADER__(Wrapper for the newunicodechare package with some defined unicode symbols.) % This is just a simple package loading the newunicodechar package and defining the common unicode symbols i regularly use for typesetting mathematics \RequirePackage{newunicodechar} From 147229261ebb286ef9aada00787b28a14cec544b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Wed, 6 Oct 2021 20:46:27 +0200 Subject: [PATCH 06/36] more pysty packages --- .../{mkessler-lectures.sty => lectures.pysty} | 38 +++++++++---------- .../{mkessler-script.cls => script.cls} | 0 utils/counters.pysty | 13 +++++++ ...sler-findpackage.sty => findpackage.pysty} | 6 +-- utils/mkessler-counters.sty | 14 ------- 5 files changed, 31 insertions(+), 40 deletions(-) rename lecture-notes/{mkessler-lectures.sty => lectures.pysty} (74%) rename lecture-notes/{mkessler-script.cls => script.cls} (100%) create mode 100644 utils/counters.pysty rename utils/{mkessler-findpackage.sty => findpackage.pysty} (93%) delete mode 100644 utils/mkessler-counters.sty diff --git a/lecture-notes/mkessler-lectures.sty b/lecture-notes/lectures.pysty similarity index 74% rename from lecture-notes/mkessler-lectures.sty rename to lecture-notes/lectures.pysty index 2313700..393ca7b 100644 --- a/lecture-notes/mkessler-lectures.sty +++ b/lecture-notes/lectures.pysty @@ -1,7 +1,4 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mkessler-lectures}[2021-09-06 - Package for managing different lectures within a document] - -%%%%%%%%%%%%%%%%%% +__HEADER__(Package for managing different lectures within a document) % The core of the lecture command this package provides has been taken from the preamble in % https://github.com/gillescastel/university-setup % which is licensed under @@ -29,21 +26,20 @@ %SOFTWARE. % This package extends the lecture command to make a summary of lectures at the beginning of a document, and has thus modified this command. -\newif\ifenglish\englishtrue -\DeclareOption{german}{\englishfalse} -\DeclareOption{english}{\englishtrue} +\RequirePackage{xkeyval} -\newif\iffancyhead\fancyheadfalse -\DeclareOption{fancyhead}{\fancyheadtrue} +__LANGUAGE_OPTIONS__ -\DeclareOption*{\PackageWarning{mkessler-lectures}{Unknown '\CurrentOption'}} -\ProcessOptions\relax +__NEW_IF__(fancyhead,false) +\DeclareOptionX{fancyhead}{__SET_IF__(fancyhead,true)} + +__END_OPTIONS_X__ %Tocloft package for making a list of lectures \RequirePackage{tocloft} %Store name of the summary in a command to use it multiple times -\newcommand\listlecturename{\ifenglish Summary of lectures\else Übersicht der Vorlesungen\fi} -\newlistof{lecture}{lec}{\listlecturename} % Declare new list of lectures +\newcommand__PACKAGE_MACRO__(listlecturename){__IF__(english) Summary of lectures\else Übersicht der Vorlesungen\fi} +\newlistof{lecture}{lec}{__PACKAGE_MACRO__(listlecturename)} % Declare new list of lectures %Settings how to print the summary \renewcommand{\cftdot}{} \renewcommand\cftlecturefont{\normalfont\bfseries} @@ -59,19 +55,19 @@ } %Define the main lecture command to start a new lecture -\def\@lectureprefix{\ifenglish Lecture\else Vorlesung\fi} +\def__PACKAGE_MACRO__(lectureprefix){__IF__(english) Lecture\else Vorlesung\fi} \def\@lecture{}% \newcommand{\lecture}[3][]{ \refstepcounter{lecture} %Store lecture name in the macro \@lecture \ifthenelse{\isempty{#3}}{% - \def\@lecture{\@lectureprefix\, \thelecture}% + \def\@lecture{__PACKAGE_MACRO__(lectureprefix)\, \thelecture}% }{% - \def\@lecture{\@lectureprefix\, \thelecture: #3}% + \def\@lecture{__PACKAGE_MACRO__(lectureprefix)\, \thelecture: #3}% }% - \marginpar{\small\textsf{\parbox{10em}{\@lectureprefix\, \thelecture \\#2}}} + \marginpar{\small\textsf{\parbox{10em}{__PACKAGE_MACRO__(lectureprefix)\, \thelecture \\#2}}} %Add lecture as an entry to the lectures file - \addcontentsline{lec}{lecture}{\@lectureprefix\,\thelecture\,(#2)} + \addcontentsline{lec}{lecture}{__PACKAGE_MACRO__(lectureprefix)\,\thelecture\,(#2)} %If key words are provided, add the key words of the lecture below the entry \ifthenelse{\isempty{#1}}{}{\addtocontents{lec}{\smallskip\hspace{1.5em}\protect\parbox{\dimexpr\textwidth-\@pnumwidth - 2em}{#1}}} } @@ -79,7 +75,7 @@ %Provide a command to show the summary of lectures \DeclareRobustCommand*{\summaryoflectures}{ \phantomsection - \addcontentsline{toc}{section}{\listlecturename} + \addcontentsline{toc}{section}{__PACKAGE_MACRO__(listlecturename)} \thispagestyle{plain} \listoflecture } @@ -97,9 +93,9 @@ \fancyhead[RE,LO]{} % Right even, Left odd %%No fancy headers in the appendix (as there is no lecture) - \let\mkesslerlecturesoldappendix\appendix + \let__PACKAGE_MACRO__(stored@appendix)\appendix \renewcommand\appendix{ - \mkesslerlecturesoldappendix + __PACKAGE_MACRO__(stored@appendix) \fancyhead[RO,LE]{} \renewcommand{\headrulewidth}{0pt} } diff --git a/lecture-notes/mkessler-script.cls b/lecture-notes/script.cls similarity index 100% rename from lecture-notes/mkessler-script.cls rename to lecture-notes/script.cls diff --git a/utils/counters.pysty b/utils/counters.pysty new file mode 100644 index 0000000..8478335 --- /dev/null +++ b/utils/counters.pysty @@ -0,0 +1,13 @@ +__HEADER__(Write LaTeX counters to auxiliary file) + +\RequirePackage{etoolbox} + +\newwrite__PACKAGE_MACRO__(out) +\immediate\openout__PACKAGE_MACRO__(out)\jobname.cnt\relax +\AtBeginDocument{ + \let__PACKAGE_MACRO__(saved@stepcounter)\stepcounter + \def\stepcounter#1{ + __PACKAGE_MACRO__(saved@stepcounter){#1} + \immediate\write__PACKAGE_MACRO__(out){#1: \csname the#1\endcsname}} +} + diff --git a/utils/mkessler-findpackage.sty b/utils/findpackage.pysty similarity index 93% rename from utils/mkessler-findpackage.sty rename to utils/findpackage.pysty index a1c89b3..a999f35 100644 --- a/utils/mkessler-findpackage.sty +++ b/utils/findpackage.pysty @@ -1,8 +1,4 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mkessler-findpackage}[2021-09-06 - Find a package that provides some command] - - -%%%% +__HEADER__(Find a package that provides some command) % This is just a quick packaging of the post by % 'Martin Nyolt' (https://tex.stackexchange.com/users/78783/martin-nyolt) % found at diff --git a/utils/mkessler-counters.sty b/utils/mkessler-counters.sty deleted file mode 100644 index 3341e4d..0000000 --- a/utils/mkessler-counters.sty +++ /dev/null @@ -1,14 +0,0 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mkessler-counters}[2021-09-06 - Write counters to auxiliary file] - -\RequirePackage{etoolbox} - -\newwrite\mkessler@counters@out -\immediate\openout\mkessler@counters@out\jobname.cnt\relax -\AtBeginDocument{ - \let\mkessler@counters@saved@stepcounter\stepcounter - \def\stepcounter#1{ - \mkessler@counters@saved@stepcounter{#1} - \immediate\write\mkessler@counters@out{#1: \csname the#1\endcsname}} -} - From c708f0025346819b9891cd47330142b1b3bdd3e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Wed, 6 Oct 2021 21:01:04 +0200 Subject: [PATCH 07/36] adjust fancythm to pytex --- .../{mkessler-fancythm.sty => fancythm.pysty} | 190 ++++++++++++------ environments/mkessler-fancythmoptions.sty | 84 -------- ...mkessler-thmstyle.sty => thmpystyle.pysty} | 17 +- 3 files changed, 138 insertions(+), 153 deletions(-) rename environments/{mkessler-fancythm.sty => fancythm.pysty} (52%) delete mode 100644 environments/mkessler-fancythmoptions.sty rename environments/{mkessler-thmstyle.sty => thmpystyle.pysty} (88%) diff --git a/environments/mkessler-fancythm.sty b/environments/fancythm.pysty similarity index 52% rename from environments/mkessler-fancythm.sty rename to environments/fancythm.pysty index 391d132..71fe56d 100644 --- a/environments/mkessler-fancythm.sty +++ b/environments/fancythm.pysty @@ -1,24 +1,94 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mkessler-fancythm}[2021/04/27 - Theorem-Environment Package] -%%%%%%%%m +__HEADER__(Theorem-Environment Package) %Provides fancy theorem-like-environments used in the write-ups of my lecture notes +__NEW_IF__(showstars,true) +__NEW_IF__(showdaggers,true) +__NEW_IF__(includestars,true) +__NEW_IF__(includeoral,true) +__NEW_IF__(markoral,true) -\RequirePackage{mkessler-fancythmoptions} % Internal preamble for option handling +__NEW_IF__(lecturenumbers,true) +__NEW_IF__(numbersmallenvironmentswiththeorem,false) +__NEW_IF__(numbersmallenvironments,false) +__NEW_IF__(defaulttheorems,true) + +\define@choicekey*{__PACKAGE_NAME__}{__PACKAGE_PREFIX__numbersmallenvironments}[\val\nr]{no,section,theorem}{% + \ifcase\nr\relax + __SET_IF__(numbersmallenvironments,false) + \or + __SET_IF__(numbersmallenvironments,true) + %numbering small environments within sections is forbidden whilst using lecturenumbes + __IF__(lecturenumbers) + __SET_IF__(numbersmallenvironmentswiththeorem,true) + \else + __SET_IF__(numbersmallenvironmentswiththeorem,false) + \fi + \or + __SET_IF__(numbersmallenvironments,true) + __SET_IF__(numbersmallenvironmentswiththeorem,true) + \fi +} + +\define@choicekey*{__PACKAGE_NAME__}{__PACKAGE_PREFIX__lecturenumbers}[\val\nr]{true,false}{% + \ifcase\nr\relax + __SET_IF__(lecturenumbers,true) + \else + __SET_IF__(lecturenumbers,false) + \fi +} + +\define@choicekey*{__PACKAGE_NAME__}{__PACKAGE_PREFIX__defaulttheorems}[\val\nr]{true,false}{% + \ifcase\nr\relax + __SET_IF__(defaulttheorems,true) + \else + __SET_IF__(defaulttheorems,false) + \fi +} + +\define@choicekey*{__PACKAGE_NAME__}{__PACKAGE_PREFIX__showdaggers}[\val\nr]{true,false}{% + \ifcase\nr\relax + __SET_IF__(showdaggers,true) + \else + __SET_IF__(showdaggers,false) + \fi +} + +\define@choicekey*{__PACKAGE_NAME__}{ownenvironments}[\val\nr]{on, natural, off}{% + \ifcase\nr\relax + __SET_IF__(includestars,true) + __SET_IF__(showstars,true) + \or + __SET_IF__(includestars,true) + __SET_IF__(showstars,false) + \or + __SET_IF__(includestars,false) + __SET_IF__(showstars,false) + \fi +} + +\define@choicekey*{__PACKAGE_NAME__}{oralremarks}[\val\nr]{on,natural,off}{% + \ifcase\nr\relax + __SET_IF__(includeoral,true) + __SET_IF__(markoral,true) + \or + __SET_IF__(includeoral,true) + __SET_IF__(markoral,true) + \or + __SET_IF__(includeoral,false) + \fi +} %%%%% Option section -\DeclareOptionX{english}{\mkessler@fancythm@englishtrue} -\DeclareOptionX{german}{\mkessler@fancythm@englishfalse} +__LANGUAGE_OPTIONS__ -\DeclareOptionX{showdaggers}{\setkeys{mkesslerfancythm}{mkessler@fancythm@showdaggers=#1}} -\DeclareOptionX{ownenvironments}{\setkeys{mkesslerfancythm}{ownenvironments=#1}} -\DeclareOptionX{oralremarks}{\setkeys{mkesslerfancythm}{oralremarks=#1}} +\DeclareOptionX{showdaggers}{\setkeys{__PACKAGE_NAME__}{__PACKAGE_PREFIX__showdaggers=#1}} +\DeclareOptionX{ownenvironments}{\setkeys{__PACKAGE_NAME__}{ownenvironments=#1}} +\DeclareOptionX{oralremarks}{\setkeys{__PACKAGE_NAME__}{oralremarks=#1}} -\DeclareOptionX{lecturenumbers}{\setkeys{mkesslerfancythm}{mkessler@fancythm@lecturenumbers=#1}} -\DeclareOptionX{numbersmallenvironments}{\setkeys{mkesslerfancythm}{mkessler@fancythm@numbersmallenvironments=#1}} +\DeclareOptionX{lecturenumbers}{\setkeys{__PACKAGE_NAME__}{__PACKAGE_PREFIX__lecturenumbers=#1}} +\DeclareOptionX{numbersmallenvironments}{\setkeys{__PACKAGE_NAME__}{__PACKAGE_PREFIX__numbersmallenvironments=#1}} -\DeclareOptionX*{\PackageWarning{mkesslerfancythm}{Unknown X \CurrentOption}}% For unknown options -\ProcessOptionsX*\relax +__END_OPTIONS_X__ %%%%%%%% Implementation section @@ -34,8 +104,8 @@ \tcbuselibrary{breakable} % Dummy counters -\declaretheorem[numberwithin=section]{mkessler@fancythm@dummy} -\declaretheorem[numberwithin=mkessler@fancythm@dummy]{mkessler@fancythm@smalldummy} +\declaretheorem[numberwithin=section]{__PACKAGE_PREFIX__dummy} +\declaretheorem[numberwithin=__PACKAGE_PREFIX__dummy]{__PACKAGE_PREFIX__smalldummy} %%%%% Main part, i.e. providing macros for defining new theorems @@ -48,68 +118,68 @@ \NewDocumentCommand{\declarebigtheorem}{O{} O{} m m O{}}{ %First, store the name of the theorem in \theoremname - \ifmkessler@fancythm@english + \if__PACKAGE_PREFIX__english \ifthenelse{\isempty{#2}}{\def\theoremname{#4}}{\def\theoremname{#2}} \else \ifthenelse{\isempty{#1}}{\def\theoremname{#4}}{\def\theoremname{#1}} \fi %Define the mane version of the theorem - \ifthenelse{\isempty{#5}}{\declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}, sibling = mkessler@fancythm@dummy]{#4}}{} + \ifthenelse{\isempty{#5}}{\declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}, sibling = __PACKAGE_PREFIX__dummy]{#4}}{} %Define the versions theorem*, theorem**, dtheorem - \ifmkessler@fancythm@lecturenumbers - \ifmkessler@fancythm@numbersmallenvironments - \declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}, sibling=mkessler@fancythm@smalldummy]{#4*} - \declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}\ifmkessler@fancythm@showstars *\else\fi, sibling=mkessler@fancythm@smalldummy]{#4**} - \declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}\ifmkessler@fancythm@showdaggers $^{\dagger}$\else\fi, sibling=mkessler@fancythm@smalldummy]{d#4} + \if__PACKAGE_PREFIX__lecturenumbers + \if__PACKAGE_PREFIX__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} \else \declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}, numbered=no]{#4*} - \declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}\ifmkessler@fancythm@showstars *\else\fi, numbered = no]{#4**} - \declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}\ifmkessler@fancythm@showdaggers $^{\dagger}$\else\fi, numbered = no]{d#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} \fi \else - \declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}, sibling=mkessler@fancythm@dummy]{#4*} - \declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}\ifmkessler@fancythm@showstars *\else\fi, sibling=mkessler@fancythm@dummy]{#4**} - \declaretheorem[style = #3, name = \makefirstuc{\expandafter\theoremname}\ifmkessler@fancythm@showdaggers $^{\dagger}$\else\fi, sibling=mkessler@fancythm@dummy]{d#4} + \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} \fi - \ifmkessler@fancythm@includestars\else\renewenvironment{#4**}{\comment}{\endcomment}\fi + \if__PACKAGE_PREFIX__includestars\else\renewenvironment{#4**}{\comment}{\endcomment}\fi } \NewDocumentCommand{\declaresmalltheorem}{O{} O{} m m}{ %Get the name of the theorem and store it in \theoremname - \ifmkessler@fancythm@english + \if__PACKAGE_PREFIX__english \ifthenelse{\isempty{#2}}{\def\theoremname{#4}}{\def\theoremname{#2}} \else \ifthenelse{\isempty{#1}}{\def\theoremname{#4}}{\def\theoremname{#1}} \fi - \ifmkessler@fancythm@numbersmallenvironments - \ifmkessler@fancythm@numbersmallenvironmentswiththeorem - \declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}, sibling = mkessler@fancythm@smalldummy]{#4} - \declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}\ifmkessler@fancythm@showstars *\else\fi, sibling=mkessler@fancythm@smalldummy]{#4*} - \declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}\ifmkessler@fancythm@showdaggers $^{\dagger}$\else\fi, sibling=mkessler@fancythm@smalldummy]{d#4} + \if__PACKAGE_PREFIX__numbersmallenvironments + \if__PACKAGE_PREFIX__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} \else - \declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}, sibling=mkessler@fancythm@dummy]{#4} - \declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}\ifmkessler@fancythm@showstars *\else\fi, sibling=mkessler@fancythm@dummy]{#4*} - \declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}\ifmkessler@fancythm@showdaggers $^{\dagger}$\else\fi, sibling=mkessler@fancythm@dummy]{d#4} + \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} \fi \else \declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}, numbered = no]{#4} - \declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}\ifmkessler@fancythm@showstars *\else\fi, numbered = no]{#4*} - \declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}\ifmkessler@fancythm@showdaggers $^{\dagger}$\else\fi, numbered = no]{d#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} \fi - \declaretheorem[style=#3,name=\makefirstuc{\expandafter\theoremname}, sibling=mkessler@fancythm@dummy]{n#4} - \ifmkessler@fancythm@includestars\else\renewenvironment{#4*}{\comment}{\endcomment}\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 requested, now define some default theoremstyles -\ifmkessler@fancythm@defaulttheorems +\if__PACKAGE_PREFIX__defaulttheorems \RequirePackage[default styles]{mkessler-thmstyle} % Easy setup of mdframed styles - \declarebigtheorem[Satz][Theorem]{thmredmarginandfill}{theorem} \ifmkessler@fancythm@english\else\AtBeginDocument{\def\theoremautorefname{Satz}}\fi + \declarebigtheorem[Satz][Theorem]{thmredmarginandfill}{theorem} \if__PACKAGE_PREFIX__english\else\AtBeginDocument{\def\theoremautorefname{Satz}}\fi \declarebigtheorem{thmredmarginandfill}{proposition} \declarebigtheorem[Korollar]{thmredmarginandfill}{corollary} \declarebigtheorem{thmorangemarginandfill}{lemma} @@ -121,7 +191,7 @@ \declarebigtheorem[zuSatz][Addition to Theorem]{thmredmarginandfill}{additiontheorem} %%%Environments that are not numbered by default (notation, question, example, remark etc) have two forms: - % - normal form: won't be numbered unless 'mkessler@fancythm@numbersmallenvironments' is set + % - normal form: won't be numbered unless '__PACKAGE_PREFIX__numbersmallenvironments' is set % - having an asterisk: will be displayed with an asterisk, will be numbered if 'numbersmallenvironments' is set %Notation @@ -136,9 +206,9 @@ %%%% Specially treated stuff - \declaresmalltheorem[\ifmkessler@fancythm@markoral Mündliche Anmerkung\else Bemerkung\fi][\ifmkessler@fancythm@markoral Oral remark\else remark\fi]{thmyellowmargin}{oral} + \declaresmalltheorem[\if__PACKAGE_PREFIX__markoral Mündliche Anmerkung\else Bemerkung\fi][\if__PACKAGE_PREFIX__markoral Oral remark\else remark\fi]{thmyellowmargin}{oral} % Option to remove oral remarks when needed - \ifmkessler@fancythm@includeoral\else + \if__PACKAGE_PREFIX__includeoral\else \renewenvironment{oral}{\comment}{\endcomment} \renewenvironment{oral*}{\comment}{\endcomment} \renewenvironment{doral}{\comment}{\endcomment} @@ -168,26 +238,26 @@ %%%%%%%%%%%% Non-mdframed theorems \theoremstyle{plain} - \newtheorem{variant}{\ifmkessler@fancythm@english Variant\else Variante\fi} - \newtheorem{assumption}{\ifmkessler@fancythm@english Assumption\else Annahme\fi} + \newtheorem{variant}{\if__PACKAGE_PREFIX__english Variant\else Variante\fi} + \newtheorem{assumption}{\if__PACKAGE_PREFIX__english Assumption\else Annahme\fi} \theoremstyle{definition} - \newtheorem*{note}{\ifmkessler@fancythm@english Note\else Anmerkung\fi} - \newtheorem*{warning}{\color{red}\ifmkessler@fancythm@english Warning \else Warnung\fi} - \newtheorem*{goal}{\ifmkessler@fancythm@english Goal \else Ziel\fi} - \newtheorem*{strategy}{\ifmkessler@fancythm@english Proof Strategy \else Beweisstrategie\fi} - \newtheorem*{goal*}{\ifmkessler@fancythm@english Goal* \else Ziel*\fi} + \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*{problem}{Problem} \newtheorem*{info}{Information} - \newtheorem*{answer}{\ifmkessler@fancythm@english Answer\else Antwort\fi} - \newtheorem{observe}[theorem]{\ifmkessler@fancythm@english Observe\else Beobachte\fi} - \newtheorem*{property}{\ifmkessler@fancythm@english Property\else Eigenschaft\fi} + \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*{intuition}{Intuition} - \newtheorem*{recall}{\ifmkessler@fancythm@english Recall\else Erinnerung\fi} - \newtheorem*{idea}{\ifmkessler@fancythm@english Idea\else Idee\fi} - \newtheorem{exercise}{\ifmkessler@fancythm@english Exercise\else Aufgabe\fi}[section] - \newtheorem{reminder}{\ifmkessler@fancythm@english Reminder\else Erinnerung\fi} + \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} \fi % end of default theorems diff --git a/environments/mkessler-fancythmoptions.sty b/environments/mkessler-fancythmoptions.sty deleted file mode 100644 index 13036a7..0000000 --- a/environments/mkessler-fancythmoptions.sty +++ /dev/null @@ -1,84 +0,0 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mkessler-fancythmoptions} - -\RequirePackage{xkeyval} - -%%%%% This is an internal base class, do not import this yourself -%% This will just be imported by fancythm for easy options use -\newif\ifmkessler@fancythm@english\mkessler@fancythm@englishtrue -\newif\ifmkessler@fancythm@showstars\mkessler@fancythm@showstarstrue -\newif\ifmkessler@fancythm@showdaggers\mkessler@fancythm@showdaggerstrue -\newif\ifmkessler@fancythm@includestars\mkessler@fancythm@includestarstrue -\newif\ifmkessler@fancythm@includeoral\mkessler@fancythm@includeoraltrue -\newif\ifmkessler@fancythm@markoral\mkessler@fancythm@markoraltrue - -\newif\ifmkessler@fancythm@lecturenumbers\mkessler@fancythm@lecturenumberstrue -\newif\ifmkessler@fancythm@numbersmallenvironmentswiththeorem\mkessler@fancythm@numbersmallenvironmentswiththeoremfalse -\newif\ifmkessler@fancythm@numbersmallenvironments\mkessler@fancythm@numbersmallenvironmentsfalse -\newif\ifmkessler@fancythm@defaulttheorems\mkessler@fancythm@defaulttheoremstrue - -\define@choicekey*{mkesslerfancythm}{mkessler@fancythm@numbersmallenvironments}[\val\nr]{no,section,theorem}{% - \ifcase\nr\relax - \mkessler@fancythm@numbersmallenvironmentsfalse - \or - \mkessler@fancythm@numbersmallenvironmentstrue - %numbering small environments within sections is forbidden whilst using lecturenumbes - \ifmkessler@fancythm@lecturenumbers - \mkessler@fancythm@numbersmallenvironmentswiththeoremtrue - \else - \mkessler@fancythm@numbersmallenvironmentswiththeoremfalse - \fi - \or - \mkessler@fancythm@numbersmallenvironmentstrue - \mkessler@fancythm@numbersmallenvironmentswiththeoremtrue - \fi -} - -\define@choicekey*{mkesslerfancythm}{mkessler@fancythm@lecturenumbers}[\val\nr]{true,false}{% - \ifcase\nr\relax - \mkessler@fancythm@lecturenumberstrue - \else - \mkessler@fancythm@lecturenumbersfalse - \fi -} - -\define@choicekey*{mkesslerfancythm}{mkessler@fancythm@defaulttheorems}[\val\nr]{true,false}{% - \ifcase\nr\relax - \mkessler@fancythm@defaulttheoremstrue - \else - \mkessler@fancythm@defaulttheoremsfalse - \fi -} - -\define@choicekey*{mkesslerfancythm}{mkessler@fancythm@showdaggers}[\val\nr]{true,false}{% - \ifcase\nr\relax - \mkessler@fancythm@showdaggerstrue - \else - \mkessler@fancythm@showdaggersfalse - \fi -} - -\define@choicekey*{mkesslerfancythm}{ownenvironments}[\val\nr]{on, natural, off}{% - \ifcase\nr\relax - \mkessler@fancythm@includestarstrue - \mkessler@fancythm@showstarstrue - \or - \mkessler@fancythm@includestarstrue - \mkessler@fancythm@showstarsfalse - \or - \mkessler@fancythm@includestarsfalse - \mkessler@fancythm@showstarsfalse - \fi -} - -\define@choicekey*{mkesslerfancythm}{oralremarks}[\val\nr]{on,natural,off}{% - \ifcase\nr\relax - \mkessler@fancythm@includeoraltrue - \mkessler@fancythm@markoraltrue - \or - \mkessler@fancythm@includeoraltrue - \mkessler@fancythm@markoralfalse - \or - \mkessler@fancythm@includeoralfalse - \fi -} diff --git a/environments/mkessler-thmstyle.sty b/environments/thmpystyle.pysty similarity index 88% rename from environments/mkessler-thmstyle.sty rename to environments/thmpystyle.pysty index 84d5295..72b79a2 100644 --- a/environments/mkessler-thmstyle.sty +++ b/environments/thmpystyle.pysty @@ -1,14 +1,13 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mkessler-thmstyle}[2021/09/09 - Styles used for fancythm] - +__HEADER__(Mdframed Styles used for fancythm package) %%%%% This provides easy-to-use styles, especially for use with the -% A simple option wether to define some default styles -\newif\ifmkessler@thmstyle@defaultstyles\mkessler@thmstyle@defaultstylesfalse -\DeclareOption{defaultstyles}{\mkessler@thmstyle@defaultstylestrue} +\RequirePackage{xkeyval} -\DeclareOption*{\PackageWarning{mkessler-thmstyle}{Unknown '\CurrentOption'}} -\ProcessOptions\relax +% A simple option wether to define some default styles +__NEW_IF__(defaultstyles,false) +\DeclareOptionX{defaultstyles}{__SET_IF__(defaultstyles,true)} + +__END_OPTIONS_X__ \RequirePackage{amsthm} \RequirePackage{thmtools} @@ -75,7 +74,7 @@ \fi } -\ifmkessler@thmstyle@defaultstyles +__IF__(defaultstyles) \declarefancythmstyle[red!8]{red}[thmredmarginandfill] \declarefancythmstyle[orange!10]{orange}[thmorangemarginandfill] \declarefancythmstyle[blue!7]{blue}[thmbluemarginandfill] From 8eb7992e2ecf0066ee69c09f0e69e6f12c164e20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Wed, 6 Oct 2021 21:03:26 +0200 Subject: [PATCH 08/36] add submodule pytex --- .gitmodules | 3 +++ PyTeX | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 PyTeX diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..662735b --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "PyTeX"] + path = PyTeX + url = https://github.com/kesslermaximilian/PyTeX.git diff --git a/PyTeX b/PyTeX new file mode 160000 index 0000000..a9af7d4 --- /dev/null +++ b/PyTeX @@ -0,0 +1 @@ +Subproject commit a9af7d4459379446077e694e1ff2aa2eed274797 From 1b442a50fdabcf3c97422508573e8be67a485562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Wed, 6 Oct 2021 23:10:06 +0200 Subject: [PATCH 09/36] move files to subdirectory --- PyTeX | 2 +- build.py | 17 +++++++ mkessler-hypersetup.sty | 26 ----------- mkessler-vocab.sty | 44 ------------------- .../environments}/fancythm.pysty | 0 .../environments}/thmpystyle.pysty | 0 packages/hypersetup.pysty | 22 ++++++++++ castel-incfig.sty => packages/incfig.pysty | 3 +- .../lecture-notes}/lectures.pysty | 0 .../lecture-notes}/script.cls | 0 {math => packages/math}/faktor.pysty | 0 {math => packages/math}/math.pysty | 0 {math => packages/math}/mathalias.pysty | 0 {math => packages/math}/mathfig.pysty | 0 {math => packages/math}/mathfixes.pysty | 0 {math => packages/math}/mathfont.pysty | 0 {math => packages/math}/mathop.pysty | 0 {math => packages/math}/mathsymb.pysty | 0 {math => packages/math}/unicodechar.pysty | 0 {utils => packages/utils}/counters.pysty | 0 {utils => packages/utils}/findpackage.pysty | 0 packages/vocab.pysty | 41 +++++++++++++++++ {wip => packages/wip}/bibliography.pysty | 0 {wip => packages/wip}/enumerate.pysty | 0 {wip => packages/wip}/exsheet.pysty | 0 {wip => packages/wip}/figures.pysty | 0 {wip => packages/wip}/gag.pysty | 0 {wip => packages/wip}/lang-input.pysty | 0 {wip => packages/wip}/proof.pysty | 0 {wip => packages/wip}/removed.pysty | 0 {wip => packages/wip}/restate.pysty | 0 31 files changed, 82 insertions(+), 73 deletions(-) create mode 100644 build.py delete mode 100644 mkessler-hypersetup.sty delete mode 100644 mkessler-vocab.sty rename {environments => packages/environments}/fancythm.pysty (100%) rename {environments => packages/environments}/thmpystyle.pysty (100%) create mode 100644 packages/hypersetup.pysty rename castel-incfig.sty => packages/incfig.pysty (93%) rename {lecture-notes => packages/lecture-notes}/lectures.pysty (100%) rename {lecture-notes => packages/lecture-notes}/script.cls (100%) rename {math => packages/math}/faktor.pysty (100%) rename {math => packages/math}/math.pysty (100%) rename {math => packages/math}/mathalias.pysty (100%) rename {math => packages/math}/mathfig.pysty (100%) rename {math => packages/math}/mathfixes.pysty (100%) rename {math => packages/math}/mathfont.pysty (100%) rename {math => packages/math}/mathop.pysty (100%) rename {math => packages/math}/mathsymb.pysty (100%) rename {math => packages/math}/unicodechar.pysty (100%) rename {utils => packages/utils}/counters.pysty (100%) rename {utils => packages/utils}/findpackage.pysty (100%) create mode 100644 packages/vocab.pysty rename {wip => packages/wip}/bibliography.pysty (100%) rename {wip => packages/wip}/enumerate.pysty (100%) rename {wip => packages/wip}/exsheet.pysty (100%) rename {wip => packages/wip}/figures.pysty (100%) rename {wip => packages/wip}/gag.pysty (100%) rename {wip => packages/wip}/lang-input.pysty (100%) rename {wip => packages/wip}/proof.pysty (100%) rename {wip => packages/wip}/removed.pysty (100%) rename {wip => packages/wip}/restate.pysty (100%) diff --git a/PyTeX b/PyTeX index a9af7d4..a6ba08f 160000 --- a/PyTeX +++ b/PyTeX @@ -1 +1 @@ -Subproject commit a9af7d4459379446077e694e1ff2aa2eed274797 +Subproject commit a6ba08f1eedc74fea749705fae8f1380773e524b diff --git a/build.py b/build.py new file mode 100644 index 0000000..ff14ab9 --- /dev/null +++ b/build.py @@ -0,0 +1,17 @@ +from pathlib import * +import sys +sys.path.insert(0, 'PyTeX/') + +from package_formatter import PackageFormatter +from replacements import make_default_commands + +def build(build_dir: str): + input_root = Path('.').resolve() + output = input_root / build_dir + for file in input_root.rglob('*.pysty'): + formatter = PackageFormatter(package_name=file.with_suffix('').name) + make_default_commands(formatter) + formatter.format_package(file, input_root / build_dir / str(file.parent.relative_to(input_root))) + +if __name__ == "__main__": + build('build') diff --git a/mkessler-hypersetup.sty b/mkessler-hypersetup.sty deleted file mode 100644 index e6dd56d..0000000 --- a/mkessler-hypersetup.sty +++ /dev/null @@ -1,26 +0,0 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mkessler-hypersetup}[2021-09-06 - Package for setting up hyperref, cleveref and some default hyperref colors] -%%%%%%%%%%%%%%%%%% - - -\newif\ifmkessler@hypersetup@cleveref\mkessler@hypersetup@clevereffalse -\DeclareOption{cleveref}{\mkessler@hypersetup@clevereftrue} - -\DeclareOption*{\PackageWarning{mkessler-hypersetup}{Unknown '\CurrentOption'}} -\ProcessOptions\relax - -%%%Hyperref and setup -\RequirePackage{xcolor} % To compute the colors below -\RequirePackage{etoolbox} % Checking for defined commands - -\def\mkessler@hypersetup@exec{ - \RequirePackage{hyperref} % Hyperlinks - \ifmkessler@hypersetup@cleveref - \RequirePackage{cleveref} % Better referencing - \fi - \hypersetup{colorlinks, citecolor=violet, urlcolor=blue!80!black, linkcolor=red!50!black, pdfauthor=\@author, pdftitle=\ifdef{\@course}{\@course}{\@title}} -} - -\AtEndPreamble{ - \mkessler@hypersetup@exec -} diff --git a/mkessler-vocab.sty b/mkessler-vocab.sty deleted file mode 100644 index 7de937e..0000000 --- a/mkessler-vocab.sty +++ /dev/null @@ -1,44 +0,0 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mkessler-vocab}[2021-09-06 - Package for emphasizing vocabulary] -%%%%%%%%%%%%%%%%%% -%%Provides a \vocab<[name in index]>{vocabulary} command to print vocabulary in bold blue and automatically index it. - -\newif\ifmkessler@vocab@english\mkessler@vocab@englishtrue -\DeclareOption{german}{\mkessler@vocab@englishfalse} -\DeclareOption{english}{\mkessler@vocab@englishtrue} - -\newif\ifmkessler@vocab@index\mkessler@vocab@indexfalse -\DeclareOption{index}{\mkessler@vocab@indextrue} -\DeclareOption{noindex}{\mkessler@vocab@indexfalse} - -\DeclareOption*{\PackageWarning{mkessler-vocab}{Unknown '\CurrentOption'}} -\ProcessOptions\relax - -%%%%Management of vocabulary and corresponding index -\RequirePackage{xparse} -\RequirePackage{xcolor} -\ifmkessler@vocab@index - \RequirePackage{imakeidx} - \makeindex[name=mkessler@vocab@indexname, columns=2, title=\ifmkessler@vocab@english Index\else Stichwortverzeichnis\fi, intoc] - - %Emphasize \vocabulary - \RequirePackage{expl3} - \ExplSyntaxOn - \NewDocumentCommand{\vocab}{O{} m}{ - \textbf{\color{blue} #2}% - \if\relax\detokenize{#1}\relax% - \index[mkessler@vocab@indexname]{\text_titlecase_first:n{#2}} % true branch: #1 was empty - \else - \index[mkessler@vocab@indexname]{#1} % false branch: #1 was supplied - \fi - } - \ExplSyntaxOff - \newcommand\printvocabindex{ - \printindex[mkessler@vocab@indexname] - } -\else - \NewDocumentCommand{\vocab}{O{} m }{ - \textbf{\color{blue} #2} - } -\fi - diff --git a/environments/fancythm.pysty b/packages/environments/fancythm.pysty similarity index 100% rename from environments/fancythm.pysty rename to packages/environments/fancythm.pysty diff --git a/environments/thmpystyle.pysty b/packages/environments/thmpystyle.pysty similarity index 100% rename from environments/thmpystyle.pysty rename to packages/environments/thmpystyle.pysty diff --git a/packages/hypersetup.pysty b/packages/hypersetup.pysty new file mode 100644 index 0000000..a8ab3e8 --- /dev/null +++ b/packages/hypersetup.pysty @@ -0,0 +1,22 @@ +__HEADER__(Package for setting up hyperref, cleveref and some default hyperref colors) + +__NEW_IF__(cleveref,false) +\DeclareOption{cleveref}{__SET_IF__(cleveref,true)} + +__END_OPTIONS___ + +%%%Hyperref and setup +\RequirePackage{xcolor} % To compute the colors below +\RequirePackage{etoolbox} % Checking for defined commands + +\def__PACKAGE_MACRO__(exec){ + \RequirePackage{hyperref} % Hyperlinks + __IF__(cleveref) + \RequirePackage{cleveref} % Better referencing + \fi + \hypersetup{colorlinks, citecolor=violet, urlcolor=blue!80!black, linkcolor=red!50!black, pdfauthor=\@author, pdftitle=\ifdef{\@course}{\@course}{\@title}} +} + +\AtEndPreamble{ + __PACKAGE_MACRO__(exec) +} diff --git a/castel-incfig.sty b/packages/incfig.pysty similarity index 93% rename from castel-incfig.sty rename to packages/incfig.pysty index 1fc1620..a8beef2 100644 --- a/castel-incfig.sty +++ b/packages/incfig.pysty @@ -1,5 +1,4 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{castel-incfig}[2021-09-06 - Figure support for inkscape figures by Gilles Castell] +__HEADER__(Figure support for inkscape figures by Gilles Castell) %%%%%%%% % This is just a small package bundling the figure support for the inkscape figures by Gilles Castel. The setup can be originally found in the preamble diff --git a/lecture-notes/lectures.pysty b/packages/lecture-notes/lectures.pysty similarity index 100% rename from lecture-notes/lectures.pysty rename to packages/lecture-notes/lectures.pysty diff --git a/lecture-notes/script.cls b/packages/lecture-notes/script.cls similarity index 100% rename from lecture-notes/script.cls rename to packages/lecture-notes/script.cls diff --git a/math/faktor.pysty b/packages/math/faktor.pysty similarity index 100% rename from math/faktor.pysty rename to packages/math/faktor.pysty diff --git a/math/math.pysty b/packages/math/math.pysty similarity index 100% rename from math/math.pysty rename to packages/math/math.pysty diff --git a/math/mathalias.pysty b/packages/math/mathalias.pysty similarity index 100% rename from math/mathalias.pysty rename to packages/math/mathalias.pysty diff --git a/math/mathfig.pysty b/packages/math/mathfig.pysty similarity index 100% rename from math/mathfig.pysty rename to packages/math/mathfig.pysty diff --git a/math/mathfixes.pysty b/packages/math/mathfixes.pysty similarity index 100% rename from math/mathfixes.pysty rename to packages/math/mathfixes.pysty diff --git a/math/mathfont.pysty b/packages/math/mathfont.pysty similarity index 100% rename from math/mathfont.pysty rename to packages/math/mathfont.pysty diff --git a/math/mathop.pysty b/packages/math/mathop.pysty similarity index 100% rename from math/mathop.pysty rename to packages/math/mathop.pysty diff --git a/math/mathsymb.pysty b/packages/math/mathsymb.pysty similarity index 100% rename from math/mathsymb.pysty rename to packages/math/mathsymb.pysty diff --git a/math/unicodechar.pysty b/packages/math/unicodechar.pysty similarity index 100% rename from math/unicodechar.pysty rename to packages/math/unicodechar.pysty diff --git a/utils/counters.pysty b/packages/utils/counters.pysty similarity index 100% rename from utils/counters.pysty rename to packages/utils/counters.pysty diff --git a/utils/findpackage.pysty b/packages/utils/findpackage.pysty similarity index 100% rename from utils/findpackage.pysty rename to packages/utils/findpackage.pysty diff --git a/packages/vocab.pysty b/packages/vocab.pysty new file mode 100644 index 0000000..b6ef8fa --- /dev/null +++ b/packages/vocab.pysty @@ -0,0 +1,41 @@ +__HEADER__(Package for emphasizing vocabulary) +%%Provides a \vocab<[name in index]>{vocabulary} command to print vocabulary in bold blue and automatically index it. + +\RequirePackage{xkeyval} + +__LANGUAGE_OPTIONS__ +__NEW_IF__(index,false) + +\DeclareOption{index}{__SET_IF__(index,true)} +\DeclareOption{noindex}{__SET_IF__(index,false)} + +__END_OPTIONS_X__ + +%%%%Management of vocabulary and corresponding index +\RequirePackage{xparse} +\RequirePackage{xcolor} +__IF__(index) + \RequirePackage{imakeidx} + \makeindex[name=vocabindex, columns=2, title=__IF__(english) Index\else Stichwortverzeichnis\fi, intoc] + + %Emphasize \vocabulary + \RequirePackage{expl3} + \ExplSyntaxOn + \NewDocumentCommand{\vocab}{O{} m}{ + \textbf{\color{blue} #2}% + \if\relax\detokenize{#1}\relax% + \index[vocabindex]{\text_titlecase_first:n{#2}} % true branch: #1 was empty + \else + \index[vocabindex]{#1} % false branch: #1 was supplied + \fi + } + \ExplSyntaxOff + \newcommand\printvocabindex{ + \printindex[vocabindex] + } +\else + \NewDocumentCommand{\vocab}{O{} m }{ + \textbf{\color{blue} #2} + } +\fi + diff --git a/wip/bibliography.pysty b/packages/wip/bibliography.pysty similarity index 100% rename from wip/bibliography.pysty rename to packages/wip/bibliography.pysty diff --git a/wip/enumerate.pysty b/packages/wip/enumerate.pysty similarity index 100% rename from wip/enumerate.pysty rename to packages/wip/enumerate.pysty diff --git a/wip/exsheet.pysty b/packages/wip/exsheet.pysty similarity index 100% rename from wip/exsheet.pysty rename to packages/wip/exsheet.pysty diff --git a/wip/figures.pysty b/packages/wip/figures.pysty similarity index 100% rename from wip/figures.pysty rename to packages/wip/figures.pysty diff --git a/wip/gag.pysty b/packages/wip/gag.pysty similarity index 100% rename from wip/gag.pysty rename to packages/wip/gag.pysty diff --git a/wip/lang-input.pysty b/packages/wip/lang-input.pysty similarity index 100% rename from wip/lang-input.pysty rename to packages/wip/lang-input.pysty diff --git a/wip/proof.pysty b/packages/wip/proof.pysty similarity index 100% rename from wip/proof.pysty rename to packages/wip/proof.pysty diff --git a/wip/removed.pysty b/packages/wip/removed.pysty similarity index 100% rename from wip/removed.pysty rename to packages/wip/removed.pysty diff --git a/wip/restate.pysty b/packages/wip/restate.pysty similarity index 100% rename from wip/restate.pysty rename to packages/wip/restate.pysty From c18b4ad0e4ac4cb05f52e117da58c0362997b349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Wed, 6 Oct 2021 23:10:25 +0200 Subject: [PATCH 10/36] adjust build script and Makefile --- Makefile | 4 ++++ build.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9139457 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +.PHONY: build + +build: + python3 build.py diff --git a/build.py b/build.py index ff14ab9..633957b 100644 --- a/build.py +++ b/build.py @@ -6,12 +6,12 @@ from package_formatter import PackageFormatter from replacements import make_default_commands def build(build_dir: str): - input_root = Path('.').resolve() + input_root = Path('./packages').resolve() output = input_root / build_dir for file in input_root.rglob('*.pysty'): formatter = PackageFormatter(package_name=file.with_suffix('').name) make_default_commands(formatter) - formatter.format_package(file, input_root / build_dir / str(file.parent.relative_to(input_root))) + formatter.format_package(file, Path('./').resolve() / build_dir / str(file.parent.relative_to(input_root))) if __name__ == "__main__": build('build') From 13c7d3bc2145fe0dfa3bd9e4d45fa32612289cfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Wed, 6 Oct 2021 23:21:01 +0200 Subject: [PATCH 11/36] better Makefile and build script --- .gitignore | 2 ++ Makefile | 18 ++++++++++++++++-- build.py | 1 + 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 85f404f..1ce2b59 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ *.swp build/* +.gitconfiglock +.initsubmodulelock diff --git a/Makefile b/Makefile index 9139457..ac4a9c6 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,18 @@ .PHONY: build -build: - python3 build.py +build: .initsubmodulelock + @python3 build.py + +init: .initsubmodulelock .gitconfiglock + +.initsubmodulelock: + @git submodule update --init + @touch .initsubmodulelock + +.gitconfiglock: + @echo "[Make config] Setting git configs to prevent wrong pushes" + @git config push.recurseSubmodules check + @git config status.submodulesummary 1 + @echo "[Push annotated tags by default]" + @git config push.followTags true + @touch .gitconfiglock diff --git a/build.py b/build.py index 633957b..44321fe 100644 --- a/build.py +++ b/build.py @@ -10,6 +10,7 @@ def build(build_dir: str): output = input_root / build_dir for file in input_root.rglob('*.pysty'): formatter = PackageFormatter(package_name=file.with_suffix('').name) + print('[PyTeX] Writing file {}'.format(formatter.file_name)) make_default_commands(formatter) formatter.format_package(file, Path('./').resolve() / build_dir / str(file.parent.relative_to(input_root))) From b1ebeb6c11db5628c76d769cfbc6baba6218752b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Thu, 7 Oct 2021 08:38:30 +0200 Subject: [PATCH 12/36] move files into subfolder --- packages/{ => misc}/hypersetup.pysty | 0 packages/{ => misc}/incfig.pysty | 0 packages/{ => misc}/vocab.pysty | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename packages/{ => misc}/hypersetup.pysty (100%) rename packages/{ => misc}/incfig.pysty (100%) rename packages/{ => misc}/vocab.pysty (100%) diff --git a/packages/hypersetup.pysty b/packages/misc/hypersetup.pysty similarity index 100% rename from packages/hypersetup.pysty rename to packages/misc/hypersetup.pysty diff --git a/packages/incfig.pysty b/packages/misc/incfig.pysty similarity index 100% rename from packages/incfig.pysty rename to packages/misc/incfig.pysty diff --git a/packages/vocab.pysty b/packages/misc/vocab.pysty similarity index 100% rename from packages/vocab.pysty rename to packages/misc/vocab.pysty From 263d9fa54203a8ed60f455258644f47359fb80c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Thu, 7 Oct 2021 09:00:18 +0200 Subject: [PATCH 13/36] update PyTeX submodule to track own branch --- .gitmodules | 3 ++- PyTeX | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 662735b..e5a2100 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ [submodule "PyTeX"] path = PyTeX - url = https://github.com/kesslermaximilian/PyTeX.git + url = https://github.com/kesslermaximilian/PyTeX.git + branch= latex-packages diff --git a/PyTeX b/PyTeX index a6ba08f..0e90f82 160000 --- a/PyTeX +++ b/PyTeX @@ -1 +1 @@ -Subproject commit a6ba08f1eedc74fea749705fae8f1380773e524b +Subproject commit 0e90f820760b98988e516157f8a52c56dcd1598a From 57f37328a5b74cc12ca97d066de8624d414db791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Thu, 7 Oct 2021 09:00:51 +0200 Subject: [PATCH 14/36] ignore pycharm generated .idea/ folder --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 1ce2b59..41702df 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ build/* .gitconfiglock .initsubmodulelock +.idea/ From 4739c0ce22b15cb1ee51c5382b695e2dd1967981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Thu, 7 Oct 2021 09:01:50 +0200 Subject: [PATCH 15/36] adjust makefile --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index ac4a9c6..839809e 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,8 @@ build: .initsubmodulelock init: .initsubmodulelock .gitconfiglock +config: .gitconfiglock + .initsubmodulelock: @git submodule update --init @touch .initsubmodulelock From 24652768e009aa74580bb22517d0e436573f84e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Thu, 7 Oct 2021 10:06:23 +0200 Subject: [PATCH 16/36] fix various mistakes --- packages/environments/fancythm.pysty | 2 ++ .../environments/{thmpystyle.pysty => thmstyle.pysty} | 0 packages/lecture-notes/lectures.pysty | 2 +- packages/math/math.pysty | 6 ++++-- packages/math/mathalias.pysty | 8 +++++--- packages/math/mathfixes.pysty | 2 +- packages/math/mathfont.pysty | 2 +- packages/math/mathop.pysty | 6 ++++-- packages/misc/hypersetup.pysty | 8 +++++--- packages/misc/vocab.pysty | 6 +++--- packages/wip/proof.pysty | 8 ++++---- packages/wip/restate.pysty | 5 +++-- 12 files changed, 33 insertions(+), 22 deletions(-) rename packages/environments/{thmpystyle.pysty => thmstyle.pysty} (100%) diff --git a/packages/environments/fancythm.pysty b/packages/environments/fancythm.pysty index 71fe56d..59b7a2a 100644 --- a/packages/environments/fancythm.pysty +++ b/packages/environments/fancythm.pysty @@ -1,6 +1,8 @@ __HEADER__(Theorem-Environment Package) %Provides fancy theorem-like-environments used in the write-ups of my lecture notes +\RequirePackage{xkeyval} + __NEW_IF__(showstars,true) __NEW_IF__(showdaggers,true) __NEW_IF__(includestars,true) diff --git a/packages/environments/thmpystyle.pysty b/packages/environments/thmstyle.pysty similarity index 100% rename from packages/environments/thmpystyle.pysty rename to packages/environments/thmstyle.pysty diff --git a/packages/lecture-notes/lectures.pysty b/packages/lecture-notes/lectures.pysty index 393ca7b..a85d58f 100644 --- a/packages/lecture-notes/lectures.pysty +++ b/packages/lecture-notes/lectures.pysty @@ -81,7 +81,7 @@ __END_OPTIONS_X__ } -\iffancyhead +__IF__(fancyhead) \RequirePackage{fancyhdr} \pagestyle{fancy} diff --git a/packages/math/math.pysty b/packages/math/math.pysty index 03725ff..e6d0f58 100644 --- a/packages/math/math.pysty +++ b/packages/math/math.pysty @@ -4,9 +4,11 @@ __HEADER__(Main math package.) % Probably, you will just want to load them separately for more % customization -__LANGUAGE_OPTIONS__ +\RequirePackage{xkeyval} -__END_OPTIONS__ +__LANGUAGE_OPTIONS_X__ + +__END_OPTIONS_X__ %%%% Import the other custom math packages \RequirePackage{mkessler-mathfont} % Load this first to ensure untouched fonts diff --git a/packages/math/mathalias.pysty b/packages/math/mathalias.pysty index c368508..fbb1fcd 100644 --- a/packages/math/mathalias.pysty +++ b/packages/math/mathalias.pysty @@ -1,12 +1,14 @@ __HEADER__(Easy aliasing for math style commands) +\RequirePackage{xkeyval} + __NEW_IF__(basic,false) __NEW_IF__(extended,false) -\DeclareOption{basic}{__SET_IF__(basic,true)} -\DeclareOption{extended}{__SET_IF__(extended,true)__SET_IF__(basic,true)} +\DeclareOptionX{basic}{__SET_IF__(basic,true)} +\DeclareOptionX{extended}{__SET_IF__(extended,true)__SET_IF__(basic,true)} -__END_OPTIONS__ +__END_OPTIONS_X__ %Usage: \makealiasesforwith\{}{} % to declare commands of form \ as \{} for each diff --git a/packages/math/mathfixes.pysty b/packages/math/mathfixes.pysty index 88683ce..b3e3598 100644 --- a/packages/math/mathfixes.pysty +++ b/packages/math/mathfixes.pysty @@ -1,4 +1,4 @@ -__HEADER__(Hacky math packages for some (custom) fixes) +__HEADER__(Hacky math packages for some (custom@) fixes) % This just brings together some (possibly ugly) hacks that I use when writing math. Likely, you do not want to use this except when building around this package (like I did), or already have similar shortcuts %Proper Degree command diff --git a/packages/math/mathfont.pysty b/packages/math/mathfont.pysty index 9f8d9ec..e295dd3 100644 --- a/packages/math/mathfont.pysty +++ b/packages/math/mathfont.pysty @@ -18,7 +18,7 @@ __HEADER__(Collects several math fonts together) \let\mathfrak__PACKAGE_MACRO__(amsfonts@mathfrak) % Set \mathfrak to mathfrak from amsfonts \let\mathscr__PACKAGE_MACRO__(mathrsfs@mathscr) % Set \mathscr to mathscript from mathrsfs package \let\mathcat__PACKAGE_MACRO__(mathrsfs@mathscr) % Set \mathcat to mathscript from mathrsfs package - \let\mathcalo__PACKAGE_MACRO__(eucal@optionmathscr@mathscr) % Set \mathcom (for comic) to \mathscr from [mathscr]{eucal} package + \let\mathcalo__PACKAGE_MACRO__(eucal@optionmathscr@mathscr) % Set \mathcalo (for old calligraphic) to \mathscr from [mathscr]{eucal} package } \AtBeginDocument{__PACKAGE_MACRO__(restorefonts)} diff --git a/packages/math/mathop.pysty b/packages/math/mathop.pysty index 7bd8337..771ebca 100644 --- a/packages/math/mathop.pysty +++ b/packages/math/mathop.pysty @@ -1,9 +1,11 @@ __HEADER__(Math Operator Package) %Provides some commonly used Operators used in the write-ups of my lecture notes -__LANGUAGE_OPTIONS__ +\RequirePackage{xkeyval} -__END_OPTIONS__ +__LANGUAGE_OPTIONS_X__ + +__END_OPTIONS_X__ %%%%%Package dependencies \RequirePackage{amsmath} diff --git a/packages/misc/hypersetup.pysty b/packages/misc/hypersetup.pysty index a8ab3e8..a636cda 100644 --- a/packages/misc/hypersetup.pysty +++ b/packages/misc/hypersetup.pysty @@ -1,9 +1,11 @@ __HEADER__(Package for setting up hyperref, cleveref and some default hyperref colors) -__NEW_IF__(cleveref,false) -\DeclareOption{cleveref}{__SET_IF__(cleveref,true)} +\RequirePackage{xkeyval} -__END_OPTIONS___ +__NEW_IF__(cleveref,false) +\DeclareOptionX{cleveref}{__SET_IF__(cleveref,true)} + +__END_OPTIONS_X__ %%%Hyperref and setup \RequirePackage{xcolor} % To compute the colors below diff --git a/packages/misc/vocab.pysty b/packages/misc/vocab.pysty index b6ef8fa..b3c7b55 100644 --- a/packages/misc/vocab.pysty +++ b/packages/misc/vocab.pysty @@ -3,11 +3,11 @@ __HEADER__(Package for emphasizing vocabulary) \RequirePackage{xkeyval} -__LANGUAGE_OPTIONS__ +__LANGUAGE_OPTIONS_X__ __NEW_IF__(index,false) -\DeclareOption{index}{__SET_IF__(index,true)} -\DeclareOption{noindex}{__SET_IF__(index,false)} +\DeclareOptionX{index}{__SET_IF__(index,true)} +\DeclareOptionX{noindex}{__SET_IF__(index,false)} __END_OPTIONS_X__ diff --git a/packages/wip/proof.pysty b/packages/wip/proof.pysty index f224e50..a04ad02 100644 --- a/packages/wip/proof.pysty +++ b/packages/wip/proof.pysty @@ -2,7 +2,7 @@ __HEADER__(Automatic references to theorems in proofs. Claim counters within pro \RequirePackage{xkeyval} -__LANGUAGE_OPTIONS__ +__LANGUAGE_OPTIONS_X__ __END_OPTIONS_X__ @@ -18,15 +18,15 @@ __END_OPTIONS_X__ \newtheorem*{claim*}{__IF__(english) Claim\else Behauptung\fi} \AtBeginDocument{\def\claimautorefname{__IF__(english) Claim\else Behauptung\fi}} -\newif\ifhyperref +__NEW_IF__(hyperref,false) \AtBeginDocument{ \@ifpackageloaded{hyperref}{ - \hyperreftrue + __SET_IF__(hyperref,true) \def\grab#1{\expandafter\@firstoffive#1} \def__PACKAGE_MACRO__(blankref)#1{\expandafter\grab\csname r@#1\endcsname} \let__PACKAGE_MACRO__(autoref)\autoref }{ - \hyperreffalse + __SET_IF__(hyperref,true) \let__PACKAGE_MACRO__(blankref)\ref \let__PACKAGE_MACRO__(autoref)\ref } diff --git a/packages/wip/restate.pysty b/packages/wip/restate.pysty index 3f3039b..e7e8959 100644 --- a/packages/wip/restate.pysty +++ b/packages/wip/restate.pysty @@ -16,9 +16,10 @@ __NEW_IF__(english, true) __INFO__(Strict mode disabled. Undefined restates will now print placeholder boxes)% \fi }{ - __WARNING__({Erroneous input to key 'strict' ignored. Provide =true or =false.) + __WARNING__(Erroneous input to key 'strict' ignored. Provide =true or =false.) } -\ProcessOptionsX*\relax + +__END_OPTIONS_X__ \newcommand\restatesetup[1]{\setkeys{__FILE_NAME__}{#1}} From 27e3a7f4c33620048d04e6bd10ae1c7492f8a9d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Thu, 7 Oct 2021 13:53:09 +0200 Subject: [PATCH 17/36] update submodule pytex --- PyTeX | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PyTeX b/PyTeX index 0e90f82..d1a269b 160000 --- a/PyTeX +++ b/PyTeX @@ -1 +1 @@ -Subproject commit 0e90f820760b98988e516157f8a52c56dcd1598a +Subproject commit d1a269b56bf005bc885b73fc8b115f264b737af2 From d336dde3d87589f2877ca31e487f6fb88ca543ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Thu, 7 Oct 2021 13:55:39 +0200 Subject: [PATCH 18/36] add test files for packages (not finished yet) --- tests/.gitignore | 6 ++ tests/Makefile | 7 +++ tests/environments/Makefile | 7 +++ tests/environments/fancythm/Makefile | 3 + tests/environments/fancythm/test.tex | 65 ++++++++++++++++++++ tests/lecture-notes/Makefile | 7 +++ tests/lecture-notes/lectures/Makefile | 3 + tests/lecture-notes/lectures/test.lec | 4 ++ tests/lecture-notes/lectures/test.tex | 17 ++++++ tests/math/Makefile | 7 +++ tests/math/faktor/Makefile | 3 + tests/math/faktor/test.tex | 15 +++++ tests/math/math/Makefile | 3 + tests/math/math/test.tex | 17 ++++++ tests/math/mathalias/Makefile | 3 + tests/math/mathalias/test.tex | 15 +++++ tests/math/mathfig/Makefile | 3 + tests/math/mathfig/test.tex | 16 +++++ tests/math/mathfixes/Makefile | 3 + tests/math/mathfixes/test.tex | 11 ++++ tests/math/mathfont/Makefile | 3 + tests/math/mathfont/test.tex | 32 ++++++++++ tests/math/mathop/Makefile | 3 + tests/math/mathop/test.tex | 9 +++ tests/math/mathsymb/Makefile | 3 + tests/math/mathsymb/test.tex | 19 ++++++ tests/math/unicodechar/Makefile | 3 + tests/math/unicodechar/test.tex | 7 +++ tests/misc/Makefile | 7 +++ tests/misc/hypersetup/Makefile | 3 + tests/misc/hypersetup/test.bbl | 20 +++++++ tests/misc/hypersetup/test.out | 1 + tests/misc/hypersetup/test.run.xml | 86 +++++++++++++++++++++++++++ tests/misc/hypersetup/test.tex | 16 +++++ tests/misc/vocab/Makefile | 3 + tests/misc/vocab/test.tex | 11 ++++ tests/misc/vocab/vocabindex.idx | 1 + tests/misc/vocab/vocabindex.ilg | 6 ++ tests/misc/vocab/vocabindex.ind | 5 ++ tests/utils/Makefile | 7 +++ tests/utils/counters/Makefile | 3 + tests/utils/counters/test.cnt | 12 ++++ tests/utils/counters/test.tex | 15 +++++ tests/utils/findpackage/Makefile | 3 + tests/utils/findpackage/test.tex | 10 ++++ tests/wip/Makefile | 7 +++ tests/wip/proof/Makefile | 4 ++ tests/wip/proof/test.tex | 48 +++++++++++++++ tests/wip/restate/Makefile | 3 + tests/wip/restate/test.tex | 16 +++++ 50 files changed, 581 insertions(+) create mode 100644 tests/.gitignore create mode 100644 tests/Makefile create mode 100644 tests/environments/Makefile create mode 100644 tests/environments/fancythm/Makefile create mode 100644 tests/environments/fancythm/test.tex create mode 100644 tests/lecture-notes/Makefile create mode 100644 tests/lecture-notes/lectures/Makefile create mode 100644 tests/lecture-notes/lectures/test.lec create mode 100644 tests/lecture-notes/lectures/test.tex create mode 100644 tests/math/Makefile create mode 100644 tests/math/faktor/Makefile create mode 100644 tests/math/faktor/test.tex create mode 100644 tests/math/math/Makefile create mode 100644 tests/math/math/test.tex create mode 100644 tests/math/mathalias/Makefile create mode 100644 tests/math/mathalias/test.tex create mode 100644 tests/math/mathfig/Makefile create mode 100644 tests/math/mathfig/test.tex create mode 100644 tests/math/mathfixes/Makefile create mode 100644 tests/math/mathfixes/test.tex create mode 100644 tests/math/mathfont/Makefile create mode 100644 tests/math/mathfont/test.tex create mode 100644 tests/math/mathop/Makefile create mode 100644 tests/math/mathop/test.tex create mode 100644 tests/math/mathsymb/Makefile create mode 100644 tests/math/mathsymb/test.tex create mode 100644 tests/math/unicodechar/Makefile create mode 100644 tests/math/unicodechar/test.tex create mode 100644 tests/misc/Makefile create mode 100644 tests/misc/hypersetup/Makefile create mode 100644 tests/misc/hypersetup/test.bbl create mode 100644 tests/misc/hypersetup/test.out create mode 100644 tests/misc/hypersetup/test.run.xml create mode 100644 tests/misc/hypersetup/test.tex create mode 100644 tests/misc/vocab/Makefile create mode 100644 tests/misc/vocab/test.tex create mode 100644 tests/misc/vocab/vocabindex.idx create mode 100644 tests/misc/vocab/vocabindex.ilg create mode 100644 tests/misc/vocab/vocabindex.ind create mode 100644 tests/utils/Makefile create mode 100644 tests/utils/counters/Makefile create mode 100644 tests/utils/counters/test.cnt create mode 100644 tests/utils/counters/test.tex create mode 100644 tests/utils/findpackage/Makefile create mode 100644 tests/utils/findpackage/test.tex create mode 100644 tests/wip/Makefile create mode 100644 tests/wip/proof/Makefile create mode 100644 tests/wip/proof/test.tex create mode 100644 tests/wip/restate/Makefile create mode 100644 tests/wip/restate/test.tex diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 0000000..ba167d2 --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1,6 @@ +*.aux +*.fdb_latexmk +*.fls +*.log +*.pdf +wip/proof/.skip diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000..61533ed --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,7 @@ +SUBDIRS := $(wildcard */.) + +all: $(SUBDIRS) +$(SUBDIRS): + $(MAKE) -C $@ + +.PHONY: all $(SUBDIRS) diff --git a/tests/environments/Makefile b/tests/environments/Makefile new file mode 100644 index 0000000..61533ed --- /dev/null +++ b/tests/environments/Makefile @@ -0,0 +1,7 @@ +SUBDIRS := $(wildcard */.) + +all: $(SUBDIRS) +$(SUBDIRS): + $(MAKE) -C $@ + +.PHONY: all $(SUBDIRS) diff --git a/tests/environments/fancythm/Makefile b/tests/environments/fancythm/Makefile new file mode 100644 index 0000000..7931aaf --- /dev/null +++ b/tests/environments/fancythm/Makefile @@ -0,0 +1,3 @@ +test: + latexmk -c test.tex + latexmk -dvi- -pdf test.tex diff --git a/tests/environments/fancythm/test.tex b/tests/environments/fancythm/test.tex new file mode 100644 index 0000000..6571df9 --- /dev/null +++ b/tests/environments/fancythm/test.tex @@ -0,0 +1,65 @@ +\documentclass[a4paper, german]{article} + +\usepackage[lecture numbers = false, number all, number small environments = section]{mkessler-fancythm} + + +\begin{document} + \begin{theorem}[Name]\label{test} + test + \end{theorem} + \begin{definition**} + test + \end{definition**} + + \ref{test} + + \begin{theorem} + test + \end{theorem} + + \mdfsetup{skipabove=8pt,skipbelow=\topskip, bottomline=true} + \begin{lemma} + + \end{lemma} + + \begin{example} + + \end{example} + + \begin{praise} + test + \end{praise} + + \begin{remark} + test + \end{remark} + + \begin{notation} + test + \end{notation} + + \begin{abuse} + test + \end{abuse} + + \begin{theoremdef} + + \end{theoremdef} + + \begin{fact} + test + \end{fact} + + \begin{orga} + + \end{orga} + + \begin{question} + + \end{question} + + \begin{oral} + test + \end{oral} + +\end{document} diff --git a/tests/lecture-notes/Makefile b/tests/lecture-notes/Makefile new file mode 100644 index 0000000..61533ed --- /dev/null +++ b/tests/lecture-notes/Makefile @@ -0,0 +1,7 @@ +SUBDIRS := $(wildcard */.) + +all: $(SUBDIRS) +$(SUBDIRS): + $(MAKE) -C $@ + +.PHONY: all $(SUBDIRS) diff --git a/tests/lecture-notes/lectures/Makefile b/tests/lecture-notes/lectures/Makefile new file mode 100644 index 0000000..7931aaf --- /dev/null +++ b/tests/lecture-notes/lectures/Makefile @@ -0,0 +1,3 @@ +test: + latexmk -c test.tex + latexmk -dvi- -pdf test.tex diff --git a/tests/lecture-notes/lectures/test.lec b/tests/lecture-notes/lectures/test.lec new file mode 100644 index 0000000..cb88c5d --- /dev/null +++ b/tests/lecture-notes/lectures/test.lec @@ -0,0 +1,4 @@ +\contentsline {lecture}{Lecture\,1\,(date)}{1}% +\vspace \smallskipamount \hspace {1.5em}\parbox {\dimexpr \textwidth -1.55em- 2em}{Some keywords} +\contentsline {lecture}{Lecture\,2\,(date)}{2}% +\vspace \smallskipamount \hspace {1.5em}\parbox {\dimexpr \textwidth -1.55em- 2em}{Some other keywords} diff --git a/tests/lecture-notes/lectures/test.tex b/tests/lecture-notes/lectures/test.tex new file mode 100644 index 0000000..ae7b7b9 --- /dev/null +++ b/tests/lecture-notes/lectures/test.tex @@ -0,0 +1,17 @@ +\documentclass{article} + +\usepackage{mkessler-lectures} +\usepackage{blindtext} + +\begin{document} + +\summaryoflectures + +\lecture[Some keywords]{date}{title} +\blindtext + +\newpage +\lecture[Some other keywords]{date}{title 2} +\blindtext + +\end{document} diff --git a/tests/math/Makefile b/tests/math/Makefile new file mode 100644 index 0000000..61533ed --- /dev/null +++ b/tests/math/Makefile @@ -0,0 +1,7 @@ +SUBDIRS := $(wildcard */.) + +all: $(SUBDIRS) +$(SUBDIRS): + $(MAKE) -C $@ + +.PHONY: all $(SUBDIRS) diff --git a/tests/math/faktor/Makefile b/tests/math/faktor/Makefile new file mode 100644 index 0000000..8381565 --- /dev/null +++ b/tests/math/faktor/Makefile @@ -0,0 +1,3 @@ +test: + latexmk -c test.tex + latexmk -pdf -dvi- test.tex diff --git a/tests/math/faktor/test.tex b/tests/math/faktor/test.tex new file mode 100644 index 0000000..e15312d --- /dev/null +++ b/tests/math/faktor/test.tex @@ -0,0 +1,15 @@ +\documentclass{article} + +\usepackage{mkessler-faktor} + +\begin{document} +\[ + \faktor{A}{B} \cong \cofaktor{A}{B} +\] +\[ + \faktor{A}[1]{B}[-1.5] \cong \cofaktor{A}[-1]{B}[0.5] +\] +\[ + \cofaktor*{A}[-1]{B}[2] = x +\] +\end{document} diff --git a/tests/math/math/Makefile b/tests/math/math/Makefile new file mode 100644 index 0000000..7931aaf --- /dev/null +++ b/tests/math/math/Makefile @@ -0,0 +1,3 @@ +test: + latexmk -c test.tex + latexmk -dvi- -pdf test.tex diff --git a/tests/math/math/test.tex b/tests/math/math/test.tex new file mode 100644 index 0000000..be71471 --- /dev/null +++ b/tests/math/math/test.tex @@ -0,0 +1,17 @@ +\documentclass{article} + +\usepackage{mkessler-math} + +\begin{document} +\[ + \Gal \Quot \PreSh \tensor \Var \Br \Set \CHaus \cfun \One \left\lfloor \frac{1}{\frac{3}{\frac{7}{8}}} \right\rfloor \abs{\frac{1}{\frac{8}{\frac{4}{3}}}} \lVert \frac{a}{\frac{b}{c}} \rVert \left< \frac{a}{\frac{b}{c}} \right> \norm{\frac{a}{\frac{b}{c}}} \norm{test} \norm{\frac{a}{\frac{b}{c}}} +\] +\[ + \C \F \K \R \Z \Q +\] +\begin{IEEEeqnarray*}{rCl} + A & = & b \\ + & = & c +\end{IEEEeqnarray*} + +\end{document} diff --git a/tests/math/mathalias/Makefile b/tests/math/mathalias/Makefile new file mode 100644 index 0000000..8381565 --- /dev/null +++ b/tests/math/mathalias/Makefile @@ -0,0 +1,3 @@ +test: + latexmk -c test.tex + latexmk -pdf -dvi- test.tex diff --git a/tests/math/mathalias/test.tex b/tests/math/mathalias/test.tex new file mode 100644 index 0000000..218654e --- /dev/null +++ b/tests/math/mathalias/test.tex @@ -0,0 +1,15 @@ +\documentclass{article} + +\usepackage[extended]{mkessler-mathalias} + +\begin{document} +\[ +\C\F\K\N\Q\R\Z +\] +\[ +\cA\cB\cC\cD \cZ +\] +\[ +\fA \fB \fZ +\] +\end{document} diff --git a/tests/math/mathfig/Makefile b/tests/math/mathfig/Makefile new file mode 100644 index 0000000..7931aaf --- /dev/null +++ b/tests/math/mathfig/Makefile @@ -0,0 +1,3 @@ +test: + latexmk -c test.tex + latexmk -dvi- -pdf test.tex diff --git a/tests/math/mathfig/test.tex b/tests/math/mathfig/test.tex new file mode 100644 index 0000000..09326fb --- /dev/null +++ b/tests/math/mathfig/test.tex @@ -0,0 +1,16 @@ +\documentclass{article} + +\usepackage{mkessler-mathfig} + +\begin{document} + test +\[ + \begin{tikzcd} + A \ar{r} & B + \end{tikzcd} +\] +test2: + \begin{tikzpicture} + \draw (0,0) rectangle (10,10); + \end{tikzpicture} +\end{document} diff --git a/tests/math/mathfixes/Makefile b/tests/math/mathfixes/Makefile new file mode 100644 index 0000000..7931aaf --- /dev/null +++ b/tests/math/mathfixes/Makefile @@ -0,0 +1,3 @@ +test: + latexmk -c test.tex + latexmk -dvi- -pdf test.tex diff --git a/tests/math/mathfixes/test.tex b/tests/math/mathfixes/test.tex new file mode 100644 index 0000000..bb702cc --- /dev/null +++ b/tests/math/mathfixes/test.tex @@ -0,0 +1,11 @@ +\documentclass{article} + +\usepackage{mkessler-mathfixes} + +\begin{document} + Dies ist nur ein Test: + Es ist 1\degree{} warm. + \[ + a \varphi \epsilon \uglyphi \uglyepsilon \subset \supset \frac{\lim_{x\to \infty}}{} + \] +\end{document} diff --git a/tests/math/mathfont/Makefile b/tests/math/mathfont/Makefile new file mode 100644 index 0000000..7931aaf --- /dev/null +++ b/tests/math/mathfont/Makefile @@ -0,0 +1,3 @@ +test: + latexmk -c test.tex + latexmk -dvi- -pdf test.tex diff --git a/tests/math/mathfont/test.tex b/tests/math/mathfont/test.tex new file mode 100644 index 0000000..3e6de34 --- /dev/null +++ b/tests/math/mathfont/test.tex @@ -0,0 +1,32 @@ +\documentclass{article} + +\usepackage{mkessler-mathfont} +\DeclareMathAlphabet{\mathpzc}{OT1}{pzc}{m}{it} + +\begin{document} +cal com cat frak scr +\def\letters{ABCDEFGHIJKLMNOPQRSTUXWXYZ} + \[ + \mathcal{A} \mathcat{A} \mathfrak{A} \mathscr{A} + \] + mathcalo + \[ + \expandafter\mathcalo\expandafter{\letters} + \] + mathcal + \[ + \expandafter\mathcal\expandafter{\letters} + \] + neue kalligraphie + \[ + \expandafter\mathpzc\expandafter{\letters} ABC + \] + mathscr + \[ + \expandafter\mathscr\expandafter{\letters} + \] + mathfrak + \[ + \expandafter\mathfrak\expandafter{\letters}\mathfrak{p}\mathfrak{q} + \] +\end{document} diff --git a/tests/math/mathop/Makefile b/tests/math/mathop/Makefile new file mode 100644 index 0000000..7931aaf --- /dev/null +++ b/tests/math/mathop/Makefile @@ -0,0 +1,3 @@ +test: + latexmk -c test.tex + latexmk -dvi- -pdf test.tex diff --git a/tests/math/mathop/test.tex b/tests/math/mathop/test.tex new file mode 100644 index 0000000..0d9816a --- /dev/null +++ b/tests/math/mathop/test.tex @@ -0,0 +1,9 @@ +\documentclass{article} + +\usepackage{mkessler-mathop} + +\begin{document} +\[ + \Gal \Quot \PreSh \tensor \Var \Br \Set \CHaus \cfun \One \left\lfloor \frac{1}{\frac{3}{\frac{7}{8}}} \right\rfloor \abs{\frac{1}{\frac{8}{\frac{4}{3}}}} \lVert \frac{a}{\frac{b}{c}} \rVert \left< \frac{a}{\frac{b}{c}} \right> \norm{\frac{a}{\frac{b}{c}}} \norm{test} \norm{\frac{a}{\frac{b}{c}}} +\] +\end{document} diff --git a/tests/math/mathsymb/Makefile b/tests/math/mathsymb/Makefile new file mode 100644 index 0000000..7931aaf --- /dev/null +++ b/tests/math/mathsymb/Makefile @@ -0,0 +1,3 @@ +test: + latexmk -c test.tex + latexmk -dvi- -pdf test.tex diff --git a/tests/math/mathsymb/test.tex b/tests/math/mathsymb/test.tex new file mode 100644 index 0000000..cab1153 --- /dev/null +++ b/tests/math/mathsymb/test.tex @@ -0,0 +1,19 @@ +\documentclass{article} + +\usepackage{mkessler-mathsymb} + +\begin{document} +\[ +f \colon A \to B +\] + +\[ + B \leftarrow A \noloc f +\] + +\contra + +\Warning widerspruch! + +\circled{1} test. +\end{document} diff --git a/tests/math/unicodechar/Makefile b/tests/math/unicodechar/Makefile new file mode 100644 index 0000000..7931aaf --- /dev/null +++ b/tests/math/unicodechar/Makefile @@ -0,0 +1,3 @@ +test: + latexmk -c test.tex + latexmk -dvi- -pdf test.tex diff --git a/tests/math/unicodechar/test.tex b/tests/math/unicodechar/test.tex new file mode 100644 index 0000000..06a6b37 --- /dev/null +++ b/tests/math/unicodechar/test.tex @@ -0,0 +1,7 @@ +\documentclass{article} + +\usepackage{mkessler-unicodechar} + +\begin{document} +Das griechische Alphabet αβγδεζετικλμνξοπρστυφχψω +\end{document} diff --git a/tests/misc/Makefile b/tests/misc/Makefile new file mode 100644 index 0000000..61533ed --- /dev/null +++ b/tests/misc/Makefile @@ -0,0 +1,7 @@ +SUBDIRS := $(wildcard */.) + +all: $(SUBDIRS) +$(SUBDIRS): + $(MAKE) -C $@ + +.PHONY: all $(SUBDIRS) diff --git a/tests/misc/hypersetup/Makefile b/tests/misc/hypersetup/Makefile new file mode 100644 index 0000000..7931aaf --- /dev/null +++ b/tests/misc/hypersetup/Makefile @@ -0,0 +1,3 @@ +test: + latexmk -c test.tex + latexmk -dvi- -pdf test.tex diff --git a/tests/misc/hypersetup/test.bbl b/tests/misc/hypersetup/test.bbl new file mode 100644 index 0000000..055c523 --- /dev/null +++ b/tests/misc/hypersetup/test.bbl @@ -0,0 +1,20 @@ +% $ biblatex auxiliary file $ +% $ biblatex bbl format version 3.1 $ +% Do not modify the above lines! +% +% This is an auxiliary file used by the 'biblatex' package. +% This file may safely be deleted. It will be recreated by +% biber as required. +% +\begingroup +\makeatletter +\@ifundefined{ver@biblatex.sty} + {\@latex@error + {Missing 'biblatex' package} + {The bibliography requires the 'biblatex' package.} + \aftergroup\endinput} + {} +\endgroup + +\endinput + diff --git a/tests/misc/hypersetup/test.out b/tests/misc/hypersetup/test.out new file mode 100644 index 0000000..1c879f7 --- /dev/null +++ b/tests/misc/hypersetup/test.out @@ -0,0 +1 @@ +\BOOKMARK [1][-]{section.1}{test}{}% 1 diff --git a/tests/misc/hypersetup/test.run.xml b/tests/misc/hypersetup/test.run.xml new file mode 100644 index 0000000..01ca856 --- /dev/null +++ b/tests/misc/hypersetup/test.run.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + +]> + + + latex + + test.bcf + + + test.bbl + + + blx-dm.def + blx-compat.def + biblatex.def + standard.bbx + alphabetic.bbx + alphabetic.cbx + biblatex.cfg + english.lbx + + + + biber + + biber + test + + + test.bcf + + + test.bbl + + + test.bbl + + + test.bcf + + + bibliography.bib + images.bib + + + diff --git a/tests/misc/hypersetup/test.tex b/tests/misc/hypersetup/test.tex new file mode 100644 index 0000000..681d0ff --- /dev/null +++ b/tests/misc/hypersetup/test.tex @@ -0,0 +1,16 @@ +\documentclass{article} + +\usepackage[cleveref]{mkessler-hypersetup} + +\title{Geometrie} +\author{Maximilian Keßler} + +\begin{document} + \maketitle + test + + \section{test} + \label{foo} + + \Cref{foo} test. +\end{document} diff --git a/tests/misc/vocab/Makefile b/tests/misc/vocab/Makefile new file mode 100644 index 0000000..7931aaf --- /dev/null +++ b/tests/misc/vocab/Makefile @@ -0,0 +1,3 @@ +test: + latexmk -c test.tex + latexmk -dvi- -pdf test.tex diff --git a/tests/misc/vocab/test.tex b/tests/misc/vocab/test.tex new file mode 100644 index 0000000..6f60500 --- /dev/null +++ b/tests/misc/vocab/test.tex @@ -0,0 +1,11 @@ +\documentclass{article} + +\usepackage[index]{mkessler-vocab} + + + +\begin{document} + \section{beg}\label{foo} + \vocab{test} test. + \printvocabindex +\end{document} diff --git a/tests/misc/vocab/vocabindex.idx b/tests/misc/vocab/vocabindex.idx new file mode 100644 index 0000000..7889d72 --- /dev/null +++ b/tests/misc/vocab/vocabindex.idx @@ -0,0 +1 @@ +\indexentry{Test}{1} diff --git a/tests/misc/vocab/vocabindex.ilg b/tests/misc/vocab/vocabindex.ilg new file mode 100644 index 0000000..92ed096 --- /dev/null +++ b/tests/misc/vocab/vocabindex.ilg @@ -0,0 +1,6 @@ +This is makeindex, version 2.15 [TeX Live 2019] (kpathsea + Thai support). +Scanning input file vocabindex.idx....done (1 entries accepted, 0 rejected). +Sorting entries...done (0 comparisons). +Generating output file vocabindex.ind....done (5 lines written, 0 warnings). +Output written in vocabindex.ind. +Transcript written in vocabindex.ilg. diff --git a/tests/misc/vocab/vocabindex.ind b/tests/misc/vocab/vocabindex.ind new file mode 100644 index 0000000..daf8d44 --- /dev/null +++ b/tests/misc/vocab/vocabindex.ind @@ -0,0 +1,5 @@ +\begin{theindex} + + \item Test, 1 + +\end{theindex} diff --git a/tests/utils/Makefile b/tests/utils/Makefile new file mode 100644 index 0000000..61533ed --- /dev/null +++ b/tests/utils/Makefile @@ -0,0 +1,7 @@ +SUBDIRS := $(wildcard */.) + +all: $(SUBDIRS) +$(SUBDIRS): + $(MAKE) -C $@ + +.PHONY: all $(SUBDIRS) diff --git a/tests/utils/counters/Makefile b/tests/utils/counters/Makefile new file mode 100644 index 0000000..7931aaf --- /dev/null +++ b/tests/utils/counters/Makefile @@ -0,0 +1,3 @@ +test: + latexmk -c test.tex + latexmk -dvi- -pdf test.tex diff --git a/tests/utils/counters/test.cnt b/tests/utils/counters/test.cnt new file mode 100644 index 0000000..bbe51f4 --- /dev/null +++ b/tests/utils/counters/test.cnt @@ -0,0 +1,12 @@ +subparagraph: 1.0.0.0.0 +paragraph: 1.0.0.0 +subsubsection: 1.0.0 +subsection: 1.0 +section: 1 +subparagraph: 2.0.0.0.0 +paragraph: 2.0.0.0 +subsubsection: 2.0.0 +subsection: 2.0 +section: 2 +dummy: 1 +page: 2 diff --git a/tests/utils/counters/test.tex b/tests/utils/counters/test.tex new file mode 100644 index 0000000..e87b7d9 --- /dev/null +++ b/tests/utils/counters/test.tex @@ -0,0 +1,15 @@ +\documentclass{article} + +\usepackage{mkessler-counters} + +\begin{document} + +\section{test} + +\section{test} + +\newcounter{dummy} +\refstepcounter{dummy} + + +\end{document} diff --git a/tests/utils/findpackage/Makefile b/tests/utils/findpackage/Makefile new file mode 100644 index 0000000..7931aaf --- /dev/null +++ b/tests/utils/findpackage/Makefile @@ -0,0 +1,3 @@ +test: + latexmk -c test.tex + latexmk -dvi- -pdf test.tex diff --git a/tests/utils/findpackage/test.tex b/tests/utils/findpackage/test.tex new file mode 100644 index 0000000..afa2bdb --- /dev/null +++ b/tests/utils/findpackage/test.tex @@ -0,0 +1,10 @@ +\RequirePackage{mkessler-findpackage} +\findpackagebycommand{blindtext} + +\documentclass{article} + +\usepackage{blindtext} + +\begin{document} +Just a small test. +\end{document} diff --git a/tests/wip/Makefile b/tests/wip/Makefile new file mode 100644 index 0000000..61533ed --- /dev/null +++ b/tests/wip/Makefile @@ -0,0 +1,7 @@ +SUBDIRS := $(wildcard */.) + +all: $(SUBDIRS) +$(SUBDIRS): + $(MAKE) -C $@ + +.PHONY: all $(SUBDIRS) diff --git a/tests/wip/proof/Makefile b/tests/wip/proof/Makefile new file mode 100644 index 0000000..5c90a51 --- /dev/null +++ b/tests/wip/proof/Makefile @@ -0,0 +1,4 @@ +skip: .skip + +.skip: + @touch .skip diff --git a/tests/wip/proof/test.tex b/tests/wip/proof/test.tex new file mode 100644 index 0000000..6205bab --- /dev/null +++ b/tests/wip/proof/test.tex @@ -0,0 +1,48 @@ +\documentclass[german]{article} + +\usepackage{mkessler-proof} +\usepackage{mkessler-fancythm} +\usepackage{mkessler-hypersetup} +\usepackage{parskip} + +\begin{document} +\section{test} + +\begin{theorem}\label{thm:krass} + Man sollte nach Würzburg fahren. +\end{theorem} + +\begin{rproof}{thm:krass} + \begin{claim}\label{cl:qed} + Der QED ist toll. + \end{claim} + Um \autoref{cl:qed} zu beweisen, brauchen wir zunächst ein Lemma. +\end{rproof} + +\begin{lemma}\label{lm:krass} + Mathevereine sind krass. +\end{lemma} + +\begin{rproof}{lm:krass} + \begin{claim} + Mathe ist cool. + \end{claim} + \begin{subproof} + trivial. + \end{subproof} + Damit folgt nun das Lemma. +\end{rproof} + +Nun kommen wir wieder zurück zum eigentlichen Beweis: + +\begin{rproof}{thm:krass} + \begin{claim}\label{cl:würzburg} + Der QED macht ein Seminar in Würzburg + \end{claim} + \begin{subproof} + Zu prüfen in der DB. Fakt! + \end{subproof} +Aus \autoref{cl:qed} und \autoref{cl:würzburg} folgt nun die Aussage. +\end{rproof} +test +\end{document} diff --git a/tests/wip/restate/Makefile b/tests/wip/restate/Makefile new file mode 100644 index 0000000..7931aaf --- /dev/null +++ b/tests/wip/restate/Makefile @@ -0,0 +1,3 @@ +test: + latexmk -c test.tex + latexmk -dvi- -pdf test.tex diff --git a/tests/wip/restate/test.tex b/tests/wip/restate/test.tex new file mode 100644 index 0000000..f64a2f0 --- /dev/null +++ b/tests/wip/restate/test.tex @@ -0,0 +1,16 @@ +\documentclass{article} + +\usepackage[german]{mkessler-restate} + +\begin{document} + +\NewDocumentCommand{\testbla}{s}{ +\ifx#1\BooleanTrue Starred version called\else\relax\fi + \LaTeX +} + +\undef\testbla + +\restatetheorem{testbla} + +\end{document} From ec19129708aa27ddaa9c0e2b7721cccfa3f78f92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Thu, 7 Oct 2021 14:27:49 +0200 Subject: [PATCH 19/36] update submodule --- PyTeX | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PyTeX b/PyTeX index d1a269b..e213c70 160000 --- a/PyTeX +++ b/PyTeX @@ -1 +1 @@ -Subproject commit d1a269b56bf005bc885b73fc8b115f264b737af2 +Subproject commit e213c706eaaad4b3728c52b5a47d9f6d602ddb0e From 7722a0d0429eb952704b77142330bc0213c1ad14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Thu, 7 Oct 2021 18:02:11 +0200 Subject: [PATCH 20/36] include build information when building packages --- PyTeX | 2 +- build.py | 37 ++++++++++++++++++++++++++++++++++++- git_version.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 git_version.py diff --git a/PyTeX b/PyTeX index e213c70..dbdd99c 160000 --- a/PyTeX +++ b/PyTeX @@ -1 +1 @@ -Subproject commit e213c706eaaad4b3728c52b5a47d9f6d602ddb0e +Subproject commit dbdd99cc3d6e02b0cfadb1d337f6b85c5f52a9b5 diff --git a/build.py b/build.py index 44321fe..204c941 100644 --- a/build.py +++ b/build.py @@ -1,18 +1,53 @@ from pathlib import * import sys +import git +from datetime import * sys.path.insert(0, 'PyTeX/') from package_formatter import PackageFormatter from replacements import make_default_commands +from git_version import git_describe + +BUILD_DETAILS = [ + "Build details:", + " Build time: {build_time}", + " PyTeX version: {pytex_version} (commit {pytex_commit_hash})", + " LatexPackages version: {packages_version} (commit {packages_commit_hash})" +] + + +def build_details(): + repo = git.Repo() + repo_description = git_describe(repo.head.ref.commit) + pytex_repo = repo.submodule('PyTeX').module() + pytex_repo_description = git_describe(pytex_repo.head.ref.commit) + return list(map(lambda line: line.format( + build_time=datetime.now().strftime('%Y/%m/%d %H:%M'), + pytex_version=pytex_repo_description, + pytex_commit_hash=pytex_repo.head.ref.commit.hexsha[0:7], + packages_version=repo_description, + packages_commit_hash=repo.head.ref.commit.hexsha[0:7] + ),BUILD_DETAILS)) + def build(build_dir: str): input_root = Path('./packages').resolve() output = input_root / build_dir + print('[PyTeX] Getting git repository information...') + extra_header = build_details() + print('[PyTeX] ..done.') + if git.Repo().is_dirty(): + extra_header += ['WARNING: Local changes to git repository detected.', + ' The build will not be reproducible (!)'] + num_files = 0 for file in input_root.rglob('*.pysty'): - formatter = PackageFormatter(package_name=file.with_suffix('').name) + num_files+=1 + formatter = PackageFormatter(package_name=file.with_suffix('').name, extra_header=extra_header) print('[PyTeX] Writing file {}'.format(formatter.file_name)) make_default_commands(formatter) formatter.format_package(file, Path('./').resolve() / build_dir / str(file.parent.relative_to(input_root))) + print(f'[PyTeX] Successfully built {num_files} packages in {build_dir}/') if __name__ == "__main__": build('build') + diff --git a/git_version.py b/git_version.py new file mode 100644 index 0000000..11009de --- /dev/null +++ b/git_version.py @@ -0,0 +1,45 @@ +import git +from typing import Dict + + +def get_history(commit: git.objects.commit.Commit, priority=0, depth=0) -> Dict: + commit_history = {commit.hexsha: { + 'priority': priority, + 'depth': depth + }} + if len(commit.parents) == 0: + return commit_history + else: + commit_history.update(get_history(commit.parents[0], priority, depth+1)) + for parent in commit.parents[1:]: + commit_history.update(get_history(parent, priority+1, depth+1)) + return commit_history + + +def git_describe(commit: git.objects.commit.Commit): + commit_history = get_history(commit) + latest_tag = None + for tag in commit.repo.tags: + sha = tag.commit.hexsha + if sha in commit_history.keys(): + if latest_tag is None: + latest_tag = tag + elif commit_history[sha]['priority'] < commit_history[latest_tag.commit.hexsha]['priority']: + latest_tag = tag + elif commit_history[sha]['priority'] > commit_history[latest_tag.commit.hexsha]['priority']: + pass # move on + elif commit_history[sha]['depth'] < commit_history[latest_tag.commit.hexsha]['depth']: + latest_tag = tag + elif commit_history[sha]['depth'] > commit_history[latest_tag.commit.hexsha]['depth']: + pass # move on + elif tag.object.tagged_date > latest_tag.object.tagged_date: + latest_tag = tag + if latest_tag is None: + return "No tags found - cannot describe anything." + else: + msg = latest_tag.name + if commit_history[latest_tag.commit.hexsha]['depth'] != 0: + msg += "-{depth}".format(depth=commit_history[latest_tag.commit.hexsha]['depth']) + if commit.repo.is_dirty(untracked_files=True): + msg += '-*' + return msg From 645def4b8f65dbe22bb9cc5c52d64f52b04a9d0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Thu, 7 Oct 2021 18:07:51 +0200 Subject: [PATCH 21/36] update gitignore --- .gitignore | 1 + tests/.gitignore | 5 +++++ tests/COMPILE_MAKEFILE | 3 +++ tests/DIR_MAKEFILE | 7 +++++++ tests/Makefile | 8 +------- tests/environments/Makefile | 8 +------- tests/environments/fancythm/Makefile | 4 +--- tests/lecture-notes/Makefile | 8 +------- tests/lecture-notes/lectures/Makefile | 4 +--- tests/math/Makefile | 8 +------- tests/math/faktor/Makefile | 4 +--- tests/math/faktor/test.tex | 1 + tests/math/math/Makefile | 4 +--- tests/math/mathalias/Makefile | 4 +--- tests/math/mathfig/Makefile | 4 +--- tests/math/mathfixes/Makefile | 4 +--- tests/math/mathfont/Makefile | 4 +--- tests/math/mathop/Makefile | 4 +--- tests/math/mathsymb/Makefile | 4 +--- tests/math/unicodechar/Makefile | 4 +--- tests/misc/Makefile | 8 +------- tests/misc/hypersetup/Makefile | 4 +--- tests/misc/hypersetup/test.out | 1 - tests/misc/vocab/Makefile | 4 +--- tests/misc/vocab/vocabindex.idx | 1 - tests/misc/vocab/vocabindex.ilg | 6 ------ tests/misc/vocab/vocabindex.ind | 5 ----- tests/utils/Makefile | 8 +------- tests/utils/counters/Makefile | 4 +--- tests/utils/findpackage/Makefile | 4 +--- tests/wip/Makefile | 8 +------- tests/wip/proof/Makefile | 5 +---- tests/wip/restate/Makefile | 4 +--- 33 files changed, 41 insertions(+), 114 deletions(-) create mode 100644 tests/COMPILE_MAKEFILE create mode 100644 tests/DIR_MAKEFILE mode change 100644 => 120000 tests/Makefile mode change 100644 => 120000 tests/environments/Makefile mode change 100644 => 120000 tests/environments/fancythm/Makefile mode change 100644 => 120000 tests/lecture-notes/Makefile mode change 100644 => 120000 tests/lecture-notes/lectures/Makefile mode change 100644 => 120000 tests/math/Makefile mode change 100644 => 120000 tests/math/faktor/Makefile mode change 100644 => 120000 tests/math/math/Makefile mode change 100644 => 120000 tests/math/mathalias/Makefile mode change 100644 => 120000 tests/math/mathfig/Makefile mode change 100644 => 120000 tests/math/mathfixes/Makefile mode change 100644 => 120000 tests/math/mathfont/Makefile mode change 100644 => 120000 tests/math/mathop/Makefile mode change 100644 => 120000 tests/math/mathsymb/Makefile mode change 100644 => 120000 tests/math/unicodechar/Makefile mode change 100644 => 120000 tests/misc/Makefile mode change 100644 => 120000 tests/misc/hypersetup/Makefile delete mode 100644 tests/misc/hypersetup/test.out mode change 100644 => 120000 tests/misc/vocab/Makefile delete mode 100644 tests/misc/vocab/vocabindex.idx delete mode 100644 tests/misc/vocab/vocabindex.ilg delete mode 100644 tests/misc/vocab/vocabindex.ind mode change 100644 => 120000 tests/utils/Makefile mode change 100644 => 120000 tests/utils/counters/Makefile mode change 100644 => 120000 tests/utils/findpackage/Makefile mode change 100644 => 120000 tests/wip/Makefile mode change 100644 => 120000 tests/wip/proof/Makefile mode change 100644 => 120000 tests/wip/restate/Makefile diff --git a/.gitignore b/.gitignore index 41702df..33e9a46 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ build/* .gitconfiglock .initsubmodulelock .idea/ +__pycache__ diff --git a/tests/.gitignore b/tests/.gitignore index ba167d2..41830ed 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -4,3 +4,8 @@ *.log *.pdf wip/proof/.skip +*.out +*.idx +*.ilg +*.ind +*.cnt diff --git a/tests/COMPILE_MAKEFILE b/tests/COMPILE_MAKEFILE new file mode 100644 index 0000000..768055d --- /dev/null +++ b/tests/COMPILE_MAKEFILE @@ -0,0 +1,3 @@ +test: + latexmk -dvi- -pdf -gg -Werror -latexoption=-interaction=nonstopmode test.tex + latexmk -c test.tex diff --git a/tests/DIR_MAKEFILE b/tests/DIR_MAKEFILE new file mode 100644 index 0000000..61533ed --- /dev/null +++ b/tests/DIR_MAKEFILE @@ -0,0 +1,7 @@ +SUBDIRS := $(wildcard */.) + +all: $(SUBDIRS) +$(SUBDIRS): + $(MAKE) -C $@ + +.PHONY: all $(SUBDIRS) diff --git a/tests/Makefile b/tests/Makefile deleted file mode 100644 index 61533ed..0000000 --- a/tests/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -SUBDIRS := $(wildcard */.) - -all: $(SUBDIRS) -$(SUBDIRS): - $(MAKE) -C $@ - -.PHONY: all $(SUBDIRS) diff --git a/tests/Makefile b/tests/Makefile new file mode 120000 index 0000000..57a5fed --- /dev/null +++ b/tests/Makefile @@ -0,0 +1 @@ +DIR_MAKEFILE \ No newline at end of file diff --git a/tests/environments/Makefile b/tests/environments/Makefile deleted file mode 100644 index 61533ed..0000000 --- a/tests/environments/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -SUBDIRS := $(wildcard */.) - -all: $(SUBDIRS) -$(SUBDIRS): - $(MAKE) -C $@ - -.PHONY: all $(SUBDIRS) diff --git a/tests/environments/Makefile b/tests/environments/Makefile new file mode 120000 index 0000000..63f6ffd --- /dev/null +++ b/tests/environments/Makefile @@ -0,0 +1 @@ +../DIR_MAKEFILE \ No newline at end of file diff --git a/tests/environments/fancythm/Makefile b/tests/environments/fancythm/Makefile deleted file mode 100644 index 7931aaf..0000000 --- a/tests/environments/fancythm/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -test: - latexmk -c test.tex - latexmk -dvi- -pdf test.tex diff --git a/tests/environments/fancythm/Makefile b/tests/environments/fancythm/Makefile new file mode 120000 index 0000000..0fde22c --- /dev/null +++ b/tests/environments/fancythm/Makefile @@ -0,0 +1 @@ +../../COMPILE_MAKEFILE \ No newline at end of file diff --git a/tests/lecture-notes/Makefile b/tests/lecture-notes/Makefile deleted file mode 100644 index 61533ed..0000000 --- a/tests/lecture-notes/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -SUBDIRS := $(wildcard */.) - -all: $(SUBDIRS) -$(SUBDIRS): - $(MAKE) -C $@ - -.PHONY: all $(SUBDIRS) diff --git a/tests/lecture-notes/Makefile b/tests/lecture-notes/Makefile new file mode 120000 index 0000000..63f6ffd --- /dev/null +++ b/tests/lecture-notes/Makefile @@ -0,0 +1 @@ +../DIR_MAKEFILE \ No newline at end of file diff --git a/tests/lecture-notes/lectures/Makefile b/tests/lecture-notes/lectures/Makefile deleted file mode 100644 index 7931aaf..0000000 --- a/tests/lecture-notes/lectures/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -test: - latexmk -c test.tex - latexmk -dvi- -pdf test.tex diff --git a/tests/lecture-notes/lectures/Makefile b/tests/lecture-notes/lectures/Makefile new file mode 120000 index 0000000..0fde22c --- /dev/null +++ b/tests/lecture-notes/lectures/Makefile @@ -0,0 +1 @@ +../../COMPILE_MAKEFILE \ No newline at end of file diff --git a/tests/math/Makefile b/tests/math/Makefile deleted file mode 100644 index 61533ed..0000000 --- a/tests/math/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -SUBDIRS := $(wildcard */.) - -all: $(SUBDIRS) -$(SUBDIRS): - $(MAKE) -C $@ - -.PHONY: all $(SUBDIRS) diff --git a/tests/math/Makefile b/tests/math/Makefile new file mode 120000 index 0000000..63f6ffd --- /dev/null +++ b/tests/math/Makefile @@ -0,0 +1 @@ +../DIR_MAKEFILE \ No newline at end of file diff --git a/tests/math/faktor/Makefile b/tests/math/faktor/Makefile deleted file mode 100644 index 8381565..0000000 --- a/tests/math/faktor/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -test: - latexmk -c test.tex - latexmk -pdf -dvi- test.tex diff --git a/tests/math/faktor/Makefile b/tests/math/faktor/Makefile new file mode 120000 index 0000000..0fde22c --- /dev/null +++ b/tests/math/faktor/Makefile @@ -0,0 +1 @@ +../../COMPILE_MAKEFILE \ No newline at end of file diff --git a/tests/math/faktor/test.tex b/tests/math/faktor/test.tex index e15312d..b2deb2b 100644 --- a/tests/math/faktor/test.tex +++ b/tests/math/faktor/test.tex @@ -3,6 +3,7 @@ \usepackage{mkessler-faktor} \begin{document} + \[ \faktor{A}{B} \cong \cofaktor{A}{B} \] diff --git a/tests/math/math/Makefile b/tests/math/math/Makefile deleted file mode 100644 index 7931aaf..0000000 --- a/tests/math/math/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -test: - latexmk -c test.tex - latexmk -dvi- -pdf test.tex diff --git a/tests/math/math/Makefile b/tests/math/math/Makefile new file mode 120000 index 0000000..0fde22c --- /dev/null +++ b/tests/math/math/Makefile @@ -0,0 +1 @@ +../../COMPILE_MAKEFILE \ No newline at end of file diff --git a/tests/math/mathalias/Makefile b/tests/math/mathalias/Makefile deleted file mode 100644 index 8381565..0000000 --- a/tests/math/mathalias/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -test: - latexmk -c test.tex - latexmk -pdf -dvi- test.tex diff --git a/tests/math/mathalias/Makefile b/tests/math/mathalias/Makefile new file mode 120000 index 0000000..0fde22c --- /dev/null +++ b/tests/math/mathalias/Makefile @@ -0,0 +1 @@ +../../COMPILE_MAKEFILE \ No newline at end of file diff --git a/tests/math/mathfig/Makefile b/tests/math/mathfig/Makefile deleted file mode 100644 index 7931aaf..0000000 --- a/tests/math/mathfig/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -test: - latexmk -c test.tex - latexmk -dvi- -pdf test.tex diff --git a/tests/math/mathfig/Makefile b/tests/math/mathfig/Makefile new file mode 120000 index 0000000..0fde22c --- /dev/null +++ b/tests/math/mathfig/Makefile @@ -0,0 +1 @@ +../../COMPILE_MAKEFILE \ No newline at end of file diff --git a/tests/math/mathfixes/Makefile b/tests/math/mathfixes/Makefile deleted file mode 100644 index 7931aaf..0000000 --- a/tests/math/mathfixes/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -test: - latexmk -c test.tex - latexmk -dvi- -pdf test.tex diff --git a/tests/math/mathfixes/Makefile b/tests/math/mathfixes/Makefile new file mode 120000 index 0000000..0fde22c --- /dev/null +++ b/tests/math/mathfixes/Makefile @@ -0,0 +1 @@ +../../COMPILE_MAKEFILE \ No newline at end of file diff --git a/tests/math/mathfont/Makefile b/tests/math/mathfont/Makefile deleted file mode 100644 index 7931aaf..0000000 --- a/tests/math/mathfont/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -test: - latexmk -c test.tex - latexmk -dvi- -pdf test.tex diff --git a/tests/math/mathfont/Makefile b/tests/math/mathfont/Makefile new file mode 120000 index 0000000..0fde22c --- /dev/null +++ b/tests/math/mathfont/Makefile @@ -0,0 +1 @@ +../../COMPILE_MAKEFILE \ No newline at end of file diff --git a/tests/math/mathop/Makefile b/tests/math/mathop/Makefile deleted file mode 100644 index 7931aaf..0000000 --- a/tests/math/mathop/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -test: - latexmk -c test.tex - latexmk -dvi- -pdf test.tex diff --git a/tests/math/mathop/Makefile b/tests/math/mathop/Makefile new file mode 120000 index 0000000..0fde22c --- /dev/null +++ b/tests/math/mathop/Makefile @@ -0,0 +1 @@ +../../COMPILE_MAKEFILE \ No newline at end of file diff --git a/tests/math/mathsymb/Makefile b/tests/math/mathsymb/Makefile deleted file mode 100644 index 7931aaf..0000000 --- a/tests/math/mathsymb/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -test: - latexmk -c test.tex - latexmk -dvi- -pdf test.tex diff --git a/tests/math/mathsymb/Makefile b/tests/math/mathsymb/Makefile new file mode 120000 index 0000000..0fde22c --- /dev/null +++ b/tests/math/mathsymb/Makefile @@ -0,0 +1 @@ +../../COMPILE_MAKEFILE \ No newline at end of file diff --git a/tests/math/unicodechar/Makefile b/tests/math/unicodechar/Makefile deleted file mode 100644 index 7931aaf..0000000 --- a/tests/math/unicodechar/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -test: - latexmk -c test.tex - latexmk -dvi- -pdf test.tex diff --git a/tests/math/unicodechar/Makefile b/tests/math/unicodechar/Makefile new file mode 120000 index 0000000..0fde22c --- /dev/null +++ b/tests/math/unicodechar/Makefile @@ -0,0 +1 @@ +../../COMPILE_MAKEFILE \ No newline at end of file diff --git a/tests/misc/Makefile b/tests/misc/Makefile deleted file mode 100644 index 61533ed..0000000 --- a/tests/misc/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -SUBDIRS := $(wildcard */.) - -all: $(SUBDIRS) -$(SUBDIRS): - $(MAKE) -C $@ - -.PHONY: all $(SUBDIRS) diff --git a/tests/misc/Makefile b/tests/misc/Makefile new file mode 120000 index 0000000..63f6ffd --- /dev/null +++ b/tests/misc/Makefile @@ -0,0 +1 @@ +../DIR_MAKEFILE \ No newline at end of file diff --git a/tests/misc/hypersetup/Makefile b/tests/misc/hypersetup/Makefile deleted file mode 100644 index 7931aaf..0000000 --- a/tests/misc/hypersetup/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -test: - latexmk -c test.tex - latexmk -dvi- -pdf test.tex diff --git a/tests/misc/hypersetup/Makefile b/tests/misc/hypersetup/Makefile new file mode 120000 index 0000000..0fde22c --- /dev/null +++ b/tests/misc/hypersetup/Makefile @@ -0,0 +1 @@ +../../COMPILE_MAKEFILE \ No newline at end of file diff --git a/tests/misc/hypersetup/test.out b/tests/misc/hypersetup/test.out deleted file mode 100644 index 1c879f7..0000000 --- a/tests/misc/hypersetup/test.out +++ /dev/null @@ -1 +0,0 @@ -\BOOKMARK [1][-]{section.1}{test}{}% 1 diff --git a/tests/misc/vocab/Makefile b/tests/misc/vocab/Makefile deleted file mode 100644 index 7931aaf..0000000 --- a/tests/misc/vocab/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -test: - latexmk -c test.tex - latexmk -dvi- -pdf test.tex diff --git a/tests/misc/vocab/Makefile b/tests/misc/vocab/Makefile new file mode 120000 index 0000000..0fde22c --- /dev/null +++ b/tests/misc/vocab/Makefile @@ -0,0 +1 @@ +../../COMPILE_MAKEFILE \ No newline at end of file diff --git a/tests/misc/vocab/vocabindex.idx b/tests/misc/vocab/vocabindex.idx deleted file mode 100644 index 7889d72..0000000 --- a/tests/misc/vocab/vocabindex.idx +++ /dev/null @@ -1 +0,0 @@ -\indexentry{Test}{1} diff --git a/tests/misc/vocab/vocabindex.ilg b/tests/misc/vocab/vocabindex.ilg deleted file mode 100644 index 92ed096..0000000 --- a/tests/misc/vocab/vocabindex.ilg +++ /dev/null @@ -1,6 +0,0 @@ -This is makeindex, version 2.15 [TeX Live 2019] (kpathsea + Thai support). -Scanning input file vocabindex.idx....done (1 entries accepted, 0 rejected). -Sorting entries...done (0 comparisons). -Generating output file vocabindex.ind....done (5 lines written, 0 warnings). -Output written in vocabindex.ind. -Transcript written in vocabindex.ilg. diff --git a/tests/misc/vocab/vocabindex.ind b/tests/misc/vocab/vocabindex.ind deleted file mode 100644 index daf8d44..0000000 --- a/tests/misc/vocab/vocabindex.ind +++ /dev/null @@ -1,5 +0,0 @@ -\begin{theindex} - - \item Test, 1 - -\end{theindex} diff --git a/tests/utils/Makefile b/tests/utils/Makefile deleted file mode 100644 index 61533ed..0000000 --- a/tests/utils/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -SUBDIRS := $(wildcard */.) - -all: $(SUBDIRS) -$(SUBDIRS): - $(MAKE) -C $@ - -.PHONY: all $(SUBDIRS) diff --git a/tests/utils/Makefile b/tests/utils/Makefile new file mode 120000 index 0000000..63f6ffd --- /dev/null +++ b/tests/utils/Makefile @@ -0,0 +1 @@ +../DIR_MAKEFILE \ No newline at end of file diff --git a/tests/utils/counters/Makefile b/tests/utils/counters/Makefile deleted file mode 100644 index 7931aaf..0000000 --- a/tests/utils/counters/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -test: - latexmk -c test.tex - latexmk -dvi- -pdf test.tex diff --git a/tests/utils/counters/Makefile b/tests/utils/counters/Makefile new file mode 120000 index 0000000..0fde22c --- /dev/null +++ b/tests/utils/counters/Makefile @@ -0,0 +1 @@ +../../COMPILE_MAKEFILE \ No newline at end of file diff --git a/tests/utils/findpackage/Makefile b/tests/utils/findpackage/Makefile deleted file mode 100644 index 7931aaf..0000000 --- a/tests/utils/findpackage/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -test: - latexmk -c test.tex - latexmk -dvi- -pdf test.tex diff --git a/tests/utils/findpackage/Makefile b/tests/utils/findpackage/Makefile new file mode 120000 index 0000000..0fde22c --- /dev/null +++ b/tests/utils/findpackage/Makefile @@ -0,0 +1 @@ +../../COMPILE_MAKEFILE \ No newline at end of file diff --git a/tests/wip/Makefile b/tests/wip/Makefile deleted file mode 100644 index 61533ed..0000000 --- a/tests/wip/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -SUBDIRS := $(wildcard */.) - -all: $(SUBDIRS) -$(SUBDIRS): - $(MAKE) -C $@ - -.PHONY: all $(SUBDIRS) diff --git a/tests/wip/Makefile b/tests/wip/Makefile new file mode 120000 index 0000000..63f6ffd --- /dev/null +++ b/tests/wip/Makefile @@ -0,0 +1 @@ +../DIR_MAKEFILE \ No newline at end of file diff --git a/tests/wip/proof/Makefile b/tests/wip/proof/Makefile deleted file mode 100644 index 5c90a51..0000000 --- a/tests/wip/proof/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -skip: .skip - -.skip: - @touch .skip diff --git a/tests/wip/proof/Makefile b/tests/wip/proof/Makefile new file mode 120000 index 0000000..0fde22c --- /dev/null +++ b/tests/wip/proof/Makefile @@ -0,0 +1 @@ +../../COMPILE_MAKEFILE \ No newline at end of file diff --git a/tests/wip/restate/Makefile b/tests/wip/restate/Makefile deleted file mode 100644 index 7931aaf..0000000 --- a/tests/wip/restate/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -test: - latexmk -c test.tex - latexmk -dvi- -pdf test.tex diff --git a/tests/wip/restate/Makefile b/tests/wip/restate/Makefile new file mode 120000 index 0000000..0fde22c --- /dev/null +++ b/tests/wip/restate/Makefile @@ -0,0 +1 @@ +../../COMPILE_MAKEFILE \ No newline at end of file From 386e3f0e0266b53ae038d6cf3b8c182a31999a4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Thu, 7 Oct 2021 19:47:47 +0200 Subject: [PATCH 22/36] add travis --- .travis.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..10ba5e6 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,30 @@ +sudo: true +dist: bionic +language: python +cache: apt + +addons: + apt: + packages: + - wget + - tree + - latexmk + - biber + - make + +install: + - pip install GitPython + +script: + - make build + - cd build + - tree -H '.' -I "index.html" -D --charset utf-8 -T "LatexPackages" > index.html + +deploy: + - provider: pages + skip-cleanup: true + github-token: $GITHUB_TOKEN + local-dir: build/ + keep-history: false + on: + branch: master From d4e42d01f95aaa6c961f3a763722311492d3bb49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Thu, 7 Oct 2021 20:25:04 +0200 Subject: [PATCH 23/36] fix build.py script to work with detached heads --- build.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/build.py b/build.py index 204c941..5784192 100644 --- a/build.py +++ b/build.py @@ -16,18 +16,25 @@ BUILD_DETAILS = [ ] +def get_latest_commit(repo): + if repo.head.is_detached: + return repo.head.commit + else: + return repo.head.ref.commit + + def build_details(): repo = git.Repo() - repo_description = git_describe(repo.head.ref.commit) + repo_description = git_describe(get_latest_commit(repo)) pytex_repo = repo.submodule('PyTeX').module() - pytex_repo_description = git_describe(pytex_repo.head.ref.commit) + pytex_repo_description = git_describe(get_latest_commit(pytex_repo)) return list(map(lambda line: line.format( build_time=datetime.now().strftime('%Y/%m/%d %H:%M'), pytex_version=pytex_repo_description, - pytex_commit_hash=pytex_repo.head.ref.commit.hexsha[0:7], + pytex_commit_hash=get_latest_commit(pytex_repo).hexsha[0:7], packages_version=repo_description, - packages_commit_hash=repo.head.ref.commit.hexsha[0:7] - ),BUILD_DETAILS)) + packages_commit_hash=get_latest_commit(repo).hexsha[0:7] + ), BUILD_DETAILS)) def build(build_dir: str): From 34f54e9c253bc6b78f6795a221d301974726231b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Thu, 7 Oct 2021 20:37:20 +0200 Subject: [PATCH 24/36] handle missing commits (shallow clones) in git_version retrieving --- git_version.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/git_version.py b/git_version.py index 11009de..e6da79c 100644 --- a/git_version.py +++ b/git_version.py @@ -7,13 +7,14 @@ def get_history(commit: git.objects.commit.Commit, priority=0, depth=0) -> Dict: 'priority': priority, 'depth': depth }} - if len(commit.parents) == 0: - return commit_history - else: - commit_history.update(get_history(commit.parents[0], priority, depth+1)) - for parent in commit.parents[1:]: - commit_history.update(get_history(parent, priority+1, depth+1)) - return commit_history + try: + if len(commit.parents) > 0: + commit_history.update(get_history(commit.parents[0], priority, depth+1)) + for parent in commit.parents[1:]: + commit_history.update(get_history(parent, priority+1, depth+1)) + except ValueError: + pass + return commit_history def git_describe(commit: git.objects.commit.Commit): From a2af0344b5ad4bf27412fb69cde9b5c82c6f5b16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Thu, 7 Oct 2021 21:47:54 +0200 Subject: [PATCH 25/36] add automatic releases on tags --- .travis.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 10ba5e6..306ce29 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,6 @@ cache: apt addons: apt: packages: - - wget - tree - latexmk - biber @@ -16,8 +15,9 @@ install: - pip install GitPython script: - - make build + - python3 -c 'from build import build; build("build/LatexPackages/")' - cd build + - zip -r LatexPackages.zip LatexPackages - tree -H '.' -I "index.html" -D --charset utf-8 -T "LatexPackages" > index.html deploy: @@ -28,3 +28,9 @@ deploy: keep-history: false on: branch: master + - provider: releases + api_key: $GITHUB_TOKEN + skip_cleanup: true + file: $TRAVIS_BUILD_DIR/build/LatexPackages.zip + on: + tags: true From c9fe26ba2e3ccb68b8917df718fc2bf64a1fb67c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <82446011+kesslermaximilian@users.noreply.github.com> Date: Thu, 7 Oct 2021 21:54:07 +0200 Subject: [PATCH 26/36] Update README.md show build status in readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index d2d96c0..0c35438 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +[![Build Status](https://api.travis-ci.com/kesslermaximilian/LatexPackages.svg)](https://app.travis-ci.com/github/kesslermaximilian/LatexPackages) # Latex Packages #### Rework in progress From a81a83c2d9abcd9b90f8d0af79b2c12b5a1cb594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Fri, 8 Oct 2021 07:32:21 +0200 Subject: [PATCH 27/36] deploy to build repo --- .travis.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.travis.yml b/.travis.yml index 306ce29..02a6e6c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,7 @@ script: - cd build - zip -r LatexPackages.zip LatexPackages - tree -H '.' -I "index.html" -D --charset utf-8 -T "LatexPackages" > index.html + - GIT_BRANCH=$(python3 -c "import git; print(git.Repo().active_branch.name)") deploy: - provider: pages @@ -34,3 +35,16 @@ deploy: file: $TRAVIS_BUILD_DIR/build/LatexPackages.zip on: tags: true + - provider: pages + skip-cleanup: true + github-token: $GITHUB_TOKEN + local-dir: build/LatexPackages + repo: kesslermaximilian/LatexPackagesBuild + commiter_from_gh: true + allow_empty_commit: true + keep-history: true + target_branch: $GIT_BRANCH + on: + branches: + only: + - /.*/ From b8a1c1b0a943a29160491fcd6cf882b675467166 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Fri, 8 Oct 2021 07:40:26 +0200 Subject: [PATCH 28/36] show git status on build --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index ffd4e1b..51902a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,7 @@ install: - pip install GitPython script: + - git status - GIT_BRANCH=$(python3 -c "import git; print(git.Repo().active_branch.name)") - python3 -c 'from build import build; build("build/LatexPackages/")' - cd build From 7f0b9bb54ce7e4235dc62b2157ce40424088f76f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Fri, 8 Oct 2021 07:54:34 +0200 Subject: [PATCH 29/36] retrieve branch from travis env --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 51902a7..cc7094e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,8 +15,6 @@ install: - pip install GitPython script: - - git status - - GIT_BRANCH=$(python3 -c "import git; print(git.Repo().active_branch.name)") - python3 -c 'from build import build; build("build/LatexPackages/")' - cd build - zip -r LatexPackages.zip LatexPackages @@ -44,8 +42,9 @@ deploy: commiter_from_gh: true allow_empty_commit: true keep-history: true - target_branch: $GIT_BRANCH + target_branch: $TRAVIS_BRANCH on: branches: only: - /.*/ + condition: $TRAVIS_PULL_REQUEST = false From 1b1737e126a721b276590d34d3ed8ee641619f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Fri, 8 Oct 2021 08:21:48 +0200 Subject: [PATCH 30/36] do not keep history for testing reasons --- .travis.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index cc7094e..8bd2699 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,10 @@ script: - cd build - zip -r LatexPackages.zip LatexPackages - tree -H '.' -I "index.html" -D --charset utf-8 -T "LatexPackages" > index.html + - cd .. + +after_success: + deploy: - provider: pages @@ -41,7 +45,7 @@ deploy: repo: kesslermaximilian/LatexPackagesBuild commiter_from_gh: true allow_empty_commit: true - keep-history: true + keep-history: false target_branch: $TRAVIS_BRANCH on: branches: From d632e4b42174314fe8696c7fc50d2436de87fc46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Fri, 8 Oct 2021 08:33:13 +0200 Subject: [PATCH 31/36] keep history, adjust deploy message, --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8bd2699..5b564c8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,8 +45,9 @@ deploy: repo: kesslermaximilian/LatexPackagesBuild commiter_from_gh: true allow_empty_commit: true - keep-history: false + keep-history: true target_branch: $TRAVIS_BRANCH + commit_message: "%{git_commit_msg}\n\nBuilt commit %{git_sha} from %{repo}:%{git_branch}" on: branches: only: From 3cc9eb8509db712b260dbeeaf9ede09aba955749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Fri, 8 Oct 2021 08:44:08 +0200 Subject: [PATCH 32/36] use beta travis provider for custom deploy msg --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5b564c8..c65f1ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,13 +39,12 @@ deploy: on: tags: true - provider: pages - skip-cleanup: true + edge: true github-token: $GITHUB_TOKEN local-dir: build/LatexPackages repo: kesslermaximilian/LatexPackagesBuild commiter_from_gh: true allow_empty_commit: true - keep-history: true target_branch: $TRAVIS_BRANCH commit_message: "%{git_commit_msg}\n\nBuilt commit %{git_sha} from %{repo}:%{git_branch}" on: From f97e7eec3f32aaf1feb52ff0cceccd2d2c14a353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Fri, 8 Oct 2021 08:57:27 +0200 Subject: [PATCH 33/36] deploy to build repo on all branches --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index c65f1ba..5f364da 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,7 +48,5 @@ deploy: target_branch: $TRAVIS_BRANCH commit_message: "%{git_commit_msg}\n\nBuilt commit %{git_sha} from %{repo}:%{git_branch}" on: - branches: - only: - - /.*/ + all_branches: true condition: $TRAVIS_PULL_REQUEST = false From 6101618f6bba7a19be67957201c9a4358837a6e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Fri, 8 Oct 2021 09:17:56 +0200 Subject: [PATCH 34/36] better commit msg on build --- .travis.yml | 3 ++- build.py | 33 ++++++++++++++------------------- git_version.py | 24 ++++++++++++++++++++++-- 3 files changed, 38 insertions(+), 22 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5f364da..8b8c09c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,7 @@ install: - pip install GitPython script: + - export COMMIT_MSG=$(python3 -c 'from git_version import get_deploy_message; print(get_deploy_message())' - python3 -c 'from build import build; build("build/LatexPackages/")' - cd build - zip -r LatexPackages.zip LatexPackages @@ -46,7 +47,7 @@ deploy: commiter_from_gh: true allow_empty_commit: true target_branch: $TRAVIS_BRANCH - commit_message: "%{git_commit_msg}\n\nBuilt commit %{git_sha} from %{repo}:%{git_branch}" + commit_message: $COMMIT_MSG on: all_branches: true condition: $TRAVIS_PULL_REQUEST = false diff --git a/build.py b/build.py index 5784192..962a773 100644 --- a/build.py +++ b/build.py @@ -2,11 +2,12 @@ from pathlib import * import sys import git from datetime import * + sys.path.insert(0, 'PyTeX/') from package_formatter import PackageFormatter from replacements import make_default_commands -from git_version import git_describe +from git_version import git_describe, get_latest_commit BUILD_DETAILS = [ "Build details:", @@ -16,45 +17,39 @@ BUILD_DETAILS = [ ] -def get_latest_commit(repo): - if repo.head.is_detached: - return repo.head.commit - else: - return repo.head.ref.commit - - def build_details(): repo = git.Repo() repo_description = git_describe(get_latest_commit(repo)) pytex_repo = repo.submodule('PyTeX').module() pytex_repo_description = git_describe(get_latest_commit(pytex_repo)) return list(map(lambda line: line.format( - build_time=datetime.now().strftime('%Y/%m/%d %H:%M'), - pytex_version=pytex_repo_description, - pytex_commit_hash=get_latest_commit(pytex_repo).hexsha[0:7], - packages_version=repo_description, - packages_commit_hash=get_latest_commit(repo).hexsha[0:7] - ), BUILD_DETAILS)) + build_time=datetime.now().strftime('%Y/%m/%d %H:%M'), + pytex_version=pytex_repo_description, + pytex_commit_hash=get_latest_commit(pytex_repo).hexsha[0:7], + packages_version=repo_description, + packages_commit_hash=get_latest_commit(repo).hexsha[0:7] + ), BUILD_DETAILS)), repo_description def build(build_dir: str): input_root = Path('./packages').resolve() output = input_root / build_dir print('[PyTeX] Getting git repository information...') - extra_header = build_details() - print('[PyTeX] ..done.') + extra_header, repo_description = build_details() + print('[PyTeX] Building version {version} of LatexPackages'.format(version=repo_description)) + print('[PyTeX] Latest commit message: ' + get_latest_commit(git.Repo()).message.strip()) if git.Repo().is_dirty(): extra_header += ['WARNING: Local changes to git repository detected.', - ' The build will not be reproducible (!)'] + ' The build will not be reproducible (!)'] num_files = 0 for file in input_root.rglob('*.pysty'): - num_files+=1 + num_files += 1 formatter = PackageFormatter(package_name=file.with_suffix('').name, extra_header=extra_header) print('[PyTeX] Writing file {}'.format(formatter.file_name)) make_default_commands(formatter) formatter.format_package(file, Path('./').resolve() / build_dir / str(file.parent.relative_to(input_root))) print(f'[PyTeX] Successfully built {num_files} packages in {build_dir}/') + if __name__ == "__main__": build('build') - diff --git a/git_version.py b/git_version.py index e6da79c..08965b9 100644 --- a/git_version.py +++ b/git_version.py @@ -1,5 +1,25 @@ import git from typing import Dict +import os + + +def get_latest_commit(repo): + if repo.head.is_detached: + return repo.head.commit + else: + return repo.head.ref.commit + + +def get_deploy_message(): + repo = git.Repo() + old_msg = get_latest_commit(repo).message + return "{old_msg}\n" \ + "\n" \ + "Build branch {branch} ({hexsha}) from {repo_name}" \ + .format(old_msg=old_msg, + branch=os.environ['TRAVIS_BRANCH'], + hexsha=get_latest_commit(repo).hexsha[0:7], + repo_name='kesslermaximilian/LatexPackages') def get_history(commit: git.objects.commit.Commit, priority=0, depth=0) -> Dict: @@ -9,9 +29,9 @@ def get_history(commit: git.objects.commit.Commit, priority=0, depth=0) -> Dict: }} try: if len(commit.parents) > 0: - commit_history.update(get_history(commit.parents[0], priority, depth+1)) + commit_history.update(get_history(commit.parents[0], priority, depth + 1)) for parent in commit.parents[1:]: - commit_history.update(get_history(parent, priority+1, depth+1)) + commit_history.update(get_history(parent, priority + 1, depth + 1)) except ValueError: pass return commit_history From d5f7c6d88c29dab47c73c3750a9d59bff9b3b76e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Fri, 8 Oct 2021 09:21:21 +0200 Subject: [PATCH 35/36] fix missing parantheses --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8b8c09c..394b990 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ install: - pip install GitPython script: - - export COMMIT_MSG=$(python3 -c 'from git_version import get_deploy_message; print(get_deploy_message())' + - export COMMIT_MSG=$(python3 -c 'from git_version import get_deploy_message; print(get_deploy_message())') - python3 -c 'from build import build; build("build/LatexPackages/")' - cd build - zip -r LatexPackages.zip LatexPackages From b735182620b619867bd82299df1816129936cfaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Fri, 8 Oct 2021 09:32:40 +0200 Subject: [PATCH 36/36] add -build suffix to pushed branches in build repo --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 394b990..1fd2351 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,7 +46,7 @@ deploy: repo: kesslermaximilian/LatexPackagesBuild commiter_from_gh: true allow_empty_commit: true - target_branch: $TRAVIS_BRANCH + target_branch: $TRAVIS_BRANCH-build commit_message: $COMMIT_MSG on: all_branches: true