summaryrefslogtreecommitdiff
path: root/macros/luatex/latex/luacomplex/luacomplex.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/latex/luacomplex/luacomplex.tex')
-rw-r--r--macros/luatex/latex/luacomplex/luacomplex.tex53
1 files changed, 37 insertions, 16 deletions
diff --git a/macros/luatex/latex/luacomplex/luacomplex.tex b/macros/luatex/latex/luacomplex/luacomplex.tex
index 04bf4176a0..f7b38ac1a2 100644
--- a/macros/luatex/latex/luacomplex/luacomplex.tex
+++ b/macros/luatex/latex/luacomplex/luacomplex.tex
@@ -1,5 +1,5 @@
\documentclass{article}
-\usepackage{listings,color,booktabs,longtable,array,hyperref,multicol,framed}
+\usepackage{listings,color,booktabs,longtable,array,hyperref,multicol,framed,luacomplex}
\usepackage[ top=1in, bottom = 1in, left=1in, right=1in]{geometry}
\hypersetup{colorlinks,urlcolor=blue}
\lstset{frame=none,
@@ -20,7 +20,7 @@
\usepackage[backend=bibtex]{biblatex}
\begin{document}
\title{The luacomplex Package in LaTeX}
-\author{Chetan Shirore and Ajit Kumar}
+\author{Chetan Shirore\thanks{Email id: mathsbeauty@gmail.com} \space and Ajit Kumar}
\maketitle
\section{Introduction}\label{section:introduction}
The \verb|luacomplex| package is developed to define complex numbers and perform basic arithmetic on complex numbers in LaTeX. It also loads the \texttt{luamaths} package. It provides an easy way to define complex numbers and perform operations on complex numbers. The package has no particular environment for performing operations on complex numbers. The package commands can be used in any environment (including the mathematics environment). It is written in Lua, and the tex file is to be compiled with the LuaLatex engine. The time required for operations on complex numbers 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. It may also save users' efforts to copy complex numbers from other software (which may not be in latex-compatible format) and to use them in a tex file.
@@ -149,11 +149,12 @@ The package has a command \verb|\imgUnit| which provides typesetting for the ima
\section{Examples and Usage}
-The latex document (Listing: \ref{code:illluacomplex}) makes use of various commands in \verb|luacomplex| package.
+The latex document (Listing: \ref{code:illluacomplex}) makes use of various commands in \verb|luacomplex| package.
\begin{lstlisting}[label={code:illluacomplex}, caption={LaTeX document with luacomplex package}]
\documentclass{article}
\usepackage{luacomplex}
\begin{document}
+\renewcommand{\imgUnit}{\mathrm{i}}
\cpxNew{a}{3,4}
\cpxNew{b}{1,3}
\(a=\cpxPrint{a}\) \\
@@ -180,21 +181,41 @@ The latex document (Listing: \ref{code:illluacomplex}) makes use of various com
\(p = prinArg(a) =\mathRound{\cpxPrint{p}}{4}\)
\end{document}
\end{lstlisting}
-This latex document (listing: \ref{code:illluacomplex}) outputs the following on compiling with the LuaLaTeX engine.
+
+This latex document (listing: \ref{code:illluacomplex}) outputs the following on compiling with the LuaLaTeX engine. \\
+\cpxNew{a}{3,4}
+\cpxNew{b}{1,3}
+
+ \begin{minipage}{0.4\textwidth}
\begin{framed}
-\noindent\(a = 3 + 4i\)\\
-\(b = 1 + 3i\)\\
-\(c = a + b = 4 + 7i\)\\
-\(d=a-b=2+i\)\\
-\(e = a.b = -9 + 13i\)\\
-\(f = ab = 1.5 - 0.5i\)\\
-\(g = a1 = 0.12 - 0.16i\)\\
-\(h = Re(a) = 3\)\\
-\(j = Im(a) = 4\)\\
-\(m = |a| = 25\)\\
-\(n =a+bc-d= -16 + 22i\)\\
-\(p = prinArg(a) = 0.9273\)
+\noindent\(a=\cpxPrint{a}\) \\
+\(b=\cpxPrint{b}\) \\
+\cpxAdd{c}{a}{b}
+\(c=a+b=\cpxPrint{c}\) \\
+\cpxSub{d}{a}{b}
+\(d=a-b=\cpxPrint{d}\) \\
+\cpxMul{e}{a}{b}
+\(e=a.b=\cpxPrint{e}\) \\
+\cpxDiv{f}{a}{b}
+\(f=\frac{a}{b}=\cpxPrint{f}\)
+\end{framed}
+\end{minipage}
+\begin{minipage}{0.4\textwidth}
+\begin{framed}
+\cpxInv{g}{a}
+\(g=\frac{1}{a}=\cpxPrint{g}\) \\
+\cpxRe{h}{a}
+\(h=Re(a)=\cpxPrint{h}\) \\
+\cpxIm{j}{a}
+\(j=Im(a)=\cpxPrint{j}\) \\
+\cpxMod{m}{a}
+\(m=|a|=\cpxPrint{m}\) \\
+\cpxOp{n}{a+b*c-d}
+\(n=a+bc-d=\cpxPrint{n}\) \\
+\cpxPrinArg{p}{a}
+\(p = prinArg(a) =\mathRound{\cpxPrint{p}}{4}\)
\end{framed}
+\end{minipage} \\
The package can be modified or extended by adding custom Lua programs.