[l2h] Problem with LaTeX2html/MikTeX

Igor Pechtchanski pechtcha at cs.nyu.edu
Wed Jul 20 02:04:39 CEST 2005


On Wed, 20 Jul 2005, Ross Moore wrote:

> Hi Igor and Andrew,
>
> On 20/07/2005, at 8:35 AM, Igor Pechtchanski wrote:
>
> > On Tue, 19 Jul 2005, Andrew McArdle wrote:
>
> > >
> > > 'I:\Program' is not recognized as an internal or external command,
> > > operable program or batch file.
> > >
> > > Cannot read logfile './images.log': No such file or directory
> > >
> > > I:\Andrew\University\Pathology\Project\Write-up\LaTeX>
> > > </CMD.EXE>
> >
> > Looks like an unquoted system() call inside latex2html.  Running in
> > debug mode should show which exact command fails.
>
> Yes, this looks like the start of the directory name:   \Program Files .
>
> > > I made sure that the cfgcache.pm and prefs.pm files contained only
> > > I:\progra~1 instead of the full path beforehand, so this isn't the cause
> > > of
>
> I doubt that would work.
>
> > > the error. I have also searched for any mention of "I:\program" or
> > > "I:\\program" in the latex2html directory and have found nothing.
> >
> > Check your environment variables as well.
>
> Yep.  Check the values of   $LATEX,  $DVIPS,  etc.
>
> > > Can anyone suggest where this error comes from: is it trying to find
> > > Ghostscript or some LaTeX-related files? I looked for all mentions of
> > > system or exec in the perl file, in the hope that I could fix the error
> > > by double-quoting any paths, but that led me nowhere, so I am a bit
> > > stuck! Any help you can give would be appreciated.
> >
> > As far as I can see, latex2html mostly uses L2hos->syswait(...) to make
> > system calls (which, on Win32, simply runs system(...)).  Search for all
> > occurrences of those -- there are quite a few unquoted invocations of,
> > say, $LATEX.
>
> What is the correct way to quote this under Windows ?
> Does it change with different versions of the OS ?

Ross,

Simply quoting the value of "$LATEX" in the system call might do it.
FWIW, the same problem would arise on Linux if latex were installed in a
directory with a space in its name (spaces aren't as common on Linux, but
a space is a valid filename character -- in fact, Linux has more valid
filename characters than Windows does).

> Surely this problem is best fixed by adding the appropriate quoting in
> the definition of the variables at installation time.

Maybe.  It might be better to quote them during the system() calls, at
least the values that come from the environment, but see the caveat below.

> Alternatively, the   L2hos->syswait(...)   for DOS/Windows can be modified
> to search for the particular string "Program Files"  (case-insensitively)
> and then quote those parts of the command that match.

Ugh.  No.  "Program Files" isn't the only commonly found directory that
contains spaces ("Documents and Settings" comes to mind, but there are
others, too).

IMO, it's better to add double quotes around any variable definition that
expands to a program (which may be in a directory that contains spaces).
This should still work on Linux.

> Since I don't normally use Windows, at least not for programming, I
> really don't know the correct syntax to use, so as to fix it in the
> LaTeX2HTML code-base.
>
> Would someone please provide the details that I'll need.

The correct fix would be to place the double quotes properly in the
system()/syswait() calls.  The only caveat is that you'll need to watch
out for variables that may expand to a command with parameters, and only
quote the command (e.g., $sh="sh -x"; system("$sh -c 'hello'"); ).

> > > Am I even looking in the right place to convert LaTeX to a Word
> > > document? I have seen some Word document converters, but I suspect the
> > > latex2html converter will cope better with the use of packages and
> > > commands etc. Am I right?
> >
> > I've used ltx2rtf, with reasonable success, but that was on a
> > non-math-heavy file.  YMMV.
>
> There is also  TeX4ht,  to produce HTML.
> It used to be that LaTeX2HTML results were cleaner,
> but that may well have changed over the past few years.

HTH,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha at cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor at watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. /DA



More information about the latex2html mailing list