inverse and forward search in Okular Linux?

Help
2010-06-13
2013-05-29
1 2 > >> (Page 1 of 2)
  • Have anyone had any success with forward and inverse search when using the Okular viewer and Texlipse?

    Thanks

     

  • Anonymous
    2010-07-06

    Hi, I am using Okular. It supports inverse searching! Here is my method.

    Start Eclipse, click "Window->Preferences->Texlipse->Viewer Settings", then click "new.." to add a new item as follows.

    Viewer name: okular
    Viewer command: /usr/bin/okular
    Viewer arguments: %file
    Viewer input file format: dvi
    Inverse search support: Viewer outputs "file:linenum" to console
    Viewer supports forward search: Yes

    Then start Okular, click "Settins->Configure Okular->Editor", change the settings as follows.

    Editor: Customize text editor
    Command: echo %f:%l

    At last, press Shift and left-click any position in the dvi file to do inverse search ! Enjoy! :D

     
  • Pål
    Pål
    2010-07-06

    Hi

    Is it possible to do this with a pdf-file instead of a dvi-file?

     
  • Thanks a lot Homer, it works great and it does work too with PDF files.!

     
  • kaoote
    kaoote
    2010-08-03

    Hi ssardina

    In my case the methode of homer xing works fine for dvi, but not for PDF.
    What are your settings for working the forward and inverse search  with pdf by using texlipse with okular?

    and the inverse search isn't very accurate is this a normal behaviour?

     
  • Hi Kaoote,

    First I have pdflatec configured with this parameters:

    -synctex=1 -interaction=nonstopmode -src-specials %input

    see the synctex=1 will generate the .synctex.gz file, which is necessary to do the inverse search. Do you have that? Also I noticed the pdf has to be opend with ECLIPSE (using control+4)

    I unfortunately do not have forward search working. :-(

     
  • Ian Wood
    Ian Wood
    2010-08-15

    You can get forward search happening if you set Viewer arguments to:

    -unique "file:%file#src:%line %texfile"

    The -unique option prevents okular from opening multiple windows. The other part tells okular which part of the dvi file to view. This way, when you "Launch the previewer (ctrl-4)" from eclipse, okular jumps to the part of the dvi file corresponding to the cursor position in eclipse.

    For this to work, there is a latex command line option (something like '-srcspecials' I think) that puts information about source files and line numbers into the dvi file.

    To put it all together (borrowing from Homer Xing above):

    Start Eclipse, click "Window->Preferences->Texlipse->Viewer Settings", then click "new.." to add a new item as follows.

    Viewer name: okular
    Viewer command: /usr/bin/okular
    ** Viewer arguments: -unique "file:%file#src:%line %texfile"
    Viewer input file format: dvi
    Inverse search support: Viewer outputs "file:linenum" to console
    Viewer supports forward search: Yes

    Then start Okular, click "Settins->Configure Okular->Editor", change the settings as follows.

    Editor: Customize text editor
    Command: echo %f:%l

    At last, press Shift and left-click any position in the dvi file to do inverse search ! Enjoy! :D

     
  • Ian Wood
    Ian Wood
    2010-08-15

    I have a strange side effect of the inverse search: when I sift-click in okular, eclipse gets minimised. When I give it focus again, the inverse search has worked (ie: the cursor/current file corresponds to where I shift-clicked). Anyone got any idea why and/or how to stop it doing that?

    (btw: some versions of okular have the inverse search capability broken. The version I have is 0.10.2, and it works for me)

    So, if you've spent anywhere near as much time as me setting this up, you'd best stop procrastinating now and get back to writing whatever you needed latex for in the first place!!

    Happy newfound productive editing (:

     
  • drevicko:

    1 - Thanks, forward search works great! Even with pdf (your instructions kind of suggest dvi, but pdf works well too!)
    For some reason the first time I set it up, it broke the inverse search. I had to re-do the steps on the viewer to finally get both working, strange…

    2 - yes I have the same problem with eclipse minimizing when doing inverse search, have to click twice!

    Sebastian

     
  • confirmed, same thng happened in another machine. When I changed the viewer arguments for okular to -unique "file:%file#src:%line %texfile"  I lost inverse search (forward search now worked). After a few back and forths between that and just %file both worked. very strange…

     
  • Pål
    Pål
    2010-11-02

    Hi

    I'm trying to get both forward and inverse search working with Okular 0.10.5 on Fedora 13, but I can't seem to get it working. I'm using pdflatex to do the compilation of the pdf file. Does it need any special options (-synctex=1 ? ), or packages (\usepackage{pdfsync} ) to work?
    I can as ssardina get forward (and not inverse) search working by using -unique %file
    and inverse (and not forward) by using -unique "file:%file#src:%line %texfile"  but not both, even though I've redone the steps several times.
    Does anybody know why it isn't working?

    Regards

    Pål

     
  • EJ
    EJ
    2011-01-21

    I have the same problem as paalge with oklar 0.10.5 on gentoo.  I tried passing the same arguments as texlipse should be passing to okular (-unique "file:%file#src:%line %texfile"  except replacing the variables with values) in the console, and when I watch the console output after shift clicking a few places I have a bunch of lines that say 

    okular(32023)/okular (app) Okular::Document::processSourceReference: No such file: "report2_jer.pdf/../report2_jer.tex

    where report2_jer.pdf was my %file and report2_jer.tex was my %texfile.  If I just use %file, then I can watch the filename and line number being spat out as I click, so I think that this is a problem on the okular side

     
  • Ian Wood
    Ian Wood
    2011-02-03

    Did you use the "-src-specials" latex command line option? Without this, the pdf/dvi file doesn't contain information on source file locations.

     
  • EJ
    EJ
    2011-02-03

    Did you use the "-src-specials" latex command line option? Without this, the pdf/dvi file doesn't contain information on source file locations.

    yup that option is in there

     
  • Pål
    Pål
    2011-02-14

    Hi

    I've been trying to get inverse search working, but I'm still having problems. Using the information provided earlier, the forward search is working. I've tried to run Okular in the console, and it outputs /home/…./Artikkel.tex:93 which seems right. Why isn't Texlipse detecting this when opening Okular through Texlipse (using Ctrl+4)?

    Okular gets:
    -unique "file:%file#src:%line %texfile"
    pdflatex uses:
    -synctex=1 -interaction=nonstopmode -src-specials %input
    Okular uses:
    echo %f:%l

    Does anybody have any ideas how to solve this?

     
  • Ian Wood
    Ian Wood
    2011-02-17

    Hi Paalge, when you run 'okular -unique "file:your-dvi-file#src:22 your-texfile" ' in the command line, does it jump to the right spot in the dvi file?
    You could write a bash script (fedora uses a bash command line shell, right?) that captures the command line it's given and stores it in a file. That way you can see exactly what texlipse is giving okular. If it looks right, you can try running okular with the captured command line to see if it behaves right.
    Not sure what else I can suggest… It works fine for me on ubuntu with okular 0.10.2
    Older versions of okular parsed the command line incorrectly and didn't work …

     
  • Pål
    Pål
    2011-02-17

    Hi Drevicko
    Firstly I'm trying to get inverse search working for pdflatex (and not a dvi file (latex)) on both Ubuntu 10.04 and Fedora 13 using Okular 0.10.5.
    " … when you run 'okular -unique "file:your-dvi-file#src:22 your-texfile" ' in the command line, does it jump to the right spot in the dvi file? " This feature works , and I end up at the correct spot in my pdf-file.

    What is not working for me is the inverse search where one shift clicks in Okular and it takes you back to the correct place in the latex file. As described earlier by running Okular using the command line, it looks like Okular is outputting the correct command, but Texlipse is not catching it and jumping to the correct spot.

    Do you have any ideas for solving this?

     
  • Bort Simpson
    Bort Simpson
    2011-03-31

    Using a console for output on

    okular --unique "file:%file#src:%line %texfile"
    

    doesn't give output as mentioned earlier.
    However it does work fine with

    okular --unique "%file"
    

    .

    So the fix is:

    okular --unique "%file#src:%line %texfile"
    

    Together with drevicko's information everyone should be able to set it up now.

     
  • Bort Simpson
    Bort Simpson
    2011-03-31

    and yes the minimizing behaviour is still there ;(

     

  • Anonymous
    2011-07-05

    @ bortsimpson: I can confirm the minimizing issue here: Ubuntu Natty, gnome3

    @ all: thanks for the tips! I got it working nicely for pdf. But I have one unanswered question:

    How do I actually configure it if I want okular to open pdf and dvi files and still support forward and inverse search?
    Just having two viewer entries for okular, one for pdf and one for dvi, didn't seem to work, as their arguments got synced on saving.
    Do I need to workaround this with symlinks or bash scripts or is there a more straight-forward solution?

    And for dvi: is the -synctex=1 option for forward search also valid for normal latex compilation?

     
  • honestleaf
    honestleaf
    2011-11-05

    In my case, I need to pass the abolute path for the .tex file so that the forward search can work ( I use pdflatex with -synctex=1 option). To do so, I write a script which looks like

      1 #!/bin/bash
      2 
      3 /usr/bin/okular --unique "$1#src:$2 `pwd`/$3"
    

    And change the viewer configuration as

    Viewer command: /path/to/my/script
    Viewer arguments:%file %line %texfile

    Now both inverse and forward work!

    PS. for the minimizing issue, I uncheck the option "Force eclipse to get focus on inverse search" so that it will not get minimized. The drawback for this solution is also obvious: eclipse will not get focused.

     
  • Pål
    Pål
    2011-11-05

    Thank you very much honestleaf. The solution you posted finally got inverse and forward search working for me.

     
  • Ciro Santilli
    Ciro Santilli
    2012-06-05

    thank you infinitely xing for inverse and drevicko for forward (post 7 summarizes all)

     
  • Ciro Santilli
    Ciro Santilli
    2012-06-05

    just to sumarize some more (ubuntu 12.04 Unity, Eclipse 3.7.2, Texclipse 1.5.0, Okular 0.14.3)

    I also needed to set up as bortsimpson said

    -unique "%file#src:%line %texfile"

    To avoid minimizing Eclipse uncheck force Eclipse to get focus

    (if you check that eclipse minimizes, so you already have to do an alt tab AND you stop seeing eclipse, so I find it better to keep eclipse in sight, and do the alt tab)

     

  • Anonymous
    2012-09-05

    better yet, instead of what honeyleaf proposed, you could use

    --unique "%file#src:%line %fulltexfile"
    

    that is, no bash script required!

     
1 2 > >> (Page 1 of 2)