(self, printer)
return s
Returns the string representation of 'self'.
Returns the string representation of 'self'.
Returns the string representation of self .
def _latex(self, printer):
        """
        Returns the string representation of 'self'.
        """
        # Check heading:
        if self._headings[1]:
            new_line = []
            for i in range(self._w):
                # Format the item somehow if needed:
                new_line.append(str(self._headings[1][i]))
            self._headings[1] = new_line

        alignments = []
        if self._headings[0]:
            self._headings[0] = [str(x) for x in self._headings[0]]
            alignments = [self._head_align]
        alignments.extend(self._alignments)

        s = r"\begin{tabular}{" + " ".join(alignments) + "}\n"

        if self._headings[1]:
            d = self._headings[1]
            if self._headings[0]:
                d = [""] + d
            first_line = " & ".join(d) + r" \\" + "\n"
            s += first_line
            s += r"\hline" + "\n"
        for i, line in enumerate(self._lines):
            d = []
            for j, x in enumerate(line):
                if self._wipe_zeros and (x in (0, "0")):
                    d.append(" ")
                    continue
                f = self._column_formats[j]
                if f:
                    if isinstance(f, FunctionType):
                        v = f(x, i, j)
                        if v is None:
                            v = printer._print(x)
                    else:
                        v = f % x
                    d.append(v)
                else:
                    v = printer._print(x)
                    d.append("$%s$" % v)
            if self._headings[0]:
                d = [self._headings[0][i]] + d
            s += " & ".join(d) + r" \\" + "\n"
        s += r"\end{tabular}"
        return s
def _latex ( self , printer ) : # Check heading: if self . _headings [ 1 ] : new_line = [ ] for i in range ( self . _w ) : # Format the item somehow if needed: new_line . append ( str ( self . _headings [ 1 ] [ i ] ) ) self . _headings [ 1 ] = new_line alignments = [ ] if self . _headings [ 0 ] : self . _headings [ 0 ] = [ str ( x ) for x in self . _headings [ 0 ] ] alignments = [ self . _head_align ] alignments . extend ( self . _alignments ) s = r"\begin{tabular}{" + " " . join ( alignments ) + "}\n" if self . _headings [ 1 ] : d = self . _headings [ 1 ] if self . _headings [ 0 ] : d = [ "" ] + d first_line = " & " . join ( d ) + r" \\" + "\n" s += first_line s += r"\hline" + "\n" for i , line in enumerate ( self . _lines ) : d = [ ] for j , x in enumerate ( line ) : if self . _wipe_zeros and ( x in ( 0 , "0" ) ) : d . append ( " " ) continue f = self . _column_formats [ j ] if f : if isinstance ( f , FunctionType ) : v = f ( x , i , j ) if v is None : v = printer . _print ( x ) else : v = f % x d . append ( v ) else : v = printer . _print ( x ) d . append ( "$%s$" % v ) if self . _headings [ 0 ] : d = [ self . _headings [ 0 ] [ i ] ] + d s += " & " . join ( d ) + r" \\" + "\n" s += r"\end{tabular}" return s