texlive[65376] Master: luaset (27dec22)

commits+karl at tug.org commits+karl at tug.org
Tue Dec 27 22:26:24 CET 2022


Revision: 65376
          http://tug.org/svn/texlive?view=revision&revision=65376
Author:   karl
Date:     2022-12-27 22:26:23 +0100 (Tue, 27 Dec 2022)
Log Message:
-----------
luaset (27dec22)

Modified Paths:
--------------
    trunk/Master/tlpkg/bin/tlpkg-ctan-check
    trunk/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/lualatex/luaset/
    trunk/Master/texmf-dist/doc/lualatex/luaset/README.txt
    trunk/Master/texmf-dist/doc/lualatex/luaset/luaset.pdf
    trunk/Master/texmf-dist/doc/lualatex/luaset/luaset.tex
    trunk/Master/texmf-dist/tex/lualatex/luaset/
    trunk/Master/texmf-dist/tex/lualatex/luaset/luaset.sty
    trunk/Master/tlpkg/tlpsrc/luaset.tlpsrc

Added: trunk/Master/texmf-dist/doc/lualatex/luaset/README.txt
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/luaset/README.txt	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/lualatex/luaset/README.txt	2022-12-27 21:26:23 UTC (rev 65376)
@@ -0,0 +1,19 @@
+# Introduction
+The luaset package is developed to define finite sets and perform operations on them inside LaTeX documents. 
+There is no particular environment in the package for performing set operations. 
+The package commands can be used in any environment (including the mathematics environment).
+It is written in Lua, and tex file is to be compiled with the LuaLatex engine.
+The time required for operations on sets is not an issue while compiling with the LuaLaTeX engine. 
+There is no need to install Lua on the users' system as tex distributions (TeXLive or MikTeX) come bundled with LuaLaTeX. 
+
+# License
+The luaset package is released under the LaTeX Project Public License v1.3c or later. 
+The complete license text is available at http://www.latex-project.org/lppl.txt. 
+It is developed in Lua. 
+Lua is available as a certified open-source software. 
+Its license is simple and liberal, which is compatible with GPL.
+
+#Installation and Inclusion
+The installation of luaset package is similar to plain latex package, where the .sty file is in LaTeX directory of texmf tree. 
+The package can be included with \usepackage{luaset} command in the preamble of the LaTeX document. 
+The TeX file is to be compiled using the LuaLaTeX engine. 
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/doc/lualatex/luaset/README.txt
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/lualatex/luaset/luaset.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/lualatex/luaset/luaset.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/luaset/luaset.pdf	2022-12-27 21:25:42 UTC (rev 65375)
+++ trunk/Master/texmf-dist/doc/lualatex/luaset/luaset.pdf	2022-12-27 21:26:23 UTC (rev 65376)

