Re: Exporting to Rich Text Format with latex2rtf, issues and a fix

2007-11-29 Thread Wilfried
David Hewitt <[EMAIL PROTECTED]> wrote:

> Thanks for alerting this list Wilfried. I just dumped my old version,
> reinstalled, and everything worked just as you indicated. I noticed that you
> edited the Wiki a bit... I went ahead and fleshed it out for pre- and post-
> 1.9.19 versions. Let me know if you see anything that's incorrect:
> 
> http://wiki.lyx.org/Tips/ExportingRichTextFormatWithLaTeX2rtf

Excellent!
I see nothing which needs to be added or modified,
and I couldn't have described it better.





Re: Exporting to Rich Text Format with latex2rtf, issues and a fix

2007-11-28 Thread David Hewitt


Wilfried-5 wrote:
> 
> Hello all,
> we just finished a new release of the latex2rtf converter.
> It is available from http://sourceforge.net/projects/latex2rtf
> 
> The package "latex2rtf-win-gui" contains the latex2rtf program
> plus a Graphical User Interface (GUI) and an automatic installer.
> It works for Win NT, 2000, XP, 2003, and Vista.
> 
> If you have Win 9x or ME, this package will not work.
> For these systems, get the "latex2rtf-win" package 
> (without GUI and installer). 
> It works for Win 9x, ME, NT, 2000, XP, 2003, and Vista.
> 
> The program will now also search for its cfg files in the latex2rtf
> folder under the standard Windows "Program Files" folder (i.e. the
> folder which is specified by %ProgramFiles%\latex2rtf), so it will also
> be happy if installed in the default location chosen by the installer.
> Nevertheless its install folder must be the first in the search path
> when the program is run, so one must add this path in Lyx in the 'PATH
> Prefix' line in Tools -> Preferences -> Paths.
> 
> Also, the broken -P option (for specifying the path to the .cfg files if
> not installed in the default folder) is now fixed. (The option was
> "broken" because a ":" was interpreted as an option delimiter, so that
> specifying "C:\Progra~1\latex2rtf" was not possible.)
> 

Thanks for alerting this list Wilfried. I just dumped my old version,
reinstalled, and everything worked just as you indicated. I noticed that you
edited the Wiki a bit... I went ahead and fleshed it out for pre- and post-
1.9.19 versions. Let me know if you see anything that's incorrect:

http://wiki.lyx.org/Tips/ExportingRichTextFormatWithLaTeX2rtf


-
David Hewitt
Virginia Institute of Marine Science
http://www.vims.edu/fish/students/dhewitt/
-- 
View this message in context: 
http://www.nabble.com/Re%3A-Exporting-to-Rich-Text-Format-with-latex2rtf%2C-issues-and-a-fix-tf4888432.html#a14006789
Sent from the LyX - Users mailing list archive at Nabble.com.



Re: Exporting to Rich Text Format with latex2rtf, issues and a fix

2007-11-28 Thread Wilfried
Hello all,
we just finished a new release of the latex2rtf converter.
It is available from http://sourceforge.net/projects/latex2rtf

The package "latex2rtf-win-gui" contains the latex2rtf program
plus a Graphical User Interface (GUI) and an automatic installer.
It works for Win NT, 2000, XP, 2003, and Vista.

If you have Win 9x or ME, this package will not work.
For these systems, get the "latex2rtf-win" package 
(without GUI and installer). 
It works for Win 9x, ME, NT, 2000, XP, 2003, and Vista.

The program will now also search for its cfg files in the latex2rtf
folder under the standard Windows "Program Files" folder (i.e. the
folder which is specified by %ProgramFiles%\latex2rtf), so it will also
be happy if installed in the default location chosen by the installer.
Nevertheless its install folder must be the first in the search path
when the program is run, so one must add this path in Lyx in the 'PATH
Prefix' line in Tools -> Preferences -> Paths.

Also, the broken -P option (for specifying the path to the .cfg files if
not installed in the default folder) is now fixed. (The option was
"broken" because a ":" was interpreted as an option delimiter, so that
specifying "C:\Progra~1\latex2rtf" was not possible.)

Regards,




Re: Exporting to Rich Text Format with latex2rtf, issues and a fix

2007-10-28 Thread Dave Hewitt

Thanks Enrico. Wiki entry was changed to reflect this.

Dave Hewitt writes:

