Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
#######
#
# E-scripts about LuaTeX.
#
# 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/luatex.e>
#           or at <http://angg.twu.net/e/luatex.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/>.
#
#######




# «.mailing-lists»		(to "mailing-lists")
# «.luatex»			(to "luatex")
# «.luatex-manual»		(to "luatex-manual")
# «.lua-repl»			(to "lua-repl")
# «.lua-repl-2012»		(to "lua-repl-2012")
# «.context-lua»		(to "context-lua")
# «.luacode»			(to "luacode")
# «.luacode-old»		(to "luacode-old")
# «.luamplib»			(to "luamplib")
# «.luatex-upstream»		(to "luatex-upstream")
# «.luatex-0.79.1»		(to "luatex-0.79.1")
# «.luatex-svn»			(to "luatex-svn")
# «.luatex-package.searchers»	(to "luatex-package.searchers")
# «.luatex-0.79.1-mplib»	(to "luatex-0.79.1-mplib")
# «.luatex-0.79.1-paths»	(to "luatex-0.79.1-paths")
# «.luatex-0.79.1-minimal»	(to "luatex-0.79.1-minimal")
# «.luatex-0.79.1-min-backup»	(to "luatex-0.79.1-min-backup")
# «.luatex-0.79.1-min-fmtutil»	(to "luatex-0.79.1-min-fmtutil")
# «.luatex-0.79.1-min-revert»	(to "luatex-0.79.1-min-revert")
# «.luatex-0.90»		(to "luatex-0.90")
# «.luatex-0.95.0»		(to "luatex-0.95.0")
# «.luatex-0.95.0-doc»		(to "luatex-0.95.0-doc")
# «.luatex-0.95.0-fmtutil-email»  (to "luatex-0.95.0-fmtutil-email")
# «.luatex-0.95.0-pdfoutput»	(to "luatex-0.95.0-pdfoutput")
# «.luatex-from-sid»		(to "luatex-from-sid")
# «.luatex-from-sid-inis»	(to "luatex-from-sid-inis")
# «.fmtutil»			(to "fmtutil")
# «.LUA_INIT»			(to "LUA_INIT")
# «.picture-mode»		(to "picture-mode")
# «.dvi-output»			(to "dvi-output")
# «.luapackageloader»		(to "luapackageloader")
# «.package.loaders»		(to "package.loaders")
# «.require»			(to "require")
# «.lualatex-repl»		(to "lualatex-repl")
# «.nodes»			(to "nodes")
# «.tex-without-tex»		(to "tex-without-tex")
# «.traversing-a-paragraph»	(to "traversing-a-paragraph")
# «.getting-glyph-data»		(to "getting-glyph-data")
# «.status.filename»		(to "status.filename")
# «.tex.jobname»		(to "tex.jobname")
# «.tex.inputlineno»		(to "tex.inputlineno")
# «.tex.inputlineno-repl»	(to "tex.inputlineno-repl")
# «.tex.inputlineno-tex»	(to "tex.inputlineno-tex")
# «.skipping-lines»		(to "skipping-lines")
# «.process_input_buffer»	(to "process_input_buffer")
# «.skipnlines»			(to "skipnlines")
# «.token-library»		(to "token-library")
# «.makecrspecial-1»		(to "makecrspecial-1")
# «.makecrother»		(to "makecrother")
# «.luatexbase-cctb»		(to "luatexbase-cctb")
# «.macros»			(to "macros")
# «.high-catcodes»		(to "high-catcodes")
# «.catcodes»			(to "catcodes")
# «.inspecting-defs»		(to "inspecting-defs")
# «.token.expand»		(to "token.expand")
# «.token.get_macro»		(to "token.get_macro")
# «.token.get_meaning»		(to "token.get_meaning")
# «.spurious-omega»		(to "spurious-omega")
# «.comments-in-tex.print»	(to "comments-in-tex.print")
# «.lua-5.2»			(to "lua-5.2")
# «.lua-version»		(to "lua-version")
# «.ufy»			(to "ufy")
# «.texlive-2016»		(to "texlive-2016")
# «.texlive-2017»		(to "texlive-2017")
# «.shell-escape»		(to "shell-escape")
# «.pdfshellescape»		(to "pdfshellescape")
# «.thislinetag»		(to "thislinetag")
# «.show»			(to "show")
# «.inspecting-tex-tokens»	(to "inspecting-tex-tokens")
# «.inspecting-tex-tokens-taco»	(to "inspecting-tex-tokens-taco")
# «.lua-repl-2018»		(to "lua-repl-2018")
# «.show-section»		(to "show-section")
# «.arxiv»			(to "arxiv")
# «.ifluatex»			(to "ifluatex")
# «.dimensions-of-subboxes»	(to "dimensions-of-subboxes")
# «.interleaving»		(to "interleaving")
# «.dimension-of-subboxes-1»	(to "dimension-of-subboxes-1")
# «.beginpicture-dnt»		(to "beginpicture-dnt")
# «.insert-pdf-page»		(to "insert-pdf-page")
# «.stroked-fonts-in-luamplib»	(to "stroked-fonts-in-luamplib")
# «.tex.printing-verbatim»	(to "tex.printing-verbatim")
# «.resources-about-catcodes-1»	(to "resources-about-catcodes-1")
# «.catcode-resources»		(to "catcode-resources")
# «.catcodetable@string»	(to "catcodetable@string")
# «.package.searchers-2020»	(to "package.searchers-2020")
# «.lualibs»			(to "lualibs")
# «.re»				(to "re")
# «.dimensions-of-subboxes-2»	(to "dimensions-of-subboxes-2")


# (find-es "tex" "beamer")




#####
#
# Mailing lists
# 2014may01
#
#####

# «mailing-lists» (to ".mailing-lists")
# http://www.ntg.nl/mailman/private/dev-luatex/
# http://tug.org/mailman/listinfo/luatex
# http://tug.org/pipermail/luatex/
# http://tug.org/pipermail/luatex/2009-January/000040.html
# http://www.ntg.nl/mailman/private/dev-luatex/
# http://www.ntg.nl/mailman/private/dev-luatex/2009-February/002307.html
# http://tug.org/pipermail/luatex/2013-May/004346.html tex.hashtokens()
# http://tug.org/pipermail/luatex/2017-May/006527.html Reusable Code (LuaLaTeX + LuaMPlib)

# http://weblog.elzevir.fr/2009/02/integrer-un-luatex-recent-a-tex-live/



#####
#
# luatex on squeeze
# 2010dec05
#
#####

# «luatex»  (to ".luatex")
# (find-angg ".emacs" "luatex")
# (find-status   "luatex")
# (find-vldifile "luatex.list")
# (find-udfile   "luatex/")
# (find-udfile   "luatex/examples/")
# (find-status   "texlive-luatex")
# (find-vldifile "texlive-luatex.list")
# (find-udfile   "texlive-luatex/")
# (find-zsh "dmissing luatexref")

# (find-fline "/usr/share/texmf-texlive/tex/lualatex/luainputenc/")
# (find-fline "/usr/share/texmf-texlive/tex/luatex/luatextra/")
# (find-fline "/usr/share/texmf-texlive/tex/luatex/luaotfload/")
# (find-fline "/usr/share/texmf-texlive/tex/luatex/luamplib/")
# (find-fline "/usr/share/doc/texlive-luatex/lualatex/luainputenc/")
# (find-fline "/usr/share/doc/texlive-luatex/luatex/luatextra/")
# (find-fline "/usr/share/doc/texlive-luatex/luatex/luaotfload/")
# (find-fline "/usr/share/doc/texlive-luatex/luatex/luamplib/")
# (find-fline "/usr/share/doc/texlive-luatex/")
# (find-fline "/usr/share/doc/texlive-doc/lualatex/")
# (find-fline "/usr/share/doc/texlive-doc/luatex/")

# (find-luatexrefpage 14 "primitive \\directlua")
# (find-luatexreftext    "primitive \\directlua")
# (find-luatexrefpage 19 "--luaonly")
# (find-luatexreftext    "--luaonly")

* (eepitch-luatex)
* (eepitch-kill)
* (eepitch-luatex)
\relax
\tracingonline=1\scrollmode
\edef\foo{\directlua0{tex.print(math.pi)}}
\show\foo

* (eepitch-lualatex)
* (eepitch-kill)
* (eepitch-lualatex)
\relax
\tracingonline=1\scrollmode
\edef\foo{\directlua0{tex.print(math.pi)}}
\show\foo




