diff --git a/README.md b/README.md
index 5db3763..8ebcacc 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,32 @@
# PyTeX
-Hacky python scripts to simplify my LaTeX package writing
+
+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](https://github.com/kesslermaximilian/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 - ]`
+`__PACKAGE_NAME__` | inserts package name | `mkessler-example`
+`__PACKAGE_PREFIX__` | inserts package prefix | `mkessler@example@`
+`__PACKAGE_MACRO__()`| declares internal package macro | `\mkessler@example@`
+`__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__(,)`| declares a new LaTeX if | `\ifmkessler@example@\mkessler@example@`
+`__SET_IF__(,)`| sets the value of a LaTeX if | `\mkessler@example@`
+`__IF__()`| starts conditional | `\ifmkessler@example@`
+`__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__()` | output package error | `\PackageError{mkessler-example}{}`
+`__WARNING__()`| output package warning | `\PackageWarning{mkessler-example}{}`
+`__INFO__()`| output package info | `\PackageInfo{mkessler-example}{}`
\ No newline at end of file
diff --git a/replacements.py b/replacements.py
index 8f7a188..bad08ac 100644
--- a/replacements.py
+++ b/replacements.py
@@ -31,16 +31,23 @@ def make_default_commands(package_formatter: PackageFormatter):
prefix=Attributes.package_prefix, condition=Args.one, value=Args.two)
package_formatter.add_arg_replacement(1, 'if', r'\if{prefix}{condition}', prefix=Attributes.package_prefix,
condition=Args.one)
- package_formatter.add_replacement('language options',
+ package_formatter.add_replacement('language options x',
r'\newif\if{prefix}english\{prefix}englishtrue' + '\n' +
r'\DeclareOptionX{{german}}{{\{prefix}englishfalse}}' + '\n' +
r'\DeclareOptionX{{ngerman}}{{\{prefix}englishfalse}}' + '\n' +
r'\DeclareOptionX{{english}}{{\{prefix}englishtrue}}',
prefix=Attributes.package_prefix)
+ package_formatter.add_replacement('language options',
+ r'\newif\if{prefix}english\{prefix}englishtrue' + '\n' +
+ r'\DeclareOption{{german}}{{\{prefix}englishfalse}}' + '\n' +
+ r'\DeclareOption{{ngerman}}{{\{prefix}englishfalse}}' + '\n' +
+ r'\DeclareOption{{english}}{{\{prefix}englishtrue}}',
+ prefix=Attributes.package_prefix)
package_formatter.add_arg_replacement(1, 'info', r'\PackageInfo{{{name}}}{{{info}}}', name=Attributes.package_name,
info=Args.one)
package_formatter.add_arg_replacement(1, 'warning', r'\PackageWarning{{{name}}}{{{warning}}}',
name=Attributes.package_name, warning=Args.one)
+ package_formatter.add_arg_replacement(1, 'error', r'\PackageError{{{name}}}{{{error}}}}', name=Attributes.package_name, error=Args.one)
package_formatter.add_replacement('end options x',
r"\DeclareOptionX*{{\PackageWarning{{{package_name}}}"
r"{{Unknown '\CurrentOption'}}}}" + '\n' + r'\ProcessOptionsX\relax' + '\n',