Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SyncTeX with SumatraPDF under miktex.

528 views
Skip to first unread message

Hongyi Zhao

unread,
Oct 15, 2008, 7:55:11 AM10/15/08
to
Dear all,

I learned form William's blog
(http://william.famille-blum.org/blog/index.php) that Most TeX
distributions (TeXLive and
MikTex) have now been updated to support SyncTeX.

Currently, I use the miktex-2.7.2960, who can give me some hints on how
to know whether the pdflatex in this miktex's version has the built-in
SyncTeX or not?

Regards,
--
Hongyi Zhao <hongy...@gmail.com>
Xinjiang Technical Institute of Physics and Chemistry
Chinese Academy of Sciences

Martin Heller

unread,
Oct 15, 2008, 7:57:32 AM10/15/08
to
Hongyi Zhao skrev:

> Dear all,
>
> I learned form William's blog
> (http://william.famille-blum.org/blog/index.php) that Most TeX
> distributions (TeXLive and
> MikTex) have now been updated to support SyncTeX.
>
> Currently, I use the miktex-2.7.2960, who can give me some hints on how
> to know whether the pdflatex in this miktex's version has the built-in
> SyncTeX or not?

MikTeX 2.7 supports SyncTeX. Use the -syntex flag.

pdflatex --help

-synctex=N Generate SyncTeX data for previewers if
nonzero.

Hongyi Zhao

unread,
Oct 15, 2008, 12:46:28 PM10/15/08
to

I've installed the latest miktex (miktex2.7.3164.0) and now I can use
this option, but when I use it with SumatraPDF, I meet the following
issues:

with forwards search, I will get the error "Erroo loading PDF file."
within the SumatraPDF viewer.

Then I opent the pdf with SumatraPDF viewer to do the inverse search, I
will meet the error: "Synchronization file cannot be opened".

Who can give me some hints on the above things?

Martin Heller

unread,
Oct 15, 2008, 8:44:59 PM10/15/08
to
Hongyi Zhao skrev:

> I've installed the latest miktex (miktex2.7.3164.0) and now I can use
> this option, but when I use it with SumatraPDF, I meet the following
> issues:
>
> with forwards search, I will get the error "Erroo loading PDF file."
> within the SumatraPDF viewer.
>
> Then I opent the pdf with SumatraPDF viewer to do the inverse search, I
> will meet the error: "Synchronization file cannot be opened".
>
> Who can give me some hints on the above things?

Describe exactly what you you are doing.
MikTeX+WinEdt+SyncTeX+Sumatra works on my PC.

Some guesses:

You need to use -synctex=-1 (not 1).
You are using some wrong DDE commands to call Sumatra.

Hongyi Zhao

unread,
Oct 16, 2008, 12:07:03 AM10/16/08
to
On Oct 16, 8:44 AM +0800, Martin Heller <mr_h...@yahoo.dk> wrote:
> Hongyi Zhao skrev:
>
>> I've installed the latest miktex (miktex2.7.3164.0) and now I can use
>> this option, but when I use it with SumatraPDF, I meet the following
>> issues:
>>
>> with forwards search, I will get the error "Erroo loading PDF file."
>> within the SumatraPDF viewer.
>>
>> Then I opent the pdf with SumatraPDF viewer to do the inverse search, I
>> will meet the error: "Synchronization file cannot be opened".
>>
>> Who can give me some hints on the above things?
>
> Describe exactly what you you are doing.
> MikTeX+WinEdt+SyncTeX+Sumatra works on my PC.

Let me describe what I've done in a more detailed version:

1- I install the latest MiKTeX 2.7.3164.0 including the complete packages.

2- I downloaded the following files:

http://william.famille-blum.org/software/sumatra/Sumatra-Find.edt
http://william.famille-blum.org/software/sumatra/SumatraPDF-sync.exe

3- I configure the SumatraPDF-sync.ext with WinEdt according to the
guidance by William Blum on his blog:
http://william.famille-blum.org/blog/index.php. In more detail, his
said that:

----------------
Configuring with WinEdt
For WinEdt, I have created a macro file to do all the stuff
automatically. To install it, proceed as follows:

1- Download the macro file Sumatra-Find.edt.
2- Save it in the folder: C:\Program Files\WinEdt Team\WinEdt\Exec\
3- Edit the file: goto line 22 and replace the string
'd:\Tools\SumatraPDF-sync.exe' by the path to your local copy of Sumatra.
4- 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 Find
Macro: Exe('%b\Exec\Sumatra-Find.edt');
Requires File Filter: %P\%N.pdf
Start in: %P
Shortcut: F8

That's it! Now you can just press F8 anywhere in your .tex sources files
and it will automatically locate the corresponding position in the PDF.
----------------

4- In my case, I just replace the string 'd:\Tools\SumatraPDF-sync.exe'
by the path to my local copy of Sumatra, i.e.,
F:\zhaohs\TeX-Fonts-CJK\add-ons\bin\SumatraPDF-sync.exe.

5- For WinEdt, I do the following change for pdflatex command:

From Options -- Execution Modes -- Console Applications -- PDFLaTeX,
add the "-synctex=1" to its Switchs command line options.

Is there something wrong in the above steps?

Martin Heller

unread,
Oct 16, 2008, 9:40:32 AM10/16/08
to
Hongyi Zhao skrev:

>
> http://william.famille-blum.org/software/sumatra/Sumatra-Find.edt


I use this line in WinEdt to open Sumatra from WinEdt:

Run('C:\Program Files\SumatraPDF\SumatraPDF-sync.exe
-reuse-instance -inverse-search "\"%B\WinEdt.exe\"
\"[Open(|%%f|);SelPar(%%l,8);]\""','%P');

> From Options -- Execution Modes -- Console Applications -- PDFLaTeX,
> add the "-synctex=1" to its Switchs command line options.

^^^

I think you should use
-synctex=-1
otherwise the synctex file will be gzipped and Sumatra does not
like that.

Hongyi Zhao

unread,
Oct 16, 2008, 11:16:58 AM10/16/08
to
On Oct 16, 9:40 PM +0800, Martin Heller <mr_h...@yahoo.dk> wrote:
> Hongyi Zhao skrev:
>
>> http://william.famille-blum.org/software/sumatra/Sumatra-Find.edt
>
>
> I use this line in WinEdt to open Sumatra from WinEdt:
>
> Run('C:\Program Files\SumatraPDF\SumatraPDF-sync.exe
> -reuse-instance -inverse-search "\"%B\WinEdt.exe\"
> \"[Open(|%%f|);SelPar(%%l,8);]\""','%P');

Do you mean, customize a macro within winedt like this:

---------------------
Menu Items: SumatraPDF-sync
Macro: Run('F:\zhaohs\TeX-Fonts-CJK\add-ons\bin\SumatraPDF-sync.exe

-reuse-instance -inverse-search "\"%B\WinEdt.exe\"
\"[Open(|%%f|);SelPar(%%l,8);]\""','%P');

Requires File Filter: %P\%N.pdf
Start in: %P

Shortcut: F4
---------------------

I've done the above thing, but the above settings only can open a blank
SumatraPDF viewer and no pdf file opened within it.

Why does this happen, what should I do?

>
>> From Options -- Execution Modes -- Console Applications -- PDFLaTeX,
>> add the "-synctex=1" to its Switchs command line options.
> ^^^
>
> I think you should use
> -synctex=-1
> otherwise the synctex file will be gzipped and Sumatra does not
> like that.

Thanks for this information. I've use this switch as "-1" now.

Hongyi Zhao

unread,
Oct 16, 2008, 11:53:19 AM10/16/08
to
On Oct 16, 9:40 PM +0800, Martin Heller <mr_h...@yahoo.dk> wrote:
> Hongyi Zhao skrev:
>
>> http://william.famille-blum.org/software/sumatra/Sumatra-Find.edt
>
>
> I use this line in WinEdt to open Sumatra from WinEdt:
>
> Run('C:\Program Files\SumatraPDF\SumatraPDF-sync.exe
> -reuse-instance -inverse-search "\"%B\WinEdt.exe\"
> \"[Open(|%%f|);SelPar(%%l,8);]\""','%P');

Now, I change the corresponding codes for invoking
Sumatra in the Sumatra-Find.edt according to the above codes supplied by
you. But I'll get the "Error loading pdf file" error. Why?

Hongyi Zhao

unread,
Oct 16, 2008, 11:55:14 PM10/16/08
to
On Oct 16, 11:53 PM +0800, Hongyi Zhao <hongy...@gmail.com> wrote:
> On Oct 16, 9:40 PM +0800, Martin Heller <mr_h...@yahoo.dk> wrote:
>> Hongyi Zhao skrev:
>>
>>> http://william.famille-blum.org/software/sumatra/Sumatra-Find.edt
>>
>>
>> I use this line in WinEdt to open Sumatra from WinEdt:
>>
>> Run('C:\Program Files\SumatraPDF\SumatraPDF-sync.exe
>> -reuse-instance -inverse-search "\"%B\WinEdt.exe\"
>> \"[Open(|%%f|);SelPar(%%l,8);]\""','%P');
>
> Now, I change the corresponding codes for invoking
> Sumatra in the Sumatra-Find.edt according to the above codes supplied by
> you. But I'll get the "Error loading pdf file" error. Why?

Now, I update the Sumatra to 0.9.3 and can open the pdf using Sumatra by
clicking the
Acrobat Reader button within winedt's menubar with the following two
files installed:

http://www.winedt.org/temp/Acrobat OpenDoc.edt
http://www.winedt.org/temp/Acrobat OpenDoc-Find.edt

But I still don't know how
can I make the forwards and inverse search work for me smoothly. I've
tried a lot and cann't
figured this issue out. Would you like give me some hints on this
once more? Thanks in advance.

Heiner Richter

unread,
Oct 17, 2008, 4:30:00 AM10/17/08
to
Hongyi Zhao schrieb:


Using

\usepackage{pdfsync}

in your tex-document and changing execution modes/acrobat (under winedt
options) to sumatra you have the features doubleclick from within
pdf-file or vice versa use F8 from within winedt

Hongyi Zhao

unread,
Oct 17, 2008, 6:10:37 AM10/17/08
to
On Oct 17, 4:30 PM +0800, Heiner Richter <heiner....@web.de> wrote:
[snip]
>
> Using
>
> \usepackage{pdfsync}

I've done.

>
> in your tex-document and changing execution modes/acrobat (under winedt
> options) to sumatra you have the features doubleclick from within
> pdf-file or vice versa use F8 from within winedt

I've done, but when I doubleclick from within
pdf-file, I get the error message like this: "No synchronization info at
this position". You can get the screenshot of this error message from
my ftp server: ftp://159.226.135.215/incoming/doubleclick_error.png

Furthmore, the F8 has been bound by me to a customized macro, and I
don't know from where can I customize a new shortcut for the above
operation.

Heiner Richter

unread,
Oct 17, 2008, 6:32:07 AM10/17/08
to
Hongyi Zhao schrieb:

> On Oct 17, 4:30 PM +0800, Heiner Richter <heiner....@web.de> wrote:
> [snip]
>>
>> Using
>>
>> \usepackage{pdfsync}
>
> I've done.
>
>>
>> in your tex-document and changing execution modes/acrobat (under
>> winedt options) to sumatra you have the features doubleclick from
>> within pdf-file or vice versa use F8 from within winedt
>
> I've done, but when I doubleclick from within
> pdf-file, I get the error message like this: "No synchronization info at
> this position". You can get the screenshot of this error message from
> my ftp server: ftp://159.226.135.215/incoming/doubleclick_error.png

Sometimes (clicking at the wrong place) i get this message too. Perhaps
you should start a new paragraph (or make a \section, a \subsection) an
doubleclick there at the subject or at the first line of the paragraph

Martin Heller

unread,
Oct 17, 2008, 6:58:51 AM10/17/08
to
Hongyi Zhao skrev:

>>>> http://william.famille-blum.org/software/sumatra/Sumatra-Find.edt
>>>
>>> I use this line in WinEdt to open Sumatra from WinEdt:
>>>
>>> Run('C:\Program Files\SumatraPDF\SumatraPDF-sync.exe
>>> -reuse-instance -inverse-search "\"%B\WinEdt.exe\"
>>> \"[Open(|%%f|);SelPar(%%l,8);]\""','%P');
>> Now, I change the corresponding codes for invoking
>> Sumatra in the Sumatra-Find.edt according to the above codes supplied by
>> you. But I'll get the "Error loading pdf file" error. Why?

I meant you should replace the line that opens Sumatra in
Sumatra-Find.edt with the single unwrapped line above.

> Now, I update the Sumatra to 0.9.3 and can open the pdf using Sumatra by
> clicking the
> Acrobat Reader button within winedt's menubar with the following two
> files installed:
>
> http://www.winedt.org/temp/Acrobat OpenDoc.edt
> http://www.winedt.org/temp/Acrobat OpenDoc-Find.edt
>
> But I still don't know how
> can I make the forwards and inverse search work for me smoothly. I've
> tried a lot and cann't
> figured this issue out. Would you like give me some hints on this
> once more? Thanks in advance.

Does a foo.synctex file get generated if you run

pdflatex -synctex=-1 foo.tex

on a simple file like:

% foo.tex
\documentclass{articles}
\begin{document}
foo

bar

baz
\end{document}


Martin Chicoine

unread,
Oct 17, 2008, 9:02:45 AM10/17/08
to
On 17 oct, 06:10, Hongyi Zhao <hongyi.z...@gmail.com> wrote:

> On Oct 17, 4:30 PM +0800, Heiner Richter <heiner.rich...@web.de> wrote:
> [snip]
>
>
>
> > Using
>
> > \usepackage{pdfsync}
>
> I've done.

No, don't use pdfsync, this is the old way of doing it. Just use the -
synctex=-1 option.

Maybe you should go on the sumatrapdf-sync or on the Winedt forums.

Hongyi Zhao

unread,
Oct 17, 2008, 9:13:43 AM10/17/08
to
On Oct 17, 6:58 PM +0800, Martin Heller <mr_h...@yahoo.dk> wrote:
> Hongyi Zhao skrev:
>
>>>>> http://william.famille-blum.org/software/sumatra/Sumatra-Find.edt
>>>> I use this line in WinEdt to open Sumatra from WinEdt:
>>>>
>>>> Run('C:\Program Files\SumatraPDF\SumatraPDF-sync.exe
>>>> -reuse-instance -inverse-search "\"%B\WinEdt.exe\"
>>>> \"[Open(|%%f|);SelPar(%%l,8);]\""','%P');
>>> Now, I change the corresponding codes for invoking
>>> Sumatra in the Sumatra-Find.edt according to the above codes supplied by
>>> you. But I'll get the "Error loading pdf file" error. Why?
>
> I meant you should replace the line that opens Sumatra in
> Sumatra-Find.edt with the single unwrapped line above.

Thanks for your correcting me, I've realized that I had misunderstand
you. But even with this corrected settings, the issue is still the same
as before. In addition, I also learned from the winedt's yahoo group
forum that the following two edt files are more compatible with winedt
than the Sumatra-Find.edt is.

>
>> Now, I update the Sumatra to 0.9.3 and can open the pdf using Sumatra by
>> clicking the
>> Acrobat Reader button within winedt's menubar with the following two
>> files installed:
>>
>> http://www.winedt.org/temp/Acrobat OpenDoc.edt
>> http://www.winedt.org/temp/Acrobat OpenDoc-Find.edt
>>
>> But I still don't know how
>> can I make the forwards and inverse search work for me smoothly. I've
>> tried a lot and cann't
>> figured this issue out. Would you like give me some hints on this
>> once more? Thanks in advance.
>
> Does a foo.synctex file get generated if you run
>
> pdflatex -synctex=-1 foo.tex
>
> on a simple file like:
>
> % foo.tex
> \documentclass{articles}

Aha, should be \documentclass{article}

> \begin{document}
> foo
>
> bar
>
> baz
> \end{document}

See the compile result according to the above minimal example with the
command: pdflatex -synctex=-1 foo.tex

ftp://159.226.135.215/incoming/foo.zip

Hongyi Zhao

unread,
Oct 17, 2008, 9:23:04 AM10/17/08
to
On Oct 17, 9:02 PM +0800, Martin Chicoine <martin....@gmail.com> wrote:
> On 17 oct, 06:10, Hongyi Zhao <hongyi.z...@gmail.com> wrote:
>> On Oct 17, 4:30 PM +0800, Heiner Richter <heiner.rich...@web.de> wrote:
>> [snip]
>>
>>
>>
>>> Using
>>> \usepackage{pdfsync}
>> I've done.
>
> No, don't use pdfsync, this is the old way of doing it. Just use the -
> synctex=-1 option.

Thanks for your advices.

>
> Maybe you should go on the sumatrapdf-sync or on the Winedt forums.

Yes, I'm go on discussing this issue with some Gurus on the the Winedt
forums.

Hongyi Zhao

unread,
Oct 17, 2008, 9:34:46 AM10/17/08
to
On Oct 17, 9:23 PM +0800, Hongyi Zhao <hongy...@gmail.com> wrote:
[snip]

> Yes, I'm go on discussing this issue with some Gurus on the the Winedt
> forums.

As the supplement stuff of the current issue in question, I relay the
following from Winedt-list to here:

----------------------------
On Friday, October 17, 2008 at 18:34, Bernard...@math.u-psud.fr wrote:
> Normally, when you click on the icon, the pdf document opens at the
> exact line where was the cursor in the editor window ; this line is
> highlighted in violet. Doesn't it happen that way for you ?

When I click on the icon of *Acrobat Reader* which has been
changed to invoke the SumatraPDF viewer, I just can open the pdf file,
as for the cursor location, will always reside at a changeless
location regardless I put the cursor in different loactions in the
editor window.

> If not,
> maybe the auxiliary files are not in the document's directory, but in
> a subdirectory ;

I'm writing my PhD thesis, which consist
of multi tex files in different subdirectories belong to the main tex file's
directory, e.g., each chapter take a separate tex file and all of
these chapters are put in the same subdirectory called chapters, and
so on.

> you must know that the .synctex file has to be in the
> document's directory. (Actually, I've made a shortcut for the macro -
> F8 -,rather than using the icon.)

In my case, the .synctex file is located in the main tex document's
directory. Furthermore, the F8 has been bound to a customized
macro by me and I don't want to change this, so, from where can I make
a new shortcut for the macro to do that thing?

> As for inverse search, I just have to double-click at some place in
> the pdf file to be back at the source code in the editor window.

When I doubleclick from within


pdf-file, I get the error message like this: "No synchronization info at
this position".
You can get the screenshot of this error message from my ftp server:
ftp://159.226.135.215/incoming/doubleclick_error.png

----------------------------

Martin Chicoine

unread,
Oct 17, 2008, 9:48:21 AM10/17/08
to
On 17 oct, 09:23, Hongyi Zhao <hongyi.z...@gmail.com> wrote:

> On Oct 17, 9:02 PM +0800, Martin Chicoine <martin.chico...@gmail.com> wrote:
>
> > On 17 oct, 06:10, Hongyi Zhao <hongyi.z...@gmail.com> wrote:
> >> On Oct 17, 4:30 PM +0800, Heiner Richter <heiner.rich...@web.de> wrote:
> >> [snip]
>
> >>> Using
> >>> \usepackage{pdfsync}
> >> I've done.
>
> > No, don't use pdfsync, this is the old way of doing it. Just use the -
> > synctex=-1 option.
>
> Thanks for your advices.

Also, you should delete the .pdfsync file that was created because it
could interfere.

Hongyi Zhao

unread,
Oct 17, 2008, 10:02:00 AM10/17/08
to
On Oct 17, 9:48 PM +0800, Martin Chicoine <martin....@gmail.com> wrote:
> Also, you should delete the .pdfsync file that was created because it
> could interfere.

Thanks again.

0 new messages