Skip to content
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

Forward search fails to work (Neovim + Zathura on Linux over SSH) #2392

Closed
llinfeng opened this issue May 17, 2022 · 13 comments
Closed

Forward search fails to work (Neovim + Zathura on Linux over SSH) #2392

llinfeng opened this issue May 17, 2022 · 13 comments
Labels

Comments

@llinfeng
Copy link
Contributor

llinfeng commented May 17, 2022

Description

I am new to compiling TeX documents on Linux OS, and wonder if the specific latexmk version and/or the MikTeX distribution may impact how forward search behave? After consulting this issue for the minimum config that should work for Neovim + Tmux, I am experiencing:

  • Perfectly functional backward search over SSH, with Ctrl-Click on a locally rendered Zathura window
  • However, forward search keeps sending me to the first page in Zathura.

Steps to reproduce

min.vim content:

" Need to source plug.vim to get things going.
" Use this bash command to fetch the file: "mkdir ~/.config/nvim/autoload/; curl  https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim > ~/.config/nvim/autoload/plug.vim"
source ~/.config/nvim/autoload/plug.vim

call plug#begin('~/.vim/plugged')
    Plug 'lervag/vimtex'
call plug#end()

" let g:tex_flavor = 'latex'
let g:vimtex_view_method = 'zathura'

min.tex content:

\documentclass{minimal}
\begin{document}
Hello world!
\newpage
Hello world!
\newpage
Page 3
\newpage
Page 4
\end{document}

And, for Zathura, ~/.config/zathura/zathurarc is left empty for this test.

Setup: I am accessing the Linux server using a WSL session on Win 10 machine. The SSH connection is established with -Y flag, permitting GUI programs to get rendered locally on the WSL machine. I will update this line when I verify how things behave with direct access to the Linux server.

Then, I followed the following steps to reproduce the problem.

  1. nvim --clean -u min.vim min.tex,
  2. Navigate to the line with "Page 3" in min.tex,
  3. Compile, and view. (\ll and :VimtexView)

Expected behavior

The Zathura window shall jump to Page 3. It should also highlight the corresponding line with text "Page 3"

Actual behavior

Instead of jumping to Page 3, the first page is shown with :VimtexView. And, there is no highlight drawn on Page 3.

Do you use a latexmkrc file?

no

VimtexInfo

System info:
  OS: Linux Mint 20.2
  Vim version: NVIM v0.6.1
  Has clientserver: true
  Servername: /tmp/nvimPSG6PR/0

VimTeX project: min
  base: min.tex
  root: /home/llinfeng/tmp/min_VimTex_ForwardBackward
  tex: /home/llinfeng/tmp/min_VimTex_ForwardBackward/min.tex
  main parser: current file verified
  document class: minimal
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
    job:
      jobid: 10
      output: /tmp/nvimPSG6PR/1
      cmd: max_print_line=2000 latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf 'min.tex'
      pid: 0
  viewer: Zathura
    xwin id: 12582915
    cmd_forward_search: zathura --synctex-forward 8:8:'min.tex' 'min.pdf'&
    cmd_start: zathura  -x "/usr/bin/nvim --headless -c \"VimtexInverseSearch %{line} '%{input}'\"" --synctex-forward 7:1:'min.tex'  qf method: LaTeX logfile
@llinfeng llinfeng added the bug label May 17, 2022
@lervag
Copy link
Owner

lervag commented May 17, 2022

A couple of minor comments, first:

  • You don't need let g:tex_flavor = 'latex' (see :help vimtex-tex-flavor).
  • You should run the example with nvim --clean -u min.vim min.tex, i.e. with the --clean option. This will ensure that neovim does not load any user config from your .config/nvim.

Now, you say backward search works. This indicates that things should work. So let's go more in depth.

Can you do this:

  • ssh into your box with -Y.
  • Go to the test folder and repeat the test (remember --clean).
  • Take note of the cmd_forward_search from :VimtexInfo.
  • Open a new terminal (e.g. new ssh session or new window in tmux or whatever).
  • Go to the test folder.
  • Now run the zathura --synctex-forward LINE:COLUMN:'min.tex' 'min.pdf'& command in the terminal and report what happens.

@llinfeng
Copy link
Contributor Author

llinfeng commented May 17, 2022

