Thanks,
This unicode thing works like magic.
The only thing I am still unable to do is to insert the symbol \epsilon (as
distinct from \varepsilon).
For some reason, the varepsilon ε is printed fine, but a blank square is
printed instead of the lunate epsilon ϵ.
That is u' ε ' works,  while u' ϵ' does not.

Any idea why this is happening ?

Eli


2008/7/22 Michael Droettboom <[EMAIL PROTECTED]>:

> Yes, you would put it at the top of your .py file.
>
> In order to use Unicode in Python source code, you have to tell the Python
> interpreter what encoding the file is in.  That's done with a little "magic"
> comment at the top of the file.  The popular Unixy editors (emacs, vim etc.)
> also understand this comment and will save the file correctly.  Possibly
> other editors do as well.
>
> For more gory details that you probably need, see this:
>
> http://www.amk.ca/python/howto/unicode
>
> particularly the section "Unicode Literals in Python Source Code".
>
> Cheers,
> Mike
>
> Eli Brosh wrote:
>
>> Thanks,
>> This seems to be a solution.
>> I have an editor that supports unicode.
>> But, can you please explain better how do I make the coding directive at
>> the top of my source files ?
>> Where do I write the command:
>> # -*- coding: utf-8 -*-
>>
>> Is it inside the python script ?
>>
>>
>> Sorry for the ignorance.
>> Eli
>>
>> On Tue, Jul 22, 2008 at 10:14 AM, Michael Droettboom <[EMAIL 
>> PROTECTED]<mailto:
>> [EMAIL PROTECTED]>> wrote:
>>
>>    As an alternative, you could just use Unicode to insert the Greek
>>    characters:
>>
>>    r"α-Fe (Someone 2003)"
>>
>>    The default font used by matplotlib, Vera Sans, includes a full
>>    set of Greek characters. This, of course, requires an editor that
>>    supports Unicode and a coding directive at the top of your source
>>    files, eg.:
>>
>>    # -*- coding: utf-8 -*-
>>
>>
>>    Cheers,
>>    Mike
>>
>>    Eli Brosh wrote:
>>
>>        Here is the use case I have in mind:
>>        Plotting properties of various phases of iron, I need a legend
>>        with greek letters and normal text:
>>        \alpha-Fe, Someone (2003)
>>
>>        Now, I need the names e.g. someone to be upright.
>>        Also, the relbar between \alpha and Fe is shorter with normal
>>        text fonts than with italics.
>>
>>        I can solve the problem by using r'\rm{\alpha-Fe, Someone
>>        (2003)}' but it would be easier if I could just change the
>>        defaults.
>>
>>        Eli
>>
>>
>>        On Mon, Jul 21, 2008 at 6:21 PM, Michael Droettboom
>>        <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
>>        <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>> wrote:
>>
>>           Unfortunately there isn't. This is *theoretically* possible
>>        with
>>           the STIX fonts, but that hasn't been implemented. However, with
>>           the Computer Modern fonts, many of the glyphs simply aren't
>>           present (upright Greek, for example) to make this happen.
>>
>>           That said, I'm not sure this is necessarily a good idea.
>>        Math has
>>           a set of commonly accepted conventions about when to use italic
>>           vs. upright that may only confuse the reader when not followed.
>>           Can you provide a use case?
>>
>>           Cheers,
>>           Mike
>>
>>           Eli Brosh wrote:
>>
>>               Hello
>>               I there a way to change the default mathtext font from
>>        cal to rm ?
>>               I would like to use the rm (serif) font without stating
>>               rm{...} or mathrm{...}.
>>               Is it possible to do using the matplotlibrc ?
>>               can you give me an example of how this is done ?
>>
>>               Thanks
>>               Eli
>>
>> ------------------------------------------------------------------------
>>
>>
>> -------------------------------------------------------------------------
>>               This SF.Net email is sponsored by the Moblin Your Move
>>               Developer's challenge
>>               Build the coolest Linux based applications with Moblin
>>        SDK &
>>               win great prizes
>>               Grand prize is a trip for two to an Open Source event
>>        anywhere
>>               in the world
>>
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>        <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
>>                     <
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>        <http://moblin-contest.org/redirect.php?banner_id=100&url=/>>
>>
>> ------------------------------------------------------------------------
>>
>>               _______________________________________________
>>               Matplotlib-users mailing list
>>               Matplotlib-users@lists.sourceforge.net
>>        <mailto:Matplotlib-users@lists.sourceforge.net>
>>               <mailto:Matplotlib-users@lists.sourceforge.net
>>        <mailto:Matplotlib-users@lists.sourceforge.net>>
>>
>>
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>>
>>
>>    --    Michael Droettboom
>>    Science Software Branch
>>    Operations and Engineering Division
>>    Space Telescope Science Institute
>>    Operated by AURA for NASA
>>
>>
>>
> --
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
>
>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to