texlive[67565] Master/texmf-dist: luaplot (6jul23)
commits+karl at tug.org
commits+karl at tug.org
Thu Jul 6 21:48:00 CEST 2023
Revision: 67565
http://tug.org/svn/texlive?view=revision&revision=67565
Author: karl
Date: 2023-07-06 21:48:00 +0200 (Thu, 06 Jul 2023)
Log Message:
-----------
luaplot (6jul23)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/lualatex/luaplot/luaplot.pdf
trunk/Master/texmf-dist/doc/lualatex/luaplot/luaplot.tex
trunk/Master/texmf-dist/tex/lualatex/luaplot/luaplot.sty
Modified: trunk/Master/texmf-dist/doc/lualatex/luaplot/luaplot.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/lualatex/luaplot/luaplot.tex
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/luaplot/luaplot.tex 2023-07-06 19:47:51 UTC (rev 67564)
+++ trunk/Master/texmf-dist/doc/lualatex/luaplot/luaplot.tex 2023-07-06 19:48:00 UTC (rev 67565)
@@ -107,7 +107,7 @@
\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 @@
\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}
Modified: trunk/Master/texmf-dist/tex/lualatex/luaplot/luaplot.sty
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/luaplot/luaplot.sty 2023-07-06 19:47:51 UTC (rev 67564)
+++ trunk/Master/texmf-dist/tex/lualatex/luaplot/luaplot.sty 2023-07-06 19:48:00 UTC (rev 67565)
@@ -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 @@
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
- return "gdraw " ..s
+ for j=1, #mytbl do
+ finalstr = finalstr .."gdraw " ..tostring(mytbl[j]).."withcolor " .. myclr..";"
+ end
+ return finalstr
end
function luatikzpath (f,a,b,n)
@@ -74,7 +98,7 @@
local endcode = [[
endgraph;
endfig;
-\string\end{mplibcode}
+\string\end{mplibcode}
]]
local expr={}
local countexp = 1
@@ -100,7 +124,7 @@
for k=1, countexp-1 do
local clr = colortbl[k] or 'black';
local w = plotstytbl[k] or '';
- mainstr="drawoptions("..w..");"..luapath(expr[k],\mop at one,\mop at two,\mop at five).."withcolor " .. clr..";"..'drawoptions();'
+ mainstr="drawoptions("..w..");"..luapath(expr[k],\mop at one,\mop at two,\mop at five, clr)..'drawoptions();'
tex.print(mainstr)
end
tex.print(tostring(\mop at ten))%
More information about the tex-live-commits
mailing list.