diff options
author | Karl Berry <karl@freefriends.org> | 2023-08-24 20:18:55 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-08-24 20:18:55 +0000 |
commit | 0ab5364487abae2cfc92885db195801226d9b7dd (patch) | |
tree | 22d94b6a5bb7466efae586c202915b19cc6b6eda /Master/texmf-dist | |
parent | a5560f51ecbc195d32584aa363b0bbb89c1f483f (diff) |
luamaths (24aug23)
git-svn-id: svn://tug.org/texlive/trunk@68050 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/lualatex/luamaths/README.txt | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/luamaths/luamaths.pdf | bin | 146010 -> 146829 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/luamaths/luamaths.tex | 14 | ||||
-rw-r--r-- | Master/texmf-dist/tex/lualatex/luamaths/luamaths-fractions.lua | 50 | ||||
-rw-r--r-- | Master/texmf-dist/tex/lualatex/luamaths/luamaths.sty | 10 |
5 files changed, 69 insertions, 7 deletions
diff --git a/Master/texmf-dist/doc/lualatex/luamaths/README.txt b/Master/texmf-dist/doc/lualatex/luamaths/README.txt index a4a7a334fd3..30ceca23014 100644 --- a/Master/texmf-dist/doc/lualatex/luamaths/README.txt +++ b/Master/texmf-dist/doc/lualatex/luamaths/README.txt @@ -1,5 +1,5 @@ # The luamaths package -# version 1.4 +# version 1.5 # Authors: Chetan Shirore and Ajit Kumar # Email: mathsbeauty@gmail.com diff --git a/Master/texmf-dist/doc/lualatex/luamaths/luamaths.pdf b/Master/texmf-dist/doc/lualatex/luamaths/luamaths.pdf Binary files differindex 13ecb392afa..5713dfa7de5 100644 --- a/Master/texmf-dist/doc/lualatex/luamaths/luamaths.pdf +++ b/Master/texmf-dist/doc/lualatex/luamaths/luamaths.pdf diff --git a/Master/texmf-dist/doc/lualatex/luamaths/luamaths.tex b/Master/texmf-dist/doc/lualatex/luamaths/luamaths.tex index 3cb499b88c8..81b58f95115 100644 --- a/Master/texmf-dist/doc/lualatex/luamaths/luamaths.tex +++ b/Master/texmf-dist/doc/lualatex/luamaths/luamaths.tex @@ -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 @@ Table \ref{tbl:opluamaths} lists operations in the \verb|luamaths| package. \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 @@ Table \ref{tbl:illluamaths} illustrates operations in the \verb|luamaths| packag \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} diff --git a/Master/texmf-dist/tex/lualatex/luamaths/luamaths-fractions.lua b/Master/texmf-dist/tex/lualatex/luamaths/luamaths-fractions.lua index f13d3352456..6900b25ec4e 100644 --- a/Master/texmf-dist/tex/lualatex/luamaths/luamaths-fractions.lua +++ b/Master/texmf-dist/tex/lualatex/luamaths/luamaths-fractions.lua @@ -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 @@ function M.simp (num) 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 @@ function M.tostring (c) 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.__div = M.div 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 diff --git a/Master/texmf-dist/tex/lualatex/luamaths/luamaths.sty b/Master/texmf-dist/tex/lualatex/luamaths/luamaths.sty index 1f6bf1ade06..48c285b61b0 100644 --- a/Master/texmf-dist/tex/lualatex/luamaths/luamaths.sty +++ b/Master/texmf-dist/tex/lualatex/luamaths/luamaths.sty @@ -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 @@ tex.sprint(complex.tostring(complex.round(#1,#2))) }% }% \newcommand{\imUnit}{\mathrm{i}} - +\newcommand\luaChkeqnum[2]{% +\directlua{% +tex.sprint(tostring(lnumChqEql(#1,#2)))% +}% +} \endinput |