Issue
In Neovim on MacOS, when pressing \lv to trigger :VimtexView, I get error message vimtex: Viewer cannot find Zathura window ID!. The Zathura window does not get a xwin id. xdotool is installed.
minimal.vim
set nocompatible
let &runtimepath = '~/.vim/plugged/vimtex,' . &runtimepath
let &runtimepath .= ',~/.vim/plugged/vimtex/after'
filetype plugin indent on
syntax on
let g:vimtex_view_method = 'zathura'
minimal.tex
\documentclass{article}
\begin{document}
\title{Big Title}
\author{Author Name}
\maketitle
\section{Chapter Title}
Consectetuer adipiscing elit. Aenean commodo ligula eget dolor.
\section{Chapter next}
Lorem ipsum dolor sit amet,
\end{document}
Output from VimtexCompileOuput
Rc files read:
NONE
Latexmk: This is Latexmk, John Collins, 17 Apr. 2020, version: 4.69a.
Viewing pdf
======= Need to update make_preview_continuous for target files
Latexmk: I have not found a previewer that is already running.
So I will start it for 'mwe.pdf'
------------
Latexmk: All targets (mwe.pdf) are up-to-date
For rule 'view', running '&if_source( )' ...
------------
Running 'start zathura -x "nvr --servername /var/folders/bv/ctdkmjy5583dgsks5z4tf8r40000gn/T/vimr_E4615521-7C8A-4FBF-812D-F4D6EB8D1DBC.sock --remote +%{line} %{input}" "mwe.pdf"'
------------
------------
Running 'echo vimtex_compiler_callback_success'
------------
vimtex_compiler_callback_success
Commands/Input
\ll\lv or :VimtexViewObserved Behaviour
Error message appears
Expected Behaviour
Expect window to shift and passage to be highlighted in Zathura
Output from VimtexInfo
System info
OS: Mac OS X 10.15.5 (19F101)
Vim version: NVIM v0.4.3
Has clientserver: true
Servername: /var/folders/bv/ctdkmjy5583dgsks5z4tf8r40000gn/T/vimr_B34B0D20-0B2F-4D8E-B5B4-8BB5EBCAC57A.sock
vimtex project: mwe
base: mwe.tex
root: /Users/Timothy/Desktop/mwe
tex: /Users/Timothy/Desktop/mwe/mwe.tex
out: /Users/Timothy/Desktop/mwe/mwe.pdf
log: /Users/Timothy/Desktop/mwe/mwe.log
aux: /Users/Timothy/Desktop/mwe/mwe.aux
fls: /Users/Timothy/Desktop/mwe/mwe.fls
main parser: current file verified
compiler: latexmk
backend: nvim
output: /var/folders/bv/ctdkmjy5583dgsks5z4tf8r40000gn/T/nvim3vxPQp/0
configuration:
continuous: 1
callback: 1
latexmk options:
-verbose
-file-line-error
-synctex=1
-interaction=nonstopmode
latexmk engine: -pdf
pid: 1516
cmd: max_print_line=2000 latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -e '$new_viewer_always = "0"' -e '$pdf_previewer = "zathura -x \"nvr --servername /var/folders/bv/ctdkmjy5583dgsks5z4tf8r40000gn/T/vimr_B34B0D20-0B2F-4D8E-B5B4-8BB5EBCAC57A.sock --remote +\%{line} \%{input}\" \%S"' -e '$success_cmd = "echo vimtex_compiler_callback_success"' -e '$failure_cmd = "echo vimtex_compiler_callback_failure"' 'mwe.tex'
viewer: Zathura
xwin id: 0
process:
pid: -
cmd: zathura -x "nvr --servername /var/folders/bv/ctdkmjy5583dgsks5z4tf8r40000gn/T/vimr_B34B0D20-0B2F-4D8E-B5B4-8BB5EBCAC57A.sock --remote-expr \"vimtex#view#reverse_goto(%{line}, '%{input}')\"" --synctex-forward 11:14:'/Users/Timothy/Desktop/mwe/mwe.tex' '/Users/Timothy/Desktop/mwe/mwe.pdf' >/dev/null 2>&1 &
qf: LaTeX logfile
config:
packages:
default: 1
default: 1
document class: article
Edit by @lervag: Remove unnecessary options from minimal vimrc.
In #1735 I got the impression that this issue was resolved. Did I misunderstand?
A different issue lay at the basis of that one. Once I resolved that, I got the error message that's in the title of this issue. For future reference it seemed more clear to create a separate issue for both.
Ok. Have you tried the commands from a terminal? That is:
mwe.pdf in Zathura with a command like this from a terminal in the same location as the file: zathura -x "nvr --remote-expr \"vimtex#view#reverse_goto(%{line}, '%{input}')\"" --synctex-forward 11:14:mwe.tex mwe.pdfxdotool search --class Zathura. What's the output?Thanks. Nothing happens when I run that command in Terminal. Zathura doesn't open and the terminal doesn't give me a new prompt.
Ok, then try simply zathura mwe.pdf. Does that work?
Do you have Zathura with libsynctex support? Which version of Zathura? What's the output of zathura --help?
That command works: the pdf opens as expected.
I reinstalled zathura with synctex just to be sure but nothing changed.
Output of zathura --help is this:
``` Usage:
zathura [OPTION…] [file1] [file2] [...]
Help Options:
-h, --help Show help options
Application Options:
-e, --reparent=xid Reparents to window specified by xid (X11)
-c, --config-dir=path Path to the config directory
-d, --data-dir=path Path to the data directory
--cache-dir=path Path to the cache directory
-p, --plugins-dir=path Path to the directories containing plugins
--fork Fork into the background
-w, --password=password Document password
-P, --page=number Page number to go to
-l, --log-level=level Log level (debug, info, warning, error)
-v, --version Print version information
-x, --synctex-editor-command=cmd Synctex editor (forwarded to the synctex command)
--synctex-forward=position Move to given synctex position
--synctex-pid=pid Highlight given position in the given process
--mode=mode Start in a non-default mode
```
Good, but you did not respond to all of my questions:
Ok. Have you tried the commands from a terminal? That is:
- Open the mwe.pdf in Zathura with a command like this from a terminal in the same location as the file: zathura -x "nvr --remote-expr \"vimtex#view#reverse_goto(%{line}, '%{input}')\"" --synctex-forward 11:14:mwe.tex mwe.pdf
- Now do xdotool search --class Zathura. What's the output?
My apologies for the late reply (holiday).
When I copy paste the first command in a Terminal I now get:
zsh: unknown file attribute: { Other times it runs but nothing happens at all.
When I subsequently type the xdotool command I don't get anything. When I instead do zathura mwe.pdf, zathura correctly opens the PDF. When I then run the xdotool command there is no output either.
Thanks. I believe the zathura command is correct, except for some escaping. You could try this:
zathura -x 'nvr --remote-expr "vimtex#view#reverse_goto(%{line}, ''%{input}'')"' ...
However, I think the real problem is that xdotool is not working as expected. Before we proceed on the Vim side of things, we need to make sure we can start Zathura, then use xdotool from a terminal to obtain the X window ID.
So, for now, simplify:
Open a pdf in Zathura: zathura mwe.pdf & (last & to make it go to background).
Now again, confirm that xdotool search --class Zathura does not give any output.
Install xprop or xwininfo, if necessary.
Run xprop to get the window properties from the Zathura window. Try with xwininfo as well. What's the output?
I've already mentioned that this seems related to #1719. Can you please read that thread again, especially the comments from June 17 and later? E.g. this comment seems relevant.
& doesn't put the process in the background. It does give me what looks like a PID, e.g.[1] 18412xdotool search --class Zathura gives no outputxprop and clicking on the zathura window does nothing. Running xwininfo asks me explicitly to click in the zathura window but when I do that nothing happensI don't know whether this is true on Linux but on macOS zathura does not behave like a normal window. When opened like this it's attached to the Terminal process. I can't close the zathura window separtely, I can only do this by closing the Terminal session.
I've tried to implement the #1719 wrapper script but I don't quite know how to translate this to macOS. Even with sudo I can't just copy that script to /usr/bin/. I also wouldn't know how to check where that folder is in my PATH. Any ideas on how to adapt the instructions in that thread to my system?
I've tried to implement the #1719 wrapper script but I don't quite know how to translate this to macOS. Even with sudo I can't just copy that script to /usr/bin/. I also wouldn't know how to check where that folder is in my PATH. Any ideas on how to adapt the instructions in that thread to my system?
Ah, I'm sorry, my mistake. I thought that issue was related to OSX, but it was related to Wayland on Linux. However, this issue _is_ relevant. Could you read the linked comment and see if it helps?
Ah, no, sorry. I realize @ktran9891 get's the same message as you. So, it seems noone so far has been able to get Zathura to fully work on OSX. I don't use OSX myself, and I am confident that the issue here is related to the xdotool part. It seems it is not possible to obtain the window ID with xdotool. To solve the issue, you would have to investigate this part, and I'm afraid I am not able to help further with that.
See fix over at zegervdv/homebrew-zathura
But when I install development branch the zathura window is now correctly seen by window management apps like Magnet but zathura does not open with VimtexCompile (it does open with :! zathura test.pdf & however). Maybe this will work when it's merged into the zathura master?
@flimofly on my machine it already works fine
@flimofly on my machine it already works fine
Oh that's great! Are you also on macOS Big Sur? Is a window ID assigned by xdotool (see :VimtexInfo)? I have no idea what I'm doing wrong. Did you need to install the develop version of zathura with an option to install libsync?
I have the same problem with zathura. When i type the cmd from :VimtexInfo in the terminal manually zathura -x "/Applications/MacVim.app/Contents/MacOS/Vim --servername VIM --remote-expr \"vimtex#view#reverse_goto(%{line}, '%{input}')\"" --synctex-forward 1:1:'/Users/tobiassimon/sandbox/minimal_vimtex/main.tex' '/Users/tbsmn/sandbox/minimal_vimtex/build/main.pdf' >/dev/null 2>&1 &
I get this output:
[1] 42075
[1] + exit 255 zathura -x --synctex-forward > /dev/null 2>&1
Does this help anyone to see whats wrong?
@tbsmn Can you try the same, but without >/dev/null 2>&1? That part removes all output/error messages.
@flimofly on my machine it already works fine
Screen.Recording.2021-01-11.at.15.37.58.movOh that's great! Are you also on macOS Big Sur? Is a window ID assigned by xdotool (see :VimtexInfo)? I have no idea what I'm doing wrong. Did you need to install the develop version of zathura with an option to install libsync?
Yeah, I'm on latest macOS, I just followed the instructions on the homebrew-zathura issue
:VimtexInfo after starting the compiler
System info
OS: macOS 11.1 (20C69)
Vim version: NVIM v0.4.4
Has clientserver: true
Servername: /var/folders/3r/_5t4ccxd4gv7j_q14qgnpf3r0000gn/T/nvimwuPAEu/0
vimtex project: main
base: main.tex
root: /Users/danielfalbo/Downloads/tmp
tex: /Users/danielfalbo/Downloads/tmp/main.tex
out: /Users/danielfalbo/Downloads/tmp/main.pdf
log: /Users/danielfalbo/Downloads/tmp/main.log
aux: /Users/danielfalbo/Downloads/tmp/main.aux
fls: /Users/danielfalbo/Downloads/tmp/main.fls
main parser: current file
compiler: latexmk
configuration:
continuous: 1
callback: 1
latexmk options:
-verbose
-file-line-error
-synctex=1
-interaction=nonstopmode
latexmk engine: -pdf
job: 5
pid: 12015
cmd: max_print_line=2000 latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -e '$new_viewer_always = "0"' -e '$pdf_previewer = "zathura -x \"/usr/local/Cellar/neovim/0.4.4/bin/nvim --servername /var/folders/3r/_5t4ccxd4gv7j_q14qgnpf3r0000gn/T/nvimwuPAEu/0 --remote +\%{line} \%{input}\" \%S"' -e '$success_cmd = "echo vimtex_compiler_callback_success"' -e '$failure_cmd = "echo vimtex_compiler_callback_failure"' 'main.tex'
viewer: Zathura
xwin id: 0
process:
pid: -
cmd: zathura -x "/usr/local/Cellar/neovim/0.4.4/bin/nvim --servername /var/folders/3r/_5t4ccxd4gv7j_q14qgnpf3r0000gn/T/nvimwuPAEu/0 --remote-expr \"vimtex#view#reverse_goto(%{line}, '%{input}')\"" --synctex-forward 51:1:'/Users/danielfalbo/Downloads/tmp/main.tex' '/Users/danielfalbo/Downloads/tmp/main.pdf' >/dev/null 2>&1 &
qf: LaTeX logfile
root: /Users/danielfalbo/Downloads/tmp
addqflist: 62
errorformat_saved:
fix_paths: 63
main: /Users/danielfalbo/Downloads/tmp/main.tex
set_errorformat: 61
document class:
packages:
amsbsy
amsfonts
amsgen
amsmath
amsopn
amssymb
amstext
amsthm
array
atbegshi
atveryend
auxhook
bigintcalc
bitset
bookmark
booktabs
calc
enumitem
epigraph
epstopdf-base
eso-pic
etexcmds
everyshi
fontawesome
fontenc
fourier
fourier-orns
fouriernc
geometry
gettitlestring
graphics
graphicx
hycolor
hyperref
ifluatex
ifmtarg
iftex
ifthen
ifvtex
ifxetex
import
infwarerr
intcalc
keyval
kvdefinekeys
kvoptions
kvsetkeys
letltxmacro
listings
lmodern
lscape
lstmisc
ltxcmds
microtype
nag
nameref
nextpage
pdfescape
pdflscape
pdfpages
pdftexcmds
pgf
pgfcomp-version-0-65
pgfcomp-version-1-18
pgfcore
pgffor
pgfkeys
pgfmath
pgfrcs
pgfsys
refcount
rerunfilecheck
textcomp
tikz
transparent
trig
uniquecounter
url
xcolor
xifthen
@tbsmn Can you try the same, but without
>/dev/null 2>&1? That part removes all output/error messages.
When I do that, I get error: Built without synctex support, but synctex specific option was specified.
But I can't find the precise formulation to install with synctex support via brew in the documentation. Does anyone remember it?
zegervdv/zathura/zathura --with-synctex
Thanks for the quick reply. This fixed it!
On 12 Jan 2021, at 07:41, Daniel Falbo notifications@github.com wrote:
zegervdv/zathura/zathura --with-synctex
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/lervag/vimtex/issues/1737#issuecomment-758442270, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEZHVAFRAHA6EFEJWSE4KOTSZPVKFANCNFSM4ORPQN7Q.
@tbsmn Can you try the same, but without
>/dev/null 2>&1? That part removes all output/error messages.
When I do that I get this error:
error: Could not connect to session bus: Error when creating the command line »dbus-launch --autolaunch=8b1580da9b5b98d21dde03ed5e8470ff --binary-syntax --close-stderr«: The child process was terminated with status 1
error: Got no usable data from SyncTeX or D-Bus failed in some way.
When I run dbus-launch --autolaunch=8b1580da9b5b98d21dde03ed5e8470ff I get:
Autolaunch requested, but X11 support not compiled in.
Cannot continue.
I installed dbus from homebrew, any idea how i can get it with X11 support compiled?
@flimofly Is it working for you now? Could you post the exact homebrew commands you used to install zathura to make it work?
I'm sorry that I can't be of much more help here, @tbsmn; but I'm glad to see some progress here. I would be very happy if the result of this discussion can be an update to the docs with a simple and consise recipe to make Zathura work on OSX.
Could you post the exact homebrew commands you used to install zathura to make it work?
It's working now. I did:
$ brew uninstall zathura-pdf-poppler
$ brew uninstall zathura
$ brew install zathura --HEAD --with-synctex
$ brew install zathura-pdf-poppler
$ mkdir -p $(brew --prefix zathura)/lib/zathura
$ ln -s $(brew --prefix zathura-pdf-poppler)/libpdf-poppler.dylib $(brew --prefix zathura)/lib/zathura/libpdf-poppler.dylib
Note that before I had installed 'xdotool' via brew and also XQuartz. I had also followed the instructions on this website to get XQuartz to work with XTEST. I wonder whether XQuartz is necessary at all?
On my machine, everything's ok without XQuartz so I guess it's not necessary 👍
@flimofly Thanks. I did the exact same install, but it is not working I get the same error as before.
error: Could not connect to session bus: Error when creating the command line »dbus-launch --autolaunch=8b1580da9b5b98d21dde03ed5e8470ff --binary-syntax --close-stderr«: The child process was terminated with status 1
error: Got no usable data from SyncTeX or D-Bus failed in some way.
xdotool and XQuartz work with XTEST. But thanks for that tipp.
Any ideas how I could debug this?
@tbsmn Unfortunately I don't have a clue. I looked at an earlier issue that I had with dbus but that was something different so won't help here.
@danielfalbo Does forward search work for you? I see in your VimtexInfo output that xwin = 0. So if you do :VimtexView, you also still get the error Viewer cannot find Zathura window ID! I presume?
@tbsmn
Hadn't tried this before because Zathura did open correctly but when I paste the command from VimtexInfo in a separate Terminal window, I now get a similar error that is also dbus related:
error: Could not connect to session bus: Cannot spawn a message bus without a machine-id: Unable to load /usr/local/var/lib/dbus/machine-id or /etc/machine-id: Failed to open file “/usr/local/var/lib/dbus/machine-id”: No such file or directory
error: Got no usable data from SyncTeX or D-Bus failed in some way.
@flimofly OK so opening and refreshing is working. Same here. But fordward an backward search is an issue (example :VimtexView).
I think this may be related to this Issue: https://github.com/zegervdv/homebrew-zathura/issues/50
@danielfalbo Does forward/backward search work for you, or do you have the same issue?
Forward and backward search are working now for both @tbsmn and me on latest version of macOS.
See further troubleshooting over at zegervdv/homebrew-zathura
Ah, nice! Would you care to provide an updated summary of what is required, then I can add it to the docs?
I will give it a try:
brew install dbus (if already installed) brew reinstall dbusexport DBUS_SESSION_BUS_ADDRESS='unix:path='$DBUS_LAUNCHD_SESSION_BUS_SOCKET to .zshrc<auth><\auth> in /usr/local/opt/dbus/share/dbus-1/session.conf from EXTERNAL to DBUS_COOKIE_SHA1brew services start dbus# unlink installed zathura and girara
brew unlink girara
brew unlink zathura
# install HEAD
brew install girara --HEAD
$ brew uninstall zathura-pdf-poppler
$ brew uninstall zathura
$ brew install zathura --HEAD --with-synctex
$ brew install zathura-pdf-poppler
$ mkdir -p $(brew --prefix zathura)/lib/zathura
$ ln -s $(brew --prefix zathura-pdf-poppler)/libpdf-poppler.dylib $(brew --prefix zathura)/lib/zathura/libpdf-poppler.dylib
Credits go to @robert-michael who figured out the dbus part.
@flimofly am I missing something?
Thanks! I've tried to add a section :help vimtex-faq-zathura-osx that I hope is helpful. Reg. step 5, do you need sudo or change user to root? Why $ infront of the last commands? Do you need brew unlink if you did not already install Zathura before?
Thanks both!
No need for sudo or root user. (Terminal noob here, but doesn't the $ just mean normal user?)
brew unlink is not necessary when zathura is not installed.
Most helpful comment
Thanks for the quick reply. This fixed it!