Page 3 of 3 FirstFirst 123
Results 21 to 28 of 28

Thread: HOWTO: Evince + SyncTeX + vim/emacs/scite/lyx/kile/$EDITOR + forward/backward search

  1. #21
    Join Date
    Nov 2005
    Beans
    12

    Re: HOWTO: Evince + SyncTeX + vim/emacs/scite/lyx/kile/$EDITOR + forward/backward sea

    Grrr! I got this to work beautifully on 12.04 with Sublime Text 2... but things have stopped working on 12.10 beta1 with today's updates ##@$@#)($*!!!

    evince_forward_search now errors out upon calling "print_exc()", which means that the dbus interface or somehting like it must have changed yet again! Any wisdom to be offered?

    Edit: scratch the above. The problem is that the scripts do not seem to support file names with spaces. I'll see if I can fix this. More info:

    - The exception thrown is as follows:

    Code:
    Traceback (most recent call last):
      File "/home/<OMITTED>/.config/sublime-text-2/Packages/LaTeXTools/evince/evince_forward_search", line 44, in <module>
        dbus_name = daemon.FindDocument('file://' + pdf_file, True, dbus_interface = "org.gnome.evince.Daemon")
      File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 70, in __call__
        return self._proxy_method(*args, **keywords)
      File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 145, in __call__
        **keywords)
      File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
        message, timeout)
    dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Message did not receive a reply (timeout by message bus)
    - What fails is the call to FindDocument.
    - Quoting the file name in the call to FindDocument does not work.

    If anyone has any advice, it's very welcome!
    Last edited by marciano; September 24th, 2012 at 08:09 PM. Reason: Additional info and correction - problem is with spaces in file names.

  2. #22
    Join Date
    Nov 2005
    Beans
    12

    Re: HOWTO: Evince + SyncTeX + vim/emacs/scite/lyx/kile/$EDITOR + forward/backward sea

    OK, I solved my own problem

    The evince_{forward,backward}_search scripts do not seem to handle file names with spaces. The problem is that the Evince FindDocument call expects an URI for the file name, with spaces replaced with "%20". If you pass a file name with non-encoded spaces, the call throws an exception. On the other hand, SyncTeX handles file names with spaces just fine, but a consequence of this is that if you replace spaces with "%20" in the name of the TeX file, syncing will fail (most likely, your editor will open a new window or tab with a new file name).

    To fix this, you need the following changes:

    1. in evince_forward_search, replace the line that says

    Code:
    pdf_file = os.path.abspath(sys.argv[1])
    with

    Code:
    pdf_file = os.path.abspath(sys.argv[1]).replace(" ", "%20")
    2. in evince_backward_search, method __init__(), replace the line

    Code:
    self.uri = uri
    with

    Code:
    self.uri = uri.replace(" ", "%20")
    also, add the following line at the beginning of method on_sync_source():

    Code:
    input_file = input_file.replace("%20", " ")
    3. finally, in the evince shell script, make sure that you invoke your editor quoting the file name.

    Hope this helps!
    Marciano.

  3. #23
    Join Date
    Oct 2012
    Beans
    1

    Backward search w/ Emacs in Ubuntu 12.04 (failure -> solved)

    In my installation emacs tried to treat uri of the file literally - it visited a file with name /home/mjacek/file:/home/mjacek/latex/mypaper.tex, which was nonexistent...


    After trying strange things, I hacked the evince_backward_search script with a line to strip the "file:" uri prefix:


    cmd = re.sub("%l",str(source_link[0]), cmd)
    ##mjacek added next line
    cmd = re.sub("file:","",cmd)
    ##
    print cmd

    ... and now it works OK

    I also needed to use patches from http://ubuntuforums.org/showpost.php...26&postcount=5 , otherwise I got dbus error.

    PS. When editing Python code do remember that indentation counts - align the new line exactly with old ones, not the other way round

  4. #24
    Join Date
    Oct 2012
    Beans
    1

    Re: HOWTO: Evince + SyncTeX + vim/emacs/scite/lyx/kile/$EDITOR + forward/backward sea

    Hello Ben and all the other guys who contributed,

    Great work! I am in the proof reading stage of my thesis (and can't use dvi format because of tikz and pgfplots). This app has till date, at least saved me 50% of the efforts.

    Cheers,
    Devendra

  5. #25
    Join Date
    Dec 2012
    Beans
    1

    Re: HOWTO: Evince + SyncTeX + vim/emacs/scite/lyx/kile/$EDITOR + forward/backward sea

    Hello all,

    I got that working for vim on Ubuntu 12.10. The only problem is that if I do ctrl-click in evince to jump to vim, vim starts two windows. One is working and I can jump through the document via forward and backward search. The second window is just a replica of the first one with the same document and I have to manuelly close that one. Can you help me? Maybe there is a newer version of the script for ubuntu 12.10.

    Thank you!

  6. #26
    Join Date
    Mar 2013
    Beans
    1

    Re: HOWTO: Evince + SyncTeX + vim/emacs/scite/lyx/kile/$EDITOR + forward/backward sea

    Quote Originally Posted by macsa View Post
    Hello all,

    I got that working for vim on Ubuntu 12.10. The only problem is that if I do ctrl-click in evince to jump to vim, vim starts two windows. One is working and I can jump through the document via forward and backward search. The second window is just a replica of the first one with the same document and I have to manuelly close that one. Can you help me? Maybe there is a newer version of the script for ubuntu 12.10.

    Thank you!
    I've had a similar problem: as I have a .tex file open in gvim, evince opens another instance of the same file in a tab prefixed with 'file://' (I use '-remote-tab-silent'). I've changed
    cmd = re.sub("%f",input_file[7:],self.editor)
    to
    cmd = re.sub("%f",input_file[7:],self.editor)
    in evince_backward_search (thus stripping unwanted prefix), and now it works.

    Many thanks to the author and contributors! The scripts are great.

  7. #27
    Join Date
    Jul 2011
    Beans
    1

    Re: HOWTO: Evince + SyncTeX + vim/emacs/scite/lyx/kile/$EDITOR + forward/backward sea

    Thanks a lot for a great tool.

    How about putting it on github?

    Rehan

  8. #28
    Join Date
    Aug 2013
    Beans
    1

    Re: HOWTO: Evince + SyncTeX + vim/emacs/scite/lyx/kile/$EDITOR + forward/backward sea

    woth pointing out that the right path for those who use vundle (instead of vim-latexsuite package) is
    ~/.vim/bundle/vim-latex/after/ftplugin/tex.vim

Page 3 of 3 FirstFirst 123

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •