ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Mojca Miklavec" <mojca.miklavec.lists@gmail.com>
To: "mailing list for ConTeXt users" <ntg-context@ntg.nl>
Cc: Peter Hedwig <peter@affenbande.org>,
	Ethan Merritt <merritt@u.washington.edu>
Subject: Re: UTF-8 characters and gnuplot module
Date: Mon, 24 Mar 2008 16:53:10 +0100	[thread overview]
Message-ID: <6faad9f00803240853n1d3df88dt31808c998d3b674@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.1.10.0803241527210.4944@leo>

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
___________________________________________________________________________________

  reply	other threads:[~2008-03-24 15:53 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-24 14:38 Morgan Brassel
2008-03-24 15:53 ` Mojca Miklavec [this message]
2008-03-24 16:03   ` Mojca Miklavec
2008-03-24 16:35   ` Morgan Brassel
2008-03-24 17:21     ` Mojca Miklavec
2008-03-24 18:52   ` Ethan Merritt
2008-03-24 20:14     ` Mojca Miklavec
2008-03-24 22:02       ` Hans Hagen
2008-03-24 22:21         ` Mojca Miklavec
2008-03-24 22:43           ` Hans Hagen
2008-03-25 14:28             ` Morgan Brassel
2008-03-25 14:55               ` Mojca Miklavec
2008-03-25 15:57                 ` Morgan Brassel
2008-03-25 17:11                   ` Mojca Miklavec
2008-03-25 20:24                     ` Henning Hraban Ramm
2008-03-26  8:05                 ` Taco Hoekwater
2008-03-26  9:28                   ` Mojca Miklavec
2008-03-24 19:24 ` Mojca Miklavec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6faad9f00803240853n1d3df88dt31808c998d3b674@mail.gmail.com \
    --to=mojca.miklavec.lists@gmail.com \
    --cc=merritt@u.washington.edu \
    --cc=ntg-context@ntg.nl \
    --cc=peter@affenbande.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).