1

Is there any PDF viewer available for Linux that supports synctex (inverse and forward search) without the need for DBUS? Ideally, on Wayland compositors, and using vim as editor. (My current solution uses vimtex and zathura, on xorg (due to xdotool).)

jj_p
  • 627

1 Answers1

2

this is for example possible using zathura as a viewer, which is quite lightweight, runs under wayland and has vim-like keyboard control on top. Dbus support can be completely disabled at compile time but in case you use a precompiled distribution package, you can still run it without a running dbus session.

Regarding editor setup, I can't give you detailed instructions as I'm using emacs (auctex package), but the following hints and a little research should get you going:

Forward synchronization (from editor to viewer) works in a generic way by calling zathura with the --synctex-forward option and the respective parameters, which should be trivial to setup in vim (as long as your latex plugin gives you the correct synctex parameters (alternatively, you can get them by calling synctex view, see the zathura manual for details).

For backwards synchronization, you can give zathura an arbitrary --synctex-editor-command to call when you control-click in the pdf. In my case, it calls emacsclient which communicates to a running emacs --server over a socket file via

--synctex-editor-command "emacsclient +%{line} %{input}"

Here, +%{line} will expand to the correct line number in the source file and %{input} to the source file name. Gvim, which you're probably using anyway, has similar client-server functionality, as described in this answer (which describes a similar setup using okular) or the zathura manual, I don't know about plain vim though.

  • Thanks. Are you sure that foward sync works without dbus? last time I tried it said something like "error: Could not connect to session bus: Error spawning command line “dbus-launch --autolaunch=... --binary-syntax --close-stderr”: Child process exited with code 1 error: Got no usable data from SyncTeX or D-Bus failed in some way." – jj_p Jul 03 '22 at 09:03
  • @jj_p I haven't completely freed myself from the unholy udev-dbus-systemd trilogy yet (but am fairly close) and hence can't kill my dbus session without crashing the display server. My emacs is compiled without dbus though, but maybe zathura checks for other running instances over dbus. Did you try the explicit instructions on page 7 of the zathura manual (for gvim)? – n_flanders Jul 04 '22 at 02:08
  • @jj_p It is indeed required, see here. That's very unfortunate! – n_flanders Jul 04 '22 at 02:13