summaryrefslogtreecommitdiff
path: root/macros/luatex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-07-07 03:00:56 +0000
committerNorbert Preining <norbert@preining.info>2023-07-07 03:00:56 +0000
commit2178d699db60492a15e11c107f17da33543af865 (patch)
tree157f2907e3778e17df8a7e891bc276b83b444f48 /macros/luatex
parent97f4d34e17013b3239a49484afcb3d805ab09f38 (diff)
CTAN sync 202307070300
Diffstat (limited to 'macros/luatex')
-rw-r--r--macros/luatex/latex/luaplot/luaplot.pdfbin144774 -> 147391 bytes
-rw-r--r--macros/luatex/latex/luaplot/luaplot.sty42
-rw-r--r--macros/luatex/latex/luaplot/luaplot.tex11
3 files changed, 42 insertions, 11 deletions
diff --git a/macros/luatex/latex/luaplot/luaplot.pdf b/macros/luatex/latex/luaplot/luaplot.pdf
index c482c6bab9..2217258723 100644
--- a/macros/luatex/latex/luaplot/luaplot.pdf
+++ b/macros/luatex/latex/luaplot/luaplot.pdf
Binary files differ
diff --git a/macros/luatex/latex/luaplot/luaplot.sty b/macros/luatex/latex/luaplot/luaplot.sty
index eb071b568e..f9f5377c90 100644
--- a/macros/luatex/latex/luaplot/luaplot.sty
+++ b/macros/luatex/latex/luaplot/luaplot.sty
@@ -1,9 +1,9 @@
% luaplot package
-% version 1.0
+% version 1.2
% 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 Dr. Ajit Kumar
+%Authors: Chetan Shirore and Ajit Kumar
-\ProvidesPackage{luaplot}
+\ProvidesPackage{luaplot}[1.2]
\RequirePackage{xkeyval}
\RequirePackage{luacode}
\RequirePackage{tikz}
@@ -18,13 +18,37 @@ function checknumber(x)
end
end
-function luapath (f,a,b,n)
+function luapath (f,a,b,n,myclr)
+ local mytbl ={}
local s = ""
- s = s.."(" .. a .."," .. f(a) ..")"
+ local finalstr = ""
+ local y = f(a)
+ local mycnt = 1
+ if y == y and not (y==math.huge or y==-math.huge ) then
+ s = s.."(" .. a .."," .. f(a) ..")"
+ end
for i = 1, n do
- s= s .. "-- (" ..((b - a) / n * i + a) ..",".. checknumber(f((b - a) / n * i + a))..")"
+ local y = f((b - a) / n * i + a)
+ if y == y and not (y==math.huge or y==-math.huge ) then
+ if s~='' then
+ s= s .. "-- (" ..checknumber(((b - a) / n * i + a)) ..",".. checknumber(y)..")"
+ else
+ s= s .. "(" ..checknumber(((b - a) / n * i + a)) ..",".. checknumber(y)..")"
+ end
+ mytbl[mycnt] = s
+ else
+ if s~='' then
+ mytbl[mycnt] = s
+ mycnt = mycnt + 1
+ s = ''
+ end
+ end
+
+ end
+ for j=1, #mytbl do
+ finalstr = finalstr .."gdraw " ..tostring(mytbl[j]).."withcolor " .. myclr..";"
end
- return "gdraw " ..s
+ return finalstr
end
function luatikzpath (f,a,b,n)
@@ -74,7 +98,7 @@ color clr;
local endcode = [[
endgraph;
endfig;
-\string\end{mplibcode}
+\string\end{mplibcode}
]]
local expr={}
local countexp = 1
@@ -100,7 +124,7 @@ tex.print(begincode)
for k=1, countexp-1 do
local clr = colortbl[k] or 'black';
local w = plotstytbl[k] or '';
- mainstr="drawoptions("..w..");"..luapath(expr[k],\mop@one,\mop@two,\mop@five).."withcolor " .. clr..";"..'drawoptions();'
+ mainstr="drawoptions("..w..");"..luapath(expr[k],\mop@one,\mop@two,\mop@five, clr)..'drawoptions();'
tex.print(mainstr)
end
tex.print(tostring(\mop@ten))%
diff --git a/macros/luatex/latex/luaplot/luaplot.tex b/macros/luatex/latex/luaplot/luaplot.tex
index cc238260eb..a0defde6b6 100644
--- a/macros/luatex/latex/luaplot/luaplot.tex
+++ b/macros/luatex/latex/luaplot/luaplot.tex
@@ -107,7 +107,7 @@ clr
\begin{lstlisting}[caption={[]}]
plotoptions
\end{lstlisting}
- & Specifies different options for plotting. The input is to be in curly braces. If the expression is a big string and multi-line then it can be enclosed in two square brackets (string in Lua). The different plot options include grids, labels, legends, axes styles, point markings on axes, framing styles etcetera. For all possible options, the MetaPost package \cite{online.metapost} documentation and guide \cite{article.hobby} can be referred. \\
+ & Specifies different options for plotting. The input is to be in curly braces. If the expression is a big string and multi-line then it can be enclosed in two square brackets (string in Lua). The different plot options include grids, labels, legends, axes styles, point markings on axes, framing styles etcetera. For all possible options, the MetaPost package documentation \cite{online.metapost} and guide \cite{article.hobby} can be referred. \\
\bottomrule \\
\caption{Optional parameters in the luaplot command}
\label{tbl:paraluaplot}
@@ -167,7 +167,14 @@ xmin=-10,xmax=10]
\end{lstlisting} & \newline \luaplot[
clr={ 'red, blue, green' },
xmin=-10,xmax=10]
-{x^3,-x^3,x} \\
+{x^3,-x^3,x} \\ \midrule
+\begin{lstlisting}[caption={[]}]
+\luaplot[xmin=-5,xmax=5,
+clr={'red, blue'}]
+{(2*(x^2)-1)/(x^2-1),1/x}
+\end{lstlisting} & \newline \luaplot[xmin=-5,xmax=5,
+clr={'red, blue'}]
+{(2*(x^2)-1)/(x^2-1),1/x} \\
\bottomrule \\
\caption{Plotting graphs with the luaplot command}
\label{tbl:luaplotex}