Skip to content

Commit

Permalink
minor changes for htdocs
Browse files Browse the repository at this point in the history
svn path=/trunk/matplotlib/; revision=4504
  • Loading branch information
jdh2358 committed Nov 29, 2007
1 parent 4a5c982 commit 517513f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 18 deletions.
12 changes: 12 additions & 0 deletions examples/mathtext_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,15 @@
r'$\widehat{abc}\widetilde{def}$',
r'$\Gamma \Delta \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega$',
r'$\alpha \beta \gamma \delta \epsilon \zeta \eta \theta \iota \lambda \mu \nu \xi \pi \kappa \rho \sigma \tau \upsilon \phi \chi \psi$',
<<<<<<< .mine
<<<<<<< .mine
#ur'Generic symbol: $\u23ce \mathrm{\ue0f2}$'
=======
#ur'Generic symbol: $\u23ce \mathrm{\ue0f2 \U0001D538}$'
=======
ur'Generic symbol: $\u23ce \mathrm{\ue0f2 \U0001D538}$'
>>>>>>> .r4393
>>>>>>> .r4174
]

from pylab import *
Expand All @@ -63,7 +71,11 @@ def doall():
axis([0, 3, -len(tests), 0])
yticks(arange(len(tests)) * -1)
for i, s in enumerate(tests):
<<<<<<< .mine
print i,s
=======
print (i, s)
>>>>>>> .r4174
text(0.1, -i, s, fontsize=20)

savefig('mathtext_examples')
Expand Down
36 changes: 18 additions & 18 deletions lib/matplotlib/mathtext.py
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ def get_underline_thickness(self, font, fontsize, dpi):
# Typesetting math formulas
#
# Many of the docstrings below refer to a numbered "node" in that
# book, e.g. @123
# book, e.g. node123
#
# Note that (as TeX) y increases downward, unlike many other parts of
# matplotlib.
Expand Down Expand Up @@ -1120,7 +1120,7 @@ class MathTextWarning(Warning):

class Node(object):
"""A node in the TeX box model
@133
node133
"""
def __init__(self):
self.size = 0
Expand Down Expand Up @@ -1149,7 +1149,7 @@ def render(self, x, y):

class Box(Node):
"""Represents any node with a physical location.
@135"""
node135"""
def __init__(self, width, height, depth):
Node.__init__(self)
self.width = width
Expand Down Expand Up @@ -1195,7 +1195,7 @@ class Char(Node):
The metrics must be converted to the TeX way, and the advance (if
different from width) must be converted into a Kern node when the
Char is added to its parent Hlist.
@134"""
node134"""
def __init__(self, c, state):
Node.__init__(self)
self.c = c
Expand Down Expand Up @@ -1286,7 +1286,7 @@ def render(self, x, y):

class List(Box):
"""A list of nodes (either horizontal or vertical).
@135"""
node135"""
def __init__(self, elements):
Box.__init__(self, 0., 0., 0.)
self.shift_amount = 0. # An arbitrary offset
Expand Down Expand Up @@ -1344,7 +1344,7 @@ def grow(self):

class Hlist(List):
"""A horizontal list of boxes.
@135"""
node135"""
def __init__(self, elements, w=0., m='additional', do_kern=True):
List.__init__(self, elements)
if do_kern:
Expand Down Expand Up @@ -1387,7 +1387,7 @@ def hpack(self, w=0., m='additional'):
Thus, hpack(w, exactly) produces a box whose width is exactly w, while
hpack (w, additional ) yields a box whose width is the natural width
plus w. The default values produce a box with the natural width.
@644, @649"""
node644, node649"""
# I don't know why these get reset in TeX. Shift_amount is pretty
# much useless if we do.
#self.shift_amount = 0.
Expand Down Expand Up @@ -1434,7 +1434,7 @@ def hpack(self, w=0., m='additional'):

class Vlist(List):
"""A vertical list of boxes.
@137"""
node137"""
def __init__(self, elements, h=0., m='additional'):
List.__init__(self, elements)
self.vpack()
Expand All @@ -1451,7 +1451,7 @@ def vpack(self, h=0., m='additional', l=float(inf)):
Thus, vpack(h, exactly) produces a box whose width is exactly w, while
vpack(w, additional) yields a box whose width is the natural width
plus w. The default values produce a box with the natural width.
@644, @668"""
node644, node668"""
# I don't know why these get reset in TeX. Shift_amount is pretty
# much useless if we do.
# self.shift_amount = 0.
Expand Down Expand Up @@ -1510,7 +1510,7 @@ class Rule(Box):
rule up to the boundary of the innermost enclosing box. This is called
a "running dimension." The width is never running in an Hlist; the
height and depth are never running in a Vlist.
@138"""
node138"""
def __init__(self, width, height, depth, state):
Box.__init__(self, width, height, depth)
self.font_output = state.font_output
Expand Down Expand Up @@ -1538,7 +1538,7 @@ class Glue(Node):
GlueSpec class, which is shared between multiple glue objects. (This
is a memory optimization which probably doesn't matter anymore, but it's
easier to stick to what TeX does.)
@149, @152"""
node149, node152"""
def __init__(self, glue_type, copy=False):
Node.__init__(self)
self.glue_subtype = 'normal'
Expand Down Expand Up @@ -1566,7 +1566,7 @@ def grow(self):
self.glue_spec.width *= GROW_FACTOR

class GlueSpec(object):
"""@150, @151"""
"""node150, node151"""
def __init__(self, width=0., stretch=0., stretch_order=0, shrink=0., shrink_order=0):
self.width = width
self.stretch = stretch
Expand Down Expand Up @@ -1647,7 +1647,7 @@ class Kern(Node):
better to move them closer together or further apart. A kern node can
also appear in a vertical list, when its 'width' denotes additional
spacing in the vertical direction.
@155"""
node155"""
def __init__(self, width):
Node.__init__(self)
self.width = width
Expand Down Expand Up @@ -1733,7 +1733,7 @@ class Ship(object):
and vlist_out , which traverse the Hlists and Vlists inside of
horizontal and vertical boxes. The global variables used in TeX to
store state as it processes have become member variables here.
@592."""
node592."""
def __call__(self, ox, oy, box):
self.max_push = 0 # Deepest nesting of push commands so far
self.cur_s = 0
Expand Down Expand Up @@ -1769,7 +1769,7 @@ def hlist_out(self, box):
elif isinstance(p, Kern):
self.cur_h += p.width
elif isinstance(p, List):
# @623
# node623
if len(p.children) == 0:
self.cur_h += p.width
else:
Expand All @@ -1783,7 +1783,7 @@ def hlist_out(self, box):
self.cur_h = edge + p.width
self.cur_v = base_line
elif isinstance(p, Box):
# @624
# node624
rule_height = p.height
rule_depth = p.depth
rule_width = p.width
Expand All @@ -1799,7 +1799,7 @@ def hlist_out(self, box):
self.cur_v = baseline
self.cur_h += rule_width
elif isinstance(p, Glue):
# @625
# node625
glue_spec = p.glue_spec
rule_width = glue_spec.width - cur_g
if glue_sign != 0: # normal
Expand Down Expand Up @@ -2470,7 +2470,7 @@ def subsuperscript(self, s, loc, toks):
else:
shift_down = SUBDROP * xHeight
if super is None:
# @757
# node757
sub.shrink()
x = Hlist([sub])
# x.width += SCRIPT_SPACE * xHeight
Expand Down

0 comments on commit 517513f

Please sign in to comment.