I am running LyX 2.0.2 in Ubuntu 12.04 and using the default PDF viewer Evince.

I want to setup SyncTeX to go back and forth between the document and the source, at the right position in the text.

I found this in the LyX website, but it doesn't give the Evince viewer.

Does anybody know how to set it up?

  • You might want to try using a newer version of LyX by using the PPA
    – scottkosty
    Jan 30, 2014 at 18:38
  • I tried the instructions on the PPA, but with no success on getting the newer version. Would you say upgrading through the Synaptic Manager could be useful instead?
    – Diego-MX
    Jan 31, 2014 at 16:35
  • sorry the instructions didn't work for you. I've not heard that before. If you want to say exactly which steps you did and where it went wrong, I might have some ideas. Well, I don't think there are any updates in Synaptic Manager. Unless you added the PPA in which case you can update through Synaptic Manager. Finally, if you don't get an answer here, consider emailing lyx-users (linking to this thread) with your question.
    – scottkosty
    Jan 31, 2014 at 17:43
  • The update did work with Synaptic. This is what I did. I followed instructions in the link for the PPA above, I wrote "/release" for the stable release instead of "/daily". Then I opened Synaptic Manager and updated it from there.
    – Diego-MX
    Jan 31, 2014 at 21:56
  • Ah, so when you wrote "with no success" what do you mean? Or it is resolved now?
    – scottkosty
    Jan 31, 2014 at 21:57

1 Answer 1


It seems there's no easy way to do this, yet.

Modifying Scripts

  • Download files. (They are from Benjamin Kellermann, originally posted to Ubuntuusers on March 2011, based on an older version of the Gedit Synctex Plugin by Jose Aliste.)
  • Extract them, e.g. to your desktop.
  • Rename the file evince to evince-synctex. (To be sure that this file will be started because /usr/bin/evince will be found first in PATH.)
  • Open this file (evince-synctex) and replace the second line (starting with EDITORCMD) to

    EDITORCMD="lyxclient -g %f %l"
  • In file evince_backward_search, replace the line

    cmd = re.sub("%f",input_file,self.editor) with

    cmd = re.sub("%f",input_file.split("file://")[1],self.editor)

    Be sure that this text aligns with the text of the lines afterwards. (That change is needed because it seems that LyX can't handle filenames starting with "file://".)

  • Move all three files (evince-synctex, evince_backward_search, evince_forward_search) to /usr/local/bin (needs root rights). (That's the place where user scripts should be stored.)

Extra for Evince 3.4.0 (= Ubuntu 12.04)

In file evince_forward_search, replace the last line (starting with window.SyncView() with

window.SyncView(tex_file, (line_number,1), int (time.time ()), dbus_interface="org.gnome.evince.Window")

Setting up LyX

  • In Document > Settings > Output, check Synchronize with output
  • In Tools > Preferences > Output > General > PDF command, write evince_forward_search $$o $$n $$t
  • Change PDF Viewer (Tools > Preferences > File Handling > File Formats > PDF (pdflatex)) to evince-synctex.

Backward Search (Evince -> LyX)

  • Open file in LyX, view "PDF (pdflatex)".
  • Hold Ctrl key and (left-)click on the line you want to edit. It should be shown in LyX now.

Forward Search (LyX -> Evince)

  • Open file in LyX, view "PDF (pdflatex)".
  • Right-click on one line (in LyX), choose "forward search".
  • In a modern Linux environment (I'm using Arch Linux), you'll need to adjust evince_backward_search and evince_forward_search, too: in both, you must set the first line to #!/usr/bin/python2 to explicitly run Python 2.x and in evince_backward_search you'll have to add another parameter to the function definition of on_sync_source so the line reads like def on_sync_source(self, input_file, source_link, time):, otherwise you'll get an error message when the function is called (with 4 arguments instead of 3) (and with Sublime Text you'll also have to adjust the cmd = re.sub( line). Oct 21, 2014 at 0:41
  • Also see wiki.lyx.org/LyX/SyncTeX#toc4 for the hopefully up-to-date instructions of the LyX community.
    – Jaleks
    Mar 23, 2022 at 8:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .