[luatex] Line breaks
Khaled Hosny
khaledhosny at eglug.org
Sat Feb 19 18:05:46 CET 2011
On Sat, Feb 19, 2011 at 06:11:58PM +0200, Dirk Laurie wrote:
> On Sat, Feb 19, 2011 at 05:15:58PM +0200, Wolfgang Schuster wrote:
> >
> > Use \detokenize, e.g.
> >
> > \directlua{\detokenize{text = [[
> > This is a paragraph
> > with some lines.
> >
> > This is another paragraph,
> > separated from the first
> > by a blank line. ]]}
> > tex.print(text)}
> >
> Yes, this works. Unfortunately,
>
> \directlua{\detokenize{ dofile "ex2.lua" }}
>
> when ex2.lua contains
>
> text = [[
> > This is a paragraph
> > with some lines.
> >
> > This is another paragraph,
> > separated from the first
> > by a blank line. ]]}
Something like that would do the trick (basically detecting empty lines
on your own):
for line in text:gmatch("(.-)\r?\n") do
local p = #line and tex.print or tex.sprint
p(line)
end
It will ignore your last line, though, because it is not line feed
delimited.
Regards,
Khaled
--
Khaled Hosny
Egyptian
More information about the luatex
mailing list