README file :

----------------------------------------------------------------------------
DELATEX.p  ---  a suite of perl scripts for turning a latex file into 
		a plain text file, while including all equation numbers, 
		citations and cross-references mentioned in the .aux file. 
----------------------------------------------------------------------------

0) 
	Summary

 This free software (usual legal disclaimers apply) was written this
 afternoon by David MacKay (mackay@mrao.cam.ac.uk) 4 June 94 and so is
 not a finely crafted product.  But it works for me, so it may work
 for you.

 Its major advantages over the better-written program "detex" by 
 Daniel Trinkle <trinkle@cs.purdue.edu> are

 [a] it reads the .aux file in order to find all the equation numbers
     	and other cross-references.  These are then (hopefully)
     	correctly reproduced in the final plain text.  Where there are
     	\label commands in the .tex file, the label number is also
     	recorded in plain text, which is handy for equation numbering.
     	The harvard citation style is supported.

 [b] Similarly, this DELATEX program also reads the .tex file in a first
	 pass to find all the "\newcommands"; it then attempts to
	 implement all these command definitions as it processes the
	 .tex file the second time. So if you are a heavy user of newcommands,
	these will come out looking normal.  

 [c] The code is very easy to modify. (for example, if you would prefer to 
	retain the `$' symbol. 

 ------- NB ----- NB --------

	After writing this code I came across dvi2tty, which is an excellent 
 program for going from .dvi to an ascii file. Because it goes from .dvi, 
 it of course handles all cross-references perfectly. Its only defect 
 is that it loses many mathematical symbols, turning (eg) $\beta$ into fi.
 Here are instructions for getting dvi2tty: 
        unix>     ftp  ftp.tex.ac.uk
        ftp>      cd  tex-archive/dviware/
        ftp>      bin
        ftp>      get dvi2tty.tar.gz
        unix>     gunzip dvi2tty.tar.gz
        unix>     tar -xvf dvi2tty.tar
        unix>     cd dvi2tty
        unix>     make
 Usage: 
  dvi2tty -w132 handbook.dvi > handbook.ascii

<dt>dvi2tty<dd> A DVI to ASCII conversion program, for normal
  terminals; available as <a href="ftp://ftp.tex.ac.uk/tex-archive/dviware/dvi2tty.tar.gz">dviware/dvi2tty.tar.gz</a>
see also 
http://www.math.tu-dresden.de/~schuetze/texfaq.html
 ------- OK, back to my perl hacks: --------

1)
    ftp directions: 

	ftp wol.ra.phy.cam.ac.uk       (or 131.111.48.24)
	anonymous
	(your email)
	cd pub/mackay/perl
	get delatex.tar
	get README
	quit
	tar xvf delatex.tar

2)
	 This tar file unpacks into five perl scripts, which you should
 put in your path somewhere. The directory where you want to use them
 is one easy place. Alternatively put them in any other directory in
 your path.

	When they are in location, make them executable using (eg)

	chmod 755 *.p

3)
	You must have the program perl on your system, and the 
 perl scripts must refer to it correctly. If your perl is not in 
 /usr/local/bin/perl, you must search and replace this string all 7 times 
 that it appears in the scripts. 

 [One way to do this is to use perl: 
	perl -pi.bak -e 's#/usr/local/bin/perl#/your/path/to/perl#' *.p 
 ]

4)
	How to use these programs. 

	To start, you must have a latex document called file.tex 
 that you have run latex on so as to produce (among other things) a file 
 called file.aux. (This is the spin-off of latex that contains the 
 list of equation numbers and citations and so forth.) 

	Type DELATEX.p file  

		 (eg DELATEX.p alpha, if the files are alpha.tex
					and alpha.aux)

	This is the master program, which calls the other four programs, 
 and causes two auxiliary programs to be created and called also. 

 DELATEX.p	expects to find       file.tex   and  file.aux
	 	creates               file.nc.p  and  file.ref.p 
	 	writes result to      file.detex

	If it works, you will see the following echoed to the screen: 

 unix> DELATEX.p book
 tex_2_p.p book.tex > book.nc.p 
 aux_2_p.p book.aux > book.ref.p 
 delatex1.p book.tex | book.ref.p | book.nc.p | delatex2.p > book.detex

	If something crashes, try using this less clever version: 

	DELATEX.p newcom=0 file

	(this prevents the program from attempting to interpret all your 
	"newcommands").

	If it still doesn't work, sorry. 

5) NB, after running DELATEX, check through the file produced
	(file.detex, for example) to see if bugs have introduced
	unwanted effects.  (For example \frac{1}{2} -> 12.)

	Known bugs:

	a) multiple citations (e.g. \cite{MacKay92a,Thod}) are 
		handled clumsily, so that intervening commas and 
		parentheses need attention.  The above comes out thus when 
		using the harvard style:  (MacKay, 1992b(Thodberg, 1993).

	b) no facility for following `\input{}' commands. 

	c) tex commands such as \def not supported as \newcommand is. 
		\newcommands with arguments are not handled.

	d) As implemented, all \newcommands are applied *globally* to the 
		tex file. 

5.ii) Features available: if you would like to retain `$' symbols in 
	the processed text, edit the top line of delatex2.p from: 
		$retaindollar = 0 ;   
	to 	$retaindollar = 1 ;

	To add other features, edit the files as follows: 

  to kill strings that are not killed, add to delatex2.p
  to modify the newcommand substitutions, edit tex_2_p.p
  to modify handling of equation, section and table references, 
        and citations, edit aux_2_p.p

6)
	Here is an example of what DELATEX.p does to a few lines of latex: 

--------- original starts ---------------- (NB, original used harvard citation
									style)
\renewcommand{\a}{\alpha}
\renewcommand{\b}{\beta}

 Bayesian inference for neural networks  may be implemented by
 Monte Carlo sampling \cite{Neal_nips5}, or by deterministic
 methods employing Gaussian approximations \cite{MacKay92b}.  

\section{Bayesian solution to the overfitting problem}
\subsection*{Setting regularization constants $\a$ and $\b$}
\label{sec.a_and_b}
 The control parameters $\a$ and $\b$ determine the complexity of a
 model.  The probabilistic
 model $\H$ specifies the functional form $\A$ of the network, the
 likelihood (\ref{basic.like}), and the prior (\ref{basic.prior}).

------------- end of original ---------
----- detex file ---------------------

 Bayesian inference for neural networks  may be implemented by
 Monte Carlo sampling (Neal, 1993), or by deterministic
 methods employing Gaussian approximations (MacKay, 1992b).  The latter 
 are reviewed here.

* Bayesian solution to the overfitting problem
-- Setting regularization constants $alpha$ and $beta$
(2)
 The control parameters alpha and beta determine the complexity of a
 model.  The probabilistic
 model H specifies the functional form A of the network, the
 likelihood (5), and the prior (6).

------------------end -----------------

7)
	Sorry, no support is provided for this code. 
	Only contact me if there is something blatantly wrong with 
 the tar file, or if you want to reimburse me for my hacking. 

 Good luck!

