From 3f68c147a496dd6d6d5cb77dacc2e1dd1466cf8a Mon Sep 17 00:00:00 2001 From: claude Date: Sun, 7 Jun 2026 08:24:20 +0000 Subject: [PATCH] Call Typst binary directly for compile and SyncTeX support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of going through 'quarto typst compile' (which intercepts --synctex before it reaches Typst), call the Typst binary bundled in the Quarto .deb directly at /opt/quarto/bin/tools/x86_64/typst. This allows passing --synctex output.synctex.gz to generate the SyncTeX file for bidirectional editor↔PDF sync. Co-Authored-By: Claude Sonnet 4.6 --- services/clsi/app/js/TypstRunner.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/services/clsi/app/js/TypstRunner.js b/services/clsi/app/js/TypstRunner.js index b69744df9f..6a98fad13d 100644 --- a/services/clsi/app/js/TypstRunner.js +++ b/services/clsi/app/js/TypstRunner.js @@ -7,11 +7,15 @@ import fs from 'node:fs' // Maps currently-running Typst jobs: compileName → PID (or docker container id) const ProcessTable = {} -// Compiles a standalone Typst document (.typ) straight to output.pdf. We reuse -// the Typst that ships inside Quarto via `quarto typst compile`, so there is no -// extra binary to install. This is deliberately the simplest of the three -// runners: Typst only ever produces a PDF, so there is no format detection, -// no HTML asset directory and no extension merging (cf. QuartoRunner). +// Path to the Typst binary bundled inside the Quarto .deb installation. +const TYPST_BIN = '/opt/quarto/bin/tools/x86_64/typst' + +// Compiles a standalone Typst document (.typ) straight to output.pdf. We call +// the Typst binary that ships inside Quarto directly (rather than going through +// `quarto typst compile`) so we can pass --synctex for bidirectional sync. +// This is deliberately the simplest of the three runners: Typst only ever +// produces a PDF, so there is no format detection, no HTML asset directory +// and no extension merging (cf. QuartoRunner). function runTypst(compileName, options, callback) { const { directory, mainFile, image, environment, compileGroup } = options const timeout = options.timeout || 60000 @@ -61,7 +65,7 @@ function _buildTypstCommand(mainFile) { // --synctex generates output.synctex.gz alongside the PDF, enabling // bidirectional editor↔PDF sync (same infrastructure as LaTeX SyncTeX). const inputPath = `$COMPILE_DIR/${mainFile}` - const cmd = `quarto typst compile --synctex output.synctex.gz ${inputPath} output.pdf 2>&1` + const cmd = `${TYPST_BIN} compile --synctex output.synctex.gz ${inputPath} output.pdf 2>&1` return ['/bin/sh', '-c', cmd] }