dsh-latex-studio: A MiKTeX Compilation and Visual Typesetting Closed Loop in DSH

Preface

When writing LaTeX papers in DeepSeek Harness (DSH), agents often rely solely on source code and .log files: a successful compilation does not guarantee that the layout is submission-ready. Two-dimensional defects such as orphan/widow lines, floats positioned too far from citations, column gaps in two-column layouts, overfull boxes, and inconsistent table font sizes are difficult to detect via logs alone. Furthermore, if the “compile → view page image → diagnose → fix → re-verify” loop is broken down into scattered scripts, it is difficult to reproduce stably within a session.

This post introduces the community plugin dsh-latex-studio (maintainer Qingzhu093). It integrates daily compilation and VTO (Visual Typesetting Optimization) workflows into the DSH toolchain, featuring a persistent defect ledger and plugin page configuration forms. The methodology references PaperFit (MIT, arXiv:2605.10341). The current version of the repository is 0.4.1 (MIT), requiring host dsh >= 0.2.0-rc.2 and Node ^22.19.0 || >=24.0.0. Directory page: SkillHub - dsh-latex-studio; Source code: github.com/Qingzhu093/dsh-latex-studio.

What is this

dsh-latex-studio is a workflow plugin for the DSH desktop client: with MiKTeX as a hard dependency, it provides 10 tools and 3 skills, and maintains a cross-turn defect ledger (state.json) on the VTO path. The positioning in the introduction can be summarized as: LaTeX compile gate + VTO typesetting loop—first ensure it compiles, then perform restricted fixes and gate reviews based on page images.

The plugin self-registers skills (latex-daily, latex-fix-catalog, latex-vto-loop) during apply(). It is ready to use upon installation, without needing to copy skills/ to the DSH skill discovery directory.

Core Features

Two Command Lines

The README categorizes capabilities into two lines to facilitate division of labor in sessions:

Line A (Daily Compilation)

  • latex_doctor: Checks if local LaTeX / page image / bibliography tools are ready, providing executable advice for missing items.
  • latex_build: Multi-pass compilation driver; prioritizes latexmk (requires Perl), falls back to a built-in multi-pass driver if unavailable (engine → on-demand bibtex/biber → until .aux stabilizes, max 4 passes), producing consistent structure marked by via.
  • latex_lint: Static checks (optionally depends on chktex).
  • bib_tool: Bibliography-related operations.

Line B (Full VTO Workflow)

  • vto_start / vto_inspect / vto_fix / vto_verify / vto_report / vto_rollback: Covers “compile → read log → render page image → diagnose (18 defect types) → restricted fix → gate review”.
  • vto_fix defaults to apply:false, providing only recipes and diffs; write operations follow a backup → write → content guard → rollback on failure path.
  • vto_report writes to the defect ledger by id+page; vto_verify determines regression for items marked as fixed but recurring, and downgrades the verdict if unresolved blocking-level defects exist.

Environment and Degradation Strategy

  • Hard Dependencies: MiKTeX (engine, bibtex/biber, Poppler pdftoppm/pdfinfo for page images, Ghostscript mgs.exe, etc.). On Windows, use winget install MiKTeX.MiKTeX.
  • Optional: Perl + latexmk (recommended for .fls dependency tracking); automatically uses the built-in multi-pass driver if missing.
  • Page Images: Defaults to local Poppler/Ghostscript, zero additional installation; MinerU or host read_pdf only as optional fallbacks.
  • Missing External Components: Does not throw exceptions; returns status:'skipped' with fix suggestions.
  • Privacy: uploadScope uniformly controls which PDF parses can be uploaded; defaults to not sending personal manuscripts externally.

Installation and Activation

The DSH ecosystem is “everything is a plugin”; SkillHub is a community directory, with no official affiliation with DeepSeek / High-Flyer. Please review the source code and MIT license yourself before installing; the plugin runs with the current DSH process privileges, involving reading/writing projects and calling local TeX, so it should be operated in a trusted environment.

Installing from GitHub (README Original)

The repository directly commits runnable lib/ (pure JS, no build step), available via github: source without authorized build scripts. On Windows, use the full path of the desktop’s built-in CLI (README example path is D:\DshDesktop\resources\runtime\cli\bin\dsh.cmd) to avoid the old global dsh on PATH misoperating the profile:

& "D:\DshDesktop\resources\runtime\cli\bin\dsh.cmd" plugin --profile desktop add github:Qingzhu093/dsh-latex-studio

It is recommended to lock the commit to prevent subsequent pushes from changing the actual running code:

& "D:\DshDesktop\resources\runtime\cli\bin\dsh.cmd" plugin --profile desktop add github:Qingzhu093/dsh-latex-studio#<sha>

The README also notes: in local tests on profiles exclusively managed by Electron, dsh plugin add may hang. Daily use is more recommended to run node tools/install.mjs (pack, register profile, self-check) after cloning the repo. Restart DSH or start a new session after installation or upgrade, otherwise the old instance will still be used.

cd <repo>\dsh-latex-studio
node tools/install.mjs

After installation, run a self-check (can be executed outside the plugin to avoid “installed but not loaded” scenarios with no error reporting):

node tools/doctor.mjs

Exit codes: 0 healthy, 1 has failed items, 2 script error. The self-check verifies files, whether apply() registers 10 tools and 3 skills, profile registration, skill shadowing, and whether local compilation and page image rendering truly work.

Configuration

The plugin provides a configuration form on the DSH Plugins page (README states that volatile configuration fields can be edited on the page starting from 0.4.x; doctor reports the number of volatile fields). Specific fields are subject to the repository’s docs/DEVELOPMENT.md and Schemastery contracts; this article does not list every item not detailed in the captured materials.

Typical Usage

1. Diagnose Environment First

In the session, have the agent call latex_doctor, and supplement MiKTeX or optional components (e.g., winget install StrawberryPerl.StrawberryPerl to enable latexmk) based on the returned “installed / missing” and advice[].

2. Daily Compilation and Lint

  • Use latex_build for the project main file (default --enable-installer can auto-install missing packages).
  • Run latex_lint when extra signals are needed (full external channel only available when chktex is dependent).
  • Use bib_tool and Line A documentation for bibliography issues.

3. VTO Closed Loop

Just proceed in the order of Line B in the session: vto_start establishes context → vto_inspect reads logs and page images (note uploadScope if parse:true) → vto_fix looks at the recipe first (apply:false) → apply after confirmation → vto_verify gate → vto_report updates defect ledger. Use vto_rollback when needing to undo.

The three skills cover daily compilation, fix catalogs, and VTO loops respectively; models can select based on tasks. Without relying on skill services, the 10 tools remain available for registration and use.

Use Cases and Notes

Who it is for

  • Agent workflows for writing dissertations or conference submissions in LaTeX within DSH, hoping to systematically check layout defects after “compilation passes”.
  • Scenarios primarily using Windows + MiKTeX locally, wanting both page images and compilation to run locally, and defaulting to not uploading PDFs.

Things to Note

  • Designed around MiKTeX; other TeX distributions are not described as first-class citizens in the captured materials.
  • Do not assume “skills/ in the npm package will be automatically discovered by DSH”—this plugin solves the problem via registration.
  • For upgrades, run node tools/install.mjs again followed by node tools/doctor.mjs; for uninstallation, modify dependencies in $DSH_HOME/profiles/<name>/package.json and dsh.profile.bundles, and delete the installation copy (default $DSH_HOME is ~/.dsh).

Conclusion

dsh-latex-studio binds MiKTeX compilation, logs and local page images, 18 types of visual defect diagnosis, restricted fixes, and defect ledgers into DSH’s 10 tools and 3 skills. It is suitable for LaTeX agent workflows that require “compilable and viewable layout”. For further information, visit the SkillHub Directory Page and GitHub Repository (see docs/DEVELOPMENT.md for maintenance and troubleshooting).

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye