Here's a short summary for Hans (or Taco), so that he doesn't need to read any further: - is it possible to have the contents between \startGPscript ... \stopGPscript go verbatim to the temporary file instead of having to be parsed? - Is there a way to get UTF-8 accented latin characters out of plain metapost files when using mptopdf?
On Mon, Mar 24, 2008 at 3:38 PM, Morgan Brassel wrote: > Hi everyone, Hello Morgan, > I'm currently learning how to use the gnuplot module (thank you Mojca, and > all the others, for this great tool!). I stick for now with the metapost > terminal, as I'm not sure I'd be able to recompile gnuplot in order to add > the context terminal. Which platform are you using? > It seems that accents are not supported in gnuplot scripts. In the example > below, both the methods to typeset accents fail. Is there a solution to > this? Maybe there is something wrong with my settings... > > \usemodule[gnuplot] > \setupGNUPLOT[terminal=mp] > \startGNUPLOTscript[sin] > set xlabel "héllo h\'ello" > plot sin(x) > \stopGNUPLOTscript > \starttext > \useGNUPLOTgraphic[sin] > \stoptext I'm afraid that the problem lies in metapost terminal ... Well, there are two problems, to be honest. Problem #1: is a "Hans please help" kind of problem. If you take a look into filename-gnuplot-1.plt you will spot: set xlabel "héllo h\dochar {233}llo" This can be solved by using set xlabel \detokenize{"héllo h\'ello"} in the your script or by convincing Hans or Taco to fix that problem (the content between \startGNUPLOTscript goes through some non-perfect modified TeX parser while it should be copied verbatim to the output file, but I have no idea how to fix that). \detokenize is just an ugly workaround. However, even if you fix that, you're still stuck. Problem #2: is a "sorry, mp terminal is limited" kind of problem. Let's take a look at filename-gnuplot-1-mp.mp after you fix the above mentioned problem: /.../ %font changes verbatimtex \def\setfont#1#2{%. \font\gpfont=#1 at #2pt \gpfont} \setfont{cmr10}{10.00} etex /.../ put_text( btex héllo h'ello etex, 635.3a, 18.3b, 0, 2); The first é doesn't work since metapost's btex doesn't know about utf-8 characters. I suspect there might be some solution to that if you convince mptopdf to respect UTF-8 input encoding on one hand and default font encoding on the other hand, so that é won't be taken from characters >127, but faked instead. I have no idea how to solve the input encoding problem (you could modify the mptopdf format, but there must be some other way - I guess that it is solvable). With font encoding you would have one problem less if \setfont{cmr10}{10.00} could be replaced by \setfont{ec-lmr10}{10.00} or even better - left out at all, but well - you would need to patch the metapost terminal for that or do some postprocessing or add another verbatimtex or ... The second \' doesn't work because metapost apparently eats all the backslashes for some stupid "security" reason. I could send you a patch for both problems, but it would mean: - that you would have problems every time you would use another gnuplot binary - you would need to recompile gnuplot binary anyway The problems mentioned under #2 are just a few among many other reasons why I have written the context terminal. Mojca PS: I'm CC-ing to Ethan in case he has some proposal about what could be done with metapost terminal to support UTF-8 (one of the best thing to do would be to remove cmr, but more is needed), and I'm CC-ing to the developer of the new TikZ terminal (for no specific reason). ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________