Property changes on: trunk/Master/texmf-dist/doc/lualatex/luaset/luaset.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/lualatex/luaset/luaset.tex
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/luaset/luaset.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/lualatex/luaset/luaset.tex	2022-12-27 21:26:23 UTC (rev 65376)
@@ -0,0 +1,230 @@
+\documentclass{article}
+\usepackage{listings,color,booktabs,longtable,array,hyperref,multicol,framed}
+\usepackage[ left=1in, right=1in]{geometry}
+\hypersetup{colorlinks,urlcolor=blue}
+\lstset{frame=none,
+	language=[LaTeX]{TeX},
+  aboveskip=3mm,
+  belowskip=3mm,
+  showstringspaces=false,
+  columns=flexible,
+  basicstyle={\ttfamily},
+  numbers=none,
+  numberstyle=\tiny\color{gray},
+  stringstyle=\color{mauve},
+  breaklines=true,
+  breakatwhitespace=true,
+  tabsize=1
+}
+\usepackage[backend=bibtex]{biblatex}
+\begin{document}
+\title{The luaset Package in LaTeX}
+\author{Chetan Shirore and Dr. Ajit Kumar}
+\maketitle
+\section{Introduction}\label{section:introduction}
+The \verb|luaset| package is developed to define finite sets and perform operations on finite sets inside LaTeX documents. There is no particular environment in the package for performing set operations. The package commands can be used in any environment (including the mathematics environment). It is written in Lua, and tex file is to be compiled with the LuaLaTeX engine. The time required for performing set operations is not an issue while compiling with LuaLaTeX. There is no need to install Lua on the users' system as tex distributions (TeXLive or MikTeX) come bundled with LuaLaTeX. The package is helps to perform set operations (union, intersection, difference, etcetera) in LaTeX documents. It may also save the users' efforts to copy sets from other software (which may not be in LaTeX compatible format) and to use them in a tex file. The package supports the nesting of commands for multiple operations. 
+
+\section{Installation and License}
+
+The installation of the \verb|luaset| package is similar to plain latex package, where the \texttt{.sty} file is in LaTeX directory of texmf tree. The package can be included with \verb|\usepackage{luaset}| command in the preamble of the LaTeX document. The TeX file is to be compiled using the LuaLaTeX engine.
+
+The \verb|luaset| package is released under the LaTeX Project Public License v1.3c or later. The complete license text is available at \url{http://www.latex-project.org/lppl.txt}. It is developed in Lua.  Lua is available as a certified open-source software. Its license is simple and liberal, which is compatible with GPL. Questions on  \url{https://tex.stackexchange.com} inspired a small part of the development of this package. The content on this site is available under the \verb|CC BY-SA| license. It also loads the \verb|luamaths| package, which is available under the LaTeX Project Public License v1.3c or later. This package is loaded to use the standard mathematical functions and computations on real numbers while performing operations on sets.
+
+\subsection{Defining and Displaying Sets}
+A set can be defined by using the \verb|\luaSetNew| command.
+\begin{lstlisting}
+\luaSetNew{name}{set}
+\end{lstlisting}
+The following commands define sets \( A \) and \(B \).
+\begin{lstlisting}
+\luaSetNew{A}{a,b,c,10,d,10,a,30}
+\luaSetNew{B}{d,e,f,10,20}
+\end{lstlisting}
+The set can be displayed or printed by using the \verb|\luaSetPrint| command.
+\begin{lstlisting}
+\luaSetPrint{name of set}
+\end{lstlisting}
+ For example, the following commands
+ \begin{lstlisting}
+\(A = \luaSetPrint{A}\) \\
+\(B = \luaSetPrint{B}\)
+\end{lstlisting}
+output to
+\begin{framed}
+\noindent \(A = \{10, 30, a, b, c, d\}\) \\
+\(B = \{10, 20, d, e, f\}\)
+\end{framed}
+The standard mathematical functions can also be used. 
+\subsection{Commands in the luaset package}
+Table \ref{tbl:opluaset} summarises commands in the \verb|luaset| package.
+\begin{center}
+\begin{longtable}{llm{5cm}}
+\toprule
+\multicolumn{1}{c}{\textcolor{blue}{Function}} & \multicolumn{1}{c}{\textcolor{blue}{Command Format}} & \multicolumn{1}{c}{\textcolor{blue}{Description}}  \\
+\toprule
+\begin{lstlisting}
+\luaSetUnion
+\end{lstlisting} &
+\begin{lstlisting}
+\luaSetUnion{set}{set1}{set2}
+\end{lstlisting} & Defines the new set as a union of set1 and set2. \\
+\midrule
+\begin{lstlisting}
+\luaSetIntersection
+\end{lstlisting} &
+\begin{lstlisting}
+\luaSetIntersection{set}{set1}{set2}
+\end{lstlisting} & Defines the new set as an intersection of set1 and set2. \\
+\midrule
+\begin{lstlisting}
+\luaSetDifference
+\end{lstlisting} &
+\begin{lstlisting}
+\luaSetDifference{set}{set1}{set2}
+\end{lstlisting} & Defines the new set as a difference of set1 and set2. \\
+\midrule
+\begin{lstlisting}
+\luaSetCardinal
+\end{lstlisting} &
+\begin{lstlisting}
+\luaSetCardinal{set}
+\end{lstlisting} & Gives the cardinality of a set (number of elements). \\
+\midrule
+\begin{lstlisting}
+\luaSetBelongsto
+\end{lstlisting} &
+\begin{lstlisting}
+\luaSetBelongsto{element}{set}
+\end{lstlisting} & Returns true if an element is in a set; otherwise, it returns false.\\
+\midrule
+\begin{lstlisting}
+\luaSetSubseteq
+\end{lstlisting} &
+\begin{lstlisting}
+\luaSetSubseteq{set1}{set2}
+\end{lstlisting} & Returns true if set1 is a subset of set2; otherwise, it returns false. \\
+\midrule
+\begin{lstlisting}
+\luaSetSubset
+\end{lstlisting} &
+\begin{lstlisting}
+\luaSetSubset{set1}{set2}
+\end{lstlisting} & Returns true if set1 is  a proper subset of set2; otherwise, it returns false. \\
+\midrule
+\begin{lstlisting}
+\luaSetEqual
+\end{lstlisting} &
+\begin{lstlisting}
+\luaSetEqual{set1}{set2}
+\end{lstlisting} & Returns true if set1 is equal to set2; otherwise, it returns false. \\ 
+\bottomrule
+\caption{Commands in the luaset package}
+\label{tbl:opluaset}
+\end{longtable}
+\end{center}
+\subsection{Examples and Usage}
+The latex document (Listing: \ref{code:illluaset}) uses various commands in the \verb|luaset| package.
+\begin{lstlisting}[label={code:illluaset}, caption={LaTeX document with luaset package}]
+\documentclass{article}
+\usepackage{luaset,parskip}
+\begin{document}
+\luaSetNew{A}{a,b,c,\mathCos{0},d,10,a,30}
+\luaSetNew{B}{d,e,f,10,20}
+\luaSetUnion{C}{A}{B}
+\luaSetIntersection{D}{A}{B}
+\luaSetDifference{E}{A}{B}
+\luaSetDifference{F}{B}{A}
+\(A = \luaSetPrint{A}\)  % printing set A
+
+\(B = \luaSetPrint{B}\)  % printing set B
+
+\(C = A \cup B = \luaSetPrint{C}\)  % printing set C
+
+\(D = A\cap B = \luaSetPrint{D}\)  % printing set D
+
+\(E = A-B = \luaSetPrint{E}\)  % printing set E
+
+\(F = B-A = \luaSetPrint{F}\)  % printing set F
+
+The Cardinality of set \(A\) is \luaSetCardinal{A}.
+
+It is \luaSetSubseteq{A}{B} that \(A \subseteq B \).
+
+It is \luaSetSubseteq{A}{C} that \(A \subseteq C \).
+
+It is \luaSetSubset{A}{B} that \(A \subset B \).
+
+It is \luaSetSubset{A}{C} that \(A \subset C \).
+
+\luaSetIntersection{G}{C}{A}
+
+\(G = C \cap A = \luaSetPrint{G}\)  % printing set G
+
+It is \luaSetEqual{A}{B} that \(A=B \).
+
+It is \luaSetEqual{G}{A} that \(G=A \).
+
+It is \luaSetBelongsto{z}{A} that \(z \in A \).
+
+It is \luaSetBelongsto{10}{A} that \(10 \in A \).
+
+\luaSetNew{S}{a,10,b,x,y,z,100,200}
+
+\(S = \luaSetPrint{S}\)  % printing set S
+
+
+\luaSetIntersection{H}{C}{S}
+\luaSetUnion{I}{D}{S}
+
+\(H = C \cap S = \luaSetPrint{H}\)  % printing set H
+
+\(I = D \cup S = \luaSetPrint{I}\)  % printing set I
+\end{document}
+\end{lstlisting}
+The latex document (Listing: \ref{code:illluaset})  generates the following output on the compilation.
+
+\begin{framed}
+
+\(A =  \{10, 30, 1.0, a, b, c, d\}\)  % printing set A
+
+\(B =\{10, 20, d, e, f\}\)  % printing set B
+
+\(C = A \cup B = \{10, 20, 30, 1.0, a, b, c, d, e, f\}\)  % printing set C
+
+\(D = A\cap B = \{10, d\}\)  % printing set D
+
+\(E = A-B =  \{30, 1.0, a, b, c\}\)  % printing set E
+
+\(F = B-A = \{20, e, f\}\)  % printing set F
+
+The Cardinality of set \(A\) is 7.
+
+It is false that \(A \subseteq B \).
+
+It is true that \(A \subseteq C \).
+
+It is false that \(A \subset B \).
+
+It is true  that \(A \subset C \).
+
+\(G = C \cap A = \{10, 30, 1.0, a, b, c, d\}\)  % printing set G
+
+It is false that \(A=B \).
+
+It is true that \(G=A \).
+
+It is false that \(z \in A \).
+
+It is true that \(10 \in A \).
+
+\(S = \{10, 100, 200, a, b, x, y, z\}\)  % printing set S
+
+\(H = C \cap S = \{10, a, b\}\)  % printing set H
+
+\(I = D \cup S = \{10, 100, 200, a, b, d, x, y, z\}\)  % printing set I
+\end{framed}
+
+
+The luaset package can be modified or extended by adding custom Lua programs. Advanced users acquainted with Lua can do so.
+
+\end{document}


Property changes on: trunk/Master/texmf-dist/doc/lualatex/luaset/luaset.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/lualatex/luaset/luaset.sty
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/luaset/luaset.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/lualatex/luaset/luaset.sty	2022-12-27 21:26:23 UTC (rev 65376)
@@ -0,0 +1,142 @@
+% luaset package
+% version 1.0
+% Authors: Chetan Shirore and Ajit Kumar
+% Licensed under LaTeX Project Public License v1.3c or later. The complete license text is available at http://www.latex-project.org/lppl.txt.
+
+
+\ProvidesPackage{luaset}[1.0]
+\RequirePackage{xkeyval}
+\RequirePackage{amsmath}
+\RequirePackage{luacode}
+\RequirePackage{luamaths}
+\begin{luacode*}
+sets = {}
+Set = {} 
+local mt = {
+    __tostring = function(self)
+        return "\\{" .. table.concat(table.sortedkeys(self), ", ") .. "\\}"
+    end
+}
+
+function Set.new(str)
+    str = str or ""
+    local set = {}
+    for v in utilities.parsers.iterator(str) do
+        set[v] = true
+    end
+    return setmetatable(set, mt)
+end
+
+function Set.union (a, b)
+        local union = {}
+        for k in pairs(a) do union[k] = true end
+        for k in pairs(b) do union[k] = true end
+        return setmetatable(union, mt)
+      end
+
+function Set.intersection (a, b)
+        local intersection = {}
+        for k in pairs(a) do
+          intersection[k] = b[k]
+            end
+        return setmetatable(intersection, mt)
+        end
+
+function Set.difference (a, b)
+        local difference = {}
+        for k in pairs(a) do
+        if b[k]~= true then
+          difference[k] = true
+        end
+        end
+         setmetatable(difference, mt)
+        return difference
+      end
+
+function Set.cardinal (a)
+        local len = 0
+        for k in pairs(a) do
+          len = len + 1
+          end
+        return len
+      end
+
+function Set.subseteq(a, b)
+        for k in pairs(a) do
+          if not b[k] then return false end
+        end
+        return true
+    end
+
+function Set.subset (a, b)
+        return Set.subseteq(a, b)  and not (Set.subseteq(b, a) )
+    end
+
+    function Set.equal (a, b)
+        return Set.subseteq(a, b)  and  (Set.subseteq(b, a) )
+    end
+
+
+function Set.belongsto (x, s)
+        if s[x] then
+        return true
+      else
+        return false
+        end
+    end
+
+\end{luacode*}
+
+\newcommand\luaSetNew[2]{%
+    \directlua{%
+        sets[\luastringN{#1}] = Set.new(\luastringN{#2})
+    }%
+}
+
+\newcommand\luaSetUnion[3]{%
+    \directlua{%
+        sets[\luastringN{#1}] = Set.union(sets[\luastringN{#2}],
+                                          sets[\luastringN{#3}])
+    }%
+}
+
+\newcommand\luaSetIntersection[3]{%
+    \directlua{%
+        sets[\luastringN{#1}] = Set.intersection(sets[\luastringN{#2}],
+                                          sets[\luastringN{#3}])
+    }%
+}
+
+\newcommand\luaSetDifference[3]{%
+    \directlua{%
+        sets[\luastringN{#1}] = Set.difference(sets[\luastringN{#2}],
+                                          sets[\luastringN{#3}])
+    }%
+}
+
+
+\newcommand\luaSetPrint[1]{%
+    \directlua{tex.sprint(tostring(sets[\luastringN{#1}]))}%
+}
+
+\newcommand\luaSetCardinal[1]{%
+    \directlua{tex.sprint(tostring(Set.cardinal(sets[\luastringN{#1}])))}%
+}
+
+\newcommand\luaSetSubseteq[2]{%
+    \directlua{tex.sprint(tostring(Set.subseteq(sets[\luastringN{#1}],sets[\luastringN{#2}])))}%
+}
+
+\newcommand\luaSetSubset[2]{%
+    \directlua{tex.sprint(tostring(Set.subset(sets[\luastringN{#1}],sets[\luastringN{#2}])))}%
+}
+
+\newcommand\luaSetEqual[2]{%
+    \directlua{tex.sprint(tostring(Set.equal(sets[\luastringN{#1}],sets[\luastringN{#2}])))}%
+}
+
+\newcommand\luaSetBelongsto[2]{%
+    \directlua{tex.sprint(tostring(Set.belongsto("#1",sets[\luastringN{#2}])))}%
+}
+
+\endinput


Property changes on: trunk/Master/texmf-dist/tex/lualatex/luaset/luaset.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2022-12-27 21:25:42 UTC (rev 65375)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2022-12-27 21:26:23 UTC (rev 65376)
@@ -515,7 +515,7 @@
     luamesh luamodulartables luamplib luaoptions luaotfload
     luapackageloader luaprogtable luapstricks
     luaquotes luarandom
-    luasseq luatex85 luatexbase luatexja luatexko luatextra
+    luaset luasseq luatex85 luatexbase luatexja luatexko luatextra
     luatodonotes luatruthtable luavlna luaxml
     lutabulartools lwarp lxfonts ly1 lyluatex
   macrolist macros2e macroswap mafr magaz magicnum magra

Modified: trunk/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc	2022-12-27 21:25:42 UTC (rev 65375)
+++ trunk/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc	2022-12-27 21:26:23 UTC (rev 65376)
@@ -58,6 +58,7 @@
 depend luaprogtable
 depend luaquotes
 depend luarandom
+depend luaset
 depend luatex85
 depend luatexbase
 depend luatexko

Added: trunk/Master/tlpkg/tlpsrc/luaset.tlpsrc
===================================================================


More information about the tex-live-commits mailing list.