Beispiel #1
0
 def source(self):
     # Don't put paragraphs into math mode arrays
     if self.parentNode is None:
        # no parentNode, assume mathMode==False
        return sourceChildren(self, True)
     return sourceChildren(self,
                par=not(self.parentNode.parentNode.mathMode))
Beispiel #2
0
 def source(self):
     # Don't put paragraphs into math mode arrays
     if self.parentNode is None:
        # no parentNode, assume mathMode==False
        return sourceChildren(self, True)
     return sourceChildren(self, 
                par=not(self.parentNode.parentNode.mathMode))
Beispiel #3
0
 def source(self):
     if self.ref:
         return u"\\begin{{{0}}}{1}\\tag{{{2}}}\\end{{{0}}}".format(
             self.tagName,
             sourceChildren(self).strip(), self.ref)
     else:
         return u"\\begin{{{0}}}{1}\\end{{{0}}}".format(
             self.tagName,
             sourceChildren(self).strip())
Beispiel #4
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)
Beispiel #5
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)
Beispiel #6
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)
Beispiel #7
0
 def source(self):
     return "\\%s%s%s%s%s" % (
         self.nodeName,
         sourceArguments(self),
         self.delimiter,
         sourceChildren(self),
         self.delimiter,
     )
Beispiel #8
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)
Beispiel #9
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)
Beispiel #10
0
 def source(self):
     if self.hasChildNodes():
         return '{%s}' % sourceChildren(self)
     return '{'
Beispiel #11
0
 def source(self):
     return '$\\displaystyle %s $' % sourceChildren(self, par=False)
Beispiel #12
0
 def source(self):
     return u"\\begin{{{0}}}{1}\\end{{{0}}}".format(self.tagName,
                                                    sourceChildren(self))
Beispiel #13
0
 def source(self):
     if self.hasChildNodes():
         return '%s\n\n' % sourceChildren(self)
     return '\n\n'
Beispiel #14
0
 def source(self):
     return '$\\displaystyle %s $' % sourceChildren(self, par=False)
Beispiel #15
0
 def mathjax_source(self):
     if self.hasChildNodes():
         s = sourceChildren(self)
         return r'\({}\)'.format(mathjax_lt_gt(s))
     return ''
Beispiel #16
0
 def source(self):
     return '\\displaystyle {content}'.format(
         content=sourceChildren(self, par=False).strip())
Beispiel #17
0
 def source(self):
     if self.hasChildNodes():
         return r'<script type="math/tex">{}</script>'.format(
             sourceChildren(self))
     return ''
Beispiel #18
0
 def source(self):
     # Don't put paragraphs into math mode arrays
     return sourceChildren(
         self, par=not (self.parentNode.parentNode.mathMode))
Beispiel #19
0
 def source(self):
     if self.hasChildNodes():
         return r'\[ %s \]' % sourceChildren(self)
     if self.macroMode == Command.MODE_END:
         return r'\]'
     return r'\['
Beispiel #20
0
 def source(self):
     if self.hasChildNodes():
         return '{%s}' % sourceChildren(self)
     elif hasattr(self, 'endit'):
         return '{}'
     return '{'
Beispiel #21
0
 def source(self):
     return u"\\begin{{{0}}}{1}\\end{{{0}}}".format(
             self.tagName,
             sourceChildren(self))
Beispiel #22
0
 def source(self):
     if self.hasChildNodes():
         return '{%s}' % sourceChildren(self)
     return '{'
Beispiel #23
0
 def source(self):
     if self.hasChildNodes():
         return '$%s$' % sourceChildren(self)
     return '$'
Beispiel #24
0
 def source(self):
     return sourceChildren(self).strip()
Beispiel #25
0
 def source(self):
     if self.hasChildNodes():
         return r'\[ %s \]' % sourceChildren(self)
     if self.macroMode == Command.MODE_END:
         return r'\]'
     return r'\['
Beispiel #26
0
 def source(self):
     if self.hasChildNodes():
         return "{%s}" % sourceChildren(self)
     return "{"
Beispiel #27
0
 def source(self):
     if self.hasChildNodes():
         return r'\(%s\)' % sourceChildren(self)
     return r'\('
Beispiel #28
0
 def source(self):
     return '\\%s%s%s%s%s' % (self.nodeName,
                              sourceArguments(self), self.delimiter,
                              sourceChildren(self), self.delimiter)
Beispiel #29
0
 def source(self):
     if self.hasChildNodes():
         return '$%s$' % sourceChildren(self)
     return '$'
Beispiel #30
0
 def source(self):
     # Don't put paragraphs into math mode arrays
     return sourceChildren(self, 
                par=not(self.parentNode.parentNode.mathMode))
Beispiel #31
0
 def source(self):
     if self.hasChildNodes():
         return '{%s}' % sourceChildren(self)
     elif hasattr(self, 'endit'):
         return '{}'
     return '{'
Beispiel #32
0
 def source(self):
     if self.hasChildNodes():
         return "$%s$" % sourceChildren(self)
     return "$"