[luatex] Passing verbatim text to a function

Sietse Brouwer sbbrouwer at gmail.com
Mon Sep 27 19:28:18 CEST 2010


Am 27.09.2010 um 00:16 schrieb Sietse Brouwer:
>> \def\Dedent#1{ \directlua{ dedent( [[#1]] ) } }

On Mon, Sep 27, 2010 at 16:20, Wolfgang Schuster
<schuster.wolfgang at googlemail.com> wrote:
> \def\Dedent#1{\ctxlua{dedent(\!!bs\detokenize{#1}\!!es)}}
>
> or
>
> \def\Dedent#1{\ctxlua{dedent(\!!bs\normalunexpanded{#1}\!!es)}}


Neither of those works for me; in both cases LuaTeX halts with an
error. (I added (quotation marks or [[]]) (around the #1 or inside the
parentheses) to ensure the dedent() function interpreted the argument
as a string, but that did not change the error.)

%%%% Start error %%%%
! LuaTeX error <main ctx instance>:1: unexpected symbol near '\'.
\Dedent ...{dump(\!!bs\detokenize {#1}\!!es)}

l.21 }
%%%% End error %%%%

The } on line 21 is the closing brace of the \Dedent{...} command, but
I don't know what that signifies. I tried reading up on \!!bs and
\!!es to see if I could fix this myself; unfortunately, they are not
very googlable, and I found nothing.

For my case, I have a working solution already in the form of Aditya's
code; on the other hand, if this can be debugged then the wiki can
have examples of passing verbatim text both via a startstop and via a
\command{}, and that might be nice.

--Sietse


More information about the luatex mailing list