hufangd-2019/dsh-latex2office0

dsh-latex2office

LaTeX to Office formula tools for DeepSeek Harness: latex2office_insert (insert LaTeX formulas as native OMML equations or rendered images into existing .docx/.pptx at end/after_text/before_text/after_paragraph positions, atomic batch, numbered equations with academic tab layout, auto .bak backup, readback verification), latex2office_generate (create new .docx from formulas), latex2office_preview (render a formula to PNG). Engine: pandoc (LaTeX->OMML) + python-docx/python-pptx + LibreOffice headless rendering. Zero npm dependencies.

包名
dsh-latex2office
版本
0.1.1
许可证
MIT
最近更新
2026年9月9日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:hufangd-2019/dsh-latex2office

可选配置覆盖

在 profile 自身的 cordis.patch.yml 中给本插件的行挂 config:

- id: latex2office-tools
  config:
    pythonPath: 'D:\python\python.exe'   # 三个路径均可留空=自动探测
    pandocPath: ''
    sofficePath: ''
    renderTimeoutSec: 90                  # 单公式 LibreOffice 渲染超时

使用示例(模型侧调用)

// 生成带编号的公式文档
{ "tool": "latex2office_generate",
  "args": {
    "output": "D:/docs/equations.docx",
    "title": "运动方程",
    "formulas": [
      { "latex": "\\frac{\\partial u}{\\partial t} + u\\frac{\\partial u}{\\partial x} = -\\frac{1}{\\rho}\\frac{\\partial p}{\\partial x}", "number": "1.1" }
    ]
  } }

// 插入现有文档,定位到某段文字之后
{ "tool": "latex2office_insert",
  "args": {
    "file": "D:/docs/report.docx",
    "formulas": [
      { "latex": "E = mc^2", "position": { "mode": "after_text", "text": "质能方程:" }, "number": "2.1" },
      { "latex": "\\sigma_x = \\frac{F}{A}", "position": { "mode": "end" } }
    ]
  } }