30. マーク シート 選択式問題における 数式処理の活用
fp - Fixed point arithmetic
https://ctan.org/pkg/fp
Copyright: 1994–1999 Michael Mehlich
Example:
usepackage{fp}
%%%%%%%%%%%%%%%%
FPsetx{-1}
FPsety{2}
FPaddzxy
$z = x + y = z$. % z=-1+2=1.000000000000000000.
The result $z$
FPifintz is an integer.
else is not an integer.
fi % The result z is an integer.
%%%%%%%%%%%%%%%% 30 / 46
35. マーク シート 選択式問題における 数式処理の活用
execMaxima() on LuaTEX
Lua の関数 io.popen() を 用いて Maxima を 呼び出す.
begin{luacode*}
function execMaxima(cmd)
local texcmd=echo 'tex1(..cmd..);' | maxima --very-quiet
local hdl=io.popen(texcmd, r)
local content=string.gsub(hdl:read(*all), n, )
hdl:close()
return content
end
end{luacode*}
35 / 46