\catcode`\{=1
\catcode`\}=2
\catcode`\#=6
\def\test#1{%
 \immediate\write16{%
   [#1: \directlua{tex.write(status.luatex_#1)}]%
 }%
}
\test{svn}
\test{version}
\test{revision}
\csname @@end\endcsname\end





#####
#
# luatex reference manual (several versions)
# 2018jan30 / 2019jan05
#
#####

# «luatex-manual» (to ".luatex-manual")
# (find-angg ".emacs" "luatex")
# http://www.luatex.org/svn/trunk/manual/
# http://www.luatex.org/svn/trunk/manual/luatex.pdf (<- old)
# http://www.luatex.org/documentation.html
# http://wiki.luatex.org/index.php/Documentation_and_help

;; (find-fline "$S/http/www.luatex.org/svn/trunk/manual/")
(code-pdf-page "luatexref" "$S/http/www.luatex.org/svn/trunk/manual/luatex.pdf")
(code-pdf-text "luatexref" "$S/http/www.luatex.org/svn/trunk/manual/luatex.pdf" 4)
;; (find-luatexrefpage)
;; (find-luatexreftext)

;; (find-fline "/usr/local/texlive/2019/texmf-dist/doc/context/documents/general/manuals/")
(code-pdf-page "luatexref" "/usr/local/texlive/2019/texmf-dist/doc/context/documents/general/manuals/luatex.pdf")
(code-pdf-text "luatexref" "/usr/local/texlive/2019/texmf-dist/doc/context/documents/general/manuals/luatex.pdf")
;; (find-luatexrefpage)
;; (find-luatexreftext)










#####
#
# Running a Lua REPL in LuaTeX
# 2012dec27
#
#####

# «lua-repl» (to ".lua-repl")



#####
#
# Running a Lua REPL in LuaTeX with \directlua{debug.debug()}
# 2018jan31
#
#####

# «lua-repl-2012» (to ".lua-repl-2012")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# (find-man "1 texlua")
# (find-man "1 texlua" "--luaonly")
texlua -h
luatex --luaonly 

* (eepitch-luatex)
* (eepitch-kill)
* (eepitch-luatex)
\directlua{debug.debug()}
dofile "/home/edrx/LUA/lua50init.lua"
PP {1, 2, 3}
PP(sorted(keys(_G)))
print(table.concat(sorted(keys(_G)), " "))

ikeys = function (G) return ipairs(sorted(keys(G))) end
tablep = function (o) return type(o) == "table" end

for _,name in ikeys(_G) do print(name) end
af = "collectgarbage gcinfo"
a = "callback font fontforge fontloader gzip kpse lang lfs ltn12 lua md5 mime mplib node profiler tex texconfig texio unicode"
for _,name in ipairs(split(a)) do print(name, type(_G[name])) end

for _,name in ikeys(callback) do print(name) end
for _,name in ikeys(font) do print(name) end
for _,name in ikeys(fontforge) do print(name) end
for _,name in ikeys(fontloader) do print(name) end
for _,name in ikeys(gzip) do print(name) end
for _,name in ikeys(kpse) do print(name) end
for _,name in ikeys(lang) do print(name) end
for _,name in ikeys(lfs) do print(name) end
for _,name in ikeys(ltn12) do print(name) end
for _,name in ikeys(lua) do print(name) end
for _,name in ikeys(md5) do print(name) end
for _,name in ikeys(mime) do print(name) end
for _,name in ikeys(mplib) do print(name) end
for _,name in ikeys(node) do print(name) end
for _,name in ikeys(profiler) do print(name) end
for _,name in ikeys(tex) do print(name) end
for _,name in ikeys(texconfig) do print(name) end
for _,name in ikeys(texio) do print(name) end
for _,name in ikeys(unicode) do print(name) end


collectgarbage	function
gcinfo	function

callback	table
font	table
fontforge	table
fontloader	table
gzip	table
kpse	table
lang	table
lfs	table
ltn12	table
lua	table
md5	table
mime	table
mplib	table
node	table
profiler	table
tex	table
texconfig	table
texio	table
unicode	table

PP(A)




#####
#
# ConTeXt Lua documents
# 2013jan24
#
#####

# «context-lua» (to ".context-lua")
# http://www.pragma-ade.com/show-man-44.htm
# http://www.pragma-ade.com/general/manuals/cld-mkiv.pdf




#####
#
# luacode
# 2013apr30
#
#####

# «luacode» (to ".luacode")
# (find-angg ".emacs" "luacode")
# (find-sh "locate luacode")
# (find-fline "/usr/share/doc/texlive-luatex/lualatex/luacode/")
# (find-fline "/usr/share/texlive/texmf-dist/tex/lualatex/luacode/luacode.sty")

# (find-angg ".emacs" "luacode")
# (find-luacodepage)
# (find-luacodetext)

# (find-luatexrefpage)
# (find-luatexreftext)

http://www.unirioja.es/cu/jvarona/downloads/numerical-methods-luatex.pdf
tex.print
\directlua

http://www.readytext.co.uk/?p=1449 Lua code to process a LuaTeX node list
http://www.readytext.co.uk/?cat=15 LuaTeX Examples
http://tex.stackexchange.com/questions/70/what-is-a-simple-example-of-something-you-can-do-with-luatex
http://wiki.contextgarden.net/Programming_in_LuaTeX
http://wiki.contextgarden.net/Programming_in_LuaTeX#Parsing_input_without_exploding_your_head

#*
# (defun c  () (interactive) (eev-bounded) (find-zsh0 "ee"))
# (defun cc () (interactive) (eev-bounded) (find-zsh  "ee"))
# (defun d  () (interactive) (find-pdf-page "/tmp/tikz/test1.pdf"))
# (find-angg ".emacs.papers" "tikz")

mkdir /tmp/tikz/
cd    /tmp/tikz/
cat > test1.tex <<'%%%'
\documentclass{book}
\usepackage{luacode}
\begin{document}

\begin{luacode}
print("Hello!")
a = 22
\end{luacode}

\begin{luacode}
print("Hello!", a)
\end{luacode}

\begin{luacode}
xyfromuv = function (u,v)
    local x = u + v
    local y = u y v
    tex.print(x..",",,y)
  end
\end{luacode}
\def\xyfromuv#1#2{\directlua{xyfromuv(#1, #2)}}


% xyfromt = function (t)
%     xyfromyv(t, 1/t)
%   end
% \def\xyfromt   #1{\directlua{xyfromt(#1)}}




Hello
\end{document}
%%%
lualatex test1.tex
#*








#####
#
# luacode-old
# 2014jun08
#
#####

# «luacode-old» (to ".luacode-old")
# http://wiki.luatex.org/index.php/Writing_Lua_in_TeX
# (find-angg ".emacs" "luatex")
# (find-blogme3 "anggdefs.lua" "setvbuf" "Without a setvbuf errors are")

%*
% (eeluatex-bounded)
% (eeluatex-view)

Hello

% http://wiki.luatex.org/index.php/Writing_Lua_in_TeX
\def\luacode{%
  \bgroup
  \catcode`\{=12
  \catcode`\}=12
  \catcode`\^^M=12
  \catcode`\#=12
  \catcode`\~=12
  \catcode`\%=12
  \doluacode
}
\bgroup
\catcode`\^^M=12 %
\long\gdef\doluacode#1^^M#2\endluacode{\directlua{#2}\egroup}%
\egroup


\luacode
io.stdout:setvbuf("no")           -- for errors
print(2+3)
\endluacode

%*

# Apparently an extension of the \luacode macro that appears at:
# http://wiki.luatex.org/index.php/Writing_Lua_in_TeX

# http://ctan.tche.br/macros/luatex/latex/luacode/
# http://ctan.tche.br/macros/luatex/latex/luacode/luacode.pdf
# http://ctan.tche.br/macros/luatex/latex/luacode/README




#####
#
# luamplib
# 2013may11
#
#####

# «luamplib» (to ".luamplib")
# (find-udfile "texlive-luatex/luatex/luamplib/")
# (find-zsh "dmissing luamp")
# http://wiki.luatex.org/index.php/Metapost_with_LuaTeX
# (find-angg ".emacs" "luatex")
# http://tex.stackexchange.com/questions/23984/how-to-use-mplib-directly-from-lua
# http://tex.stackexchange.com/questions/3750/ploting-a-function-using-mplib-in-lualatex
# http://math.berkeley.edu/computing/wiki/index.php/Tex_sample_embedded_metapost

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd /tmp/
export LUA_INIT=

I am trying to use luamplib to create some drawings, but all my
attempts to follow the recipes that I found at the web are failing at
essentially the same point... for example, this shell code

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd /tmp/
cat > luamplibtest.tex <<'@@@'
\documentclass[a4paper]{article}
\usepackage{luamplib}
\begin{document}
Some text, a drawing (%
\begin{mplibcode}
beginfig(1);
draw (0,0)--(100,0)--(100,100)--(0,100)--cycle;
endfig;
\end{mplibcode}
), more text
\end{document}
@@@

~/bigsrc/luatex-beta-0.79.1/build/texk/web2c/luatex luamplibtest.tex

lualatex luamplibtest.tex






#####
#
# luatex from upstream
# 2014may01
#
#####

# «luatex-upstream» (to ".luatex-upstream")
# «luatex-0.79.1»   (to ".luatex-0.79.1")
# (find-angg ".emacs" "luatex-src")
# http://www.luatex.org/download.html
# https://foundry.supelec.fr/frs/download.php/file/15762/luatex-beta-0.79.1-doc.tar.bz2
# https://foundry.supelec.fr/frs/download.php/file/15763/luatex-beta-0.79.1-source.tar.bz2
# https://foundry.supelec.fr/frs/download.php/file/15766/metapost-1.902-src.tar.bz2
# http://tug.org/pipermail/luatex/2014-May/004829.html on luamplib
# http://tug.org/pipermail/luatex/2014-May/004830.html on compiling 0.79.0
# http://tug.org/pipermail/luatex/2014-May/004831.html use 0.79.1 instead
# http://tug.org/pipermail/luatex/2014-May/004832.html using the .fmt
# http://tug.org/pipermail/luatex/2014-May/004834.html using the .fmt: answer
#*
rm -Rv ~/bigsrc/luatex-beta-0.79.1/
tar -C ~/bigsrc/ -xvjf \
  $S/https/foundry.supelec.fr/frs/download.php/file/15763/luatex-beta-0.79.1-source.tar.bz2
cd     ~/bigsrc/luatex-beta-0.79.1/

find * -type f | sort > .files

# (find-fline "~/bigsrc/luatex-beta-0.79.1/")
# (find-fline "~/bigsrc/luatex-beta-0.79.1/.files")
# (find-fline "~/bigsrc/luatex-beta-0.79.1/build/texk/kpathsea/paths.h")

#*
cd ~/bigsrc/luatex-beta-0.79.1/
./build.sh  |& tee obsh

#*
# (find-fline "/usr/share/texlive/texmf-dist/tex/latex/latexconfig/")
# (find-fline "/usr/share/texlive/texmf-dist/tex/latex/latexconfig/lualatex.ini")
# (find-fline "/var/lib/texmf/web2c/luatex/" "lualatex.fmt")
# (find-fline "~/.texmf-var/web2c/luatex/" "lualatex.fmt")
# (find-fline "~/.texmf-var/web2c/luatex/lualatex.log")



#####
#
# Luatex: sources from the SVN repository
# 2019feb04
#
#####

# «luatex-svn» (to ".luatex-svn")
# (code-c-d "luatexs"   "~/bigsrc/luatex/branches/experimental/source/")
# (code-c-d "luatexsrc" "~/bigsrc/luatex/branches/experimental/source/texk/web2c/luatexdir/")
# http://www.luatex.org/download.html
# https://serveur-svn.lri.fr/svn/modhel/luatex
#    --username anonsvn --password anonsvn

# (find-man "1 svn")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# (find-fline "~/bigsrc/luatex/")
rm -Rv ~/bigsrc/luatex/
mkdir  ~/bigsrc/luatex/
cd     ~/bigsrc/
svn checkout \
  --username anonsvn --password anonsvn \
  https://serveur-svn.lri.fr/svn/modhel/luatex
cd     ~/bigsrc/luatex/

# (code-c-d "luatexs"   "~/bigsrc/luatex/branches/experimental/source/")
# (code-c-d "luatexsrc" "~/bigsrc/luatex/branches/experimental/source/texk/web2c/luatexdir/")
# (find-luatexsfile "")
# (find-luatexsrcfile "")
# (find-luatexsrcgrep "grep --color -nRH --null -e print *")
# (find-luatexsrcgrep "grep --color -nRH --null -e getcatcode *")
# (find-luatexsrcfile "NEWS" "The tex.print function has")
# (find-luatexssh "find * | sort")
# (find-luatexssh "grep -R '\"print\"' *")
# (find-luatexssh "grep -R -e 'tex\\.print' *")
# (find-luatexsrcfile "lua/ltexlib.c" "{ \"getcatcode\", getcatcode },")
# (find-luatexsrcfile "lua/ltexlib.c" "{ \"setcatcode\", setcatcode },")
# (find-luatexsrcfile "lua/ltexlib.c" "static int getcatcode(")
# (find-luatexsrcfile "lua/ltexlib.c" "static int setcatcode(")
# (find-luatexsrcgrep "grep --color -nH --null -e cat_code_table_par lua/*")

# (find-luatexsrcfile "lua/ltexlib.c" " texlib[] = ")
# (find-luatexsrcfile "lua/ltexlib.c" "{ \"print\", luacprint },")
# (find-luatexsrcfile "lua/ltexlib.c" "/* lua.print */")

# (find-luatexsfile "texk/web2c/luatexdir/lua/ltexlib.c" "{ \"print\", luacprint },")
# (find-luatexsfile "texk/web2c/luatexdir/lua/ltexlib.c" "/* lua.print */")
# (find-luatexsfile "texk/web2c/luatexdir/")
# (find-luatexsfile "texk/web2c/luatexdir/tex/")
# (find-luatexsfile "texk/web2c/luatexdir/tex/printing.c" "0 to 15")

# (find-luatexsrcfile "NEWS" "tex.print() output is now fed straight into a pseudo file")
# (find-luatexsrcfile "lua/ltexlib.c" "void init_tex_table(")
# (find-luatexsrcfile "lua/ltexlib.c" "void init_tex_table(" "\"tex\"")
# (find-luatexsrcfile "lua/ltexlib.c" "int luaopen_tex(")
# (find-luatexsrcfile "lua/ltexlib.c" "int luaopen_tex(" "\"tex\", texlib,")
# (find-luatexsrcfile "lua/ltexlib.c" "texlib[] =")
# (find-luatexsrcfile "lua/ltexlib.c" "texlib[] =" "{ \"print\", luacprint },")
# (find-luatexsrcfile "lua/ltexlib.c" "static int luacprint(")
# (find-luatexsrcfile "lua/ltexlib.c" "static int do_luacprint(")
# (find-luatexsrcgrep "grep --color -nRH --null -e tex.print *")
# (find-luatexsrcgrep "grep --color -nRH --null -e '\"tex\"' *")
# (find-luatexsrcgrep "grep --color -nRH --null -e    luacprint *")
# (find-luatexsrcgrep "grep --color -nRH --null -e do_luacprint *")
# (find-luatexsrcgrep "grep --color -nRH --null -e DEFAULT_CAT_TABLE *")
# (find-luatexsrcgrep "grep --color -nRH --null -e         CAT_TABLE *")
# (find-luatexsrcgrep "grep --color -nRH --null -e      'pseudo file' *")
# (find-luatexsrcfile "tex/inputstack.h" "18<=name<=20" "pseudo file")
# (find-luatexsrcfile "tex/inputstack.c" "void pseudo_from_string(")



# (find-man "1 grep")

# (find-sh "cd ~/bigsrc/luatex/ && du -c")
# (find-luatexssh "find * | sort | grep lua")
# (find-luatexssh "find * | sort | grep print")
# (find-luatexsfile "texk/web2c/luatexdir/tex/printing.c")

# (find-luatexssh "find * | sort | grep token")
# (find-luatexsfile "texk/web2c/luatexdir/lua/")
# (find-luatexsfile "texk/web2c/luatexdir/lua/_luatoken.w")
# (find-luatexsfile "texk/web2c/luatexdir/lua/lnewtokenlib.c")
# (find-luatexsfile "texk/web2c/luatexdir/lua/luatoken.c")
# (find-luatexsfile "texk/web2c/luatexdir/tex/")
# (find-luatexsfile "texk/web2c/luatexdir/tex/_textoken.w")
# (find-luatexsfile "texk/web2c/luatexdir/tex/textoken.c")


* (eepitch-shell)
rm -Rv /tmp/testsvn
mkdir  /tmp/testsvn
cd     /tmp/testsvn
svn checkout http://svn.prv.digirati.com.br/repos/adm/trunk/todo
svn checkout --username edrx.dig \
   http://svn.prv.digirati.com.br/repos/adm/trunk/todo




#####
#
# Where is the source for the modified package.searchers of luatex?
# 2017jul10
#
#####

# «luatex-package.searchers» (to ".luatex-package.searchers")
# http://www.lua.org/manual/5.2/manual.html#pdf-package.searchers
# http://www.lua.org/manual/5.2/manual.html#pdf-dofile
# http://www.lua.org/manual/5.2/manual.html#pdf-loadfile
# (find-fline "~/LATEX/dednat6/lualoader.lua")
# (find-fline "~/LATEX/dednat6/lualoader.lua" "assert")

# (code-c-d "luatex0791" "~/bigsrc/luatex-beta-0.79.1/")
# (find-luatex0791file "")
# (find-luatex0791sh "grep INPUT $(cat .files)")
# (find-luatex0791sh "grep -w INPUT $(cat .files)")
# (find-luatex0791grep "grep -nH -e INPUT $(cat .files)")
# (find-luatex0791grep "grep -nHw -e INPUT $(cat .files)")
# (find-luatex0791grep "grep -nH -e recorder_record_input $(cat .files)")
# (find-luatex0791grep "grep -nH -e luatex_dofile $(cat .files)")
# (find-luatex0791grep "grep -nH -e luatex_loadfile $(cat .files)")
# (find-luatex0791grep "grep -nH -e luaopen_package $(cat .files)")
# (find-luatex0791file "source/texk/web2c/lib/openclose.c" "recorder_record_input" "INPUT")
# (find-luatex0791file "source/texk/web2c/luatexdir/lua/luastuff.w")
# (find-luatex0791file "source/texk/web2c/luatexdir/lua/luastuff.w" "recorder_record_input")
# (find-luatex0791file "source/texk/web2c/luatexdir/lua/luastuff.w" "recorder_record_input" "_input")
# (find-luatex0791file "source/texk/web2c/luatexdir/lua/luastuff.w" "L,luatex_dofile")




#####
#
# luatex-0.79.1: mplib (is broken and segfaults)
# 2017jun24
#
#####

# «luatex-0.79.1-mplib» (to ".luatex-0.79.1-mplib")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -v ~/.texmf-var/web2c/luatex/lualatex*
cd /tmp/
~/bigsrc/luatex-beta-0.79.1/build/texk/web2c/luatex '&lualatex'  2>&1 | tee o

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

rm -v            ~/bin/luatex

cd /tmp/
cat > luamplibtest.tex <<'@@@'
\documentclass[a4paper]{article}
\usepackage{luamplib}
\begin{document}
Some text, a drawing (%
\begin{mplibcode}
beginfig(1);
draw (0,0)--(100,0)--(100,100)--(0,100)--cycle;
endfig;
\end{mplibcode}
), more text
\end{document}
@@@
lualatex luamplibtest.tex

cd /tmp/
cp -v ~/bigsrc/luatex-beta-0.79.1/build/texk/web2c/luatex /tmp/lualatex
./lualatex luamplibtest.tex   2>&1 | tee ot

NEWLUATEXDIR=$HOME/bigsrc/luatex-beta-0.79.1/build/texk/web2c
NEWLUATEX=$NEWLUATEXDIR/luatex

rm -v            /tmp/luatex
cp -v $NEWLUATEX /tmp/
which luatex
PATH=/tmp:$PATH
which luatex

cp -v /usr/share/texlive/texmf-dist/tex/latex/latexconfig/* .

luatex --ini lualatex.ini
luatex --fmt=lualatex luamplibtest.tex

# (find-fline "/etc/texmf/web2c/texmf.cnf")
# (find-fline "~/bigsrc/luatex-beta-0.79.1/source/texk/kpathsea/texmf.cnf")
# (find-fline "/usr/share/texlive/texmf/web2c/texmf.cnf")
# (find-fline "/usr/share/texmf/web2c/texmf.cnf")
# (find-node "(kpathsea)Top")

# (find-sh "locate texmf.cnf")

$NEWLUATEX --ini lualatex.ini
$NEWLUATEX --fmt=lualatex somefile.tex
$NEWLUATEX --fmt=lualatex luamplibtest.tex

#*
# (find-angg ".emacs" "luatex-src")
# (find-luatexsrcfile "")
# (find-luatexsrcfile "INSTALL")
# (find-luatexsrcfile "obsh")
# (find-luatexsrcfile ".files" "source/texk/web2c/mplibdir/")
# (find-luatexsrcfile "source/texk/web2c/mplibdir/")
# (find-luatexsrcfile "build/texk/web2c/" " luatex")





#####
#
# luatex-0.79.1 lualatex.ini file problem (narrowing down to paths)
# 2014may04
#
#####

# «luatex-0.79.1-paths» (to ".luatex-0.79.1-paths")
# (find-fline "~/.texmf-var/web2c/pdftex/")
# (find-sh "locate texmf.cnf")

# (find-fline "/etc/texmf/web2c/texmf.cnf")
# (find-fline "~/bigsrc/luatex-beta-0.79.1/.files")
# (find-fline "~/bigsrc/luatex-beta-0.79.1/source/texk/kpathsea/texmf.cnf")
# (find-fline "/usr/share/texlive/texmf/web2c/texmf.cnf")
# (find-fline "/usr/share/texmf/web2c/texmf.cnf")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
NEWLUATEXDIR=$HOME/bigsrc/luatex-beta-0.79.1/build/texk/web2c
NEWLUATEX=$NEWLUATEXDIR/luatex

rm -v            /tmp/luatex
cp -v $NEWLUATEX /tmp/

cd ~/luatex/
which luatex
PATH=/tmp:$PATH
which luatex

luatex '&lualatex' |& tee o
# (find-sh "cat ~/luatex/o")
# (find-sh "cat ~/luatex/o | tr : '\n'")




luatex --ini lualatex
luatex --fmt=lualatex luamplibtest.tex
luatex --fmt=lualatex luamplibtest.tex

warning
 kpathsea
 configuration file texmf.cnf not found in these directories
 /tmp
/tmp/share/texmf-local/web2c
/tmp/share/texmf-dist/web2c
/tmp/share/texmf/web2c
/tmp/texmf-local/web2c
/tmp/texmf-dist/web2c
/tmp/texmf/web2c
/
//share/texmf-local/web2c
//share/texmf-dist/web2c
//share/texmf/web2c
//texmf-local/web2c
//texmf-dist/web2c
//texmf/web2c
//texmf-local/web2c
/
//share/texmf-local/web2c
//share/texmf-dist/web2c
//share/texmf/web2c
//texmf-local/web2c
//texmf-dist/web2c
//texmf/web2c.








* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
NEWLUATEXDIR=$HOME/bigsrc/luatex-beta-0.79.1/build/texk/web2c
NEWLUATEX=$NEWLUATEXDIR/luatex
$NEWLUATEX --ini lualatex.ini
$NEWLUATEX --fmt=lualatex somefile.tex






https://foundry.supelec.fr/frs/download.php/latestzip/6/luatex-latest.zip

/usr/bin/lualatex




# (find-man "1 luatex")
# (find-man "1 luatex" "fmt")
* (setenv "NEWLUATEXDIR" "/home/edrx/bigsrc/luatex-beta-0.79.1/build/texk/web2c")


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

NEWLUATEXDIR=$HOME/bigsrc/luatex-beta-0.79.1/build/texk/web2c
NEWLUATEX=$NEWLUATEXDIR/luatex
cd /tmp/
$NEWLUATEX '&latex'  2>&1 | tee o
$NEWLUATEX '&latex' luamplibtest.tex

# (find-fline "/tmp/o")
# (find-fline "/tmp/o" "kpathsea: Running mktexfmt latex.fmt")
# (find-fline "/tmp/o" "/home/edrx/.texmf-var/web2c/pdftex/latex.fmt")
# (find-fline "/tmp/o" "Fatal format file error")

/home/edrx/.texmf-var/web2c/pdftex/latex.fmt

# (find-zsh "w mktexfmt")
# (find-fline "/usr/bin/mktexfmt")
# (find-man "1 mktexfmt")


# (find-fline "~/.texmf-var/web2c/pdftex/")

$NEWLUATEX --fmt=latex luamplibtest.tex





#####
#
# luatex-0.79.1: minimal installation
# 2017jun24
#
#####

# «luatex-0.79.1-minimal» (to ".luatex-0.79.1-minimal")
# Compile with: (to "luatex-0.79.1")
# Check: (find-fline "/tmp/")
#        (find-fline "~/.texmf-var/web2c/")
#        (find-fline "~/.texmf-var/web2c/luatex/")
#        (find-fline "~/bin/")
# See:
# (find-angg ".emacs" "luatex")
# (find-luatexrefpage (+ 4 27) "--fmt=FORMAT")
# (find-luatexreftext (+ 4 27) "--fmt=FORMAT")
# (find-fline "~/bigsrc/luatex-beta-0.79.1/build/texk/web2c/")
# (find-fline "~/bigsrc/luatex-beta-0.79.1/build/texk/web2c/" " luatex")

# «luatex-0.79.1-min-backup» (to ".luatex-0.79.1-min-backup")
# Save Debian's luatex as /usr/bin/luatex-orig,
# and install luatex-0.79.1 as /usr/bin/luatex.
#
sudo mv -iv /usr/bin/luatex \
            /usr/bin/luatex-orig
sudo rm -v  /usr/bin/luatex
ls -lAF    ~/bigsrc/luatex-beta-0.79.1/build/texk/web2c/luatex
sudo cp -s ~/bigsrc/luatex-beta-0.79.1/build/texk/web2c/luatex \
            /usr/bin/luatex

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

# ^ Fails. See:
# (find-fline              "~/bigsrc/luatex-beta-0.79.1/ofmtutil")
# (find-sh "grep 'fmtutil:' ~/bigsrc/luatex-beta-0.79.1/ofmtutil")

# «luatex-0.79.1-min-revert» (to ".luatex-0.79.1-min-revert")
# 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")




# 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


* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
laf    ~/.texmf-var/web2c/luatex/
rm -fv ~/.texmf-var/web2c/luatex/*.fmt
rm -fv ~/.texmf-var/web2c/luatex/*.log







#####
#
# luatex-0.90
# 2016apr22
#
#####

# «luatex-0.90» (to ".luatex-0.90")
# http://www.luatex.org/download.html ->
# https://foundry.supelec.fr/projects/luatex
# https://foundry.supelec.fr/frs/download.php/file/15783/beta-0.90.0.doc.tar.xz
# https://foundry.supelec.fr/frs/download.php/file/15782/beta-0.90.0.tar.xz

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
mkdir ~/usrc/luatex/
rm -Rv ~/usrc/luatex/beta-0.90.0.doc/
tar -C ~/usrc/luatex/ -xvJf \
  $S/https/foundry.supelec.fr/frs/download.php/file/15783/beta-0.90.0.doc.tar.xz
cd     ~/usrc/luatex/beta-0.90.0.doc/

rm -Rv ~/usrc/luatex/beta-0.90.0/
tar -C ~/usrc/luatex/ -xvJf \
  $S/https/foundry.supelec.fr/frs/download.php/file/15782/beta-0.90.0.tar.xz
cd     ~/usrc/luatex/beta-0.90.0/

#*
# (find-node "(tar)Option Summary" "--xz")

(code-c-d "luatexdocmanual" "~/usrc/luatex/beta-0.90.0.doc/manual")
;; (find-luatexdocmanualfile "")

# (find-fline    "~/usrc/luatex/beta-0.90.0.doc/manual/")
# (find-fline    "~/usrc/luatex/beta-0.90.0.doc/manual/old/")
# (find-pdf-page "~/usrc/luatex/beta-0.90.0.doc/manual/luatex.pdf")
# (find-pdf-page "~/usrc/luatex/beta-0.90.0.doc/manual/old/functionref.pdf")
# (find-pdf-page "~/usrc/luatex/beta-0.90.0.doc/manual/old/luatexref-t.pdf")
# (find-fline    "~/usrc/luatex/beta-0.90.0/")
# (find-fline    "~/usrc/luatex/beta-0.90.0/manual/")




#####
#
# luatex 0.95.0
# 2017fev01
#
#####

# «luatex-0.95.0» (to ".luatex-0.95.0")
# http://www.luatex.org/download.html
# http://minimals.contextgarden.net/current/bin/luatex/linux-64/bin/
# https://foundry.supelec.fr/projects/luatex
# https://foundry.supelec.fr/frs/?group_id=10&release_id=430#luatex-_0.95.0-title-content
# https://foundry.supelec.fr/frs/download.php/latestfile/6/0.95.0.doc.tar.xz
# https://foundry.supelec.fr/frs/download.php/latestfile/6/0.95.0.tar.xz
# (find-fline "$S/https/foundry.supelec.fr/frs/download.php/latestfile/6/")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# (find-fline "~/usrc/luatex/")
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
# (find-fline "~/usrc/luatex/0.95.0.doc/manual/")
# (find-fline "~/usrc/luatex/0.95.0/")
# (find-fline "~/usrc/luatex/0.95.0/INSTALL")
# (find-fline "~/usrc/luatex/0.95.0/INSTALL" "build.sh  ")
cd     ~/usrc/luatex/0.95.0/
./build.sh |& tee ob

# (find-fline "~/usrc/luatex/0.95.0/ob")
# (find-fline "~/usrc/luatex/0.95.0/ob" "build/texk/web2c/luatex")
# (find-fline "~/usrc/luatex/0.95.0/build/texk/web2c/" " luatex")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# Adapted from the next block, but **THIS IS NOT WORKING**
# Install and run fmtutil:
# (find-fline "/usr/bin/" "luatex")
# (find-sh "ls -lAF /usr/bin/luatex*")
R
mv -iv /usr/bin/luatex \
       /usr/bin/luatex-orig
rm -v  /usr/bin/luatex
ls -lAF ~/usrc/luatex/0.95.0/build/texk/web2c/luatex
cp -s   ~/usrc/luatex/0.95.0/build/texk/web2c/luatex \
       /usr/bin/luatex
exit
cd ~/usrc/luatex/0.95.0/
fmtutil --byengine luatex |& tee ofmtutil

# Revert:
# (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   |& tee /tmp/ofmtutil
# (find-fline   "/tmp/ofmtutil")
# (find-sh "sort /tmp/ofmtutil")
# (find-sh "grep 'fmtutil:' /tmp/ofmtutil")


# «luatex-0.95.0-doc» (to ".luatex-0.95.0-doc")

;; (find-fline "~/usrc/luatex/0.95.0.doc/manual/")
(code-pdf-page "luatex" "~/usrc/luatex/0.95.0.doc/manual/luatex.pdf")
(code-pdf-text "luatex" "~/usrc/luatex/0.95.0.doc/manual/luatex.pdf")
;; (find-luatexpage)
;; (find-luatextext)




#####
#
# luatex-0.95.0: e-mail about problem installing it
# 2017mar21
#
#####

# «luatex-0.95.0-fmtutil-email» (to ".luatex-0.95.0-fmtutil-email")
# https://mail.google.com/mail/ca/u/0/#sent/15af31cbb31ee32f
# http://tug.org/pipermail/luatex/2017-March/006433.html My original e-mail
# http://tug.org/pipermail/luatex/2017-March/006434.html Norbert's answer
# http://tug.org/pipermail/luatex/2017-March/006435.html my question about \pdfoutput
#
# https://anonscm.debian.org/cgit/debian-tex/texlive-bin.git/tree/debian/patches/debian-builtin-searchpath
# https://anonscm.debian.org/cgit/debian-tex/texlive-bin.git/plain/debian/patches/debian-builtin-searchpath
# https://anonscm.debian.org/cgit/debian-tex/texlive-bin.git/tree/debian/patches/

luatex-0.95.0 on Debian: fmtutil problem

Hi list,

I am trying to compile and use luatex-0.95.0 on a Debian variant -
Trisquel - but I am getting errors at the "fmtutil" step... the error
messages are quite clear but I couldn't find anything on how to build
LuaTeX in a way that makes it look for ".ini" files where Debian puts
them:

  /usr/share/texlive/texmf-dist/tex/latex/latexconfig/dvilualatex.ini
  /usr/share/texlive/texmf-dist/tex/latex/latexconfig/lualatex.ini
  /usr/share/texlive/texmf-dist/tex/plain/config/dviluatex.ini
  /usr/share/texlive/texmf-dist/tex/plain/config/luatex.ini

The script I used is below. I edited it for readability, but after
editing it I tested it a handful of times by sending it line by line
to an Emacs shell buffer to make sure that the bug remains...




# Compile.
# Note that the things in ~/snarf/ are local copies of:
# https://foundry.supelec.fr/frs/download.php/latestfile/6/0.95.0.doc.tar.xz
# https://foundry.supelec.fr/frs/download.php/latestfile/6/0.95.0.tar.xz
#
rm -Rv ~/usrc/luatex/
mkdir  ~/usrc/luatex/
cd     ~/usrc/luatex/
tar -xJvf ~/snarf/https/foundry.supelec.fr/frs/download.php/latestfile/6/0.95.0.doc.tar.xz
tar -xJvf ~/snarf/https/foundry.supelec.fr/frs/download.php/latestfile/6/0.95.0.tar.xz
cd     ~/usrc/luatex/0.95.0/
./build.sh

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

# Put a texmf.cnf in a place that luatex can see
rm -v /home/edrx/usrc/luatex/0.95.0/build/texmf.cnf
cp -s /usr/share/texlive/texmf-dist/web2c/texmf.cnf \
      /home/edrx/usrc/luatex/0.95.0/build/

sudo mv -iv /usr/bin/luatex /usr/bin/luatex-orig
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 /usr/bin/luatex
fmtutil --byengine luatex
# fmtutil fails with the error message below:

fmtutil: running `luatex -ini   -jobname=dviluatex -progname=dviluatex dviluatex.ini' ...
(...)
fmtutil: /home/edrx/.texmf-var/web2c/luatex/dviluatex.fmt installed.
fmtutil: running `luatex -ini   -jobname=luatex -progname=luatex luatex.ini' ...
This is LuaTeX, Version 0.95.0 (TeX Live 2016)  (INITEX)
 restricted system commands enabled.
(/usr/share/texlive/texmf-dist/tex/plain/config/luatex.ini
(/usr/share/texlive/texmf-dist/tex/generic/config/luatexiniconfig.tex)
(/usr/share/texlive/texmf-dist/tex/generic/config/luatex-unicode-letters.tex
loading Unicode properties)
(/usr/share/texlive/texmf-dist/tex/plain/config/pdfetex.ini
(/usr/share/texlive/texmf-dist/tex/generic/config/pdftexconfig.tex
! Undefined control sequence.
l.3 \pdfoutput
            =1
? 
! Emergency stop.
l.3 \pdfoutput
            =1
!  ==> Fatal error occurred, bad output DVI file produced!
No pages of output.
Transcript written on luatex.log.



# ! Undefined control sequence.
# l.3 \pdfoutput
#             =1
#
# See:
# http://tex.stackexchange.com/questions/283056/luatex-0-85-pdf-primitive-changes-and-format-file-generation

# Revert to the Debian LuaTeX.
#
ls -lAF /usr/bin/luatex*
sudo rm -v  /usr/bin/luatex
sudo mv -iv /usr/bin/luatex-orig /usr/bin/luatex
fmtutil --byengine luatex


* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
locate texmf.cnf
laf \
  /etc/texmf/web2c/texmf.cnf \
  /usr/share/texmf/web2c/texmf.cnf \
  /usr/share/texlive/texmf-dist/web2c/texmf.cnf

# (find-fline "/etc/texmf/web2c/texmf.cnf")
# (find-fline "/usr/share/texlive/texmf-dist/web2c/texmf.cnf")





#####
#
# luatex-0.95.0 doesn't have pdfoutput
# 2017mar23
#
#####

# «luatex-0.95.0-pdfoutput» (to ".luatex-0.95.0-pdfoutput")
# http://tex.stackexchange.com/questions/283056/luatex-0-85-pdf-primitive-changes-and-format-file-generation
# (find-angg ".emacs" "luatex-0.95.0")

;; (find-luatex095file "")
;; (find-luatex095sh "find * | grep ini")
# (find-luatex095page (+ 4 30) "2.1.7 The backend primitives \\pdf *")
# (find-luatex095text (+ 4 30) "2.1.7 The backend primitives \\pdf *")

# (find-sh "locate luatex.ini")
# (find-sh "locate lualatex.ini")
# (find-sh "locate luatexiniconfig.tex")
# (find-fline "/usr/share/texlive/texmf-dist/tex/plain/config/luatex.ini")
# (find-fline "/usr/share/texlive/texmf-dist/tex/plain/config/dviluatex.ini")
# (find-fline "/usr/share/texlive/texmf-dist/tex/generic/config/luatexiniconfig.tex")
# (find-fline "/usr/share/texlive/texmf-dist/tex/latex/latexconfig/lualatex.ini")
# (find-fline "/usr/share/texlive/texmf-dist/tex/latex/latexconfig/dvilualatex.ini")
# (find-fline "/usr/share/texlive/texmf-dist/tex/latex/latexconfig/lualatexiniconfig.tex")



Hi Norbert,

this - a slight modification of your first suggestion - made
the luatex-0.95.0 binary in /usr/bin/ able to access texmf.cnf:

  cp -s /usr/share/texlive/texmf-dist/web2c/texmf.cnf \
        ~/usrc/luatex/0.95.0/build/

However, when I run

  fmtutil --byengine luatex

it says this, and aborts:

  fmtutil: running `luatex -ini   -jobname=dviluatex -progname=dviluatex dviluatex.ini' ...
  (...)
  fmtutil: /home/edrx/.texmf-var/web2c/luatex/dviluatex.fmt installed.
  fmtutil: running `luatex -ini   -jobname=luatex -progname=luatex luatex.ini' ...
  This is LuaTeX, Version 0.95.0 (TeX Live 2016)  (INITEX)
   restricted system commands enabled.
  (/usr/share/texlive/texmf-dist/tex/plain/config/luatex.ini
  (/usr/share/texlive/texmf-dist/tex/generic/config/luatexiniconfig.tex)
  (/usr/share/texlive/texmf-dist/tex/generic/config/luatex-unicode-letters.tex
  loading Unicode properties)
  (/usr/share/texlive/texmf-dist/tex/plain/config/pdfetex.ini
  (/usr/share/texlive/texmf-dist/tex/generic/config/pdftexconfig.tex
  ! Undefined control sequence.
  l.3 \pdfoutput
              =1
  ? 
  ! Emergency stop.
  l.3 \pdfoutput
              =1
  !  ==> Fatal error occurred, bad output DVI file produced!
  No pages of output.
  Transcript written on luatex.log.



It seems that I need to change luatex.ini, or one of the files it
"\input"s, to make it run something like the compatibility code in the
section "2.1.7 The backend primitives \pdf *" of the manual, because
recent luatexes have fewer "\pdf*" primitives that the luatex in
Debian...

Is there a standard way to do that? Where can I find the ".ini"s for
recent luatexes?

  Cheers & thanks,
    Eduardo Ochs
    eduardoochs@gmail.com
    http://angg.twu.net/
    http://angg.twu.net/LATEX/2017planar-has.pdf


# (find-fline "~/.texmf-var/web2c/luatex/")



#####
#
# luatex from Sid
# 2017mar23
#
#####

# «luatex-from-sid» (to ".luatex-from-sid")
# https://linuxaria.com/howto/how-to-install-a-single-package-from-debian-sid-or-debian-testing
# https://wiki.debian.org/DebianUnstable
# https://packages.debian.org/sid/texlive-binaries
# https://packages.debian.org/source/sid/texlive-bin
# https://packages.debian.org/source/sid/texlive-base
# http://http.debian.net/debian/pool/main/t/
# http://http.debian.net/debian/pool/main/t/texlive-bin/
# http://http.debian.net/debian/pool/main/t/texlive-bin/texlive-bin_2016.20160513.41080.dfsg-1.dsc

rm -Rv ~/usrc/texlive-bin/
mkdir  ~/usrc/texlive-bin/
cd $S/http/http.debian.net/debian/pool/main/t/texlive-bin/
cp -v texlive-bin_2016.20160513.41080.dfsg* ~/usrc/texlive-bin/
cd     ~/usrc/texlive-bin/
dpkg-source -sn -x texlive-bin_2016.20160513.41080.dfsg-1.dsc
cd     ~/usrc/texlive-bin/texlive-bin-2016.20160513.41080.dfsg/
dpkg-buildpackage -us -uc -b -rfakeroot     |& tee odb

(code-c-d "texlivebin" "~/usrc/texlive-bin/texlive-bin-2016.20160513.41080.dfsg/")
;; (find-texlivebinfile "")
;; (find-texlivebinsh "find * | grep ini")
# (find-sh "apt-file find luatex.ini")
# (find-vldifile "texlive-base.list")
# (find-vldifile "texlive-base.list" "/luatex.ini")

configure: error: did not find poppler 0.30 or better




#####
#
# LuaTeX from Sid: finding the .ini files
# 2017mar26
#
#####

# «luatex-from-sid-inis» (to ".luatex-from-sid-inis")
# https://packages.debian.org/source/sid/texlive-base
# http://http.debian.net/debian/pool/main/t/texlive-base/
# http://http.debian.net/debian/pool/main/t/texlive-base/texlive-base_2016.20170123-5.dsc
# http://http.debian.net/debian/pool/main/t/texlive-base/texlive-base_2016.20170123-5.debian.tar.xz
# http://http.debian.net/debian/pool/main/t/texlive-base/texlive-base_2016.20170123.orig.tar.xz 276M
# http://http.debian.net/debian/pool/main/t/texlive-base/texlive-base_2016.20170123-5_all.deb

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
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 -

# (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/")
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/tex-ini-files/")

* (setenv   "TLC" "/usr/share/texlive/texmf-dist/tex/plain/config")
* (code-c-d "TLC" "/usr/share/texlive/texmf-dist/tex/plain/config/")
* (setenv   "TLL" "/usr/share/texlive/texmf-dist/tex/latex/latexconfig")
* (code-c-d "TLL" "/usr/share/texlive/texmf-dist/tex/latex/latexconfig/")
* (setenv   "TLB" "~/usrc/texlive-base")
* (code-c-d "TLB" "~/usrc/texlive-base/")
* (setenv   "TLI" "~/usrc/texlive-base/usr/share/texlive/texmf-dist/tex/generic/tex-ini-files")
* (code-c-d "TLI" "~/usrc/texlive-base/usr/share/texlive/texmf-dist/tex/generic/tex-ini-files/")
# (find-TLBfile "")
# (find-TLCfile "")
# (find-TLLfile "")
# (find-TLIfile "")
# (find-TLBsh "find * | grep ini")
# (find-TLBsh "find * | grep load-unicode-data.tex")
# (find-TLBfile "usr/share/texlive/texmf-dist/tex/generic/unicode-data/" "load-unicode-data.tex")

tkdiff $TLC/luatex.ini   $TLI/luatex.ini
tkdiff $TLL/lualatex.ini $TLI/lualatex.ini

# (find-sh "locate lualatex.ini")
# (find-sh "locate kpathsea")

# https://anonscm.debian.org/cgit/debian-tex/texlive-bin.git/plain/debian/patches/debian-builtin-searchpath
# (find-fline "$S/https/anonscm.debian.org/cgit/debian-tex/texlive-bin.git/plain/debian/patches/debian-builtin-searchpath")
# (find-node "(kpathsea)Top")
# (find-node "(kpathsea)Supported file formats")

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

# (find-sh "locate load-unicode-data.tex")








# (find-status   "luatex")
# (find-vldifile "luatex.list")
# (find-udfile   "luatex/")

apt-cache showsrc luatex

# (find-fline "/var/cache/apt/apt-file/")
http://fr.archive.trisquel.info/trisquel/dists/belenos/


Hi Norbert,

I am using Trisquel, in its stable ("Belenos") version... the
/usr/bin/luatex that comes with it says that its version is:

  This is LuaTeX, Version beta-0.76.0-2013121407 (rev 4627)

it comes from a "luatex_0.76.0-3ubuntu1_amd64.deb" that came from this
place,

  http://fr.archive.trisquel.info/trisquel/pool/main/l/luatex/

the date of the .deb there is 2013dec14 - quite old.



I can try to download, compile and install texlive-bin from Sid

  https://packages.debian.org/source/sid/texlive-bin

if you think it's a good idea... that package is from 20160513.





I can try to download, compile and install "texlive-binaries",
"texlive-luatex" and friends from Sid from these or similar places,

  https://packages.debian.org/sid/texlive-luatex
  https://packages.debian.org/sid/texlive-binaries
  http://ftp.debian.org/debian/pool/main/t/texlive-bin/
  http://ftp.debian.org/debian/pool/main/t/texlive-bin/texlive-bin_2016.20160513.41080.dfsg-1.dsc
  http://ftp.debian.org/debian/pool/main/t/texlive-bin/texlive-binaries_2016.20160513.41080.dfsg-1_amd64.deb

if you think it's a good idea, 

  https://en.wikipedia.org/wiki/Trisquel#Release_history














#####
#
# fmtutil
# 2014may10
#
#####

# «fmtutil» (to ".fmtutil")
# http://tug.org/pipermail/luatex/2014-May/004834.html
# http://tug.org/pipermail/luatex/2016-September/006187.html
# http://tug.org/pipermail/luatex/2016-September/006190.html
# (find-fline "~/.texmf-var/web2c/")

# (find-sh "locate bin/luatex")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
R
mv -iv /usr/bin/luatex \
       /usr/bin/luatex-orig
cp -iv ~/bigsrc/luatex-beta-0.79.1/build/texk/web2c/luatex \
       /usr/bin/luatex
exit
fmtutil --byengine luatex |& tee /tmp/o791

# (find-fline "~/luatex/")
cd ~/luatex/
lualatex luamplibtest.tex |& tee /tmp/ol791


# (find-man "1 fmtutil")
# (find-man "1 fmtutil")

fmtutil --all |& tee /tmp/o
# (find-fline "/tmp/o")

R
mv -v /usr/bin/luatex-orig \
      /usr/bin/luatex
exit

https://www.tug.org/texlive/pretest.html

http://www.preining.info/blog/2014/04/tex-live-news-2013-frozen-2014-pretest-2014-debian/
https://www.preining.info/blog/2014/04/debian-tex-live-preliminary-packages-2014/




#####
#
# LUA_INIT
# 2014jul01
#
#####

# «LUA_INIT» (to ".LUA_INIT")
# (find-sfc "zhas.tex")
# (find-angg "LUA/lua50init.lua")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
= os.getenv("LUA_INIT")
= os.getenv("LUA_INIT"):sub(2)

dofile(os.getenv("LUA_INIT"):sub(2))




#####
#
# picture-mode
# 2015feb10
#
#####

# «picture-mode» (to ".picture-mode")
# (find-es "tex" "picture-mode")
# (find-es "tex" "ovals")
# (find-kopkadaly4page (+ 12 288) "13.1   The picture environment")
# (find-kopkadaly4text            "13.1   The picture environment")
# (find-kopkadaly4page (+ 12 296) "\\oval(x dimen,y dimen)[part]")
# (find-kopkadaly4text            "\\oval(x dimen,y dimen)[part]")
# (find-kopkadaly4page (+ 12 301) "13.1.6 Shifting a picture environment")
# (find-kopkadaly4text            "13.1.6 Shifting a picture environment")
# (find-angg ".emacs.papers" "kopkadaly")




#####
#
# DVI output
# 2015feb11
#
#####

# «dvi-output» (to ".dvi-output")
# (find-man "1 texlua")
# (find-man "1 texlua" "--output-format=FORMAT")



#####
#
# luapackageloader
# 2021apr21
#
#####

# «luapackageloader»  (to ".luapackageloader")
# (to "package.loaders")
# https://mail.google.com/mail/ca/u/0/#search/luapackageloader/FMfcgxwLtGjJmCBFpbQPVcMwJjTcQkdF
# https://mail.google.com/mail/ca/u/0/#search/luapackageloader
# (find-fline "/usr/local/texlive/2019/texmf-dist/tex/luatex/luapackageloader/luapackageloader.lua")
# (find-fline "/usr/local/texlive/2020/texmf-dist/tex/luatex/luapackageloader/luapackageloader.lua")
# (find-fline "/usr/local/texlive/2020/texmf-dist/tex/luatex/luapackageloader/")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
tkdiff \
  /usr/local/texlive/2019/texmf-dist/tex/luatex/luapackageloader/luapackageloader.lua \
  /usr/local/texlive/2020/texmf-dist/tex/luatex/luapackageloader/luapackageloader.lua




#####
#
# package.loaders
# 2015feb11
#
#####

# «package.loaders» (to ".package.loaders")
# (find-angg ".emacs" "luatex")
# (find-luatexrefpage (+ 4  26) "3.2 LUA changes" "3.2 LUA changes")
# (find-luatexreftext (+ 4  26) "3.2 LUA changes" "3.2 LUA changes")
# (find-lua51manualw3m "#pdf-package.loaders")

# (find-google-links "luatex package.loaders")
# http://www.google.com.br/search?tbm=isch&q=luatex+package.loaders
# http://ctan.math.washington.edu/tex-archive/macros/luatex/generic/luatexbase/luatexbase-loader.pdf
# https://tug.org/pipermail/luatex/2010-March/001414.html
# https://tug.org/pipermail/luatex/2010-March/001430.html package.loaders[4] is left unaffected
# http://ctan.mackichan.com/macros/luatex/generic/luatexbase/luatexbase-loader.dtx

# (find-sh "locate luatexbase")
# (find-zsh "dmisiing luatexbase")
# (find-fline "/usr/share/doc/texlive-luatex/luatex/luatexbase/")
(code-pdf-page "luatexbaseloader" "/usr/share/doc/texlive-luatex/luatex/luatexbase/luatexbase-loader.pdf")
(code-pdf-text "luatexbaseloader" "/usr/share/doc/texlive-luatex/luatex/luatexbase/luatexbase-loader.pdf")
(code-pdf-page "luatexbasemodutils" "/usr/share/doc/texlive-luatex/luatex/luatexbase/luatexbase-modutils.pdf")
(code-pdf-text "luatexbasemodutils" "/usr/share/doc/texlive-luatex/luatex/luatexbase/luatexbase-modutils.pdf")
# (find-luatexbaseloaderpage)
# (find-luatexbaseloadertext)
# (find-luatexbasemodutilspage)
# (find-luatexbasemodutilstext)

# http://ctan.mackichan.com/macros/luatex/generic/luatexbase/luatexbase-loader.dtx

# http://tug.org/pipermail/luatex/2015-February/005071.html how do I get lua5.1's behavior...?

# (find-books "__comp/__comp.el" "ierusalimschy")
# (find-pil2page (+ 19 138) "15.1     The require Function")
# (find-pil2text (+ 19 138) "15.1     The require Function")
# http://www.lua.org/manual/5.1/manual.html#pdf-package.loaders
# (find-lua51manualw3m "#pdf-package.loaders")
#
# (find-fline "~/LOGS/2015feb16.lua")
# http://lua-users.org/wiki/LuaModulesLoader
# http://lua-users.org/wiki/BinaryModulesLoader
# https://git.octaforge.org/tools/octascript.git/tree/octascript/std/init.lua#n441





#####
#
# make "require" in lualatex respect package.path
# 2015feb16
#
#####

# «require» (to ".require")
# http://tug.org/pipermail/luatex/2015-February/005071.html (problem)
# http://tug.org/pipermail/luatex/2015-February/005073.html (solution)

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# Download luarepl-0.5 and untar it into /tmp/lua-repl-0.5/
cd /tmp/
wget https://github.com/hoelzro/lua-repl/archive/0.5.tar.gz
tar -C /tmp/ -xvzf /tmp/0.5.tar.gz

# Create /tmp/lualoader.lua
cat    > /tmp/lualoader.lua <<'%%%'
-- From http://lua-users.org/wiki/LuaModulesLoader
local function lualoader(modulename)
  local errmsg = ""
  -- Find source
  local modulepath = string.gsub(modulename, "%.", "/")
  for path in string.gmatch(package.path, "([^;]+)") do
    local filename = string.gsub(path, "%?", modulepath)
    local file = io.open(filename, "rb")
    if file then
      -- Compile and return the module
      return assert(loadstring(assert(file:read("*a")), filename))
    end
    errmsg = errmsg.."\n\tno file '"..filename.."' (checked with custom loader)"
  end
  return errmsg
end
--
-- See http://www.lua.org/manual/5.1/manual.html#pdf-package.loaders
table.insert(package.loaders, 2, lualoader)
--
-- See also: http://lua-users.org/wiki/BinaryModulesLoader
%%%

# Create /tmp/myrepl.lua
cat    > /tmp/myrepl.lua <<'%%%'
repldir      = "/tmp/lua-repl-0.5/"
package.path = ""
package.path = repldir.."?/init.lua;"..package.path
package.path = repldir.."?.lua;"     ..package.path
repl         = require "repl"
sync         = require "repl.sync"
function sync:showprompt(p) io.write(p == ">" and ">>> " or ">>>> ") end
function sync:lines() return io.stdin:lines() end
function sync:displayerror(err) print(err) end
function sync:displayresults(results)
    if results.n == 0 then return end
    print(unpack(results, 1, results.n))
  end
print()
sync:run()
%%%

# Create /tmp/myrepl.tex
cat    > /tmp/myrepl.tex <<'%%%'
\documentclass{book}
\begin{document}
\directlua{dofile "lualoader.lua"}
\directlua{dofile "myrepl.lua"}
\end{document}
%%%

# Run LuaRepl from LuaLaTeX - the prompt will be ">>> "
cd /tmp/
lualatex myrepl.tex





#####
#
# lualatex-repl
# 2015feb17
#
#####

# «lualatex-repl» (to ".lualatex-repl")
# (find-angg ".emacs" "lualatex-repl")

# Brainstorm with Rob Hoelz in 2015feb17:
# (find-fline "~/LOGS/2015feb17.hoelzro")




#####
#
# nodes
# 2015feb22
#
#####

# «nodes» (to ".nodes")
# http://www.readytext.co.uk/?p=1449 Lua code to process a LuaTeX node list
# https://gist.github.com/pgundlach/556247
# (find-luatexrefpage (+ 4  90) "The node library")
# (find-luatexreftext (+ 4  90) "The node library")
# http://tug.org/pipermail/luatex/2011-July/thread.html
# http://tug.org/pipermail/luatex/2011-July/003115.html
# http://tug.org/pipermail/luatex/2011-July/003116.html
# http://wiki.luatex.org/index.php/TeX_without_TeX




#####
#
# TeX without TeX
# 2015feb22
#
#####

# «tex-without-tex» (to ".tex-without-tex")
# http://wiki.luatex.org/index.php/TeX_without_TeX
# (find-fline "$S/http/wiki.luatex.org/index.php/TeX_without_TeX.src")
# https://news.ycombinator.com/item?id=29713270 LuaTeX Comes of Age (2017) (lwn.net) ***

# (find-LATEX "twot-myprogram.lua")
# https://raw.github.com/gist/1062041/d3de082e955f6535f3820742cef76fe9e50d5a6f/myprogram.lua
# https://gist.github.com/pgundlach/1063228

* (eepitch-ltrepl)
* (eepitch-kill)
* (eepitch-ltrepl)
dofile "twot-boxes.lua" -- (find-LATEX "twot-boxes.lua")
tex.box[0] = vbox
tex.print("\\box0")


* (eepitch-ltrepl)
* (eepitch-kill)
* (eepitch-ltrepl)
newrule = function (depth, height, width)
    local r  = node.new("rule")
    r.depth  = depth
    r.height = height
    r.width  = width
    return r
  end
--
pt = 65536
r1 = newrule(2*pt, 4*pt, 2*pt)
r2 = newrule(3*pt, 6*pt, 3*pt)
r1.next = r2
r2.prev = r1
--
hbox = node.hpack(r1)
tex.box[0] = hbox
tex.print("\\box0")



* (eepitch-ltrepl)
* (eepitch-kill)
* (eepitch-ltrepl)
dofile "twot-pages.lua" -- (find-LATEX "twot-pages.lua")


* (eepitch-ltrepl)
* (eepitch-kill)
* (eepitch-ltrepl)
dofile "twot-paragraph.lua" -- (find-LATEX "twot-paragraph.lua")
node.write(vbox)





#####
#
# Traversing a paragraph (using an example from TeX_without_TeX)
# 2015feb24
#
#####

# «traversing-a-paragraph» (to ".traversing-a-paragraph")
# http://wiki.luatex.org/index.php/TeX_without_TeX
# http://wiki.luatex.org/images/Nodes_in_sample_paragraph.png
# (find-LATEX "twot.tex")
# (find-pdf-page "~/LATEX/twot.pdf")

* (eepitch-ltrepl)
* (eepitch-kill)
* (eepitch-ltrepl)
dofile "twot-paragraph.lua" -- (find-LATEX "twot-paragraph.lua")

= vbox -- glue
= vbox.next -- hlist
= vbox.next.head                               -- glue
= vbox.next.head.next                          -- glyph
= vbox.next.head.next.char                     --  65="A"
= vbox.next.head.next.next                     -- glue
= vbox.next.head.next.next.next                -- glyph
= vbox.next.head.next.next.next.char           --  119="w"
= vbox.next.head.next.next.next.next           -- kern
= vbox.next.head.next.next.next.next.next      -- glyph
= vbox.next.head.next.next.next.next.next.char --  111="o"

= vbox.next.next -- penalty
= vbox.next.next.next -- glue
= vbox.next.next.next.next -- hlist
= vbox.next.next.next.next.head                -- glyph
= vbox.next.next.next.next.head.char           -- 109="m"
= vbox.next.next.next.next.head.next           -- kern
= vbox.next.next.next.next.head.next.next      -- glyph
= vbox.next.next.next.next.head.next.next.char -- 121="y"

= vbox.next.next.next.next.next -- nil

node.write(vbox)




** Old stuff:
* (eepitch-ltrepl)
* (eepitch-kill)
* (eepitch-ltrepl)
dofile "twot-paragraph.lua" -- (find-LATEX "twot-paragraph.lua")

= vbox
= type(vbox)
== getmetatable(vbox)
-- (find-luatexrefpage (+ 4  90) "The node library")
-- (find-luatexreftext (+ 4  90) "The node library")

= vbox.id
= vbox.subtype
== node.types()
=  node.types()[vbox.id]
-- (find-luatexrefpage (+ 4 163) "node.types()")
-- (find-luatexreftext (+ 4 163) "node.types()")
-- (find-luatexrefpage (+ 4 163) "8.1.1.1 glue_spec items")
-- (find-luatexreftext (+ 4 163) "8.1.1.1 glue_spec items")
-- (find-luatexrefpage (+ 4 165) "8.1.2.1 hlist nodes")
-- (find-luatexreftext (+ 4 165) "8.1.2.1 hlist nodes")
-- (find-luatexrefpage (+ 4 168) "8.1.2.8 math nodes")
-- (find-luatexreftext (+ 4 168) "8.1.2.8 math nodes")
-- (find-luatexrefpage (+ 4 168) "8.1.2.9 glue nodes")
-- (find-luatexreftext (+ 4 168) "8.1.2.9 glue nodes")
-- (find-luatexrefpage (+ 4 169) "8.1.2.12 glyph nodes")
-- (find-luatexreftext (+ 4 169) "8.1.2.12 glyph nodes")
-- (find-luatexrefpage (+ 4 143) "6.1 Characters and glyphs")
-- (find-luatexreftext (+ 4 143) "6.1 Characters and glyphs")

= vbox      -- glue
= vbox.spec -- glue_spec





#####
#
# getting glyph data
# 2015feb26
#
#####

# «getting-glyph-data» (to ".getting-glyph-data")
* (eepitch-ltrepl2)
* (eepitch-kill)
* (eepitch-ltrepl2)
!\setbox0=\hbox{abc}
!\setbox0=\hbox{a$\{\},$}

= tex.box[0] -- hlist
= tex.box[0].head -- glyph
= tex.box[0].head.next -- math
= tex.box[0].head.next.next -- glyph
= tex.box[0].head.next.next.next -- glyph
= tex.box[0].head.next.next.next.next -- glyph
= tex.box[0].head.next.next.next.next.next -- math
= tex.box[0].head.next.next.next.next.next.next -- nil

= tex.box[0].head.next.next                -- glyph
= tex.box[0].head.next.next.char           --  102
= tex.box[0].head.next.next.next           -- glyph
= tex.box[0].head.next.next.next.char      --  103
= tex.box[0].head.next.next.next.next      -- glyph
= tex.box[0].head.next.next.next.next.char --  59


# (find-angg ".emacs.papers" "texbook")
# (find-texbookpage (+ 11 427) "Font tables")
# (find-texbookpage (+ 12 430) "cmmi10")




#####
#
# tex.jobname and status.filename
# 2019feb19
#
#####

# «tex.jobname» (to ".tex.jobname")
# «status.filename» (to ".status.filename")
# (find-texbookpage (+ 12 213) "\\jobname")
# (find-texbooktext (+ 12 213) "\\jobname")
# (find-angg ".emacs.papers" "luatexref")
# (find-LATEXfile "dednat6load.lua" "tex.jobname")
# (find-LATEXfile "dednat6load.lua" "status.filename")
# (find-luatexrefpage (+ 4 158) "9.2 The status library")
# (find-luatexreftext (+ 4 158) "9.2 The status library")
# (find-luatexrefpage (+ 4 158) "9.2 The status library" "filename")
# (find-luatexreftext (+ 4 158) "9.2 The status library" "filename")
# (find-luatexrefpage (+ 4 164) "tex.jobname")
# (find-luatexreftext (+ 4 164) "tex.jobname")




#####
#
# using tex.inputlineno to obtain the current line
# 2015feb22
#
#####

# «tex.inputlineno» (to ".tex.inputlineno")
# «tex.inputlineno-repl» (to ".tex.inputlineno-repl")
# (find-luatexrefpage (+ 4 164) "tex.inputlineno")
# (find-luatexreftext (+ 4 164) "tex.inputlineno")

* (eepitch-ltrepl)
* (eepitch-kill)
* (eepitch-ltrepl)
= tex.inputlineno
= tex.jobname

bigstr = readfile(tex.jobname..".tex")
lines = splitlines(bigstr)
= tex.inputlineno
= lines[tex.inputlineno]



# «tex.inputlineno-tex» (to ".tex.inputlineno-tex")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd /tmp/

cat > test1.tex <<'%%%'
\documentclass{book}
\begin{document}
\directlua{print()}
\directlua{print(4, tex.inputlineno)}  % print(4, 4)
\directlua{print(5, tex.inputlineno)}  % print(5, 5)
\directlua{tex.inputlineno = tex.inputlineno + 4}
7
8
9
10
11
12
13
14
\directlua{print(15, tex.inputlineno)}  % print(15, 10) <-- why???
\end{document}
%%%

lualatex test1.tex


* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd /tmp/

cat > test.lua <<'%%%'
readfile = function (fname)
    local f = assert(io.open(fname, "r"))
    local bigstr = f:read("*a")
    f:close()
    return bigstr
  end
split = function (str, wordpat)
    local arr = {}
    for word in str:gmatch(wordpat or "([^%s]+)") do
      table.insert(arr, word)
    end
    return arr
  end
splitlines = function (bigstr)
    local arr = split(bigstr, "([^\n]*)\n?")
    table.remove(arr)
    return arr
  end

bigstr = readfile(tex.jobname..".tex")
lines  = splitlines(bigstr)
pl     = function () print(tex.inputlineno, lines[tex.inputlineno]) end
%%%

cat > test1.tex <<'%%%'
\documentclass{book}
\begin{document}
\directlua{dofile "test.lua"}
\directlua{print()}
\directlua{pl()} % a
\directlua{pl()} % bb
\directlua{pl()} % ccc
\end{document}
%%%

lualatex test1.tex





#####
#
# skipping lines
# 2015mar04
#
#####

# «skipping-lines» (to ".skipping-lines")
# (find-texbookpage (+ 12 37) "7: How TEX Reads What You Type")
# (find-texbooktext (+ 12 37) "7: How TEX Reads What You Type")
# http://www.readytext.co.uk/?p=1449 Lua code to process a LuaTeX node list
# http://www.readytext.co.uk/?cat=15 LuaTeX Examples
# http://tex.stackexchange.com/questions/70/what-is-a-simple-example-of-something-you-can-do-with-luatex
# http://wiki.contextgarden.net/Programming_in_LuaTeX
# http://wiki.contextgarden.net/Programming_in_LuaTeX#Parsing_input_without_exploding_your_head




#####
#
# process_input_buffer
# 2021aug29
#
#####

# «process_input_buffer»  (to ".process_input_buffer")
# https://www.pragma-ade.com/general/manuals/luatex.pdf#page=176
# https://tug.org/pipermail/luatex/2014-February/004761.html
# https://tug.org/pipermail/luatex/2021-August/007588.html vitek
# (find-angg ".emacs.papers" "luatexref")
# (find-ltluatexpage)
# (find-ltluatextext)
# (find-anggfile "markdown-dednat6/test.tex" "process_input_buffer")




#####
#
# skipnlines
# 2021aug29
#
#####

# «skipnlines»  (to ".skipnlines")

%L skipnlines_ = 0
%L skipnlines  = function (li)
%L     if skipnlines_ > 0 then
%L        skipnlines_ =  skipnlines_ - 1
%L        return ""
%L     end
%L     return li
%L   end
%L 
%L luatexbase.add_to_callback("process_input_buffer", skipnlines, "skipnlines")
\pu

\directlua{skipnlines_ = 4}
A
B
C
D
E
F
G
H




#####
#
# The token library
# 2015mar05
#
#####

# «token-library» (to ".token-library")
# (find-luatexrefpage (+ 4 37) "4.1.3.3 token_filter")
# (find-luatexreftext (+ 4 37) "4.1.3.3 token_filter")
# (find-luatexrefpage (+ 4 126) "4.16 The token library")
# (find-luatexreftext (+ 4 126) "4.16 The token library")
# (find-texbookpage (+ 12 37)  "5      End of line")
# (find-texbooktext (+ 12 37)  "5      End of line")
# (find-texbookpage (+ 12 37) "10      Space")
# (find-texbooktext (+ 12 37) "10      Space")
# (find-texbookpage (+ 12 37) "11      Letter")
# (find-texbooktext (+ 12 37) "11      Letter")
# (find-texbookpage (+ 12 37) "12      Other character")
# (find-texbooktext (+ 12 37) "12      Other character")
# (find-texbookpage (+ 12 37) "13      Active character")
# (find-texbooktext (+ 12 37) "13      Active character")
# (find-texbookpage (+ 12 343) "\\chardef\\active=13")
# (find-texbooktext (+ 12 343) "\\chardef\\active=13")
# (find-texbookpage (+ 12 352) "\\gdef\\obeylines{\\catcode`\\^^M=\\active")
# (find-texbooktext (+ 12 352) "\\gdef\\obeylines{\\catcode`\\^^M=\\active")
# (find-texbookpage (+ 12 39))
# (find-texbookpage (+ 12 271) "codename")
# (find-texbooktext (+ 12 271) "codename")
# (find-texbookpage (+ 12 461) "*\\catcode")
# (find-texbooktext (+ 12 461) "*\\catcode")
# (find-luatexrefpage (+ 4 111) "tex.catcode")
# (find-luatexreftext (+ 4 111) "tex.catcode")

# (find-LATEXfile "diagxy.tex" "\\catcode`\\@=12")
# (find-LATEXfile "diagxy.tex" "\\catcode`\\@=11")
# (find-fline "/usr/share/texlive/texmf-dist/tex/plain/base/plain.tex")

\gdef\obeylines{\catcode`\^^M=\active}
\def\makecreol  {\catcode`\^^M=5}
\def\makecrother{\catcode`\^^M=12}

# http://www.ntg.nl/pipermail/dev-luatex/2007-March/000454.html
# http://tug.org/pipermail/luatex/2014-February/004761.html Using the token_filter callback only for 'some tokens'
# http://tex.stackexchange.com/questions/135319/tracing-group-level-and-position-in-luatex
# http://tug.org/pipermail/luatex/2012-April/003588.html Use cases for the token library
# http://tex.stackexchange.com/questions/45293/can-the-lua-part-of-luatex-know-about-tokens
# http://www.gust.org.pl/bachotex/2014-pl/presentations/luatextalk.pdf
# https://www.gutenberg.eu.org/IMG/pdf/luatextl.pdf



# «makecrspecial-1» (to ".makecrspecial-1")
# (find-LATEX "tmp.tex")

\directlua{
foo = function (c, newcatcode, n)
    print()
    oldcatcode = tex.catcode[c]
    tex.catcode[c] = newcatcode
    print("tex.catcode["..c.."] "..oldcatcode.." -> "..newcatcode)
    for i=1,n do PP(i, token.get_next()) end
    tex.catcode[c] = oldcatcode
  end
}

\directlua{foo(13, 5, 4)}ab
cd

\directlua{foo(13, 12, 6)}ab

cd




#####
#
# Making CR of catcode "other"
# 2015mar06
#
#####

# «makecrother» (to ".makecrother")
# https://mail.google.com/mail/ca/u/0/#search/luatex/14bf1b4a6c4c34ea
# http://tug.org/pipermail/luatex/2015-March/005079.html edrx
# http://tug.org/pipermail/luatex/2015-March/005080.html elie

# creating a "verbatim"-like catcode table from Lua

Hi list,

this code uses token.getnext() to "eat" the CR immediately after the
\directlua{...} and the lines that say "one", "two two", and "three
three three" before returning control to LaTeX's parser:

  cd /tmp/
  cat > test.tex <<'%%%'
  \documentclass{book}
  \begin{document}
  \directlua{
  makecrendofline = function () tex.catcode[13] = 5  end
  makecrother     = function () tex.catcode[13] = 12 end
  nextchar = function () return token.get_next()[2] end
  eatline  = function () repeat until nextchar() == 13 end
  makecrother()
  for i=1,4 do eatline() end
  makecrendofline()
  }
  one
  two two
  three three three
  four four four four
  five five five five five
  \end{document}
  %%%
  lualatex test.tex
  xpdf test.pdf

We can use that idea, combined with something like this,

  texfile = readfile(tex.jobname..".tex")
  lines   = splitlines(texfile)
  for i=0,10 do dosomethingwith(lines[tex.inputlineno + 1]) end

to make Lua interpret the lines after a certain point, and then make
TeX's parser skip them.

The catcode trick that I used above is quite fragile, though - it will
not notice CRs in comments, for example. It would be better to use a
pre-prepared catcode table like the one that "verbatim" uses, instead
of just changing the catcodes of CR, %, and a few other chars.

How do I construct a "verbatim"-ish catcode table? How do I save it
and activate it? Is there a way to do that from pure Lua? How do I
check, for a given number n, if the catcode table "n" exists? I saw in
the reference manual that there are primitives \initcatcodetable and
\savecatcodetable... so there is a way to do that mixing TeX and Lua.

  Thanks in advance! Pointers appreciated!...
  Cheers,
    Eduardo Ochs
    eduardoochs@gmail.com
    http://angg.twu.net/



# «luatexbase-cctb» (to ".luatexbase-cctb")
# http://tug.org/pipermail/luatex/2015-March/005079.html edrx
# http://tug.org/pipermail/luatex/2015-March/005080.html elie
# https://github.com/lualatex/luatexbase/blob/master/luatexbase-cctb.dtx#L510
# (find-sh "locate luatexbase")
# (find-sh "locate luatexbase-cctb")
# (find-fline "/usr/share/texlive/texmf-dist/tex/luatex/luatexbase/luatexbase-cctb.sty")
# (find-udfile "texlive-luatex/luatex/luatexbase/")
# (find-fline "/usr/share/doc/texlive-luatex/luatex/luatexbase/")
# (code-pdf-page "luatexbasecctb" "/usr/share/doc/texlive-luatex/luatex/luatexbase/luatexbase-cctb.pdf")
# (code-pdf-text "luatexbasecctb" "/usr/share/doc/texlive-luatex/luatex/luatexbase/luatexbase-cctb.pdf")
# (find-luatexbasecctbpage)
# (find-luatexbasecctbtext)
# (find-luatexbasecctbpage 6 "2.2      Lua module")
# (find-luatexbasecctbtext 6 "2.2      Lua module")

* (eepitch-lltr)
* (eepitch-kill)
* (eepitch-lltr)
PP(catcodetables)




#####
#
# TeX macros from Lua
# 2015feb22
#
#####

# «macros» (to ".macros")
# http://tug.org/pipermail/luatex/2011-June/002894.html macros




#####
#
# catcodes for utf-8 chars above 256
# 2015mar24
#
#####

# «high-catcodes» (to ".high-catcodes")
# (find-LATEX "tmp.tex")
# (find-efunctiondescr 'find-einsert)
# (find-einsert '((8592 9167)))
# (find-einsert '((8704 8747)))
# (find-LATEX "edrx.sty" "glyphs")
# (find-LATEX "edrx15chars.tex")



#####
#
# inspecting catcodes from Lua
# 2016oct07
#
#####

# «catcodes» (to ".catcodes")
# (find-LATEX "2016-2-GA-algebra.tex" "repl")
# (find-angg ".emacs" "luatex")
# (find-luatexrefpage (+ 4 113) "4.14.1.1 Integer parameters")
# (find-luatexreftext (+ 4 113) "4.14.1.1 Integer parameters")
# (find-luatexrefpage (+ 4 114)   "tex.catcodetable")
# (find-luatexreftext (+ 4 114)   "tex.catcodetable")
# (find-LATEX "edrxchars.tex" "\\Delta")
# (find-texbookpage (+ 12 37) "13      Active character")
# (find-texbooktext (+ 12 37) "13      Active character")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
#  cd ~/dednat6/ && lualatex demo-repl.tex
cd ~/LATEX/; REPL=1 lualatex -record 2016-2-GA-algebra.tex
PP(tex.catcodetable)
PP(tex.getcatcode(32))
PP(tex.getcatcode(33))
PP(tex.getcatcode(65))
PP(tex.getcatcode(66))
PP(tex.getcatcode(914))  -- uppercase alpha: 11 (letter)
PP(tex.getcatcode(916))  -- uppercase delta: 13 (active)
PP(tex.getcatcode(257))
for i=0,2000 do if tex.getcatcode(i)==13 then printf(" %d", i) end end; print()




#####
#
# inspecting defs from Lua
# 2016oct07 / 2022oct22
#
#####

# «inspecting-defs» (to ".inspecting-defs")
# (find-LATEX "2022tikz-repl.tex" "tests")
# (find-angg "LUA/LuaTex1.lua")tik

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd ~/LATEX/
lualatex 2022tikz-repl.tex      # (find-LATEX "2022tikz-repl.tex" "tests")
ee_dofile "~/LUA/LuaTex1.lua"   -- (find-angg "LUA/LuaTex1.lua")
tk = Token.create "repl"
= tk
= tk:expand()      -- semi-broken
= tk:get_macro()
= tk:get_meaning()
= token.expand("repl")
= token.expand("\\repl")
= token.expand(tk.__)




#####
#
# token.get_meaning, token.get_macro, and token.expand
# 2022oct22
#
#####

# «token.expand»       (to ".token.expand")
# «token.get_macro»    (to ".token.get_macro")
# «token.get_meaning»  (to ".token.get_meaning")
# (find-angg "LUA/Repl2.lua" "getmeaning")
# https://tug.org/pipermail/luatex/2022-October/007752.html edrx: token.expand?
# https://tug.org/pipermail/luatex/2022-October/007753.html hhagen: answer
# https://mail.google.com/mail/u/0/#sent/QgrcJHrhxBMPfPNbWhLGLWXQksNpKpTMgng

Hi list,

how do I use the function token.expand, that is (very) briefly
mentioned here?

  http://mirrors.ibiblio.org/CTAN/systems/doc/luatex/luatex.pdf#page=224

I've put this in a .tex file

  \def\foo{FOO}
  \def\bletch#1{BL#1ETCH}

and entered a Lua REPL. All the "print"s below give meaningful
results,

  print(token.get_macro("foo"))
  print(token.get_macro("bletch"))
  print(token.get_meaning("foo"))
  print(token.get_meaning("bletch"))
  print(token.create("bletch"))
  print(token.create("bletch").expandable)

and the last one says "true"... but I've tried to call token.expand
with several kinds of arguments, and in all cases I got this error,

  ! Undefined control sequence.
  \repl ->\directlua { print(); run_repl2_now() }

where \repl is the tex macro that I use to run my Lua REPL...

Help please, and thanks in advance... =/
  Eduardo Ochs
  http://angg.twu.net/dednat6.html










= token.get_macro("repl")
= token.get_meaning("repl")

http://mirrors.ibiblio.org/CTAN/systems/doc/luatex/luatex.pdf#page=224


= tex.get_macro


= get_macro("repl")
= get_meaning("repl")
= get_meaning("repl")

# (find-tlsh "find * | sort | grep lua")
# (find-tlsh "find * | sort | grep '\\.lua$' | tee /tmp/o")
# (find-tlsh "grep get_macro $(cat /tmp/o)")


# (find-LATEX "2016-2-GA-algebra.tex" "repl")
# (find-luatexrefpage (+ 4 213) "10.6.3 Creating tokens")
# (find-luatexreftext (+ 4 213) "10.6.3 Creating tokens")
# (find-luatexrefpage (+ 4 213)   "token.create")
# (find-luatexreftext (+ 4 213)   "token.create")
# (find-luatexrefpage (+ 4 214)   "get_macro")
# (find-luatexreftext (+ 4 214)   "get_macro")
# (find-luatexrefpage (+ 4 214)   "get_meaning")
# (find-luatexreftext (+ 4 214)   "get_meaning")
# (find-luatexrefpage (+ 4 215)   "token.expand")
# (find-luatexreftext (+ 4 215)   "token.expand")

# (find-luatexrefpage (+ 4 135) "4.17.5 token.create")
# (find-luatexreftext (+ 4 135) "4.17.5 token.create")
# (find-luatexrefpage (+ 4 135) "4.17.2 token.is_expandable")
# (find-luatexreftext (+ 4 135) "4.17.2 token.is_expandable")
# (find-LATEX "edrx15.sty")





#####
#
# Spurious uppercase omega
# 2015apr24
#
#####

# «spurious-omega» (to ".spurious-omega")
# http://tug.org/pipermail/luatex/2010-December/002397.html solution
# http://www.ntg.nl/pipermail/ntg-context/2010/050090.html problem
# http://www.ntg.nl/pipermail/ntg-context/2010/050092.html

\catcode`\^^J=10  % (find-es "luatex" "spurious-omega")
% \catcode 10=10

# (find-angg ".emacs.papers" "texbook")
# (find-texbookpage (+ 12 37) "16 categories")
# (find-texbooktext (+ 12 37) "16 categories")
# (find-texbookpage (+ 12 37) "5      End of line")
# (find-texbooktext (+ 12 37) "5      End of line")
# (find-texbookpage (+ 12 37) "10      Space")
# (find-texbooktext (+ 12 37) "10      Space")
# (find-texbookpage (+ 12 343) "\\catcode`\\{=1")
# (find-texbooktext (+ 12 343) "\\catcode`\\{=1")




#####
#
# Comments in tex.print
# 2015may31
#
#####

# «comments-in-tex.print» (to ".comments-in-tex.print")
# (find-dn6 "output.lua" "deletecomments")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd /tmp/

cat > testcomments.lua <<'%%%'
 deletecomments = function (str)
     return (str:gsub("%%[^%%\n]*\n[ \t]*", ""))
   end
 mytexprint = function (str)
     tex.print(deletecomments(str))
   end
 mytexprint2 = function (str)
     tex.print(str:gsub("\n", "\r"))
   end
 testA = [[
 \def\testA{AA AAA}
 ]]
 testB = [[
 \def\testB{BB
   BBB}
 ]]
 testC = [[
 \def\testC{CC %
   CCC}
 ]]
%%%

cat > testcomments.tex <<'%%%'
\documentclass{book}
\begin{document}
\directlua{dofile "testcomments.lua"}
                 \directlua{tex.print(testA)}  \testA  % 1
                 \directlua{tex.print(testB)}  \testB  % 2
\catcode`\^^J=10 \directlua{tex.print(testB)}  \testB  % 3
\catcode`\^^J=5 \directlua{mytexprint(testC)} \testC  % 4
                 \directlua{mytexprint2(testC)} \testC  % 5
\end{document}
%%%

lualatex testcomments.tex

# (find-pdf-page "/tmp/testcomments.pdf")




#####
#
# lua5.2
# 2015jun25
#
#####

# «lua-5.2» (to ".lua-5.2")
# «lua-version» (to ".lua-version")
# http://tug.org/pipermail/luatex/2013-January/004008.html create a cloned texlive
# http://tug.org/pipermail/luatex/2013-January/003991.html
# package.loaders does not exist any more in lua52.

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd /tmp/
cat > a.tex <<'%%%'
% (find-sh "cd /tmp/ && luatex a.tex")
\directlua{print(_VERSION)}
\bye
%%%
luatex a.tex

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd /tmp/
echo '\directlua{print(_VERSION)}\bye' > v.tex
luatex v.tex



#####
#
# ufy
# 2017jan28
#
#####

# «ufy» (to ".ufy")
# https://github.com/deepakjois/ufy
# https://github.com/jgm/cmark-lua




#####
#
# texlive-2016
# 2017mai07
#
#####

# «texlive-2016» (to ".texlive-2016")
# https://www.tug.org/texlive/
# https://www.tug.org/texlive/acquire-netinstall.html
# https://www.tug.org/texlive/quickinstall.html
# http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
# https://www.preining.info/blog/2017/06/tex-live-2017-released/

# (find-fline "/usr/local/texlive/2016")
# (find-fline "~/.texlive2016")
# (find-fline "~/.texlive2017")

rm -rf /usr/local/texlive/2016
rm -rf ~/.texlive2017

# (code-c-d "texlive2016i" "~/usrc/install-tl-20170413/")
# (find-texlive2016ifile "")
# (find-texlive2016ish "find * | sort")

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

# (find-fline "~/usrc/install-tl-20170413/")
rm -Rv ~/usrc/install-tl-20170413/
mkdir  ~/usrc/install-tl-20170413/
tar -C ~/usrc/ -xvzf $S/http/mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
cd     ~/usrc/install-tl-20170413/


rm -rf /usr/local/texlive/
mkdire /usr/local/texlive

rm -rf /usr/local/texlive/2016
rm -rf ~/.texlive2016

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# https://www.tug.org/texlive/quickinstall.html
# (find-texlive2016ifile "")
# (find-texlive2016ifile "install-tl")
# (find-texlive2016ifile "install-tl" "=item B<-portable>")

cd ~/usrc/install-tl-20170413/
./install-tl -gui text     |& tee oi
C
-
a
L
R
I


# (find-fline "/usr/local/texlive/2016/install-tl.log")

# (find-fline "/usr/local/texlive/")
# (find-fline "/usr/local/texlive/2016/texmf-dist/tex/generic/tex-ini-files/")
# (find-fline "/usr/local/texlive/2016/bin/x86_64-linux/")
# (find-sh "cd /usr/local/texlive/ && find | sort")
# (find-sh "cd /usr/local/texlive/ && find | sort | grep ini")




#####
#
# texlive-2017
# 2017jul09
#
#####

# «texlive-2017» (to ".texlive-2017")
# https://www.tug.org/texlive/
# https://www.tug.org/texlive/acquire-netinstall.html
# https://www.tug.org/texlive/quickinstall.html
# http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
#   (find-fline "$S/http/mirror.ctan.org/systems/texlive/tlnet/")
#   (find-fline "$S/http/mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz")
# https://www.tug.org/texlive/doc/install-tl.html
# http://mirror.hmc.edu/ctan/systems/texlive/tlnet/tlpkg/texlive.tlpdb

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -rfv /usr/local/texlive/2016/
rm -rfv ~/.texlive2016/
rm -rfv ~/.texlive2017/

rm -Rv ~/usrc/install-tl-20170709/
rm -Rv ~/usrc/install-tl-20180815/
tar -C ~/usrc/ -xvzf \
  $S/http/mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
cd     ~/usrc/install-tl-20170709/
cd     ~/usrc/install-tl-20180815/

# (code-c-d "tlinstall" "~/usrc/install-tl-20170709/")
# (code-c-d "tlinstall" "~/usrc/install-tl-20180815/")
# (find-tlinstallfile "")
# https://www.tug.org/texlive/doc/install-tl.html

./install-tl -gui text    |& tee oi
install-tl --profile installation.profile

# Loading http://mirror.hmc.edu/ctan/systems/texlive/tlnet/tlpkg/texlive.tlpdb
# Installing TeX Live 2017 from: http://mirror.hmc.edu/ctan/systems/texlive/tlnet (verified)
# Platform: x86_64-linux => 'GNU/Linux on x86_64'
# Distribution: net  (downloading)
# Using URL: http://mirror.hmc.edu/ctan/systems/texlive/tlnet
# Directory for temporary files: /tmp/U4Dz7wu3cs


# http://mirror.hmc.edu/ctan/systems/texlive/tlnet/tlpkg/texlive.tlpdb
# http://mirror.hmc.edu/ctan/systems/texlive/tlnet (verified)
# http://mirror.hmc.edu/ctan/systems/texlive/tlnet
# (find-fline "/tmp/U4Dz7wu3cs")

# (find-fline "/usr/local/texlive/2017/")
# (find-fline "/usr/local/texlive/2017/tlpkg/tlpobj/catechis.tlpobj")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
export PATH=/usr/local/texlive/2017/bin/x86_64-linux:$PATH
lualatex



Installing [2362/2362, time/total: 01:35:45/01:35:47]: zwpagelayout [587k]
Time used for installing the packages: 95:49
running mktexlsr /usr/local/texlive/2017/texmf-dist ...
mktexlsr: Updating /usr/local/texlive/2017/texmf-dist/ls-R... 
mktexlsr: Done.
writing fmtutil.cnf to /usr/local/texlive/2017/texmf-dist/web2c/fmtutil.cnf
writing updmap.cfg to /usr/local/texlive/2017/texmf-dist/web2c/updmap.cfg
writing language.dat to /usr/local/texlive/2017/texmf-var/tex/generic/config/language.dat
writing language.def to /usr/local/texlive/2017/texmf-var/tex/generic/config/language.def
writing language.dat.lua to /usr/local/texlive/2017/texmf-var/tex/generic/config/language.dat.lua
running mktexlsr /usr/local/texlive/2017/texmf-var /usr/local/texlive/2017/texmf-config /usr/local/texlive/2017/texmf-dist ...
mktexlsr: Updating /usr/local/texlive/2017/texmf-config/ls-R... 
mktexlsr: Updating /usr/local/texlive/2017/texmf-dist/ls-R... 
mktexlsr: Updating /usr/local/texlive/2017/texmf-var/ls-R... 
mktexlsr: Done.
running updmap-sys --nohash ...done
re-running mktexlsr /usr/local/texlive/2017/texmf-var /usr/local/texlive/2017/texmf-config ...
mktexlsr: Updating /usr/local/texlive/2017/texmf-config/ls-R... 
mktexlsr: Updating /usr/local/texlive/2017/texmf-var/ls-R... 
mktexlsr: Done.
setting up ConTeXt cache: running mtxrun --generate ...done
pre-generating all format files, be patient...
running fmtutil-sys --no-error-if-no-engine=luajittex,mfluajit --no-strict --all ...done
running package-specific postactions
finished with package-specific postactions

 ----------------------------------------------------------------------
 The following environment variables contain the string "tex"
 (case-independent).  If you're doing anything but adding personal
 directories to the system paths, they may well cause trouble somewhere
 while running TeX.  If you encounter problems, try unsetting them.
 Please ignore spurious matches unrelated to TeX.

    EETEX=/home/edrx/.eev/ee.tex
    MAKEINFODIR=/home/edrx/usrc/texinfo/texinfo-4.11.dfsg.1/makeinfo
    NEWLUATEXDIR=/home/edrx/bigsrc/luatex-beta-0.79.1/build/texk/web2c
 ----------------------------------------------------------------------


Welcome to TeX Live!


See /usr/local/texlive/2017/index.html for links to documentation.
The TeX Live web site (http://tug.org/texlive/) contains any updates and
corrections. TeX Live is a joint project of the TeX user groups around the
world; please consider supporting it by joining the group best for you. The
list of groups is available on the web at http://tug.org/usergroups.html.


Add /usr/local/texlive/2017/texmf-dist/doc/man to MANPATH.
Add /usr/local/texlive/2017/texmf-dist/doc/info to INFOPATH.
Most importantly, add /usr/local/texlive/2017/bin/x86_64-linux
to your PATH for current and future sessions.

Logfile: /usr/local/texlive/2017/install-tl.log
/home/edrx/usrc/install-tl-20170709(edrx:ve)# 

# (find-fline "/usr/local/texlive/2018/texmf-dist/doc/man/")
# (find-fline "/usr/local/texlive/2018/texmf-dist/doc/info/")
# (find-fline "/usr/local/texlive/2018/install-tl.log")
# (find-fline "/usr/local/texlive/2018/install-tl.log" "Add /usr/local/")




#####
#
# shell-escape
# 2023feb12
#
#####

# «shell-escape»  (to ".shell-escape")
# (find-angg "LUA/lua50init.lua" "getoutput")
# (find-man "1 luatex" "  --shell-escape")
# (find-man "1 luatex" "  --no-shell-escape")
# (find-man "1 luatex" "  --shell-restricted")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd /tmp/

cat > a.tex <<'%%%'
  \directlua{ print(); print("HELLO"); os.exit() }
%%%
luatex a.tex

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd /tmp/
cat > b.tex <<'%%%'
  \nonstopmode
  \directlua{
    getoutput = function (command)
        local pipe = assert(io.popen(command))
        local output = pipe:read("*a")
        pipe:close()
        return output
      end
    print()
    print(getoutput("ls /tmp/"))
    os.exit()
  }
%%%
luatex                  b.tex
luatex   --shell-escape b.tex
lualatex                b.tex
lualatex --shell-escape b.tex

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd /tmp/
cat > c.tex <<'%%%'
  \nonstopmode
  \directlua{
    dofile "/home/edrx/LUA/lua50init.lua"
    print()
    print(getoutput("ls /tmp/"))
    os.exit()
  }
%%%
luatex                  c.tex
luatex   --shell-escape c.tex
lualatex                c.tex
lualatex --shell-escape c.tex




#####
#
# \pdfshellescape
# 2017jul15
#
#####

# «pdfshellescape» (to ".pdfshellescape")
# http://tug.org/pipermail/luatex/2015-December/005549.html
# http://tug.org/pipermail/luatex/2015-December/thread.html#5549
# http://tug.org/pipermail/luatex/2015-December/005552.html




#####
#
# thislinetag
# 2017ago05
#
#####

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





#####
#
# \show
# 2018jan29
#
#####

# «show» (to ".show")
# (find-angg ".emacs.papers" "texbook")
# (find-angg ".emacs.papers" "luatexref")
# (find-texbookpage (+ 12 10) "\\show")
# (find-texbooktext (+ 12 10) "\\show")
# http://tug.org/pipermail/luatex/2018-January/006736.html
# http://tug.org/pipermail/luatex/2018-January/006737.html answer
# http://tug.org/pipermail/luatex/2018-January/006739.html my 2nd e-mail
# (find-luatexrefpage (+ 4 182) "9.6 The token library")
# (find-luatexreftext (+ 4 182) "9.6 The token library")
# (find-luatexrefpage (+ 4 182) "set_macro")
# (find-luatexreftext (+ 4 182) "set_macro")
# (find-luatexrefpage (+ 4 183) "token.create(\"relax\")")
# (find-luatexreftext (+ 4 183) "token.create(\"relax\")")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd ~/LATEX/
lualatex 2018dednat6-repl.tex
mt = function (s) tok = token.create(s); print(tok) end
ma = function (s) print(token.get_macro(s)) end
me = function (s) print(token.get_meaning(s)) end
ma "break"
me "break"
ma "section"
ma "@startsection"
ma "if@noskipsec"
me "if@noskipsec"
mt "if@noskipsec"
print(tok)
PPV(getmetatable(tok))
print(getmetatable(tok).__index)




getproperties = function (o, names, T)
    T = T or {}
    for _,name in ipairs(split(names)) do T[name] = o[name] end
    return T
  end
token_property_names = "command cmdname csname id active expandable protected"
prtoken = function (name)
    PPV(getproperties(token.create(name), token_property_names))
  end

prtoken "relax"
prtoken "def"
prtoken "foobar"
prtoken "fooplic"
prtoken "if@noskipsec"
prtoken "section"



PPV(getproperties(tok, "command cmdname csname id active expandable protected"))


tokenproperties = function (t)
    local T = {}
    local p = function (name) T[name] = t[name] end
    

    for _,name = ipairs(split("command cmdname csname id active expandable"))
t = token.create("relax")
print(t)
print(t.command)
print(t.cmdname)
print(t.csname)
print(t.id)
print(t.active)
print(t.expandable)
print(t.protected)
command    -- a number representing the internal command number
cmdname    -- the type of the command (for instance the catcode)
csname     -- the associated control sequence (if applicable)
id         -- the unique id of the token
active     -- a boolean indicating the active state of the token
expandable -- a boolean indicating if the token (macro) is expandable
protected  -- a boolean indicating if the token (macro) is protected



Inspecting a \def from LuaTeX

Hi list,

Is there a way to inspect the contents of a \def from Lua in LuaTeX?
If I do, say,

  \def\hello{Hello}

I know how to see the sequence of tokens in \hello by running
"\show\hello" in a TeX prompt... is there something similar that can
be done from Lua?

  Thanks in advance!
    Eduardo Ochs
    http://angg.twu.net/luatex.html




# (find-es "lua5" "luarepl-2017-latex")
# (find-angg "LATEX/2018repl-test.tex")
# (find-luatexrefpage)
# (find-luatexreftext)
# (find-luatexrefpage (+ 4 182) "9.6 The token library")
# (find-luatexreftext (+ 4 182) "9.6 The token library")
# (find-luatexrefpage (+ 4 182) "set_macro")
# (find-luatexreftext (+ 4 182) "set_macro")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd ~/LATEX/
lualatex 2018repl-test

print(token.get_macro("alpha"))
print(token.get_meaning("alpha"))
print(token.set_macro("alpha","whatever"))
print(token.get_macro("alpha"))
print(token.get_meaning("alpha"))

print(token.get_macro("definecolor"))



#####
#
# Inspecting TeX tokens from a REPL
# 2019jan16
#
#####

# «inspecting-tex-tokens» (to ".inspecting-tex-tokens")
# http://tug.org/pipermail/luatex/2019-January/007034.html

Inspecting TeX tokens from a Lua REPL

Hi list,

I am not sure if this is the right place to ask open-ended questions,
but let me try.

I wrote a package called Dednat6 - here:

  http://angg.twu.net/LATEX/2018tugboat-rev1.pdf (TUGBoat article)
  http://angg.twu.net/LATEX/2018dednat6-extras.pdf (extra features/docs)
  http://angg.twu.net/dednat6.zip (zip file)
  http://angg.twu.net/dednat6.html (home page)

and it includes a nice Lua REPL. If we run this,

  rm -Rfv /tmp/dn6-test/
  mkdir   /tmp/dn6-test/
  cd      /tmp/dn6-test/
  wget http://angg.twu.net/dednat6.zip
  unzip dednat6.zip
  lualatex 2018dednat6-repl.tex

we enter the REPL in the middle of the compilation of a document; more
precisely, in this context:

  \documentclass{article}
  \begin{document}
    \catcode`\^^J=10
    \directlua{dofile "dednat6load.lua"}
    \directlua{luarepl()}

which means that we can use the REPL to inspect, *from Lua*, the
current definitions and macros - for example, the current definitions
for \section and \subsection. I am just beginning to play with this
idea, writing code that uses the these functions from the token
library (section 9.6 in the LuaTeX reference manual),

  token.create(...)
  token.get_macro(...)
  token.get_meaning(...)
  
and inspecting the fields "command", "cmdname", "csname", "id",
"active", "expandable", "protected" of token objects... clearly I
haven't gone very far.

What tools do you people use to inspect \defs from Lua? Where do you
suggest me to look? Any suggestions of packages, articles (in TUGBoat
or elsewhere), webpages, code, comments in source code?...

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



P.S.: this question is connected to the one in this thread -
http://tug.org/pipermail/luatex/2018-January/006736.html - but I know
much more now...

P.S.: messy code welcome, & feel free to write me in private!




#####
#
# Inspecting TeX tokens from a REPL: e-mail to Taco
# 2019feb04
#
#####

# «inspecting-tex-tokens-taco» (to ".inspecting-tex-tokens-taco")
# https://mail.google.com/mail/ca/u/0/#sent/KtbxLwgsznqnhmdlJXMCnRmhMHRPlnSCGq




#####
#
# lua-repl-2018
# 2018fev01
#
#####

# «lua-repl-2018» (to ".lua-repl-2018")
# (find-LATEX "2018repl-test.tex")
# http://angg.twu.net/LATEX/2018repl-test.tex.html
# http://tug.org/pipermail/luatex/2018-February/006740.html  to luatex
# https://mail.google.com/mail/ca/u/0/#sent/1614f68a1c57648d to luatex
# https://mail.google.com/mail/ca/u/0/#sent/1614f74eb7507e3f to rob

Ann: Running Rob Hoelz's lua-repl from LuaTeX

Hi list,

a few years ago I experimented with running code like this

  \directlua{debug.debug()}

from a .tex file to obtain a Lua prompt, but found this method a bit
frustrating, I don't remember exactly why...

Now I am using something much nicer, based on Rob Hoelz's lua-repl
(plus dednat6 and other bloat), and I finally got the time to pack it
and write something vaguely like documentation for it. It is here:

  http://angg.twu.net/luatex.html#repl

There you will find instructions for downloading and testing the code,
and this very important comment:

  ...And please do get in touch with me - I'm eduardoochs at gmail.com
  - to discuss new features that would make this easier to use!!! I
  always use this repl from Emacs and eev with eepitch (...) so I need
  very few features from the repl myself.

Cheers =),
  Eduardo Ochs
  http://angg.twu.net/luatex.html





#####
#
# show \section and related macros
# 2018mar12
#
#####

# «show-section» (to ".show-section")
# (find-es "tex" "section")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd ~/LATEX/
lualatex 2018repl-test

print(token.get_macro("section"))
print(token.get_macro("@startsection"))






#####
#
# Producing stuff that is acceptable by Arxiv
# 2019feb19
#
#####

# «arxiv» (to ".arxiv")
# https://www.monperrus.net/martin/how-to-use-lualatex-arxiv
# https://tex.stackexchange.com/questions/372154/lualatex-how-to-produce-pdf-acceptable-by-arxiv




#####
#
# The ifluatex package
# 2019feb19
#
#####

# «ifluatex» (to ".ifluatex")
# (find-tlsh "find * | sort | grep ifluatex")

# (find-fline    "/usr/local/texlive/2018/texmf-dist/doc/latex/oberdiek/")
# (find-pdf-page "/usr/local/texlive/2018/texmf-dist/doc/latex/oberdiek/ifluatex.pdf")
# (find-pdf-text "/usr/local/texlive/2018/texmf-dist/doc/latex/oberdiek/ifluatex.pdf")

# (code-c-d      "ifluatex" "/usr/local/texlive/2018/texmf-dist/doc/latex/oberdiek/")
# (code-pdf-page "ifluatex" "/usr/local/texlive/2018/texmf-dist/doc/latex/oberdiek/ifluatex.pdf")
# (code-pdf-text "ifluatex" "/usr/local/texlive/2018/texmf-dist/doc/latex/oberdiek/ifluatex.pdf")
# (find-ifluatexfile "")
# (find-ifluatexpage)
# (find-ifluatextext)





#####
#
# dimensions-of-subboxes
# 2019mar07
#
#####

# «dimensions-of-subboxes» (to ".dimensions-of-subboxes")
# https://tug.org/pipermail/luatex/2019-March/007091.html my question
# https://tug.org/pipermail/luatex/2019-March/007092.html answer
# https://mail.google.com/mail/ca/u/0/#sent/QgrcJHsBmtlnJrcVHhLqglwBzKDPQHpWrFQ

Dimensions of sub-boxes?
Hi list,

sorry, I know that this _should_ be trivial but I can't figure out how
to do it from the manual...

Suppose that I set the box 0 by running this:

  \setbox0\hbox{%
    \hbox{a}%
    \hbox{bcde}%
    \hbox{fg}%
  }

How do I get - from Lua - number of sub-boxes of box0 and the width,
the height and the depth of each one?

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

--answer:--

Units are sp.  To get pt, divide by 2^16.

\setbox0\hbox{%
  \hbox{a}%
  \hbox{bcde}%
  \hbox{fg}%
}

\directlua{
adj = 2^16
for hlist in node.traverse_id(node.id"hlist", tex.box[0].list) do
    print(hlist.width / adj, hlist.height / adj, hlist.depth / adj)
end
}

\bye

# (find-luatexrefpage (+ 4 128) "7.2.1.26 node.traverse_id")
# (find-luatexreftext (+ 4 128) "7.2.1.26 node.traverse_id")
# (find-luatexrefpage (+ 4 106) "7.1.2.1 hlist nodes")
# (find-luatexreftext (+ 4 106) "7.1.2.1 hlist nodes")
# (find-luatexrefpage (+ 4 106) "7.1.2.1 hlist nodes" "height")
# (find-luatexreftext (+ 4 106) "7.1.2.1 hlist nodes" "height")
# (find-texbookpage (+ 12 57) "scaled point (65536 sp = 1 pt)")
# (find-texbooktext (+ 12 57) "scaled point (65536 sp = 1 pt)")




#####
#
# Dimensions of one box
# 2019mar08
#
#####

# «dimension-of-subboxes-1» (to ".dimension-of-subboxes-1")

\savebox{\myboxa}{%
\bhbox{%
\begin{tabular}[t]{l}
a \\
bc \\
def \\
\end{tabular}}}

\usebox{\myboxa}
\usebox{\myboxa}

\setbox0\hbox{\usebox{\myboxa}}
\directlua{
print "HELLO"
adj = 2^16
for hlist in node.traverse_id(node.id"hlist", tex.box[0].list) do
    print(hlist.width / adj, hlist.height / adj, hlist.depth / adj)
end
}

% 25.060012817383	8.3999633789062	27.600036621094

\unitlength=1pt
\def\closeddot{\circle*{4.0}}

\beginpicture(0,0)(4,4)%
\put(0,0){\usebox{\myboxa}}
\put(0,0){\closeddot}
\put(25.06,8.4){\closeddot}
\put(25.06,-27.6){\closeddot}
\end{picture}%




#####
#
# Fixing the behavior of \beginpicture (for .dnt files)
# 2019may02
#
#####

# «beginpicture-dnt» (to ".beginpicture-dnt")
# (find-LATEX "edrxpict.lua" "beginpicture")
# (find-LATEX "edrxgac2.tex" "beginpicture")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
chdir "~/LATEX/"
dofile "edrxpict.lua"

print(beginpicture(v(-1,-1), v(4,6)))
print(pictaxes())
print("{\\linethickness{0.5pt}\n" .. pictaxes() .."\n}")
print(pictdots("1,3 0,2 2,2 1,1 1,0"))

\expr{pictaxes()}}


Wrap = Class {
  type    = "Wrap",
  new = function (left, right)
      return Wrap {left=left, right=right}
    end,
  __tostring = function (o) return mytabletostring(o) end,
  __mul = function (w, o)
      if otype(o) == "Wrap"
      then return Wrap.new(w.left..o.left, o.right..w.right)
      else return w.left .. o .. w.right
      end
    end, 
  __index = {
  },
}

wa = Wrap.new ("<a ", " a>")
wb = Wrap.new ("<b ", " b>")
wc = Wrap.new ("<c ", " c>")
= wa
= wa * wb
= wa * wb * "o"


= beginpicture(v(-1,-1), v(4,6))

= Wrap.new(beginpicture(v(-1,-1), v(4,6)).."\n", "\n\\endpicture") *
  Wrap.new("{\\linethickness{0.5pt}\n", "\n}") *
"hoo"

Wrap(pictaxes(), "") *
  pictdots("1,3 0,2 2,2 1,1 1,0")




#####
#
# insert-pdf-page
# 2019sep05
#
#####

# «insert-pdf-page» (to ".insert-pdf-page")
# (find-es "tex" "pdfpages")
# https://www.contextgarden.net/Including_pages_from_PDF_documents
# https://www.contextgarden.net/Category:PDF
# (find-fline "/usr/local/texlive/2019/texmf-dist/tex/context/base/mkii/page-imp.mkii")
# (find-fline "/usr/local/texlive/2019/texmf-dist/tex/context/base/mkiv/page-imp.mkiv")
# (find-fline "/usr/local/texlive/2019/texmf-dist/tex/context/base/mkiv/page-sel.mkvi")
# (find-fline "/usr/local/texlive/2019/texmf-dist/tex/context/base/mkiv/")





#####
#
# stroked-fonts-in-luamplib
# 2019dec01
#
#####

# «stroked-fonts-in-luamplib» (to ".stroked-fonts-in-luamplib")
# https://tug.org/pipermail/luatex/2019-November/007259.html
# https://tug.org/pipermail/luatex/2019-December/007260.html
# https://tug.org/pipermail/metapost/2015-May/003083.html
# https://tex.stackexchange.com/a/451951/
# https://tex.stackexchange.com/a/479410/
# https://tex.stackexchange.com/questions/180510/how-to-get-intersection-points-of-two-glyphs/451951
# https://tex.stackexchange.com/questions/479395/welcoming-2019-pi-day-how-to-draw-the-letter-%cf%80/479410





#####
#
# Problem tex.print()-ing a verbatim block
# 2020jun05
#
#####

# «tex.printing-verbatim»  (to ".tex.printing-verbatim")
# (find-fline "/tmp/dednatv/")
# https://mail.google.com/mail/ca/u/0/#sent/KtbxLzGSrbBfZqhmvfJhrkvZFBpmmhSmSV
# https://tug.org/pipermail/luatex/2020-June/007364.html

Hello list,

if I run something like this from Lua

  tex.print([[
  \begin{verbatim}
  foo
    poo
      boo
  \end{verbatim}
  ]])

the newlines in the verbatim are converted to spaces... how do I fix
this?

I'm running Debian Stable and I've tried the test below - after the
line that says "snip-snip" - with the two versions of lualatex that I
have here. Thanks in advance!

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


--snip--snip--

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

/usr/bin/lualatex --version
# -> This is LuaTeX, Version 1.07.0 (TeX Live 2019/dev/Debian)
/usr/local/texlive/2019/bin/x86_64-linux/lualatex --version
# -> This is LuaTeX, Version 1.10.0 (TeX Live 2019)

cat > test.tex <<'==='
\documentclass{article}
\begin{document}
\catcode`\^^J=10
\directlua{dofile "test.lua"}
Compare with:
\begin{verbatim}foo   poo     boo\end{verbatim}
\begin{verbatim}foo  poo    boo\end{verbatim}
\begin{verbatim}
foo
  poo
    boo
\end{verbatim}
\end{document}
===

cat > test.lua <<'==='
str = [[
\begin{verbatim}
foo
  poo
    boo
\end{verbatim}
]]
print(str)
tex.print(str)
===

lualatex test.tex
xpdf     test.pdf

# (find-pdf-page "/tmp/dednatv/test.pdf")
# (find-pdf-text "/tmp/dednatv/test.pdf")





#####
#
# Where can I learn more about catcodes in LuaTeX?
# 2020jun06
#
#####

# «resources-about-catcodes-1» (to ".resources-about-catcodes-1")
# https://tug.org/pipermail/luatex/2020-June/007368.html
# https://mail.google.com/mail/ca/u/0/#search/catcodetable/QgrcJHrnxTjLqnFVGTJxJxgKTNnRnknsKqG

Where can I learn more about catcodes in LuaTeX?

Hi list,

I just sent a question about catcodes that had the wrong tone... let
me try to rewrite it completely.

I am the author of a package called "Dednat6" for drawing diagrams
with luatex/lualatex. It is very extensible, and, among other things,
it provides a way to run Lua code embedded in specially-marked
comments - more precisely, in what I call "%L"-blocks. This is
explained in sections 3 and 4 of the TUGBoat article about Dednat6:

  https://tug.org/TUGboat/tb39-3/tb123ochs-dednat.pdf

I am trying to convince more category theorists to try Dednat6, but I
am afraid that they will find LuaTeX too hard to learn, as I did, and
they will give up. One of the things that I am trying to do to remedy
this is to collect pointers on where they can learn things.

The message about catcodes that I sent yesterday is here:

  https://tug.org/pipermail/luatex/2020-June/007364.html

It contains a simple test that reveals - I mean, to an imaginary
newbie reading it - that the TeX interpreter and tex.print use two
different catcode tables.

One obvious place to learn more about these different catcode tables
is the LuaTeX reference manual. Let me use a trick from eev to point
to sections of the manual. The trick is explained here,

  http://angg.twu.net/eev-intros/find-pdf-like-intro.html#7
  (find-pdf-like-intro "7. Shorter hyperlinks to PDF files")

and - for the sake of completeness, and for Emacs users only - there
is an introduction of how to use Emacs and eev to create and share
"executable notes" here:

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

To make a long story short, after running these sexps in Emacs,

(code-pdf-page "luatexref" "/usr/local/texlive/2019/texmf-dist/doc/context/documents/general/manuals/luatex.pdf")
(code-pdf-text "luatexref" "/usr/local/texlive/2019/texmf-dist/doc/context/documents/general/manuals/luatex.pdf" 4)

I can use the sexp hyperlinks below to point to specific sections of
the manual; I believe that they are easy to understand.

  (find-luatexrefpage        5  "Contents")
  (find-luatexreftext        5  "Contents")
  (find-luatexrefpage (+ 4  24) "Note that the expansion of \\directlua")
  (find-luatexreftext (+ 4  24) "Note that the expansion of \\directlua")
  (find-luatexrefpage (+ 4  27) "2.5 Catcode tables")
  (find-luatexreftext (+ 4  27) "2.5 Catcode tables")
  (find-luatexrefpage (+ 4 197) "10.3.14.1 print")
  (find-luatexreftext (+ 4 197) "10.3.14.1 print")

So, how can I do things like inspecting catcodes and changing them
from Lua? I saw that there is a brief mention of a "tex.catcodetable"
here,

  (find-luatexrefpage (+ 4 186) "10.3.2.1 Integer parameters")
  (find-luatexreftext (+ 4 186) "10.3.2.1 Integer parameters")
  (find-luatexreftext (+ 4 186) "10.3.2.1 Integer parameters" "tex.catcodetable")

but I didn't find there the ways to inspect and change entries of
catcode tables from Lua...

I am quite outsider-ish in the LuaTeX community, and I have the
sensation that I don't even know where are the forums in which the
discussions are happening... so:

Please, people, if you have any pointers that you believe that may be
useful to me, I'd like to see them - and private messages are welcome.

I *guess* that the material - both "reference" and "discussions" -
about catcodes in LuaTeX is scattered through several mailing lists,
and in comments in the source code of LuaTeX itself, in the source
code of packages that use catcodes in luatex-ish ways, in TUGBoat
articles, in slides, in posts in stackexchange... and I don't know
where else, and I don't know if there are chat channels about LuaTeX
nowadays - did they migrate from IRC to things like Slack and
Zulip?...

  Cheers and thanks in advance,
    Eduardo Ochs
    http://angg.twu.net/dednat6.html
    http://angg.twu.net/dednat6.html#hacking





#####
#
# catcode-resources
# 2020jun06
#
#####

# «catcode-resources» (to ".catcode-resources")
# https://tex.stackexchange.com/questions/45293/can-the-lua-part-of-luatex-know-about-tokens
# https://tex.stackexchange.com/users/2707/bruno-le-floch
# http://users.aims.ac.za/~bruno/
# https://ctan.org/author/lefloch?lang=en
# https://ctan.org/pkg/cprotect
# https://ctan.org/pkg/gtl
# https://ctan.org/pkg/unravel

# https://tug.org/pipermail/luatex/2020-June/007369.html Luigi
# https://tug.org/pipermail/luatex/2020-June/007370.html David Carlisle




#####
#
# \catcodetable@string
# 2020jun06
#
#####

# «catcodetable@string» (to ".catcodetable@string")
# https://mail.google.com/mail/ca/u/0/#search/catcodetable/QgrcJHrnxTjLqnFVGTJxJxgKTNnRnknsKqG

google for \catcodetable@string

# (find-tlsh "find * | sort | grep ltluatex")
# (find-tlfile "texmf-dist/tex/latex-dev/base/" "ltluatex.lua")
# (find-tlfile "texmf-dist/tex/latex/base/"     "ltluatex.lua")
# (find-fline               "/usr/local/texlive/2019/texmf-dist/doc/latex/base/")
# (code-pdf-page "ltluatex" "/usr/local/texlive/2019/texmf-dist/doc/latex/base/ltluatex.pdf")
# (code-pdf-text "ltluatex" "/usr/local/texlive/2019/texmf-dist/doc/latex/base/ltluatex.pdf")
# (find-ltluatexpage)
# (find-ltluatextext)
# (find-ltluatexpage 3 "\\catcodetable@string")
# (find-ltluatextext 3 "\\catcodetable@string")
# (find-ltluatexpage 3 "\\catcodetable@latex")
# (find-ltluatextext 3 "\\catcodetable@latex")
# (find-ltluatexpage 9 "\\newcatcodetable\\catcodetable@latex")
# (find-ltluatextext 9 "\\newcatcodetable\\catcodetable@latex")

# (find-ltluatexpage 5 "add_to_callback")
# (find-ltluatextext 5 "add_to_callback")
# (find-ltluatexpage 23 "local function add_to_callback")
# (find-ltluatextext 23 "local function add_to_callback")

# (find-fline "/usr/local/texlive/2019/texmf-dist/doc/latex-dev/base/ltnews23.tex")
# (code-pdf-page "ltnews23" "/usr/local/texlive/2019/texmf-dist/doc/latex-dev/base/ltnews23.pdf")
# (code-pdf-text "ltnews23" "/usr/local/texlive/2019/texmf-dist/doc/latex-dev/base/ltnews23.pdf")
# (find-ltnews23page)
# (find-ltnews23text)
# (find-ltnews23page 2 "predefined: \\catcodetable@initex")
# (find-ltnews23text 2 "predefined: \\catcodetable@initex")

# https://tex.stackexchange.com/questions/290592/error-when-compiling-with-lualatex-file-ltluatex-tex

# (find-tlsh "find * | sort | grep ctablestack")
# (find-fline "/usr/local/texlive/2019/texmf-dist/doc/luatex/ctablestack/")
# (code-pdf-page "ctablestack" "/usr/local/texlive/2019/texmf-dist/doc/luatex/ctablestack/ctablestack.pdf")
# (code-pdf-text "ctablestack" "/usr/local/texlive/2019/texmf-dist/doc/luatex/ctablestack/ctablestack.pdf")
# (find-ctablestackpage)
# (find-ctablestacktext)
# (find-ctablestackpage 1 "\\catcodetable\\catcodetable@latex")
# (find-ctablestacktext 1 "\\catcodetable\\catcodetable@latex")
# (find-ctablestackpage 1 "\\showthe\\catcode`\\Z")
# (find-ctablestacktext 1 "\\showthe\\catcode`\\Z")
# (find-ctablestackpage 2 "\\the\\catcode`\\@")
# (find-ctablestacktext 2 "\\the\\catcode`\\@")

# (find-fline "/usr/local/texlive/2019/texmf-dist/source/luatex/ctablestack/ctablestack.dtx")
# (find-tlgrep "grep --color -nRH --null -e catcodetable texmf-dist/source/luatex")
# (find-tlgrep "grep --color -nRH --null -e catcodetable texmf-dist/source/luatex")




#####
#
# Bug with package.searchers in TeXLive 2020
# 2020nov05
#
#####

# «package.searchers-2020»  (to ".package.searchers-2020")
# https://tug.org/pipermail/luatex/2020-November/007426.html My original question
# https://tug.org/pipermail/luatex/2020-November/007427.html Luigi's answer 1
# https://tug.org/pipermail/luatex/2020-November/007428.html My answer 1
# https://tug.org/pipermail/luatex/2020-November/007429.html Luigi's answer 2
# https://tug.org/pipermail/luatex/2020-November/007430.html Ulrike's answer
# https://github.com/latex3/lualibs/issues/4 my issue on latex3/lualibs

I am getting a strange error with TeXLive 2020 here that I don't get
with TeXLive 2019. The error is:

  .../2020/texmf-dist/tex/luatex/lualibs/lualibs-basic-merged.lua:378:
    attempt to call a nil value (field 'cpath specification')
  stack traceback:
  .../2020/texmf-dist/tex/luatex/lualibs/lualibs-basic-merged.lua:378:
    in local 'lookup'
  .../2020/texmf-dist/tex/luatex/lualibs/lualibs-basic-merged.lua:402:
    in function
<.../2020/texmf-dist/tex/luatex/lualibs/lualibs-basic-merged.lua:392>
        [C]: in function 'require'
        dednat6/dednat6.lua:58: in main chunk
        [C]: in function 'dofile'
        dednat6load.lua:58: in main chunk
        [C]: in function 'dofile'
        [\directlua]:1: in main chunk.
  l.50 \directlua{dofile "dednat6load.lua"}

and what I understood after a few hours trying to debug this is that
the culprit on my side is this chunk of code:

  package.loaders = package.loaders or package.searchers
  local function lualoader(modulename) ... end
  table.insert(package.loaders, 2, lualoader)

in this file:

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

it seems that my code confuses the part of the code in

  /usr/local/texlive/2020/texmf-dist/tex/luatex/lualibs/lualibs-basic-merged.lua

that comes from lualibs-package.lua... I tkdiff'ed the versions of
lualibs-package.lua from TeXLive 2019 and TeXLive 2020 by doing

  tkdiff \
    /usr/local/texlive/2019/texmf-dist/tex/luatex/lualibs/lualibs-package.lua \
    /usr/local/texlive/2020/texmf-dist/tex/luatex/lualibs/lualibs-package.lua

and I found that the function "helpers" contains this code,

  builtin    = {
      ["preload table"]       = searchers[1+offset], -- special case, built-in libs
      ["path specification"]  = searchers[2+offset],
      ["cpath specification"] = searchers[3+offset],
      ["all in one fallback"] = searchers[4+offset], -- special case, combined libs
  },

that supposes that users will not insert their own functions in the
middle of the table package.searchers... but there's a LOT in the code
in lualibs-package.lua that I don't understand - including the parts
that changed from 2019 to 2020.

What should I do? Should I change my code that adds a new searcher to
package.searchers? How? All the users of Dednat6 that I have conctact
with use Dednat6 both on recent TeXLives and on TeXLive 2016/2017 -
for Arxiv-related reasons - so I need to find a solution that works on
as many versions of TeXLive as possible...

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



# (find-sh "locate lualibs/lualibs-basic-merged.lua")

# (find-fline "/usr/local/texlive/2019/texmf-dist/tex/luatex/lualibs/lualibs-basic-merged.lua")
# (find-fline "/usr/local/texlive/2020/texmf-dist/tex/luatex/lualibs/lualibs-basic-merged.lua")
# (find-tkdiff "/usr/local/texlive/2019/texmf-dist/tex/luatex/lualibs/lualibs-basic-merged.lua"
               "/usr/local/texlive/2020/texmf-dist/tex/luatex/lualibs/lualibs-basic-merged.lua")
# (find-tkdiff "/usr/local/texlive/2019/texmf-dist/tex/luatex/lualibs/lualibs-package.lua"
               "/usr/local/texlive/2020/texmf-dist/tex/luatex/lualibs/lualibs-package.lua")

# (setenv "TLUATEX2019" "/usr/local/texlive/2019/texmf-dist/tex/luatex")
# (setenv "TLUATEX2020" "/usr/local/texlive/2020/texmf-dist/tex/luatex")
# (code-c-d "tluatex2019" "$TLUATEX2019/")
# (code-c-d "tluatex2020" "$TLUATEX2020/")
# (find-tluatex2019file "lualibs/lualibs-basic-merged.lua")
# (find-tluatex2020file "lualibs/lualibs-basic-merged.lua")
# (find-tluatex2019file "lualibs/lualibs-package.lua")
# (find-tluatex2020file "lualibs/lualibs-package.lua")

# (find-fline "~/LATEX/dednat6/dednat6.lua" "REPL = Repl:new()")
# (find-pdf-page "~/LATEX/tmp.pdf")
# (find-dn6 "lualoader.lua")
# (find-lua53manual "#pdf-load")
# (find-lua51manual "#pdf-debug.getinfo")

# (find-tkdiff "/usr/local/texlive/2019/texmf-dist/tex/luatex/lualibs/lualibs-package.lua"
               "/usr/local/texlive/2020/texmf-dist/tex/luatex/lualibs/lualibs-package.lua")




#####
#
# lualibs
# 2020nov05
#
#####

# «lualibs»  (to ".lualibs")
# (find-es "git" "git-log-difftool")
# https://github.com/latex3/lualibs
# (find-git-links "https://github.com/latex3/lualibs" "lualibs")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# rm -Rfv ~/usrc/lualibs/
cd      ~/usrc/
git clone https://github.com/latex3/lualibs
cd      ~/usrc/lualibs/

export PAGER=cat
git branch --list -a
git for-each-ref
git log --oneline --graph --all -20

# (find-fline "~/usrc/")
# (find-fline "~/usrc/lualibs/")
# (find-gitk  "~/usrc/lualibs/")

# (code-c-d "lualibs" "~/usrc/lualibs/")
# (find-lualibsfile "")
# (find-lualibsfile "lualibs-package.lua")
# (find-lualibsfile "" "lualibs-package.lua")
# (find-lualibssh "git log --oneline --graph --all -400")

# (find-efunctiondescr 'vc-annotate)
# (find-efunction      'vc-annotate)


# (find-es "git" "git-diff")
# (find-es "git" "git-show")
# (find-es "git" "git-log")
# (find-es "git" "git-blame")




#####
#
# Making require "re" work
# 2021oct14
#
#####

# «re»  (to ".re")
# (find-LATEX "2021lean-nng.tex" "re")
# (find-sh "locate /re.lua")
# (find-tkdiff "/usr/share/lua/5.1/re.lua" "/usr/share/lua/5.3/re.lua")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -v   ~/LATEX/dednat6/re.lua
rm -v ~/dednat6/dednat6/re.lua
cp -v /usr/share/lua/5.3/re.lua   ~/LATEX/dednat6/
cp -v /usr/share/lua/5.3/re.lua ~/dednat6/dednat6/





#####
#
# dimensions-of-subboxes
# 2022apr24
#
#####

# «dimensions-of-subboxes-2»  (to ".dimensions-of-subboxes-2")
# https://tug.org/pipermail/luatex/2022-April/007698.html
# https://tug.org/pipermail/luatex/2022-April/007700.html

Dimensions of subboxes

Hi list,

I use LuaTeX a lot - I am even the author of
<http://angg.twu.net/dednat6/tug-slides.pdf>! - but I use very few of
the Lua functions that call the underlying TeX, so probably this is a
very basic question...

The code below runs

  \setbox0\hbox{\hbox{$a$}\hbox{$b$}\hbox{$p$}\hbox{$q$}}

and then starts a Lua REPL:

--snip--snip--
rm -Rfv /tmp/emlua/
mkdir   /tmp/emlua/
cd      /tmp/emlua/
git clone https://github.com/edrx/emlua .

rm -Rfv /tmp/emlua/tex/
mkdir   /tmp/emlua/tex/
cd      /tmp/emlua/tex/
cp -v ../edrxlib.lua .
cp -v ../Repl1.lua .

cd      /tmp/emlua/tex/
cat > a.tex <<'---'
\setbox0\hbox{\hbox{$a$}\hbox{$b$}\hbox{$p$}\hbox{$q$}}
\directlua{dofile "edrxlib.lua"}
\directlua{dofile "Repl1.lua"}
\directlua{REPL = EdrxRepl.new(); print(); REPL:repl()}
\bye
---

luatex a.tex
--snip--snip--

My question is: how do I get the dimensions of the subboxes of box0
from Lua?

  Thanks in advance!
    Eduardo Ochs
    https://github.com/edrx/emlua#introduction
    http://angg.twu.net/pict2e-lua.html



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


Hi Patrick!

The trick with coroutines looked like overkill, but there were some
very useful comments... I followed some links, and got the solution
below. If I send these lines to a shell,


cd /tmp/emlua/tex/
cat > a.tex <<'---'
\setbox0\hbox{\hbox{$a$}\hbox{$b$}\hbox{$p$}\hbox{$q$}}
\directlua{dofile "edrxlib.lua"}
\directlua{dofile "Repl1.lua"}
\directlua{REPL = EdrxRepl.new(); print(); REPL:repl()}
\bye
---

luatex a.tex
  adj = 2^16
  print(tex.box[0])
  print(tex.box[0].width)
  print(tex.box[0].width / adj)
  for hlist in node.traverse_id(node.id"hlist", tex.box[0].list) do
    local wd = hlist.width  / adj
    local ht = hlist.height / adj
    local dp = hlist.depth  / adj
    print(format("wd: %.3f  ht: %.3f  dp: %.3f", wd, ht, dp))
  end


Then the log of my interaction with luatex is this:


This is LuaTeX, Version 1.12.0 (TeX Live 2020) 
 restricted system commands enabled.
(./a.tex
>>>   adj = 2^16
>>>   print(tex.box[0])
<node    nil <    387 >    nil : hlist 2>
>>>   print(tex.box[0].width)
1273476
>>>   print(tex.box[0].width / adj)
19.431701660156
>>>   for hlist in node.traverse_id(node.id"hlist", tex.box[0].list) do
...     local wd = hlist.width  / adj
...     local ht = hlist.height / adj
...     local dp = hlist.depth  / adj
...     print(format("wd: %.3f  ht: %.3f  dp: %.3f", wd, ht, dp))
...   end
wd: 5.286  ht: 4.306  dp: 0.000
wd: 4.292  ht: 6.944  dp: 0.000
wd: 5.031  ht: 4.306  dp: 1.944
wd: 4.823  ht: 4.306  dp: 1.944
>>> 


So: problem solved! Thanks! =)
  Eduardo Ochs
  http://angg.twu.net/





#####
#
# interleaving
# 2022apr25
#
#####

# «interleaving»  (to ".interleaving")
# https://tex.stackexchange.com/questions/20893/concurrently-interleaving-execution-of-lua-and-tex-in-luatex/20905#20905
# http://tracker.luatex.org/view.php?id=682 0000682: Create tex.execute()









#####
#
# Other links
# 2014may04
#
#####

http://www.ntg.nl/mailman/private/dev-luatex/

# http://wiki.luatex.org/index.php/Main_Page
# http://wiki.luatex.org/index.php/Typeset_non-TeX_files_by_converting_them_using_Lua_code
# http://wiki.luatex.org/index.php/Writing_Lua_in_TeX
# http://ctan.org/pkg/luacode

# (find-sh "locate luacode")

http://tex.stackexchange.com/users/7826/eduardoochs
http://tex.stackexchange.com/faq#questions
http://en.gravatar.com/emails

http://tex.stackexchange.com/questions/28064/how-to-display-only-certain-lines-of-a-paragraph/28106#28106
http://tex.stackexchange.com/questions/27780/one-letter-word-at-the-end-of-line/28128#28128
http://tex.stackexchange.com/questions/28136/latex-not-hyphenating-properly-text-running-off-page/28178#28178
http://tex.stackexchange.com/questions/28294/can-i-have-the-overfullrule-rule-colored/28299#28299

\luaexec{
  tex.print(math.floor(\the\luatexversion/100).."."..
  \the\luatexversion \% 100)
}}

http://tug.org/pipermail/luatex/2012-August/thread.html#3760
http://wiki.luatex.org/
http://tug.org/TUGboat/tb31-3/tb99isambert.pdf
http://tug.org/TUGboat/tb32-1/tb100isambert.pdf
http://tug.org/~kotucha/luatab.pdf

http://tex.stackexchange.com/questions/70/what-is-a-simple-example-of-something-you-can-do-with-luatex
http://wiki.contextgarden.net/Programming_in_LuaTeX
http://wiki.luatex.org/index.php/TeX_without_TeX
ftp://ftp.dante.de/tex-archive/macros/luatex/generic/lua-visual-debug/doc/
ftp://ftp.dante.de/tex-archive/macros/luatex/generic/lua-visual-debug/doc/lvdebug-doc.pdf

# http://tex.stackexchange.com/questions/108612/how-to-draw-this-pyramid-with-tex
# http://tex.blogoverflow.com/2012/03/textalk-an-interview-with-patrick-gundlach/

# https://mail.google.com/mail/ca/u/0/#search/to%3Apatrick%40gundla.ch/13e0a1a779b546bb
# https://github.com/pgundlach

patrick@gundla.ch
Program and scripts used to generate data diagrams

Hi Patrick,

I am a long-time Lua user but a LuaTeX newbie...
I was browsing the web for LuaTeX examples and I found this:

  http://wiki.luatex.org/index.php/TeX_without_TeX
  http://wiki.luatex.org/index.php/File:Nodes_in_sample_paragraph.png

the data diagram with structs and pointers is just awesome.
How did you generate it? I have lots of diagrams that I would like to
put in that form - and that looks far, far better than anything I've
been able to do with either ascii art or inkscape =)...

  Cheers, thanks in advance,
    Eduardo Ochs
    eduardoochs@gmail.com
    http://angg.twu.net/
    http://angg.twu.net/dednat4.html  <- being ported to LuaTeX very slowly








http://www.guitex.org/home/images/ArsTeXnica/AT011/AT11-scarso.pdf



-- 2013apr23, texlua vs luatex:
local function writemsg (...)
  if token == nil then
    io.write(string.format(...)..'\n')
  else
    texio.write_nl(string.format(...)..'\n')
  end
end
-- The token table isn't accessible from texlua.


http://tex.stackexchange.com/questions/20444/what-are-immediate-write18-and-how-does-one-use-them
https://tex.stackexchange.com/questions/191328/how-to-pass-a-latex-argument-verbatim-to-lua

Choosing a LaTeX Compiler (my predilection for LuaTeX):
https://lists.gnu.org/archive/html/emacs-orgmode/2021-04/msg00136.html
https://lists.gnu.org/archive/html/emacs-orgmode/2021-04/msg00138.html pdfpages
https://lists.gnu.org/archive/html/emacs-orgmode/2021-04/msg00172.html all capital letters of the document in TeX Gyre

https://sile-typesetter.org/what-is-sile/

https://tex.stackexchange.com/questions/51330/lua-function-to-see-if-a-macro-is-defined-or-not
https://tex.stackexchange.com/questions/492630/passing-arguments-from-tex-to-a-lua-function

# (find-sh "locate luaimageembed")
# (find-tlfile "texmf-dist/doc/lualatex/luaimageembed/README.md")
# (find-tlfile "texmf-dist/tex/lualatex/luaimageembed/luaimageembed.sty")
# https://tug.org/pipermail/tex-live/2023-June/049283.html





# Local Variables:
# coding:               utf-8-unix
# modes:                (fundamental-mode emacs-lisp-mode lua-mode)
# End: