λ, etc)
(Chapa 1)


LuaTeX and LuaLaTeX stuff (Eduardo Ochs)

Quick index:

1. Dednat6

Almost all of my recent .tex files invoke a "semi-preprocessor" that I wrote, called Dednat6, to let me typeset diagrams easily... its homepage is here: dednat6.html.

2. Using LuaRepl on luatex/lualatex

I integrated Rob Roelz's lua-repl into dednat6 to let me test things in lualatex using a Lua prompt and eepitch. I haven't been using this much, and the best way to explain it would be with a screencast - that I haven't been able to produce yet because of a glitch in X... so no docs yet... =(

# Some links:
# (find-es "lua5" "luarepl-2016")
# (find-es "ffmpeg" "x11grab-problem-erasal")
# (find-eev-quick-intro "6. Controlling shell-like programs")

2017ago04: It's working again! See:

# (find-angg "LATEX/2017repl-test-1.tex")
# (find-angg "LATEX/dednat6/luarepl.lua")

3. Flsfiles: a way to pack multi-file .tex files

Most of my .tex files start with a header like this,

% (defun c () (interactive) (find-LATEXsh "lualatex -record 2017planar-has.tex"))
% (defun d () (interactive) (find-xpdfpage "~/LATEX/2017planar-has.pdf"))
% (defun e () (interactive) (find-LATEX "2017planar-has.tex"))
% (defun u () (interactive) (find-latex-upload-links "2017planar-has"))

so that I can get an e-script like this one by typing 'M-x u',

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# Upload pdf
cd ~/LATEX/
Scp-np 2017planar-has.pdf $TWUP/LATEX/2017planar-has.pdf
Scp-np 2017planar-has.pdf $TWUS/LATEX/2017planar-has.pdf
# Test the pdf (open the urls in a browser):
# (find-xpdfpage   "~/LATEX/2017planar-has.pdf")
# http://angg.twu.net/LATEX/2017planar-has.pdf
#   file:///home/edrx/LATEX/2017planar-has.pdf

# Make .tgz and upload it
flsfiles-tgz 2017planar-has.fls 2017planar-has.tgz
Scp-np 2017planar-has.tgz $TWUP/LATEX/2017planar-has.tgz
Scp-np 2017planar-has.tgz $TWUS/LATEX/2017planar-has.tgz
# http://angg.twu.net/LATEX/2017planar-has.tgz

# Make .zip and upload it
flsfiles-zip 2017planar-has.fls 2017planar-has.zip
Scp-np 2017planar-has.zip $TWUP/LATEX/2017planar-has.zip
Scp-np 2017planar-has.zip $TWUS/LATEX/2017planar-has.zip
# http://angg.twu.net/LATEX/2017planar-has.zip

# Test the .tgz.
# The e-script below downloads, unpacks and compiles the .tgz in /tmp/edrx-latex/.
rm -rfv /tmp/2017planar-has.tgz
rm -rfv /tmp/edrx-latex/
cd /tmp/
wget http://angg.twu.net/LATEX/2017planar-has.tgz
mkdir  /tmp/edrx-latex/
tar -C /tmp/edrx-latex/ -xvzf /tmp/2017planar-has.tgz
cd     /tmp/edrx-latex/
lualatex 2017planar-has.tex

# Test the .zip.
# The e-script below downloads, unpacks and compiles the .tgz in /tmp/edrx-latex/.
rm -rfv /tmp/2017planar-has.zip
rm -rfv /tmp/edrx-latex/
cd /tmp/
wget http://angg.twu.net/LATEX/2017planar-has.zip
mkdir    /tmp/edrx-latex/
unzip -d /tmp/edrx-latex/ /tmp/2017planar-has.zip
cd       /tmp/edrx-latex/
lualatex 2017planar-has.tex

The really non-trivial parts are the ones that call flsfiles-tgz and flsfiles-zip.

When I type 'M-x c' emacs runs lualatex -record 2017planar-has.tex, and the '-record' option makes lualatex generate a .fls file that lists all files that lualatex has read; the Lua script flsfiles.lua processes that, and outputs the files that are in current directory or in its subdirectories (to exclude the files from the global installation), without repetitions.

Here are the definitions of flsfiles-tgz and flsfiles-zip:

# From: (find-angg ".zshrc" "flsfiles")
# See:  (find-angg "LUA/flsfiles.lua")
function flsfiles     () { ~/LUA/flsfiles.lua $1 | grep -v "^/" }
function flsfiles-tgz () { tar -chvzf "$2" $(flsfiles $1) }
function flsfiles-zip () { rm -fv "$2"; zip "$2" $(flsfiles $1) }

In lua(la)tex 0.76 the '-record' option does not list .lua files, so the above does not work. In lua(la)tex 0.79 and beyond it works, so I have to install a newer luatex on top of my Debian system...

4. Installing a recent luatex on Debian


My e-mail to the mailing list about this is here.

This downloads and builds luatex-0.95.0:

# From: (find-es "luatex" "luatex-0.95.0")

