On Thu, Oct 25, 2007 at 10:43:27AM +0200, Andreas Karlsson wrote:
> 
> Considering the difficulties to install latex2rtf and get it to
> work from inside LyX (see below), wouldn't it be a good idea to
> handle latex2rtf like e.g. the Aspell dictionaries, i.e.
> automatically download, install and configure it during the
> installation process, if the user selects this option?

As I already wrote to the users' list, the problem reported by
Dave is due to the fact that the latex2rtf option for specifying
the config directory is broken on Windows.

On Windows, latex2rtf is compiled with the hardcoded path "C:/l2r/cfg"
for the config directory. However, the installer offers by default
to install the program in "C:/Program Files/latex2rtf" (sic!).

There are two ways for specifying the config directory, the first
one is using the -P flag but it is broken (more below), the second
one is using the env variable RTFPATH and this method works.

Thus, an easy workaround is creating a latex2rtf.bat files containing:

@echo off
set RTFPATH=C:/Program Files/latex2rtf/cfg
latex2rt %*

and putting it in the PATH. If the configure.py script was not
braindead, one would simply need to reconfigure LyX and voilĂ ,
latex2rtf would work. This is because configure.py checks first
for latex2rtf and then for latex2rt (this is the name of the executable
on Windows). However, configure.py does not check for the existence
of an executable whose name is "program" but for files in the PATH
whose name is either "program" or "program.exe".
On Windows, you can invoke "program" and an executable whose name
is "program" and whose extension is contained in the PATHEXT env
variable gets executed. On a stock Windows installation, this is the
content of PATHEXT:

C:\> echo %PATHEXT%
.COM;.EXE;.BAT;.CMD;.VBS;.JS;.JSE;.WSF;.WSH;.MSC

Due to the aforementioned braindeadness, one needs changing in the
preferences the name of the latex2rtf executable from "latex2rt"
to "latex2rtf" in order to be able to use the batch file.

Another option is using a workaround for the broken -P option.
If one specifies -P "C:/Program Files/latex2rtf/cfg", the path
is not taken into account because the check to assure that it
is an absolute path fails due to the fact that only *nix paths
are considered. However, if LyX and latex2rtf are both installed
on the same drive, one can instead use -P "/Program Files/latex2rtf/cfg"
and this works. So, the other option is simply adding the above
flag to the converter command in preferences.

In conclusion, both configure.py (IMO) and latex2rtf need to be fixed.
Doing that, using latex2rtf on Windows will be quite simple.

-- 
Enrico

Reply via email to