[luatex] Passing verbatim text to a function

Wolfgang Schuster schuster.wolfgang at googlemail.com
Tue Sep 28 06:24:33 CEST 2010


Am 28.09.2010 um 04:54 schrieb Sietse Brouwer:

> I tested those three with
> \one{
>    \TeX
>        in
>    Lua} ,
> mutatis mutandis, but none of them preserved linebreaks or spaces,
> alas. :-/ I tried inexpertly placing \obeylines and \obeyspaces, but
> that did not help.

\def\startone
  {\begingroup
   \obeylines
   \dostartone}

\def\dostartone#1\stopone
  {\ctxlua{thirddata.one(...)}%
   \endgroup}

>> You can also write a environment by changing the defintions to
>> 
>> \def\startone#1\stopone{\ctxlua{thirddata.verbatim(...)}}
> 
> Where the (...) presumably was one of the above \!!bs...\!!es
> stretches. Again (surrounding the definition with \unprotect and
> \protect) this threw no errors, but it, too, did not preserve spaces
> or newlines.
> 
> I also tried to define
> 
> \def\doDedent#1
>    {\startDedent#1\stopDedent}
> 
> using Aditya's named buffer pattern, but that gave 'runaway argument'
> errors, so I guess it's not the way to go.

You can’t use a buffer in other commands.

Wolfgang





More information about the luatex mailing list