Being able to go from a line in WinEdt to the corresponding place in a compiled document is extremely useful and saves a lot of time. This has long been possible using Yap with dvi documents, but Yap is slow and ugly and the dvi files usually have to be converted to pdf before sending them to anyone else.
So I tend to use pdftexify to create pdf files directly, but I miss having synchronization between what I write and the pdf file that is created.
However, I’ve found a solution that is not too difficult to implement and seems to work well. It replaces the Adobe pdf reader with SumatraPDF. There is some fiddling of settings in WinEdt as explained in the instructions below. The information below is adapted from William Blum’s website.
- Download SumatraPDF and install it to the (default) directory
c:\Program files\SumatraPDF - For Winedt 6.0
Run WinEdt and go to Options/Execution Modes. Click on the “PDF Viewer” tab and click the “Sumatra PDF” button. Make sure the box under “Sync Tex” is ticked. Then click “OK”. That’s it! - For Winedt 5.6.
- Download Acrobat OpenDoc.edt and Sumatra-Find.edt and save them to
C:\Program Files\WinEdt Team\WinEdt\Exec - Run WinEdt and go to Options/Execution Modes. Click on the “Acrobat” tab and replace the path to the “PDF Viewer Executable” with
"C:\Program files\SumatraPDF\SumatraPDF.exe" -reuse-instance. Like this:
- Before closing the dialog box, go to the “Console Applications” tab and select “PDFTexify”. Change the switches field to
--pdf --tex-option=--synctex=-1
Similarly, for PDFLaTeX and PDFTeX, change the switches fields to--synctex=-1Then click “OK”. - In WinEdt, go to the menu ‘Option/Menu setup’. Create a new macro menu somewhere (under ‘Accessories’ for instance) and fill the options as follows:
- Name:
Sumatra FindMacro:Exe('%b\Exec\Sumatra-Find.edt');Requires File Filter:
%P\%N.pdfStart in:
%PShortcut:
Shift-F8Now when editing a .tex file in WinEdt, you can go to the corresponding line in the pdf document by pressing Shift-F8.
- Download Acrobat OpenDoc.edt and Sumatra-Find.edt and save them to
Update
- The above instructions only work with MikTeX (tested on MikTeX 2.7 and 2.8). If you use TeXLive, or some other LaTeX implementation, then you will need to figure it out for yourself.
- You should not use the
pdfsyncpackage. - Some people have reported trouble with beamer. I have had no difficulties using beamer with the above settings.
- The above instructions have now been updated (8 Sep 2009) to take account of all comments below.

