[comp.text] How can I get text out of latex?

robert@aiai.ed.ac.uk (Robert Inder) (04/03/91)

I want to find a way of converting a document written in
Latex to a format suitable for another word processing
system (actually, Uniplex).

BURST OF WILD OPTIMISM:
   Does anybody have a suitable converter?
END BURST OF WILD OPTIMISM.

Failing that, plain ASCII.  

Before I launch into writing something, is there any existing
piece of software that will produce plain ASCII from a latex
document (or even from latex output --- i.e. the dvi file).

Even a Latex->nroff converter would be OK...

I know about "detex".  Simply stripping the latex commands isn't enough.  I
would really like something that leaves more of the "intention" of the
various latex commands (e.g. sectioning commands at various depths,
and the various kinds of list-making commands).

Robert.






-- 
      Another idea half-baked in the solar furnace of...
Robert Inder, Knowledge Engineering Group, AI Applications Institute
R.Inder@uk.ac.ed   (+44) 31 650 2746

zeil@cs.odu.edu (Steven J. Zeil) (04/05/91)

In article <4423@skye.ed.ac.uk> robert@aiai.ed.ac.uk (Robert Inder) writes:
>Before I launch into writing something, is there any existing
>piece of software that will produce plain ASCII from a latex
>document (or even from latex output --- i.e. the dvi file).
>I know about "detex".  Simply stripping the latex commands isn't enough.  I
>would really like something that leaves more of the "intention" of the
>various latex commands (e.g. sectioning commands at various depths,
>and the various kinds of list-making commands).


There are a number of programs for getting text out of a dvi file.
Check one of the servers such as sun.soe.clarkson.edu
The program I use is called dvi2tty


Now, here's the catch:  The .dvi files contain micro-positioning
information for individual characters.  Programs like dvi2tty will
do their best to put a character into a position as close as possible
to the "actual" position indicated by the .dvi file, but because of
the mismatch between the fine positioning in the .dvi file and the
coarse-grained positioning available in a simple text file, the
results are not very good.  Inter-word spaces tend to disappear, while
blanks get "randomly" inserted within the middle of words.

The way to get around this problem is to alter the document so that it
uses fixed-width fonts throughout. I add the following to the preamble
of the LaTeX document prior to converting to text.

\def\rm{\protect\tt}
\def\it{\protect\tt}
\def\bf{\protect\tt}
\def\sl{\protect\tt}
\def\sf{\protect\tt}
\def\sc{\protect\tt}

Then run it through LaTeX, send the .dvi file through dvi2tty, and you
should have a reasonable text file.

                                                           Steve Z