Article View: comp.text.tex
Article #2008readable deTeX
From: wilcox
Date: Wed, 02 Sep 1992 14:55
Date: Wed, 02 Sep 1992 14:55
36 lines
1858 bytes
1858 bytes
I have a manual for a fault tree program that we sell (called FaultrEASE).
The manual is in TeX, using the TeXtures implementation from Blue Sky.
So far, so good. However, the program also has on-line help, which is
basically a de-TeXed version of the manual. I produce this using a LISP
program which I have taught to recognize TeX macros and do simple-minded
transforms in their place. I tried using GNU's deTeX, but this does *no*
formatting at all, so the output is not very readable. Is there any code
(TeX, LISP, or otherwise) for transforming TeX documents into flat (but
somewhat readable) ASCII, suitable for an on-line manual?
Following are some of the LISP functions I use, to give you an idea of what
I'm trying to do:
(defun expand-section (stream)
"Capitalizes the section name,
places two blank lines before it, and one after."
(let ((section (read stream)))
(format nil "~2%~a~%" (string-upcase section))
))
(defun deTeX (input output)
"Remove TeX commands from an input stream, ~
sending results to an output stream."
(let ((*readtable* *TeX-readtable*))
(loop
(let* ((char (read-char input nil :eof))
(string
(case char
((#\{ #\} #\$ ))
(#\% (read-line input) (peek-char t input nil) nil)
(#\\ (expand-def input))
(:eof (return t))
(t char)
)))
(when string (princ string output))
))))
Technical Details
Message-ID:
<9209021455.AA09531@cmns-sun.think.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!ames!network.ucsd.edu!mvb.saic.com!info-texShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!ames!network.ucsd.edu!mvb.saic.com!info-tex From: wilcox@cmns.think.com Newsgroups: comp.text.tex Subject: readable deTeX Message-ID: <9209021455.AA09531@cmns-sun.think.com> Date: Wed, 2 Sep 92 10:55:21 EDT Organization: Info-Tex<==>Comp.Text.Tex Gateway X-Gateway-Source-Info: Mailing List Lines: 37