Discussion:
[zathura] synctex, open a new file on a specified line
Maxim Gonchar
2014-04-23 06:05:40 UTC
Permalink
Hi,

after some playing and searching the internet I was able to use zathura
synctex support, by opening a file:
zathura -s -x 'gvim --servername SYNCTEX --remote +\%{line} \%{input}'
Introduction_en.pdf
and switching to the specified line:
zathura --synctex-forward 100:1:<fullpath>/Introduction_en.tex
Introduction_en.pdf

If I try to combine these two commands I get an error saying that the
opened instance for Introduction_en.pdf is not found.
I wonder why this distinction is made? Is there a way to open zathura and
sync if file is not opened, or simply sync if the opened instance exists?

Here is the vim code to sync or run zathura, which is ugly, because
instead of one function I need three:

function! StartZathura( pdfname )
let cmd = "silent !zathura -s -x "
let backcmd = "'gvim --servername ".v:servername." --remote
+\\%{line}
\\%{input}' "
let execstr = cmd.backcmd.a:pdfname.'&'
exec execstr
endf

function! SyncZathura( pdfname, status )
let cmd = "silent !zathura --synctex-forward "
let path = line(".").":".col(".").":".expand("%:p")." "
let execstr = cmd.path.a:pdfname
if !a:status
let execstr.=' &'
endif
exec execstr
return v:shell_error
endf

function! StartOrSyncZathura( pdfname )
if !SyncZathura( a:pdfname, 1 )
return
endif
call StartZathura( a:pdfname )
sleep 300m
call SyncZathura( a:pdfname, 0 )
endf

regards,
Maxim
Sebastian Ramacher
2014-04-23 17:30:51 UTC
Permalink
Post by Maxim Gonchar
Hi,
after some playing and searching the internet I was able to use zathura
zathura -s -x 'gvim --servername SYNCTEX --remote +\%{line} \%{input}'
Introduction_en.pdf
zathura --synctex-forward 100:1:<fullpath>/Introduction_en.tex
Introduction_en.pdf
If I try to combine these two commands I get an error saying that the
opened instance for Introduction_en.pdf is not found.
I wonder why this distinction is made? Is there a way to open zathura and
sync if file is not opened, or simply sync if the opened instance exists?
It's just that nobody had any use for anything like that yet so it's just not
there - doing anything after a document has been opened was always a pain to
time right. But if there's interest in something like that, we can fix that.

Cheers
--
Sebastian Ramacher
Maxim Gonchar
2014-04-24 05:29:07 UTC
Permalink
That would be great! Thanks.

Maxim

On Wed, 23 Apr 2014 21:30:51 +0400, Sebastian Ramacher
Post by Sebastian Ramacher
Post by Maxim Gonchar
Hi,
after some playing and searching the internet I was able to use zathura
zathura -s -x 'gvim --servername SYNCTEX --remote +\%{line} \%{input}'
Introduction_en.pdf
zathura --synctex-forward 100:1:<fullpath>/Introduction_en.tex
Introduction_en.pdf
If I try to combine these two commands I get an error saying that the
opened instance for Introduction_en.pdf is not found.
I wonder why this distinction is made? Is there a way to open zathura and
sync if file is not opened, or simply sync if the opened instance exists?
It's just that nobody had any use for anything like that yet so it's just not
there - doing anything after a document has been opened was always a pain to
time right. But if there's interest in something like that, we can fix that.
Cheers
gi1242+zathura
2014-04-30 01:43:48 UTC
Permalink
Post by Sebastian Ramacher
Post by Maxim Gonchar
after some playing and searching the internet I was able to use zathura
zathura -s -x 'gvim --servername SYNCTEX --remote +\%{line} \%{input}'
Introduction_en.pdf
zathura --synctex-forward 100:1:<fullpath>/Introduction_en.tex
Introduction_en.pdf
If I try to combine these two commands I get an error saying that the
opened instance for Introduction_en.pdf is not found.
I wonder why this distinction is made? Is there a way to open zathura and
sync if file is not opened, or simply sync if the opened instance exists?
It's just that nobody had any use for anything like that yet so it's
just not there - doing anything after a document has been opened was
always a pain to time right. But if there's interest in something like
that, we can fix that.
Something like this is very useful when I open up a PDF viewer from my
editor (Vim of course). I'd like to have one mapping that opens a PDF
(if it's not already open) and then syncs to the current location.

However, this functionality can be trivially added with a little
scripting. See here:

http://wiki.math.cmu.edu/iki/wiki/tips/20140310-zathura-fsearch.html

GI

PS: Thanks a ton for implementing forward searches. I finally was able
to abandon Xdvi, and now do everything with PDF files.
--
'Common' Proof Techniques:
6. Proof by Similarity -- "The other 253 cases are analogous"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.pwmt.org/archive/zathura/attachments/20140429/0a8335f3/attachment.sig>
Loading...