[luatex] Line breaks

Dirk Laurie dpl at sun.ac.za
Sat Feb 19 17:11:58 CET 2011


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. ]]}
> tex.print(text)

is not similarly effective.  
 
I have tried a workaround using a "detokenize" function
written in Lua, which is almost effective: there is a mysterious
extra 3 in the PDF file.

I attach files xxx.tex, ex1.tex, ex2.lua, xxx.pdf, the last made
by lualatex 0.65.

The output of "pdftotext xxx.pdf" is also surprising.

Dirk




-------------- next part --------------
A non-text attachment was scrubbed...
Name: xxx.tex
Type: text/x-tex
Size: 105 bytes
Desc: not available
URL: <http://tug.org/pipermail/luatex/attachments/20110219/a87ed9dc/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ex1.tex
Type: text/x-tex
Size: 108 bytes
Desc: not available
URL: <http://tug.org/pipermail/luatex/attachments/20110219/a87ed9dc/attachment-0001.bin>
-------------- next part --------------
function detokenize(text)
    text=string.gsub(text,"\n%s*\n+","\\par ")
    return string.gsub(text,"\n",' ')
    end

text = [[
This is a paragraph
with some lines.

This is another paragraph,
separated from the first
by a blank line. ]]
tex.print(detokenize(text))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xxx.pdf
Type: application/pdf
Size: 16064 bytes
Desc: not available
URL: <http://tug.org/pipermail/luatex/attachments/20110219/a87ed9dc/attachment.pdf>


More information about the luatex mailing list