[Tex/LaTex] How to enbale SyncTex in LyX

forward-inverse-searchlyxpdftex

I'm using LyX 2.0.7, and I tried to enable 'Synchronization with output' by following the guide on LyX wiki.

I couldn't succeed after doing each step exactly as the wiki stated. After lots of experiments to get it work, I followed the steps for 'Enable SyncTeX in LyX' for LyX 1.6, which can be applied to LyX 2.0 with some modification, and it make SyncTex work!

As it explained the wiki page, the steps for enabling SyncTex is different in version 1.6.* and 2.0, the following quotes are from the wiki page.

Lyx 2.0
>

  1. In Document > Settings > Output, check Synchronize with output
  2. If your viewer needs another output format than \synctex=-1 (which is the default), select > it or insert it in "Custom Macro"
  3. Modify Output > General > PDF for your PDF viewer (see the viewer-specific notes below)

Lyx 1.6

  1. Enter Tools > Preferences > File Handling > Export programs
  2. Click "LaTeX (pdflatex) > PDF (pdflatex)" in the list. In the "Export program" box, it now says pdflatex $$i. Instead, put pdflatex -synctex=-1 $$i there.
  3. Click Modify to the right of the list, then Apply.

The question is: Since LyX 2.0 has specific settings for enabling SyncTex, why it is not enough to enable it there as the wiki page suggest? and why it is still required to change the latex command line argument?

Can anyone confirm this problem? Is it a bug or is it how it suppose to function? If it's a bug how can we report it?

Best Answer

This is a MikTeX issue, as confirmed by Enrico Forestieri:

For some reason, miktex does not understand/obey the command lyx inserts into the preamble when you check the "Enable Forward/Reverse Search" button in the toolbar and does not generate the necessary info.

The generation of the required info can be forced by changing the converter "LaTeX (pdflatex) -> PDF (pdflatex)" in Preferences->File handling->Converters from the default "pdflatex $$i" to "pdflatex -synctex=1 $$i" (i.e., by adding the -synctex=1 switch). After that it should work (supposing that you performed the necessary configuration as explained in the above link).

Related Question