#1 by George on 30 July 2009 - 2:29 pm
Quote
It has worked perfectly well. Thank you.
#2 by Prof. György SZEIDL on 31 July 2009 - 6:48 pm
Quote
the forward search does not work.
my winedt directory is
c:\winedt56
i have modified the line
“C:\Program Files\WinEdt Team\WinEdt\winedt.exe” “[Open(|%f|);SelPar(%l,8)]”
accordingly to
“C:\WinEdt56\winedt.exe” “[Open(|%f|);SelPar(%l,8)]”
and put the macro Sumatra-Find.edt into the directory
“C:\WinEdt56\exec
i get the error message unknown macro: Forward Search.
the inverse search works perfectly.
best regards
g. szeidl
#3 by y. calleecharan on 31 July 2009 - 10:59 pm
Quote
Thanks. Pressing F8 opens up the document to the page at which the document was browsed to after compilation. What am I doing wrong?
F8 is not opening at the corresponding line.
Best Regards
Y.Calleecharan
#4 by y.calleecharan on 31 July 2009 - 11:58 pm
Quote
Hello again,
Sorry about my earlier post. It works fine. I lost sight of the forest because of all the trees. I forgot to put \usepackage{pdfsync} in the preamble. Both forward and inverse search features seem to work fine.
Best Regards,
Y.Calleecharan
#5 by Rob J Hyndman on 1 August 2009 - 3:48 pm
Quote
To Y. Calleecharan: I think the problem is that you are using TeXLive rather than MikTeX. I have only tested the instructions with MikTeX 2.7. TeXLive does not have a texify command.
#6 by y.calleecharan on 2 August 2009 - 2:35 am
Quote
Thanks. Yes indeed I’m using TeXLive. Alex from WinEdt also explained about the texify issue. I’m now just using –synctex=-1 (without putting the pdf before) everywhere for PDFTeX, PDFLaTeX, TeXify and PDFTeXify. Now I get a .synctex file at last. And I don’t need the pdfsync package. The forward search seems to go to a position with 2–3 lines earlier to where it is supposed to point. But I can live with that. So it’s working fine now with TeXLive 2008.
I have one question. Maybe you would be kind to help here:
Starting after a clean build, every time I press F8 the Sumatra window pops up maximized at the corresponding line entry (without I need to close the PDF viewer each time). I found that if I made an inverse search, then tries forward search again then the sumatra window is not maximzed as before. But of course still, sumatra is going to the right line in the PDF file. Closing the PDF window after an inverse search resets things to normal.
Is there a way by modifying the macro parameters to every time force the sumatra window to get maximized on screen when pressing F8? Or something like closing Sumatra first and then opening it again.
One more issue: I was surprised to see that when I click on a reference entry in the bibliography at the end of the PDF document, it opens up the .bbl bibliography file at the corresponding entry. Well, is it possible to open the .bib file instead of the .bbl file? This would indeed be very convenient if changes have to be made in the .bib file.
Thanks a lot
#7 by Rob J Hyndman on 13 September 2009 - 11:22 pm
Quote
1. For TeXLive there is no pdftexify so it doesn’t matter what switches you include. For pdftex and pdflatex you need
--synctex=-1.2. I think you probably mean that the sumatra window is not in focus (i.e., on top). By default, it remains hidden behind your WinEdt window. To change this, you need to modify the file Sumatra-Find.edt. Go to line 38 and change to the following:
DDEExe('[ForwardSearch("%P%N.pdf","%q%n%t",%!l,0,0,1)]');>The only change here is the last digit is changed from 0 to 1.
3. I don’t think it is possible to create links to the bib file(s). The way BibTeX works is that the bbl file is first created, and this is used when constructing the pdf file. So any links back to the bib files are not available.
#8 by y. calleecharan on 2 August 2009 - 7:36 pm
Quote
Thanks for your very prompt reply. I’ll answer according to your numbered answers:
1. Yes, you’re right. TeXLive is different.
2. Thanks a lot. With the change that you specified, it now works perfectly i.e. the Sumatra window can be brought at any time on the top.
3. No worries for this one. I’m just becoming lazy and want everything to do in the minimal time
.
Again, many sincere thanks for your kind help in taking time to help others. The forward– and inverse-search is indeed a big time saver. I never could make it work with Adobe Acrobat.
#9 by y. calleecharan on 2 August 2009 - 7:48 pm
Quote
Just a comment: In the instructions listed, I found that on my machine doing step 3 or a combination of steps 3 & 4 without doing step 2 will automatically brings the required changes in Sumatra regarding the path of WinEdt in Sumatra as being done in Step 2.
#10 by Christian on 7 September 2009 - 7:30 pm
Quote
Thank you for these detailed instructions. It works with my installation of WinEdt 5.5 / MikTeX 2.7 and the latest official release of SumatraPDF (0.9.4) from its official website. Seems that the special version specified in step 1 is no longer required.
There is, however, one more thing to consider with WinEdt. When the option “Start viewer” is active in one of the execution modes (step 4), for example in PDFTeXify, then the Adobe Reader will be launched on top of SumatraPDF. To avoid this behaviour, one should consider replacing the macro “Acrobat OpenDoc.edt” by an updated version:
“http://www.winedt.org/temp/Acrobat OpenDoc.edt”
Best regards -
Christian
#11 by Rob J Hyndman on 7 September 2009 - 7:58 pm
Quote
Thanks Christian. The instructions have been amended accordingly.
#12 by Jan on 7 September 2009 - 9:52 pm
Quote
Thanks Rob and Christian. The synchronization is working nicely.
As mentioned by Christian, with the latest version of SumatraPDF (beta 0.9.4) step 2 is not necessary anymore.
Best regards,
Jan
#13 by Rob J Hyndman on 8 September 2009 - 9:59 am
Quote
Thanks Jan. I’ve deleted the old step 2 (and subsequent steps are now renumbered).
#14 by pedalracer@googlemail.com on 13 September 2009 - 8:45 pm
Quote
Hi
great that Rob updates infos here. I knew about Blum’ site but lot of old infos are confusing there.
My question is, cause I do not understand the varibales in the macro, whether I can install summatra somwhere else?
I need it in \B: in my WinEdt program directory.
thanks alot!
#15 by Rob J Hyndman on 13 September 2009 - 8:51 pm
Quote
You can install SumatraPDF wherever you like, so long as the directory is correctly specified in Step 3. The Sumatra-Find.edt macro will find SumatraPDF using the location specified in Step 3.
#16 by pedalracer@googlemail.com on 14 September 2009 - 1:25 am
Quote
Thank you very much Rob.
I got it now running partly. Forward search by hitting F8 in WinEdt works more or less. It aims a bit besides.
But inverse or backward search is more importan for me and is not working. It seems to work on the first page but on page 2, 3, 4 etc. it isnt no more.
I write a paper with a known structure of projects that is like this.
+ main dir
–project file.tex
+ subdir
–chapter1
–chapter2
I use the include cmd, since I read that input is no good.
%\input{content/1-firstchapter.tex}
Bingo, I realized that you have NOT to use the “search forward” option under console applications! I think it is good to mention in your FAQ that users should backup their settings and then before they start editing the above content they press the button to set DEFAULT settings
#17 by pedalracer@googlemail.com on 14 September 2009 - 8:03 pm
Quote
Hello Rob
I got it now working and am very happy.
I want to ask you whether you want to publish an article on W. Blum’s
LatexDaemon.
There is so less information on it on the web despite it is such a great tool, when you can get it to run.
best regards
#18 by Rob J Hyndman on 14 September 2009 - 8:08 pm
Quote
Good to know it’s working for you. Thanks for the pointer to LaTeXDaemon — I’ll add it to my list of things to cover.
#19 by Pedro on 24 September 2009 - 10:14 pm
Quote
Hello Rob
Thanks! Works great, except in one situation.
If I call “Sumatra Find” when the pdf file is not already open in Sumatra, WinEdt hangs (busy for ever). I looked at the edt file but I am not sure how to test for this situation and open the file in Sumatra automatically.
I am using WinEdt 5.6 Beta and MikTeX 2.8 on Vista SP 2.
Very nice and useful blog, by the way. I am an agronomist turned biologist and use both LaTeX and R regularly, and find your blog and insights very useful.
#20 by Ziv Ran on 29 September 2009 - 7:19 am
Quote
Thanks! It works perfectly (with MikTex 2.7). SO good to get
away from Yap.
The only slight improvement I can suggest is to make Windows focus on the Sumatra window
#21 by pedalracer on 30 September 2009 - 10:21 pm
Quote
Hello
It stopped working for me. Even forward search is no longer doing its job. All looks as it looks in this guide.
I wonder if there is something else important. I must ask what option is given under options/execution mode/tex options and there under
Tex auxiliary output folder?
Since I have my project structured in subfolders I assume that there is the culprit.
What I have is that I got the project.synctex with the project.pdf but Sumatra can’t use it for forward or inverse search. So I think that it may be linked to the fact that I have my chapters in the subdir \chapters\ ?!?
#22 by Rob J Hyndman on 1 October 2009 - 10:24 am
Quote
I haven’t tested it using subfolders. On my system, I’m using %P as the auxiliary output folder.
#23 by pedalman on 1 October 2009 - 8:26 pm
Quote
Dear Rob
thank you for the information on the aux output folder. I reinstalled my Winedt on another machine in order to check what the default setting is there. However, I changed it to %P by checking the button in the options.
Unluckily, it is not working. I deleted all working files (aux etc.) and so on but I Sumatra is saying that
There is no syncronisation info at this point.…. !?!
What a pity, since there is after each PdfLatex run a thesis.synctex. So, for some reasons Sumatra is not taking this into account. However, I implemented the Sumatra.edt macro and it once worked.
Maybe, there is a link to MikTex 2.8x?
#24 by Rob J Hyndman on 1 October 2009 - 8:34 pm
Quote
I don’t think I can help further. I now have it working on three computers, all with MikTeX 2.8 and SumatraPDF v0.9.4beta. It was previously working fine with MikTex 2.7 and SumatraPDF v0.9.3. The subfolders could still be your problem.
#25 by pedalman on 1 October 2009 - 8:39 pm
Quote
Ok,
thanks in advance for your patience. The good news are I found the problem and solved it!!
I think this will be helpful for others too.
I had to change all calls for any .tex fils from my project main file into XYZ.tex from originally XYZ without tex.
So in my case it has to look like.
\input{preambel/settings.tex}
\input{preambel/preambel.tex}
\input{macros/newcommands.tex}
\input{macros/TableCommands.tex}
\input{preambel/Hyphenation.tex}
Note the file endings when using input
cheers
#26 by Rob J Hyndman on 1 October 2009 - 8:42 pm
Quote
\input is not usually recommended. The preferred method is \include{}. You might find it works better with \include{}.
Pingback: Converting eps to pdf | Research tips
#27 by Lars Relund on 6 October 2009 - 1:06 am
Quote
Hi Rob
After some work I got it to work. I had to
1) change to DDEExe(‘[ForwardSearch(“%P\%N.pdf”,”%p%n%t”,%!l,0,0,0)]’);> line in Sumatra-Find.edt to DDEExe(‘[ForwardSearch(“%P\%N.pdf”,”%n%t”,%!l,0,0,0)]’);>
2) Moreover, inverse search did not work before installing William Blum’s own version of Sumatra pdf. Here you can set the commandline of inverse search. My problem was that it looked in the ‘Program Files’ folder. Mine is named ‘Programmer’ instead (Danish WinXP version).
cheers
#28 by Marc on 31 October 2009 - 8:25 pm
Quote
Thanks a lot for the detailed instructions!
Forward search works fine hitting F8, but not when clicking the PDFTexify button. Do you know of a way to also enable forward search with PDFTexify?
Inverse search works too, but only for the first two lines of a section. I guess this behavior is caused by me using soft word wrapping in WinEdt. For inverse search to work as expected one should probably resort to smart wrapping.
#29 by Cris on 16 November 2009 - 10:34 pm
Quote
I followed ypur pocedure and everything works well. The only problem that I have is with the shortkey F8. When I use it the Sumatra-Find.edt file is open and the following phase is highlighted
Run(‘%$(“AcroRead”); –reuse-instance –inverse-search “\”%B\WinEdt.exe\”
What is the trouble?
Thanks Cristina
#30 by Myriam on 3 December 2009 - 8:58 pm
Quote
Hello!
I’m having troubles with the forward search. I did all the steps but when i am hitting the F8 key, I get an warning message saying:
Keyword expected
^^^ ÿþ/
and then nothing happen…
Any idea what could it be?
Also 2 files open with sumatra when pushing the Textify button… Is that normal?
Thanks for the help.
#31 by Rob J Hyndman on 3 December 2009 - 10:33 pm
Quote
Both problems sound odd. I haven’t seen them before. Make sure you’re using WinEdt 5.6 and MikTeX 2.8. Otherwise I don’t know what the problems could be.
#32 by Peter on 11 February 2010 - 3:32 am
Quote
Hi,
Thank you very much for sharing this information. It works perfectly fine for me. I though have a question : why SumatraPDF ? Does it work with Acrobat Reader ?
Best regards
#33 by Rob J Hyndman on 11 February 2010 - 8:03 am
Quote
No, it doesn’t work with Acrobat Reader. SumatraPDF allows the pdf file to be changed externally while it is still loaded.
#34 by Phillip Li on 1 March 2010 - 8:06 am
Quote
Hi Rob,
Thanks for the informative blog.
I followed the instructions exactly and got it to work almost perfectly. When I press F8, the entire paragraph gets highlighted in SumtraPDF instead of the line. Is this normal?
I’m using Winedt Build: 20071003 (v. 5.5) and SumtraPDF V1.0.1.
Any ideas? Thanks a lot
#35 by Rob J Hyndman on 1 March 2010 - 4:49 pm
Quote
Yes, that is normal. The sync markers are only done at paragraph level, not at line level.
#36 by Shane on 9 March 2010 - 11:22 am
Quote
This is an excellent tutorial! Thanks for putting it up, its really helped me out!
#37 by Hans on 21 April 2010 - 8:11 pm
Quote
I am using Winedt 6 + Miktex 2.8.
I have the problem that the Sumatra pdf does not update after a new PDF has been created and Sumatra has been invoked with forward search.
Even with Shift+F8 (which will invoke the forward search), the forward search displays the correct location, but the document stays the same. The only possiblity to get Sumatra to show the new document is to close it or press “r” for reload.
Is there a possiblity to have Winedt make Sumatra automatically reload the document before invoking forward search?
#38 by Hans on 21 April 2010 - 8:34 pm
Quote
I have found the error: The file was on a network drive!
Sumatra does not refresh in this case. Solution is to copy it to the internal harddisk.
Pingback: Winedt 6, y búsqueda inversa en Pdfs. « Wordpress.mat.uah.es Blogs
#39 by Yuval on 2 May 2010 - 4:30 am
Quote
Will this sumatraPDF solution admit forward search also from file1.tex file2.tex etc that are attached to the main file with \include{file1} \include{file2}.
I can not do such forward search with the YAP dvi (Is there a way to do it ?)
So I may have two reasons to try your solution
I use WinEDT 5.6 Miktex 2.7–2.8 Windows XP and Vista
#40 by Rob J Hyndman on 2 May 2010 - 3:42 pm
Quote
Yes, I’ve just tried with WinEdt 5.6 using a file with several \include{}s and it worked fine.
#41 by Yuval on 2 May 2010 - 8:39 pm
Quote
Sounds good.
Can I assume the dvi and SumatraPDF forward/backward searches will live happily side by side?
(For small projects I expect to still prefer what seems to be a more accurate pointing of the yap)
Thank you for your prompt response
#42 by Rob J Hyndman on 2 May 2010 - 9:46 pm
Quote
Yes, they both work. Double click to get from either yap or SumatraPDF back to the relevant line in WinEdt. To go the other way, use Shift-F8 for pdf and Ctrl-Shift-S for dvi.
#43 by Yuval on 3 May 2010 - 5:30 am
Quote
I went through the installation.
Reversed search works fine. Direct search does not. More precisely, direct search works well from the main file but not
from any of the include files. In other words, both YAP and the Sumatra can not do a direct search from any of the include files. On a second thought it kind of “makes sense” . The dvi search buttons are not highlighted in the files that were compiled by the main file through \include{} commands. So they do not “know” they became part of the big DVI or big SumatraPDF file. What did I miss? It seems that the direct search might work only if Miktex (I used the V2.8) has a way to tell the included files that they were actually “latextified”.
Hope I do not burden you with a too difficult question.
I can of course default to pouring all the files into the main file
if there is no solution.
Thanks
#44 by Rob J Hyndman on 3 May 2010 - 2:35 pm
Quote
You do need to set the main file as the “main file” in WinEdt. Then it should work fine.
#45 by Lily on 8 June 2010 - 3:10 am
Quote
I am using WinEdt 6.0 and MikTeX 2.8 on Vista. After I downloaded Sumatrapdf reader, I went to Options/Execution Modes/PDFViewer following your instruction, but the tab for Sumatra PDF is in shadow and does not respond when I click on it. It seems that WinEdt cannot detect Sumatrapdf reader.
After I manually changed the Pdf View Executable to D:\Program Files\Sumatrapdf, it indeed worked for the direct and inverse search which is great. But some other packages like hyperref don’t work.
Any comment will be appreciated. Thanks
#46 by Rob J Hyndman on 8 June 2010 - 9:36 am
Quote
Strange. I have the same combination (but on Windows 7) and it works for me. Make sure you have Sumatrapdf v1.1 and that it is installed in the default directory.
Pingback: Sweave under Windows – Pedro J. Aphalo's web pages and blog
#47 by Fernando Nadal on 28 July 2010 - 6:05 pm
Quote
Hello,
I have MiKTeX 2.7 and WinEdt 6 running on my PC. I work with PDF files (PDFLaTeX). My TeX sources are organized in folders and subfolders and I use the \import{}{} LaTeX command to include them (I think it has better nested folder support than \include or \input).
PDF (Forward) Search doesn’t work because can’t find source TeX files located on subfolders. I have changed 1 line of PDF Search.edt and now it works for me:
On the :Sumatra_Running:: section change this:
DDEExe(‘[ForwardSearch(“%P\%N.pdf”,”%q%n%t”,%!l,0)]’);
with this:
DDEExe(‘[ForwardSearch(“%P\%N.pdf”,”%p\%n%t”,%!l,0)]’);
The change, %p\%n%t, gets the absolute path of the file, that’s all.
I hope this can help some one else.