Opened 9 months ago

Closed 9 months ago

Last modified 9 months ago

#33729 closed defect (fixed)

Latex display of integer mod ring is broken

Reported by: GMS Owned by:
Priority: blocker Milestone: sage-9.6
Component: user interface Keywords:
Cc: Eric Gourgoulhon Merged in:
Authors: Kwankyu Lee Reviewers: Matthias Koeppe
Report Upstream: N/A Work issues:
Branch: 9e2190c (Commits, GitHub, GitLab) Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by Kwankyu Lee)

This

Zn=IntegerModRing(6)
Zn

gives Ring of integers modulo 6. But after %display latex, it gives

\Bold๐‘/6\Bold๐‘

This is caused by the changes in #33475 merged to sage 9.6.beta6.

Reported at โ€‹https://groups.google.com/g/sage-support/c/NWGRB50xXNk).

Change History (18)

comment:1 Changed 9 months ago by Kwankyu Lee

Strange. It works well with me both with 9.6rc0 (on my desktop) and 9.5 (on Cocalc).

With 9.6rc0, what do you get from print(html(Zn))? I get

<html>\(\displaystyle \newcommand{\ZZ}{\Bold{Z}}\ZZ/6\ZZ\)</html>

comment:2 Changed 9 months ago by GMS

I get

<html>\[\newcommand{\Bold}[1]{\mathbf{#1}}\ZZ/6\ZZ\]</html>

BTW, this \newcommand{\Bold}[1]{\mathbf{#1}} appears every time for every displayed line.

This is on SageMath 9.5 from โ€‹https://github.com/3-manifolds/Sage_macOS/releases

comment:3 in reply to: ย 2 Changed 9 months ago by Kwankyu Lee

Replying to gh-GMS103:

I get

<html>\[\newcommand{\Bold}[1]{\mathbf{#1}}\ZZ/6\ZZ\]</html>

BTW, this \newcommand{\Bold}[1]{\mathbf{#1}} appears every time for every displayed line.

This is on SageMath 9.5 from โ€‹https://github.com/3-manifolds/Sage_macOS/releases

On sage 9.5 (on Cocalc), I get the same but it display well.

comment:4 in reply to: ย 2 Changed 9 months ago by Kwankyu Lee

Replying to gh-GMS103:

BTW, this \newcommand{\Bold}[1]{\mathbf{#1}} appears every time for every displayed line.

That was normal before sage 9.6.beta6.

Last edited 9 months ago by Kwankyu Lee (previous) (diff)

comment:5 Changed 9 months ago by Kwankyu Lee

I did experiments again, and now I can confirm that Zn shows

\Bold๐‘/6\Bold๐‘

and print(html(Zn)) shows

<html>\(\displaystyle \newcommand{\ZZ}{\Bold{Z}}\ZZ/6\ZZ\)</html>

with sage 9.6rc0. On the other hand, ZZ displays correctly and print(html(ZZ)) shows

<html>\(\displaystyle \newcommand{\Bold}[1]{\mathbf{#1}}\Bold{Z}\)</html>

I don't know what happened with me before...

comment:6 Changed 9 months ago by Kwankyu Lee

Authors: โ†’ Kwankyu Lee
Branch: โ†’ u/klee/33729
Commit: โ†’ 8eb67b8d9de1ba7f1a48e4f443b05b8b0d7ce08b
Priority: major โ†’ blocker
Status: new โ†’ needs_review

New commits:

โ€‹8eb67b8Add macro definitions recursively to latex output

comment:7 Changed 9 months ago by Kwankyu Lee

Cc: Eric Gourgoulhon added

comment:8 Changed 9 months ago by Kwankyu Lee

The branch was tested with

โ€‹https://nbviewer.org/github/egourgoulhon/SageMathTest/blob/master/Notebooks/test_display.ipynb

which may need an update for this ticket.

comment:9 Changed 9 months ago by Kwankyu Lee

Description: modified (diff)

comment:10 Changed 9 months ago by Kwankyu Lee

Summary: %display latex: \ZZ undefined โ†’ Latex display of integer mod ring is broken

comment:11 Changed 9 months ago by Kwankyu Lee

Description: modified (diff)

comment:12 Changed 9 months ago by Kwankyu Lee

To reviewer:

#33475 changed the way to get html(mathjax) output from the latex string of an object. It appends sage-defined macros that only appear in the latex string. But some macros use macros themselves. Hence the definitions of the latter macros are not included in the html output, causing the broken display.

The patch redefines the code to add macro definitions recursively.

comment:13 Changed 9 months ago by git

Commit: 8eb67b8d9de1ba7f1a48e4f443b05b8b0d7ce08b โ†’ 9e2190cc73f9c2064ec7001b2097b4bc805f52bf

Branch pushed to git repo; I updated commit sha1. New commits:

โ€‹9e2190cAdd a test

comment:14 Changed 9 months ago by Matthias Kรถppe

Reviewers: โ†’ Matthias Koeppe
Status: needs_review โ†’ positive_review

comment:15 Changed 9 months ago by Kwankyu Lee

Thanks!

comment:16 Changed 9 months ago by Volker Braun

Branch: u/klee/33729 โ†’ 9e2190cc73f9c2064ec7001b2097b4bc805f52bf
Resolution: โ†’ fixed
Status: positive_review โ†’ closed

comment:17 in reply to: ย 8 ; Changed 9 months ago by Eric Gourgoulhon

Commit: 9e2190cc73f9c2064ec7001b2097b4bc805f52bf

Replying to klee:

The branch was tested with

โ€‹https://nbviewer.org/github/egourgoulhon/SageMathTest/blob/master/Notebooks/test_display.ipynb

which may need an update for this ticket.

Done (cf. new cell no. 7).

BTW, thank you for the fix!

Last edited 9 months ago by Eric Gourgoulhon (previous) (diff)

comment:18 in reply to: ย 17 Changed 9 months ago by Kwankyu Lee

Replying to egourgoulhon:

Done (cf. new cell no. 7).

Thanks. The notebook is already very helpful.

Note: See TracTickets for help on using tickets.