Andreas Karlsson <[EMAIL PROTECTED]> writes:

> 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 the one who makes the DOS/Win port, I try to explain some things, see below.

Dave Hewitt <[EMAIL PROTECTED]> writes:

> Ideally, one would simply:
> 
> (1) install latex2rtf from sourceforge (win-gui download here - 
> http://sourceforge.net/project/showfiles.php?group_id=22654)
> (2) add the latex2rtf folder (C:\l2r -- see below) to the Windows search 
> path (see section 2.4 here - 
> http://sourceforge.net/project/showfiles.php?group_id=22654)
> (3) open LyX, reconfigure, close, and restart
> 
> and the converter for Latex (plain) -> Rich Text Format would be sorted out 
> by LyX and a Rich Text Format option would be made available under File -> 
> Export.
> 
> Unfortunately, it ain't that easy.
> 
> First off, the above strategy works fine if all you want to do is use the 
> latex2rtf GUI (l2rshell.exe; the icon on the desktop calls this) to convert 
> existing .tex files to .rtf files. In fact, you only need (1) and (2) above 
> for that, and then you just export plain latex from LyX and run the 
> conversion manually. Getting LyX to recognize the converter (latex2rt.exe) 
> is the hard part, but it's nice to have LyX do all the work behind the scenes.
> 
> The first issue is that you should simply avoid installing the program 
> anywhere but C:\l2r. All of the defaults for the program assume that it is 
> installed at this path. I installed to Program Files because I had not read 
> section 2.4 here - 
> http://sourceforge.net/project/showfiles.php?group_id=22654 - first. It 
> explains how to adjust the three configuration files (more on these in a 
> minute) to make latex2rtf work from any installation path, but it never 
> worked for me, and I tried a lot of different things. No matter what I 
> tried, running LyX from the command prompt showed that the error was that 
> latex2rtf could not find its config directory (the cfg directory under the 
> latex2rtf root directory). It always assumed that the root directory was 
> C:\l2r despite the fact that all entries in the configuration files were 
> adjusted to reflect "C:\Program Files\latex2rtf", where I installed it. 

Adapting the pathes in the batch files (l2rprep.bat, l2r.bat) only helps if 
these batch files are executed. If you just call latex2rt.exe, they aren't.
The configuration of the GUI shell is used only by the GUI shell. latex2rt.exe 
itself knows nothing of the GUI shell nor of the batch files. 

There is no easy solution because on English and US Windows, the programs 
folder is "C:\Program Files\" while e.g. on German Windows it's "C:\Programme", 
and under DOS there is no programs folder at all. So the default is C:\l2r, 
whereas the GUI installer can check for the entry in the windows registry and 
install itself in the programs folder however it is named.

> So, 
> make your life easy and install to C:\l2r. I never checked this with the 
> latex2rtf folks, but the simple solution seems to be obvious.
> 
> Next, you do need to add the latex2rtf folder to the Windows search path:
> 
> a. Right-click My Computer and go to Properties.
> b. Advanced Tab -> Environment Variables -> System Variables -> Path, add 
> "C:\l2r;" (no quotes) somewhere in the line.
 
> The next step varies depending on how you have LaTeX set up on your 
> machine. I used the LyXWinInstaller and this presents a new wrinkle for 
> latex2rtf.
> 
> Those three configuration files (.bat files) are in the latex2rtf root and 
> are L2R.BAT, L2RSEM.BAT, and L2RPREP.BAT. You'll need to edit them (use a 
> good text editor; i.e., not Notepad).
> ...
> At this point, I tried reconfiguring LyX and it still failed to find the 
> converter.
> 
> L2RPREP comes in - this is a bit tougher. I ran this file from a command 
> prompt to see that it set the paths correctly. As best I could tell, 
> "which" always failed to find the Ghostscript, LaTeX, and ImageMagick 
> files. 

That is OK. Which only looks in the current search path. If the Ghostscript, 
LaTeX or ImageMagick folders isn't yet in the PATH, which returns "1". Calling 
"which" is intended to avoid adding the folders to the path more than once.
But if these folders are already defined systemwide (by
a. Right-click My Computer and go to Properties.
b. Advanced Tab -> Environment Variables -> System Variables -> Path )
l2rprep is only needed for setting RTFPATH.
If you go this far, I recommend you also add the variable RTFPATH to the 
systemwide settings:
a. Right-click My Computer and go to Properties.
b. Advanced Tab -> Environment Variables -> System Variables 
c. "New" 
 name: RTFPATH 
 value: C:\Program Files\latex2rtf\cfg
or, if you installed it in C:\l2r
 value: C:\l2r\cfg

> So, I edited it to look as below (changes starting on line 8). 
> Again, this applies for people that use LyXWinInstaller only.
> ...
> The final "set l2rpath=" line appears superfluous, but it doesn't stop 
> things from working.

It removes the environment variable "l2rpath" which is only temporarily used in 
l2rprep.bat and without this command would remain defined and use up some of 
the (under DOS, Win95, -98, -ME limited) environment space.

> I also added "C:\Program Files\LyX 1.5.2;" (no quotes) to the Windows 
> search path. In my inexperienced mind this was to help "which" find the 
> above files, but I also edited the L2RPREP before reconfiguring LyX, so 
> these events are confounded when it comes to success/failure. Basically, 
> I'm not sure that this addition to the search path was necessary.

No, most probably the folder "C:\Program Files\LyX 1.5.2" does not contain any 
of the files needed by latex2rtf.
 
> At this point, reconfiguring LyX and restarting finds the converter, which 
> appears in Tools -> Preferences -> Converters as Latex (plain) -> Rich Text 
> Format with the converter as:
> 
> latex2rt -p -S -o $$o $$i
> 
> The option shows up in Export and works fine.

It works only if the pathes set by l2rprep.bat are set permanently in the 
windows environment OR if Lyx calls l2rprep.bat before calling latex2rt OR if 
Lyx has some other way to set the PATH before calling latex2rt.

If you open a command prompt, run l2rprep and close the command prompt, all the 
additions to the PATH done in l2rprep are gone. They are available only in this 
command prompt and in processes started from this command prompt. If you call 
Lyx from within this command prompt, calling latex2rtf may work. If you call 
Lyx via its start menu or desktop icon, calling latex2rtf won't work unless the 
pathes to latex2rt.exe, Ghostscript, etc. are added system-wide, as described 
in the latex2rtf documentation.
 
> For anyone with more experience with this, I'd appreciate knowing what I 
> did was necessary/unnecessary and any thoughts on the matter. Perhaps we 
> can put a final version without errors and unnecessary steps on the wiki.

I hope to have clarified some things.


Reply via email to