[Okular-devel] [Bug 228427] inconsistency between dvi and pdf forward search

Jochen Trumpf Jochen.Trumpf at anu.edu.au
Sun Mar 7 02:59:22 CET 2010


https://bugs.kde.org/show_bug.cgi?id=228427





--- Comment #5 from Jochen Trumpf <Jochen Trumpf anu edu au>  2010-03-07 02:59:19 ---
Hm, I have been looking into this and as I feared, this is far from trivial. In
fact, the syntax that you/kile have been using is not really supported and it
only works "by accident" in the dvi case. The source file path you are using,
i.e. "./loremipsum.tex", requires expansion to make sense, i.e. the "." needs
to be expanded to the current working directory. As far as I can tell, path
expansion is not officially supported by other viewers in this context, only
relative and absolute paths are. It is definitely not supported by synctex, the
library okular uses for forward search in pdf files. 

So, why exactly does it work for dvi files in okular? 

The dvisourcesplitter class tries to support common but wrong syntax in forward
search command lines, such as missing ".tex" file name extensions and missing
spaces between line number and source file name where the latter starts with a
digit. It does this by testing the existence of source files. For this purpose
it creates a QFileInfo from the given source file name and plays with this
(adding extensions, modifying paths and names etc.) in all sorts of manners.
Because of the way that QFileInfo works, this process also handles simple
expansions like "./loremipsum.tex". 

The problem I am having with this approach is that it tries to second guess
what the user wants and may yield unexpected results in pathological situations
(such as nested folder structures with common filenames at several levels or
where folder names start with digits). In my view it would be much cleaner if
the expansion happened before okular is called (i.e. if kile did it in this
case and called okular using either a relative or an absolute path).

Summing up, a clean approach would be to do away with the current
dvisourcesplitter, expand the documentation of the forward search command line
syntax explaining more clearly what syntax is supported, and implementing some
checks that warn the user if wrong or ambiguous syntax is used.

What do people think?

P.S.: I believe the original reason why the dvisourcesplitter class was
implemented has to do with file names that start with digits. From old forum
discussions concerning xdvi (the first viewer to support all this), it seems to
be clear that the supported syntax was meant to be 
<dvi path>#src:<number>[ ]<source path>
where <source path> was either relative or absolute and the blank between <line
number> and <source path> was mandatory if <source path> started with a digit
and optional otherwise. The problem is of course that such a blank needs to be
escaped on a typical unix command line, so somewhere along the way the kdvi
developers started to "support" a no-blank syntax despite the fact that this
can not be made unambiguous in all cases.

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Okular-devel mailing list