Ticket #15210: trac_15210-operation_table-latex-nt.patch

File trac_15210-operation_table-latex-nt.patch, 2.3 KB (added by nthiery, 8 years ago)
  • sage/matrix/operation_table.py

    # HG changeset patch
    # User Nicolas M. Thiery <nthiery@users.sf.net>
    # Date 1379504469 -7200
    #      Wed Sep 18 13:41:09 2013 +0200
    # Node ID ff51a7930848afd20f209622a83e55ca65a62888
    # Parent  f0ee3538887fe739601babb54e177ec5e1133b7a
    #15210: fix latex for operation tables
    
    diff --git a/sage/matrix/operation_table.py b/sage/matrix/operation_table.py
    a b class OperationTable(SageObject): 
    278278        *
    279279         +
    280280        sage: T._latex_()
    281         '{\\setlength{\\arraycolsep}{2\\ex}\n\\begin{array}{r|*{0}{r}}\n\\multicolumn{1}{c|}{\\ast}\\\\\\hline\n\\end{array}}'
     281        '{\\setlength{\\arraycolsep}{2ex}\n\\begin{array}{r|*{0}{r}}\n\\multicolumn{1}{c|}{\\ast}\\\\\\hline\n\\end{array}}'
    282282
    283283    If the algebraic structure cannot be listed (like when it is infinite)
    284284    then there is no way to create a table. ::
    class OperationTable(SageObject): 
    673673            b| b c a
    674674            c| c a b
    675675            sage: T._latex_()
    676             '{\\setlength{\\arraycolsep}{2\\ex}\n\\begin{array}{r|*{3}{r}}\n\\multicolumn{1}{c|}{\\times}&a&b&c\\\\\\hline\n{}a&a&b&c\\\\\n{}b&b&c&a\\\\\n{}c&c&a&b\\\\\n\\end{array}}'
     676            '{\\setlength{\\arraycolsep}{2ex}\n\\begin{array}{r|*{3}{r}}\n\\multicolumn{1}{c|}{\\times}&a&b&c\\\\\\hline\n{}a&a&b&c\\\\\n{}b&b&c&a\\\\\n{}c&c&a&b\\\\\n\\end{array}}'
    677677
    678678        TESTS::
    679679
    class OperationTable(SageObject): 
    10001000            sage: R=Integers(2)
    10011001            sage: T=OperationTable(R, operation=operator.mul)
    10021002            sage: T._latex_()
    1003             '{\\setlength{\\arraycolsep}{2\\ex}\n\\begin{array}{r|*{2}{r}}\n\\multicolumn{1}{c|}{\\ast}&a&b\\\\\\hline\n{}a&a&a\\\\\n{}b&a&b\\\\\n\\end{array}}'
     1003            '{\\setlength{\\arraycolsep}{2ex}\n\\begin{array}{r|*{2}{r}}\n\\multicolumn{1}{c|}{\\ast}&a&b\\\\\\hline\n{}a&a&a\\\\\n{}b&a&b\\\\\n\\end{array}}'
    10041004        """
    10051005        n = self._n
    10061006        names = self._names
    10071007
    10081008        # Headers
    1009         table = ['{\\setlength{\\arraycolsep}{2\\ex}\n']
     1009        table = ['{\\setlength{\\arraycolsep}{2ex}\n']
    10101010        table.append('\\begin{array}{r|*{'+str(n)+'}{r}}\n')
    10111011        table.append('\\multicolumn{1}{c|}{'+self._latex_symbol+'}')
    10121012        table += ['&'+names[i] for i in range(n)]