Re: Forward/reverse searching problems under Windows (The Sequel)
On 05/25/2011 4:16 PM, Enrico Forestieri wrote: > Enrico Forestieri writes: > >> So, can anyone compiling LyX with MSVC perform that check? > > It turned out to be an issue with the MSVC compiler and should be fixed > in the next release. Wow, thanks for all the time and effort you put into this. I really appreciate it. > In the meantime, Windows users needing to perform a dvi forward search > can workaround it by first generating a pdf and *then* previewing as > dvi. Yes, that works. Thanks very much. -chris
Re: Forward/reverse searching problems under Windows (The Sequel)
Enrico Forestieri writes: > So, can anyone compiling LyX with MSVC perform that check? It turned out to be an issue with the MSVC compiler and should be fixed in the next release. In the meantime, Windows users needing to perform a dvi forward search can workaround it by first generating a pdf and *then* previewing as dvi. -- Enrico
Re: Forward/reverse searching problems under Windows (The Sequel)
Christopher Menzel writes: > > On May 23, 2011, at 3:33 PM, Enrico Forestieri wrote: > > Christopher Menzel writes: > >> > >> That is, LyX is calling the appropriate forward search command for a PDF > >> preview document, not DVI. > > > > LyX performs a forward search for the last generated format, so it means > > that you generated a pdf after the dvi, even if you quitted the pdf viewer > > and are now previewing the dvi. > > Sorry, I guess I'm confused about the semantics of "generating a format" > versus "previewing". What more do I have to do to "generate a format" > beyond previewing? If you hit the "update" button, a given format is generated (produced) in the temp dir, but a previewer is not started. > From the documentation it appears that all I should > have to do is generate a dvi preview: > >Forward search works both with DVI and PDF output. LyX simply >checks which preview format you have used before (i.e., which >format is already there in the temporary directory) and chooses >the appropriate configuration for the respective format. > > I have done that; the only thing in the Temp directory is a DVI file > for my document. There is no sign of any PDF. So, let's see whether we can solve this mystery by looking at the code. The following is the relevant snippet in src/frontends/qt4/GuiView.cpp: if (!dviname.exists() && !pdfname.exists()) { dr.setMessage(_("Please, preview the document first.")); break; } string outname = dviname.onlyFileName(); string command = lyxrc.forward_search_dvi; if (!dviname.exists() || pdfname.lastModified() > dviname.lastModified()) { outname = pdfname.onlyFileName(); command = lyxrc.forward_search_pdf; } Firstly, LyX checks whether a dvi or pdf was generated. If not, the message "Please, preview the document first." is issued. Then, LyX assumes that you generated a dvi, but if no dvi exists or the pdf is newer than the dvi, a pdf format is assumed. Note that if no pdf exists, pdfname.lastModified() returns -1 and the check pdfname.lastModified() > dviname.lastModified() is never true. Thus, if no pdf exists a dvi forward search is always attempted. Anyway, you say that a pdf search is tried, even if no pdf is in sight. Let's se how that could happen. The lastModified() method returns a time_t type, which is a signed type on all machines and compilers I have access to. However, I don't have access to the MSVC compiler, which is the one used for the Windows version you are using, most probably. I am able to compile a Windows version with the MinGW compiler, and there it works. So, the only way that a pdf search could be attempted is if the time_t type is an unsigned type for the MSVC compiler. Indeed, in that case, the -1 would be interpreted as the greatest possible value and the check pdfname.lastModified() > dviname.lastModified() would be always true. I have no way to check that and someone building LyX with MSVC should perform that test. It would suffice adding the line lyxerr << "pdf: " << pdfname.lastModified() << endl; just before that snippet, trying a forward search with only a dvi generated and looking at what is printed. If the result is pdf: -1 the mystery remains unsolved (I always get that), but if it prints something like pdf: 2147483647 we found the bug. So, can anyone compiling LyX with MSVC perform that check? -- Enrico
Re: Forward/reverse searching problems under Windows (The Sequel)
On May 23, 2011, at 3:33 PM, Enrico Forestieri wrote: > Christopher Menzel writes: >> >> That is, LyX is calling the appropriate forward search command for a PDF >> preview document, not DVI. > > LyX performs a forward search for the last generated format, so it means > that you generated a pdf after the dvi, even if you quitted the pdf viewer > and are now previewing the dvi. Sorry, I guess I'm confused about the semantics of "generating a format" versus "previewing". What more do I have to do to "generate a format" beyond previewing? From the documentation it appears that all I should have to do is generate a dvi preview: Forward search works both with DVI and PDF output. LyX simply checks which preview format you have used before (i.e., which format is already there in the temporary directory) and chooses the appropriate configuration for the respective format. I have done that; the only thing in the Temp directory is a DVI file for my document. There is no sign of any PDF. How do I "generate a formate" to tell LyX I'm using DVI now? Thanks for your patience. Chris Menzel
Re: Forward/reverse searching problems under Windows (The Sequel)
Christopher Menzel writes: > > That is, LyX is calling the appropriate forward search command for a PDF > preview document, not DVI. LyX performs a forward search for the last generated format, so it means that you generated a pdf after the dvi, even if you quitted the pdf viewer and are now previewing the dvi. -- Enrico
Re: Forward/reverse searching problems under Windows (The Sequel)
On 05/22/2011 8:59 PM, Christopher Menzel wrote: > On 22/05/2011 7:07 PM, Christopher Menzel wrote: >> ...Yes, yes, that is exactly what I was looking for. The relevant >> debugging output appears to be this: >> >> ... >> The row information is indeed there. I do not know enough about LyX's >> internals to figure out from the rest of it why the forward search is >> still failing. > > Whoops, hang on, I had been doing a bit of experimenting with PDF output > and had deleted entry for a DVI viewer in Preferences -> Output -> > General. I've put the command for Yap back in and now, well, forward > search is now working. I am certain I had selected the built-in Yap > command when it was first failing, as I checked and double-checked > against the instructions, but perhaps I just had some sort of blind spot > (or, as I shall choose to believe, I inadvertently fixed something :-) . OK, things still aren't quite right but I think I've uncovered what might be the problem. As I note above, when I first set things up, I was certain I had selected the supplied Yap command for Preferences -> Output -> General. However, since I was only using Yap, I left the field for the PDF viewer blank. This led to the "Couldn't proceed" message when I invoked Forward Search. I have since added the supplied viewer command for SumatraPDF, even though I am only previewing with DVI, and now when I invoke Forward Search, I see the following error message: 13:00:31.093: The process failed to start. Either the invoked program is missing, or you may have insufficient permissions to invoke the program...\..\..\lyx-2.0.0\src\support\Systemcall.cpp(217): Systemcall: 'CMCDDE SUMATRA control [ForwardSearch("""Recombination.pdf""","""Recombination.tex""",84,0,0,1)]' did not start! ..\..\..\lyx-2.0.0\src\support\Systemcall.cpp(218): error The process failed to start. Either the invoked program is missing, or you may have insufficient permissions That is, LyX is calling the appropriate forward search command for a PDF preview document, not DVI. According to the documentation, this should not be happening: Forward search works both with DVI and PDF output. LyX simply checks which preview format you have used before (i.e., which format is already there in the temporary directory) and chooses the appropriate configuration for the respective format. I have checked the Temp directory LyX is using for my current document and there are no signs that I am using PDF there; there are only the output files you expect from using the latex command to generate a DVI file. I'm not sure why forward search started working properly for me last night -- something happened to enable LyX correctly to realize that I was doing a DVI preview -- but pretty clearly its invoking the forward search command appropriate for PDF instead of DVI is the reason why it wasn't working for me before and is not working again now. (The problem arises whether or not I use the synctex option.) Suggestions, as always, much appreciated. Chris Menzel