Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
This is the file `README.ee' of dednat4.
Author:     Eduardo Ochs <eduardoochs@gmail.com>
Maintainer: Eduardo Ochs <eduardoochs@gmail.com>
Version:    2008jul08
This file is in the Public Domain.
See: http://angg.twu.net/dednat4.html
     http://angg.twu.net/dednat4/README.ee.html
     http://angg.twu.net/dednat4/README.ee
     (find-dn4 "Makefile")



A LaTeX document consists of a header, like:

  \documentclass{article}
  \usepackage{amsmath}
  \usepackage{url}
  % plus several others
  \begin{document}

then a "body", then a "footer" (often just "\end{document}"). If we
want to include dednat4 trees and diagrams in the "body" then the
header becomes slightly more complex, and to process the document we
need to run dednat4 on it before running latex and xdvi.

There is a way to save just the body of a document to a file called
"ee.tex", and then run dednat4, latex and xdvi on another file,
"tmp.tex", that has all the headers and footers, and that "\input"s
ee.tex. The idea is simple, but it has enough steps to be confusing.

This file describes how this works, from three points of view: a
"low-level" one, roughly shell-based; the "demo" targets in the
Makefile; and how I run dednat4/latex/xdvi on regions of text in
Emacs, using eev tricks.

This file is incomplete, sorry!



Processing "ee.tex" files from the shell
========================================

Let me suppose that we have saved a LaTeX/dednat4 "body" file to
a "ee.tex" file in the current directory. For example, with:

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)

rm -Rv /tmp/dn4test/
mkdir  /tmp/dn4test/
cd     /tmp/dn4test/
cat > ee.tex <<'%%%'
%:
%:             [P]  [Q]
%:              :    :
%:  P{\lor}Q    R    R
%:  ==================\text{or-elim}
%:            R
%:
%:            ^or-elim
%:
%D diagram or-elim
%D 2Dx     100       +25      +25
%D 2D  100 P --> P{\lor}Q <-- Q
%D 2D       \        |       /
%D 2D        \       |      /
%D 2D         \      v     /
%D 2D  +20     ----> R <---
%D 2D
%D (( P P{\lor}Q Q   R
%D    @ 0 @ 1 -> @ 1 @ 2 <-
%D    @ 0 @ 3 -> @ 1 @ 3 -> @ 2 @ 3 ->
%D ))
%D enddiagram
%D
$$\cded{or-elim}
  \qquad
  \cdiag{or-elim}
$$
%%%

Then - supposing that dednat4 was installed in ~/dednat4/, and that
you've run "make demo1" there to download the extra files and compile
everything, and everything worked - the following sequence of shell
commands should be enough to run dednat4 and latex on
headers+body+footer and display the resulting dvi file:

  cd /tmp/dn4test/
  ~/dednat4/.files.sh cptexinputs
  cp edrxmain41a.tex tmp.tex
  ~/dednat4/dednat4 tmp.tex
  latex tmp.tex
  xdvi tmp.dvi

The command "~/dednat4/.files.sh cptexinputs" copies several required
TeX files to the current directory. To make it just show what it would
do without executing anything, run it with the "-n" option:

  ~/dednat4/.files.sh -n cptexinputs

It will say something like this:

  # dummy mode, not executing
  cp -sv /home/edrx/dednat4/examples/edrx08.sty .
  cp -sv /home/edrx/dednat4/examples/edrxdnt.tex .
  cp -sv /home/edrx/dednat4/examples/edrxdefs.tex .
  cp -sv /home/edrx/dednat4/examples/edrxheadfoot.tex .
  cp -sv /home/edrx/dednat4/examples/edrxmain41.tex .
  cp -sv /home/edrx/dednat4/examples/edrxmain41a.tex .
  cp -v /home/edrx/dednat4/examples/bussproofs.sty .
  cp -v /home/edrx/dednat4/examples/prooftree.sty .
  cp -v /home/edrx/dednat4/examples/proof.sty .
  cp -v /home/edrx/dednat4/examples/diagxy.tex .




The low-level view
==================

(incomplete!)

Stage 0: preparation - copy edrx08.sty to the current directory, and
make edrxdnt.tex, edrxdefs.tex, and edrxheadfoot.tex available -
either by copying them or by setting TEXINPUTS. (Only needs to be made
once)

Stage 1: create (i.e., select) tmp.tex. Done by "copy edrxmain41.tex
tmp.tex" or "copy edrxmain41a.tex tmp.tex"; the "41" file is used when
we want "\documentclass{book}", the "41a" is for
"\documentclass{article}"; apart from the \documentclass they're the
same.

Stage 2: create an "ee.tex" - by writing the selected region to it.

Stage 3: run "dednat4 tmp.tex" to create a file "tmp.dnt". "tmp.tex"
contains the lines `%L require "experimental.lua"', `%L process
"edrx08.sty"', and `%L process "edrx08.sty"', so several files are
read. Diagram:

  tmp.tex -----------\
   | |                | (dednat4 tmp.tex)
   | \-> edrx08.sty ->|
   |                  |
   \-----> ee.tex --->|  
                      v
                    tmp.dnt

Stage 4: run "latex tmp.tex" to create a file "tmp.dvi". Due to
"\usepackage"s and "\input"s, several other ".sty" and ".tex" files
are read. Note that "tmp.dnt" is loaded before "ee.tex"; for each
diagram and tree defined in "ee.tex", "tmp.dnt" contains a
corresponding "\defdiag" or "\defded" (explain the "\diag"s and
"\ded"s).

  tmp.tex            -------\
   \-> edrx08.sty       --->|
   |    \-> edrxdnt.tex  -->| (latex tmp.tex)
   |    \-> edrxdefs.tex  ->|
   \-> edrxheadfoot.tex   ->|
   \-> tmp.dnt            ->|
   \-> ee.tex             ->|
                            v
                         tmp.dvi




The Emacs-and-eev view
======================

(not written yet)