Thanks a lot for your very fast reply. I updated to use the following folded min.vim, and reproduced the same forward search behavior, with nvim --clean -u min.vim min.tex in the text folder. Wherever I start, the forward search will send me to page 1 in Zathura. I happen to have two Linux Mint Boxes, and this pattern is consistent over SSH.

`vim.tex`
" Need to source plug.vim to get things going.
" curl  https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim > ~/.config/nvim/autoload/plug.vim
source ~/.config/nvim/autoload/plug.vim

call plug#begin('~/vimfiles/plugged')
    Plug 'lervag/vimtex'
call plug#end()

let g:vimtex_view_method = 'zathura'

After issuing \lv to for forward search on line 9, in :VimtexInfo, I see the following:

  viewer: Zathura
    xwin id: 16777219
    cmd_forward_search: zathura --synctex-forward 9:1:'min.tex' 'min.pdf'&

Then, I went to a new console and navigated to the same test folder, and issue two commands:

  1. zathura --synctex-forward 9:1:'min.tex' 'min.pdf'& as I found from :VimtexInfo, and

  2. zathura --synctex-forward LINE:COLUMN:'min.tex' 'min.pdf'& as mentioned previously.

**(base) username 🏆 BoxName ➜  test_search  zathura --synctex-forward 9:1:'min.tex' 'min.pdf'&
[2] 2876000
(base) username 🏆 BoxName ➜  test_search  error: Failed to query 'filename' property from 'org.pwmt.zathura.PID-2875974': GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._g_2dio_2derror_2dquark.Code0: No document open.
SyncTeX Warning: No tag for min.tex
(base) username 🏆 BoxName ➜  test_search  zathura --synctex-forward LINE:COLUMN:'min.tex' 'min.pdf'&
[3] 2876125
(base) username 🏆 BoxName ➜  test_search  error: Failed to query 'filename' property from 'org.pwmt.zathura.PID-2875974': GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._g_2dio_2derror_2dquark.Code0: No document open.
SyncTeX Warning: No tag for min.tex
[3]  + 2876125 done       zathura --synctex-forward LINE:COLUMN:'min.tex' 'min.pdf'
**

@llinfeng
Copy link
Contributor Author

When I access a Linux box locally, with the two commands, I see slightly different console output. Though, for the first command with 9:1 denoting the intended line and column number, the result is identical - the Zathura window will jump to page 1.

(base) username 🏆 BoxName ➜  test_search  zathura --synctex-forward 9:1:'min.tex' 'min.pdf'&
[1] 2900
(base) username 🏆 BoxName ➜  test_search 
[1]  + 2900 done       zathura --synctex-forward 9:1:'min.tex' 'min.pdf'
(base) username 🏆 BoxName ➜  test_search   zathura --synctex-forward LINE:COLUMN:'min.tex' 'min.pdf'&
[1] 3095
(base) username 🏆 BoxName ➜  test_search 
[1]  + 3095 done       zathura --synctex-forward LINE:COLUMN:'min.tex' 'min.pdf'

@lervag
Copy link
Owner

lervag commented May 17, 2022

Ah, sorry! I didn't mean LINE:COLUMN literally. LINE should be the line number and COLUMN the column number to which you want to synchronize with synctex.

Let's keep testing this in the terminal. So, just to be sure I understood correctly, can you verify that the following steps reproduce your issue?

cd /path/to/test/files

# Start zathura
zathura min.pdf&

# Now try forward search
zathura --synctex-forward 9:1:'min.tex' 'min.pdf'

I.e., the last line should do a forward search to page 3 or 4, but on your end, it will go to page 1. Please confirm.

If confirmed, then try this instead:

# Use full path to tex file
zathura --synctex-forward 9:1:'/path/to/min.tex' 'min.pdf'

# Or full path to both files
zathura --synctex-forward 9:1:'/path/to/min.tex' '/path/to/min.pdf'

Do any of these work?

Can you also report the version of synctex on your end? I.e., output of synctex help (only three first lines).

Finally, it could be useful to see the output of synctex itself:

synctex view -i 9:1:'min.tex' -o min.pdf

@llinfeng
Copy link
Contributor Author

After opening min.pdf with Zathura, I first went to page 2. Then, the following command (with output) sent me to the first page instead of page 3.

(base) username 🏆 BoxName ➜  test_folder  zathura --synctex-forward 9:1:'min.tex' 'min.pdf'                         [22/05/17| 8:25PM]
SyncTeX Warning: No tag for min.tex

Then, with /home/username/tmp/test_folder/min.tex being the full path, I tried and both attempts sent me to the first page again.

(base) username 🏆 BoxName ➜  test_folder  zathura --synctex-forward 9:1:'/home/username/tmp/test_folder/min.tex' 'min.pdf'
SyncTeX Warning: No tag for /home/username/tmp/test_folder/min.tex
(base) username 🏆 BoxName ➜  test_folder  zathura --synctex-forward 9:1:'/home/username/tmp/test_folder/min.tex' '/home/username/tmp/test_folder/min.pdf'
SyncTeX Warning: No tag for /home/username/tmp/test_folder/min.tex

For synctex, here is the version info. I think I got it installed through MikTeX, into /home/username/bin. (To get a full MikTeX installation, I used mpm --verbose --package-level=complete --upgrade and left the console running by itself to complete the whole thing.)

This is SyncTeX command line utility, version 1.5
usage: synctex <subcommand> [options] [args]
Synchronize TeXnology command-line client, version 1.21

Lastly, with synctex by itself, I see:

(base) username 🏆 BoxName ➜  test_folder  synctex view -i 9:1:'min.tex' -o min.pdf
This is SyncTeX command line utility, version 1.5
SyncTeX Warning: No tag for min.tex

Across all three attempts, I think the common complaint is: SyncTeX Warning: No tag for min.tex. Then, per the following list of files in the test folder, am I missing something?

(base) username 🏆 BoxName ➜  test_folder  ls                                                                        
min.aux  min.fdb_latexmk  min.fls  min.latexmain  min.log  min.pdf  min.synctex.gz  min.tex  min.vim

@lervag
Copy link
Owner

lervag commented May 18, 2022

Lastly, with synctex by itself, I see:

(base) username 🏆 BoxName ➜  test_folder  synctex view -i 9:1:'min.tex' -o min.pdf
This is SyncTeX command line utility, version 1.5
SyncTeX Warning: No tag for min.tex

Clearly, the problem is that there is no synctex data. Can you recompile the files and try the synctex command again? When you do, do it like this:

  1. Open the project in Vim+VimTeX.
  2. Run \lC to fully clean all created files.
  3. Now do \ll. It will probably open Zathura when the compilation is finished.
  4. Do \lo. It will open a buffer that shows the compilation output. Please add the output in your reply - I'm curious if there is something there that explains why the synctex stuff is not working.
  5. Finally, run the synctex view command from a terminal as before.

@llinfeng
Copy link
Contributor Author

After launching the Neovim with nvim --clean -u min.vim min.tex, and following step 1-4, the log reads as the following log.

Detailed log
Rc files read:
  /etc/LatexMk
Latexmk: This is Latexmk, John Collins, 17 Mar. 2022. Version 4.77, version: 4.77.
======= Need to update make_preview_continuous for target files
Not using a previewer
------------
Running 'echo vimtex_compiler_callback_compiling'
------------
vimtex_compiler_callback_compiling
Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex': File changes, etc:
   Changed files, or newly in use since previous run(s):
  min.tex
Rule 'pdflatex': The following rules & subrules became out-of-date:
  pdflatex
------------
Run number 1 of rule 'pdflatex'
------------
------------
Running 'pdflatex  -file-line-error -synctex=1 -interaction=nonstopmode -recorder  "min.tex"'
------------
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (MiKTeX 22.1) (preloaded format=pdflatex.fmt)
 restricted \write18 enabled.
entering extended mode
(min.tex
LaTeX2e <2021-11-15> patch level 1
L3 programming layer <2022-05-04>
(/home/username/.miktex/texmfs/install/tex/latex/base/minimal.cls
Document Class: minimal 2001/05/25 Standard LaTeX minimal class
)
(/home/username/.miktex/texmfs/install/tex/latex/l3backend/l3backend-pdftex.def
)
 (min.aux)
 [1
{/home/username/.miktex/texmfs/data/fonts/map/pdftex/pdftex.map
}
]
 [2
]
 [3
]
 [4
]
 (min.aux)
 )<
