texlive[68050] Master/texmf-dist: luamaths (24aug23)
commits+karl at tug.org
commits+karl at tug.org
Thu Aug 24 22:18:55 CEST 2023
Revision: 68050
http://tug.org/svn/texlive?view=revision&revision=68050
Author: karl
Date: 2023-08-24 22:18:55 +0200 (Thu, 24 Aug 2023)
Log Message:
-----------
luamaths (24aug23)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/lualatex/luamaths/README.txt
trunk/Master/texmf-dist/doc/lualatex/luamaths/luamaths.pdf
trunk/Master/texmf-dist/doc/lualatex/luamaths/luamaths.tex
trunk/Master/texmf-dist/tex/lualatex/luamaths/luamaths-fractions.lua
trunk/Master/texmf-dist/tex/lualatex/luamaths/luamaths.sty
Modified: trunk/Master/texmf-dist/doc/lualatex/luamaths/README.txt
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/luamaths/README.txt 2023-08-24 20:18:43 UTC (rev 68049)
+++ trunk/Master/texmf-dist/doc/lualatex/luamaths/README.txt 2023-08-24 20:18:55 UTC (rev 68050)
@@ -1,5 +1,5 @@
# The luamaths package
-# version 1.4
+# version 1.5
# Authors: Chetan Shirore and Ajit Kumar
# Email: mathsbeauty at gmail.com
Modified: trunk/Master/texmf-dist/doc/lualatex/luamaths/luamaths.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/lualatex/luamaths/luamaths.tex
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/luamaths/luamaths.tex 2023-08-24 20:18:43 UTC (rev 68049)
+++ trunk/Master/texmf-dist/doc/lualatex/luamaths/luamaths.tex 2023-08-24 20:18:55 UTC (rev 68050)
@@ -1,7 +1,7 @@
\documentclass{article}
\renewcommand{\baselinestretch}{1.2}
\usepackage{float,listings,color,booktabs,longtable,array,hyperref,luamaths,amsmath,amssymb}
-\usepackage[top=1.1in, bottom=1.1in, left=1.1in, right=1.1in]{geometry}
+\usepackage[top=1in, bottom=1in, left=1.1in, right=1.1in]{geometry}
\hypersetup{colorlinks,urlcolor=blue}
\lstset{frame=none,
language=[LaTeX]{TeX},
@@ -190,6 +190,13 @@
\begin{lstlisting}
\complexRound{cx_num}{digits}
\end{lstlisting} & It rounds off a complex number to a specified number of decimal places.\\
+\midrule
+\begin{lstlisting}
+\luaChkeqnum
+\end{lstlisting} &
+\begin{lstlisting}
+\luaChkeqnum{x}{y}
+\end{lstlisting} & It returns true if x = y, otherwise returns false.\\
\bottomrule \\
@@ -333,6 +340,11 @@
\begin{lstlisting}
\complexRound{lcomplex(\mathPi,6)}{4}
\end{lstlisting} & \(\complexRound{lcomplex(\mathPi,6)}{4}\)\\
+\midrule
+
+\begin{lstlisting}
+\luaChkeqnum{\mathCos{0}}{1}
+\end{lstlisting} & \luaChkeqnum{\mathCos{0}}{1}\\
\bottomrule \\
\caption{Illustrations of commands in the luamaths package}
\label{tbl:illluamaths}
Modified: trunk/Master/texmf-dist/tex/lualatex/luamaths/luamaths-fractions.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/luamaths/luamaths-fractions.lua 2023-08-24 20:18:43 UTC (rev 68049)
+++ trunk/Master/texmf-dist/tex/lualatex/luamaths/luamaths-fractions.lua 2023-08-24 20:18:55 UTC (rev 68050)
@@ -1,9 +1,9 @@
-- The luafractions module
-- Authors: Chetan Shirore and Ajit Kumar
--- version 1.2, Date=21-Aug-2023
+-- version 1.3, Date=23-Aug-2023
-- Licensed under LaTeX Project Public License v1.3c or later. The complete license text is available at http://www.latex-project.org/lppl.txt.
-M = {} -- the module
+M = {} -- the module
frac_mt = {} -- the metatable
function M.new (n, d, mode)
mode = mode or 'fracs'
@@ -41,8 +41,11 @@
end
function M.toFnumber(c)
+if getmetatable( c ) == frac_mt then
return c.n / c.d
end
+return c
+end
function M.toFrac(x)
if type(x) == "number" then
@@ -216,6 +219,48 @@
return string.format("\\frac{%g}{%g}", c.n, c.d)
end
+
+function lnumChqEql(x, y)
+
+ if type(x) == "number" and type(y) == "number" then
+ return (x == y)
+ end
+
+ if getmetatable( x ) == frac_mt and getmetatable( y ) == frac_mt then
+ return (M.toFnumber(x) == M.toFnumber(y))
+ end
+
+ if type(x) == "number" and getmetatable( y ) == frac_mt then
+ return (M.toFnumber(y) == x)
+ end
+
+ if getmetatable( x ) == frac_mt and type(y) == "number" then
+ return (M.toFnumber(x) == y)
+ end
+
+ if getmetatable( x ) == complex_meta and getmetatable( y ) == complex_meta then
+ return M.toFnumber(x[1]) == M.toFnumber(y[1]) and M.toFnumber(x[2]) == M.toFnumber(y[2])
+ end
+
+ if type(x) == "number" and getmetatable( y ) == complex_meta then
+ return (M.toFnumber(y[1]) == x and M.toFnumber(y[2]) == 0)
+ end
+
+ if getmetatable(x) == complex_meta and type( y ) == "number" then
+ return (M.toFnumber(x[1]) == y and M.toFnumber(x[2]) == 0)
+ end
+
+ if getmetatable( x ) == frac_mt and getmetatable( y ) == complex_meta then
+ return (M.toFnumber(x)==M.toFnumber(y[1]) and M.toFnumber(y[2]) == 0)
+ end
+
+ if getmetatable( x ) == complex_meta and getmetatable( y ) == frac_mt then
+ return (M.toFnumber(y)==M.toFnumber(x[1]) and M.toFnumber(x[2]) == 0)
+ end
+
+ return false
+end
+
--Setting Metatable operations.
frac_mt.__add = M.add
frac_mt.__sub = M.sub
@@ -224,5 +269,6 @@
frac_mt.__unm = minusFracs
frac_mt.__pow = powerFracs
frac_mt.__tostring = M.tostring
+frac_mt.__eq = lnumChqEql
return M
\ No newline at end of file
Modified: trunk/Master/texmf-dist/tex/lualatex/luamaths/luamaths.sty
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/luamaths/luamaths.sty 2023-08-24 20:18:43 UTC (rev 68049)
+++ trunk/Master/texmf-dist/tex/lualatex/luamaths/luamaths.sty 2023-08-24 20:18:55 UTC (rev 68050)
@@ -1,9 +1,9 @@
% The luamaths package
-% version 1.4
+% version 1.5
% 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{luamaths}[1.4]
+\ProvidesPackage{luamaths}[1.5]
\RequirePackage{xkeyval}
\RequirePackage{amsmath}
\RequirePackage{luacode}
@@ -50,6 +50,10 @@
}%
}%
\newcommand{\imUnit}{\mathrm{i}}
-
+\newcommand\luaChkeqnum[2]{%
+\directlua{%
+tex.sprint(tostring(lnumChqEql(#1,#2)))%
+}%
+}
\endinput
More information about the tex-live-commits
mailing list.