fix: detect MiKTeX in quarto check on Windows#14266
fix: detect MiKTeX in quarto check on Windows#14266queelius wants to merge 1 commit intoquarto-dev:mainfrom
quarto check on Windows#14266Conversation
Previously, `quarto check` only looked for TeX Live (via tlmgr) and TinyTeX when checking for LaTeX installations. MiKTeX, which uses `initexmf` instead of `tlmgr`, was never detected -- even when installed, in PATH, and successfully used for PDF compilation. Add a MiKTeX detection fallback that runs when TeX Live is not found. It locates `initexmf` in PATH and extracts the MiKTeX distribution version from its --version output. Closes quarto-dev#14265 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
There was a problem hiding this comment.
Pull request overview
Adds MiKTeX as an additional LaTeX distribution that quarto check can detect (primarily for Windows), so users no longer see Tex: (not detected) when MiKTeX is installed and on PATH.
Changes:
- Add MiKTeX fallback detection by locating
initexmfand extracting a distribution version frominitexmf --version. - Populate
quarto checkhuman-readable output and JSON output with MiKTeX path/version/source when detected. - Document the fix in the 1.10 changelog.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/command/check/check.ts | Adds MiKTeX detection fallback and JSON/output population for quarto check LaTeX checks. |
| news/changelog-1.10.md | Adds a changelog entry noting MiKTeX detection fix for quarto check on Windows. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const versionResult = await execProcess({ | ||
| cmd: "initexmf", | ||
| args: ["--version"], | ||
| stdout: "piped", | ||
| stderr: "piped", | ||
| }); |
There was a problem hiding this comment.
detectMiktex() records path based on the resolved initexmfPath, but the version check runs execProcess with cmd: "initexmf" (re-resolved from PATH). If multiple initexmf entries exist (or PATH changes), this can report a path from one install and a version from another. Use the resolved initexmfPath for the execProcess call (and/or set cwd appropriately) to keep path/version consistent.
| // initexmf --version outputs lines like: | ||
| // MiKTeX Configuration Utility 4.12 (MiKTeX 24.1) | ||
| // The parenthesized version is the distribution version | ||
| const distVersionMatch = versionResult.stdout.match( | ||
| /\(MiKTeX\s+(\d[\d.]*)\)/i, | ||
| ); | ||
| const versionMatch = distVersionMatch || | ||
| versionResult.stdout.match(/MiKTeX\s+(\d[\d.]*)/i); | ||
| if (versionMatch) { | ||
| result.version = versionMatch[1]; | ||
| } |
There was a problem hiding this comment.
The new MiKTeX version parsing logic is currently untested. There are existing smoke tests for quarto check --output (JSON parsing) but nothing exercises/validates the MiKTeX detection/version extraction path; consider adding a unit test for the initexmf --version parsing (and ideally path/source population) to prevent regressions when MiKTeX changes its output format.
|
@queelius before asking Claude to fix things, better to understand the issue and look for related discussions. |
Summary
quarto checkinitexmfin PATH and extracting version from its--versionoutputCloses #14265
Details
On Windows,
quarto checkreportedTex: (not detected)even when MiKTeX was installed, in PATH, and successfully used for PDF compilation. The existing LaTeX detection only checked for TeX Live (viatlmgr) and TinyTeX. MiKTeX usesinitexmfas its configuration utility rather thantlmgr, so it was never found.The fix adds a
detectMiktex()function that:initexmfis available viawhichinitexmf's locationinitexmf --versionoutput (e.g.,MiKTeX 26.2)After the fix, users with MiKTeX will see:
Test plan
quarto checkshows MiKTeX info(not detected)quarto check --output check.jsonincludes"source": "miktex"in JSON output🤖 Generated with Claude Code