> >This works, try it. So, you could install to "C:\Program Files\latex2rtf"
> >and then
> >1) add "C:\Program Files\latex2rtf" to PATH prefix
> >2) add -P "/Program Files/latex2rtf/cfg" to the latex2rtf converter entry
> >in the LyX preferences
> >
> >or use a .bat file for setting RTFPATH and launching latex2rt, as I
> >outlined in an other post.
> >
> >All in all, installing latex2rtf to C:\l2r maybe the best option.
>
> I agree with this last statement, but although I didn't test it... your
> 2-part process for making it work if installed elsewhere seems easy enough.
> Perhaps we could post both options.

However, it is better using the dos short form of the path,
i.e., -P /Progra~1/latex2rtf/cfg, in order to avoid the quotes.
This is because the LyX parser is not able to cope with them and
goes bersek when you save the preferences and then restart LyX.

--
Enrico



Re: Exporting to Rich Text Format with latex2rtf, issues and a fix

2007-10-28 Thread Enrico Forestieri
Dave Hewitt writes:

> >This works, try it. So, you could install to "C:\Program Files\latex2rtf"
> >and then
> >1) add "C:\Program Files\latex2rtf" to PATH prefix
> >2) add -P "/Program Files/latex2rtf/cfg" to the latex2rtf converter entry
> >in the LyX preferences
> >
> >or use a .bat file for setting RTFPATH and launching latex2rt, as I
> >outlined in an other post.
> >
> >All in all, installing latex2rtf to C:\l2r maybe the best option.
> 
> I agree with this last statement, but although I didn't test it... your 
> 2-part process for making it work if installed elsewhere seems easy enough. 
> Perhaps we could post both options.

However, it is better using the dos short form of the path,
i.e., -P /Progra~1/latex2rtf/cfg, in order to avoid the quotes.
This is because the LyX parser is not able to cope with them and
goes bersek when you save the preferences and then restart LyX.

-- 
Enrico



Re: Exporting to Rich Text Format with latex2rtf, issues and a fix

2007-10-27 Thread Dave Hewitt



Dave Hewitt writes:

> All I did was:
>
> (1) uninstall latex2rtf (to remove all my edited files), remove C:\l2r and
> C:\Program Files\LyX 1.5.2 from my Windows search path, then reconfigure
> LyX (RTF export disappeared)
>
> (2) reinstall latex2rtf to C:\l2r, put C:\l2r on the search path again,
> start LyX, reconfigure, and restart LyX -> LyX FAILS to find the converter

If you mean that you added C:\l2r to "PATH prefix" in LyX preferences
and then reconfigured, then this is explained by the fact that changes
to "PATH prefix" are only taken after you save preferences and close and
restart LyX.


To be perfectly honest, I didn't realize that LyX had a 'PATH Prefix' list 
in Preferences. I was adding the paths to the Windows Environment Variable 
'Path'. Apparently these two alternatives do the same thing, as I removed 
C:\l2r from the path in the Win environment and added it to LyX Path 
Prefix, restarted, reconfigured, restarted again, and all works as before.




> (3) close LyX, restart LyX, reconfigure again, close and restart LyX ->
> WORKS FINE

Yes, because now the previously set "PATH prefix" is taken into account.


Got it. This is the only thing that needs done apparently, and is probably 
better on the system than adding to the Win environment. I'm not a 
developer or programmer, so I don't know any more about this.




> I did steps 1-3 three times and it works that way every time... the only
> thing you need to do apparently is reconfigure LyX TWICE after installing
> latex2rtf and adding the folder to the search path.

No, you need to close and restart LyX after adding the folder to
"PATH prefix". Otherwise, the "PATH prefix" as set at LyX start
is still used, no matter that you changed it.

> (I closed and restarted
> LyX between reconfigurations, but I don't know that that matters). I still
> think it's simplest to just install latex2rtf to C:\l2r. There may be 
other

> complications if you install elsewhere, but I didn't test that.

If you install to C:\l2r, you only need to add C:\l2r to "PATH prefix".
If you install latex2rtf somewhere else, you have to specify where its
config directory is. There are no other complications.


Wow, this is simple. Should we put a single entry on the Wiki about this 
even though it is so simple?




> Enrico, I think that l2rprep.bat is intended to do the same thing you
> proposed with the new .bat file - set rtfpath. No? Either way, it seems
> only relevant when the .bat files are being called... and (again, see
> below) I think Wilfried indicates that they are not when LyX calls 
latex2rt

> (.exe).

l2rprep.bat simply sets up the correct environment for latex2rtf but
does not launch latex2rtf itself. You don't need it, as you already have
the correct environment set when using LyX, except for RTFPATH if you
don't install to C:\l2r.

Note that you could also specify the config directory through a
command line option. Suppose that you installed latex2rtf to
"C:\Program Files\latex2rtf", then you could simply use something like:

latex2rt -P "C:/Program Files/latex2rtf/cfg" -p -S -o file.rtf file.tex

but the -P option is broken and doesn't work. I think that it is due
to the fact that a path which does not begin with / is not recognized
as being absolute and is thus refused. However, if your current drive
is C:, you can omit it and use instead:

latex2rt -P "/Program Files/latex2rtf/cfg" -p -S -o file.rtf file.tex

This works, try it. So, you could install to "C:\Program Files\latex2rtf"
and then
1) add "C:\Program Files\latex2rtf" to PATH prefix
2) add -P "/Program Files/latex2rtf/cfg" to the latex2rtf converter entry
   in the LyX preferences

or use a .bat file for setting RTFPATH and launching latex2rt, as I
outlined in an other post.

All in all, installing latex2rtf to C:\l2r maybe the best option.


I agree with this last statement, but although I didn't test it... your 
2-part process for making it work if installed elsewhere seems easy enough. 
Perhaps we could post both options.




Dave



Re: Exporting to Rich Text Format with latex2rtf, issues and a fix

2007-10-26 Thread Wilfried Hennings
Dave Hewitt <[EMAIL PROTECTED]> writes:

> Questions/comments inserted in Wilfried's comments below...
> 
> So does this means that LyX doesn't need to know about the .bat files? It 
> looks like all that LyX is doing is calling the latex2rt (.exe file) to get 
> the conversion. Right?

You could merge l2rprep.bat into l2r.bat so that first the path is set and then 
latex2rt.exe is called, and tell Lyx to call this batch file instead of calling 
teh latex2rt.exe. 
But I think as Lyx has a method for setting the pathes itself, I would prefer 
letting Lyx so it.

> >
> > > 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.
> 
> Apparently this is correct. I was thinking that since LyXWinInstaller had 
> installed the ImageMagick and Ghostscript stuff to C:\PF\LyX\etc that 
> latex2rtf would need help finding those. I opened the GUI shell and noticed 
> that it found those files without aid (in the latex2rtf Environment tab; it 
> must have found them from the registry). So presumably latex2rt knows where 
> they are as well, somehow.

No, the latex2rt.exe does NOT know this, it must rely on the setting of PATH 
and RTFPATH. latex2rt.exe is not able to look in the registry, as the GUI is.

Wilfried



Re: Exporting to Rich Text Format with latex2rtf, issues and a fix

2007-10-25 Thread Enrico Forestieri
Dave Hewitt writes:

> All I did was:
> 
> (1) uninstall latex2rtf (to remove all my edited files), remove C:\l2r and 
> C:\Program Files\LyX 1.5.2 from my Windows search path, then reconfigure 
> LyX (RTF export disappeared)
> 
> (2) reinstall latex2rtf to C:\l2r, put C:\l2r on the search path again, 
> start LyX, reconfigure, and restart LyX -> LyX FAILS to find the converter

If you mean that you added C:\l2r to "PATH prefix" in LyX preferences
and then reconfigured, then this is explained by the fact that changes
to "PATH prefix" are only taken after you save preferences and close and
restart LyX.

> (3) close LyX, restart LyX, reconfigure again, close and restart LyX -> 
> WORKS FINE

Yes, because now the previously set "PATH prefix" is taken into account.

> I did steps 1-3 three times and it works that way every time... the only 
> thing you need to do apparently is reconfigure LyX TWICE after installing 
> latex2rtf and adding the folder to the search path.

No, you need to close and restart LyX after adding the folder to
"PATH prefix". Otherwise, the "PATH prefix" as set at LyX start
is still used, no matter that you changed it.

> (I closed and restarted 
> LyX between reconfigurations, but I don't know that that matters). I still 
> think it's simplest to just install latex2rtf to C:\l2r. There may be other 
> complications if you install elsewhere, but I didn't test that.

If you install to C:\l2r, you only need to add C:\l2r to "PATH prefix".
If you install latex2rtf somewhere else, you have to specify where its
config directory is. There are no other complications.

> Enrico, I think that l2rprep.bat is intended to do the same thing you 
> proposed with the new .bat file - set rtfpath. No? Either way, it seems 
> only relevant when the .bat files are being called... and (again, see 
> below) I think Wilfried indicates that they are not when LyX calls latex2rt 
> (.exe).

l2rprep.bat simply sets up the correct environment for latex2rtf but
does not launch latex2rtf itself. You don't need it, as you already have
the correct environment set when using LyX, except for RTFPATH if you
don't install to C:\l2r.

Note that you could also specify the config directory through a
command line option. Suppose that you installed latex2rtf to
"C:\Program Files\latex2rtf", then you could simply use something like:

latex2rt -P "C:/Program Files/latex2rtf/cfg" -p -S -o file.rtf file.tex

but the -P option is broken and doesn't work. I think that it is due
to the fact that a path which does not begin with / is not recognized
as being absolute and is thus refused. However, if your current drive
is C:, you can omit it and use instead:

latex2rt -P "/Program Files/latex2rtf/cfg" -p -S -o file.rtf file.tex

This works, try it. So, you could install to "C:\Program Files\latex2rtf"
and then
1) add "C:\Program Files\latex2rtf" to PATH prefix
2) add -P "/Program Files/latex2rtf/cfg" to the latex2rtf converter entry
   in the LyX preferences