/home/username/.miktex/texmfs/install/fonts/type1/publ
ic/amsfonts/cm/cmr10.pfb
>
Output written on min.pdf (4 pages, 17206 bytes).
SyncTeX written on min.synctex.gz.

Transcript written on min.log.
Latexmk: Getting log file 'min.log'
Latexmk: Examining 'min.fls'
Latexmk: Examining 'min.log'
Latexmk: Log file says output to 'min.pdf'
Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex': File changes, etc:
   Changed files, or newly in use since previous run(s):
  min.aux
Rule 'pdflatex': The following rules & subrules became out-of-date:
  pdflatex
------------
Run number 2 of rule 'pdflatex'
------------
------------
Running 'pdflatex  -file-line-error -synctex=1 -interaction=nonstopmode -recorder  "min.tex"'
------------
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (MiKTeX 22.1) (preloaded format=pdflatex.fmt)
 restricted \write18 enabled.
entering extended mode
(min.tex
LaTeX2e <2021-11-15> patch level 1
L3 programming layer <2022-05-04>
(/home/username/.miktex/texmfs/install/tex/latex/base/minimal.cls
Document Class: minimal 2001/05/25 Standard LaTeX minimal class
)
(/home/username/.miktex/texmfs/install/tex/latex/l3backend/l3backend-pdftex.def
)
 (min.aux
)
 [1
{/home/username/.miktex/texmfs/data/fonts/map/pdftex/pdftex.map
}
]
 [2
]
 [3
]
 [4
]
 (min.aux
)
 )<
/home/username/.miktex/texmfs/install/fonts/type1/publ
ic/amsfonts/cm/cmr10.pfb
>
Output written on min.pdf (4 pages, 17206 bytes).
SyncTeX written on min.synctex.gz.

Transcript written on min.log.
Latexmk: Getting log file 'min.log'
Latexmk: Examining 'min.fls'
Latexmk: Examining 'min.log'
Latexmk: Log file says output to 'min.pdf'
Latexmk: All targets (min.pdf) are up-to-date
------------
Running 'echo vimtex_compiler_callback_success'
------------
vimtex_compiler_callback_success

In /etc/LatexMk, I see two lines:

$pdf_previewer     = 'start xpdf';
$pdf_update_method = 1;

And, with synctex view -i 9:1:'min.tex' -o min.pdf issued in the test directory, Zathura jumps to page 1, and I found the following from the console:

This is SyncTeX command line utility, version 1.5
SyncTeX Warning: No tag for min.tex

In case the contents in the min.synctex.gz file are relevant, I fold them here. And, the test folder can be found here on Dropbox.

