|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
-- This file:
-- https://anggtwu.net/LATEX/2026logica-para-pessoas.lua.html
-- https://anggtwu.net/LATEX/2026logica-para-pessoas.lua
-- (find-angg "LATEX/2026logica-para-pessoas.lua")
-- Author: Eduardo Ochs <eduardoochs@gmail.com>
--
-- (defun e () (interactive) (find-LATEX "2025-2-C2-example-6.tex"))
-- (defun e () (interactive) (find-LATEX "2026logica-para-pessoas.tex"))
-- (defun l () (interactive) (find-LATEX "2026logica-para-pessoas.lua"))
-- «.anchors» (to "anchors")
bigstr = [==[
\L {((6x^3)(7x^4))'}
\R {\L {\ddx((6x^3)(7x^4))}}
\R { (6x^3)\ddx(7x^4) + (7x^4) \L {\ddx(6x^3)} }
(6x^3)\ddx(7x^4) + (7x^4) · \R {6 · \L {\ddx x^3}}
(6x^3)\ddx(7x^4) + (7x^4) · \L {6 · \R {3 x^2}}
(6x^3) \L {\ddx(7x^4)} + (7x^4) \R{(18x^2)}
(6x^3)·\R {7 \L {\ddx x^4}} + (7x^4)(18x^2)
(6x^3)·\L {7·\R {4x^3}} + (7x^4)(18x^2)
(6x^3) \R{(28x^3)} + \L {(7x^4)(18x^2)}
\L {(6x^3)(28x^3)} + \R {126x^6}
\L {\R {168x^6} + 126x^6}
\R {294x^6}
]==]
n = 0
substL = function (str)
local f = function (body) return format("\\luastandout {L%s} %s", n, body) end
return (str:gsub("\\L%s*(%b{})", f))
end
substR = function (str)
local f = function (body) return format("\\luastandout {R%s} %s", n-1, body) end
return (str:gsub("\\R%s*(%b{})", f))
end
defE = function (str)
return format("\\sa {E%d} {\\luastandout {E%d} {%s}}", n, n, str)
end
--[[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "2026logica-para-pessoas.lua"
lines = VTable(splitlines(bigstr))
for i,line in ipairs(lines) do
n = i
print(defE(substR(substL(bitrim(line)))))
end
--]]
-- «anchors» (to ".anchors")
-- (find-es "lua5" "string.byte")
tabify = function (nspaces)
local tabs = ""
while nspaces > 1 do tabs=tabs.."\t"; nspaces=nspaces-8 end
return tabs
end
tabify_tag = function (tag)
local str0 = format("%% <.%s>", tag)
local str1 = format("%% «.%s»", tag)
local str3 = format("(to \"%s\")", tag)
local nspaces = 33 - #str0
local str2 = tabify(nspaces)
return str1..str2..str3
end
--[[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "2026logica-para-pessoas.lua"
bigstr = ee_readfile "~/LATEX/2026logica-para-pessoas.tex"
pat = "\194?\171([!-~]+)\194?\187"
for a in bigstr:gmatch(pat) do
if a:match("^[^.]") then print(tabify_tag(a)) end
end
= tabify_tag("a")
= foo
= #foo
--]]
-- Local Variables:
-- coding: utf-8-unix
-- End: