ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* SyncTeX does not work with Zathura
       [not found] <546d4350-5561-57a3-c963-584fc65e1a9c@drozak.net>
@ 2021-10-10 16:11 ` Cezary Drożak via ntg-context
  2021-10-10 16:59   ` Hans Hagen via ntg-context
  0 siblings, 1 reply; 5+ messages in thread
From: Cezary Drożak via ntg-context @ 2021-10-10 16:11 UTC (permalink / raw)
  To: ntg-context; +Cc: Cezary Drożak

[-- Attachment #1: Type: text/plain, Size: 772 bytes --]

Hello,
I have been trying to get SyncTeX to work with ConTeXt and Zathura, but 
nothing
seems to work.

I created a simple `hello.mklx` file and ran `context --synctex=-1 
hello.mklx`.
Then I launched Zathura with `zathura -x "nvr -cc \"call 
vimtex#view#reverse_goto(%{line}, '%{input}')\" --nostart" hello.pdf`.
When I clicked "Hello, world!" while holding a control key it printed the
following error to console:

```
(org.pwmt.zathura:80241): GLib-CRITICAL **: 15:49:12.359: 
g_variant_new_string: assertion 'string != NULL' failed
warning: Failed to obtain data via SyncTeX or data is incomplete.
```

I am attaching the `hello.mklx`, `hello.pdf` files and the generated 
`hello.synctex` file. I am getting the same result with `--synctex=1`.

Regards,
Cezary Drożak

[-- Attachment #2: hello.pdf --]
[-- Type: application/pdf, Size: 6064 bytes --]

[-- Attachment #3: hello.synctex --]
[-- Type: text/plain, Size: 194 bytes --]

SyncTeX Version:1
Output:pdf
Magnification:1000
Unit:1
X Offset:0
Y Offset:0
Content:
!86
{1
[0,0:0,0:0,0,0
v0,0:0,55380990:39158276,55380990,0
]
!60
}1
!7
Postamble:
Count:2
!22
Post scriptum:

[-- Attachment #4: hello.mklx --]
[-- Type: text/plain, Size: 35 bytes --]

\starttext
Hello, world!
\stoptext

[-- Attachment #5: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: SyncTeX does not work with Zathura
  2021-10-10 16:11 ` SyncTeX does not work with Zathura Cezary Drożak via ntg-context
@ 2021-10-10 16:59   ` Hans Hagen via ntg-context
  2021-10-10 17:20     ` Cezary Drożak via ntg-context
  0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen via ntg-context @ 2021-10-10 16:59 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Hans Hagen

On 10/10/2021 6:11 PM, Cezary Drożak via ntg-context wrote:
> Hello,
> I have been trying to get SyncTeX to work with ConTeXt and Zathura, but 
> nothing
> seems to work.
> 
> I created a simple `hello.mklx` file and ran `context --synctex=-1 
> hello.mklx`.
> Then I launched Zathura with `zathura -x "nvr -cc \"call 
> vimtex#view#reverse_goto(%{line}, '%{input}')\" --nostart" hello.pdf`.
> When I clicked "Hello, world!" while holding a control key it printed the
> following error to console:
> 
> ```
> (org.pwmt.zathura:80241): GLib-CRITICAL **: 15:49:12.359: 
> g_variant_new_string: assertion 'string != NULL' failed
> warning: Failed to obtain data via SyncTeX or data is incomplete.
> ```
> 
> I am attaching the `hello.mklx`, `hello.pdf` files and the generated 
> `hello.synctex` file. I am getting the same result with `--synctex=1`.
you can play with

mtxrun --script synctex

and the synctex file to see if it makes sense

one problem with synctex is that the editors depend on a library and 
there has been changes

texshop now uses the more independent method for context i.e. just 
calling "mtxrun --script synctex ..." which not only removes the 
dependency of a library (the dependency on mtxrun is ok as one has 
context anyway) but also permits room for improvement (apart from not 
being tricked by latex specific heuristics in the library)

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
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: SyncTeX does not work with Zathura
  2021-10-10 16:59   ` Hans Hagen via ntg-context
@ 2021-10-10 17:20     ` Cezary Drożak via ntg-context
  2021-10-10 20:54       ` Hans Hagen via ntg-context
  0 siblings, 1 reply; 5+ messages in thread
From: Cezary Drożak via ntg-context @ 2021-10-10 17:20 UTC (permalink / raw)
  To: Hans Hagen, mailing list for ConTeXt users; +Cc: Cezary Drożak

 > you can play with
 >
 > mtxrun --script synctex
 >
 > and the synctex file to see if it makes sense
I wrote two almost identical files in plain tex and context. When I 
generated the synctex file and ran `mtxrun --script synctex --list 
x.synctex` I got this:

```
$ mtxrun --script synctex --list context.synctex
mtx-synctex     | begin page: 1
mtx-synctex     | end page: 1

$ mtxrun --script synctex --list tex.synctex
mtx-synctex     | begin page: 1
mtx-synctex     |   [  72   82   92   82] :     1 : 
/home/nawordar/tests/tex/hello/./tex.tex
mtx-synctex     | end page: 1
```

It looks like context generates an incomplete synctext file.

 > one problem with synctex is that the editors depend on a library and 
there has been changes
 >
 > texshop now uses the more independent method for context i.e. just 
calling "mtxrun --script synctex ..." which not only removes the dependency 
of a library (the dependency on mtxrun is ok as one has context anyway) but 
also permits room for improvement (apart from not being tricked by latex 
specific heuristics in the library)

But that would need a change in Zathura wouldn't it?
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: SyncTeX does not work with Zathura
  2021-10-10 17:20     ` Cezary Drożak via ntg-context
@ 2021-10-10 20:54       ` Hans Hagen via ntg-context
  2021-10-11 10:32         ` Cezary Drożak via ntg-context
  0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen via ntg-context @ 2021-10-10 20:54 UTC (permalink / raw)
  To: Cezary Drożak, mailing list for ConTeXt users; +Cc: Hans Hagen

On 10/10/2021 7:20 PM, Cezary Drożak wrote:
>  > you can play with
>  >
>  > mtxrun --script synctex
>  >
>  > and the synctex file to see if it makes sense
> I wrote two almost identical files in plain tex and context. When I 
> generated the synctex file and ran `mtxrun --script synctex --list 
> x.synctex` I got this:
> 
> ```
> $ mtxrun --script synctex --list context.synctex
> mtx-synctex     | begin page: 1
> mtx-synctex     | end page: 1
> 
> $ mtxrun --script synctex --list tex.synctex
> mtx-synctex     | begin page: 1
> mtx-synctex     |   [  72   82   92   82] :     1 : 
> /home/nawordar/tests/tex/hello/./tex.tex
> mtx-synctex     | end page: 1
> ```
> 
> It looks like context generates an incomplete synctext file.

I can't say ... what is missing? Can you figure out what makes Zathura 
unhappy?

The context synctex files are definitely less verbose because (1) we 
avoid clutter, (2) omit auto-generated content like pagenumbers and so, 
(3) collapse ranges (which we can do because we know what we're dealing 
with), (4) don't compress (because it makes no sense), (5) ignore 
styles, (6) also handle xml, etc. There have been some changes between 
synctex 1 and 2 but I don['t keep track of that. Actually, if a 'call 
some command' approach would have been chosen we could have better 
readable files (in our case lua or so).

>  > one problem with synctex is that the editors depend on a library and 
> there has been changes
>  >
>  > texshop now uses the more independent method for context i.e. just 
> calling "mtxrun --script synctex ..." which not only removes the 
> dependency of a library (the dependency on mtxrun is ok as one has 
> context anyway) but also permits room for improvement (apart from not 
> being tricked by latex specific heuristics in the library)
> 
> But that would need a change in Zathura wouldn't it?

sure, so unlikely to happen soon (i have no influence on that)

(but it would have been a better approach anyway, not being dependent on 
libraries that that depend on specific synctex versions in tex as well 
as heuristics; basically now one needs a version of the editor/viewer 
that matches a tex engine); one doesn't hard code a pdf viewer in an 
editor either (btw, the script approach permits two way sync, so in 
texshop one can go from pdf to source and source to pdf)

here with

\starttext
Hello, world!
\stoptext

i get

SyncTeX Version:1
Input:1:oeps.tex
Output:pdf
Magnification:1000
Unit:1
X Offset:0
Y Offset:0
Content:
!103
{1
[0,0:0,0:0,0,0
v0,0:0,55380990:39158276,55380990,0
h1,6:4661756,9176901:4275840,655360,327680
]
!104
}1
!8
Postamble:
Count:3
!22
Post scriptum:

(also with context --synctex oeps)

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
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: SyncTeX does not work with Zathura
  2021-10-10 20:54       ` Hans Hagen via ntg-context
@ 2021-10-11 10:32         ` Cezary Drożak via ntg-context
  0 siblings, 0 replies; 5+ messages in thread
From: Cezary Drożak via ntg-context @ 2021-10-11 10:32 UTC (permalink / raw)
  To: Hans Hagen, mailing list for ConTeXt users; +Cc: Cezary Drożak

 > I can't say ... what is missing? Can you figure out what makes Zathura 
unhappy?

I run gdb with breakpoint set on zathura/synctex.c:86 and while
`synctex_get_input_line_column` returns true, `input_file` is `NULL` so the
"else" branch is executed. That is all I managed to debug, I don't know how 
I
could step into the SyncTeX function.

 > here with
 >
 > \starttext
 > Hello, world!
 > \stoptext
 >
 > i get
 >
 > SyncTeX Version:1
 > Input:1:oeps.tex
 > Output:pdf
 > Magnification:1000
 > Unit:1
 > X Offset:0
 > Y Offset:0
 > Content:
 > !103
 > {1
 > [0,0:0,0:0,0,0
 > v0,0:0,55380990:39158276,55380990,0
 > h1,6:4661756,9176901:4275840,655360,327680
 > ]
 > !104
 > }1
 > !8
 > Postamble:
 > Count:3
 > !22
 > Post scriptum:
 >
 > (also with context --synctex oeps)

For me it generated a slightly smaller file:

 > SyncTeX Version:1
 > Input:1:/home/nawordar/projects/zathura/build/oeps.tex
 > Output:pdf
 > Magnification:1000
 > Unit:1
 > X Offset:0
 > Y Offset:0
 > Content:
 > !141
 > {1
 > [0,0:0,0:0,0,0
 > v0,0:0,55380990:39158276,55380990,0
 > ]
 > !61
 > }1
 > !7
 > Postamble:
 > Count:2
 > !22
 > Post scriptum:

Similarly to previous examples, `mtxrun --script synctex --list 
oeps.synctex`
only showed me that much:

```
mtx-synctex     | begin page: 1
mtx-synctex     | end page: 1
```

When I executed it on your SyncTeX file, it showed one line more:

```
mtx-synctex     | begin page: 1
mtx-synctex     |   [  71  135  136  149] :     6 : oeps.tex
mtx-synctex     | end page: 1
```

Still, with both files Zathura gave me the same error :/. It is really 
weird
though, that ConTeXt generated a different SyncTeX file for me for the same
exact file and command.

The versions of ConTeXt and SyncTeX:

```
$ synctex help
This is SyncTeX command line utility, version 1.5
usage: synctex <subcommand> [options] [args]
Synchronize TeXnology command-line client, version 1.21

$ context --version
mtx-context     | ConTeXt Process Management 1.04
```

 > btw, the script approach permits two way sync, so in texshop one can go 
from pdf to source and source to pdf

Could you send me the exact commands for that? I can't get any meaningful
output from `mtxrun --script synctex` either. It always prints me just an
empty line. All the options described in usage look like they are for going 
to
source code.

[1]: 
https://github.com/pwmt/zathura/blob/9bc3e9bfafc11a526b6f94d62b8da5ac209f6da0/zathura/synctex.c#L86
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-10-11 10:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <546d4350-5561-57a3-c963-584fc65e1a9c@drozak.net>
2021-10-10 16:11 ` SyncTeX does not work with Zathura Cezary Drożak via ntg-context
2021-10-10 16:59   ` Hans Hagen via ntg-context
2021-10-10 17:20     ` Cezary Drożak via ntg-context
2021-10-10 20:54       ` Hans Hagen via ntg-context
2021-10-11 10:32         ` Cezary Drożak via ntg-context

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).