Re: texworks crashes with a context mkiv example

Bruno Voisin <[email protected]> Sat, 21 Mar 2026 15:25:55 +0100
Newsgroups gmane.comp.tex.texworks,gmane.comp.tex.live
Message-ID <[email protected]>
> On 21 Mar 2026, at 13:26, Stefan Löffler <[email protected]> wrote:
> 
> Jérôme released a bugfix for SyncTeX that should hopefully fix the crash. The latest development builds for TeXworks are available from https://tug.org/texworks/#Online_resources (including an AppImage). Since I currently don't have a working ConTeXt setup I would very much appreciate some feedback.

Hi Stefan,

There's been further testing off-list, until a few hours ago actually, mostly Hans Hagen, Max Chernoff and me. Hans modified three ConTeXt files

	mkiv/luat-run.lua
	mkiv/node-syn.lua

	mkxl/node-syn.lmt

which bring SyncTeX back to mkiv (ie LuaTeX-based ConTeXt) and add the same level of detail to the .synctex files created by lmtx (ie LuaMetaTeX-based ConTeXt).

No rebuild of binaries afterwards, just the formats. I imagine this will come to TeX Live soon (possibly after further testing).

I did the testing with two files: Hello-world.tex from https://wiki.contextgarden.net/Introduction/Quick_Start (earlier today), and example.tex (just now after finding your message) as posted by Luigi Scarso in the message that started this thread.

In each case I created 4 identical copies of the file, and processed them as follows:

	context --synctex Hello-world-lmtx.tex
	context --synctex --luatex Hello-world-mkiv.tex

	context --synctex=repeat Hello-world-lmtx-repeat.tex
	context --synctex=repeat --luatex Hello-world-mkiv-repeat.tex

and similarly with example.tex.

I get no crash with Hello-world.tex in any configuration. I get a crash with example.tex and release TeXworks 0.6.11 when lmtx is used. Switching to the TeXworks development version you point to, there's no crash but no SyncTeX functionality either.

I assume the crash comes from the combination of two things:

- example.tex is very peculiar, it includes no actual input of its own, just calls /usr/local/texlive/2026/texmf-dist/tex/context/sample/common/knuth.tex through

	\dorecurse{4}{
	\input knuth
	\page
	}

So that's bound to be a challenge for SyncTeX.

- mkiv, ie context with --luatex, and lmtx, ie context without --luatex, work differently with respect to SyncTeX: the former stores the full absolute path of the .tex source in the .synctex file, and nothing about the files read within it with \input; the latter stores the names of the source files and any \input file, not their paths.

Attached is an archive with the tests, including the .tex, .pdf and .synctex files. I copied over

	/usr/local/texlive/2026/texmf-dist/tex/context/sample/common/knuth.tex (used by example.tex)
	/usr/local/texlive/2026/texmf-dist/tex/context/sample/common/tufte.tex (used by Hello-world.tex)

to the respective directories, so that TeXworks could jump from preview to them with SyncTeX.

The *-parser variants are for TeXShop (adding "% !TEX useConTeXtSyncParser" at the beginning of the source file), they're irrelevant for TeXworks.

To analyze what's in the .synctex files produced by ConTeXt, how they are interpreted, Hans provided a very useful command during the testing:

	mtxrun --script synctex --list <basename>.synctex

So the verdict: to get SyncTeX to work with TeXworks, you need to use --synctex=repeat, not just --synctex, but this is already what the "ConTeXt (LuaTeX)" typesetting script does.

Max Chernoff just modified the dedicated page on the ConTeXt wiki:

	https://wiki.contextgarden.net/Input_and_compilation/Text_editors/SyncTeX

By the way, a suggestion: the  "ConTeXt (LuaTeX)" typesetting script uses actually LuaMetaTeX now. There would need to be two:

	ConTeXt (LuaTeX)
	context
	--luatex
	--script=repeat
	$fullname

	ConTeXt (LuaMetaTeX)
	context
	--script=repeat
	$fullname

In ConTeXt parlance, these are

- mkii: "ConTeXt (pdfTeX)" and "ConTeXt (XeTeX)"

- mkiv: "ConTeXt (LuaTeX)"

- lmtx: "ConTeXt (LuaMetaTeX)"

That's all I can think of right now.

Bruno
Tests.zip (application/zip, 532.6 KB) - not displayed