Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
% A demo that produces a single, complete .tex file.
% This file:
%   http://angg.twu.net/dednat6/demo-write-single.tex.html
%   http://angg.twu.net/dednat6/demo-write-single.tex
%                (find-dednat6 "demo-write-single.tex")
% See: http://angg.twu.net/dednat6.html#no-lua
% Version: 2019aug20.
%
%
% This is a modification of demo-write-dnt.tex that replaces the
%
%   %L write_dnt_file()
%
% near the end of the file by these two lines:
%
%   %L write_dnt_file()
%   %L write_single_tex_file("demo-write-single-sngf.tex")
%
% The "write_dnt_file()" writes the contents of the global variable
% dnt_log to the file "demo-write-single.dnt"; the 
%
%   write_single_tex_file("demo-write-single-sngf.tex")
%
% creates a file that is a copy of demo-write-single.tex with the line
%
%   \input\jobname.dnt
%
% replaced by the contents of the global variable dnt_log.
%
%
% Some emacs/eev-isms. You don't need to understand this.
% See: (find-eev-quick-intro "7.4. Commands with very short names")
%      http://angg.twu.net/eev-intros/find-eev-quick-intro.html#7.4
% (defun c () (interactive) (find-dednat6sh "lualatex -record demo-write-single.tex"))
% (defun c () (interactive) (find-dednat6sh "pdflatex         demo-write-single.tex"))
% (defun c () (interactive) (find-dednat6sh "pdflatex    demo-write-single-sngf.tex"))
% (defun d () (interactive) (find-pdf-page "~/dednat6/demo-write-single.pdf"))
% (defun d () (interactive) (find-pdf-page "~/dednat6/demo-write-single-sngf.pdf"))
% (defun e () (interactive) (find-dednat6 "demo-write-single.tex"))
% (defun e () (interactive) (find-dednat6 "demo-write-single-sngf.tex"))
% (defun u () (interactive) (find-latex-upload-links "demo-write-single"))
%   (find-pdf-page "~/dednat6/demo-write-single.pdf")
% http://angg.twu.net/dednat6/demo-write-single.pdf
%
%
\documentclass[oneside]{book}
\usepackage{ifluatex}
\usepackage{proof}   % For derivation trees ("%:" lines)
\input diagxy        % For 2D diagrams ("%D" lines)
\xyoption{curve}     % For the ".curve=" feature in 2D diagrams
\begin{document}

\ifluatex
  \catcode`\^^J=10
  \directlua{dofile "dednat6load.lua"}
\else
  \input\jobname.dnt
  \def\pu{}
\fi

A tree:
%
%L addabbrevs("->", "\\to ")
%
%:  [a]^1  a->b
%:  -----------
%:       b       b->c
%:       ------------
%:            c
%:          ----1
%:          a->c
%:
%:          ^comp
%:
\pu
$$\ded{comp}$$



\def\catA{\mathbf{A}}
\def\catB{\mathbf{B}}

A diagram:
%
%D diagram adj
%D 2Dx     100     +25
%D 2D  100 LA <--| A
%D 2D      |       |
%D 2D      |  <->  |
%D 2D      v       v
%D 2D  +25 B |--> RB  
%D 2D
%D 2D  +15 \catB \catA
%D 2D
%D (( LA A <-|
%D    LA B -> A RB ->
%D    B RB |->
%D    LA RB harrownodes nil 20 nil <->
%D    \catB \catA <- sl^ .plabel= a L
%D    \catB \catA -> sl_ .plabel= b R
%D ))
%D enddiagram
%D
$$\pu
  \diag{adj}
$$


% More eev-isms, for tests in the author's machine.
% You are not expected to understand this.
% (find-angg      "LATEX/dednat6/output.lua" "write_single_dnt_file")
% (find-tkdiff  "~/LATEX/dednat6/output.lua" "~/dednat6/dednat6/output.lua")
% (find-tkdiff> "~/LATEX/dednat6/output.lua" "~/dednat6/dednat6/output.lua")
% (find-sh "cd /tmp/ && pdflatex foo.tex")
% (find-fline "/tmp/" "foo.tex")
% (find-pdf-page "/tmp/foo.pdf")

%L write_dnt_file()
%L write_single_tex_file("demo-write-single-sngf.tex")
\pu


\end{document}

% Local Variables:
% coding: utf-8-unix
% End: