Changes

Jump to navigation Jump to search
m
→‎Manipulating verbatim text for dummies: Slightly more clear explanation
content = table.concat(lines,'\n')
-- context.starttyping()
-- context(content)
-- context.stoptyping)
-- does not work.
tex.sprint("\\starttyping\n" .. content .. "\\stoptyping\n")
 
-- The typing environment looks for an explicit \type{\stoptyping}. So,
-- context.starttyping() context(content) context.stoptyping()
-- does not work. But
-- context.starttyping() context(content) tex.sprint("\\stoptyping")
-- does.
end
\stopluacode</texcode>
{\ctxlua{userdata.dedentedtyping(buffers.content('dedentedtyping'))}}</texcode>
Unlike MkII, where the contents of a buffer were written to an external file, in MkIV buffers are stored in memory. Thus, with luatex is really simple to manipulate verbatim text: write the text manipulating code in lua and pass the contents of the environment to the lua function using buffers.
 
= Conclusion =

Navigation menu