Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

The title pretty much sums it up. I use the package srcltx in my documents. I am running Ubuntu with Kile 2.1 and Okular 0.8.2 as a viewer. I am pretty sure that inverse search should work, but I haven't been able to set it up. How does one configure the viewer and editor to make this feature work?

share|improve this question

3 Answers 3

up vote 13 down vote accepted

Check this Ubuntu forums thread: How can I do an inverse search between okular and kile?

Here is a summary of the required steps (not tested):

  • Setup inverse search from Okular:

    Settings -> Configure Okular .. -> Editor -> Editor dropdown: "custom text editor"

    command: kile %f --line %l

  • Set up Kile to tell LaTeX to add source info, i.e., set LaTeX build tools from Default to Modern:

    Settings -> Configure kile -> Build -> LaTeX -> "Modern" in the dropdown menu

  • Add a new forwardDVI configuration:

    Settings -> Configure kile -> Build -> forwardDVI

    then:

    1. "new..." button on the right
    2. choose a name
    3. put the full path to the perl script (see below) as the command (don't forget to escape, i.e., put a backslash in front of any spaces)
    4. put '%target' as Options (the single quotes are important)

#!/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;
share|improve this answer
    
It'd be great if you can provide a summary of what they found to eventually work. (The answer on the second page of that thread.) This is since (a) a summary can be much more readable and (b) just in case link-rot sets in and that thread disappears. I know this is Ubuntu we are talking about, but .... just in case. –  Willie Wong Jul 28 '10 at 16:28
    
I got it working with the above steps but without resorting to the script but using okular as the embedded viewer.. –  Johnson-Leung Jul 30 '10 at 23:06
1  
What about for PDFLaTeX? –  Alessandro Cuttin Aug 30 '10 at 16:18
2  
@Alessandro C. You do the same thing for PDFLaTeX, just in the build environments choose PDFLaTeX to have the modern type. I also completely ignored the part about the perl script and it still works perfectly. –  Dom Feb 17 '11 at 17:19
    
@Dom, Alessandro: I tried it with Kile 2.0.85 and Texlive 2009 in an up-to-date Kubuntu with Okular 0.11.2 and PDF inverse search with pdflatex doesn't work. I also left out the perl script part. DVI inverse search however works with okular. Dom, what versions are you using? –  Turion Apr 18 '11 at 18:21

Okular to Kile navigation did not work for me on Ubuntu 14.04.1 in the above mentioned manner.

Then in Configure Kile --> Tools --> Build -->"Select a tool" I selected all possible tools and where-ever Modern was available I chose it.

Then it worked. Otherwise I have been struggling for two two days, it did not work. I must have wasted about a couple of hours for this at-least.

Hope this post saves time for many other people.

share|improve this answer

I tried what was described here and it did not work. I found this link from the University of Illinois and their suggestions worked; I'm working in Fedora 17, in case it makes any difference. Here is what they suggest:

  1. Open some LaTeX file in Kile
  2. Open "Settings -> Configure Kile..."
  3. Click "Tools -> Build -> LaTeX"
  4. Select the "Modern" configuration
  5. Set the options to -interaction=nonstopmode -src %source
  6. Click "ForwardDVI" in the list
  7. Select the "Embedded Viewer" configuration
  8. Click OK
  9. Click "LaTeX" in the build toolbar menu
  10. Click "ForwardDVI" in the view toolbar menu
  11. Open "Settings -> Configure Viewer..."
  12. Click "Editor"
  13. Select Kile as the editor
  14. Click OK
  15. Scroll to some interesting location in the document and hold down Shift while left-clicking on that location. It should jump to that spot in the LaTeX source.
  16. Scroll to some other location in the LaTeX source and click "ForwardDVI". It should jump to that location in the DVI.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.