New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
gkapfham opened this Issue Jun 2, 2015 · 12 comments

Comments

Projects
None yet
3 participants
@gkapfham

gkapfham commented Jun 2, 2015

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?

@nasenatmer

This comment has been minimized.

Show comment
Hide comment
@nasenatmer

nasenatmer Jun 2, 2015

Contributor

It seems you copy and pasted the request twice into your post. Please see my answer in #171 regarding the question whether your setup fulfils vimtex-requirements.

Contributor

nasenatmer commented Jun 2, 2015

It seems you copy and pasted the request twice into your post. Please see my answer in #171 regarding the question whether your setup fulfils vimtex-requirements.

@gkapfham

This comment has been minimized.

Show comment
Hide comment
@gkapfham

gkapfham Jun 2, 2015

I fixed the copy and paste mistake associated with this issue; it turns out that I accidentally pasted another issue report at the bottom of this one. Thanks for pointing out my mistake!

gkapfham commented Jun 2, 2015

I fixed the copy and paste mistake associated with this issue; it turns out that I accidentally pasted another issue report at the bottom of this one. Thanks for pointing out my mistake!

@gkapfham

This comment has been minimized.

Show comment
Hide comment
@gkapfham

gkapfham Jun 2, 2015

I should additionally point out that if I attempt to use MuPDF instead of Zathura and I run \ll and then \lv I also see that two MuPDF windows are opened. So, this seems to be a broader and more systematic issue related to either recent vimtex commits or something in my configuration or operating system environment.

gkapfham commented Jun 2, 2015

I should additionally point out that if I attempt to use MuPDF instead of Zathura and I run \ll and then \lv I also see that two MuPDF windows are opened. So, this seems to be a broader and more systematic issue related to either recent vimtex commits or something in my configuration or operating system environment.

@nasenatmer

This comment has been minimized.

Show comment
Hide comment
@nasenatmer

nasenatmer Jun 2, 2015

Contributor

Yes, it seems there has some regression entered vimtex that caused most of your issues here, which is why I'd suggest to focus the discussion on one of the issues, possibly #176 as it seems to narrow down the problem quite well: the action of buffer switching causing the problems.

Contributor

nasenatmer commented Jun 2, 2015

Yes, it seems there has some regression entered vimtex that caused most of your issues here, which is why I'd suggest to focus the discussion on one of the issues, possibly #176 as it seems to narrow down the problem quite well: the action of buffer switching causing the problems.

@lervag

This comment has been minimized.

Show comment
Hide comment
@lervag

lervag Jun 5, 2015

Owner

First, based on your settings I actually expect that the first \lv after \ll to open a second window. The reason for this is that the xwin_id is not set after \ll unless you enable callbacks, which you have disabled in your vimrc.

However, the next problem is not expected: changing file within the project should not lead to a new window on the next \lv. I'll investigate this.

Owner

lervag commented Jun 5, 2015

First, based on your settings I actually expect that the first \lv after \ll to open a second window. The reason for this is that the xwin_id is not set after \ll unless you enable callbacks, which you have disabled in your vimrc.

However, the next problem is not expected: changing file within the project should not lead to a new window on the next \lv. I'll investigate this.

@lervag lervag closed this in b891bd7 Jun 5, 2015

@lervag

This comment has been minimized.

Show comment
Hide comment
@lervag

lervag Jun 5, 2015

Owner

I think my last commit fixes the issue where a change of file leads to a new window being opened on \lv. I'd appreciate if you could test and verify.

The problem here is similar to the problem in #176. It seems I should take a closer look at the initialization code in general. There are probably more similar problems that should be fixed in a more general manner than what I have just pushed right now.

Owner

lervag commented Jun 5, 2015

I think my last commit fixes the issue where a change of file leads to a new window being opened on \lv. I'd appreciate if you could test and verify.

The problem here is similar to the problem in #176. It seems I should take a closer look at the initialization code in general. There are probably more similar problems that should be fixed in a more general manner than what I have just pushed right now.

@gkapfham

This comment has been minimized.

Show comment
Hide comment
@gkapfham

gkapfham Jun 5, 2015

I did some quick testing with this issue and found that zathura now only loads one time, as I would expect. However, even though a SyncTeX file is being generated, I find that it cannot zoom to the correct page in the zathura window. So, it seems as though your last commit has, at least partially, solved this problem.

Although not directly related to this issue, I can also report that, if I pick mupdf as the viewer it will load correctly and also zoom to the correct location on any of the pages on the minimal working example. However, if I go into the sections/first.tex file and then run the \lv command, I notice that a new mupdf window opens again.

In summary, it seems that, at least for me, forward search does not yet fully work for either mupdf or zathura when I am editing a mutiple-file project.

Finally, is there a way for mupdf to zoom to a specific page and then highlight that line? Or, is this a feature only provided by programs like zathura and evince?

gkapfham commented Jun 5, 2015

I did some quick testing with this issue and found that zathura now only loads one time, as I would expect. However, even though a SyncTeX file is being generated, I find that it cannot zoom to the correct page in the zathura window. So, it seems as though your last commit has, at least partially, solved this problem.

Although not directly related to this issue, I can also report that, if I pick mupdf as the viewer it will load correctly and also zoom to the correct location on any of the pages on the minimal working example. However, if I go into the sections/first.tex file and then run the \lv command, I notice that a new mupdf window opens again.

In summary, it seems that, at least for me, forward search does not yet fully work for either mupdf or zathura when I am editing a mutiple-file project.

Finally, is there a way for mupdf to zoom to a specific page and then highlight that line? Or, is this a feature only provided by programs like zathura and evince?

@lervag

This comment has been minimized.

Show comment
Hide comment
@lervag

lervag Jun 5, 2015

Owner

I just pushed a fix for mupdf as well. It should now not open more than once.

Unfortunately (because I like MuPDF alot), MuPDF does not support synctex at all. I've implemented a hack that uses synctex on the command line and sends a key sequence to MuPDF to have it open the specified page that contains the text. But highlighting is not possible, sorry.

Also, I'm sorry about the inconvenience, but could you please open a new issue for the synctex problem with Zathura? I don't have time to work more now, and it would be a great help to me if I could keep this issue closed and have a new issue with a more focused and specific specification of the problem.

Btw: Thanks alot for reporting these issues! I think I've solved/fixed several bugs now due to your reports.

Owner

lervag commented Jun 5, 2015

I just pushed a fix for mupdf as well. It should now not open more than once.

Unfortunately (because I like MuPDF alot), MuPDF does not support synctex at all. I've implemented a hack that uses synctex on the command line and sends a key sequence to MuPDF to have it open the specified page that contains the text. But highlighting is not possible, sorry.

Also, I'm sorry about the inconvenience, but could you please open a new issue for the synctex problem with Zathura? I don't have time to work more now, and it would be a great help to me if I could keep this issue closed and have a new issue with a more focused and specific specification of the problem.

Btw: Thanks alot for reporting these issues! I think I've solved/fixed several bugs now due to your reports.

@gkapfham

This comment has been minimized.

Show comment
Hide comment
@gkapfham

gkapfham Jun 8, 2015

I am writing to confirm that the recent commits that you made have resolved the issue that I described. That is, a second MuPDF window no longer opens when I am viewing a subfile of a mutlple-file LaTeX project. Generally, the rather limited MuPDF forward searching seems to normally work as I would expect. Later, I will open other issues related to concerns that I have about Zathura working correctly.

gkapfham commented Jun 8, 2015

I am writing to confirm that the recent commits that you made have resolved the issue that I described. That is, a second MuPDF window no longer opens when I am viewing a subfile of a mutlple-file LaTeX project. Generally, the rather limited MuPDF forward searching seems to normally work as I would expect. Later, I will open other issues related to concerns that I have about Zathura working correctly.

@lervag

This comment has been minimized.

Show comment
Hide comment
@lervag

lervag Jun 8, 2015

Owner

Great, I'm happy to hear that things are working. Also I will be happy to help in finding the problem with Zathura. For me things are working as expected, so I think it might be related to software versions or similar.

Owner

lervag commented Jun 8, 2015

Great, I'm happy to hear that things are working. Also I will be happy to help in finding the problem with Zathura. For me things are working as expected, so I think it might be related to software versions or similar.

@gkapfham

This comment has been minimized.

Show comment
Hide comment
@gkapfham

gkapfham May 25, 2016

I am writing to let you know that I no longer use Zathura when writing LaTeX documents with vim and vimtex. Although I like the features that it provides, it turns out that this PDF viewer does not have HiDPI support and thus all of the words look very blurry. For now, I am back to use MuPDF again! If anyone is able to get Zathura to work on a HiDPI display, please let me know how you did this.

gkapfham commented May 25, 2016

I am writing to let you know that I no longer use Zathura when writing LaTeX documents with vim and vimtex. Although I like the features that it provides, it turns out that this PDF viewer does not have HiDPI support and thus all of the words look very blurry. For now, I am back to use MuPDF again! If anyone is able to get Zathura to work on a HiDPI display, please let me know how you did this.

@lervag

This comment has been minimized.

Show comment
Hide comment
@lervag

lervag May 26, 2016

Owner

Thanks for the notice. The last time I tried HiDPI on Linux I was not able to get a "smooth" experience. That is, I was not able to get full HiDPI support with a lot of the different software I was using. I gave up, and I still haven't tried again. I'll keep in mind that Zathura may be difficult to get working as well.

Owner

lervag commented May 26, 2016

Thanks for the notice. The last time I tried HiDPI on Linux I was not able to get a "smooth" experience. That is, I was not able to get full HiDPI support with a lot of the different software I was using. I gave up, and I still haven't tried again. I'll keep in mind that Zathura may be difficult to get working as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment