コード例 #1
0
ファイル: Arrays.py プロジェクト: PatrickMassot/plastex
    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)
コード例 #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)
コード例 #3
0
ファイル: Arrays.py プロジェクト: go38/exeLearning
        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)
コード例 #4
0
ファイル: Verbatim.py プロジェクト: KatiaBorges/exeLearning
 def source(self):
     return "\\%s%s%s%s%s" % (
         self.nodeName,
         sourceArguments(self),
         self.delimiter,
         sourceChildren(self),
         self.delimiter,
     )
コード例 #5
0
ファイル: math.py プロジェクト: coursebuilder-ncl/makecourse
 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)
コード例 #6
0
ファイル: Arrays.py プロジェクト: PatrickMassot/plastex
        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)
コード例 #7
0
ファイル: __init__.py プロジェクト: christianp/makecourse
 def source(self):
     return r'\require{{cancel}}\cancel{obj}'.format(
         obj=sourceArguments(self).strip())
コード例 #8
0
 def source(self):
     return '\\%s%s%s%s%s' % (self.nodeName,
                              sourceArguments(self), self.delimiter,
                              sourceChildren(self), self.delimiter)
コード例 #9
0
 def source(self):
     return (
         r'\lower2pt\stackrel{{\large\smash{{{obj}}}}}{{\lower 3pt\sim}}'.
         format(obj=sourceArguments(self).strip()))
コード例 #10
0
ファイル: __init__.py プロジェクト: christianp/makecourse
 def source(self):
     return r'\stackrel{{{obj}}}{{\tiny\sim}}'.format(
         obj=sourceArguments(self).strip())
コード例 #11
0
 def source(self):
     return r'\mathbb{obj}'.format(obj=sourceArguments(self).strip())