From cc95d9b8f7a859cf2f69b419e15bd1a8a2777289 Mon Sep 17 00:00:00 2001 From: "Maxime Chupin (Ceremade)" Date: Mon, 21 Nov 2016 16:49:37 +0100 Subject: [PATCH] =?utf8?q?D=C3=A9but=20de=20la=20fonctionnalit=C3=A9=20pic?= =?utf8?q?ture=3Dembedded,=20NON=20FONCTIONNELLE?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- index.md | 2 +- luamesh.lua | 10 +++++++--- luamesh.sty | 16 ++++++++++++---- test/animation.pdf | Bin 23628 -> 23628 bytes test/delaunay.pdf | Bin 25488 -> 19020 bytes test/delaunay.tex | 10 +++++++++- 6 files changed, 29 insertions(+), 9 deletions(-) diff --git a/index.md b/index.md index 3bcaf2e..c496986 100644 --- 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. diff --git a/luamesh.lua b/luamesh.lua index f165fe6..9b761e2 100644 --- a/luamesh.lua +++ b/luamesh.lua @@ -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 diff --git a/luamesh.sty b/luamesh.sty index 9cc0b68..9b326e5 100644 --- a/luamesh.sty +++ b/luamesh.sty @@ -83,11 +83,11 @@ }% % %% 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 @@ -163,7 +163,15 @@ \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 @@ -179,7 +187,7 @@ }% \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% diff --git a/test/animation.pdf b/test/animation.pdf index 25621ed2c0dd1dbb9aad02b3f303ee6b11e8cd02..ef311ee4aab853b7e25c2dd14f20348a2f8d3729 100644 GIT binary patch delta 104 zcmX@JgYnD`#toL?Y=&lrM#dJC?ZaiD%*~16XPKQHOwHybD<$uSw4PF7G5*}TH8NS?{iVzNw}2fLx6nTdso$>i)fX*jz# zu3F5{Sl=zPsJKMI!bsmIH7~s+L%|fNOkP;6era%S{w)K6f9KZk=%1~&nS=Q_ zZp9|>>{y`8{_ghy6%JQNxgCux@-<7V7&X)!7>jqXxEb~xuL=*Z_#c!#XX(ykfuT~d zv&3u;&8&YMv;FF_lO^6WuFZSpI+1U6?3)QM1t+bqaMG8qa<0^T@@tk5)6>Xs-;m`q z)ry|5aT&Rps~WyLbKbgGdghf3ttG`REj}SmdL3(ya5wPQCej#Te8 z_G~Y{!?5Ap^wP=pjx`O3Hr^APIqyE7@PZXLzFu)SWc_W4c)j;Rwy@^MpH%EO{;%I@ zC%r>qsFoo6C@=6{$a2? zF8^CR$UtW8rM55s8-(XPtmlijD?5{jbwHN|KY@2ug=w8 zn=Q=vMxpHf&Wxz!l@0nI^zP1=O#cy~b7s}n;@@>ggbmMs*kf$7vae!YbwhHxQbF0j zXzQKQm!>_uo^y(_3@Z zM(@nYQ{LxY>pW+z^Z#^zxIf%$UDt2#Yw!Qi8=S;Goa$KuJQgt_(d1Sr2Xff3%bh`# zq;16LCyL3CRS8B}g>QNrhp3?c`^zj5)!0u#s)EM8har^oI<)=Jz@iwMp2n;lxUFFlt1*XoB-Pd=uNd6!+X)D)Yu1J~$kw2OUZ( zoYqW=C#GL0r=P69SmHDFM%sIrParwh5D;-3*!JodLcA((A zJM8fJ{>E@~)zco`4Qbs~>}0Y-;OSxtNl%Wz$XiI|pbTc>eD4>$C6&#?Gnl@Vdfc@~ z!v+4LlP9l}Y^ZHhUMY@^ZQw~gwVJw=M2xf6f?Sc#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