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

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file flachtex-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: flachtex-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.9

File hashes

Hashes for flachtex-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c03060f4d28692fec317e8e090e2c7007a912e0309f5e44332075240329b2af6
MD5 3210912db455ee8c386e1a33a9b349df
BLAKE2b-256 9b4bfd0b86a51d71ff089c601f4b2e252c915e99ba3865e088be358e45397062

See more details on using hashes here.

Supported by

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