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.5.tar.gz (15.3 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.5-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tex_minify-0.2.5.tar.gz
  • Upload date:
  • Size: 15.3 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.5.tar.gz
Algorithm Hash digest
SHA256 12a14ac361540eae6f3a2c666b9271adf7c5feb2b5cd63f742169b977bb72bb5
MD5 9f5fad8146a71325f43afa199ccf1188
BLAKE2b-256 fc5a1cab63214878b9d3c62c6c74be11f41c0f9ba83224f11d9fcf39f4cd0d3d

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: tex_minify-0.2.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9128c05830ea74a378bc95000cd05bf44f0d14171d9f4e8f589e1a9739bab3bb
MD5 385673a3cccdf335b0d50dc8a2b15d2b
BLAKE2b-256 24f506915a2f791a68c3d90a28fefd5e80d05064fe595eabdf7d8351e1de0ff6

See more details on using hashes here.

Provenance

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