Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Reason given by maintainers: Deprecated because it sucks

Goal

Protex aims at providing a flexible, extensible and interfaced way to remove TeX macros from a TeX/LaTeX document while keeping the mapping of position from cleaned text to source. This should make it easier to apply different language checkers to the plain text and convert the plain text position to source positions. When possible the resulting file should also be a reasonably readable text file (no big blanks, no strange holes...).

Non-goal

This project won't try to parse TeX in a complex way. The cleaning has to be extensible, but nor recursive, neither Turing complete as TeX is itself.

Principle

A command prototype set is first built from the default commands.json, updated by the user ~/.commands.json (if it exists) and then all the commands.json files found in the file tree from root to the current directory.

A command prototype tell the parser how many arguments at maximum take the command and how to use them. There are four sections in commands.json files. The three below consist in a list of special prototype:

  • print_name: the command take no argument and is replace by its name (ex: \phi, \sum)

  • print_one: the command take one argument and print it unchanged

  • discard: the command take up to 100 arguments and print nothing The fourth section is other and have a mapping as value. The mapping is of the form {<command_name>: [<# max args>, <template>]}. The template is a string where everything will be printed as is but:

  • %0 will be replace with the command name

  • %1 will be replaced with the first argument (and so on for %2, %3 etc without limit)

  • %% will be replaced with a raw %

  • % followed by anything else will not be replaced

When parsing the TeX source, the argument collection end as soon as one of those conditions is fulfilled:

  • the max number of arguments have been reached
  • the next token is a blank
  • the next token is a "word" of more than one letter (a word a sequence of contiguous everything that is neither whitespace nor a special thing in TeX (comments, commands, curly brackets, square bracket), be carefull, punctuation like "." is a valid one letter word that can be the last argument of a command)
  • the last argument was a non bracketed one letter "word"

Those rules can seem a bit convoluted but if you have a valid TeX document and valid command prototypes, the result should be what you expect.

Installation

From source: in the folder of this README run pip install . in a terminal. With pip directly: run pip install -U protex

Usage

See the command line help by running protex or python -m protex.

Notes

The requirements.txt is only for development and test, not for normal usage. There are no dependencies at all.

Metadata

Release files for protex 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for protex 0.1.0
File Size Uploaded Provenance Actions
protex-0.1.0.tar.gz 12.5 kB Without provenance Details for protex-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for protex 0.1.0
File Interpreter ABI Platform Actions
protex-0.1.0-py3-none-any.whl Python 3 none any Details for protex-0.1.0-py3-none-any.whl

Total release size: 26.1 kB

Release files / protex-0.1.0.tar.gz

Download URL protex-0.1.0.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5fa627e5091f20d70072a18c0f3271c318e33d20b1e1d4d3099256bcddf46539
BLAKE2b-256 checksum
How to use checksums
a44d0582836be6a19d0dce97c7d129308643615e57e4b695824e3cf25926eece
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.3

Release files / protex-0.1.0-py3-none-any.whl

Download URL protex-0.1.0-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
635377d541560b44434f666be949d66d6c6f3e41e3e2a5cb60a08349d48d1e13
BLAKE2b-256 checksum
How to use checksums
eae12cf419bde2978b6cb7bb25f154e8d4f717397284c02b6499259f12acbd97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.3

Security for protex 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page