Skip to content

Commit

Permalink
Fix a bug where some letter signs were not put in the proper places
Browse files Browse the repository at this point in the history
(ueb) 
eg. \frac{1}{3}e needs a letter sign before e.
Also added this after sub/super scripts to avoid any ambiguity, though
it's probably redundant. Not sure  how it is done in ueb books exactly.
  • Loading branch information
danieldalton10 committed Jul 23, 2012
1 parent 4073f5f commit cbca5e0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions latex_access/ueb.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def before (self):
Place anything here to do before we begin ueb translate. Eg. set
variables etc. Should NOT alter the actual input at all."""
self.lastnumber = -1 # keep track of where the last latex number was open i.e. after a digit . or , (for ueb)
self.lastnumber = -1 # keep track of where the last latex number # was open i.e. after a digit . or , (for ueb)

def super(self,input,start,rting=()):
'''Translate superscripts into UEB.
Expand All @@ -65,6 +65,7 @@ def super(self,input,start,rting=()):
translation = ";9" + self.translate(arg[0],(rting[0]+arg[2],rting[1]+2))
else:
translation = ";9" + self.translate(arg[0])
self.lastnumber = arg[1]
else:
if rting != ():
translation = ";9<" + self.translate(arg[0],(rting[0]+arg[2],rting[1]+3))+">"
Expand All @@ -82,6 +83,7 @@ def sub(self,input,start,rting=()):
translation = ";5"+self.translate(arg[0],(rting[0]+arg[2],rting[1]+2))
else:
translation = ";5"+self.translate(arg[0])
self.lastnumber = arg[1]
else:
if rting != ():
translation = ";5<"+self.translate(arg[0],(rting[0]+arg[2],rting[1]+3)) + ">"
Expand Down Expand Up @@ -120,7 +122,9 @@ def frac(self,input,start,rting=()):
for number in denominator[0]: translation+=self.upperNumbers[int(number)]
if rting != ():
for j in range(len(numerator[0])): self.rt.append((rting[1]+j+1,rting[0]+numerator[2]+j))
for j in range(len(denominator[0])): self.rt.append((rting[1]+j+2+len(numerator[0]),rting[0]+denominator[2]+j))
for j in range(len(denominator[0])):
self.rt.append((rting[1]+j+2+len(numerator[0]),rting[0]+denominator[2]+j))
self.lastnumber=denominator[1]
else: # complex fraction
self.lastnumber = -1
if rting != ():
Expand Down

0 comments on commit cbca5e0

Please sign in to comment.