Bug 326605 - Inverse seach with kile doesn't work properly with the new Ubuntu
Summary: Inverse seach with kile doesn't work properly with the new Ubuntu
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: DVI backend (show other bugs)
Version: 0.19.60
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-25 07:21 UTC by valto
Modified: 2014-09-23 16:47 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.14.2
Sentry Crash Report:


Attachments
Latex source file (9.34 KB, text/x-tex)
2013-10-26 14:48 UTC, valto
Details
bibliography file (72.66 KB, text/x-bibtex)
2013-10-26 14:49 UTC, valto
Details

Note You need to log in before you can comment on or make changes to this bug.
Description valto 2013-10-25 07:21:15 UTC
I have just updated to Ubuntu 13.10 (actually, I have another computer with a fresh installation of 13.10 and the same problem).

Before the update, the inverse search between Okular and Kile worked perfectly.
Now, when I shift+click, 90% of the times the inverse search doesn't work. Some time it works, but apparently it decides randomly when to work and when not to work.

By "not working", I mean that when I shift+click Kile does not pop up with the cursor at the right point in the tex file, and even if I switch manually to Kile, the cursor is not in the right place.

Reproducible: Sometimes

Steps to Reproduce:
1. Open a tex file in kile, compile it with "moden" option
2. open the dvi OR use the forward dvi command (which works perfectly)
3. use shift+click to use the inverse search
Actual Results:  
Most of the times it doesn't work. Nothing changes. Some time (apparently at random) it does work.

Expected Results:  
Kile opens and the cursor on the source tex file shifts to the place corresponding to the line in the dvi (or pdf) file used for the inverse search.

I didn't have this problem before upgrading to Ubuntu 13.10. Actually, I have 2 laptops, on one I upgraded from 13.04 to 13.10, on the other I made a fresh installation.

In both cases, the inverse search doesn't work properly.
Comment 1 Albert Astals Cid 2013-10-25 19:03:27 UTC
We did change nothing regarding inverse search in a long time, are you sure it's not someone elses fail?

Anyway, please attach all the needed stuff so we can try to reproduce the problem (i.e. i am not a latex man so i have no clue about using kile, i need all the files and instructions on what to do)
Comment 2 valto 2013-10-26 14:27:04 UTC
Actually I have submitted a bug report to Ubuntu initially, and it was them to direct me to this web-site saying that it probably has to do with some KDE libraries.

What exactly do you need me to attach?

Thanks, Daniele V.
Comment 3 Yuri Chornoivan 2013-10-26 14:39:38 UTC
(In reply to comment #2)
> Actually I have submitted a bug report to Ubuntu initially, and it was them
> to direct me to this web-site saying that it probably has to do with some
> KDE libraries.
> 
> What exactly do you need me to attach?
> 
> Thanks, Daniele V.

Please attach minimal non-working example in LaTeX (can be constructed with lipsum package).

BTW, cannot reproduce here with my LaTeX documents (Kile 2.9.60, KDE 4.10.5, self-compiled poppler+okular from git/master).
Comment 4 valto 2013-10-26 14:48:48 UTC
Created attachment 83130 [details]
Latex source file
Comment 5 valto 2013-10-26 14:49:21 UTC
Created attachment 83131 [details]
bibliography file
Comment 6 valto 2013-10-26 14:50:20 UTC
Here they are.

It's still not working properly with both of my laptops. Even though, 1 time out of 20, it does work.

Thanks for any help.
Comment 7 Albert Astals Cid 2013-10-26 16:39:36 UTC
Remember, i have no clue about latex, what do i do with those files to genereate a pdf?
Comment 8 Yuri Chornoivan 2013-10-26 16:46:49 UTC
(In reply to comment #7)
> Remember, i have no clue about latex, what do i do with those files to
> genereate a pdf?

Open the non-working.tex in Kile, wait until the ready to use PDF will be displayed at the right preview pane (it is generated automatically by default). Shift-click here and there in PDF, watch how the source code pane synchronize with Okular preview part.
Comment 9 Albert Astals Cid 2013-10-27 10:03:04 UTC
Info has been provided, bring back to unconfirmed until i can try to reproduce myself.
Comment 10 Georgy Ivanov 2013-10-30 10:29:14 UTC
I experience the same problem, and here is a workaround: the inverse search works fine for me if the "Browse" tool is selected, and fails to work if one selects "Zoom" or "Selection".
Comment 11 Albert Astals Cid 2013-10-30 10:30:44 UTC
Well, that's not a workaround, that's how it is supposed to work.
Comment 12 valto 2013-10-30 10:39:36 UTC
Hi,

in my case not. The inverse search doesn't work at all when the "Zoom" or "Selection" tool are selected (of course, as it should be), and works very bad if the "Browse" tool is selected. 

After some more experience with it, I think it works only if you select exactly a line with only text and no formulas, which is quite inconvenient.
Comment 13 oleg motygin 2014-01-15 19:25:16 UTC
I confirm the bug for Okular 0.17.3, KDE 4.11.3.

In my case the inverse search works properly
with pdf files: shift+click at any point inside
the preview window opens the editor. 

However, for dvi files the inverse search in Okular
behaves strangely. It never works from displayed
formulae, it rarely works from section titles, it is
more stable when a text line is shift-clicked.

(Kile is not to blame, same effect for TeXStudio.)
Comment 14 Daniel Meyer 2014-02-13 12:07:15 UTC
Hello,
I can confirm this bug. Setup

Ubuntu 13.10, KDE 4.11.3, Okular 0.17.3, emacs 23.

Supposed behavior:
with shift pressed, when clicking somewhere on a .dvi file, it should jump to the position in emacs. This does however work < 10% of the time. I believe that configuration is correct (I did not change it) and it does work at least sometomes. Still this is very annoying, since it makes it pretty much unusable. Any help would be very much appreciated, since this is really an essential feature for me. Thanks a lot,

Daniel.
Comment 15 Luigi Toscano 2014-02-15 23:36:49 UTC
Rough guess: the "active" area exposed by the DVI code for each character is really small, so that you need to really click on some few points. I need to better check the code of inverse search.
Comment 16 Mathieu 2014-09-18 08:43:52 UTC
Any news concerning this bug? It is really annoying for LaTeX users!
Comment 17 Albert Astals Cid 2014-09-18 19:36:30 UTC
This bug is a mix of lots of things, people using the wrong tool and complaining it does not work, people complaining it does not work in dvi but does in pdf, etc.

Sadly, It's one of those bugs that will never be fixed because various people decided to hijack it.

I'm actually not sure i have all the info needed to reproduce this so i'm going to set it to needs info again.

So i have this text file attached, where are you shift+clicking that you think it should work but does not?
Comment 18 Mathieu 2014-09-19 08:23:55 UTC
I am using opensuse 13.1 and the bug is not related to Ubuntu as the title light suggest. The problem occurs on any file compiled with latex (with the option "modern" in kile corresponding to  latex -src-specials). Shift-clicking on the dvi in okular does not work, except as the very left of the first line of the paragraph. In the previous version I had it did not matter where to click. The bug is not present for pdf files compiled with pdflatex, which seem to work normally.

I cannot imagine that this bug is not fixed for all the LaTeX users!

Opensuse 13.1
KDE 4.11.5
Okular 0.17.5
Comment 19 Daniel Meyer 2014-09-20 11:56:39 UTC
Hello Albert,
using your file, here are the test cases that I looked at:

compiling using "latex -src-specials not_working.tex" behavior is erratic. Maybe every 10th shift-click shows the desired result (i.e., jumping to the right location. Some locations for shift-click are working  ("w" from "where" line 8 p. 2) others (most) are not. But I cannot see a pattern.

compiling using "latex -synctex=1 not_working.tex" does not seem to be working at all. It never jumps to the correct location. 

compliling using "pdflatex -synctex=1 not_working.tex" works perfectly (on the pdf file obviously). Always jumps to right location. 

At this point, I cannot switch to pdflatex, since I am writing a book with a huge number of eps pictures. I actually stopped using okular and went back to xdvi (not a pretty program, but it works!). Again, any help would really be appreciated, since this is crucial for me. Best,

Daniel.
Comment 20 Albert Astals Cid 2014-09-21 17:26:37 UTC
So there are two issues here: 
 * We don't support synctex in dvi, that's right and a missing feature, (i have a patch around that should make it work, but that's a different thing)
 * For dvi src-specials you have to be pretty exact clicking in the area, and the code we have to find the closest area if you were not exact is broken, this should fix it https://git.reviewboard.kde.org/r/120308/
Comment 21 Albert Astals Cid 2014-09-21 21:55:36 UTC
Git commit d888b20483c6b3a81340950b46d55d137fd77e3f by Albert Astals Cid.
Committed on 21/09/2014 at 21:54.
Pushed by aacid into branch 'KDE/4.14'.

Fix dvi inverse search

distance being in sqr pixels and s_minDistance being a normalized value was not a good idea to compare them ^_^
REVIEW: 120308

M  +2    -0    ui/pageview.cpp

http://commits.kde.org/okular/d888b20483c6b3a81340950b46d55d137fd77e3f
Comment 22 Daniel Meyer 2014-09-22 10:15:37 UTC
Hello Albert,
thanks a lot for taking care of this. I hope I'll get the change here downstream soon. Best,

Daniel.
Comment 23 Mathieu 2014-09-23 16:47:42 UTC
Thanks Albert!!!