Example #1
0
    def source(self):
        """
        This source property is a little different than most.
        Instead of calling the source property of the child nodes,
        it walks through the rows and cells manually.  It does
        this because rows and cells have special source properties
        as well that don't return the correct markup for inserting
        into this source property.

        """
        name = self.nodeName
        escape = '\\'
        # \begin environment
        # If self.childNodes is not empty, print out the entire environment
        if self.macroMode == Macro.MODE_BEGIN:
            s = []
            argSource = sourceArguments(self)
            if not argSource: 
                argSource = ' '
            s.append('%sbegin{%s}%s' % (escape, name, argSource))
            if self.hasChildNodes():
                for row in self:
                    for cell in row:
                        s.append(sourceChildren(cell, par=not(self.mathMode)))
                        if cell.endToken is not None:
                            s.append(cell.endToken.source)
                    if row.endToken is not None:
                        s.append(row.endToken.source)
                s.append('%send{%s}' % (escape, name))
            return ''.join(s)

        # \end environment
        if self.macroMode == Macro.MODE_END:
            return '%send{%s}' % (escape, name)
Example #2
0
    def source(self):
        """
        This source property is a little different than most.
        Instead of calling the source property of the child nodes,
        it walks through the rows and cells manually.  It does
        this because rows and cells have special source properties
        as well that don't return the correct markup for inserting
        into this source property.

        """
        name = self.nodeName
        escape = '\\'
        # \begin environment
        # If self.childNodes is not empty, print out the entire environment
        if self.macroMode == Macro.MODE_BEGIN:
            s = []
            argSource = sourceArguments(self)
            if not argSource:
                argSource = ' '
            s.append('%sbegin{%s}%s' % (escape, name, argSource))
            if self.hasChildNodes():
                for row in self:
                    for cell in row:
                        s.append(sourceChildren(cell, par=not(self.mathMode)))
                        if cell.endToken is not None:
                            s.append(cell.endToken.source)
                    if row.endToken is not None:
                        s.append(row.endToken.source)
                s.append('%send{%s}' % (escape, name))
            return ''.join(s)

        # \end environment
        if self.macroMode == Macro.MODE_END:
            return '%send{%s}' % (escape, name)
Example #3
0
        def source(self):
            """
            This source property is a little different than most.  
            Instead of printing just the source of the row, it prints
            out the entire environment with just this row as its content.
            This allows renderers to render images for arrays a row 
            at a time.

            """
            name = self.parentNode.nodeName
            escape = '\\'
            s = []
            argSource = sourceArguments(self.parentNode)
            if not argSource:
                argSource = ' '
            s.append('%sbegin{%s}%s' % (escape, name, argSource))
            for cell in self:
                s.append(
                    sourceChildren(cell, par=not (self.parentNode.mathMode)))
                if cell.endToken is not None:
                    s.append(cell.endToken.source)
            if self.endToken is not None:
                s.append(self.endToken.source)
            s.append('%send{%s}' % (escape, name))
            return ''.join(s)
Example #4
0
 def source(self):
     return "\\%s%s%s%s%s" % (
         self.nodeName,
         sourceArguments(self),
         self.delimiter,
         sourceChildren(self),
         self.delimiter,
     )
Example #5
0
 def source(self):
     s = []
     argSource = sourceArguments(self.parentNode)
     if not argSource:
         argSource = ' '
     if self.ref:
         s.append(r"\tag{%s}" % self.ref)
     for cell in self:
         s.append(
             sourceChildren(cell, par=not (self.parentNode.mathMode)))
         if cell.endToken is not None:
             s.append(cell.endToken.source)
     if self.endToken is not None:
         s.append(self.endToken.source)
     return ''.join(s)
Example #6
0
        def source(self):
            """
            This source property is a little different than most.  
            Instead of printing just the source of the row, it prints
            out the entire environment with just this row as its content.
            This allows renderers to render images for arrays a row 
            at a time.

            """
            name = self.parentNode.nodeName or 'array'
            escape = '\\'
            s = []
            argSource = sourceArguments(self.parentNode)
            if not argSource: 
                argSource = ' '
            s.append('%sbegin{%s}%s' % (escape, name, argSource))
            for cell in self:
                s.append(sourceChildren(cell, par=not(self.parentNode.mathMode)))
                if cell.endToken is not None:
                    s.append(cell.endToken.source)
            if self.endToken is not None:
                s.append(self.endToken.source)
            s.append('%send{%s}' % (escape, name))
            return ''.join(s)
Example #7
0
 def source(self):
     return r'\require{{cancel}}\cancel{obj}'.format(
         obj=sourceArguments(self).strip())
Example #8
0
 def source(self):
     return '\\%s%s%s%s%s' % (self.nodeName,
                              sourceArguments(self), self.delimiter,
                              sourceChildren(self), self.delimiter)
Example #9
0
 def source(self):
     return (
         r'\lower2pt\stackrel{{\large\smash{{{obj}}}}}{{\lower 3pt\sim}}'.
         format(obj=sourceArguments(self).strip()))
Example #10
0
 def source(self):
     return r'\stackrel{{{obj}}}{{\tiny\sim}}'.format(
         obj=sourceArguments(self).strip())
Example #11
0
 def source(self):
     return r'\mathbb{obj}'.format(obj=sourceArguments(self).strip())