Contents of `min.synctex.gz`
SyncTeX Version:1
Input:1:/home/username/tmp/test_folder/min.tex
Input:2:/home/username/.miktex/texmfs/install/tex/latex/base/minimal.cls
Input:3:/home/username/.miktex/texmfs/install/tex/latex/l3backend/l3backend-pdftex.def
Input:4:/home/username/tmp/test_folder/min.aux
Output:pdf
Magnification:1000
Unit:1
X Offset:0
Y Offset:0
Content:
!340
{1
[1,4:4736286,42626579:30785863,37890293,0
[1,4:4736286,42626579:30785863,37890293,0
[1,4:4736286,4736286:30785863,0,0
(1,4:4736286,4736286:30785863,0,0
h1,4:4736286,4736286:30785863,0,0
)
]
[1,4:4736286,42626579:30785863,37890293,0
(1,4:4736286,5391646:30785863,455111,0
h1,3:4736286,5391646:1310720,0,0
x1,3:7521569,5391646
g1,3:7740022,5391646
x1,3:8213338,5391646
x1,3:9507677,5391646
g1,3:9798948,5391646
x1,3:11018649,5391646
g1,3:11237102,5391646
x1,3:12660692,5391646
g1,3:12879145,5391646
x1,3:14300915,5391646
g1,3:14519368,5391646
x1,3:15848296,5391646
k1,4:35522148,5391646:19673852
g1,4:35522148,5391646
)
]
(1,4:4736286,42626579:30785863,0,0
h1,4:4736286,42626579:30785863,0,0
)
]
]
!704
}1
!8
{2
[1,6:4736286,42626579:30785863,37890293,0
[1,6:4736286,42626579:30785863,37890293,0
[1,6:4736286,4736286:30785863,0,0
(1,6:4736286,4736286:30785863,0,0
h1,6:4736286,4736286:30785863,0,0
)
]
[1,6:4736286,42626579:30785863,37890293,0
(1,6:4736286,5391646:30785863,455111,0
h1,5:4736286,5391646:1310720,0,0
x1,5:7521569,5391646
g1,5:7740022,5391646
x1,5:8213338,5391646
x1,5:9507677,5391646
k1,6:35522149,5391646:26014472
g1,6:35522149,5391646
)
]
(1,6:4736286,42626579:30785863,0,0
h1,6:4736286,42626579:30785863,0,0
)
]
]
!527
}2
!8
{3
[1,8:4736286,42626579:30785863,37890293,0
[1,8:4736286,42626579:30785863,37890293,0
[1,8:4736286,4736286:30785863,0,0
(1,8:4736286,4736286:30785863,0,0
h1,8:4736286,4736286:30785863,0,0
)
]
[1,8:4736286,42626579:30785863,37890293,0
(1,8:4736286,5391646:30785863,447828,127431
h1,7:4736286,5391646:1310720,0,0
x1,7:6493016,5391646
x1,7:7421444,5391646
g1,7:7639897,5391646
x1,7:7967578,5391646
k1,8:35522150,5391646:27554572
g1,8:35522150,5391646
)
]
(1,8:4736286,42626579:30785863,0,0
h1,8:4736286,42626579:30785863,0,0
)
]
]
!532
}3
!8
{4
[1,10:4736286,42626579:30785863,37890293,0
[1,10:4736286,42626579:30785863,37890293,0
[1,10:4736286,4736286:30785863,0,0
(1,10:4736286,4736286:30785863,0,0
h1,10:4736286,4736286:30785863,0,0
)
]
[1,10:4736286,42626579:30785863,37890293,0
(1,10:4736286,5391646:30785863,447828,127431
h1,9:4736286,5391646:1310720,0,0
x1,9:6493016,5391646
x1,9:7421444,5391646
g1,9:7639897,5391646
x1,9:7967578,5391646
k1,10:35522150,5391646:27554572
g1,10:35522150,5391646
)
]
(1,10:4736286,42626579:30785863,0,0
h1,10:4736286,42626579:30785863,0,0
)
]
]
!543
}4
Input:5:/home/username/tmp/test_folder/min.aux
!55
Postamble:
Count:101
!25
Post scriptum:

@lervag
Copy link
Owner

lervag commented May 18, 2022

Thanks for the new input and for your test files. I've inspected the synctex files, and I notice that they do look different on my end. That is, if we gunzip the synctex files and compare yours to mine, I notice difference similar to this:

-Input:1:/home/lervag/test/min.tex
+Input:1:/home/lervag/test/./min.tex

With further testing, I notice that, with your style, synctex only works when the source file is specified with a full path. I.e., I believe things should work on your end if you do this:

synctex view -i 9:1:/home/username/tmp/test_folder/min.tex -o min.pdf

Could you check?


I also notice that there is a related open issue: #2377. I believe this is the same issue. My guess is that it has to do with some of the tool versions. Perhaps the pdflatex version. In any case, I believe the fix is to use the full path as suggested by @GianCarloMilanese, but I'll await your confirmation on the test first.

@lervag
Copy link
Owner

lervag commented May 18, 2022

I believe my latest commit fixes the issue. Can you test?

@llinfeng
Copy link
Contributor Author

llinfeng commented May 18, 2022

Tested and Confirmed. It looks like the following one-liner in init.vim does the trick single-handedly. Thanks a lot for all the backend works that make it possible! The same config also works for vim 8.2.

let g:vimtex_view_method = 'zathura'

Just a few more notes:

  • If one reuses the part of VimTeX settings across Windows and Linux machines, at least for the Viewer settings, it needs to be separated by OS. Here is what I use that got both Gvim+Sumatra to work on Windows, and Neovim/vim+ Zathura on Linux:

    VimTeX config for Win + Linux
    " Config the viewer
    if has("gui_running") && has("win32")
        " Source: https://github.com/lervag/vimtex/issues/1585
            " Caveat - for multi-file projects, even with a trusty main.latexmain
            " file, backward search may break by showing an empty buffer produced by
            " incorrect path config. This has to do with how Gvim is launched on
            " Windows, but I don't have a good solution at this point.
    
        " According to the help file, need to first declare view_method as 'general'
        let g:vimtex_view_method = 'general'
        " This have costed quite a while: need to enable View in the first place.
        let g:vimtex_view_enabled = 1
        " Forward search
        let g:vimtex_view_general_viewer = 'SumatraPDF'
        " let g:vimtex_view_general_options_latexmk = '-reuse-instance'
        let g:vimtex_view_general_options
                        \ = '-reuse-instance -forward-search @tex @line @pdf'
                        \ . ' -inverse-search "gvim --servername ' . v:servername
                        \ . ' --remote-send \"^<C-\^>^<C-n^>'
                        \ . ':drop \%f^<CR^>:\%l^<CR^>:normal\! zzzv^<CR^>'
                        \ . ':execute ''drop '' . fnameescape(''\%f'')^<CR^>'
                        \ . ':\%l^<CR^>:normal\! zzzv^<CR^>'
                        \ . ':call remote_foreground('''.v:servername.''')^<CR^>^<CR^>\""'
    endif
    if has('nvim')
        let g:vimtex_view_method = 'zathura'
    endif
  • And, forward search may fail on the second attempt and beyond with an existing Zathura window, when there is a buggy synctex.gz file from previous compilation. Then, :VimtexClean + \ll will restore the ideal forward and backward search ability.

@lervag
Copy link
Owner

lervag commented May 18, 2022

Tested and Confirmed.

Great, glad to hear it!

  • If one reuses the part of VimTeX settings across Windows and Linux machines, at least for the Viewer settings, it needs to be separated by OS.

Yes, that is true. However, the configuration you use for Windows are not really good. On Windows, you would typically not need to specify any viewer settings, because the defaults should work fine if you use SumatraPDF. Please read :help vimtex-view-sumatrapdf. You are probably also interested in the hints on how to get inverse search working.

Essentially, I would suggest the following, much simpler, OS dependent configuration:

if has('nvim') && !has("win32")
  let g:vimtex_view_method = 'zathura'
endif
  • And, forward search may fail on the second attempt and beyond with an existing Zathura window, when there is a buggy synctex.gz file from previous compilation. Then, :VimtexClean + \ll will restore the ideal forward and backward search ability.

Notice that :VimtexClean is mapped to \lc by default. Also, I have never had this experience myself...

@llinfeng
Copy link
Contributor Author

Thanks a lot for clarifying that a setup on Windows with SumatraPDF doesn't need those explicit settings anymore. This is such a relief!

Just to make sure I don't fool myself in the future - to best assist VimTeX's internal :VimtexView command, should I use VimTeX to compile the document as well? Or, it won't make a difference compared to directly calling latexmk from the console? Mainly, I've been using Tmux to organize both the compilation task and the editing task, where latexmk runs in a separate pane by itself. And, I've been using the following alias to run the job:

alias lmk='latexmk -pvc -pdf --synctex=1 -src-specials -silent -time -interaction=nonstopmode'

@lervag
Copy link
Owner

lervag commented May 19, 2022

Thanks a lot for clarifying that a setup on Windows with SumatraPDF doesn't need those explicit settings anymore. This is such a relief!

My pleasure :)

Just to make sure I don't fool myself in the future - to best assist VimTeX's internal :VimtexView command, should I use VimTeX to compile the document as well?

I would say "yes and no". If you know what you are doing, you can safely compile without VimTeX. The benefit of doing it from VimTeX is that VimTeX can ensure that things work well together. In particular, it passes the right options to latexmk and adds callbacks to get notifications on compile status inside VimTeX. It also ensures the viewer is started "properly". For Zathura, it means to start Zathura with the correct backward sync settings. But you can manually configure this in your zathura config as well, or you can specify things in your .latexmkrc file to make latexmk "do the right thing".

But, of course, VimTeX essentially runs more or less the same latexmk command that you are already using, and so it is safe to do this in a terminal. I would add the option -file-line-error to make it easier for VimTeX to parse the error output. Except for that, I think you should be more or less safe compiling the way you are already doing it:

latexmk -pvc -pdf --synctex=1 -src-specials -silent -time -interaction=nonstopmode -file-line-error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants