Synctex broken in LMTX ?
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… Best regards: Otared
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 -----------------------------------------------------------------
On 2021-05-16, Hans Hagen
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
It works just fine. Add this line at the top of your document: % !TEX useOldSyncParser I also have: \setupsynctex[state=start,method=min] I am not sure whether method=min is necessary. Anyway, search for useOldSyncParser in Help > Changes for the details.
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
+1. I use TeXShop only as a previewer (I edit documents in Vim), but, unfortunately, syncing with an external editor works only for LaTeX.
but I gave up communicating that because i cannot reason with the guy (different wavelengths .. years ago already)
Richard Koch, however, has been incredible, IMO, in supporting the macOS community (already before Mac OS X 10.0!) with TeXShop. In particular, he went to great lengths to make syncing work in TeXShop for both ConTeXt and LaTeX. The current problem is only with external editors, and it is because the directive above is not read by TeXShop when using an external editor. Anyway, I am positive that he is willing to support ConTeXt in the best possible way...
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
...which could be as well this. Nicola
On 5/16/2021 5:30 PM, Nicola wrote:
It works just fine. Add this line at the top of your document:
% !TEX useOldSyncParser
I also have:
\setupsynctex[state=start,method=min]
I am not sure whether method=min is necessary.
normally not ...
Richard Koch, however, has been incredible, IMO, in supporting the macOS community (already before Mac OS X 10.0!) with TeXShop. In particular, he went to great lengths to make syncing work in TeXShop for both ConTeXt and LaTeX. The current problem is only with external editors, and it is because the directive above is not read by TeXShop when using an external editor.
Indeed, and he also had to adapt to changing apple policies and so.
Anyway, I am positive that he is willing to support ConTeXt in the best possible way...
Sure. I met him a few times. Definitely an asset for the tex community.
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
...which could be as well this. Feel free to ask him,
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 -----------------------------------------------------------------
On 2021-05-16, Hans Hagen
On 5/16/2021 5:30 PM, Nicola wrote:
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
...which could be as well this. Feel free to ask him,
I will. Two things: 1. can you also go the other way with mtxrun (determine position in the PDF from a line in the source file)? 2. It seems that --editor has no effect: $ mtxrun --script synctex --edit --line=6 --editor=/usr/local/bin/vim WriteUp.tex sh: SciTE: command not found $ mtxrun --script synctex --goto --page=2 --x=150 --y=200 --editor=gvim WriteUp.synctex sh: SciTE: command not found Am I doing anything wrong? Nicola
On 2021-05-16, Hans Hagen
On 5/16/2021 5:30 PM, Nicola wrote:
Anyway, I am positive that he is willing to support ConTeXt in the best possible way...
Sure. I met him a few times. Definitely an asset for the tex community.
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
...which could be as well this. Feel free to ask him,
I've got a positive feedback, and the summer as an estimated time to start working on it. One thing he asked is what I was asking you: it would be useful if there were a way to sync in the other direction as well. Nicola
On 2021-05-16, Hans Hagen
wrote: On 5/16/2021 5:30 PM, Nicola wrote:
Anyway, I am positive that he is willing to support ConTeXt in the best possible way...
Sure. I met him a few times. Definitely an asset for the tex community.
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
...which could be as well this. Feel free to ask him,
I've got a positive feedback, and the summer as an estimated time to start working on it. One thing he asked is what I was asking you: it would be useful if there were a way to sync in the other direction as well. You mean sort of trying to deduce from the synctex file where to go in
On 5/20/2021 9:38 PM, Nicola wrote: the pdf? When the 'call external program' approach is used I can have an alternative (lua) output that is easier and might do that (less work). Lets first go one direction. I only have a very old macbook and an old imac i once got so no real equipment to test anythign modern. 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 -----------------------------------------------------------------
On 2021-05-20, Hans Hagen
One thing he asked is what I was asking you: it would be useful if there were a way to sync in the other direction as well. You mean sort of trying to deduce from the synctex file where to go in the pdf?
Yes. You provide a .tex file and a line number, and maybe also an optional column number, and mtxrun outputs a .pdf file, a page number and a coordinate pair or bounding box (I don't know what the best output is).
When the 'call external program' approach is used I can have an alternative (lua) output that is easier and might do that (less work). Lets first go one direction.
Dick prefers to tackle both directions at once: maybe you can coordinate with each other.
I only have a very old macbook and an old imac i once got so no real equipment to test anythign modern.
I'd be happy to help, and I am sure other users are interested, too. Nicola
On 5/21/2021 10:50 AM, Nicola wrote:
On 2021-05-20, Hans Hagen
wrote: One thing he asked is what I was asking you: it would be useful if there were a way to sync in the other direction as well. You mean sort of trying to deduce from the synctex file where to go in the pdf?
Yes. You provide a .tex file and a line number, and maybe also an optional column number, and mtxrun outputs a .pdf file, a page number and a coordinate pair or bounding box (I don't know what the best output is).
define 'tex file' ... is that the master file? in that case we're talking about the 'foo.synctex file' because how does a tex file knows what pdf is related?
When the 'call external program' approach is used I can have an alternative (lua) output that is easier and might do that (less work). Lets first go one direction.
Dick prefers to tackle both directions at once: maybe you can coordinate with each other.
I only have a very old macbook and an old imac i once got so no real equipment to test anythign modern.
I'd be happy to help, and I am sure other users are interested, too.
Nicola
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________
-- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On 2021-05-21, Hans Hagen
On 5/21/2021 10:50 AM, Nicola wrote:
On 2021-05-20, Hans Hagen
wrote: One thing he asked is what I was asking you: it would be useful if there were a way to sync in the other direction as well. You mean sort of trying to deduce from the synctex file where to go in the pdf?
Yes. You provide a .tex file and a line number, and maybe also an optional column number, and mtxrun outputs a .pdf file, a page number and a coordinate pair or bounding box (I don't know what the best output is).
define 'tex file' ... is that the master file? in that case we're talking about the 'foo.synctex file' because how does a tex file knows what pdf is related?
Good point. I don't know how/if searching from source to PDF works in TeXShop when the source is split into several files. Nicola
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 -----------------------------------------------------------------
On 2021-05-16, Hans Hagen
now, here is something to think about:
mtxrun --script synctex --list mtx-synctex | invalid synctex log file %a
I've got a positive feedback, and an agenda, from Richard Koch for supporting ConTeXt's syncing mechanism (including the PDF->TeX direction, which hopefully will land soon in beta, if it hasn't already). Just one clarification: does this work only for ConTeXt, or is it based on LuaTeX regardless of what is being typeset? Nicola
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… btw, maybe you can check with texshop for the version ... there was at some point a change in the synctex output format and texshop was adapted to handle both variants; the texshop author is quite responsive and i know he made sure context could be done but maybe there's also something mentioned in the documentation (i could probably look it up old mails if needed) .. in that case wikifyable
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 -----------------------------------------------------------------
participants (3)
-
Hans Hagen
-
Nicola
-
Otared Kavian