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] 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