Converting Mathpix Markdown (MMD) with Mathpix Python SDK
The Mathpix Python SDK provides functionality to convert Mathpix Markdown (MMD) into other formats, such as PDF, DOCX, and standard Markdown.
Code Example
from mpxpy.mathpix_client import MathpixClient
client = MathpixClient(
app_id="your-app-id",
app_key="your-app-key"
)
# Define the Mathpix Markdown input with headers, math, and a table
mmd_input = """
# Math Review
## Famous Formula
The following is the Euler identity:
$$ e^{i\\pi} + 1 = 0 $$
## Table of Values
| x | sin(x) | cos(x) |
|---|--------|--------|
| 0 | 0 | 1 |
| π | 0 | -1 |
"""
# Convert MMD to PDF (you can also use "docx", "html", or "md")
conversion = client.conversion_new(
mmd=mmd_input,
conversion_format={"pdf": True}
)
# Wait for the conversion to complete
conversion.wait_until_complete(timeout=30)
# Download the output to a local folder
conversion.download_output_to_local_path("pdf", path="./output")
- You can specify multiple output formats such as
pdf
,docx
, ormd
. - The
formats
parameter is used to request the desired output type.
Rendered Output Example: From MMD to PDF

This view shows the final PDF output generated from Mathpix Markdown input. It demonstrates how headers, LaTeX equations, and tables are rendered using the Mathpix SDK.