Not logged in. Log in with Twitter

Sumatra PDF Reader forum

Small, fast, free PDF, EPUB, MOBI, CHM, DJVU, CBR, CBZ reader for Windows

Forward search from Vim to sumatrapdf

I only found from internet that is about forward search with Vim if latex-suite is used in Vim. However, I don't use latex-suite but still want to access forward search from Vim. So I was trying to hack the code from to figure out how forward search is implemented. I tried to issue the following command in a Vim window where a tex file is loaded and the corresponding PDF file is displayed in a sumatraPDF window.

c:\Bin\Python27\python.exe C:\fwdsumatra\ disttabs.pdf disttabs.tex line(".")

I got the following error message:

Traceback (most recent call last):
File "C:\fwdsumatra\", line 12, in <module>
import dde
ImportError: This must be an MFC application - try loading win32ui first

I don't quite understand the error message as I am new to python. I also tried

c:\Bin\Python27\pythonw.exe C:\fwdsumatra\ disttabs.pdf disttabs.tex line(".")

But this command produces nothing.

Can anyone help me solve the errors? Or what are the simply ways to invoke forward search for sumatra pdf? I am novice to DDE stuff. Thanks for help.
Paul on November 2, 2011
It turns out that the message I received is due to a bug in Python 2.7.2. Since Vim 7.3 was built on Python 2.7, I was suggested by to use Python 2.7.2 only, not Python 3.x. So I am stuck now. Before any solution is found, may I suggest that sumatraPDF include some command line arguments for forward search as a new feature? Just as Yap in MikTeX, to enable forward search, sumatraPDF just needs two arguments: -reuse and -line_number and it does not sound very difficult. Maybe I am too native.
Paul on November 8, 2011
Version 1.9 will allow to use forward search without a DDE client:

SumatraPDF.exe -reuse-instance filename.pdf -forward-search sourcefile.tex 123

(where 123 is the line number).
zeniko on November 8, 2011
Great! I can't wait to get v1.9. Thanks for the great software for latex community.
Paul on November 8, 2011
BTW: You should soon find a prerelease build including the new command line option at (version 1.9.4622 or later) for testing.
zeniko on November 8, 2011
Thanks for the information. I will download the prerelease version and give it a try.
Paul on November 15, 2011
This works for me only if I dont't use \include in my main file:

Does not work:
SumatraPDF.exe -reuse-instance main.pdf -forward-search main.tex 123

Does work:
SumatraPDF.exe -reuse-instance main.pdf -forward-search sub.tex 123

Am I doing something wrong or should I report a bug?

Matthis Thorade on December 7, 2011
I posted a simpler patch here:

I am not sure whether this would help if the main latex file includes child documents.
Ilya Grigoriev on November 10, 2014

Powered by fofou, created by Krzysztof Kowalczyk