DeepSeek Harness (DSH) is a framework for interacting with and testing models. In scenarios that require generating mathematical formulas, geometric diagrams, or reports, agents often need to convert LaTeX or SVG code into visualized images. jaxzhou/dsh-mathmatic-symbol is a DSH plugin that provides four tools, enabling agents to directly render mathematical formulas as images, draw geometric figures from declarative specifications, convert existing files, and assemble documents that include these images.
The plugin belongs to the “web tools” category, is maintained by user jaxzhou, and follows the MIT license.
Core Functions¶
After installation, the plugin registers four tool functions in DSH sessions, each addressing a different mathematical visualization need:
- math_formula: Renders LaTeX formulas as images (generating both SVG and PNG).
- math_figure: Draws mathematical figures based on declarative geometric specifications.
- math_convert: Converts existing formulas or SVG files into directly embeddable image formats.
- math_document: Assembles a document and automatically inserts generated mathematical images into the document.
Installation and Enablement¶
In a DSH environment, install the plugin using the following command:
dsh plugin --profile web add @jaxzhou/dsh-mathmatic-symbol
After installation, the plugin automatically registers prompt guidance, instructing the model to prefer these tools when it needs to output images or document files instead of hand-writing rendering code.
Typical Usage¶
Rendering Mathematical Formulas¶
Using the math_formula function, an agent can pass a LaTeX string directly, and the plugin generates the corresponding image assets.
math_formula({ latex: "\\int_0^\\infty e^{-x^2}\\,dx = \\frac{\\sqrt{\\pi}}{2}" })
Drawing Geometric Figures¶
Using math_figure, an agent can describe a figure with a declarative JSON specification. For example, define a triangle:
math_figure({ figure: { ... }, name: "triangle" })
Converting Image Formats¶
If an SVG file already exists in the workspace, you can use math_convert to convert it to PNG and adjust the scaling factor:
math_convert({ source: { path: "diagrams/flow.svg" }, format: "png", scale: 3 })
Assembling Documents¶
Using math_document, an agent can specify the document path and content; the plugin inserts generated formulas and diagrams into the document and returns a relative path.
math_document({ path: "docs/report.md", body: "...", math: "image", figures: { ... } })
Technical Features and Trade-offs¶
The plugin has several explicit technical characteristics in its implementation:
- No font dependency: The generated SVG contains outline paths and does not rely on system fonts, ensuring consistent rendering in any environment.
- Deterministic rasterization: PNG output is generated by
@resvg/resvg-js, with system font loading disabled; identical input produces identical bytes on any machine. - Content-addressed files: Identical input always writes to the same file name, facilitating caching and overwriting in build workflows.
Note: Because text in the SVG is converted to outlines, labels in the image cannot be selected or searched. This is a necessary trade-off to achieve font independence.
Conclusion¶
jaxzhou/dsh-mathmatic-symbol provides a standardized solution for mathematical visualization tasks in DSH. By encapsulating complex rendering logic as tool calls, it simplifies the process for agents to generate high-quality mathematical documents and diagrams. For more details, refer to the plugin catalog page or source repository.