Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!sun-barr!lll-winken!xanth!cs.odu.edu!zeil From: zeil@cs.odu.edu (Steven J. Zeil) Newsgroups: comp.text Subject: Re: How can I get text out of latex? Message-ID: <1991Apr4.164232.9721@cs.odu.edu> Date: 4 Apr 91 16:42:32 GMT References: <4423@skye.ed.ac.uk> Sender: usenet@cs.odu.edu (Usenet News Poster) Reply-To: zeil@cs.odu.edu (Steven J. Zeil) Organization: Old Dominion University, Norfolk, VA Lines: 39 Nntp-Posting-Host: dolphin.cs.odu.edu 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