* Reader for gmesh `msh` file to plot meshes produced by this
software.
* Implement the picture mode `embedded` to allow the generated code
- (`mplibcode` or `tikz` code) to be include in a `mplibcode` or
+ (`mplibcode` or `tikz`) to be included in a `mplibcode` or
`tikzpicture` environment (for now, the produced code contains the
environment declarations).
* Macro to generate a meshed rectangle.
end
-function TeXFullOnePointTikZ(chaine,point,step,color,colorBack,colorNew,colorCircle,scale)
+function TeXOnePointTikZ(chaine,point,step,color,colorBack,colorNew,colorCircle,scale)
output = TeXaddOnePointTikZ(chaine,point,step,color,colorBack,colorNew,colorCircle)
output = "\\noindent\\begin{tikzpicture}[x="..scale..",y="..scale.."]".. output .. "\\end{tikzpicture}"
tex.sprint(output)
end
-function TeXFullOnePointMP(chaine,point,step,color,colorBack,colorNew,colorCircle,scale,mode)
+function TeXOnePointMP(chaine,point,step,color,colorBack,colorNew,colorCircle,scale,mode,picture)
if(mode=="int") then
Sx,Sy=string.match(point,"%((.+),(.+)%)")
P = {x=Sx, y=Sy}
P, listPoints = buildListExt(chaine,tonumber(point))
end
output = TeXaddOnePointMP(listPoints,P,step,color,colorBack,colorNew,colorCircle)
- output = "\\leavevmode\\begin{mplibcode}beginfig(0);u:="..scale..";".. output .. "endfig;\\end{mplibcode}"
+ if(picture=="full") then
+ output = "\\leavevmode\\begin{mplibcode}beginfig(0);u:="..scale..";".. output .. "endfig;\\end{mplibcode}"
+ else
+ output = "u:="..scale..";".. output
+ end
tex.sprint(output)
end
}%
%
%% a complete picture or some code of the engine
-\define@choicekey*{buildMesh}{picture}[\val\nr]{full, simple}{%
+\define@choicekey*{buildMesh}{picture}[\val\nr]{full, embedded}{%
\ifcase\nr\relax%
\def\luameshval@picture{full}%
\or%
- \def\luameshval@picture{simple}%
+ \def\luameshval@picture{embedded}%
\fi%
}%
%color
\def\luameshval@mode{ext}%
\fi%
}%
-\presetkeys{MeshAddOne}{tikz=false,scale, meshpoint,newpoint,color,colorBack,colorNew,colorCircle,step=badtriangles,mode=int}{}%
+%% a complete picture or some code of the engine
+\define@choicekey*{MeshAddOne}{picture}[\val\nr]{full, embedded}{%
+ \ifcase\nr\relax%
+ \def\luameshval@picture{full}%
+ \or%
+ \def\luameshval@picture{embedded}%
+ \fi%
+}%
+\presetkeys{MeshAddOne}{tikz=false,scale, meshpoint,newpoint,color,colorBack,colorNew,colorCircle,step=badtriangles,mode=int,picture=full}{}%
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% the difinition
}%
\else % we are using MP
\directlua{%
- TeXFullOnePointMP("#2","#3","\luameshval@step","\luameshval@color","\luameshval@colorback","\luameshval@colornew","\luameshval@colorcircle","\luameshval@scale","\luameshval@mode")%
+ TeXOnePointMP("#2","#3","\luameshval@step","\luameshval@color","\luameshval@colorback","\luameshval@colornew","\luameshval@colorcircle","\luameshval@scale","\luameshval@mode","\luameshval@picture")%
}%
%
\fi%
{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)}
-
+% \newcommand\mpred{\mpcolor{red}}
+% \newcommand\test{dotlabel(btex $x$ etex, (0,0));draw (0,0)--(2cm,0) withcolor red;}
+
+% \begin{mplibcode}
+% beginfig(0);
+% %\meshAddOnePoint[picture=embedded]{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)}
+% \test
+% endfig;
+% \end{mplibcode}
\end{document}