Skip to main content

A traceable LaTeX flattener.

Project description

flachtex

A simple Python-library to flatten LaTeX, thus it creates a single LaTeX-file out of a complex multi-file LaTeX-document. It is slower than comparable tools but has some important features, such as:

  1. Allows skipping parts enclosed by LaTeX-comments
  2. Allows explicit includes in case the include can not directly be deduced from the source (e.g., because it is done by an evaluation)
  3. Supports subimport
  4. Remembers where every part comes from and allows exporting this information as json.
  5. Can remove comments.

You can use it directly as Python-module or use its CLI.

usage: flachtex [-h] [--to_json] [--remove_comments] path

flachtex: Traceable LaTeX flattening.

positional arguments:
  path               Path to main.tex

optional arguments:
  -h, --help         show this help message and exit
  --to_json          Return a json.
  --remove_comments  Remove comments.

You can easily add additional rules. Just check out the rules.py to see the current rules. They are all implemented as regular expressions but also other methods are supported.

To skip some parts, use

%%FLACHTEX-SKIP-START
This part is ignored and will not be part of the output.
%%FLACHTEX-SKIP-STOP

To import some explicit file, use

%%FLACHTEX-EXPLICIT-IMPORT[path/to/file]
%%FLACHTEX-SKIP-START
Complex import logic that cannot be parsed by flachtex.
%%FLACHTEX-SKIP-STOP

You an install this tool with

pip install flachtex

This tool is still work in progress.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

flachtex-0.1.4-py3-none-any.whl (9.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page