Pict2e-lua: a library for diagrams that is being developed with eev and test blocks
Here is a screenshot (of this test; click the image to enlarge it):
Pict2e-lua is a uninteresting library that is being developed in an interesting way - with test blocks.
1. Try it!
If you want to see in practice how "development with test blocks" works, you can download and test Pict2e-lua by just running the two eepitch blocks below,
...and then running a few other, aham, "obvious", steps. I will explain these steps in three ways. If you are very familiar with eev then the (first) explanation is just this:
If you are not very familiar with eev, then you will prefer the (second) explanation, that is this video:
Click here to watch it on Youtube, or click on the image above to watch it in MP4. The quality of the MP4 is better, but on Youtube it has subtitles.
The other (third) explanation is below - it's a textual version, with lots of links, of the explanations above.
2. The textual explanation
The first eepitch block above installs Lua5.1 and LaTeX; it supposes that you are in Debian. The packages texlive-latex-extra and texlive-latex-recommended are needed because this .tex file uses xcolor and colorweb, and I was too lazy to remove these dependencies.
After running the second eepitch block you will need to run this sexp in it with `M-e',
to define the function `find-pict2elua'; note that the extra argument ":anchor" to code-c-d defines the function `find-pict2elua' as a "short hyperlink to an anchor". There is a good explanation of "short hyperlinks to anchors" here:
These are two separate blocks of sexps. The first block, that ends with (setenv "PICT2ELUADIR" "~/LATEX/"), corresponds to the setup in my machine, and the second block, that ends with (setenv "PICT2ELUADIR" "/tmp/pict2e-lua/"), is the setup for people who downloaded Pict2e-lua in /tmp/pict2e-lua/, and are testing it there. You need to execute all the sexps in the second block. The obvious way to execute them is to type `M-e <down>' many times, but it is more practical to type `M-7 M-e' many times - i.e., `M-7e7e7e7e7e7e7e7e7e7e'. The prefix `M-7' for `M-e' is explained here.
After executing the second block of sexps the function `etv' will be defined in the right way. It will be used in some test blocks to create a multiwindow setup like this one,
.__________________ | | | | | Lua | | | REPL | | Lua |________| | file | | | | PDF | | | file | |_________|________|
and to make sure that the .pdf being displayed is synced with the one on disk.
The occurrences of `(etv)' in test blocks are always like this:
They have a non-red-star line that run a method like :show() or :bshow() immediately followed by a red star line that runs `(etv)'. The methods :show() and :bshow() call methods from the class Show; its comments describe it as:
The lines with :show() and :bshow() take several seconds to execute, because they create a .tex file and run pdflatex to generate a .pdf from it, and this is slow - 6 seconds on my machine. You will have to wait until the :show() or :bshow() answers something like this,
Show: /tmp/pict2e-lua/2022pict2e-body.tex => Success!!!
and then you can execute the
with <f8> to display the .pdf.
The "orbit" figure from the screenshot was generated by this test block:
3. Download the video