rm -Rv ~/usrc/luatex/
mkdir  ~/usrc/luatex/
cd     ~/usrc/luatex/
tar -xJvf $S/https/foundry.supelec.fr/frs/download.php/latestfile/6/0.95.0.doc.tar.xz
tar -xJvf $S/https/foundry.supelec.fr/frs/download.php/latestfile/6/0.95.0.tar.xz
cd     ~/usrc/luatex/0.95.0/
./build.sh 2>&1 | tee ob

This should work for installing it on top of a Debian system,

# From: (find-es "luatex" "luatex-0.95.0")

# Save Debian's luatex as /usr/bin/luatex-orig,
# and install luatex-0.95.0 as /usr/bin/luatex.
sudo mv -iv /usr/bin/luatex \
sudo rm -v  /usr/bin/luatex
ls -lAF    ~/usrc/luatex/0.95.0/build/texk/web2c/luatex
sudo cp -s ~/usrc/luatex/0.95.0/build/texk/web2c/luatex \

# Generate .fmt files using luatex-0.95.0.
# Note that the new .fmt files will be put here:
# (find-fline "~/.texmf-var/web2c/luatex/")
cd ~/usrc/luatex/0.95.0/
fmtutil --byengine luatex    2>&1 | tee ofmtutil

...but it doesn't work, because recent luatexes have fewer primitives (see this) and so they need need newer .ini files... use this to revert back to Debian's luatex:

# Revert: /usr/bin/luatex-orig becomes /usr/bin/luatex.
# (find-fline "/usr/bin/" "luatex-orig")

ls -lAF     /usr/bin/luatex*
sudo rm -v  /usr/bin/luatex
sudo mv -iv /usr/bin/luatex-orig /usr/bin/luatex
fmtutil --byengine luatex   2>&1 | tee /tmp/ofmtutil

# (find-fline   "/tmp/ofmtutil")
# (find-sh "sort /tmp/ofmtutil")
# (find-sh "grep 'fmtutil:' /tmp/ofmtutil")

Links to some of my notes (warning: big mess!):

# (find-es "luatex" "luatex-0.90")
# (find-es "luatex" "luatex-0.95.0")
# (find-es "luatex" "luatex-0.95.0" "./build.sh")
# (find-es "luatex" "luatex-0.95.0-fmtutil-email")
# (find-es "luatex" "luatex-0.95.0-pdfoutput")
# (find-es "luatex" "luatex-from-sid-inis")

4.1. Installing the newer .ini files


This script downloads Debian Sid's luatex package and extracts its .ini files and their most obvious dependencies, copying them to ~/usrc/tex-ini-files/:

# From: (find-es "luatex" "luatex-from-sid-inis")

rm -Rv ~/usrc/texlive-base/
mkdir  ~/usrc/texlive-base/
cd     ~/usrc/texlive-base/
ar t $S/http/http.debian.net/debian/pool/main/t/texlive-base/texlive-base_2016.20170123-5_all.deb
ar p $S/http/http.debian.net/debian/pool/main/t/texlive-base/texlive-base_2016.20170123-5_all.deb \
  data.tar.xz | tar -xvJf -

rm -Rv ~/usrc/tex-ini-files/
mkdir  ~/usrc/tex-ini-files/
cd     ~/usrc/tex-ini-files/
cp -v  ~/usrc/texlive-base/usr/share/texlive/texmf-dist/tex/generic/tex-ini-files/* .
cp -v  ~/usrc/texlive-base/usr/share/texlive/texmf-dist/tex/generic/unicode-data/* .

# (find-fline "~/usrc/texlive-base/usr/share/texlive/texmf-dist/tex/generic/tex-ini-files/")
# (find-fline "~/usrc/texlive-base/usr/share/texlive/texmf-dist/tex/generic/unicode-data/")
# (find-fline "~/usrc/tex-ini-files/")

Here is my guess on how to solve the problems above - i.e., how to install a recent luatex on top of Debian.

It MAY BE possible to make a small modification to texmf.cfg (???) to make luatex search for .ini files and their dependencies in ~/usrc/tex-ini-files/ first, before the standard paths that lead to the older .ini files in the Debian installation... if I run fmtutil with that modified texmf.cfg, then it will build the new .fmt files correctly, and put them into ~/.texmf-var/web2c/luatex/.

Update: An alternative is to use the environment variable TEXINPUTS:

# (find-node "(kpathsea)Default expansion")
# http://tug.org/texinfohtml/kpathsea.html#Default-expansion

cd ~/usrc/luatex/0.95.0/
TEXINPUTS=$HOME/usrc/tex-ini-files/: \
  fmtutil --byengine luatex    2>&1 | tee ofmtutil

...now thing almost work: fmtutil generates .fmt files for dviluatex.ini and luatex.ini, but when it tries to process lualatex.ini it aborts with:

This is LuaTeX, Version 0.95.0 (TeX Live 2016)  (INITEX)
 restricted system commands enabled.
! Undefined control sequence.
\bbl@hook@everylanguage ...\luatexluaescapestring 
                                                  {\string #1}') == nil)}\if...