Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
#######
#
# E-scripts on programs to typeset deduction trees.
#
# Note 1: use the eev command (defined in eev.el) and the
# ee alias (in my .zshrc) to execute parts of this file.
# Executing this file as a whole makes no sense.
# An introduction to eev can be found here:
#
#   (find-eev-quick-intro)
#   http://angg.twu.net/eev-intros/find-eev-quick-intro.html
#
# Note 2: be VERY careful and make sure you understand what
# you're doing.
#
# Note 3: If you use a shell other than zsh things like |&
# and the for loops may not work.
#
# Note 4: I always run as root.
#
# Note 5: some parts are too old and don't work anymore. Some
# never worked.
#
# Note 6: the definitions for the find-xxxfile commands are on my
# .emacs.
#
# Note 7: if you see a strange command check my .zshrc -- it may
# be defined there as a function or an alias.
#
# Note 8: the sections without dates are always older than the
# sections with dates.
#
# This file is at <http://angg.twu.net/e/dednat.e>
#           or at <http://angg.twu.net/e/dednat.e.html>.
#        See also <http://angg.twu.net/emacs.html>,
#                 <http://angg.twu.net/.emacs[.html]>,
#                 <http://angg.twu.net/.zshrc[.html]>,
#                 <http://angg.twu.net/escripts.html>,
#             and <http://angg.twu.net/>.
#
#######





# «.dednat.lua»			(to "dednat.lua")
# «.dednat.icn»			(to "dednat.icn")
# «.dednat4-tgz-tests»		(to "dednat4-tgz-tests")
# «.thereplusxy»		(to "thereplusxy")
# «.splitdist»			(to "splitdist")
# «.phantom-nodes»		(to "phantom-nodes")
# «.tex-src-tgz»		(to "tex-src-tgz")
# «.eepitch-dednat4»		(to "eepitch-dednat4")
# «.dednat4-test»		(to "dednat4-test")
# «.dednat41-test»		(to "dednat41-test")
# «.dednat4-demo1»		(to "dednat4-demo1")
# «.dednat41-demo1»		(to "dednat41-demo1")
# «.tgz:make-demo1»		(to "tgz:make-demo1")
# «.visible-phantoms»		(to "visible-phantoms")
# «.dednat4.el»			(to "dednat4.el")
# «.symlinks»			(to "symlinks")
# «.dednat4-log»		(to "dednat4-log")
# «.2008filterp-texsrc»		(to "2008filterp-texsrc")
# «.lpeg»			(to "lpeg")
# «.bitlib»			(to "bitlib")
# «.loop»			(to "loop")
# «.demo-loop-and-place»	(to "demo-loop-and-place")
# «.ticked-arrowheads»		(to "ticked-arrowheads")
# «.enddefdiag»			(to "enddefdiag")
# «.dednat5»			(to "dednat5")
# «.idarct»			(to "idarct")
# «.idarct2017»			(to "idarct2017")
# «.GA-material-pack»		(to "GA-material-pack")
# «.hyperboles»			(to "hyperboles")
# «.dednat6-luarepl»		(to "dednat6-luarepl")
# «.luarepl»			(to "luarepl")
# «.thislinetag»		(to "thislinetag")
# «.processbigstr»		(to "processbigstr")
# «.hyperlinks»			(to "hyperlinks")
# «.BOX-dednat6»		(to "BOX-dednat6")
# «.curve»			(to "curve")
# «.dednat6.zip-2018»		(to "dednat6.zip-2018")
# «.dednat6.zip-test»		(to "dednat6.zip-test")
# «.dednat6.zip-2019»		(to "dednat6.zip-2019")
# «.contours-new»		(to "contours-new")
# «.sub-ZHA»			(to "sub-ZHA")
# «.LPicture-add-pict2e»	(to "LPicture-add-pict2e")
# «.V.walk»			(to "V.walk")
# «.LPicture.addrect»		(to "LPicture.addrect")
# «.TCG.addrect»		(to "TCG.addrect")
# «.TCGDims»			(to "TCGDims")
# «.defzha-and-deftcg»		(to "defzha-and-deftcg")
# «.defub»			(to "defub")
# «.qmarks-to-cuts»		(to "qmarks-to-cuts")
# «.dednat6-dnt-from-lua»	(to "dednat6-dnt-from-lua")
# «.output_dnt»			(to "output_dnt")
# «.output-no-tex»		(to "output-no-tex")
# «.hyperlinks-in-LPicture»	(to "hyperlinks-in-LPicture")
# «.stackexchange»		(to "stackexchange")
# «.git-repo»			(to "git-repo")
# «.git-repo-test»		(to "git-repo-test")
# «.git-repo-update»		(to "git-repo-update")
# «.makefile»			(to "makefile")
# «.ctan-guidelines»		(to "ctan-guidelines")
# «.arxiv-yoneda»		(to "arxiv-yoneda")
# «.tf:push»			(to "tf:push")
# «.diaxydoc-and-barrdoc»	(to "diaxydoc-and-barrdoc")
# «.lua-files-in-ctan-pkgs»	(to "lua-files-in-ctan-pkgs")
# «.quirks-2019-jul»		(to "quirks-2019-jul")
# «.colored-arrows»		(to "colored-arrows")
# «.write_single_tex_file»	(to "write_single_tex_file")
# «.deletecomments»		(to "deletecomments")
# «.deletecomments-2021»	(to "deletecomments-2021")
# «.LR.fromtcgspec-5.3»		(to "LR.fromtcgspec-5.3")
# «.dednat6-xyoption-2cell»	(to "dednat6-xyoption-2cell")
# «.ph1-doc»			(to "ph1-doc")
# «.harrownode»			(to "harrownode")
# «.extra-modules»		(to "extra-modules")
# «.converting-TCG-to-TCGQ»	(to "converting-TCG-to-TCGQ")
# «.dednat4-pdfs-downloading»	(to "dednat4-pdfs-downloading")
# «.dednat4-texs-converting»	(to "dednat4-texs-converting")
# «.tikzdiagram»		(to "tikzdiagram")
# «.plabel-error-handling»	(to "plabel-error-handling")
# «.bussproofs»			(to "bussproofs")
# «.at:»			(to "at:")
# «.texstudio»			(to "texstudio")
# «.repl-pict»			(to "repl-pict")
# «.lawvere-tierney»		(to "lawvere-tierney")
# «.lawvere-tierney-mpunder»	(to "lawvere-tierney-mpunder")
# «.V3»				(to "V3")
# «.drawing-polys»		(to "drawing-polys")
# «.numerozinhos»		(to "numerozinhos")
# «.error-2021-04-21»		(to "error-2021-04-21")
# «.color-non-open»		(to "color-non-open")
# «.pictreplace»		(to "pictreplace")
# «.burghardt»			(to "burghardt")
# «.lean-nng»			(to "lean-nng")
# «.fitch»			(to "fitch")
# «.ftch»			(to "ftch")
# «.slides-to-pngs»		(to "slides-to-pngs")





# (find-blogme3 "sandwiches-defs.lua" "code-pdf-page-tests")
# (code-pdf-page "dn6slides"  "~/dednat6/tug-slides.pdf")
# (code-pdf-text "dn6slides"  "~/dednat6/tug-slides.pdf")
# (code-pdf-page "dn6article" "~/dednat6/tugboat-rev2.pdf")
# (code-pdf-text "dn6article" "~/dednat6/tugboat-rev2.pdf")





#####
#
# dednat.lua (obsolete)
# 2001may15
#
#####

# «dednat.lua»  (to ".dednat.lua")
# (find-angg "LUA/dednat.lua")
# (find-angg "LATEX/Makefile")
# (find-angg "LATEX/Makefile" "dednat.lua")
# (find-angg "LATEX/Makefile" "dn_to_dnt")

#*
# (find-angg "LATEX/tese2.sty")
# (find-angg "LATEX/proof.edrx.sty")

cd ~/LATEX/
rm -v tmp.dn tmp.dnt

cat > tmp.tex <<'%%%'
% \input tese2.sty
\documentclass{book}
  \usepackage{proof.edrx}
  \def\ded#1{\csname ded-#1\endcsname}
  \def\defded#1#2{\expandafter\def\csname ded-#1\endcsname{#2}}
  \input tmp.dnt
\begin{document}
%
%:*->*\to *
%:
%:  a  [a->b]^1
%:  -----------
%:      b
%:  ---------1
%:  (a->b)->b
%:
%:  ^dedtest
%:
$$\ded{dedtest}$$
%
\end{document}
%%%

make tmp.dvi
rexdvi tmp.dvi

#*





#####
#
# dednat.icn (obsolete)
# 2001may15
#
#####

# «dednat.icn»  (to ".dednat.icn")
# (find-angg "LATEX/dednat.icn")




#####
#
# dednat4: tgz and tests
# 2008may26
#
#####

# «dednat4-tgz-tests»  (to ".dednat4-tgz-tests")
# (find-es "xypic")
# (find-es "xypic" "dednat41-test")
# (find-es "xypic" "dednat41-demo1")
# (find-es "xypic" "eepitch-dednat4")
# (find-angg ".emacs" "eepitch-dednat4")
# (find-angg ".emacs" "dednat4")
# (find-angg ".emacs" "eedn4a")
# (find-dn4 "")
# (find-dn4 "Makefile")

# The README is crap:
# (find-dn4file "README")

# This is ok - copy to the dednat4/ dir:
#   (find-THLw3m "dednat4.html")
#   (find-TH "dednat4")
#   (find-sh "grep IMG ~/TH/dednat4.blogme")
# It needs a hacker's guide, though... get logs from:
#   (find-es "xypic" "eepitch-dednat4")

# Add: at: x y tag
#      .xy+= x y
#      there+: x y tag

# (find-anggfile "IMAGES/Atimes-dnt.png")
# (find-anggfile "IMAGES/Atimes.png")
# (find-anggfile "IMAGES/TfromFtoG.png")
# (find-anggfile "IMAGES/eqfib-trans.png")
# (find-anggfile "IMAGES/lccc-bcc.png")
# (find-anggfile "IMAGES/lccc-frob.png")
# (find-anggfile "IMAGES/preslim.png")

# (find-zsh "
cd ~/IMAGES/
A=(
Atimes-dnt.png
Atimes.png
TfromFtoG.png
eqfib-trans.png
lccc-bcc.png
lccc-frob.png
preslim.png
)
laf $A
")





#####
#
# there+xy:
# 2008jun01
#
#####

# «thereplusxy»  (to ".thereplusxy")
# (find-LATEXfile "2008sheaves.tex" "thereplusxy =")



#####
#
# understand harrownodes and varrownodes
# 2008jun02
#
#####

# «splitdist»  (to ".splitdist")
# (find-dn4 "dednat41.lua")
# (find-dn4 "experimental.lua")

Suppose that we want to draw a diagram like this one:

A |-----> FA
|          -
|   |->    |
v          v
B |-----> FB

* (eepitch-dednat4)
* (eepitch-kill)
* (eepitch-dednat4)
require "experimental"
= splitdist(100, 200, nil, 20, nil)
--> 140 160





#####
#
# Documentation about phantom nodes
# 2008jun24
#
#####

# «phantom-nodes»  (to ".phantom-nodes")
# Moved to: (find-dn4 "README.phantoms")




#####
#
# LaTeX source tarballs for my .texs
# 2008jun08
#
#####

# «tex-src-tgz»  (to ".tex-src-tgz")

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

rm -Rv /tmp/te/
mkdir  /tmp/te/
cd     /tmp/te/

# (find-fline "~/LATEX/2008bcc.tex")
F=$HOME/LATEX/2008bcc.tex

cp -av $F .
cp -av ~/dednat4/examples/edrx08.sty   .
cp -av ~/dednat4/examples/edrxdnt.tex  .
cp -av ~/dednat4/examples/edrxdefs.tex .
cp -av ~/dednat4/examples/edrxheadfoot.tex .
~/dednat4/dednat41 $(basename $F)
cp -av $S/http/www.ctan.org/tex-archive/macros/latex/contrib/lkproof/proof.sty .
unzip -o $S/ftp/ftp.math.mcgill.ca/pub/barr/diagxy.zip diagxy.tex

latex $(basename $F)

# (find-fline "/tmp/te/")
# (find-dn4exfile "")
# (find-dn4file "Makefile")
# (find-dn4file "Makefile" "TATPROOFSFILE  =")
# (find-dn4file "Makefile" "DIAGXYFILE")

# Add this?
# (find-dn4file "dednat41.lua")
# Generated by dednat41.lua




#####
#
# eepitch-dednat4
# 2008may11
#
#####

# «eepitch-dednat4»  (to ".eepitch-dednat4")
# (find-angg ".emacs" "eepitch-dednat4")
# (find-angg "LUA/lua50init.lua" "load_dednat4")
# (find-dn4 "dednat41.lua")
# (find-dn4 "dednat41.lua" "tree-lib" "dolinenumbers")

* (eepitch-dednat4)
* (eepitch-kill)
* (eepitch-dednat4)
PP(abbrevs)
process "/home/edrx/dednat4/examples/edrx08.sty"
PP(abbrevs)
PP(heads)


* (eepitch-dednat4)
* (eepitch-kill)
* (eepitch-dednat4)
dolinenumbers = nil

diagram "miniadj"
dxy2Dx "      100   140 "
dxy2D  " 140 a^L <= a   "
dxy2D  "      -     -   "
dxy2D  "      |     |   "
dxy2D  "      v     v   "
dxy2D  " 100  b => b^R  "
PP("nodes =", nodes)
pushtag "a^L"; pushtag "a"; dof "<="
pushtag "a^L"; pushtag "b"; dof "|->"
pushtag "a"; pushtag "b^R"; dof "|->"
pushtag "b"; pushtag "b^R"; dof "=>"
PP("arrows =", arrows)
enddiagram()


* (eepitch-dednat4)
* (eepitch-kill)
* (eepitch-dednat4)
dolinenumbers = nil
mytostringk = mytostringk2

dofs "diagram miniadj2"
dofs "2Dx      100   140 "
dofs "2D  140 a^L <= a   "
dofs "2D       -     -   "
dofs "2D       |     |   "
dofs "2D       v     v   "
dofs "2D  100  b => b^R  "
dofs "(( a^L a <=   a^L b |->   a b^R |->"

printf("xs = %s\n", mytostring(xs))
for i=1,#nodes  do printf("nodes[%d] = %s\n",  i, mytostring(nodes[i]))  end
for i=1,#arrows do printf("arrows[%d] = %s\n", i, mytostring(arrows[i])) end
for i=1,#ds     do printf("ds[%d] = %s\n",     i, mytostring(ds[i]))     end
for i=1,#depths do printf("depths[%d] = %s\n", i, mytostring(depths[i])) end
PP(keys(nodes))

dofs "   b b^R => ))"
dofs "enddiagram"




Note: due to a bad design decision the elements of ds are "in the
wrong order" - to push a new element we move the old elements from the
positions 1..n to 2..n+1, and then we set ds[1] to the new element...
this simplifies accessing the elements at the top of the stack, but
complicates all the rest - especially "@" and operations with the
array "depths".

One possible fix (dirty trick): use a metatable with a "__call" entry
for the table "ds"; make ds(2) return ds[-2] for any value of 2.



Notes (obsolete):

%L at = function (index) return ds[#ds - depths[1] - index] end
%L PP("@ 0 =", at(0))
%L PP("@ 1 =", at(1))
%L PP("@ 2 =", at(2))
%L PP(ds[#ds])
%L PP(ds[#ds - 1])
%L PP(#ds)
%L PP(ds)
%L mytostringk = mytostringk2
%L printf("xs = %s\n", mytostring(xs))
%L for i=1,#nodes  do printf("nodes[%d] = %s\n",  i, mytostring(nodes[i]))  end
%L for i=1,#arrows do printf("arrows[%d] = %s\n", i, mytostring(arrows[i])) end
%L for i=1,#ds     do printf("ds[%d] = %s\n",     i, mytostring(ds[i]))     end
%L for i=1,#depths do printf("depths[%d] = %s\n", i, mytostring(depths[i])) end
%L PP(keys(nodes))
% (find-sh "cd ~/LATEX/ && lua51 ~/dednat4/dednat41.lua tmp.tex")
% (find-angg "LUA/lua50init.lua")






#####
#
# Testing dednat41
# 2008may19
#
#####

# «dednat4-test»  (to ".dednat4-test")
# «dednat41-test»  (to ".dednat41-test")
# (find-dn4 "Makefile")
# (find-node "(kpathsea)File lookup")
# (find-dn4exfile "dednat4.el")
# (find-eevtmpfile "")
# (find-eevtmpfile "ee.sh")
# (find-LATEXfile "" "tmp.tex")
# (find-LATEXfile "tmp.tex")
# (find-LATEXfile "ee.tex")
# (find-angg ".emacs")
# (find-angg ".emacs" "dednat4")
# (find-es "xypic" "eepitch-dednat4")
# (find-angg ".emacs" "eedn4a")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rv /tmp/dntest/
mkdir  /tmp/dntest/
cd     /tmp/dntest/

cd ~/dednat4/
make S=$S TEXDIR=/tmp/dntest texfiles

cd     /tmp/dntest/

DN4EXDIR=$HOME/dednat4/examples/
cp -v $DN4EXDIR/edrxmain41a.tex tmp.tex
cp -v $DN4EXDIR/eedemo1.tex     ee.tex
cp -v $DN4EXDIR/edrx08.sty      edrx08.sty
~/dednat4/dednat41 tmp.tex
TEXINPUTS=$DN4EXDIR: latex tmp.tex

# (find-fline   "/tmp/dntest/")
# (find-fline   "/tmp/dntest/tmp.tex")
# (find-dvipage "/tmp/dntest/tmp.dvi")



# «dednat4-demo1»  (to ".dednat4-demo1")
# «dednat41-demo1»  (to ".dednat41-demo1")
# (find-dn4 "Makefile" "demo1")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd ~/dednat4/
rm -Rv demos/
mkdir  demos/
make demo1

# (find-dn4 "demos/")
# (find-man "unzip")





#####
#
# dednat4: "make demo1" (from the tarball)
# 2008jun25
#
#####

# «tgz:make-demo1»  (to ".tgz:make-demo1")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rv /tmp/dn4t/
mkdir  /tmp/dn4t/
cd     /tmp/dn4t/
tar -xvzf ~/dednat4/dednat4.tgz
make S=$S demo1 |& tee om

# (find-fline "/tmp/dn4t/")




#####
#
# visible phantoms
# 2008jun27
#
#####

# «visible-phantoms»  (to ".visible-phantoms")
# (find-fline "~/tmp/phantom-nodes.png")

%*
% (eedn4a-bounded)

%L phantomnode = "\\myphantom{O}"
\def\myphantom{\phantom}

%D diagram harrowdemo
%D 2Dx     100       +30
%D 2D  100 A |-----> FA
%D 2D	   |          -
%D 2D	 f |   |->    | Ff
%D 2D	   v          v
%D 2D  +30 B |-----> FB
%D 2D
%D ((  A FA |->
%D     A  B -> .plabel= l f
%D    FA FB -> .plabel= r Ff
%D     B FB |->
%D    A FB harrownodes nil 20 nil |->
%D ))
%D enddiagram
%D
$$\diag{harrowdemo}
  \qquad
  {\def\myphantom{\red}
   \diag{harrowdemo}
  }
$$

%*



#####
#
# dednat4.el
# 2008jun27
#
#####

# «dednat4.el»  (to ".dednat4.el")
# (find-dn4 "dednat4.el")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd ~/dednat4/
lua51 -e 'dofile"dednat41.lua"' -i
require "experimental"




#####
#
# symlinks: tmp.tex -> edrxmain41.tex and ee.tex -> eedemo1.tex
# 2008jun27
#
#####

# «symlinks»  (to ".symlinks")
# (find-dn4file "Makefile")

# Removed from the makefile:

# Ooops - here I am symlinking tmp.tex -> edrxmain41a.tex... What
# happens if I copy something to tmp.tex later? Does it cease to be a
# symlink, or does it overwrite edrxmain41a.tex?
#
# Possible solution: do not symlink - edrxmain41a.tex has a header
# that explains from where it comes.

#demo1-old: dednat41 texfiles
#	mkdir -p $(DEMODIR)
#	ln -sf $(DN4EXDIR)/edrxmain41a.tex $(DEMODIR)/tmp.tex
#	ln -sf $(DN4EXDIR)/edrx08.sty      $(DEMODIR)/edrx08.sty
#	ln -sf $(DN4EXDIR)/eedemo1.tex     $(DEMODIR)/ee.tex
#	cd $(DEMODIR) && $(PWD)/dednat41 tmp.tex
#	cd $(DEMODIR) && TEXINPUTS=$(TEXDIR): latex tmp.tex

#	cd $(DEMODIR) && ln -sf edrxmain41a.tex tmp.tex
#	cd $(DEMODIR) && ln -sf eedemo1.tex     ee.tex





#####
#
# dednat4-log.html
# 2008jul12
#
#####

# «dednat4-log»  (to ".dednat4-log")
# (find-THgrep      "grep -niH -e traffic *")
# (find-blogme3grep "grep -niH -e traffic *")
# (find-blogme3 "anggdefs.lua" "TRAFFIC")
# (find-TH "dednat4")
# (find-TH "dednat4-log")
# (find-es "blogme" "traffic-lights-glyphs")

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

cd
rm -Rv mkdir /tmp/dn4/

cd ~/dednat4/
make tarball

mkdir /tmp/dn4/
cd    /tmp/dn4/
wget http://angg.twu.net/dednat4/dednat4.tgz
tar -xvzf dednat4.tgz
make
make dednat4
make texfiles
make demo2





#####
#
# 2008filterp-texsrc.tar.gz
# 2008jul12
#
#####

# «2008filterp-texsrc»  (to ".2008filterp-texsrc")
# http://angg.twu.net/math/
# (find-twusfile "")
# (find-twusfile "math/")
# (find-twusfile "LATEX/")

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

rm -Rv /tmp/fi/
mkdir  /tmp/fi/
cd ~/LATEX/
cp -aiv 2008filterp.{tex,dnt} filters.bib /tmp/fi/
cd     /tmp/fi/
          ~/dednat4/.files.sh eval "{ texedrx ; texother; } | prepends"
cp -aiv $(~/dednat4/.files.sh eval "{ texedrx ; texother; } | prepends") .
rm -v edrxmain*.tex
tar -cvzf /tmp/2008filterp-texsrc.tar.gz *
laf       /tmp/2008filterp-texsrc.tar.gz
laf

~/dednat4/dednat4 2008filterp.tex

latex 2008filterp.tex
bibtex 2008filterp
latex 2008filterp.tex
latex 2008filterp.tex

# (ee-cp "/tmp/2008filterp-texsrc.tar.gz" (ee-twusfile "LATEX/2008filterp-texsrc.tar.gz") 'over)





#####
#
# The "lpeg" and "bitlib" targets in the Makefile
# 2008jul21
#
#####

# «lpeg»  (to ".lpeg")
# «bitlib»  (to ".bitlib")
# (find-dn4 "Makefile" "lpeg")
# (find-dn4 "Makefile" "bitlib")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd ~/dednat4/ && make tmpdir
cd /tmp/dn4/
tar -xvzf /tmp/dulua.tgz
make S=$S luabuild
tar -cvzf /tmp/dulua.tgz usrc/lua-5.1.3/

make S=$S lpegbuild
make S=$S bitlibbuild

./lua51
require "lpeg"
PP(lpeg)
assert(package.loadlib("./lbitlib.so", "luaopen_bit"))()
print(bit.bxor(6,3))
os.exit()




#####
#
# \Loop
# 2008aug01
#
#####

# «loop»  (to ".loop")
# (find-diagxypage 29 "\\Loop")
# (find-diagxytext    "\\Loop")
# (find-dn4 "experimental.lua")
# (find-dn4 "experimental.lua" "loop")

%*
% (eedn4a-bounded)

%D diagram ??
%D 2Dx     100   +30 +30
%D 2D  100 a --> b
%D 2D            v
%D 2D  +20       c   d
%D 2D
%D (( a b -> b c ->
%D    a loop (ul,dl)_{aa}
%D    b loop (u,r)
%D    c loop (dl,dr)
%D    d place
%D ))
%D enddiagram
%D
$$\diag{??}$$

%*
% (eedn4a-bounded)

$$\bfig
  \morphism[A`B;f]
  \Loop(0,0)A(ur,ul)_g
  \Loop(0,0)A(ur,ul)^a
  \Loop(500,0)B(dl,dr)_h
  \Loop(1000,0)CC(dl,dr)
  % \Loop(1500,0)DD
  \efig
$$

%*



#####
#
# demo-loop-and-place
# 2022feb08
#
#####

# «demo-loop-and-place»  (to ".demo-loop-and-place")

%D diagram demo-loop-and-place
%D 2Dx     100 +15 +15
%D 2D  100 NW  N   NE
%D 2D  +15 W   C   E
%D 2D  +15 SW  S   SE
%D 2D
%D (( NW loop  (l,u)   N loop (ul,ur)  NE loop  (u,r)
%D    W  loop (dl,ul)  C place         E  loop (ur,dr)^{abc}
%D    SW loop  (d,l)   S loop (dr,dl)  SE loop  (r,d)
%D ))
%D enddiagram
%D
$$\pu
  \diag{demo-loop-and-place}
$$

-- (find-dn6 "diagforth.lua" "arrows")
-- (find-dn6 "diagforth.lua" "arrows" "loop")
-- (find-dn6 "diagtex.lua" "DxyLoop")






#####
#
# ticked arrowheads
# 2009feb26
#
#####

# «ticked-arrowheads»  (to ".ticked-arrowheads")

from	Michael Barr <barr@math.mcgill.ca>
to	Categories list <categories@mta.ca>
date	Wed, Feb 25, 2009 at 10:08 PM
subject	categories: ticked arrowheads in xy-pic and diagxy
	
A month or two ago, Micah McCurdy wrote to ask me if it was possible to
make an arrow with a tick in the middle (that is ----+---->) and I said I
didn't know how to do that and suggested he ask Ross Moore.  Ross told him
that xy-pic didn't have that capacity.  Well, Micah discovered that it
did.  Here are some samples, using diagxy, but that is just a front end to
xy-pic.

%*
% (eedn4a-bounded)

 $$\bfig
 \node a(0,0)[A]
 \node b(300,400)[B]
 \arrow/@{>}|-*@{>}/[a`b;f]
 \efig$$

 $$\bfig
 \ptriangle/>`>`@{>}|-@{|}/[A`B`C;f`g`h]
 \efig$$

 $$\bfig
 \morphism/@{>}|-@{+}/<700,0>[ABCDE`F;h]
 \efig$$

 $$\bfig
 \morphism/@{>}|-*@{|}/<700,0>[ABCDE`F;h]
 \efig$$

%*

As far as I can tell, the * between the - and the @ has no effect.  The
one limitation is that what goes inside the -@{ } must be a \dir.  This is
a limitation for me, since I cannot figure out the syntax of \newdir.  For
this to work, it clearly has to be something that tex can rotate.

Michael



from	Michael Barr <barr@math.mcgill.ca>
to	Categories list <categories@mta.ca>
date	Sat, Feb 28, 2009 at 1:55 PM
subject	categories: More arrow decorations
	
By playing with Micah's discovery (which is actually documented on page
39, third line from the bottom of Fig. 13), I have come up with the
following potentially useful decorations:

%*
% (eedn4a-bounded)

 $$\bfig  \morphism/@{>}|-@{|}/<500,500>[A`B;f]  \efig$$

 $$\bfig  \morphism/@{>}|-@{x}/<500,500>[A`B;f]  \efig$$

 $$\bfig  \morphism/@{>}|-@{o}/<500,500>[A`B;f]  \efig$$

 $$\bfig  \morphism/@{>}|-@{*}/<500,500>[A`B;f]  \efig$$

 $$\bfig  \morphism/@{>}|-@{||}/<500,500>[A`B;f]  \efig$$

 $$\bfig  \morphism/@{>}|-@{)}/<500,500>[A`B;f]  \efig$$

 $$\bfig  \morphism/@{>}|-@{(}/<500,500>[A`B;f]  \efig$$

%*

The same ideas also work in native xy-pic and, for all I know, in the
matrix version as well.





#####
#
# enddefdiag
# 2009aug11
#
#####

# «enddefdiag»  (to ".enddefdiag")
# (find-dn4 "experimental.lua" "def")

%*
% (eedn4a-bounded)
% (find-sh0 "cd ~/LATEX/ && dvips  -D 300 -P pk -o tmp.ps tmp.dvi")
% (find-sh0 "cd ~/LATEX/ && dvired -D 300 -P pk -o tmp.ps tmp.dvi")
% (find-pspage "~/LATEX/tmp.ps")

%D diagram pmetauniv
%D 2Dx     100    +20
%D 2D  100        #1
%D 2D             -
%D 2D           #4|
%D 2D             v
%D 2D  +20 #2 ==> #3
%D 2D
%D (( #1 #3 |-> .plabel= l #4
%D    #2 #3  =>
%D ))
%D enddefpdiagram 4

$$\pmetauniv abcd$$

%*




#####
#
# dednat5
# 2010apr20
#
#####

# «dednat5»  (to ".dednat5")
# (find-dn4 "dednat4.lua")
# (find-dn4 "dednat5.lua")
# (find-dn4 "dednat5-shadow.lua")
# (find-tkdiff "~/dednat4/dednat4.lua" "~/dednat4/dednat5.lua")

# (find-dn5 "")





#####
#
# How to build "idarct-preprint.pdf" 
# 2015sep30 / 2017mai01
#
#####

# «idarct» (to ".idarct")
# (find-angg ".emacs" "idarct")
# https://mail.google.com/mail/ca/u/0/#search/idarct/13f82428ec76b6e3 <- tgz
#
#    http://angg.twu.net/math-b.html#idarct
# file:///home/edrx/TH/L/math-b.html#idarct
# (find-TH "math-b" "internal-diags-in-ct")
# (find-TH "math-b" "internal-diags-in-ct" "idarct-preprint.pdf")

# (find-idarct0file "")
# (find-idarct0file "Makefile")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
laf -d ~/LATEX/idarct/
laf    ~/LATEX/idarct/
rm -Rv ~/LATEX/idarct/
mkdir  ~/LATEX/idarct/
tar -C ~/LATEX/idarct/ -xvzf ~/LATEX/idarct.tgz
cd     ~/LATEX/idarct/
make idarct-preprint.dvi
make idarct-preprint.pdf

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd ~/dednat6/tests/
cp -v proof.sty ~/LATEX/idarct/

cd ~/LATEX/idarct/
make   idarct-preprint.dvi
dvipdf idarct-preprint.dvi
cd ~/LATEX/idarct/
cp -v  idarct-preprint.dvi ~/LATEX/
cp -v  idarct-preprint.pdf ~/LATEX/
cp -v  frob-sketch.eps     ~/LATEX/

cp -v diagxy.tex ~/LATEX/idarct/



#####
#
# 2017idarct.tex: an attempt to port idarct to dednat6
# 2019apr22
#
#####

# «idarct2017» (to ".idarct2017")
# (find-LATEX "2017idarct.tex")





#####
#
# 2015-2-GA-material: pack into a zip file
# 2016feb15
#
#####

# «GA-material-pack» (to ".GA-material-pack")
# Superseded by: (find-angg "LUA/flsfiles.lua")
# (find-angg       "LATEX/2015-2-GA-material.tex")
# (find-xpdfpage "~/LATEX/2015-2-GA-material.pdf")

# Preparation:
# (find-dn6 "dednat6.lua" "run-tests-in-test-dir")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rv /tmp/ga/
mkdir  /tmp/ga/
cd ~/LATEX/
A=(
2015-2-GA-material.tex
diagxy.tex
edrx15.sty
edrx15defs.tex
edrxaccents.tex
edrxdnt.tex
edrxheadfoot.tex
edrxtikz.lua
istanbuldefs.tex
)
cp -v $A /tmp/ga/

mkdir    /tmp/ga/dednat6/
unzip -d /tmp/ga/dednat6/ /tmp/dednat6.zip

zip -r /tmp/ga.zip *
lualatex 2015-2-GA-material.tex

# (find-fline "/tmp/ga.zip")
# (find-man "zip")

cd  /tmp/ga/
lualatex -recorder 2015-2-GA-material.tex
# (find-fline   "/tmp/ga/2015-2-GA-material.fls")
# (find-sh "sort /tmp/ga/2015-2-GA-material.fls")
# (find-sh "sort /tmp/ga/2015-2-GA-material.fls | grep -v /usr/")





#####
#
# Hyperboles
# 2016jul17
#
#####

# «hyperboles» (to ".hyperboles")
# (find-LATEX "2016-1-GA-material.tex")

= v(3,4)
= v(3,4):norm()
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()
chdir "~/LATEX/"
dofile "edrxtikz.lua" -- (find-LATEX "edrxtikz.lua")
-- (find-LATEX "edrxtikz.lua" "Hyperbole")
PP(V)




#####
#
# dednat6/luarepl
# 2016oct07 / 2019jan06
#
#####

# «dednat6-luarepl» (to ".dednat6-luarepl")
# «luarepl» (to ".luarepl")
# (find-LATEX "2018dednat6-repl.tex")
# (find-LATEX "2018tug-dednat6.tex" "repls-2")

# Old:
# (find-es "lua5" "lua-repl-2016")






#####
#
# thislinetag
# 2017ago09
#
#####

# «thislinetag» (to ".thislinetag")
# (find-es "luatex" "thislinetag")
# (find-LATEX "2017cwm.tex" "thislinetag")



#####
#
# processbigstr (for interactive tests)
# 2017dez30
#
#####

# «processbigstr» (to ".processbigstr")
# (find-dn6 "texfile.lua" "processbigstr")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()
processbigstr [[
%D diagram foo
%D 2Dx     100   +30
%D 2D  100 a <-| b
%D 2D      |     |
%D 2D      v     v
%D 2D  +20 c ==> d
%D 2D
%D (( a b <-| a c -> b d -> c d => 
%D ))
%D enddiagram
]]




#####
#
# Hyperlinks to source
# 2017dez31
#
#####

# «hyperlinks» (to ".hyperlinks")
# (find-dn6 "texfile.lua" "TexFile" "hyperlink =")
# (find-dn6 "diagforth.lua" "enddiagram")
# (find-dn6 "diagforth.lua" "enddiagram" "no hyperlink yet")
# (find-dn6 "diagforth.lua" "enddiagram" "tf:hyperlink()")
# (find-dn6file "treetex.lua" "tf:hyperlink()")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()
bigstr = [[
%:  a  b 
%:  ----?
%:    c     
%:    
%:    ^foo     
%:
%D diagram bar
%D 2Dx     100   +30
%D 2D  100 a <-| b
%D (( a b <-|
%D ))
%D enddiagram
]]
processbigstr(bigstr)
hyperlinkfmt = '(find-es "dednat" "hyperlinks" (+ 9 %s))'
processbigstr(bigstr)



no hyperlink yet
= format("foo", 10)
= format('(find-fline "foo" %d)', 10)







#####
#
# Porting BOX to dednat6
# 2017dez29
#
#####

# «BOX-dednat6» (to ".BOX-dednat6")
# (find-dn6 "diagforth.lua" "BOX")
#
# (find-dn4 "experimental.lua" "BOX")
# (find-dn4 "examples/edrx08.sty" "savebox")
# (find-dn4 "examples/edrx08.sty" "diagprep")
# (find-idarct0file "2010diags-body.tex")
# (find-idarct0file "2010diags-body.tex" "dnc .tex=" "BOX")
# (find-idarct0file "2010diags.dnt")
# (find-idarct0file "2010diags.dnt" "\\savebox{\\myboxa}{$\\fcded{dict-1-dnc}$}")
# (find-dn6 "preamble6.lua" "preamble1")
# (find-dn6 "diagforth.lua" "enddiagram")
# (find-dn6 "diagtex.lua" "arrows_to_defdiag")
# (find-dn6grep "grep -nH -e arrows_to_defdiag *")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()
bigstr = [[
%:  a  b    d  e
%:  ----?   ----!
%:    c       f
%:    
%:    ^foo    ^bar
%:
%D diagram plic
%D 2Dx     100    +30
%D 2D  100 foo -> bar
%D
%D (( foo .tex= \fcded{foo} BOX
%D    bar .tex= \fcded{bar} BOX
%D    foo bar ->
%D ))
%D enddiagram
]]
processbigstr(bigstr)





#####
#
# .curve=
# 2018dec22
#
#####

# «curve» (to ".curve")
# (find-dn6grep "grep --color -nH -e curve *.lua")
# (find-dn6 "diagtex.lua" "arrow_to_TeX-test")
# (find-dn6 "diagtex.lua" "arrow_to_TeX" "curve =")
# (find-dn6 "diagforth.lua" ".curve=")
# (find-es "diagxy" "moving-labels")
# (find-es "diagxy" "shape")

# Old:
# (find-dn4grep "grep --color -nH -e curve *")
# (find-LATEXgrep "grep --color -nH -e '.curve=' *.tex")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()
require "diagtex"
test = function (A) print(arrow_to_TeX(A)) end
storenode {TeX="a", tag="a", x=100, y=100}
storenode {TeX="b", tag="b", x=140, y=100}
test {from="a", to="b", shape="|->"}
test {from="a", to="b", shape="|->", label="up", placement="a"}
test {from="a", to="b", shape="|->", label="up", placement="a", slide="5pt"}
test {from="a", to="b", shape="|->", label="up", lplacement="_(0.42)"}  -- err?





#####
#
# dednat6.zip: 2018 version (just after the TUGBoat article)
# 2018dec23
#
#####

# «dednat6.zip-2018» (to ".dednat6.zip-2018")
# (find-latex-upload-links "2018dednat6-extras")
# (find-angg ".zshrc" "flsfiles")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd  ~/LATEX/
cat ~/LATEX/2018tugboat-rev1.fls \
    ~/LATEX/2018tug-dednat6.fls \
    ~/LATEX/2018dednat6-extras.fls \
    ~/LATEX/2018dednat6-minimal.fls \
    ~/LATEX/2018dednat6-repl.fls \
    ~/LATEX/2018dednat6-no-lua.fls \
    > /tmp/o.fls
flsfiles /tmp/o.fls | tee /tmp/o2.fls
(TZ=GMT date; date) > VERSION
rm  dednat6.zip
zip dednat6.zip $(cat /tmp/o2.fls) \
  2018tugboat-rev1.pdf    \
  2018tug-dednat6.pdf     \
  2018dednat6-extras.pdf  \
  2018dednat6-minimal.pdf \
  2018dednat6-no-lua.pdf \
  VERSION

laf dednat6.zip
# (find-sh "unzip -lv ~/LATEX/dednat6.zip")
cd ~/LATEX/
Scp-np -v dednat6.zip edrx@angg.twu.net:/home/edrx/slow_html/
Scp-np -v dednat6.zip edrx@angg.twu.net:/home/edrx/public_html/


# «dednat6.zip-test» (to ".dednat6.zip-test")
# (find-LATEX "2018dednat6-extras.tex" "dednat6.zip-test")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rfv /tmp/dn6-test/
mkdir   /tmp/dn6-test/
cd      /tmp/dn6-test/
wget http://angg.twu.net/dednat6.zip
# cp -v ~/LATEX/dednat6.zip .
unzip dednat6.zip
rm -v *.pdf
lualatex 2018tugboat-rev1.tex
lualatex 2018tugboat-rev1.tex
lualatex 2018tug-dednat6.tex
lualatex 2018tug-dednat6.tex
lualatex 2018dednat6-extras.tex
lualatex 2018dednat6-extras.tex
lualatex 2018dednat6-minimal.tex
lualatex 2018dednat6-no-lua.tex
mkdir no-lua/
cd    no-lua/
cp -v ../2018dednat6-no-lua.tex ../2018dednat6-no-lua.dnt .
pdflatex 2018dednat6-no-lua.tex

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rfv /tmp/dn6-test-min/
mkdir   /tmp/dn6-test-min/
cd      /tmp/dn6-test-min/
# wget http://angg.twu.net/dednat6.zip
cp -v ~/LATEX/dednat6.zip .
unzip dednat6.zip "dednat6/**" dednat6load.lua 2018dednat6-minimal.tex
lualatex 2018dednat6-minimal.tex
xpdf 2018dednat6-minimal.pdf

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rfv /tmp/dn6-test-no-lua/
mkdir   /tmp/dn6-test-no-lua/
cd      /tmp/dn6-test-no-lua/
# wget http://angg.twu.net/dednat6.zip
cp -v ~/LATEX/dednat6.zip .
unzip dednat6.zip "dednat6/**" dednat6load.lua 2018dednat6-no-lua.tex
lualatex 2018dednat6-no-lua.tex
mkdir no-lua/
cd    no-lua/
cp -v ../2018dednat6-no-lua.tex ../2018dednat6-no-lua.dnt .
pdflatex 2018dednat6-no-lua.tex
xpdf     2018dednat6-no-lua.pdf

# (find-fline "/tmp/dn6-test/")
# (find-fline "/tmp/dn6-test-min/")




#####
#
# dednat6.zip: version of may 2019
# 2019may15
#
#####

# «dednat6.zip-2019» (to ".dednat6.zip-2019")
# (find-TH "dednat6" "testing:script")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd  ~/LATEX/
cat ~/LATEX/2018tugboat-rev1.fls \
    ~/LATEX/2018tug-dednat6.fls \
    ~/LATEX/2018dednat6-extras.fls \
    ~/LATEX/2018dednat6-minimal.fls \
    ~/LATEX/2018dednat6-repl.fls \
    ~/LATEX/2018dednat6-no-lua.fls \
    > /tmp/o.fls
flsfiles /tmp/o.fls | tee /tmp/o2.fls
(TZ=GMT date; date) > VERSION
rm  dednat6.zip
zip dednat6.zip $(cat /tmp/o2.fls) \
  2018dednat6-preproc.tex \
  2018tugboat-rev1.pdf    \
  2018tug-dednat6.pdf     \
  2018dednat6-extras.pdf  \
  2018dednat6-minimal.pdf \
  VERSION

laf dednat6.zip
# (find-sh "unzip -lv ~/LATEX/dednat6.zip")
cd ~/LATEX/
Scp-np -v dednat6.zip edrx@angg.twu.net:/home/edrx/slow_html/
Scp-np -v dednat6.zip edrx@angg.twu.net:/home/edrx/public_html/

# (find-TH "dednat6" "testing:script")
# (find-twusfile "")



#####
#
# New code for contours
# 2018dec30
#
#####

# «contours-new» (to ".contours-new")
# (find-dn6 "zhas.lua" "ZHA-walls")
# (find-dn6 "zhas.lua" "Cuts-tests")
# (find-dn6file "zhas.lua" "addcuts =")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()
z = ZHA.fromspec("123432343234321")
= z
z:PP()
PP(z:leftwallgenerators())

contourstr = function (z)
    local str = "00s"
    local store = function (s) str = str.."-"..s end
    for _,P in ipairs(z:leftwallgenerators()) do
      local l1,r1 = P:to_l_r()
      local l0 = l1-1
      local r0 = z.minr[l0]
      store(l0..r0.."w-"..l1..r1.."s")
    end
    store(z.topl..z.minr[z.topl].."w")
    store(z.topl..z.topr.."n")
    store(z.minl[z.topr]..z.topr.."e")
    rwgens = z:rightwallgenerators()
    for i=#rwgens,1,-1 do
      local P = rwgens[i]
      local l1,r1 = P:to_l_r()
      local r0 = r1-1
      local l0 = z.minl[r0]
      store(l1..r1.."s-"..l0..r0.."e")
    end
    return str
  end

= contourstr(z)
= z


A implementação atual é meio tosca. O ideal seria que eu
adicionasse na classe V, e na função v, o suporte a sufixos como
s, n, e, w...




#####
#
# Using a sub-ZHA (as in PHA3)
# 2018dec30
#
#####

# «sub-ZHA» (to ".sub-ZHA")
# (find-LATEX "2017planar-has-3.tex" "classifier")
# (find-dn6grep "grep --color -nH -e addcuts *.lua")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()
z = ZHA.fromtcgspec("4, 5; 32, 14 25"):print()
mp = MixedPicture.new({}, z):addlrs():addcutssub("34", "c"):print()
mp = MixedPicture.new({}, z):addlrs():addcuts("2/1"):print()
mp = MixedPicture.new({}, z):addlrs():addcuts("4/3"):print()
mp = MixedPicture.new({}, z):addlrs():addcuts("5/4"):print()
mp = MixedPicture.new({}, z):addlrs():addcuts("2|3"):print()
z:PP()

-- (find-dn6 "zhas.lua" "MixedPicture-zha")
-- (find-dn6 "zhas.lua" "MixedPicture-zhalrf-tests")

myspec = "1R2R3212RL1"
mycuts = "c 4321/0 0123|45|6"
mytop  = v"35"
myf    = "lr -> lr:below(mytop) and lr:lr() or '..'"

mp = mpnew({}, myspec):addcutssub(mytop, mycuts):addlrs():print()
mp = mpnew({}, myspec):addcutssub(mytop, mycuts):adddots():print()
mp = mpnew({}, myspec):addcutssub(mytop, mycuts):zhalrf0(myf):print()
mytop = v"34"
mp = mpnew({}, myspec):addcutssub(mytop, mycuts):zhalrf0(myf):print()
mp:print()


* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()

myspec = "1232RL1"
mycuts = "c 32/10 012|3"
mytop  = v"35"
myf    = "lr -> lr:below(mytop) and lr:lr() or '..'"

foo = function (top, opts)
    mytop = v(top)
    mpnew(opts, myspec):addcutssub(mytop, mycuts):zhalrf0(myf):print()
  end
foo("33", {})
foo("32", {})
foo("20", {})
foo("10", {})


-- (find-LATEX "2017planar-has-1.tex" "topologies-as-HAs")
-- (find-LATEX "2017planar-has-1.tex" "topologies-on-2CGs")
-- (ph1     "topologies-on-2CGs")
-- (ph1     "topologies-on-2CGs" ":addgens()")
-- (ph1p 27 "topologies-on-2CGs")
-- (ph1p 30)
-- (find-dn6file "zhas.lua" "addgens =")




#####
#
# Adding arbitrary pict2e code to an LPicture object
# 2019apr27
#
#####

# «LPicture-add-pict2e» (to ".LPicture-add-pict2e")
# (find-dn6 "picture.lua" "LPicture")
# (find-dn6 "picture.lua" "LPicture" "addtex =")
# (find-dn6 "picture.lua" "LPicture" "addtex =" "addt")
# (find-dn6 "zhas.lua" "MixedPicture")
# (find-dn6 "zhas.lua" "MixedPicture-zhalrf-tests")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()
mp = mpnew({}, "123454321")
mp = mpnew({}, "123454321"):addlrs()
mp = mpnew({}, "123454321"):addlrs():addcontour()
mp:print()
mp:lprint()
mp.lp:print()
mp.lp:addtex("HELLO"):print()
mp.lp:addtex("HELLO"):print()
mp.lp:addt("\\polygon%s%s%s%s", 2, 3, 4, 5):print()

PPV(LPicture.__index)
PPV(MixedPicture.__index)

mp = mpnew({}, "123454321")




#####
#
# Adding a V.walk method and support for things like "23e"
# 2019apr28
#
#####

# «V.walk» (to ".V.walk")
# (find-dn6 "picture.lua" "V")
# (find-dn6 "picture.lua" "V" "v = V.fromab")
# (find-dn6 "picture.lua" "V" "walk =")
# (find-dn6 "picture.lua" "V" "fromab =")
# (find-dn6 "picture.lua" "V" "fromab =" "ensw")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()
= v"22"
= v"22":w()

PPV(V.__index)
= v"22"
= v"22":walk"e"
= v"22e"

# TODO: simplify this:
# (find-dn6 "zhas.lua" "Cuts")
# (find-dn6 "zhas.lua" "Cuts" "addcuts =")
# (find-dn6 "zhas.lua" "Cuts" "addcuts =" "local f =")





#####
#
# LPicture.addrect
# 2019apr28
#
#####

# «LPicture.addrect» (to ".LPicture.addrect")
# (find-dn6 "picture.lua" "LPicture")
# (find-dn6 "picture.lua" "LPicture" "addtex =")
# (find-dn6 "picture.lua" "LPicture" "addtex =" "addt")
# (find-dn6 "picture.lua" "LPicture" "addrect4 =")
# (find-dn6 "zhas.lua" "MixedPicture")
# (find-dn6 "zhas.lua" "MixedPicture-zhalrf-tests")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()
mp = mpnew({}, "123454321")
mp = mpnew({}, "123454321"):addlrs()
mp = mpnew({def="foo"}, "123454321"):addlrs()

LPicture.__index.addrect4 = function (lp, x0, y0, x1, y1)
    return lp:addt("\\polygon(%s,%s)(%s,%s)(%s,%s)(%s,%s)",
                   x0,y0, x1,y0, x1,y1, x0,y1)
  end
LPicture.__index.addrect2 = function (lp, x0y0, x1y1)
    local x0,y0 = x0y0:to_x_y()
    local x1,y1 = x1y1:to_x_y()
    return lp:addt("\\polygon(%s,%s)(%s,%s)(%s,%s)(%s,%s)",
                   x0,y0, x1,y0, x1,y1, x0,y1)
  end

mp.lp:addrect2(v"00", v"23")
mp.lp:print()





#####
#
# Adding rectangles to TCG to debug dimensions
# 2019apr28
#
#####

# «TCG.addrect» (to ".TCG.addrect")
# (find-LATEX "edrxpict.lua" "TCG")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
chdir "~/LATEX/"
require "edrxpict"





#####
#
# TCGDims
# 2019apr28
#
#####

# «TCGDims» (to ".TCGDims")
# (find-LATEX "edrxpict.lua" "TCGDims")
# (find-dn6 "picture.lua" "LPicture")
# (find-dn6 "picture.lua" "LPicture" "addtex =")
# (find-dn6 "picture.lua" "LPicture" "addtex =" "addt")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
chdir "~/LATEX/"
require "edrxpict"

lp = LPicture.new({meta="p b", def="foo"})
lp:addpoint(v(1,1))
lp:addpoint(v(4,8))
lp:addrect2(v(2,1), v(3,2))
= lp

LPicture.__index.addarrow = function (lp, A, B, t0, t1)
    lp:addtex(Line.newAB(A, B, t0, t1):pictv())
  end

-- (find-LATEX "edrxpict.lua" "TCGDims")
lp = LPicture.new({meta="p b", def="foo"})
td = TCGDims {h=6, v=3, q=2, crh=2, crv=1, qrh=1}
lp:addpoint(td:lowerleft())
lp:addpoint(td:upperright(4))
lp:addrectr(td:L(0), td:cellradius())
lp:addrectr(td:L(1), td:cellradius())
lp:addrectr(td:L(2), td:cellradius())
lp:addrectr(td:R(0), td:cellradius())
lp:addrectr(td:R(1), td:cellradius())
lp:addrectr(td:R(2), td:cellradius())
lp:addrectr(td:R(3), td:cellradius())
lp:addrectr(td:R(4), td:cellradius())
lp:addarrow(td:larrowparams(2, 1))
lp:addarrow(td:lrarrowparams(2, 1))
lp:addarrow(td:lrarrowparams(2, 0))
= lp




#####
#
# \defzha and \deftcg
# 2019apr29
#
#####

# «defzha-and-deftcg» (to ".defzha-and-deftcg")
# (find-LATEX "2017planar-has-defs.tex" "defzha-and-deftcg")
# (find-dn6 "picture.lua" "makepicture")
# (find-dn6 "picture.lua" "makepicture" "options.tdef")
# (find-dn6 "picture.lua" "makepicture" "options.zdef")

\def\defzha#1#2{\expandafter\def\csname zha-#1\endcsname{#2}}
\def\ifzhaundefined#1{\expandafter\ifx\csname zha-#1\endcsname\relax}
\def\zha#1{\ifzhaundefined{#1}
    \errmessage{UNDEFINED ZHA: #1}
  \else
    \csname zha-#1\endcsname
  \fi
}
\def\deftcg#1#2{\expandafter\def\csname tcg-#1\endcsname{#2}}
\def\iftcgundefined#1{\expandafter\ifx\csname tcg-#1\endcsname\relax}
\def\tcg#1{\iftcgundefined{#1}
    \errmessage{UNDEFINED TCG: #1}
  \else
    \csname tcg-#1\endcsname
  \fi
}




#####
#
# defub
# 2021jul17
#
#####

# «defub»  (to ".defub")
# Example: (find-LATEX "2017planar-has-1.tex" "prop-calc-ZHA")
#          (find-LATEX "2017planar-has-1.tex" "prop-calc-ZHA" "defub")
# (find-LATEXgrep "grep --color=auto -nH --null -e    'defub' *.tex")
# (find-LATEXgrep "grep --color=auto -nH --null -e '%L defub' *.tex")




#####
#
# A way to convert question marks to cuts
# 2019apr29
#
#####

# «qmarks-to-cuts» (to ".qmarks-to-cuts")
# (find-dn6 "zhas.lua" "MixedPicture-J-tests")
# (find-dn6 "zhas.lua" "MixedPicture-J-tests" "Imp")
# (find-dn6 "zhas.lua" "mpnewJ")
# (find-dn6 "zhas.lua" "mpnewJ" ":zhaJcuts()")
# (find-dn6 "zhas.lua" "MixedPicture-zha")
# (find-dn6 "zhas.lua" "MixedPicture-zha" "zhaJcuts =")
# (find-dn6 "zhas.lua" "ZHA-getcuts")
# (find-dn6 "zhas.lua" "ZHA-getcuts" "getcuts =")

# (find-dn6 "tcgs.lua" "qmarks-cuts")
# (find-dn6 "zhas.lua" "Cuts-tests")
# (find-dn6 "zhas.lua" "Cuts-tests" "c:addcuts(")
# (find-dn6 "zhas.lua" "Cuts")
# (find-dn6 "zhas.lua" "Cuts" "addcuts =")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()
require "tcgs"
mp = mpnewJ({}, "1234RR321", "P -> z:Imp(v'12', P)")
= mp
= mp.zha:getcuts(mp.J)
= mp:addlrs()

PP(qmarkstocuts(".??", "..???"))
PP(cutstoqmarks "321/0 0|1|2345")

--      _5 ?
--      _4 ?
-- ? 3_ _3 ?
-- ? 2_ _2
--   1_ _1



#####
#
# How to run dednat6 from a Lua without TeX and generate a .dnt
# 2019apr29
#
#####

# «dednat6-dnt-from-lua» (to ".dednat6-dnt-from-lua")
# (find-LATEXfile "2018dednat6-no-lua.tex" "write_dnt_file()")
# (find-dn6 "output.lua" "write_dnt_file")
# (find-LATEX "dednat6load.lua")
# (find-dn6file "preamble6.lua" "\\def\\pu{\\directlua{pu()}}")
# (find-dn6 "block.lua" "texfile0")
# (find-dn6 "block.lua" "texfile0" "pu =")
# (find-dn6 "output.lua" "output")
# (find-dn6 "output.lua" "output" "output_verbose =")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
chdir "~/LATEX/"
-- (find-LATEX "dednat6load.lua")
dednat6dir = "dednat6/"            -- (find-dn6 "")
dofile(dednat6dir.."dednat6.lua")  -- (find-dn6 "dednat6.lua")
dofile(dednat6dir.."block.lua")    -- (find-dn6 "block.lua")
texfile0("2018dednat6-minimal.tex")
tex = {print = function () end}
-- pu(tf.j)
tf:processuntil(tf.j)
print(dnt_log)




#####
#
# Changing output_dnt to add debug code
# 2019may02
#
#####

# «output_dnt» (to ".output_dnt")
# (find-dn6 "output.lua" "output_dnt")

%L output_dnt = function (str)
%L     dnt_log = dnt_log..str.."\n"
%L   end
%L output_dnt = function (str)
%L     dnt_n = dnt_n or 1
%L     local dbg = "% "..dnt_n.."\n"
%L     if dnt_n == 15 then dbg = dbg..debug.traceback().."\n" end
%L     dnt_log = dnt_log..dbg..str.."\n"
%L     dnt_n = dnt_n + 1
%L   end




#####
#
# Changing output() to make it run well outside latex
# 2019dec15
#
#####

# «output-no-tex» (to ".output-no-tex")
# (find-dn6 "output.lua" "output_dnt")

output = function (str) print(str) end





#####
#
# Add things like "% %L-block in lines 42-99" to the latex of LPictures
# 2019apr30
#
#####

# «hyperlinks-in-LPicture» (to ".hyperlinks-in-LPicture")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd ~/LATEX/
./dednat6load.lua -t 2019logicday.tex

# (find-LATEXsh "./dednat6load.lua -t 2019logicday.tex")
# (find-LATEXsh "./dednat6load.lua -t 2019logicday.tex" "\\def\\Kmini")

# Better line numbers in the output:
# (find-dn6 "treetex.lua" "TreeNode")
# (find-dn6 "treetex.lua" "TreeNode" "TeX_deftree = ")
# (find-dn6grep "grep --color -nH -e TeX_deftree *.lua")
# (find-dn6file "block.lua" "hyperlink =")

# (find-dn6grep "grep --color -nH -e hyperlink *.lua")
# (find-dn6grep "grep --color -nH -e 'tf:hyperlink()' *.lua")
# (find-dn6 "block.lua" "Block")
# (find-dn6 "block.lua" "Block" "hyperlink =")
# (find-dn6 "treetex.lua" "TeX_deftree_tatsuta")
# (find-dn6 "treetex.lua" "TeX_deftree_tatsuta" "tf:hyperlink()")
# (find-dn6 "diagtex.lua" "arrows_to_defdiag")

# (find-dn6grep "grep --color -nHw -e Line *.lua")
# (find-dn6 "texfile.lua" "TexFile")
# (find-dn6 "texfile.lua" "TexFile" "Line %s")

# (find-dn6 "picture.lua" "LPicture")
# (find-dn6 "picture.lua" "LPicture" "output =")




#####
#
# Dednat6 at stackexchange
# 2019may17
#
#####

# «stackexchange» (to ".stackexchange")
# https://tex.stackexchange.com/questions/468/what-is-the-best-package-out-there-to-typeset-proof-trees/491248#491248



#####
#
# A git repository for dednat6 - creating it (obsolete)
# 2019may17
#
#####

# «git-repo» (to ".git-repo")
# (find-eev2-links)
# (find-es "dednat" "dednat6.zip-2019")
# (find-LATEXfile "" " dednat6.zip")
# https://github.com/edrx/dednat6
# https://github.com/edrx/dednat6/archive/master.zip

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
dednat6files () { unzip -Z1 ~/LATEX/dednat6.zip; }
dednat6files () {( cd /tmp/dednat6/ && git ls-files; )}

mkdir -p ~/dednat6/dednat6/lua-repl/repl/
cd       ~/dednat6/
# (...)
dednat6files | my-cmp-tkdiff "~/LATEX/" "~/dednat6/"

# (find-eevfile "README.md")
# (find-fline "~/dednat6/README.md")

git add README.md
git commit -m "first commit"
git remote add origin https://github.com/edrx/dednat6.git
git push -u origin master





#####
#
# Downloading and testing dednat6 from git
# 2019may21
#
#####

# «git-repo-test» (to ".git-repo-test")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rfv /tmp/dednat6/
cd      /tmp/
git clone https://github.com/edrx/dednat6
cd      /tmp/dednat6/
make
make clean
laf

# (find-gitk "/tmp/dednat6/")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rfv /tmp/master.zip
rm -Rfv /tmp/dednat6-master/
mkdir   /tmp/dednat6-master/
cd      /tmp/
wget https://github.com/edrx/dednat6/archive/master.zip
unzip master.zip
cd      /tmp/dednat6-master/
make
make clean
laf




#####
#
# Uploading recent updates to the git repository
# 2019jul19
#
#####

# «git-repo-update» (to ".git-repo-update")
# (find-angg ".emacs" "find-dednat6-links")
# (find-dednat6-links)
# (find-eev2-links)
# (find-angg "dednat6/")
# https://github.com/edrx/dednat6

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
dednat6files    () {( cd /tmp/dednat6/ && git ls-files; )}
dednat6pdffiles () {( cd /tmp/dednat6/ && ls *.pdf | cat; )}
dednat6pdffiles () {( cd ~/dednat6/ && ls *.pdf | cat; )}

(TZ=GMT date; date) > ~/dednat6/VERSION
rm -Rfv /tmp/dednat6
cd      /tmp/
git clone https://github.com/edrx/dednat6
cd      /tmp/dednat6/

PAGER=cat git log --oneline --graph --all -20

# (find-fline "/tmp/")
# (find-fline "/tmp/dednat6/")
# (find-gitk  "/tmp/dednat6/")

# First step: make sure that ~/LATEX/dednat6/
# and ~/dednat6/ are in sync.
#
cd      /tmp/dednat6/
dednat6files | grep lua | my-cmp-tkdiff "~/LATEX/" "~/dednat6/"
dednat6files |            my-cmp-tkdiff "~/dednat6/" /tmp/dednat6/

# cp -iv ~/LATEX/dednat6/diagtikz.lua dednat6/
# git add dednat6/diagtikz.lua
# cp -iv ~/dednat6/demo-tikz.tex .
# git add demo-tikz.tex

MSG="Make deletecomments_2021 the default."
MSG="Added the DeleteComments class in output.lua."
MSG="Now '%L' blocks ignore the first space after the '%L'."
MSG="Added 'newnode:' and 'at:'."
MSG="Rewrote lualoader.lua to make it handle a bug in TeXLive 2020."
MSG="Added the classes ProofSty and BussProofs to treetex.lua."
MSG="Added diagtikz.lua and demo-tikz.tex."
MSG="Rewrote demo-tikz.tex."
MSG="Added more comments to diagtex.lua."
MSG="Added 'xy+='."
echo "$MSG"

# (magit-status "/tmp/dednat6/")
git commit -a -m "$MSG"

# (find-eevsh0 "PAGER=cat git log -1 --pretty=tformat:%s")
# git commit -a --amend -m "$MSG"

# (find-gitk ee-eevdir)
# (find-eevsh0 "gitk &")
git push

# edrx Fa

cd      /tmp/dednat6/
cd ~/dednat6/
make veryclean
make
make clean
ls
laf
dednat6pdffiles
rm -v /tmp/dednat6.zip
zip   /tmp/dednat6.zip $(dednat6files) $(dednat6pdffiles)
laf   /tmp/dednat6.zip
unzip -l /tmp/dednat6.zip

cp -v /tmp/dednat6.zip ~/LATEX/

cd /tmp/
Scp-np dednat6.zip edrx@angg.twu.net:/home/edrx/slow_html/
Scp-np dednat6.zip edrx@angg.twu.net:/home/edrx/public_html/
Scp-np -v dednat6.zip edrx@angg.twu.net:/home/edrx/public_html/

# (find-dednat6 "Makefile")
# (find-fline "/tmp/dednat6/Makefile")





#####
#
# A Makefile for the dednat6/ directory
# 2019may19
#
#####

# «makefile» (to ".makefile")
# (find-dednat6 "Makefile")
# (find-dednat6 "")
# (find-dednat6sh "ls *.tex; ls *.lua; ls *.png")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd ~/dednat6/
make veryclean
make -n
make all

# (find-es "git" "git-ls-files")
git ls-files

make tugboat-rev2.pdf

git rm ltugboat.cls
git add Makefile
git commit -a -m 'Added a makefile'
git commit -a -m 'Small doc fixes.'
git push

make clean
laf
make all
laf
make clean
laf

make demo-minimal.pdf
make demo-preproc.pdf
make demo-preproc.subdirpdf
make demo-write-dnt.pdf
make demo-write-dnt.subdirpdf

make tugboat-rev2.pdf





#####
#
# Guidelines for preparing Dednat6 for submission to CTAN
# 2019may21
#
#####

# «ctan-guidelines» (to ".ctan-guidelines")
# https://tex.stackexchange.com/questions/25116/what-is-good-practice-when-preparing-a-package-for-ctan




#####
#
# Submitting my notes on Yoneda to Arxiv
# 2019jun01
#
#####

# «arxiv-yoneda» (to ".arxiv-yoneda")
# http://angg.twu.net/LATEX/2019notes-yoneda.pdf
# https://arxiv.org/user/
# https://arxiv.org/submit/2713866/preview
# https://arxiv.org/submit/2713866/view
# (nyo)

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd ~/LATEX/
lualatex         2019notes-yoneda.tex
pdflatex -record 2019notes-yoneda.tex
flsfiles-zip     2019notes-yoneda.fls 2019notes-yoneda.zip

rm -rfv  /tmp/edrx-latex/
mkdir    /tmp/edrx-latex/
unzip -d /tmp/edrx-latex/     ~/LATEX/2019notes-yoneda.zip
cd       /tmp/edrx-latex/
pdflatex 2019notes-yoneda.tex
   latex 2019notes-yoneda.tex

# (find-man "unzip")

# (find-fline    "/tmp/edrx-latex/")
# (find-fline    "~/LATEX/2019notes-yoneda.zip")
# (find-sh "cp -v ~/LATEX/2019notes-yoneda.zip /tmp/")
# (find-xpdfpage "/tmp/edrx-latex/2019notes-yoneda.pdf")

# ! LaTeX Error: Option clash for package hyperref.
# https://www.quora.com/Should-I-post-my-paper-to-the-arXiv-before-I-get-a-decision-from-a-conference-journal
# https://veronikach.com/phd-advice/my-thoughts-on-preprints/
# https://tex.stackexchange.com/questions/329461/arxiv-option-clash-for-package-hyperref-when-there-are-no-options
# https://arxiv.org/help/submit_tex
# https://arxiv.org/help/faq/mistakes
# https://arxiv.org/help/hypertex


A diagram for the Yoneda Lemma (in which each node and arrow can be
interpreted precisely as a ``term'', and most of the interpretations
are ``obvious''; plus dictionaries!!!)

The full title of these slides is:

``A diagram for the Yoneda Lemma (In which each node and arrow can be
interpreted precisely as a `term', and most of the interpretations are
`obvious'; plus dictionaries!!!)''



This is a set of slides showing how to represent
 the Yoneda Lemma ---
or, rather, three ``Yoneda Lemmas'' --- as diagrams, in a way that le


This is a set of slides showing how to represent the Yoneda Lemma ---
or, rather, three ``Yoneda Lemmas'' --- as diagrams, in a way in which
eacy node and arrow can be interpreted precisely as a term in a type
system or in Agda, 

Most of the details that do not appear in these 6-node diagrams that
are needed for the translation to Agda can 




This is a set of slides showing how to interpret the three ``Yoneda
Lemmas'' as diagrams with five or six nodes each, in a way in which
each node and arrow can be interpreted precisely as a term in a type
system or in Agda.

These 5- or 6-node diagrams do not have all the details needed for the
translation into terms, but we show how to infer the missing details
using the technique of ``internal diagrams''.





#####
#
# tf:push and tf:pop
# 2019jul02
#
#####

# «tf:push» (to ".tf:push")
# (find-dn6 "stacks.lua")
# (find-dn6 "block.lua")
# (find-dn6 "block.lua" "TexLines")
# (find-dn6 "block.lua" "texfile0")
# (find-dn6 "block.lua" "tf_push_and_tf_pop")



#####
#
# diaxydoc.pdf and barrdoc.pdf
# 2019jul16
#
#####

# «diaxydoc-and-barrdoc» (to ".diaxydoc-and-barrdoc")
# (find-angg ".emacs" "diaxydoc-and-barrdoc")
# https://ctan.org/pkg/diagxy
# http://tug.ctan.org/tex-archive/macros/generic/diagrams/diagxy/diaxydoc.pdf
# http://tug.ctan.org/tex-archive/macros/latex/contrib/xypic/doc/barrdoc.pdf
# (find-tlsh "find * | sort | grep diaxydoc")
# (find-tlsh "find * | sort | grep barrdoc")
# (find-fline "/usr/local/texlive/2018/texmf-dist/doc/generic/barr/" "diaxydoc.pdf")
# (find-fline "/usr/local/texlive/2018/texmf-dist/doc/generic/xypic/" "barrdoc.pdf")

;; (find-diaxydocpage)
;; (find-diaxydoctext)
;; (find-barrdocpage)
;; (find-barrdoctext)
;; (find-barrdocpage 2 "\\usepackage[barr,pdf]{xy}")
;; (find-barrdoctext 2 "\\usepackage[barr,pdf]{xy}")
;; (find-barrdocpage 24 "5.3    Empty placement and moving labels")
;; (find-barrdoctext 24 "5.3    Empty placement and moving labels")
;; (find-barrdocpage 33 "5.9   A few samples")
;; (find-barrdoctext 33 "5.9   A few samples")
;; (find-diaxydocpage 34 "4.9   A few samples")
;; (find-diaxydoctext 34 "4.9   A few samples")




#####
#
# Lua files in CTAN packages
# 2019jul18
#
#####

# «lua-files-in-ctan-pkgs» (to ".lua-files-in-ctan-pkgs")

# https://tug.org/pipermail/tex-live/2019-July/043918.html
# https://tug.org/pipermail/tex-live/2019-July/043922.html invitation

* e-mail to texlive: Packages that only have Lua files
https://tug.org/pipermail/tex-live/2019-July/043931.html
https://mail.google.com/mail/ca/u/0/#sent/QgrcJHsHpDWxZJHjjFnVDPsgGhwhCsfctBG
Packages that only have Lua files
Hi List,

Are there any examples on CTAN of packages that are made of Lua files
only, except for documentation? I have this package here, that I would
like to submit to CTAN soon - i.e., in a few months - that is like
that...

  http://angg.twu.net/dednat6.html

In order to use it, in, say, foo.tex, one has to copy to the same
directory of foo.tex the file "dednat6load.lua" and the directory
"dednat6/" - that only contains Lua files.

  Thanks in advance!!!
    Eduardo Ochs
    http://angg.twu.net/dednat6.html
    http://angg.twu.net/math-b.html
    http://angg.twu.net/#eev

# https://tug.org/pipermail/tex-live/2019-July/043935.html xindex
# https://ctan.org/pkg/xindex
# (find-tlsh "find * | sort | grep xindex")

# https://tug.org/pipermail/tex-live/2019-July/043937.html .sty
# https://tug.org/pipermail/tex-live/2019-July/043938.html lualibs, luaotfload




#####
#
# Mapping the quirks that don't let me create a .sty for dednat6
# 2019jul20
#
#####

# «quirks-2019-jul» (to ".quirks-2019-jul")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rv /tmp/quirks/
mkdir  /tmp/quirks/
cd   ~/dednat6/
cp -av demo-minimal.tex dednat6load.lua dednat6/ /tmp/quirks/
cd     /tmp/quirks/

lualatex demo-minimal.tex
cp -iv demo-minimal.tex demo-BCD.tex
cp -iv demo-minimal.tex demo-BDC.tex
cp -iv demo-minimal.tex demo-BD.tex
cp -iv demo-minimal.tex demo-CDB.tex
cp -iv demo-minimal.tex demo-DCB.tex

# (find-fline "/tmp/quirks/demo-minimal.tex" 56)
# (find-fline "/tmp/quirks/demo-BCD.tex" 56)
# (find-fline "/tmp/quirks/demo-BDC.tex" 56)
# (find-fline "/tmp/quirks/demo-BD.tex" 56)
# (find-fline "/tmp/quirks/demo-CDB.tex" 56)
# (find-fline "/tmp/quirks/demo-DCB.tex" 56)

lualatex demo-BCD.tex
lualatex demo-BDC.tex
lualatex demo-BD.tex
lualatex demo-CDB.tex
lualatex demo-DCB.tex

# (find-fline "/tmp/quirks/a.tex")
# (find-fline "/tmp/quirks/")
# (find-pdf-page "/tmp/quirks/demo-BCD.pdf")
# (find-pdf-page "/tmp/quirks/demo-BDC.pdf")
# (find-pdf-page "/tmp/quirks/demo-BD.pdf")
# (find-pdf-page "/tmp/quirks/demo-CDB.pdf")
# (find-pdf-page "/tmp/quirks/demo-DCB.pdf")
# BCD: default, good
# BCD: some omegas
# BD: many omegas
# DCB: LaTeX Error: Missing \begin{document}.


  \catcode`\^^J=10                      % (find-es "luatex" "spurious-omega")
  \directlua{dofile "dednat6load.lua"}  % (find-dednat6 "dednat6load.lua")

% %\catcode`\^^J=10
% \directlua{dofile "dednat6load.lua"}
%   -> many omegas

% \begin{document}
%   \catcode`\^^J=10                      % (find-es "luatex" "spurious-omega")
%   \directlua{dofile "dednat6load.lua"}  % (find-dednat6 "dednat6load.lua")
%  -> everything works





#####
#
# colored-arrows
# 2019aug03
#
#####

# «colored-arrows» (to ".colored-arrows")

\def\ca#1{{\color   {Red}#1}}
\def\cb#1{{\color{Yellow}#1}}
\def\cc#1{{\color  {Blue}#1}}
\def\cd#1{{\color {Green}#1}}

\ca{1}\cb{2}\cc{3}\cd{4}

%D diagram ??
%D 2Dx     100 +30
%D 2D  100 A   B
%D 2D
%D 2D  +20
%D 2D
%D (( A .tex= \ca{A}
%D    B .tex= \cb{B}
%D    A B |-> .plabel= a \cc{C}
%D
%D ))
%D enddiagram
%D
$$\pu
  \diag{??}
$$

\defdiag{??}{   % In the "%D"-block in lines 65--77
  \morphism(0,0)|a|/|->/<450,0>[{\ca{A}}`{\cb{B}};{\cc{C}}]
}
\defdiag{??}{   % In the "%D"-block in lines 65--77
  \morphism(0,0)|a|/|->/<450,0>[{\ca{A}}`{\cb{B}};{\cc{C}}]
  \color{Green}
  \morphism(0,200)|a|/|->/<450,0>[{\ca{A}}`{\cb{B}};{\cc{C}}]
  \color{Black}
  \morphism(0,400)|a|/|->/<450,0>[{\ca{A}}`{\cb{B}};{\cc{C}}]
}

$$
  \diag{??}
$$




#####
#
# write_single_tex_file
# 2019aug03
#
#####

# «write_single_tex_file» (to ".write_single_tex_file")
# (find-dednat6file "demo-write-dnt.tex")
# (find-dednat6file "demo-write-single.tex")
# (find-dn6 "output.lua" "write_dnt_file")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
chdir "~/dednat6/"




#####
#
# deletecomments (I need a better version of this)
# 2019aug16
#
#####

# «deletecomments» (to ".deletecomments")
# (find-dn6 "output.lua" "deletecomments")
# (find-LATEXgrep "grep --color -nH -e deletecomments *.tex")

%L deletecomments = function (str)
%L     return (str:gsub("%%[^\n]*\n[ \t]*", ""))
%L   end



#####
#
# deletecomments: a better version
# 2021may14
#
#####

# «deletecomments-2021»  (to ".deletecomments-2021")
# (find-dn6 "output.lua" "deletecomments")
# (find-dn6 "output.lua" "DeleteComments-class")
# (find-dn6 "output.lua" "DeleteComments-tests")
# (find-es "tex" "comments")
# (find-lua51manual "#pdf-string.reverse")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()
bigstr = [[
foo%12
  bar\plic%34
  qoo%56
  blep
  bletch
  %
  woo
]]

DeleteComments = Class {
  type  = "DeleteComments",
  split = function (bigstr)
      local A = {}
      for _,li in ipairs(splitlines(bigstr)) do
        local a,b = li:match("^([^%%]*)(.*)")
        table.insert(A, {a, b, "\n"})
      end
      return DeleteComments(A)
    end,
  __tostring = function (dc) return mytabletostring(dc) end,
  __index = {
      hascomment = function (dc, k) return dc[k][2] ~= "" end,
      endswithcmd = function (dc, k)
          return dc[k][1]:reverse():match("^[A-Za-z]+\\")
        end,
      addspaceaftercmd = function (dc, k)
          dc[k][1] = dc[k][1].." "
        end,
      valid = function (dc, k) return 1 <= k and k <= #dc end,
      ltrim = function (dc, k)
          dc[k][1] = dc[k][1]:match("^[ \t]*(.*)")
        end,
      delcomment = function (dc, k)
          if dc:endswithcmd(k) then dc:addspaceaftercmd(k) end
          dc[k][2] = ""   -- delete the "%..."
          dc[k][3] = ""   -- delete the newline
          if dc:valid(k+1) then dc:ltrim(k+1) end
        end,
      delcomments = function (dc)
          for k=1,#dc do if dc:hascomment(k) then dc:delcomment(k) end end
	  return dc
        end,
      concat = function (dc)
          bigstr = ""
          for k=1,#dc-1 do bigstr = bigstr..dc[k][1]..dc[k][2]..dc[k][3] end
          if #dc > 0 then bigstr = bigstr..dc[#dc][1]..dc[#dc][2] end
          return bigstr
        end,
  },
}

dc = DeleteComments.split(bigstr)
= dc
= dc:delcomments()
= dc:concat()

delcomments = 

deletecomments1 = function (line)
    local left,right = line:match("^([^%%]*)(.*)")
    if right == "" then
      
    end

deletecomments = function (bigstr)
    local lines = splitlines(bigstr)
    for i=1,#lines do
      local line = lines[i]
      local left,right = line:match("^([^%%]*)(.*)")
      local newright = right
      if right:match"^%%" then
        if left:match"^[ \t]*$" then lines[i] = ""
        if left:rev():match("[A-Za-z]+\\") then
          newright = "\n"
        else
          newright = 
      end
      PP(left, right) 
    end
  end

= deletecomments(bigstr)





#####
#
# Coercion problems in LR.fromtcgspec in Lua 5.3
# 2019aug12
#
#####

# «LR.fromtcgspec-5.3» (to ".LR.fromtcgspec-5.3")
# (find-es "lua5" "coercions-5.3")

# (find-dn6 "tcgs.lua" "TCGSpec")
# (find-dn6 "tcgs.lua" "TCGSpec" "mp =")
# (find-dn6 "tcgs.lua" "TCGSpec" "zhaspec =")
# (find-dn6 "tcgs.lua" "TCGSpec" "zha =")
# (find-dn6 "zhaspecs.lua" "LR")
# (find-dn6 "zhaspecs.lua" "LR" "fromspec =")
# (find-dn6 "zhaspecs.lua" "LR" "fromtcgspec =")
# (find-dn6 "zhaspecs.lua" "LR" "fromtwocolgraph =")
# (find-dn6 "zhaspecs.lua" "LR" "zha =")
# (find-dn6file "zhaspecs.lua" " spec =")
# (find-dn6 "zhas.lua")
# (find-dn6 "zhas.lua" "ZHA")
# (find-dn6 "zhas.lua" "ZHA" "fromspec0 =")
# (find-dn6 "zhas.lua" "ZHA" "specwidths =")
# (find-dn6 "picture.lua" "V")
# (find-dn6 "picture.lua" "V" "to_l_r =")

[string "2019elephant-poster-z.tex:%R:860-873"]:14
# (find-LATEXfile "2019elephant-poster-z.tex" 860 14)

# (find-dn6 "zhas.lua" "MixedPicture")
# (find-dn6 "zhas.lua" "MixedPicture" "zfunction =")
# (find-dn6 "zhas.lua" "asciirectpoints-tests")


-- (find-LATEXfile "2019elephant-poster-z.tex" "house =")


* (eepitch-lua53)
* (eepitch-kill)
* (eepitch-lua53)
loaddednat6()
output = print

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()
output = print
str = ".1.|2.3|4.5"
opts = {def="dagHouse", scale="4pt", meta="p b s"}
mp = MixedPicture.new(opts):zfunction(str)
= mp
= mp:tolatex()

* (eepitch-lua53)
* (eepitch-kill)
* (eepitch-lua53)
loaddednat6()
output = print
str = ".1.|2.3|4.5"
opts = {def="dagHouse", scale="4pt", meta="p b s"}
mp = MixedPicture.new(opts):zfunction(str)
= mp
= mp:tolatex()



kite  = ".1.|2.3|.4.|.5."
house = ".1.|2.3|4.5"
W     = "1.2.3|.4.5."
guill = ".1.2|3.4.|.5.6"
hex   = ".1.2.|3.4.5|.6.7."
mp = MixedPicture.new({def="dagKite", meta="s", scale="5pt"}, z):zfunction(kite):output()
mp = MixedPicture.new({def="dagKite",  meta="t", scale="4pt"}, z):zfunction(kite):output()
mp = MixedPicture.new({def="dagHouse", meta="s", scale="5pt"}, z):zfunction(house):output()
mp = MixedPicture.new({def="dagW",     meta="s", scale="4pt"}, z):zfunction(W):output()
mp = MixedPicture.new({def="dagGuill", meta="s", scale="4pt"}, z):zfunction(guill):output()
mp = MixedPicture.new({def="dagHex",   meta="s", scale="4pt"}, z):zfunction(hex):output()

kite  = ".1.|2.3|.4.|.5."
house = ".1.|2.3|4.5"
W     = "1.2.3|.4.5."
guill = ".1.2|3.4.|.5.6"
hex   = ".1.2.|3.4.5|.6.7."
o = MixedPicture.new({def="dagKite", meta="s", scale="5pt"}, z)
o = MixedPicture.new({def="dagKite", meta="s", scale="5pt"}, z):zfunction(kite)
PPV(o)


mp = MixedPicture.new({def="dagKite", meta="s", scale="5pt"}, z):zfunction(kite):output()
mp = MixedPicture.new({def="dagKite",  meta="t", scale="4pt"}, z):zfunction(kite)
mp = MixedPicture.new({def="dagHouse", meta="s", scale="5pt"}, z):zfunction(house)
mp = MixedPicture.new({def="dagW",     meta="s", scale="4pt"}, z):zfunction(W)
mp = MixedPicture.new({def="dagGuill", meta="s", scale="4pt"}, z):zfunction(guill)
mp = MixedPicture.new({def="dagHex",   meta="s", scale="4pt"}, z):zfunction(hex)

-- (find-dn6file "luarects.lua" "tozmp =")
-- (find-dn6 "luarects.lua" "ZHAFromPoints")







#####
#
# dednat6-xyoption-2cell
# 2019aug18
#
#####

# «dednat6-xyoption-2cell» (to ".dednat6-xyoption-2cell")
# (find-fline "~/LATEX/xy-problem-1.tex")

\documentclass{article}

%\usepackage{proof}   % For derivation trees ("%:" lines)
\input diagxy        % For 2D diagrams ("%D" lines)
\xyoption{curve}     % For the ".curve=" feature in 2D diagrams
\xyoption{all}
\xyoption{2cell}
%\usepackage[all,2cell]{xy}

\usepackage{mathrsfs,amssymb,stmaryrd,bbm,mathtools, mathabx, enumitem, upgreek}
\usepackage{chngcntr}

\usepackage{ifluatex}
\begin{document}




#####
#
# Explaining the notations in PH1
# 2019sep18
#
#####

# «ph1-doc» (to ".ph1-doc")

# (ph1p 5 "positional")
# (ph1    "positional")
# (find-LATEX "2017planar-has-defs.tex" "picturedots")
# (find-LATEX "edrxpict.lua" "pictdots")g


* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()





#####
#
# harrownode
# 2019oct07
#
#####

# «harrownode» (to ".harrownode")

% (find-angg ".emacs.papers" "symbols")
% (find-symbolspage 108 "extarrows")
% (find-symbolstext 108 "extarrows")
% (find-dn6 "diagforth.lua" "place")

% \usepackage{extarrows}

%L forths["harrownode"] = function (x0, y0, x2, y2, dx0, dx2)
%L     local node0, node2 = ds:pick(1), ds:pick(0)
%L     local dx0, dx2, tex = getwordasluaexpr(), getwordasluaexpr()
%L     local tex = getword() or werror()
%L     local x0, y0, x2, y2 = node0.x, node0.y, node2.x, node2.y
%L     local x1a, x1b = splitdist(x0, x2, dx0, 0, dx2) -- x1a=x1b
%L     local x1, y1 = x1a, (y0 + y2)/2
%L     PP(x1, y1, tex)
%L     ds:push(storenode{x=x1, y=y1, TeX=tex})
%L     ds:push(storearrow(DxyPlace {ds:pick(0)}))
%L   end

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

$\xLongrightarrow[foo]{bar}$

%D diagram adj
%D 2Dx     100     +25     +25   +25
%D 2D  100 LA <--| A
%D 2D      |       |
%D 2D      |  <->  |
%D 2D      v       v
%D 2D  +25 B |--> RB       C --> D
%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      LA RB harrownode nil nil \xLongrightarrow[foo]{bar}
%D    \catB \catA <- sl^ .plabel= a L
%D    \catB \catA -> sl_ .plabel= b R
%D
%D    C D -> .curve= ^10pt .plabel= a a
%D    C D -> .curve= _10pt .plabel= b b
%D ))
%D enddiagram
%D
$$\pu
  \diag{adj}
$$




#####
#
# extra-modules.tex: a discussion of the modules for ZHAs in dednat6
# 2019dec13
#
#####

# «extra-modules» (to ".extra-modules")
# (find-angg "dednat6/extra-modules.tex")
# (dnz)
# (find-dednat6 "dednat6/zhas.lua" "ZHA-tests")
# (find-dednat6 "dednat6/zhas.lua" "MixedPicture")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()
z = ZHA.fromspec("12L1RRR2RL1"):PP():print()
z = ZHA.fromspec("123LLR432L1"):PP():print()
z = ZHA.fromspec("123RRL432R1"):PP():print()
= z
= z:tolatex()

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()
output = function (str) print(str) end
-- (jopp 3 "basic-definitions")
-- (jos    "basic-definitions")

tdims = TCGDims {qrh=5, q=15, crh=12, h=60, v=25, crv=7}   -- with v arrows
tspec_PA  = TCGSpec.new("46; 11 22 34 45, 25")
tspec_PAQ = TCGSpec.new("46; 11 22 34 45, 25", ".???", "???.?.")
oap  = tspec_PA :mp  ({zdef="O_A(P)"})  :addlrs()
oapj = tspec_PAQ:mp  ({zdef="O_A(P),J"}):addlrs()
pa   = tspec_PA :tcgq({tdef="(P,A)",   meta="1pt p"}, "lr q h v ap")
paq  = tspec_PAQ:tcgq({tdef="(P,A),Q", meta="1pt p"}, "lr q h v ap")

= tdims
= tspec_PA
= tspec_PAQ
= oap
= oapj

-- (find-dednat6 "dednat6/eoo.lua" "otype")

= otype(oap)
PP(keys(oap))

= VerticalTable(sorted(keys(oap)))
= PP(getmetatable(oap))
= PP(getmetatable(oap).__index)
= PP(sorted(keys(getmetatable(oap).__index)))

ofields  = function (o) return VerticalTable(sorted(keys(oap))) end
omethods = function (o) return VerticalTable(sorted(keys(getmetatable(oap).__index))) end
= otype(oap)
= ofields(oap)
= omethods(oap)

= oap.cuts   -- error
= oap.lp
= PP(oap.lp)

PPV(oap)






#####
#
# Converting code that uses the old TCG class to code that uses TCGQ
# 2019dec24
#
#####

# «converting-TCG-to-TCGQ» (to ".converting-TCG-to-TCGQ")
# Old: (find-LATEXgrep "grep --color -nH --null -e TCG.new *")
#      (find-LATEX "edrxpict.lua" "TCG")
#      (find-LATEX "edrxpict.lua" "TCG-tests")
# New: (find-LATEXgrep "grep --color -nH --null -e TCGDims *")
#      (find-LATEXgrep "grep --color -nH --null -e TCGSpec *")
#      (find-LATEX "dednat6/tcgs.lua")
#
# Meaning of the (new) parameters:
#      (find-dednat6 "extra-modules.tex")
#      (find-dednat6 "extra-modules.tex" "TCGs")
#      (find-pdf-page "~/dednat6/extra-modules.pdf" 3)


* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
--
-- An example of code using the old TCG class, from:
-- (find-LATEX "2017planar-has-1.tex" "2CGs")
-- (find-LATEX "2017planar-has-1.tex" "2CGs" "TCG.new")
--
loaddednat6()
chdir "~/LATEX/"
dofile "edrxtikz.lua"                  -- (find-LATEX "edrxtikz.lua")
dofile "edrxpict.lua"                  -- (find-LATEX "edrxpict.lua" "TCG")
output = function (str) print(str) end -- (find-es "dednat" "output-no-tex")

tcg_big    = {scale="14pt", meta="p",   dv=2, dh=2.75, ev=0.32, eh=0.275}
tcg_Big    = {scale="14pt", meta="p",   dv=2, dh=3.5,  ev=0.32, eh=0.200}
tcg_medium = {scale= "9pt", meta="p s", dv=1, dh=2.2,  ev=0.32, eh=0.275}
tcgnew = function (opts, def, str)
    return TCG.new(opts, def, unpack(split(str, "[ %d]+")))
  end
tcgbig = function (def, spec) return tcgnew(tcg_big,    def, spec or tcg_spec) end
tcgBig = function (def, spec) return tcgnew(tcg_Big,    def, spec or tcg_spec) end
tcgmed = function (def, spec) return tcgnew(tcg_medium, def, spec or tcg_spec) end

tcg = TCG.new(tcg_big,    "foo", 3, 4, "34 23", "22 12"):lrs():vs():hs():output()

-- (find-LATEXfile "2019planar-has-1-body.tex" "TCG.new")
-- (find-LATEX "dednat6/tcgs.lua" "TCGSpec-test")




#####
#
# Downloading the PDFs of my .texs that require dednat4
# 2020jan27
#
#####

# «dednat4-pdfs-downloading» (to ".dednat4-pdfs-downloading")
# (find-twusfile "LATEX/")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# (find-fline "/tmp/latexold/")
rm -Rv /tmp/latexold/
mkdir  /tmp/latexold/
cd     /tmp/latexold/
A=(
2007dnc-sets.pdf
2008bcc.pdf
2008comprcat.pdf
2008dnc-sets.pdf
2008filterp-abs.pdf
2008filterp.pdf
2008filterp-slides.pdf
2008gf.pdf
2008graphs.pdf
2008hyp.pdf
2008induction.pdf
2008modallogic.pdf
2008monads.pdf
2008natded.pdf
2008notations.pdf
2008projeto.pdf
2008sdg.pdf
2008sheaves-abs1.pdf
2008sheaves.pdf
2008topos-str.pdf
2009dnc-in-coq.pdf
2009dnc-monads.pdf
2009jul02-C2-exercicios.pdf
2009jun05.pdf
2009-planodetrabalho.pdf
2009unilog-abs1.pdf
2009unilog-diags.pdf
2009unilog-dnc.pdf
2010diags.pdf
2010kockdiff-new.pdf
2010kockdiff.pdf
2010reducao.pdf
2010unilog-2010jun21.pdf
2010unilog-current.pdf
2011ebl-abs.pdf
2011ebl-booklet-abs.pdf
2011ebl-slides.pdf
2012minicats.pdf
2013idct-changes.pdf
2013-montreal.pdf
2014istanbul-a.pdf
2014sfc-abstract.pdf
2014sfc-slides2h.pdf
2014sfc-slides2.pdf
2014sfc-slides.pdf
2015children.pdf
2015planar-has.pdf
)

for i in $A; do wget -nc http://angg.twu.net/LATEX/$i; done




#####
#
# dednat4-texs-converting
# 2020jan27
#
#####

# «dednat4-texs-converting» (to ".dednat4-texs-converting")
# (find-angg "LUA/texcatcodes.lua")




#####
#
# tikzdiagram and endtikzdiagram
# 2020feb16
#
#####

# «tikzdiagram» (to ".tikzdiagram")
# (find-dednat6 "dednat6/diagforth.lua" "high-level-tests")
# (find-dednat6 "dednat6/diagforth.lua" "diagram")
# (find-dednat6 "dednat6/diagforth.lua" "enddiagram")
# (find-dednat6 "dednat6/diagtikz.lua")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()
forths["tikzdiagram"] = function ()
    diagramname = getword() or derror("No diagram name")
    xys = {}
    nodes  = VerticalTable {}
    arrows = VerticalTable {}
    lasty = nil
  end
forths["endtikzdiagram"] = function ()
    -- output(arrows_to_defdiag(diagramname, tf:hyperlink()))
    print(arrows)
  end

dxyrun [[ tikzdiagram ??             ]]
dxyrun [[ 2Dx     100   +40          ]]
dxyrun [[ 2D  100 A --> B            ]]
dxyrun [[ 2D            |            ]]
dxyrun [[ 2D  +30       C            ]]
dxyrun [[ 2D                         ]]
dxyrun [[ (( A B ->  .plabel= a foo  ]]
dxyrun [[    B C =>  .plabel= r bar  ]]
dxyrun [[    A C |-> .plabel= m plic ]]
dxyrun [[                            ]]
dxyrun [[ ))                         ]]
dxyrun [[ endtikzdiagram             ]]

-- (find-dednat6 "dednat6/diagtex.lua" "arrows_to_defdiag")
-- (find-dednat6 "dednat6/diagtex.lua" "arrow_to_TeX")

print(arrows)
PP(arrows[1])
PP(arrows[1].from)
PP(arrows[1].to)
PP(nodes[arrows[1].from])
PP(nodes[arrows[1].to])




#####
#
# plabel-error-handling
# 2020jul25
#
#####

# «plabel-error-handling»  (to ".plabel-error-handling")
# (find-dednat6 "dednat6/diagforth.lua" "high-level-tests")
# (find-dednat6 "dednat6/diagforth.lua" "diagram")
# (find-dednat6 "dednat6/diagforth.lua" "enddiagram")
# (find-dednat6 "dednat6/diagtikz.lua")
# (find-dednat6 "dednat6/diagforth.lua" "diag-head" "dxyrun =")
# (find-dednat6 "dednat6/parse.lua" "getword")
# (find-LATEX "2020dn6-error-handling.lua")
# (dne)

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()

getword1 = function (errmsg) return getword() or error(errmsg) end

forths[".plabel="] = function ()
    local p     = getword1("In '.plabel=': missing first argument (placement)")
    local label = getword1("In '.plabel=': missing second argument (label)")
    arrow.placement, arrow.label = p, label
  end

dxyrun [[ diagram ??                 ]]
dxyrun [[ 2Dx     100   +40          ]]
dxyrun [[ 2D  100 A --> B            ]]
dxyrun [[ 2D            |            ]]
dxyrun [[ 2D  +30       C            ]]
dxyrun [[ 2D                         ]]
dxyrun [[ (( A B ->  .plabel= aafoo  ]]
dxyrun [[    A W ->  .plabel= aafoo  ]]
dxyrun [[ ))                         ]]
dxyrun [[ # enddiagram               ]]





#####
#
# bussproofs
# 2020aug22
#
#####

# «bussproofs»  (to ".bussproofs")
# (find-es "tex" "bussproofs-victor")
# (find-angg "LUA/lua50init.lua" "loaddednat6")
# (find-LATEX "dednat6load.lua")
# (find-LATEX "dednat6/heads6.lua" "tree-head")
# (find-LATEX "dednat6/block.lua" "TexLines")
# (find-LATEX "dednat6/treesegs.lua" "allsegments-tests")
# (find-LATEX "dednat6/treetex.lua" "TreeNode")
# (find-LATEX "dednat6/treetex.lua" "TreeNode" "TeX_deftree =")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()
require "block"
bigstr = [[
%:                       H
%:                      ...
%:  A  B  C   E  F      \Pi
%:  =======r  ::::\phi  ...
%:     D       G         I
%:     -------------------
%:             J
%:
%:             ^bars
%:
]]
output = print
output("foo")
texlines = TexLines.new("test", bigstr)
tf = texlines:toblock()
PP(headblocks)
tf:processuntil(texlines:nlines())
PP(headblocks)
= allsegments[9]
seg = allsegments[9][1]
name = "bars"
output(seg:rootnode():totreenode():TeX_deftree(name))
= seg:rootnode()
= seg:rootnode():totreenode()
tree = seg:rootnode():totreenode()
= tree
= tree[1]
= tree[3]
= tree[3][1]
= tree[3][1][1]
PPV(tree)
PPV(tree[3][1][1])

-- (find-bussguidepage 6 "\\QuaternaryInfC{form}")
-- (find-bussguidetext 6 "\\QuaternaryInfC{form}")
-- (find-bussguidepage 8 "\\RightLabel{text}")
-- (find-bussguidetext 8 "\\RightLabel{text}")
-- (find-bussguidepage 9 "\\doubleLine")
-- (find-bussguidetext 9 "\\doubleLine")

BussProofs = Class {
  type = "BussProofs",
  new  = function () return BussProofs {} end,
  __index = {
    unabbrev = function (bp, str) return unabbrev(str) end,
    tolatex = function (bp, tn, i)
        local i_,i__ = i.." ", i.."  "
        if not tn:hasbar() then
          local r_ = tn:TeX_root()
          return i.."\\AxiomC{$"..bp:unabbrev(r_).."$}"
        else
          local r_ = tn:TeX_root()
          local b_ = tn:barchar()
          local l_ = tn:TeX_label()
          local h_ = tn:hypslist()
          local r  = "\\mathstrut "..bp:unabbrev(r_)
          local s  = function (indent, str)
	                 return str and (indent..str.."\n") or ""
                       end
          local Lines = {["-"]=nil,
                         ["="]="\\doubleLine",
                         ["."]="\\noLine"}
          local Line  = Lines[b_]
          local Label = l_ and format("\\RightLabel{$%s$}", l_)
          local Infs  = {"\\UnaryInfC",
                         "\\BinaryInfC",
                         "\\TrinaryInfC",
                         "\\QuaternaryInfC",
                         "\\QuinaryInfC"}
          local Inf   = format("%s{$%s$}", Infs[#h_], bp:unabbrev(r_))
          local f  = function (tn) return bp:tolatex(tn, i__) end
          local Hyps  = mapconcat(f, h_, i__.."\n")
          return Hyps.."\n"..s(i_,Line)..s(i_,Label)..i..Inf
        end
      end,
    todefded = function (bp, tn, name, link)
        local comment = "   % "..(link or tf:hyperlink())
        return "\\defdedbuss{"..name.."}{"..comment.."\n"..
               bp:tolatex(tn, " ").."\n }"
      end,
  },
}

bp = BussProofs.new()
= bp:tolatex(tree, "")
= bp:tolatex(tree, "  ")
= bp:todefded(tree, "NAME")

ee_dofile "~/LATEX/2020dn6-error-handling.lua"
bp = BussProofs.new()
= bp:todefded(tree, "NAME")




#####
#
# The word "at:" and the new syntax for calculating with "v"s
# 2020dec04
#
#####

# «at:»  (to ".at:")
# (find-LATEX "2020ats.tex")
# (find-dn6 "dednat6.lua")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()

Node = Class {
  type       = "Node",
  __tostring = function (node) return mytostring(node) end,
  __index    = {
    v    = function (node) return v(node.x,node.y) end,
    setv = function (node,v) node.x=v[1]; node.y=v[2]; return node end,
  },
}
storenode = function (node)
    node = Node(node)
    table.insert(nodes, node)
    node.noden = #nodes         -- nodes[node.noden] == node
    if node.tag then            -- was: "and not nodes[node.tag]"...
      nodes[node.tag] = node    -- nodes[node.tag] == node
    end
    return node
  end

dxyrun [[ diagram ??                     ]]
dxyrun [[ 2Dx     100               +40  ]]
dxyrun [[ 2D  100 A0 -------------> A1   ]]
dxyrun [[ 2D      |    ----- B4 B5   |   ]]
dxyrun [[ 2D      |    \   B3\       |   ]]
dxyrun [[ 2D      |     \B2   v      |   ]]
dxyrun [[ 2D      v B0 B1 ---->      v   ]]
dxyrun [[ 2D  +40 A2 -------------> A3   ]]
dxyrun [[ 2D                             ]]
dxyrun [[ # (( A B ->  .plabel= aafoo    ]]
dxyrun [[ #    A W ->  .plabel= aafoo    ]]
dxyrun [[ # ))                           ]]
dxyrun [[ # enddiagram                   ]]

= nodes
= v(10,20)
= v(10,20) + v(3,4)
= 10 * v(10,20) + v(3,4)
= tow

tow = function (vv, ww, a, b)
    local diff = ww-vv
    local diffrot90 = v(diff[2], -diff[1])
    return vv + (a or 0.5)*diff + (b or 0)*diffrot90
  end
ats_to_vs = function (str)
    return (str:gsub("@(%w+)", "nodes[\"%1\"]:v()"))
  end
forths["newnode:"] = function ()
    local tag = getword()
    ds:push(storenode({tag=tag, TeX=phantomnode}))
  end
forths["at:"] = function ()
    local node = ds:pick(0)
    local vexpr = getword()
    node:setv(expr(ats_to_vs(vexpr)))
  end

dxyrun [[ (( newnode: B0 at: tow(@A0,@A2,0.75,0.25) ]]
dxyrun [[    newnode: B1 at: @B0+v(10,0)            ]]
dxyrun [[ ))                                        ]]

= nodes

= tow(v(100,200), v(110,200))
= tow(v(100,200), v(110,200), 0.1)
= tow(v(100,200), v(110,200), 0.1, 1)

= nodes[1]
= otype(nodes[1])
= otype(nodes)
= nodes[1]:v()

=   nodes[1][1], nodes[1][2]
= v(nodes[1][1],nodes[1][2])


= ats_to_vs("@A0 + @A1")
= expr(ats_to_vs("@A0 + @A1"))
= expr(ats_to_vs("tow(@A0,@A1)"))

-- (find-angg "LUA/lua50init.lua" "VerticalTable")
-- (find-dn6 "diagstacks.lua" "nodes")
-- (find-dn6 "diagforth.lua" "relplace")
-- (find-dn6grep "grep --color -nH --null -e storenode *.lua")
-- (find-dn6grep "grep --color -nH --null -e phantom *.lua")




#####
#
# Instructions to use Dednat6 in TeXStudio
# 2021jan20
#
#####

# «texstudio»  (to ".texstudio")
# (find-es "tex" "texstudio")
# http://angg.twu.net/dednat6.html#essential-files

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# (find-fline "/tmp/ts/")
rm -Rv /tmp/ts/
mkdir  /tmp/ts/
cd     /tmp/ts/

cd ~/dednat6/
cp -aiv demo-minimal.tex dednat6load.lua dednat6/ /tmp/ts/

cd     /tmp/ts/
texstudio demo-minimal.tex


# Configurations:
# Options -> Configure TeXstudio -> Build -> Default compiler -> LuaLaTeX
# Options -> Configure TeXstudio -> Show advanced options [turn on]
# Options -> Configure TeXstudio -> Build -> Build Options -> Show stdout -> Always

# On why we (sometimes) need stdout:
# (find-dn6articlepage 3 "The preprocessor outputs this on stdout:")
# (find-dn6articletext 3 "The preprocessor outputs this on stdout:")
# (find-dn6articlepage 3 "3   Semi-preprocessors")
# (find-dn6articletext 3 "3   Semi-preprocessors")
# (find-dn6slidespage 14 "output" "\\defdiag")
# (find-dn6slidestext 14 "output" "\\defdiag")





#####
#
# repl-pict: create pict2e code from a REPL
# 2021feb08
#
#####

# «repl-pict»  (to ".repl-pict")
# (find-LATEX "2021repl-pict.tex")
# (find-LATEX "edrxtikz.lua")
# (find-LATEX "edrxpict.lua")

# (find-LATEX "2017planar-has-defs.tex" "picturedotsdef")
# (find-LATEX "edrxpict.lua" "defpictdots")
# (find-LATEXfile "dednat6/zhas.lua")
# (find-dn6 "tcgs.lua")
# (find-dn6 "tcgs.lua" "TCGQ")
# (find-dn6 "picture.lua" "BoundingBox")
# (find-dn6 "picture.lua" "BoundingBox" "addpoint =")
# (find-dn6 "picture.lua" "LPicture")
# (find-dn6 "picture.lua" "LPicture-tests")
# (find-dn6 "picture.lua" "metaopts")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()
-- require "picture.lua"
lp = LPicture.new {cellfont="\\scriptsize"}
lp = LPicture.new {cellfont="\\scriptsize", meta="b"}
for l=0,2 do
  for r=0,3 do
    local pos=lr(l, r)
    lp:put(pos, pos:xy())
  end
end
= lp
= lp:tolatex()
ee_writefile("~/LATEX/o.tex", "$"..lp:tolatex().."$")

-- (find-angg "LUA/lua50init.lua" "repltexthis")
repltexthis(lp:tolatex())





#####
#
# Drawing Lawvere-Tierney topologies (with cuts on each \Omega(u))
# 2021apr03
#
#####

# «lawvere-tierney»  (to ".lawvere-tierney")
# (find-dn6 "tcgs.lua" "TCGSpec")
# (find-dn6 "tcgs.lua" "TCGSpec" "mp =")
# (find-dn6 "tcgs.lua" "TCGSpec" "mpunder =")
# (find-dn6 "zhas.lua" "MixedPicture-cuts")
# (find-dn6 "zhas.lua" "MixedPicture-cuts" "addcutssub =")
# (find-dn6 "zhas.lua" "MixedPicture-zha")
# (find-dn6 "zhas.lua" "MixedPicture-zha" "zhalr =")
# (find-dn6 "zhas.lua" "MixedPicture-zha" "zhalrf0 =")
# (find-dn6 "zhas.lua" "ZHA-shrinktop")
# (find-dn6 "zhas.lua" "ZHA-test-shrinktop")
# (find-es "dednat" "sub-ZHA")

# (cltp 28 "SetT-classifier-defs")
# (clt     "SetT-classifier-defs")
# (cltp 38 "def-j-example")
# (clt     "def-j-example")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()

ts = TCGSpec.new("33; 32, ", ".??",".??")
= ts:zhaspec()
= ts:zha()
= ts:zha():shrinktop(v"32")
= ts:zha():shrinktop(v"32").spec
= ts:hasqmarks()
= ts:cuts()
= "c "..ts:cuts()

utop    = "32"
zhaspec = ts:zhaspec()
zha     = ts:zha()
uzha    = ts:zha():shrinktop(v(utop))
ucuts   = "c "..ts:cuts()
ulrf    = "lr -> lr:below(v'"..utop.."') and lr:lr() or '..'"

mp      = ts:mp({zdef="?", scale="12pt", meta=""})
mp      = mpnew({zdef="?", scale="12pt", meta=""}, zhaspec)
mp:zhalrf0(ulrf)
= mp

mp.cuts:addcuts(uzha, ucuts)
= mp


-- «lawvere-tierney-mpunder»  (to ".lawvere-tierney-mpunder")
-- (find-dn6 "tcgs.lua" "TCGSpec" "mp =")
-- (find-dn6 "tcgs.lua" "TCGSpec" "mpunder =")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()
output = print

ts = TCGSpec.new("33; 32, ")
ts = TCGSpec.new("33; 32, ", ".??",".??")
mp = ts:mpunder("32", {zdef="A:j:3_", scale="12pt", meta=""}):print()
mp = ts:mpunder("20", {zdef="A:j:2_", scale="12pt", meta=""}):print()
mp = ts:mpunder("10", {zdef="A:j:1_", scale="12pt", meta=""}):print()
mp = ts:mpunder("03", {zdef="A:j:_3", scale="12pt", meta=""}):print()
mp = ts:mpunder("02", {zdef="A:j:_2", scale="12pt", meta=""}):print()
mp = ts:mpunder("01", {zdef="A:j:_1", scale="12pt", meta=""}):print()






#####
#
# V3: a variant of the class V for 3D vectors
# 2021apr19
#
#####

# «V3»  (to ".V3")
# (find-dn6 "picture.lua" "V")
# (find-angg "LATEX/2020-2-C3-plano-tang.lua")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()

V3 = Class {
  type    = "V3",
  __tostring = function (v) return v:tostring() end,
  __add      = function (v, w) return V3{v[1]+w[1], v[2]+w[2], v[3]+w[3]} end,
  __sub      = function (v, w) return V3{v[1]-w[1], v[2]-w[2], v[3]-w[3]} end,
  __unm      = function (v) return v*-1 end,
  __mul      = function (v, w)
      local ktimesv   = function (k, v) return V3{k*v[1], k*v[2], k*v[3]} end
      local innerprod = function (v, w) return v[1]*w[1] + v[2]*w[2] + v[3]*w[3] end
      if     type(v) == "number" and type(w) == "table" then return ktimesv(v, w)
      elseif type(v) == "table" and type(w) == "number" then return ktimesv(w, v)
      elseif type(v) == "table" and type(w) == "table"  then return innerprod(v, w)
      else error("Can't multiply "..tostring(v).."*"..tostring(w))
      end
    end,
  __index = {
    tostring = function (v) return v:v3string() end,
    v3string = function (v) return pformat("(%s,%s,%s)", v[1], v[2], v[3]) end,
    v2string = function (v) return tostring(v:tov2()) end,
    tov2 = function (v) return v[1]*v.p1 + v[2]*v.p2 + v[3]*v.p3 end,
    p1 = V{2,-1},
    p2 = V{2,1},
    p3 = V{0,2},
  },
}

v3 = function (x,y,z) return V3{x,y,z} end

= v3(2,3,4)
= v3(2,3,4)*10
= v3(2,3,4):v2string()

V3.__index.tostring = function (v) return v:v3string() end
V3.__index.tostring = function (v) return v:v2string() end

= expr("v3(2,3,4)")

foo = function (str)
    local f = function (s) return tostring(expr(s)) end
    return (str:gsub("<([^<>]+)>", f))
  end

-- (find-dn6 "heads6.lua" "lua-head")


= Pict

= foo "ab<1+2>cd<v3(2,3,4)>"

     return string.gsub(str, "%$([%a_][%w_]*)", function (e)
         return getenv(e) or ""
       end)





#####
#
# Functions to draw multiplication and division of polynomials
# 2021apr25
#
#####

# «drawing-polys»  (to ".drawing-polys")
# (find-LATEXfile "2020-2-C2-ids-trigs.lua")
# (c2m202itp 2 "div-polis")
# (c2m202it    "div-polis")




#####
#
# Diagramas de numerozinhos - low-level approach
# 2021apr29
#
#####

# «numerozinhos»  (to ".numerozinhos")
# (find-LATEX "2020-2-C3-P1.tex" "numerozinhos")
# (mpgp 24 "Fxy")
# (mpg     "Fxy")
# (find-LATEX "material-para-GA.tex" "pictureFxy")
# (find-LATEX "edrxpict.lua" "pictFxy")
# (find-LATEX "edrxpict.lua" "pictFxy" "tcell")
# (find-LATEX "2020-2-C2-ids-trigs.lua")
# (find-LATEX "2020-2-C2-ids-trigs.lua" "CCells")
# (find-LATEX "2020-2-C2-ids-trigs.lua" "CCells" "addlatexto =")
# (find-dn6 "zhas.lua" "MixedPicture")
# (find-dn6 "picture.lua" "AsciiPicture")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()
f = function (x,y) return min(x,y) end
mp = MixedPicture.new({zdef="demo", scale="10pt", meta=""})
mp.ap.s = "   "
mp.lp:addt("\\Line(-3,0)(3,0)")
mp.lp:addt("\\Line(0,3)(0,-3)")

for y=2,-2,-1 do
  for x=-2,2 do
    mp:put(v(x,y), tostring(f(x,y)))
  end
end
= mp
= mp:tolatex()

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()
MixedPicture.__index.addnumerosaxes = function (mp, xmin, xmax, ymin, ymax)
    mp.lp:addt("\\Line(%s,0)(%s,0)", xmin-0.5, xmax+0.5)
    mp.lp:addt("\\Line(0,%s)(0,%s)", ymin-0.5, ymax+0.5)
    return mp
  end
MixedPicture.__index.addnumerozinhos = function (mp, xmin, xmax, ymin, ymax, f)
    for y=ymin,ymax do
      for x=xmin,xmax do
        mp:put(v(x,y), tostring(f(x,y)))
      end
    end
    return mp
  end

mp = MixedPicture.new({zdef="demo", scale="10pt", meta=""})
mp.ap.s = "   "

f = function (x,y) return min(x,y) end
mp:addnumerosaxes (-2,4, -2,4)
mp:addnumerozinhos(-2,4, -2,4, f)
= mp




#####
#
# error-2021-04-21
# 2021apr21
#
#####

# «error-2021-04-21»  (to ".error-2021-04-21")

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

rm -Rfv /tmp/dednat6/
mkdir   /tmp/dednat6/
cd      /tmp/dednat6/
wget http://angg.twu.net/dednat6.zip
unzip   dednat6.zip
export PATH=/usr/local/texlive/2021/bin/x86_64-linux:$PATH
lualatex demo-minimal.tex




#####
#
# Show non-open sets using color
# 2021may08
#
#####

# «color-non-open»  (to ".color-non-open")
# (find-LATEX "2021groth-tops-children.lua" "zha-colors")
# (find-dn6 "picture.lua" "V")
# (find-dn6 "picture.lua" "AsciiPicture")
# (find-dn6 "picture.lua" "AsciiPicture" "put =")
# (find-dn6 "picture.lua" "AsciiPicture-tests")
# (find-dn6 "zhas.lua" "MixedPicture")
# (find-dn6 "zhas.lua" "MixedPicture" " celltotex =")
# (find-dn6 "zhas.lua" "MixedPicture" " put =")
# (find-dn6 "zhas.lua" "MixedPicture" " addcells =")
# (find-dn6 "zhas.lua" "MixedPicture-tests")

# (find-LATEX "2021groth-tops-defs.tex" "ArtDecoNQ")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()
= v"20"
= v"20":And(v"11")
= v"20":And(v"11"):lr()
= v"20":Or (v"11"):lr()

V.__index.minmaxlr = function (A, B)
    local minl,minr = A:And(B):to_l_r()
    local maxl,maxr = A:Or (B):to_l_r()
    return minl,maxl,minr,maxr
  end
= v"46":minmaxlr(v"53")

betweens = function (A, B)
    A, B = v(A), v(B)
    local minl,minr = A:And(B):to_l_r()
    local maxl,maxr = A:Or (B):to_l_r()
    return cow(function ()
        for l=minl,maxl do
          for r=minr,maxr do
	    coy(l, r)
	  end
	end
      end)
  end
for l,r in betweens("46", "53") do print(l, r) end

MixedPicture.__index.putcolor = function (mp, A, str)
    A = v(A)
    str = str:gsub("~", A:lr())
    mp.ap:put(A, str)
    return mp
  end
MixedPicture.__index.putcolors = function (mp, A, B, str)
    for l,r in betweens(A, B) do
      mp:putcolor(v(l, r):lrtoxy(), str)
    end
    return mp
  end
MixedPicture.__index.putleftgen = function (mp, l, r, green, red, orange, yellow)
    local lr = function (l, r) return v(l, r):lrtoxy() end
    mp:putcolor (lr(l,   r),   green  or "\\G~")
    mp:putcolors(lr(l,   r-1), thisleft, yellow or "\\Y~")
    mp:putcolor (lr(l,   r-1), red    or "\\R~")
    mp:putcolor (lr(l,   r-2), orange or "\\O~")
    mp:putcolor (lr(l+1, r-1), orange or "\\O~")
    return mp
  end
MixedPicture.__index.putrightgen = function (mp, l, r, green, red, orange, yellow)
    local lr = function (l, r) return v(l, r):lrtoxy() end
    mp:putcolor (lr(l,   r),   green  or "\\G~")
    mp:putcolors(lr(l-1, r),   thisright, yellow or "\\Y~")
    mp:putcolor (lr(l-1, r),   red or "\\R~")
    mp:putcolor (lr(l-2, r),   orange or "\\O~")
    mp:putcolor (lr(l-1, r+1), orange or "\\O~")
    return mp
  end
MixedPicture.__index.transfercolors = function (mp)
    for l,r in betweens("00", thistop) do
      local str = bitrim(mp.ap:get(lr(l, r)))
      if str ~= "" then mp.lp:put(lr(l, r), str) end
    end
    return mp
  end

= lr
= lr(2,0)

-- (jonp 3 "basic-definitions")
-- (jos    "basic-definitions")
-- (jonp 16 "valuations")
-- (jov     "valuations")

thistop   = v"46"
thisleft  = v"40"
thisright = v"06"

Foo_ts   = TCGSpec.new("43; , ")
Foo_mp   = Foo_ts:mp({zdef="H_zha", scale="11pt", meta=nil})
Foo_mp.ap.s = "    "
Foo_mp:putcolors("00", "46", "~")
Foo_mp:putleftgen(2,  2)
Foo_mp:putrightgen(2, 5)
= Foo_mp
Foo_mp:putleftgen(2,  2, nil, "", "", "")
Foo_mp:putrightgen(2, 5, nil, "", "", "")
= Foo_mp

Foo_mp:transfercolors()
= Foo_mp:tolatex()




#####
#
# The "pictreplace" head for "%P" lines
# 2021aug09
#
#####

# «pictreplace»  (to ".pictreplace")
# (find-LATEX "2020-2-C3-plano-tang.lua" "pictreplace")
# (find-LATEX "2020-2-C3-plano-tang.lua" "pictreplace-tests")
# (find-dednat6 "tugboat-rev2.tex" "creating-new-heads")
# (find-pdf-page "~/dednat6/tugboat-rev2.pdf" 5)

# Used in:
# (find-LATEXgrep "grep --color=auto -nH --null -e '%P' 202*.tex")
# (c3m202planotangp 27 "3D-fig")
# (c3m202planotanga    "3D-fig")
# (c3m211cnp 15 "figura-piramide")
# (c3m211cna    "figura-piramide")
# (c3m211dpp 11 "3D-fig")
# (c3m211dpa    "3D-fig")
# (c3m211nfp 18 "quadraticas-exemplos")
# (c3m211nfa    "quadraticas-exemplos")
# (c3m211nfa    "quadraticas-exemplos" "%P")




#####
#
# Convert the tree in 2021burghardt.tex to an UndTree
# 2021sep29
#
#####

# «burghardt»  (to ".burghardt")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()
require "block" -- (find-dn6 "block.lua")
= Path.prepend("path",     "~/LUA/?.lua")
require "Rect" -- (find-angg "LUA/Rect.lua" "undtolatex-tests")

-- (find-LATEX   "2021burghardt.tex" "tree")
texfile0("~/LATEX/2021burghardt.tex")
= tf
output = print
tf:processuntil(tf.j)
= tf

= allsegments
= allsegments[79]
= allsegments[79][1]

caretsegs = {}
for n,segments in pairs(allsegments) do
  local seg = segments[1]
  if seg and seg.t:match("^^") then print(seg); caretsegs[seg.t] = seg end
end
PPV(caretsegs)
caretseg = caretsegs["^Bur-tree"]
= caretseg
= caretseg:rootnode()
= caretseg:rootnode():totreenode()
tree = caretseg:rootnode():totreenode()
= tree
PPV(tree)

= undtolatex(tree)

defbody = undtolatex(tree)
deffull = "\\def\BurUnd{\n"..defbody.."\n}"
= deffull
output(deffull)



caretsegs = {}
for n,segments in pairs(allsegments) do
  local seg = segments[1]
  if seg and seg.t:match("^^") then print(seg); caretsegs[seg.t] = seg end
end
caretseg = caretsegs["^Bur-tree"]
tree = caretseg:rootnode():totreenode()
defbody = undtolatex(tree)
deffull = "\\def\BurUnd{\n"..defbody.."\n}"
output(deffull)



-- (find-dn6 "treetex.lua" "ProofSty-test")
-- (find-dn6 "treesegs.lua")
-- (find-dn6 "heads6.lua" "tree-head")



#####
#
# lean-nng
# 2021oct13
#
#####

# «lean-nng»  (to ".lean-nng")
# (find-dn6 "treesegs.lua" "Segments")
# (find-LATEXfile "2021lean-nng.tex")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()
output = print
require "block" -- (find-dn6 "block.lua")
-- (find-LATEX   "2021lean-nng.tex" "tree")
texfile0("~/LATEX/2021lean-nng.tex")
= tf
tf:processuntil(tf.j)
= tf

= Path.prependtopath "~/LUA/?.lua"
require "Rect"  -- (find-angg "LUA/Rect.lua")
require "Re"    -- (find-angg "LUA/Re.lua")

lean_gram = [=[
  stuff   <- {~ ( wordsf / special / . ) * ~}
  wordsf  <- {~ ("" -> "\textsf{") word ("" -> "}")~}
  word    <- {~  ([A-Za-z0-9]+ / ('_' -> '\_')) +  ~}
  special <- ( '[' / ']' / '.' ) -> specials
]=]

lean_specials = {
  ["["] = "<<",
  ["]"] = ">>",
  ["."] = "\\,",
}

lean_rt0 = Re { grammar = lean_gram, defs = {specials = lean_specials} }
lean_rtp = Re { grammar = lean_gram, defs = {specials = lean_specials}, print = PP }
lean_rtp:c 'top <- word'   'foo_bar0plic bletch'
lean_rtp:c 'top <- wordsf' 'foo_bar0plic bletch'
lean_rtp:c 'top <- stuff'  'foo_bar0plic bletch'
lean_rtp:c 'top <- stuff'  'foo_bar0plic.[bletch]'
lean_rt0:c 'top <- stuff'  'foo_bar0plic.[bletch]'
lean_rtranslate = lean_rt0:c 'top <- stuff'
PP(lean_rtranslate         'foo_bar0plic.[bletch]')

proofsty = ProofSty.new()
proofsty.unabbrev = function (ps, str)
    return lean_rtranslate(str)
  end
TreeNode.__index.TeX_deftree = function (tn, name, link)
    return proofsty:todefded(tn, name, link)
  end

texfile0("~/LATEX/2021lean-nng.tex")
tf:processuntil(tf.j)



# Old:

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loaddednat6()
= Path.prependtopath "~/LUA/?.lua"
require "block" -- (find-dn6 "block.lua")
require "Rect"  -- (find-angg "LUA/Rect.lua")
-- (find-LATEX   "2021lean-nng.tex" "tree")
texfile0("~/LATEX/2021lean-nng.tex")
= tf
output = print
tf:processuntil(tf.j)
= tf

PPPV(allsegments)
= allsegments
= allsegments:last(1000)
= allsegments:last(1000):totreenode()




#####
#
# fitch
# 2021oct20
#
#####

# «fitch»  (to ".fitch")
# «ftch»   (to ".ftch")
# (find-angg ".emacs" "dednat6-ftch")
# (find-es "tex" "kluwer-fitch")
# (find-LATEX "2021fitch.tex" "defftch")
# (find-LATEX "2021fitch.lua")




#####
#
# slides-to-pngs
# 2022oct22
#
#####

# «slides-to-pngs»  (to ".slides-to-pngs")
# (find-fline "~/IMAGES/")
# (find-fline "~/IMAGES/" "dednat6")
# (find-pdf-page "~/dednat6/tug-slides.pdf")
# (find-man "pdftoppm")
# (find-TH "dednat6" "introduction")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rv /tmp/pdf-jpg-pdf/
mkdir  /tmp/pdf-jpg-pdf/
cd     /tmp/pdf-jpg-pdf/
# pdftoppm -jpeg -jpegopt quality=80 -r 150 ~/dednat6/tug-slides.pdf b
# pdftoppm -jpeg -jpegopt quality=80 -r 60 ~/dednat6/tug-slides.pdf b
pdftoppm -png -r 100 ~/dednat6/tug-slides.pdf dednat6-slides
pdftoppm -png -r 125 ~/dednat6/tug-slides.pdf dednat6-slides
# (find-fline "/tmp/pdf-jpg-pdf/")
# (find-fline "/tmp/pdf-jpg-pdf/dednat6-slides-07.png")
# (find-fline "/tmp/pdf-jpg-pdf/dednat6-slides-09.png")
# (find-fline "/tmp/pdf-jpg-pdf/dednat6-slides-10.png")

cd     /tmp/pdf-jpg-pdf/
cp -v dednat6-slides-07.png ~/IMAGES/
cp -v dednat6-slides-09.png ~/IMAGES/
cp -v dednat6-slides-10.png ~/IMAGES/
makeL; makeR






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