I've had this working for a while, I've not noticed anyone posting about how
to use it without cygwin. This works with the standard windows version of
lyx rather than the cywin version. Its a bit of a stupid method with cludges
but it does work fine, its not as neat as the cygwin version (which it's
basically a port of) If anyone manages to clean it up a bit and remove some
of the dependancies that would be good.

Requirements:
- nircmd.exe (i've forgotten why, I think its purely to let me hide the
windows command window)
- python 2.6 (might work with 3 not tried it)
- win32api python extension (to find the short pathnames)
- SumatraPDF

Setup:
- Set the lyxserver pipe (under paths in the settings) to
"\\.\pipe\lyxserver"
- put "SumatraPDF.bat", "search.py", "nircmd.exe" and "SumatraPDF.exe" in
"../lyx16/bin"
- Update the paths in "SumatraPDF.bat" to be correct for your setup (mine is
64bit), use pythonw.exe to supress the console
- set your in "PDF (pdflatex)" viewer field (in file formats) to: NIRCMD.EXE
EXECMD SumatraPDF.bat
- set the "Latex (pdflatex) -> PDF (pdflatex)" converter to "pdflatex
--synctex=-1 $$i"

Fixes:
- If it won't work uncomment the time.sleep(100) line to see python errors
and change "pythonw.exe" to "python.exe" in "SumatraPDF.bat".
- To turn on debugging in lyx for the pipe use the flag -dbg lyxserver. This
will probably say something illuminating, or nothing at all if its not
worked.

SumatraPDF.bat
------------------------------------------------------------------------------------
"SumatraPDF.exe" -inverse-search "C:/Progra~1/Python~1/pythonw.exe
C:/Progra~2/lyx16/bin/search.py %%l %%f" %1
------------------------------------------------------------------------------------

search.py
------------------------------------------------------------------------------------
# author Chris Lingwood
#
# This script (along with sumatra.bat) enables DVI/PDF search in windows
using Sumatra

import sys
import time
import os
import win32api


#Debug output to ensure the path name is picked up properly
print(sys.argv[1])
print(sys.argv[2:])

line = sys.argv[1]
filename = ' '.join(sys.argv[2:])
print(filename)

#We have to get the windows short filename to avoid having spaces which
upsets the command
filename = win32api.GetShortPathName(filename);
#create the command to be send to the lyx server pipe with an echo to a
windows pipe
command = "echo LYXCMD:revdvi:server-goto-file-row:"+filename+" "+line+">>
\\\\.\pipe\lyxserver.in"

#print it for debugging and send it to the os
print(command)
os.system(command)

#Uncomment the next line if there are problems, it lets you see the
debugging output (this is still supressed with pythonw.exe though)
#time.sleep(100)
------------------------------------------------------------------------------------

Chris
-- 
View this message in context: 
http://lyx.475766.n2.nabble.com/Reverse-search-in-windows-from-lyx-1-5-tp5177491p5177491.html
Sent from the LyX - Users mailing list archive at Nabble.com.

Reply via email to