On 11/12/2023 10:26 AM, Henning Hraban Ramm wrote:
Am 12.11.23 um 00:59 schrieb Jim:
Hi,
I've read the wiki, looked at workflows-synctex.tex, searched the web, and scratched my head, all to no avail. So here I am, cap in hand...
When I run context, I get a .synctex file which has some information in it, but I can't find any invocation of synctex to return anything useful. Nor does the okular example in the wiki (https://wiki.contextgarden.net/SyncTeX) work for me. Ocular starts, but always on the first page, regardless of what line number I give it.
On the other hand, pdftex creates a .synctex file which my copy of synctex find useful.
I am using the synctex from the current version of texlive: This is SyncTeX command line utility, version 1.5
Can anyone either (a) enlighten me on what I am doing wrong; or (b) definitively confirm that context is not currently playing nicely with synctex (the wiki notwithstanding) and I should give up this quest for now.
ConTeXt doesn’t work with the synctex binary, but with mtxrun --script synctex
afaik there is no binary ... there is a library that has to be compiled into a pdf viewer that intercept some 'goto the text file' command and then launches an editor (afik the library has some heuristics build in wrt boxes and nesting and so); at the tex end there is also a library that kicks in addiional code for nodes and the backend (which is why enabling synctex will have an impact on runtime) wrt the synctex file, that one is generated by context (so we don't use the synctex code in luatex and as luametatex has no backend there it's even completely absent ... context generates the file itself which is also a bit more efficient)
Unfortunately, it’s not a drop-in replacement, so it doesn’t work with most editors. (I was thinking about a translating wrapper script, but didn’t do anything yet.)
AFAIK TeXshop (MacOS) is the only TeX editor that supports ConTeXt’s workflow.
indeed texshop uses the approach that avoids the library and just calls mtxrun to figure out the file/line that relates to the position; this is more reliable because there is no need to recompile a viewer when synctex updates you can run mtxrun --script synctex on the synctex file and check what areas are there
ConTeXt’s synctex format is much simpler than the “standard” LaTeX one and should be at least as good, but alas it needs support from the editors. simpler in the sense that we only output what is needed for the synchronization to work reliable; fwiw, my collegue already for many years uses context with synctex enabled with sumatra pdf in pretty complex setups: a mix of tex and xml files with deeply nested inputs and it works ok (so we also get to the right spot in an (included) xml file)
for synctex to work one has to call context with --synctex or put a directive on the topline of the file. Otherwise you won't get the right jobname. Of course it then still depends on the pdf viewer + lib used if things work out as expected. there isn't much we can do about the viewer part unless tit is not locked into the binary but as flexible like the texshop viewer is Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------