diff options
author | Karl Berry <karl@freefriends.org> | 2023-07-06 19:48:00 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-07-06 19:48:00 +0000 |
commit | e8a7f2a6d71d1898700cc8833f2e98547e80a174 (patch) | |
tree | 730557064e0078e8d5de96758e8b83833b9d23f9 /Master | |
parent | d753ea3a7854156b371ee0ac5b0ccbea63572869 (diff) |
luaplot (6jul23)
git-svn-id: svn://tug.org/texlive/trunk@67565 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/lualatex/luaplot/luaplot.pdf | bin | 144774 -> 147391 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/luaplot/luaplot.tex | 11 | ||||
-rw-r--r-- | Master/texmf-dist/tex/lualatex/luaplot/luaplot.sty | 42 |
3 files changed, 42 insertions, 11 deletions
diff --git a/Master/texmf-dist/doc/lualatex/luaplot/luaplot.pdf b/Master/texmf-dist/doc/lualatex/luaplot/luaplot.pdf Binary files differindex c482c6bab98..22172587231 100644 --- a/Master/texmf-dist/doc/lualatex/luaplot/luaplot.pdf +++ b/Master/texmf-dist/doc/lualatex/luaplot/luaplot.pdf diff --git a/Master/texmf-dist/doc/lualatex/luaplot/luaplot.tex b/Master/texmf-dist/doc/lualatex/luaplot/luaplot.tex index cc238260ebf..a0defde6b63 100644 --- a/Master/texmf-dist/doc/lualatex/luaplot/luaplot.tex +++ b/Master/texmf-dist/doc/lualatex/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} diff --git a/Master/texmf-dist/tex/lualatex/luaplot/luaplot.sty b/Master/texmf-dist/tex/lualatex/luaplot/luaplot.sty index eb071b568e1..f9f5377c90c 100644 --- a/Master/texmf-dist/tex/lualatex/luaplot/luaplot.sty +++ b/Master/texmf-dist/tex/lualatex/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))% |