Hi list, I am trying to use luarepl with LuaLaTeX, but I am stuck at what seems to be a standard problem, and I can't figure out from these docs (I'm on Debian)
/usr/share/doc/texlive-luatex/luatex/luatexbase/luatexbase-loader.pdf /usr/share/doc/texlive-luatex/luatex/luatexbase/luatexbase-modutils.pdf how to make LuaLaTeX's "require" behave as the one in standard Lua 5.1... Here is a self-contained test. --snip--snip-- # Download luarepl-0.5 and untar it into /tmp/lua-repl-0.5/ cd /tmp/ wget https://github.com/hoelzro/lua-repl/archive/0.5.tar.gz tar -C /tmp/ -xvzf /tmp/0.5.tar.gz # Create /tmp/myrepl.lua cat > /tmp/myrepl.lua <<'%%%' repldir = "/tmp/lua-repl-0.5/" package.path = "" package.path = repldir.."?/init.lua;"..package.path package.path = repldir.."?.lua;" ..package.path repl = require "repl" sync = require "repl.sync" function sync:showprompt(p) io.write(p == ">" and ">>> " or ">>>> ") end function sync:lines() return io.stdin:lines() end function sync:displayerror(err) print(err) end function sync:displayresults(results) if results.n == 0 then return end print(unpack(results, 1, results.n)) end sync:run() %%% # Create /tmp/myrepl.tex cat > /tmp/myrepl.tex <<'%%%' \documentclass{book} \begin{document} \directlua{dofile "myrepl.lua"} \end{document} %%% --snip--snip-- Now if we run "export LUA_INIT=; lua5.1 /tmp/myrepl.lua" everything works, and we get luarepl's prompt, which is ">>> ". Note that I am using "export LUA_INIT=" and "package.path = ''"; this is just to make the behavior of the test more predictable. However, if I run "cd /tmp/; lulatext myrepl.tex" it fails with: This is LuaTeX, Version beta-0.70.2-2012070301 (TeX Live 2012/Debian) restricted \write18 enabled. (./myrepl.tex LaTeX2e <2011/06/27> LuaTeX adaptation of babel <v3.8m-luatex-1.5> and hyphenation patterns for english, dumylang, nohyphenation, loaded. (/usr/share/texlive/texmf-dist/tex/latex/base/book.cls Document Class: book 2007/10/19 v1.4h Standard LaTeX document class (/usr/share/texlive/texmf-dist/tex/latex/base/bk10.clo)) (./myrepl.aux) ! LuaTeX error myrepl.lua:5: module 'repl' not found: no field package.preload['repl'] [kpse lua searcher] file not found: 'repl' [kpse C searcher] file not found: 'repl' stack traceback: [C]: in function 'require' myrepl.lua:5: in main chunk [C]: in function 'dofile' <\directlua >:1: in main chunk. l.3 \directlua{dofile "myrepl.lua"} Help, please! =( Any pointers welcome... Cheers, Eduardo Ochs http://angg.twu.net/
