[luatex] writing to tex stream

Wolfgang Schuster schuster.wolfgang at googlemail.com
Sat Oct 15 13:42:51 CEST 2011

Am 15.10.2011 um 03:10 schrieb Frank Kuehnel:

> Is there any documentation on how to write to a custom defined output-stream?
> I couldn't find any help on how to set up an output stream defined in tex and used
> in lua, i.e
> \newwrite\xmlfile
> \immediate\openout\xmlfile=test.xml
> \immediate\write\xmlfile{<?xml version="1.0"?>}
> \directlua{
> 	tex.print(... ???
> }
> Thanks for your help,

Use Lua to open a file and write into the file, i wrote short example in ConTeXt to show you how it can be done.


export = io.open("test.xml","wb")

function writexml(str)




\writexml{<?xml version="1.0"?>}



More information about the luatex mailing list