Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
-- This file:
--   http://angg.twu.net/LUA/emaxima.lua.html
--   http://angg.twu.net/LUA/emaxima.lua
--           (find-angg "LUA/emaxima.lua")
-- Author: Eduardo Ochs <eduardoochs@gmail.com>
--
-- See: (find-angg ".emacs" "emaxima-conv")
--      (find-es "maxima" "emaxima")
--      (find-es "maxima" "savemaximasession-0")
-- Superseded by: (find-angg "LUA/Maxima1.lua")

bigstr = [==[
(%i4) integrate(x^2,x);
(%o4) {{x^3}\over{3}}
(%i5) diff(sin(x),x);
(%o5) \cos x
(%i6) diff(cos(x),x);
(%o6) -\sin x
]==]

convertline0 = function (li)
    local io,n,right = li:match("^%(%%([io])(%d+)%) (.*)$")
    PP(io, n, right)
  end

convertlines = function (bigstr)
    local out = {}
    local add = function (outli) table.insert(out, outli) end
    add("\\begin{maximasession}")
    add("\\maximaoutput*")
    for _,li in ipairs(splitlines(bigstr)) do
      local io,n,right = li:match("^%(%%([io])(%d+)%) (.*)$")
      if io then
	local outli = format("\\%s%s. %s \\\\", io, n, right)
        add(outli)
      else
        print("% Bad line: "..li)
      end
    end
    add("\\end{maximasession}")
    return table.concat(out, "\n")
  end

-- (find-fline "/tmp/emaxima-in")
-- (find-fline "/tmp/emaxima-out")
conv = function (fnamein, fnameout)
    local instr  = ee_readfile(fnamein or "/tmp/emaxima-in")
    local outstr = convertlines(instr)
    ee_writefile(fnamein or "/tmp/emaxima-out", outstr)
  end

--[[
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("emaxima.lisp");
load("/usr/share/emacs/site-lisp/maxima/emaxima.lisp");
display2d:'emaxima;
integrate(x^2,x);
diff(sin(x),x);
diff(cos(x),x);

--]]

--[[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "emaxima.lua"
for _,li in ipairs(splitlines(bigstr)) do
  convertline0(li)
end
= convertlines(bigstr)

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
lua51 -e "ee_dofile '~/LUA/emaxima.lua'; PP(convertline0) "
lua51 -e "ee_dofile '~/LUA/emaxima.lua'; conv()" && cat /tmp/emaxima-out

* (eepitch-sh)
* (eepitch-kill)
* (eepitch-sh)
lua5.1 -e "ee_dofile'~/LUA/emaxima.lua';conv()" && cat /tmp/emaxima-out



         


--]]




-- Local Variables:
-- coding:  utf-8-unix
-- End: