Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Consider a *NIX executable, dvi2rtf, whose contents are:

#!/bin/sh
TMPX=`mktemp /tmp/dvi2rtf.XXXXXX`
dvitty $1 $TMPX         # CTAN
txt2rtf $TMPX $2        # CTAN, in rtfutils

If my head is working this morning and the right executables are on the PATH, this clobbers the second argument with an RTF file whose text contents will roughly correspond to those of the dvi file named by the first argument.

Such a program doesn't deserve the filename dvi2rtf, since it makes no attempt to preserve the formatting of the DVI file; Cf. Q#1621885: How to turn a dvi to tex. RTF's \wpsp can allow rtf to handle horizontal space similarly to DVI; RTF's notion of code pages is similar to how DVI handles fonts: maybe it is possible to handle other tricky features of dvi, such as vertical space?

Question: Is there such a program that attempts to preserve layout, however flaky? And if not, are there the RTF primitives to write a converter in a reasonable way?

share|improve this question

migrated from stackoverflow.com Apr 18 '12 at 14:29

This question came from our site for professional and enthusiast programmers.

1  
do you still have the latex source available? If not, not it's not possible. (Or at least harder than retyping the text) Look here for a similar question stackoverflow.com/questions/1620002/pdf-to-latex-linux –  Eduardo Leoni Dec 16 '09 at 15:03
    
With a sufficiently low quality threshold, it is certainly possible: the code I give usually yields intelligible text. Rtf has a different approach to laying out text -it's genuinely a markup language, while dvi is a plotting language- but I'm guessing it is possible to map dvi's layout onto rtf for most tex output, because rtf does allow some control over vertical and horizontal placement, and tex generally lays out characters line by line in the dvi. So, I'm optimistic. I think I'll have to implement it myself, though... –  Charles Stewart Dec 16 '09 at 15:24
add comment

1 Answer

up vote 3 down vote accepted

The main problems that need solving seem to be solved in Richard M's answer to my question Laying out Graphics in RTF (1):

  1. Mapping dvi fonts to RTF fonts - seems to need the mapping worked out by hand, can specify using \deff directives
  2. Positioning RTF boxes - can be handled by \pvpg and \phpg directives, per (1);
  3. Rules - can be handled by \dprect directives, per (1);
  4. New page can be forced using \page.

So this seems to be implementable.

Links

  1. DVI spec
  2. RTF 1.5 spec
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.