On Wed, Apr 22, 2009 at 11:33:18PM +0200, Pavel Sanda wrote:

> Enrico Forestieri wrote:
> > On Wed, Apr 22, 2009 at 06:08:12PM +0200, Pavel Sanda wrote:
> > 
> > > Enrico Forestieri wrote:
> > > > On Tue, Apr 21, 2009 at 07:27:46PM -0700, sykes wrote:
> > > > 
> > > > > I'm running LyX 1.6.2 on Windows XP.  I would like to perform inverse
> > > > > searches from Yap back to the actual line in LyX.  Is this possible?  
> > > > >  
> > > > 
> > > > This is possible only with the cygwin version of LyX.
> > > 
> > > is this version patched somehow?
> > 
> > No, it works OOTB on cygwin.
> hmmm i recently studied this bug:
> http://www.lyx.org/trac/ticket/94
> and thought this is not possible OOTB.

I think this has always been possible OOTB with xdvi, provided that
you activate src-specials when producing the dvi.

> you even don't use any
> special converter preferences or scripts for yap?

Only a wrapper is necessary. I attach here an excerpt of the README
file in the LyX/Cygwin package, explaining everything.

> is your solution extendible for xdvi?

What do you mean? When using xdvi you only have to be sure that
src-specials are activated and then you simply Ctrl-click in the
xdvi window to jump to the right location in the LyX window.

Reverse DVI search

Reverse DVI search allows the cursor in LyX to automatically jump to the
point corresponding to where you Ctrl-click (if using xdvi) or double click
(if using yap) in the previewed DVI file.
This feature can be enabled as follows:

  * Activate src-specials by changing the "LaTeX (plain)->DraftDVI" converter
    in Tools->Preferences->File Handling->Converters to "latex --src $$i"
    if you use tetex, or to "latex -src-specials $$i" if you use miktex.
    As an alternative to redefining the converter (maybe because you use
    pplatex instead of latex for producing a DraftDVI), you can insert
    "\usepackage[active]{srcltx}" in the preamble of the LyX file.

  * A program or script will be called by the dvi viewer when initiating
    a reverse dvi search (xdvi uses Ctrl-click, yap uses double click).
    This program should take 2 arguments, a filename and a line number, and
    should pass this info to a running instance of LyX. This can be done
    either using the lyxpipe (set by default to ~/.lyx/lyxpipe) or the
    unix domain socket that lyx creates in its temporary directory.
    A suitable script (/usr/local/bin/lyxeditor.sh) is already included in
    this package for using the lyxpipe machinery. You could modify it in order
    to better fit your needs, but it should already work out of the box.
    Alternatively, you can use lyxclient.exe for communicating with lyx
    through the socket mechanism.

  * If you use xdvi, you don't need to do anything else, as lyx already
    provides the necessary hooks for automatically using lyxclient.exe.
    However, if for whatever reason you want to use the lyxpipe instead
    of the socket for communicating with lyx, simply change the DVI
    viewer in "Tools->Preferences->File Handling->File formats" to
    "xdvi -editor 'lyxeditor.sh %f %l'" (without double quotes), where
    lyxeditor.sh is the aforementioned script.

  * If you use yap, you should set the name of the program directly in yap
    through the View->Options menu. However, as yap is a native Windows
    application, both lyxeditor.sh and lyxclient.exe have to be launched
    through the wrapper program /usr/local/bin/lyxeditor.exe (after
    installation, you will find its source in the /usr/local/share/lyx/etc
    directory). After launching yap, choose the View->Options menu and select
    the "Inverse DVI Search" tab. Click on the "New..." button and, in the
    window which opens, enter "LyX Editor" (or any other name you like) in
    the "Name:" field. Now click on the button labeled "..." to open a
    filedialog and navigate to the directory containing lyxeditor.exe (it
    will be C:\cygwin\usr\local\bin if C:\cygwin is your root directory).
    Select lyxeditor.exe and then specify the program arguments as "%f %l"
    (without the double quotes) if you want to use the lyxpipe, or as
    "-g %f %l" (again, without quotes) if you want to use the lyxsocket.

  * If you did no mistakes, and if src-specials are activated as previously
    described, whenever you Ctrl-click in xdvi, or double click in yap, the
    cursor in LyX should jump to the desired location.

Reply via email to