1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
"""
C.8.4 Numbering (p194)
"""
from plasTeX import Command
class newcounter(Command):
args = 'name:str [ within ]'
def invoke(self, tex):
a = self.parse(tex)
self.ownerDocument.context.newcounter(a['name'], a['within'])
class setcounter(Command):
args = 'name:str value:int'
def invoke(self, tex):
a = self.parse(tex)
self.ownerDocument.context.counters[a['name']].setcounter(a['value'])
class addtocounter(Command):
args = 'name:str value:int'
def invoke(self, tex):
a = self.parse(tex)
self.ownerDocument.context.counters[a['name']].addtocounter(a['value'])
class value(Command):
args = 'name:str'
def invoke(self, tex):
a = self.parse(tex)
return tex.textTokens(self.ownerDocument.context.counters[a['name']].arabic)
class arabic(Command):
""" Return arabic representation """
args = 'name:str'
def invoke(self, tex):
a = self.parse(tex)
return tex.textTokens(self.ownerDocument.context.counters[a['name']].arabic)
class Roman(Command):
""" Return uppercase roman representation """
args = 'name:str'
def invoke(self, tex):
a = self.parse(tex)
return tex.textTokens(self.ownerDocument.context.counters[a['name']].Roman)
class roman(Roman):
""" Return the lowercase roman representation """
def invoke(self, tex):
a = self.parse(tex)
return tex.textTokens(self.ownerDocument.context.counters[a['name']].roman)
class Alph(Command):
""" Return the uppercase letter representation """
args = 'name:str'
def invoke(self, tex):
a = self.parse(tex)
return tex.textTokens(self.ownerDocument.context.counters[a['name']].Alph)
class alph(Alph):
""" Return the lowercase letter representation """
def invoke(self, tex):
a = self.parse(tex)
return tex.textTokens(self.ownerDocument.context.counters[a['name']].alph)
class fnsymbol(Command):
""" Return the symbol representation """
args = 'name:str'
def invoke(self, tex):
a = self.parse(tex)
return tex.textTokens(self.ownerDocument.context.counters[a['name']].fnsymbol)
class stepcounter(Command):
args = 'name:str'
def invoke(self, tex):
a = self.parse(tex)
return self.ownerDocument.context.counters[a['name']].stepcounter()
class refstepcounter(Command):
args = 'name:str'
def invoke(self, tex):
a = self.parse(tex)
return self.ownerDocument.context.counters[a['name']].stepcounter()
|