Hacky python scripts to simplify LaTeX package writing, in particular the ones at https://git.abstractnonsen.se/latex/latex-packages.
Go to file
2022-01-13 21:12:35 +01:00
base add support for latex3 files 2022-01-11 18:55:18 +01:00
build detect unknown files in build dir 2022-01-13 21:12:35 +01:00
config handle header correctly, i.e. do not only expand on macro 2021-10-22 19:29:23 +02:00
default_formatters ensure file integrity when overwriting files also in dictionary case 2022-01-13 20:49:26 +01:00
errors detect unknown files in build dir 2022-01-13 21:12:35 +01:00
formatter ensure file integrity when overwriting files also in dictionary case 2022-01-13 20:49:26 +01:00
macros make author acronym available 2022-01-11 21:23:13 +01:00
utils detect unknown files in build dir 2022-01-13 21:12:35 +01:00
__init__.py add dictionary formatter for translation package 2022-01-09 14:15:28 +01:00
.gitignore format project correctly as python module with corresponding submodules 2021-10-18 15:08:58 +02:00
LICENSE Initial commit 2021-10-06 18:34:42 +02:00
README.md better readme 2021-10-07 14:27:15 +02:00

PyTeX

Some hacky python scripts to simplify my LaTeX package writing.

Usage

Write packages in .pytex format. The PackageFormatter class will then - given author and name of the package - read in and format the file to produce a ready to use LaTeX package .sty file.

As an example, see the LatexPackages repository where this is used.

Macros

Here is a (possibly incomplete) list of the PyTeX macros currently supported. The examples assume that we create a package called example.sty, written by myself:

macro name explanation example
__HEADER__(< package description>) inserts package header, including license and LaTeX package header \NeedsTexFormat{LaTeX2e}
\ProvidesPackage{mkessler-example}[2021/10/07 - <description>]
__PACKAGE_NAME__ inserts package name mkessler-example
__PACKAGE_PREFIX__ inserts package prefix mkessler@example@
__PACKAGE_MACRO__(<macro-name>) declares internal package macro \mkessler@example@<macro-name>
__FILE_NAME__ inserts package file name mkessler-example.sty
__AUTHOR__ inserts package author Maximilian Keßler
__DATE__ inserts compilation date in format %Y/%m/%d 2021/10/07
__NEW_IF__(<name>,<value>) declares a new LaTeX if \ifmkessler@example@<name>\mkessler@example@<name><value>
__SET_IF__(<name>,<value>) sets the value of a LaTeX if \mkessler@example@<name><value>
__IF__(<name>) starts conditional \ifmkessler@example@<name>
__LANGUAGE_OPTIONS__ inserts default language options \newif\mkessler@example@english\mkessler@example@englishtrue
\DeclareOption{german}{\mkessler@example@englishfalse}
\DeclareOption{ngerman}{\mkessler@example@englishfalse}
\DeclareOption{english}{\mkessler@example@englishtrue}
__LANGUAGE_OPTIONS_X__ inserts default language options with xkeyval \newif\mkessler@example@english\mkessler@example@englishtrue
\DeclareOptionX{german}{\mkessler@example@englishfalse}
\DeclareOptionX{ngerman}{\mkessler@example@englishfalse}
\DeclareOptionX{english}{\mkessler@example@englishtrue}
__END_OPTIONS__ process options and handle wrong options \DeclareOption*{\PackageWarning{mkessler-example}{Unknown '\CurrentOption'}
\ProcessOptions\relax
__END_OPTIONS_X__ process options with xkeyval \DeclareOptionX*{\PackageWarning{mkessler-example}{Unknown '\CurrentOption'}
\ProcessOptionsX\relax
__ERROR__(<message>) output package error \PackageError{mkessler-example}{<message>}
__WARNING__(<message>) output package warning \PackageWarning{mkessler-example}{<message>}
__INFO__(<message>) output package info \PackageInfo{mkessler-example}{<message>}