On Tue, May 22, 2007 at 09:20:33PM -0400, RGH wrote:
> Enrico Forestieri wrote:
> > On Tue, May 22, 2007 at 04:35:11PM -0400, Richard Heck wrote:
> >   
> >> So does this seem to be the pathname problem? You can run htlatex
> >> file.tex. Can you run htlatex path/file.tex? Can you run htlatex
> >> c:/path/file.tex? If you can run the former, this is fixable, because we
> >> can use the relative pathname.
> >>
> >> I'm not sure what to do about this. HTML View and Export have been
> >> broken for ages. They work now on Linux and (I believe) OSX. So one
> >> possibility, absent a fix for Windows, is to alter configure.py so it
> >> only installs the htlatex HTML converter on Linux. I suppose it could
> >> still check for html2latex. The other option would be to try to ship
> >> some python script or something that would fix the problem on Windows.
> >>     
> >
> > Notice that latex->html conversion works flawlessly for me with htlatex
> > on both Windows and *nix after simply removing the originaldir flag in
> > the converter. If I understand it correctly, your change would break the 
> > conversion on Windows?
> >   
> Sorry, but that can't be true. If you run htlatex without the 
> originaldir flag, then, yes, you will get an html file dumped into the 
> directory where the original LyX file lived. But you'll only get the one 
> HTML file, not the other files generated for footnotes, and not the css 
> file. There are several bug reports about that, and that's how the code 
> works: If you export html from myfile.lyx, the only file that gets 
> copied out of the temporary directory is myfile.html. You will have the 
> other files in the temporary directory, and you could copy them out 
> manually before closing LyX (at which point they'll be erased), but 
> that's not how export is supposed to work.

Yes, you're right. I wanted to say "almost" flawlessly and indeed I now
remember that I had to manually copy the needed files.

> That said, an option would be to omit the (new) usetempdir flag on 
> Windows. Then View>HTML would work, though export would work only 
> partially, as just described.

Unfortunately, htlatex on Windows only works when you call it with a
simple filename without a path (either absolute or relative), so the
tempdir approach will not work the way you thought it. However, thanks
to your patch, I modified my htlatex script (I attach it here) and now
I am able to both view and export to html.

I know that it is cumbersome, but may be the same logic could be adopted
in the LyX sources, i.e., take a snapshot of what files are present before
calling htlatex and then move any generated file in the conversion dir.
Anyway, the script works like a charm and could be translated in python
in order to use it in native Windows builds in place of htlatex.exe. 

-- 
Enrico
#!/bin/sh
# This is a wrapper script for LyX/Cygwin to let LyX use the native
# Windows' version of htlatex which is part of MikTeX.
#
# 2006-08-31 Enrico Forestieri
# =======================================================================

dir=`dirname "$1"`
bname=`basename "$1" .tex`
cd "$dir"
files=`ls | xargs echo | sed 's/ /\|/g'`
htlatex.exe "$bname.tex"
if [ -d "$bname.html.conversion" ]; then
    files="$files|$bname.html.conversion"
    ls | egrep -v "$files" | xargs -i%s mv %s "$bname.html.conversion"
fi

Reply via email to