Hi Hans and Nicola, Thank you for your attention and your answers. As a matter of fact I am aware that when using ConTeXt with TeXShop one has to add on the first line % !TEX useOldSyncParser and then setup synctex with \setupsynctex[state=start,method=min] (or method=max, or just ignoring that part). In the test file I sent this morning, I left out that « % !TEX useOldSyncParser » line, but on my machine, with or without it the situation does not change. In fact a few years ago I was in touch with Richard Koch about the issue and we exchanged a few emails and testings, after which he added a Special Comment menu item for « % !TEX useOldSyncParser ». The ConTeXt code for synctex used to work fine, but beginning last year (if I remember well) the behaviour became somewhat unstable (again on my machine). It seems that the content which goes on the first page of the PDF file remains out of synctex when the file is typeset with LMTX. The same TeX file produces the correct synctex result when typeset with mkiv from TeXLive 2020 (version 2020.03.10 14:44). Indeed, one can compare the « filename.synctex » files obtained with LMTX and mkiv, to observe the differences, but I am unable to interpret why those differences are there. I am sending those files as well as the TeX and PDF files with this message. The PDF file I am sending is the one obtained with LMTX, and of course the syncing works fine when one uses the synctex file obtained with mkiv (upon renaming adequately that file)… Best regards: Otared
On 16 May 2021, at 16:53, Hans Hagen
wrote: On 5/16/2021 2:52 PM, Otared Kavian wrote:
Hi Hans, I have been noticing for some time that \setupsynctex does not work properly, at least in TeXShop on MacOS. A « filename.synctex » file is created but on most occasions it does not contain many lines, and one cannot go from the PDF file to the right location in the source file. Has something changed in the way synctex used to work ? Below I am sending you a test file with its PDF and .synctex files, for you to see for yourself. Sorry for the disturbance… irr texshoip has soem setting for it (you need to check with Dick) which relates to a change in synctex
anyway, this whole synctex thing is a mess ... it's rather bound to the way latex does things and way to complex due to these heuristics so it could never work well for context
the reason you see little in the .synctex file is that context doesn't use the synctec library at all: i produce just what is needed directly, so we have a way more compact output (and also better 'real file' tracking, plus avoiding generated stuff in the otr that makes no sense to sync to because it has no file; we also protect styles from being accessed that way)
now, in my opinion, the biggest drawback of synctex is that one needs to compile it into the editor/viewer. Far better would have been to let the viewer call out to an external program (configurable) that reports back the file and line ... more flexible, better upward compatibility, no need to have the synctex code on board, hardly any code and no fuzzy heuristics to fight
but I gave up communicating that because i cannot reason with the guy (different wavelengths .. years ago already)
now, here is something to think about:
mtxrun --script synctex --list mtx-synctex | invalid synctex log file %a
mtxrun --script synctex --list synctex-broken.synctex mtx-synctex | begin page: 1 mtx-synctex | end page: 1 mtx-synctex | begin page: 2 mtx-synctex | [ 71 135 177 149] : 9 : ./synctex-broken.tex mtx-synctex | [ 181 135 224 149] : 2 : ./synctex-broken.tex mtx-synctex | [ 71 163 290 178] : 14 : ./synctex-broken.tex mtx-synctex | [ 71 178 290 193] : 17 : ./synctex-broken.tex mtx-synctex | end page: 2 mtx-synctex | begin page: 3 mtx-synctex | [ 71 135 496 149] : 21 : ./synctex-broken.tex mtx-synctex | [ 71 149 496 164] : 21 : ./synctex-broken.tex mtx-synctex | [ 71 163 496 178] : 21 : ./synctex-broken.tex mtx-synctex | [ 71 178 496 193] : 21 : ./synctex-broken.tex mtx-synctex | [ 71 192 496 207] : 21 : ./synctex-broken.tex mtx-synctex | [ 71 207 496 222] : 21 : ./synctex-broken.tex mtx-synctex | [ 71 221 462 236] : 21 : ./synctex-broken.tex mtx-synctex | end page: 3
mtxrun --script synctex --report --page=3 --x=76 --y=140 synctex-broken.synctex --console "./synctex-broken.tex" 21
see? the info is just there, so you can try to convince the texshop creator to support this:
-- call an external program with these arrguments (the texhop editor knows the positions as it has the viewer built in) -- go to reported file and line
afaik synctex works for my collegue and scite/sumatra and actually he uses the fact that in context it also goes to positions in xml files because it tracks files and lines in xml nodes too (it's the reason why i support synctex at all, personally I never use(d) it)
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 -----------------------------------------------------------------