[luatex] Passing verbatim text to a function

Sietse Brouwer sbbrouwer at gmail.com
Mon Sep 27 15:32:02 CEST 2010


Dear Adityan

On Mon, Sep 27, 2010 at 03:09, Aditya Mahajan <adityam at umich.edu> wrote:
> If you do not mind a slight change in the user syntax, here is an
> alternative:
>
> \def\startDedent
>  {\dostartbuffer[dedent][startDedent][stopDedent]}
>
> \def\stopDedent{\directlua{dedent("dedent")}}
>
> The function dedent(...) now takes the name of the buffer rather than its
> contents. So
>
>    dedent = function(name)
>        local code = buffers.content(name)
>        ....
>    end

Ah, perfect! I had in fact been hoping to use that user syntax, but
had thought that I would tackle the verbatim input first. You've
solved both of my problems in one blow.

I've written up the answer and added it as a section in
http://wiki.contextgarden.net/Programming_in_LuaTex#Getting_text_into_LuaTex_verbatim
. (It might be more at home at http://luatex.bluwiki.com/, but I
couldn't find any way to create a user account or contact the
maintainer of that page.)

Thank you very much for your help,
Kind regards,

Sietse
(Sietse Brouwer)



More information about the luatex mailing list