[OS X TeX] latex2rtf: A developer's perspective

Thomas Schröder hydrochlorix at gmx.net
Thu Apr 22 10:07:31 EDT 2004


Am 21.04.2004 um 20:25 schrieb Scott Prahl:

Hi Scott,

> As everyone realizes, the issue of living in a world dominated by
> Microsoft Word makes these types of conversions mandatory from time
> to time.

You said it.

> The first thing that you must accept when converting from latex to
> RTF is that the document will not be as nice as the latex document.

I don't really think that this would be necessary, really. Editable 
output is much more important IMO. If you want to exchange some of your 
work for a paper then the layout is going to be changed according to 
the journal's preferences anyway.

> RTF is a limited mark-up language and Word has some pretty horrible
> typesetting limitations.  If you wanted fidelity, you would have
> opted to convert to PDF in the first place, right?

Exactly.

> Another disadvantage of trying to convert high level latex commands
> is when someone (or some package) tries to change low level latex
> or tex commands.  Something like TeX4ht is perfectly suited for this
> since it works at a very low level and can handle redefinitions quite
> well.  On the other hand, if you want editable equations in Word,
> then the latex -> html -> word process will only leave you with
> images of your equations.

I was hoping, as I mentioned time and again that the OpenOffice.org 
route would handle this, but it didn't. But I'm further investigating 
:-)

> Now for some specifics.  Thomas Schröder provided his test document
> and said that latex2rtf failed.  The conversion was OK except that (1)
> \fbox has a bug and the figure was lost and (2) \centering doesn't
> work properly.

The fbox thing isn't so important, neither is the centering. I only put 
the fbox in there for the OpenOffice.org route which I tried at the 
time because images didn't show up, so I wanted to see if at least the 
fboxes I put around them would shop up which they didn't. And images 
can be centerd in Word, so that's no big deal.

And to correct my own post: my little test document seems to work fine 
but another more complex one which also contains German special symbols 
which get completely messed up, doesn't. They are both in Mac Roman 
encoding so I don't really understand why this happens... oh, well.

What's also not working and what was not in my little test file are my 
own macros and several packages I use and this and the German thing was 
what my gripes were about mainly. I should have checked my facts before 
I posted, sorry :-)

I like many of latex2rtf's capabilities, but I guess in the end it's 
not for me because I make extensive use of extra packages and macros, 
both of which latex2rtf can't handle.

I picked two random math formulas from a colleague's work, some parts 
of which he likes to publish in one of those Word-only-journals, and 
spiced up my old test file like so:

-----------------------
\documentclass[11pt]{article}
\usepackage[applemac]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx,german,dcolumn,amsmath}
\begin{document}

\section{Das ist ein Kapitel}

Das ist ein Test. ä ö ü ß

$\alpha ~ \beta ~\gamma$

\begin{figure}[h]
\centering
\fbox{\includegraphics{Benzol}}
\caption{Eine kleine Abbildung}
\end{figure}

\begin{equation}
E = m \cdot c^2
\end{equation}

\begin{equation}
      \sum_{i=1}^{N_g+N_s}\nu^{\prime}_{ij}\chi_i \quad \longrightarrow 
\quad \sum_{i=1}^{N_g+N_s}\nu^{\prime\prime}_{ij}\chi_i   \quad (j = 
1,..., N_j)
\end{equation}


\begin{equation}
      r_{ij} = \frac{\text{1}}{\nu_{ij}A_{\text{akt}}} \frac{dn_{ij}}{dt}
\end{equation}


\end{document}
  -----------------------

This file works nicely with latex and pdflatex but not with latex2rtf. 
I thought maybe I could use several tools to do the conversion to Word, 
using latex2rtf for pictures and formulas and maybe tex4ht for the 
rest. That would be OK, too, but I guess if latex2rtf chokes on two 
(really) randomly chosen equations then it just isn't for me. Sorry.

FWIW, mzlatex one of the calling commands for tex4ht produces really 
nice XML code from my test file that looks great and correct in 
Mozilla. Now, if I could get this into Word....

> I mention this not to defend latex2rtf so much as to point out that
> without his simple test document, I would never have known about the
> \fbox bug (since I do not use that particular latex command).  I would
> also not have known that I need to revisit the handling of \centering
> in a figure environment.  latex2rtf is open source and will only get
> better through feedback like this --- nice simple examples showing the
> problems.

Hey, I'm always glad to help (even though my gripes were about 
different issues) :-)

> For what it is worth, everything above works with the except of the
> table of contents, index and (the nomenclature package?).  Image 
> translation
> is as good a you want by selecting the DPI in the converted image.

Among the programmes I used to do my little tests, latex2rtf won hands 
down in image conversion. Really nice!

> FWIW, I am working on producing table of contents in the translated 
> document.

I don't think that would be necessary either. It just came to my mind 
that in Word you can create your own table of contents, provided that 
chapters and sections are correctly assigned which they should be if 
you translated a properly marked up LaTeX file. I just tried that with 
the test file above and it works.

Thanks for your comments and keep up the good work! And sorry for the 
lengthy reply.

	Bye, Thomas
-----------------------------------------------------
Please see <http://www.esm.psu.edu/mac-tex/> for list
guidelines, information, and LaTeX/TeX resources.





More information about the MacOSX-TeX mailing list