string lblPreambule, lblLocal; lblPreambule := "\usepackage[frenchb]{babel}\usepackage[garamond]{mathdesign}\usepackage{amsmath}\usepackage{mflogo}"; lblLocal := ""; string lblS[]; lblS[0] = "alpha"; lblS[1] = "beta"; lblS[2] = "gamma"; lblS[3] = "delta"; lblN = 3; vardef scanchaine_label(expr s) = save d,m,f,c,l,flag,i; string d,m,f,c; d := ""; m := ""; f := ""; l = length(s); flag := 0; for i:=0 upto l: c := substring (i,i+1) of s; if c = "'": f := f & c; flag := 2; elseif c = "_": flag := 1; else: if flag = 0: d := d & c else: m := m & c fi; fi endfor; for i:=0 upto lblN: if d = lblS[i]: d := "\" & d fi endfor; d := d & "_{" & m & "}" & f; d enddef; vardef lTEX primary s = write "verbatimtex" to "mptextmp.mp"; write "%&latex" to "mptextmp.mp"; write "\documentclass{article}" to "mptextmp.mp"; write lblPreambule to "mptextmp.mp"; write lblLocal to "mptextmp.mp"; write "\begin{document}" to "mptextmp.mp"; write "etex" to "mptextmp.mp"; write "btex $"& scanchaine_label(s) &"$ etex" to "mptextmp.mp"; write EOF to "mptextmp.mp"; scantokens "input mptextmp" enddef; vardef TEX primary s = write "verbatimtex" to "mptextmp.mp"; write "%&latex" to "mptextmp.mp"; write "\documentclass{article}" to "mptextmp.mp"; write lblPreambule to "mptextmp.mp"; write lblLocal to "mptextmp.mp"; write "\begin{document}" to "mptextmp.mp"; write "etex" to "mptextmp.mp"; write "btex "& s &" etex" to "mptextmp.mp"; write EOF to "mptextmp.mp"; scantokens "input mptextmp" enddef; vardef Etiquette.@#(expr s,t,p) = label.@#(TEX(s) scaled t,p gddEnPlace) enddef; vardef EtiquetteChemin.@#(expr s,p,pos) = % label, chemin, position save chemin; path chemin; if path p: chemin:=p; else: chemin:=gddP[p]; % fonction pour chemin et courbe fi; label.@#(TEX(s), _milieuChemin(chemin,pos) gddEnPlace) enddef; vardef _milieuChemin(expr p,pos) = % p est du type path save midtime; midtime = arctime (pos*(arclength(p))) of p; point infinity of (subpath (0,midtime) of p) enddef; vardef FICHIER primary s = save _s; string _s; _s = "input " & s; scantokens _s enddef; endinput