Skip to main content

A CLI tool to expand \input commands in TeX files and filter BibTeX files based on citations.

Project description

tex-minify

A command-line tool to expand \input commands in TeX files and filter BibTeX files based on citations.

Features

  • Recursively expands all \input commands in TeX files
  • Handles relative paths correctly
  • Supports both .tex extension present or not in \input commands
  • UTF-8 encoding support
  • Configurable base directory for input resolution
  • Filter BibTeX files to only keep cited references

Usage

Using uvx (no installation required)

# Minify a TeX file (prints to stdout)
uvx tex-minify minify input.tex

# Save minified output to file
uvx tex-minify minify input.tex -o output.tex

# Specify base directory for \input resolution
uvx tex-minify minify input.tex --base-dir /path/to/tex/files -o output.tex

# Filter BibTeX file to only keep cited references
uvx tex-minify filter-bib paper.tex references.bib -o filtered.bib

Using pip installation

First install:

pip install tex-minify

Then use:

# Minify a TeX file
tex-minify minify input.tex -o output.tex

# Filter BibTeX file
tex-minify filter-bib paper.tex references.bib -o filtered.bib

Using pixi (for development)

# Setup development environment
pixi install
pixi run install

# Run the tool
pixi run -- tex-minify minify input.tex
pixi run -- tex-minify filter-bib paper.tex references.bib

Commands

minify

Process a TeX file and expand all \input commands.

tex-minify minify INPUT_FILE [-o OUTPUT] [--base-dir BASE_DIR]

Arguments:

  • INPUT_FILE: Path to the input TeX file
  • -o, --output: Output file path (optional, defaults to stdout)
  • --base-dir: Base directory for resolving \input paths (optional, defaults to input file directory)

filter-bib

Filter a BibTeX file to only include references that are cited in the TeX file.

tex-minify filter-bib TEX_FILE BIB_FILE [-o OUTPUT]

Arguments:

  • TEX_FILE: Path to the TeX file containing citations
  • BIB_FILE: Path to the BibTeX file to filter
  • -o, --output: Output file path (optional, defaults to stdout)

Error Handling

The tool will exit with a non-zero status code and display an error message if:

  • Input files are not found
  • Referenced \input files are not found
  • Output file cannot be written
  • Any other processing errors occur

Project details


Download files

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

Source Distribution

tex_minify-0.2.6.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

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

tex_minify-0.2.6-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file tex_minify-0.2.6.tar.gz.

File metadata

  • Download URL: tex_minify-0.2.6.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for tex_minify-0.2.6.tar.gz
Algorithm Hash digest
SHA256 2ff66f9d5b72bd06ae88e41a241e5584ac5b2b38562ba66687b6889593b10080
MD5 4d2fd5ac2813e4a93ecb2e605b7b1dd5
BLAKE2b-256 2882cdd79978ac18b2265e370c8a3a64e6bfbb3a95ca87243001e416307ab41b

See more details on using hashes here.

Provenance

The following attestation bundles were made for tex_minify-0.2.6.tar.gz:

Publisher: release.yml on dwahdany/tex-minify

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tex_minify-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: tex_minify-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for tex_minify-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 6c7ae1d2e0610006612ed481fbbb7d5ef9d4159681b22c0af9e7549f0330ff17
MD5 d6c14ade83a6e5e8aa00329a27763efb
BLAKE2b-256 facbba8bf627b0a926dcb6b0e9ed2abeb8ab9e3cd16fb510ce0d0d655c8ba2e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for tex_minify-0.2.6-py3-none-any.whl:

Publisher: release.yml on dwahdany/tex-minify

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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