Opened 7 years ago

Closed 6 years ago

#15210 closed defect (fixed)

Fix latex for operation tables

Reported by: nthiery Owned by:
Priority: major Milestone: sage-5.13
Component: group theory Keywords:
Cc: rbeezer Merged in: sage-5.13.beta3
Authors: Nicolas M. Thiéry Reviewers: Jeroen Demeyer
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

    sage: from sage.matrix.operation_table import OperationTable
    sage: R=Integers(2)
    sage: T=OperationTable(R, operation=operator.mul)
    sage: view(T)
    *** boom ***

And indeed, there is a spurious \ in 2\ex in the latex output:

    sage: T._latex_()
    '{\\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}}'

Reported by Nicolas Martin and Loïc Devilliers

Attachments (1)

trac_15210-operation_table-latex-nt.patch (2.3 KB) - added by nthiery 6 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 follow-up: Changed 7 years ago by nthiery

I am wondering if we should not actualy run latex whenever we doctest a latex method. That is include something like

    sage: view(T, viewer=None)

Or just

    sage: view(T)

If we configure view to not actually run the viewer when in doctest mode.

comment:2 Changed 6 years ago by nthiery

  • Status changed from new to needs_review

comment:3 in reply to: ↑ 1 Changed 6 years ago by jdemeyer

  • Reviewers set to Jeroen Demeyer
  • Status changed from needs_review to positive_review

Replying to nthiery:

I am wondering if we should not actualy run latex whenever we doctest a latex method.

Remember that LaTeX isn't a prerequisite of Sage, so we could only do that as optional doctest.

The patch obviously fixes the bug.

comment:4 Changed 6 years ago by jdemeyer

  • Status changed from positive_review to needs_work
sage -t devel/sage/sage/matrix/operation_table.py
**********************************************************************
File "devel/sage/sage/matrix/operation_table.py", line 280, in sage.matrix.operation_table.OperationTable
Failed example:
    T._latex_()
Expected:
    '{\\setlength{\\arraycolsep}{2\\ex}\n\\begin{array}{r|*{0}{r}}\n\\multicolumn{1}{c|}{\\ast}\\\\\\hline\n\\end{array}}'
Got:
    '{\\setlength{\\arraycolsep}{2ex}\n\\begin{array}{r|*{0}{r}}\n\\multicolumn{1}{c|}{\\ast}\\\\\\hline\n\\end{array}}'
**********************************************************************
File "devel/sage/sage/matrix/operation_table.py", line 675, in sage.matrix.operation_table.OperationTable.set_print_symbols
Failed example:
    T._latex_()
Expected:
    '{\\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{a
rray}}'
Got:
    '{\\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{arr
ay}}'
**********************************************************************

Changed 6 years ago by nthiery

comment:5 Changed 6 years ago by nthiery

  • Status changed from needs_work to needs_review

Oops, how did I missed this??? Thanks for the report ... Fixed in the updated patch.

comment:6 Changed 6 years ago by jdemeyer

  • Merged in set to sage-5.13.beta3
  • Resolution set to fixed
  • Status changed from needs_review to closed
Note: See TracTickets for help on using tickets.