[luatex] Inspecting TeX tokens from a Lua REPL
luigi scarso
luigi.scarso at gmail.com
Wed Jan 16 20:15:10 CET 2019
On Wed, Jan 16, 2019 at 7:35 PM Eduardo Ochs <eduardoochs at gmail.com> wrote:
> 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...
>
> cool.. thank you very much for your links !
--
luigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/luatex/attachments/20190116/fe058fd2/attachment.html>
More information about the luatex
mailing list