Début de la fonctionnalité picture=embedded, NON FONCTIONNELLE
authorMaxime Chupin (Ceremade) <chupin@ceremade.dauphine.fr>
Mon, 21 Nov 2016 15:49:37 +0000 (16:49 +0100)
committerMaxime Chupin (Ceremade) <chupin@ceremade.dauphine.fr>
Mon, 21 Nov 2016 15:49:37 +0000 (16:49 +0100)
index.md
luamesh.lua
luamesh.sty
test/animation.pdf
test/delaunay.pdf
test/delaunay.tex

index 3bcaf2e..c496986 100644 (file)
--- a/index.md
+++ b/index.md
@@ -7,7 +7,7 @@
 * 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.
index f165fe6..9b761e2 100644 (file)
@@ -570,13 +570,13 @@ function buildListExt(chaine, stop)
 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}
@@ -586,6 +586,10 @@ function TeXFullOnePointMP(chaine,point,step,color,colorBack,colorNew,colorCircl
       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
index 9cc0b68..9b326e5 100644 (file)
 }%
 %
 %% 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%
index 25621ed..ef311ee 100644 (file)
Binary files a/test/animation.pdf and b/test/animation.pdf differ
index b1232ee..3c5278d 100644 (file)
Binary files a/test/delaunay.pdf and b/test/delaunay.pdf differ
index a969a44..dae9c63 100644 (file)
@@ -38,7 +38,15 @@ newpoint = y
 {(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}

Licence Creative Commons Les fichiers de Syracuse sont mis à disposition (sauf mention contraire) selon les termes de la
Licence Creative Commons Attribution - Pas d’Utilisation Commerciale - Partage dans les Mêmes Conditions 4.0 International.