Skip to content

Zathura Windows Repeatedly Open When Using Vimtex on Ubuntu 14.04 LTS #177

@gkapfham

Description

@gkapfham

Once again, thank you for your hard work in the vimtex plugin! I have used it in the past several months to write many papers using LaTeX and vim. Although I have tried a wide number of different configurations in an attempt to get Zathura integration to work with vimtex, I have never been able to successfully use forward searching from vim to Zathura.

Before I go into the details about the problem that I am facing, I will share some of the configurations of the environments in which I have noticed concerns. Currently, I am running Ubuntu 14.04 LTS and I have focused on reproducing the problems described in this issue with a new version of vim that I built from source a few days ago. However, I should note that I was also not able to get Zathura integration to work when I tried it with the standard version of vim that comes with Ubuntu 14.04.

Here is the version of vim provided by Ubuntu:

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan  2 2014 19:40:46)
Garbage after option argument: "-version"
More info with: "vim -h"

Here are some more details about this version of vim:

:version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan  2 2014 19:40:46)
Included patches: 1-52

Here is the version of vim that I recently compiled:

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled May 31 2015 17:09:42)
Garbage after option argument: "-version"
More info with: "vim -h"

Here are some more details about this version of vim:

:version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled May 31 2015 17:09:42)
Included patches: 1-729

Here is the version of the xdotool that comes pre-installed with Ubuntu 14.04 LTS:

xdotool version 3.20140217.1

Here is the version of zathura that I have installed:

zathura 0.2.6
(plugin) pdf-poppler (0.2.4) (/usr/lib/zathura/pdf.so)

I have also created a minimal .vimrc file; you will notice that it is only slightly different than the one that people commonly use when reporting issues about vimtex.

set nocompatible
filetype plugin indent on
syntax enable
set iskeyword+=:
let maplocalleader=","
let mapleader=","

call plug#begin('~/.vim/bundle')
Plug 'https://github.com/lervag/vimtex.git', {'for': 'tex'}
call plug#end()

let g:vimtex_fold_enabled = 0
let g:vimtex_quickfix_mode = 2
let g:vimtex_quickfix_open_on_warning = 1
let g:vimtex_toc_resize = 0
let g:vimtex_toc_hide_help = 1
let g:vimtex_indent_enabled = 1
let g:vimtex_latexmk_enabled = 1
let g:vimtex_latexmk_callback = 0
let g:vimtex_complete_recursive_bib = 0
let g:vimtex_view_method = 'zathura'

I also have a .latexmkrc file that I took from @lervag's GitHub repository of configuration files and enhanced slightly with other configurations that I found in the discussion of issues for vimtex.

$print_type = 'pdf';
$pdf_mode = 1;
$bibtex_use = 2;
push @generated_exts, "cb";
push @generated_exts, "cb2";
push @generated_exts, "spl";
push @generated_exts, "nav";
push @generated_exts, "snm";
push @generated_exts, "tdo";
push @generated_exts, "nmo";
push @generated_exts, "brf";
push @generated_exts, "nlg";
push @generated_exts, "nlo";
push @generated_exts, "nls";
push @generated_exts, "synctex.gz";
push @generated_exts, "tex.latexmain";
push @generated_exts, "run.xml";
$latex = 'latex --src-specials %O %S';
$pdflatex = 'pdflatex -file-line-error -synctex=1 -interaction=nonstopmode -shell-escape %O %S';

$new_viewer_always = 0;
$pdf_update_method = 2;
$pdf_update_signal = 'SIGHUP';

add_cus_dep('nlo', 'nls', 0, 'nlo2nls');
sub nlo2nls {
  system("makeindex $_[0].nlo -s nomencl.ist -o $_[0].nls -t $_[0].nlg" );
}

# vim: ft=perl

The vast majority of the LaTeX documents that I write are divided into multiple files. I followed the vimtex guidelines to add headers to the top of a subfile so that it is clear which file is the main file. To reproduce the fault that I am having on complex LaTeX documents, I have produced the following minimal working example.

First, there is a file that is called minimal.tex:

\documentclass{minimal}
\begin{document}
Hello world first page!
\newpage
Hello world second page!
\newpage
\input{sections/first.tex}
\end{document}

Then, there is the file called first.tex that is in the sections directory:

% vim: ft=tex
% !TEX root = minimal.tex

Hello world third page!!

I am going to write a lot of content now. Does this work?

Now, if I load the minimal.tex file into vim and press <leader>ll to start the compilation of the paper in latexmk I would notice that the first zathura window has appeared on the screen. Then, if I press <leader>lv so that I zoom to say, the first page that contains the sentence "Hello world first page!", I would find that another Zathura window has appeared.

If I change buffers to the first.tex file and then run the <leader>lv command again, it will load another zathura window. Interestingly, zathura never goes to the correct page based on my location in either the minimal.tex file or the first.tex file.

Here is the output from running the <leader>li command in vim:

b:vimtex
  id : 0


g:vimtex#data[0] : minimal
  pid : 0
  root : '/home/gkapfham/working/writing/minimal'
  aux : '/home/gkapfham/working/writing/minimal/minimal.aux'
  log : '/home/gkapfham/working/writing/minimal/minimal.log'
  out : '/home/gkapfham/working/writing/minimal/minimal.pdf'
  tex : '/home/gkapfham/working/writing/minimal/minimal.tex'
  base : 'minimal.tex'
  viewer
    xwin_id : '104857607'
    class : 'Zathura'
    cmd_start : 'zathura  -x "/usr/local/bin/gvim --servername GVIM1 --remote +\%{line} \%{input}" ''/home/gkapfham/working/writing/minimal/minimal.pdf
'''
    cmd_forward_search : 'zathura --synctex-forward 5:1:''/home/gkapfham/working/writing/minimal/sections/first.tex'' ''/home/gkapfham/working/writing/
minimal/minimal.pdf'''
    init : function('20')
    view : function('21')
    start : function('22')
    forward_search : function('23')
    latexmk_callback : function('24')
    latexmk_append_argument : function('25')
    focus_vim : function('<SNR>39_focus_vim')
    xwin_exists : function('<SNR>39_xwin_exists')
    xwin_get_id : function('<SNR>39_xwin_get_id')

If I run the command xdotool search --class Zathura in a terminal window, I do find the xwin_id that was listed in the debugging output in vim. Also, note that the pid field in the debugging output is always (or, at least often) listed as 0.

I would see similar types of behavior when I tried to get Zathura to work with the older version of vim that is standard with Ubuntu 14.04. In summary, I have never been able to get Zathura integration to work in vimtex and vim.

Can you please advise me on how I can get Zathura integration working on vimtex on Ubuntu 14.04?
Once again, thank you for your hard work in the vimtex plugin! I have used it in the past several months to write many papers using LaTeX and vim. Although I have tried a wide number of different configurations in an attempt to get Zathura integration to work with vimtex, I have never been able to successfully use forward searching from vim to Zathura.

Can you please advise me on how I can get Zathura integration working on vimtex on Ubuntu 14.04?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions