RFE: Non D-Bus forward/backward search for SyncTeX-enabled docs
@lukehutch
Submitted by Luke Hutchison Link to original bug (#647146)
Description
It would be very helpful if there were a non D-Bus version of forward and backward search for linking synctex-enabled PDF back to a source editor.
Backward search:
An external editor command would be specified as a commandline parameter to evince. e.g. when viewing a file, LyX could launch evince as:
evince /path/to/file.pdf --backward-search-cmd="lyxclient -g %f %l"
When the user Ctrl-clicks on a synctex-enabled
doc, as well as the usual D-Bus method firing, if this parameter is specified then Evince will launch the specified external command.
Forward search:
Evince supports this already (though see Bug 647138). Evince's support only works to page resolution. It would be helpful if Evince scrolled not just to the correct page, but also moved the search point to the middle of the window, and highlighted/selected the bounding box of the page element containing the search point (word/paragraph etc.), to make it much easier for your eye to find the search point.
Evince could add a commandline parameter that specifies a rectangle on a specific page of a document that should be scrolled to the center of the window upon opening the document, so that synctex output could be used with greater accuracy than just jumping to the right page.
Currently LyX has as its default forward search command something like:
synctex view -i $$n:0:$$t -o $$o -x "evince -i %{page+1} $$o"
It would be great if you could do something like:
synctex view -i $$n:0:$$t -o $$o -x "evince -i %{page+1} $$o
--jump-to-rect=%{x},%{y},%{h},%{v},%{width},%{height}"
The point %{x},%{y}
would be displayed at the middle of the page specified with
the -i
switch, and the rectangle %{h},%{v},%{width},%{height}
could be selected
by default to draw the user's eye to the text unit that the forward search
point is contained within.
If you don't want to add another command line parameter, maybe it would be possible to extend the -i
and -p
switches to take a page number followed by an optional x,y
coord followed by an optional bounding box to select:
evince [-i pagenum[,x,y[,h,v,w,h]]] file.pdf
For reference, here is the relevant output from "synctex help view". Note that %{x},%{y}
etc. are floating point numbers:
-x viewer-command
Normally the synctex tool outputs its result to the stdout.
It is possible to launch an external tool with the result.
The viewer-command is a printf like format string with following
specifiers.
%{output} is the name specifier of the main document, without path
extension.
%{page} is the 0 based page number specifier, %{page+1} is the 1
based page number specifier.
To synchronize by point, %{x} is the x coordinate specifier, %{y}
is they coordinate specifier, both in dots and relative to the top
left corner of the page.
To synchronize by box,
%{h} is the horizontal coordinate specifier of the origin of the
enclosing box,
%{v} is the vertical coordinate specifier of the origin of the
enclosing box, both in dots and relative to the upper left
corner of the page.
They may be different from the preceding pair of coordinates.
%{width} is the width specifier, %{height} is the height specifier
of the enclosing box.
The latter dimension is naturally counted from bottom to top.
There is no notion of depth for such a box.
To synchronize by content, %{before} is the word before,
%{offset} is the offset specifier, %{middle} is the middle word,
and %{after} is the word after.
Version: git master