Edit Links |
Tips /
ExportingRichTextFormatWithLaTeX2rtf
<< | Page list | >>
Use LaTeX2rtf to export Rich Text Format documents from within LyXEntry assembled by Dave Hewitt, but the knowledge was mostly from other people. LaTeX2rtf translates a LaTeX document into a Rich Text Format (RTF) document that can be opened and edited in word processors, including Microsoft Word and WordPad. If you need to share documents with folks that use such word processors and are (presumably) not familiar with the power of LyX, this translator is a good option. This explanation of how to get LaTeX2rtf working with LyX comes from experience with LyX 1.5.2 on WinXP (English). The homepage for LaTeX2rtf is here. You can download the latex2rtf-win-gui installer from SourceForge here. NOTE: LaTeX2rtf version 1.9.19 was released in late November 2007 and makes it much easier to get LaTeX2rtf working with LyX. (Many thanks to Wilfried Hennings and the LaTeX2rtf team!) See the first entry under Simplest Option below. If you had already set up LyX to work with a previous version of LaTeX2rtf, uninstall LaTeX2rtf, open LyX and remove the path to LaTeX2rtf from the PATH Prefix line in Tools -> Preferences -> Paths, close LyX, restart LyX, run Reconfigure (Tools -> Reconfigure), close LyX, and follow the instructions below for a fresh install of LaTeX2rtf. Table of contents (hide) 1. Simplest Option1.1 LaTeX2rtf Versions 1.9.19 and upDownload the latex2rtf-win-gui installer for LaTeX2rtf from the link above. Run the installer and accept the default installation directory - usually C:\Program Files\latex2rtf. Open LyX and add C:\Program Files\latex2rtf to the start of the PATH Prefix line in Tools -> Preferences -> Paths. Save your changes, close LyX, restart LyX, run Reconfigure (Tools -> Reconfigure), and restart again (yes, this seems redundant, but it's necessary). Once restarted (and when a document is open), LyX should display a Rich Text Format option in the File -> Export list and should indicate the Latex (plain) -> Rich Text Format converter in Tools -> Preferences -> Converters. Also, be sure to have a look at the description of the options in the LaTeX2rtf documentation. For example, you may or may not need the -S option, which is set in the converter entry by default (most LyX users in the US probably do not need this option). Also, starting with LaTeX2rtf version 1.9.19, the meaning of the -p option is reversed, so normally you should not set -p. You may want other options as well - e.g., equations are converted to EQ fields by default, but can alternatively be converted to bitmaps. You can edit the converter entry to remove or add options by: making changes, saving your changes by clicking Modify and then Save, closing LyX, restarting LyX, running Reconfigure (Tools -> Reconfigure), closing and restarting LyX again. 1.2 Older versions of LaTeX2rtfYou can SAVE YOURSELF SOME TROUBLE by installing the program in a folder l2r in the C:\ root directory - C:\l2r. Just specify that path in the appropriate place in the installer GUI when prompted to do so. Older versions of LaTeX2rtf defaulted to this directory when looking for configuration files, so it's a pain to get the program working with LyX when it's installed elsewhere (hence, the simplest option label). Once LaTeX2rtf is installed, open LyX and add C:\l2r to the start of the PATH Prefix line in Tools -> Preferences -> Paths. Save your changes, close LyX, restart LyX, run Reconfigure (Tools -> Reconfigure), and restart again (yes, this seems redundant, but it's necessary). Once restarted (and when a document is open), LyX should display a Rich Text Format option in the File -> Export list and should indicate the Latex (plain) -> Rich Text Format converter in Tools -> Preferences -> Converters. As noted above, be sure to have a look at the description of the options in the LaTeX2rtf documentation for the version you are installing. For example, you may or may not need the -S option, which is set in the converter entry by default (most LyX users in the US probably do not need this option). Prior to LaTeX2rtf version 1.9.19, you probably do want to retain the -p option. You may want other options as well - e.g., equations are converted to EQ fields by default, but can alternatively be converted to bitmaps. You can edit the converter entry to remove or add options by: making changes, saving your changes by clicking "Modify" and then "Save", closing LyX, restarting LyX, running Reconfigure (Tools -> Reconfigure), closing and restarting LyX again. 2. Not-so-Simple OptionIf you must install LaTeX2rtf to a folder other than C:\l2r (for versions prior to 1.9.19) or C:\Program Files\latex2rtf (for version 1.9.19 and up), here's a method for getting LyX to find the converter. First, you should have a good reason for doing this. The actual converter in LaTeX2rtf - latex2rt.exe - has to be able to find its configuration files. These are the files in the \cfg directory under the directory where you installed LaTeX2rtf. The default for the program is to search under the LaTeX2rtf root directory. The first thing to do is add the LaTeX2rtf root directory to the LyX 'PATH Prefix' as described above. You can then use the Converter specifications in LyX to specify the configuration directory... err... directly. For example, add -P /Progra~1/latex2rtf/cfg
to the Converter: line under the Latex (plain) -> Rich Text Format entry in Tools -> Preferences -> Converters. It should look like this: latex2rt -P /Progra~1/latex2rtf/cfg -S -o $$o $$i
This assumes that your current drive is C:. Note that Progra~1 is substituted for Program Files. This is the DOS path and is used to avoid having to put the path in quotes (used when spaces are present). LyX can't handle the quotes in the Converter entry. Also, starting with LaTeX2rtf 1.9.19 you can include the full path - C:\Progra~1\latex2rtf\cfg. [In older versions, the -P option was broken because the colon in the path was interpreted as an option delimiter.] As noted above, be sure to have a look at the description of the options in the LaTeX2rtf documentation for the version you are installing. For example, you may or may not need the -S option, which is set in the converter entry by default (most LyX users in the US probably do not need this option). Also, starting with LaTeX2rtf version 1.9.19, the meaning of the -p option [different from the -P /path/to/cfg option] is reversed, so normally you should not set -p. You may want other options as well - e.g., equations are converted to EQ fields by default, but can alternatively be converted to bitmaps. You can edit the converter entry to remove or add options by: making changes, saving your changes by clicking Modify and then Save, closing LyX, restarting LyX, running Reconfigure (Tools -> Reconfigure), closing and restarting LyX again. 3. Toughest Option (which I have not tried)You can also use a .BAT file to set RTFPATH and launch latex2rt.exe. See the mailing list archive and search for 'Exporting to Rich Text Format'. The October 2007 thread includes entries by Enrico Forestieri on the topic. 4. LinuxSince .rtf documents can be read by the likes of OpenOffice, latex2rtf is handy on Linux as well. Here, the installation seems somewhat straight-forward. As for Gentoo (with LyX 1.5.2 and TeXLive-2007), it goes like this:
Now the "Rich text format" should appear in File > Export. Just tried it and I liked the result. Seems that recent versions can do a decent conversion job. The thanks go to the developpers. For Ubuntu-based systems, and probably Debian, try:
5. OS Xlatex2rtf can be compiled from source.
I have found it works well but doesn't like centred images/tables in floats, so set them to default formatting. Otherwise, it is a very good converter. Installing from MacPorts is not recommended as the MacTex stack is a better implementation of TeX for OS X. 6. MiscellanyDid we mention that you should check the LaTeX2rtf documentation for the descriptions of the various options that can be used with the converter? If you use the converter from the command line, you'll also need to edit the .BAT files as described here. LyX knows nothing of these .BAT files, so editing them is unnecessary if you're just using LaTeX2rtf from within LyX. A GUI front-end for LaTeX2rtf (l2rshell.exe) is also installed with the program and a desktop icon will be installed to call that GUI. LyX interacts solely with the converter (latex2rt.exe), so you may never need that GUI front-end. It can be used to convert LaTeX files (.tex) to RTF files manually. The Rich Text Format option (and others) will disappear from the File/Export list if the file's Document > Settings... > Fonts > "Use non-TeX fonts" is checked. Category: Tips Windows Rich Text Format latex2rtf Tag me |