Skip to content

Mathpix

trialdesignbench.mathpix

Mathpix PDF conversion client for workflow step 1.

MathpixClient dataclass

Client for uploading PDFs to Mathpix and downloading converted text.

convert_pdf(pdf_path, output_dir, *, save_tex_zip=False, poll_interval_seconds=5.0, timeout_seconds=600.0)

Convert a PDF to Mathpix Markdown and optionally save a LaTeX ZIP.

download_bytes(pdf_id, extension)

Download a completed Mathpix PDF result by extension.

download_text(pdf_id)

Download Mathpix Markdown for a completed PDF job.

submit_pdf(pdf_path, *, save_tex_zip=False)

Submit a local PDF file to Mathpix for asynchronous OCR.

wait_for_conversion(pdf_id, conversion_format, *, poll_interval_seconds, timeout_seconds)

Poll Mathpix until a requested conversion format is ready.

wait_for_pdf(pdf_id, *, poll_interval_seconds, timeout_seconds)

Poll Mathpix until PDF OCR completes or fails.

MathpixError

Bases: RuntimeError

Raised when Mathpix rejects a request or returns an unusable response.

MathpixTransport

Bases: Protocol

Minimal transport surface used by MathpixClient.

get_bytes(url, *, headers)

GET raw bytes.

get_json(url, *, headers)

GET a JSON object.

post_multipart(url, *, headers, file_path, data)

POST a multipart form-data request and return a JSON object.

UrllibMathpixTransport dataclass

urllib implementation of the Mathpix HTTP transport.