or use a .bat file for setting RTFPATH and launching latex2rt, as I
outlined in an other post.

All in all, installing latex2rtf to C:\l2r maybe the best option.

-- 
Enrico



Re: Exporting to Rich Text Format with latex2rtf, issues and a fix

2007-10-25 Thread Dave Hewitt
Wilfried, thanks a lot for your input. This was just a novice hackjob that 
worked, and my goal (as stated at the end) was to get a solid working 
solution that could be placed on the LyX wiki. I admit lots of ignorance on 
all of this.


Nonetheless, I figured that since I started this I should try and finish 
it. So, I began by working on Enrico's suggested solution... but I found 
out it's all much easier than that.


All I did was:

(1) uninstall latex2rtf (to remove all my edited files), remove C:\l2r and 
C:\Program Files\LyX 1.5.2 from my Windows search path, then reconfigure 
LyX (RTF export disappeared)


(2) reinstall latex2rtf to C:\l2r, put C:\l2r on the search path again, 
start LyX, reconfigure, and restart LyX -> LyX FAILS to find the converter


(3) close LyX, restart LyX, reconfigure again, close and restart LyX -> 
WORKS FINE


I did steps 1-3 three times and it works that way every time... the only 
thing you need to do apparently is reconfigure LyX TWICE after installing 
latex2rtf and adding the folder to the search path. (I closed and restarted 
LyX between reconfigurations, but I don't know that that matters). I still 
think it's simplest to just install latex2rtf to C:\l2r. There may be other 
complications if you install elsewhere, but I didn't test that.


This strikes me as weird. Does LyX do this for other converters... how does 
configure behave differently between successive calls? Can anyone else try 
this and see if they repeat it?


Anyway, apparently all of my problems with the configuration files (the 
.bat's) were a waste of time - the second time I reconfigured LyX it worked 
despite all of that. As Wilfried noted, I think (see below), those files 
are irrelevant to LyX's use of the converter (latex2rt.exe) and the GUI shell.


Remaining question:

Enrico, I think that l2rprep.bat is intended to do the same thing you 
proposed with the new .bat file - set rtfpath. No? Either way, it seems 
only relevant when the .bat files are being called... and (again, see 
below) I think Wilfried indicates that they are not when LyX calls latex2rt 
(.exe).


Questions/comments inserted in Wilfried's comments below...


> 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.

Well, as the one who makes the DOS/Win port of latex2rtf, I can explain 
why it

is as is and why some thing work and others not. See below.

> 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.

What do you mean by "configuration files"?
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.


I was referring to the .bat files, without knowing what they really did. My 
fault.


So does this means that LyX doesn't need to know about the .bat files? It 
looks like all that LyX is doing is calling the latex2rt (.exe file) to get 
the conversion. Right?



> So,
> make your life easy and install to C:\l2r. I never checked this with the
> latex2rtf fo

Re: Exporting to Rich Text Format with latex2rtf, issues and a fix

2007-10-25 Thread Wilfried Hennings
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.

Well, as the one who makes the DOS/Win port of latex2rtf, I can explain why it 
is as is and why some thing work and others not. See below.

> 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. 

What do you mean by "configuration files"?
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. 


> 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).
> 
> L2R and L2RSEM are almost identical, but notice that one of them (don't 
> recall which, I changed it), on line 15, has the German windows settings 
> line unremarked. The other one has the English windows settings unremarked. 
> I changed them both to have the English settings unremarked (i.e., 
> functional) and the German settings remarked (i.e., unfunctional). I didn't 
> actually test whether this mattered, but it seemed prudent. The paths 
> should all be fine if you installed to C:\l2r and you need do nothing more 
> with these files.
> 
> 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.

> So, I edited it to look as below (changes starting on line 8). 
> Again, this applies for people that use LyXWinInstaller only.
> 
> rem set folder containing Ghostscript executables here:
> %l2rpath%\which gswin32c >nul
> if errorlevel 1 SET PATH="C:\Program Files\LyX 
> 1.5.2\etc\Ghostscript\bin";"C:\Program Files\LyX 
> 1.5.2\etc\Ghostscript\lib";%PATH%
> 
> rem set folder containing ImageMagick executables here:
> %l2rpath%\which identify >nul
> if errorlevel 1 SET PATH="C:\Program Files\LyX 1.5.2\etc\ImageMagick";%PATH%
> 
> rem set folder containing LaTeX and dvips executables here:
> %

Re: Exporting to Rich Text Format with latex2rtf, issues and a fix

2007-10-25 Thread Juergen Spitzmueller
Andre Poenitz wrote:

> Maybe you could add that to the wiki...

Yes, please.

Jürgen



Re: Exporting to Rich Text Format with latex2rtf, issues and a fix

2007-10-24 Thread Enrico Forestieri
Dave Hewitt writes:

> Over the past few days I've struggled to get LyX 1.5.2 on WinXP to 
> recognize and use latex2rtf for Rich Text Format exports. Jurgen suggested 
> this to someone and it was a tool I needed, so I gave it a shot. The 
> process was beset by many troubles, and now that I finally have it working, 
> I describe it here to help other users on WinXP that need a way of sharing 
> documents with the underclass that use M$ products (hat tip to Paul). 
> Jurgen helped me a LOT along the way.

The problem here is that the option -P for specifying the config directory
to latex2rtf is broken on Windows. However, the RTFPATH variable works,
so a simpler option is creating a latex2rtf.bat file as follows:

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

You only need installing latex2rtf, starting LyX and reconfigure.
Then, go to Tools->Preferences->Converters and modify the entry
for the LaTeX to Rich Text Format converter changing latex2rt
into latex2rtf. Note that this last step is only necessary because
the configure.py script is braindead and simply checks for the
existence of program or program.exe, but not for program.bat, or
program.cmd, or ... (sigh).

-- 
Enrico



Re: Exporting to Rich Text Format with latex2rtf, issues and a fix

2007-10-24 Thread Andre Poenitz
On Wed, Oct 24, 2007 at 05:26:19PM -0400, Dave Hewitt wrote:
> Over the past few days I've struggled to get LyX 1.5.2 on WinXP to 
> recognize and use latex2rtf for Rich Text Format exports. Jurgen suggested 
> this to someone and it was a tool I needed, so I gave it a shot. The 
> process was beset by many troubles, and now that I finally have it working, 
> I describe it here to help other users on WinXP that need a way of sharing 
> documents with the underclass that use M$ products (hat tip to Paul). 
> Jurgen helped me a LOT along the way.
> [...]

Maybe you could add that to the wiki...

Andre'


Exporting to Rich Text Format with latex2rtf, issues and a fix

2007-10-24 Thread Dave Hewitt
Over the past few days I've struggled to get LyX 1.5.2 on WinXP to 
recognize and use latex2rtf for Rich Text Format exports. Jurgen suggested 
this to someone and it was a tool I needed, so I gave it a shot. The 
process was beset by many troubles, and now that I finally have it working, 
I describe it here to help other users on WinXP that need a way of sharing 
documents with the underclass that use M$ products (hat tip to Paul). 
Jurgen helped me a LOT along the way.


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. 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).


