LaTeX text processing using "LaTeX low level font commands" in texmanager.py & backend_ps.py

Dear John,

Its 3 months later, but rather late than never:

From: John Hunter [mailto:jdhunter@…4…]
Sent: 26 October 2005 23:13
To: Randewijk P-J <pjrandew@…841…>
Cc: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] "Superior" LaTeX text
processing using a "Low Level Font Command" input file in
texmanager.py & backend_ps.py

>>>>> ""Randewijk" == "Randewijk P-J <pjrandew@...841...>"
>>>>> <pjrandew@...841...> writes:

    > Dear All, I have hacked a bit at texmanager.py and
    > backend_ps.py in order to generate "superior" text
    > output using LaTeX.

Thanks for the changes!

    > It involves "including" a user specific "low level
    > font command" input file useing some "new" rcParams
    > and the savefig command with the PS backend in you
    > main "pylab" script:

...

I worry that this is starting to get hairy -- perhaps we
should look into separating the latex from the code more cleanly.

JDH

The LaTeX low level font commands are now accessible using either rcParams[...] or the `matplotlibrc' file instead of a seperate input file as proposed previously.

e.g. in you pylab script file:

rcParams['latex.font.uselowlevel']='True'

rcParams['latex.font.size']='12' # Fontsize, e.g. 10, 11, 12, ...
rcParams['latex.font.baselineskip']='14'# Baselineskip - usually 1.2 x Fontsize
rcParams['latex.font.encoding']='T1' # T1 - Latin 1, etc.
rcParams['latex.font.family']='phv' # cmr - Computer Modern Roman, ptm - Times-Roman, phv - Helvetica, etc.
rcParams['latex.font.series']='m' # m - Medium, b - Bold, bc - Bold Condensed, bx - Bold Expanded
rcParams['latex.font.shape']='n' # n - Upright (Normal), it - Italic, sl - Slanted,
                                        # sc - Small Caps, ui - Upright Italics, ol - Outline

To bypass a specific low level command, set the rc parameter to an empty string, e.g.

rcParams['latex.font.size']='' # Fontsize, e.g. 10, 11, 12, ...

The default fontsize will now be used.

The code added to `backend_ps.py' and `texmanager.py' are basically:

...
            fontcmd = ''
            if rcParams['latex.font.uselowlevel'] == 'True':
                if rcParams['latex.font.size'] and rcParams['latex.font.baselineskip']:
                    fontcmd += r'\fontsize{%s}{%s}' % (rcParams['latex.font.size'], rcParams['latex.font.baselineskip'])
                if rcParams['latex.font.encoding']:
                    fontcmd += r'\fontencoding{%s}'% rcParams['latex.font.encoding']
                if rcParams['latex.font.family']:
                    fontcmd += r'\fontfamily{%s}'% rcParams['latex.font.family']
                if rcParams['latex.font.series']:
                    fontcmd += r'\fontseries{%s}'% rcParams['latex.font.series']
                if rcParams['latex.font.shape']:
                    fontcmd += r'\fontshape{%s}'% rcParams['latex.font.shape']
                fontcmd += r'\selectfont '
...

(or see attached)

The validations to the added param keys in `__init__.py' maybe needs some more work...

I think it would be much easier for us to deal with this if
you submit it as a proper patch against CVS and upload it to
the sf site. Could I trouble you to do that?

How do I go about doing that?

I have never used CVS before. (Only RCS for my own stuff.)

I have installed TortoiseCSV (yes, unfortunately I am a win32 user...), but how do I proceed from here...

I started reading the part `Developer CVS Access via SSH' (instead of `Anonymous CVS Access')

I have created a SF login, but can't get past the:

`Log in to SourceForge.net' admin page...

http://sourceforge.net/account/login.php?return_to=%2Fproject%2Fadmin%2F%3Fgroup_id%3D80706

Kind regards,

   Peter-Jan Randewijk

-oOOOOOOOOOOOOOOOOOOOOOOOOOOOOOo-
    Dep. Electrical & Electronic Engineering - E313
    Stellenbosch University
    Private Bag X1
    Matieland, 7603
    South Africa
    Tel: +27 (0) 21 808 4457 (w)
    Fax: +27 (0) 21 808 3951 (w)
    Tel: +27 (0) 21 883 8592 (h)
    Cell: +27 (0) 83 556 5809 (h)
    eMail: pjrandew@...841... (w)
-oOOOOOOOOOOOOOOOOOOOOOOOOOOOOOo-

backend_ps.py (42.8 KB)

init.py|attachment (36.6 KB)

texmanager.py (12.7 KB)

···

-----Original Message-----