Example #1
0
def print_latex_table(out, table, justs=None, separator=None, headings=False):
    """
    Prints out the Latex code to display the given
    2D list as a table.
    
    """
    if justs is None:
        justs = ["l"] * len(table[0])

    if separator:
        coldiv = " | "
    else:
        coldiv = " "

    print >> out, "\\begin{tabular}{%s}" % coldiv.join(justs)

    if headings:
        print >> out, " & ".join(
            ["\\textbf{%s}" % filter_latex("%s" % cell)
             for cell in table[0]]) + "\\\\\n"
        print >> out, "\\\\\n".join([
            " & ".join([filter_latex("%s" % cell) for cell in row])
            for row in table[1:]
        ])
    else:
        print >> out, "\\\\\n".join([
            " & ".join([filter_latex("%s" % cell) for cell in row])
            for row in table
        ])

    print >> out, "\\end{tabular}"
Example #2
0
def print_latex_table(out, table, justs=None, separator=None, headings=False):
    """
    Prints out the Latex code to display the given
    2D list as a table.
    
    """
    if justs is None:
        justs = ["l"] * len(table[0])
    
    if separator:
        coldiv = " | "
    else:
        coldiv = " "
        
    print >> out, "\\begin{tabular}{%s}" % coldiv.join(justs)
    
    if headings:
        print >> out, " & ".join(["\\textbf{%s}" % filter_latex("%s" % cell) for cell in table[0]]) + "\\\\\n"
        print >> out, "\\\\\n".join([" & ".join([filter_latex("%s" % cell) for cell in row]) for row in table[1:]])
    else:
        print >> out, "\\\\\n".join([" & ".join([filter_latex("%s" % cell) for cell in row]) for row in table])
    
    print >> out, "\\end{tabular}"
Example #3
0
 def to_latex(self):
     if self.forward:
         str = "/"
     else:
         str = "\\backslash "
     return filter_latex(str)
Example #4
0
 def to_latex(self):
     if self.forward:
         str = "/"
     else:
         str = "\\backslash "
     return filter_latex(str)
Example #5
0
 def to_latex(self):
     return filter_latex(str(self))