Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: How can I do an inverse search between okular and kile?

  1. #11
    Join Date
    Jun 2008
    Beans
    17

    Re: How can I do an inverse search between okular and kile?

    Update:
    Okular will jump to the right document section if you invoke it like this:

    okular --unique test.dvi#src:33test.tex
    okular --unique test-main.dvi#src:33test-intro.tex
    The %target macro in Kile's forwardDVI options produces output in the right form except with a space between the line number and file, which breaks it into two arguments and okular dies. (in fact, I had 3 since there's a space in the path to my directory).

    So I used quotes around '%target', except then the # turns into %26 and okular dies.

    Then I hit another problem: okular is run in the latex source code directory, and prepends the path to it's arguments: one of my 3 arguments above also had the path repeated!

    At this point I nearly gave up, but stumbled across Juerg Wullschleger's post on May 28 09 here. He wrote a perl script to get xdvi working (which, by the way, isn't in lucid ubuntu yet, nor kdvi). A little editing of his script and I came up with the one below, which is working for me! Yay! Way too much time wasted on this!

    I put the script in a folder somewhere, used chmod to make it executable and put it's full path as a new forwardDVI configuration:
    Settings -> configure kile -> Build -> forwardDVI then:
    1. "new..." button on the right
    2. give it a name, perhaps "My Okular"
    3. put the full path to your perl script as the command (don't forget to escape==[put backslash in front of] any spaces)
    4. put '%target' as Options (the single quotes are important: the script gets it all as one argument that way, otherwise it's broken up at spaces, one of which Kile puts in there for you)


    Don't forget to setup inverse search from Okular: Settings -> Configure Okular .. -> Editor -> editor dropdown: "custom text editor", command: "kile %f --line %l"
    And set up Kile to tell LaTeX to add source info: Settings -> configure kile -> Build -> LaTeX -> "Modern" in the dropdown


    Code:
    #!/usr/bin/perl
    # kile2okular. (c) Ian Wood, 2010
    # based on:
    # kile2xdvi. (c) Juerg Wullschleger, 2009
    
    if($ARGV[0] =~ m/file:(.*)#src:(\S*) (\S*)/){
    $dviFile = $1;
    $line = $2;
    $sourceFile = $3;
    $sourcePos = '--unique "'.$line.' '.$sourceFile.'"';
    if($dviFile =~ m|.*/([^/]*.dvi)|){
    $dviFile = $1;
    }else{
    print 'usage1: kile2xdvi <dvifile> or kile2xdvi "file:<dvifile>#src:<line> <sourcefile>"'."\n";
    exit;
    }
    }else{
    if((!$ARGV[0]) || ($ARGV[0] == "--help") || ($ARGV[0] == "-h")){
    print 'usage2: kile2xdvi <dvifile> or kile2xdvi "file:<dvifile>#src:<line> <sourcefile>"'."\n";
    exit;
    }
    $dviFile = $ARGV[0];
    $sourcePos = '';
    }
    if (!(-e $dviFile)){
    print "$dviFile: No such file.\n";
    exit -1;
    }
    
    `okular --unique "$dviFile#src:$line$sourceFile"\n`;
    exit;
    Last edited by drevicko; May 17th, 2010 at 05:05 AM.

  2. #12

    Re: How can I do an inverse search between okular and kile?

    You can read this post
    http://ubuntuforums.org/showthread.php?t=1134500&page=3
    for a solution the works for me.

  3. #13
    Join Date
    Jun 2007
    Location
    Perth - OZ
    Beans
    101
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: How can I do an inverse search between okular and kile?

    I could not find, for some reason KDVI in the repositories, so I went for the solution of post #4 with Okular and it worked straight away

    Thanks

    By the way where is KDVI?
    Ubuntu 18.04 64 bit -> transitioning to 20.04

  4. #14
    Join Date
    Oct 2007
    Beans
    5

    Re: How can I do an inverse search between okular and kile?

    I've done everything that I've read here and I still can't get forward or inverse search working at all; nothing happens when I shift+left click in Okular, and ditto in Kile (the documentation doesn't even describe exactly how perform inverse search).

    Is there anyone who can describe, step by step, how I might be able to get this working? It seems like an extremely useful feature. If I can get it working on my machine I will gladly write a detailed step by step guide on the matter, and submit it to whoever's in charge of documentation. That includes matters like preventing a new window from popping up, making sure the destination line in the other document is correct, etc. I'd gladly write such a document if I could figure the steps out.

    Any help is appreciated. Thanks,
    A

  5. #15
    Join Date
    Dec 2008
    Beans
    7

    Re: How can I do an inverse search between okular and kile?

    I tried it with Kile 2.0.85 and Texlive 2009 in an up-to-date Kubuntu with Okular 0.11.2 and it still doesn't work with PDF inverse search. Are there any hints why?

    DVI inverse search however works with okular.

  6. #16
    Join Date
    Nov 2006
    Beans
    233

    Re: How can I do an inverse search between okular and kile?

    I have the same problem with okular and kile on my work desktop (Kubuntu 10.10). I can't get the inverse search working with pdf files. When I left click, nothing happens.

    Oddly enough, I have another machine with linux Mint 10 KDE, and for this machine, inverse search works fine! If I figure anything out, I'll post it here.

Page 2 of 2 FirstFirst 12

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
  •