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.4.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.4-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tex_minify-0.2.4.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.4.tar.gz
Algorithm Hash digest
SHA256 d0a966c36a78965ffdb2f3ce54f1b8ca2b1415e3bcbeaac87e368dbac6d2e73e
MD5 192938fa534e8b90e944471781cf6004
BLAKE2b-256 0ad27afb8720af328c9c0f4a554fcc600db621967e6611e050262b67ee814d9e

See more details on using hashes here.

Provenance

The following attestation bundles were made for tex_minify-0.2.4.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.4-py3-none-any.whl.

File metadata

  • Download URL: tex_minify-0.2.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 63ac86b866cb6c754d71eda0c7fdda6c0aacc6e12c7db91c2465175ab06edcc2
MD5 59297b6e9d052870d2418a2609ad0c23
BLAKE2b-256 58c8227960ad883b31225cfbc15fba4f107ed8621ab25c4a8063f53bc9c9b44a

See more details on using hashes here.

Provenance

The following attestation bundles were made for tex_minify-0.2.4-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