Skip to content

🔨 papersmith

Programmatic Word document generation with native LaTeX equations, citation management, charts, and a built-in MCP server for LLMs.

CI PyPI version Python 3.10+ License: MIT


What is papersmith?

papersmith wraps python-docx in a fluent, chainable API that makes it effortless to create professional Word documents from Python code or via LLM tools.

Key Features

  • 📝 Fluent Document API — Chainable methods for clean, readable document construction
  • 📐 LaTeX Equations — Inline $E=mc^2$ and display $$\int x\,dx$$ rendered as native Office Math (OMML)
  • 🎨 Style Presetsacademic, modern, report, formal, minimal — or build your own
  • 📚 Citations — APA, IEEE, Harvard, MLA, Chicago with BibTeX import
  • 📊 Charts — Embed matplotlib bar, line, pie, and scatter plots
  • 🤖 MCP Server — 25+ tools for Claude Desktop, Cursor, and other LLM clients
  • 💻 CLI — Generate documents from Markdown, scrub metadata, launch MCP server

Quick Example

from papersmith import SmithDocument

doc = SmithDocument(preset="academic")
doc.add_cover_page(title="My Research Paper", author="Jane Smith")
doc.add_heading("Introduction", level=1)
doc.add_text("The time complexity is $O(n \\log n)$.")
doc.add_equation(r"T(n) = 2T\left(\frac{n}{2}\right) + \Theta(n)")
doc.save("paper.docx")

Architecture

graph TD
    A[Python API / CLI / MCP] --> B[SmithDocument]
    B --> C[Style Presets]
    B --> D[LaTeX → OMML Engine]
    B --> E[Citation Manager]
    B --> F[Chart Renderer]
    B --> G[python-docx]
    G --> H[.docx Output]
    H --> I[PDF Export]