L2R and L2RSEM are almost identical, but notice that one of them (don't 
recall which, I changed it), on line 15, has the German windows settings 
line unremarked. The other one has the English windows settings unremarked. 
I changed them both to have the English settings unremarked (i.e., 
functional) and the German settings remarked (i.e., unfunctional). I didn't 
actually test whether this mattered, but it seemed prudent. The paths 
should all be fine if you installed to C:\l2r and you need do nothing more 
with these files.


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. So, I edited it to look as below (changes starting on line 8). 
Again, this applies for people that use LyXWinInstaller only.



rem set folder containing Ghostscript executables here:
%l2rpath%\which gswin32c >nul
if errorlevel 1 SET PATH="C:\Program Files\LyX 
1.5.2\etc\Ghostscript\bin";"C:\Program Files\LyX 
1.5.2\etc\Ghostscript\lib";%PATH%


rem set folder containing ImageMagick executables here:
%l2rpath%\which identify >nul
if errorlevel 1 SET PATH="C:\Program Files\LyX 1.5.2\etc\ImageMagick";%PATH%

rem set folder containing LaTeX and dvips executables here:
%l2rpath%\which latex >nul
if errorlevel 1 SET PATH="C:\Program Files\MiKTeX 2.6\miktex\bin";%PATH%


The final "set l2rpath=" line appears superfluous, but it doesn't stop 
things from working.


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 confound