summaryrefslogtreecommitdiff
path: root/macros/luatex/latex/luamaths/luamaths.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-08-04 03:01:07 +0000
committerNorbert Preining <norbert@preining.info>2023-08-04 03:01:07 +0000
commit319c90e45fc96ba6f15edcf00b24e484d9d92f2b (patch)
tree7011e82643aff6842597d83574783a350142063c /macros/luatex/latex/luamaths/luamaths.sty
parent63c1aaa794cb47fe36ebe8010257ec8ad322efbb (diff)
CTAN sync 202308040301
Diffstat (limited to 'macros/luatex/latex/luamaths/luamaths.sty')
-rw-r--r--macros/luatex/latex/luamaths/luamaths.sty24
1 files changed, 19 insertions, 5 deletions
diff --git a/macros/luatex/latex/luamaths/luamaths.sty b/macros/luatex/latex/luamaths/luamaths.sty
index c3bc4d51e0..524b36a210 100644
--- a/macros/luatex/latex/luamaths/luamaths.sty
+++ b/macros/luatex/latex/luamaths/luamaths.sty
@@ -1,19 +1,25 @@
-% luaset package
-% version 1.0
-% Authors: Chetan Shirore and Ajit Kumar
+% The luamaths package
+% version 1.1
% Licensed under LaTeX Project Public License v1.3c or later. The complete license text is available at http://www.latex-project.org/lppl.txt.
+%Authors: Chetan Shirore and Ajit Kumar
-\ProvidesPackage{luaset}[1.0]
+\ProvidesPackage{luamaths}[1.1]
\RequirePackage{xkeyval}
\RequirePackage{amsmath}
\RequirePackage{luacode}
\begin{luacode*}
+local complex = require "luamaths-complex"
+local lfrac = require "luamaths-fractions"
+
function mathop(...)
inf = math.huge
return ...
end
function mathround(num, numDecimalPlaces)
+ if num==math.floor(num) then
+ return math.floor(num)
+ end
local mult = 10^(numDecimalPlaces or 0)
return math.floor(num * mult + 0.5) / mult
end
@@ -27,7 +33,7 @@ end
\newcommand\mathCos[1]{\directlua{tex.sprint(math.cos(#1))}}
\newcommand\mathExp[1]{\directlua{tex.sprint(math.exp(#1))}}
\newcommand\mathFloor[1]{\directlua{tex.sprint(math.floor(#1))}}
-\newcommand\mathHuge{\directlua{tex.sprint(math.huge)}}
+\newcommand\mathInf{\directlua{tex.sprint(math.huge)}}
\newcommand\mathLog[1]{\directlua{tex.sprint(math.log(#1))}}
\newcommand\mathMax[1]{\directlua{tex.sprint(math.max(#1))}}
\newcommand\mathMin[1]{\directlua{tex.sprint(math.min(#1))}}
@@ -38,4 +44,12 @@ end
\newcommand\mathTan[1]{\directlua{tex.sprint(math.tan(#1))}}
\newcommand\mathRad[1]{\directlua{tex.sprint(math.rad(#1))}}
\newcommand\mathRound[2]{\directlua{tex.sprint(mathround(#1,#2))}}
+\newcommand\complexRound[2]{%
+\directlua{%
+tex.sprint(complex.tostring(complex.round(#1,#2)))
+}%
+}%
+\newcommand{\imUnit}{\mathrm{i}}
+
+
\endinput