2

I am using Vim 64 bit and have installed Vimtex on Windows 11. I can compile a LaTeX file and changes are shown in the pdf file, but typing \lv does not open my pdf viewer, SumatraPDF.

Here is part of my _vimrc file:

 let g:Tex_DefaultTargetFormat = 'pdf'
 let g:Tex_CompileRule_pdf = 'pdflatex -synctex=1 -interaction=nonstopmode $*'
 let g:Tex_ViewRule_pdf = 'SumatraPDF -reuse-instance' 

I have tried changing letg:Tex_ViewRule_pdf = 'C:\path\to\SumatraPDF -reuse-instance' and have added SumatraPDF to my PATH.

Here is my latexmk output when I run \lo

Win CP console initial and current in/out Win: (437, 437), (1252, 1252)
Coding system for system and terminal: 'CP1252'
---
Rc files read:
  NONE
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: Nothing to do for 'testing.tex'.
Latexmk: All targets (testing.pdf) are up-to-date
------------
Running 'echo vimtex_compiler_callback_success'
------------
vimtex_compiler_callback_success
Win CP console initial and current in/out Win: (437, 437), (1252, 1252)
Coding system for system and terminal: 'CP1252'
---

Thanks!

2
  • Welcome to Vi and Vim!
    – filbranden
    Jul 29, 2022 at 17:23
  • 1
    The settings you are discussing are not relevant to VimTeX. They are settings for LaTeX-Suite. Thus, changing these options will have no effect on VimTeX. Aug 2, 2022 at 6:50

1 Answer 1

3

Using Sumatra

Figured out what the problem was. I replaced everything I used before to:

"Only works if let g:vimtex_view_general_viewer= path\to\sumatrapdf.exe
let g:vimtex_view_general_viewer = 'C:\Users\Pranav\AppData\Local\SumatraPDF\SumatraPDF.exe'
let g:vimtex_view_general_options
                \ = '-reuse-instance -forward-search @tex @line @pdf'

To enable double click in the PDF to go to that spot in the LaTeX file:

  1. Go to Sumatra PDF --> Settings --> Options
  2. Paste cmd /c start /min "" vim -v --not-a-term -T dumb -c "VimtexInverseSearch %l '%f'" into Set inverse search command-line
  3. For more info, use the command :vimtex-synctex-inverse-search

Thanks to @Karl Yngve Lervåg for pointing out that my original settings worked for LaTeX-Suite and not Vimtex + showing where the documentation is!

6
  • 1
    The settings you are discussing are not relevant to VimTeX. They are settings for LaTeX-Suite. Thus, changing these options will have no effect on VimTeX. Aug 2, 2022 at 6:50
  • 1
    If you find that changing these options indeed have an effect, then you are clearly using LaTeX-Suite and not VimTeX. You should update your question and answer accordingly. Aug 2, 2022 at 6:51
  • Hi, I am using Vimtex. Maybe because I was using LaTeX-Suite settings it didn't work. Updating my answer to my current settings that work with Vimtex
    – Sony
    Aug 3, 2022 at 13:16
  • 1
    Ok, it is an improvement. But now you are using configuration you find in old issue threads (the last comment in issue 627 is from december 2016, which is more than 5 years ago now). What you want is to read the documentation where this is all explained! Please read :help vimtex-view-sumatrapdf. Aug 3, 2022 at 20:12
  • 2
    No problem; glad to help! Now it seems you're answer is quite good, so I'll upvote it :) Aug 4, 2022 at 7:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.