In this question / answer : one pass verbatim latex material to lua, but latex displays this material by him self. If one suppress the two lines :
local buf_without_end = mybuf:gsub("\\end{foobar}\n","")
print(string.format("Lua: %q", buf_without_end))
the material doesn't disapear. I'd like to modify this material using lua code and display it after.
\documentclass{beamer}
\usepackage{luacode,tikz}
\directlua{dofile("verb.lua")}
\newenvironment{LuaVerb}{%
\directlua{start_recording()}}{%
\directlua{stop_recording()}
}
\begin{document}
\begin{frame}
% pass the material to lua
\begin{LuaVerb}
hello word
\end{LuaVerb}
% use of this material, but with or witout this line
% the material is displayed
%\directlua{print_recording()}
\end{frame}
\end{document}
verb.lua
tp = tex.print
mybuf = ""
function readbuf( buf )
mybuf = mybuf .. buf .. "\n"
end
function start_recording()
luatexbase.add_to_callback('process_input_buffer', readbuf, 'readbuf')
end
function stop_recording()
luatexbase.remove_from_callback('process_input_buffer', 'readbuf')
end
function print_recording()
local buf_without_end = mybuf:gsub("\\end{LuaVerb}\n","")
print(string.format("Lua: %q", buf_without_end))
mybuf = ""
end
tex.print(mybuf)is followed an Omega ??? – Tarass Oct 16 '14 at 18:45TL 2013, so maybe this issue is fixed in recentbeamer. Do you mean thatomegacharacter is added afterHello world? – michal.h21 Oct 16 '14 at 18:50\n. but it wanishes with loadingfontspec. It's normal I think. Thank you very much. – Tarass Oct 16 '14 at 18:57frame, but in aframethe LuaVerb text is not hidden. I had to store the latex material in LuaVerb outside theframeand then I can use it in theframe. – Tarass Oct 17 '14 at 07:05beamerprocess frame in a special way, because of overlays and similar fetures. the solution could be to use buffer reader to read whole document and parse the document for\begin/\end{LuaVerb}` to start/stop processing – michal.h21 Oct 17 '14 at 07:43