#33729 closed defect (fixed)
Latex display of integer mod ring is broken
Reported by:  GMS  Owned by:  

Priority:  blocker  Milestone:  sage9.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: 
Description (last modified by )
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/sagesupport/c/NWGRB50xXNk).
Change History (18)
comment:1 Changed 9 months ago by
comment:2 followups: ย 3 ย 4 Changed 9 months ago by
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/3manifolds/Sage_macOS/releases
comment:3 Changed 9 months ago by
Replying to ghGMS103:
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/3manifolds/Sage_macOS/releases
On sage 9.5 (on Cocalc), I get the same but it display well.
comment:4 Changed 9 months ago by
Replying to ghGMS103:
BTW, this
\newcommand{\Bold}[1]{\mathbf{#1}}
appears every time for every displayed line.
That was normal before sage 9.6.beta6.
comment:5 Changed 9 months ago by
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
Authors:  โ Kwankyu Lee 

Branch:  โ u/klee/33729 
Commit:  โ 8eb67b8d9de1ba7f1a48e4f443b05b8b0d7ce08b 
Priority:  major โ blocker 
Status:  new โ needs_review 
New commits:
โ8eb67b8  Add macro definitions recursively to latex output

comment:7 Changed 9 months ago by
Cc:  Eric Gourgoulhon added 

comment:8 followup: ย 17 Changed 9 months ago by
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
Description:  modified (diff) 

comment:10 Changed 9 months ago by
Summary:  %display latex: \ZZ undefined โ Latex display of integer mod ring is broken 

comment:11 Changed 9 months ago by
Description:  modified (diff) 

comment:12 Changed 9 months ago by
To reviewer:
#33475 changed the way to get html(mathjax) output from the latex string of an object. It appends sagedefined 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
Commit:  8eb67b8d9de1ba7f1a48e4f443b05b8b0d7ce08b โ 9e2190cc73f9c2064ec7001b2097b4bc805f52bf 

Branch pushed to git repo; I updated commit sha1. New commits:
โ9e2190c  Add a test

comment:14 Changed 9 months ago by
Reviewers:  โ Matthias Koeppe 

Status:  needs_review โ positive_review 
comment:16 Changed 9 months ago by
Branch:  u/klee/33729 โ 9e2190cc73f9c2064ec7001b2097b4bc805f52bf 

Resolution:  โ fixed 
Status:  positive_review โ closed 
comment:17 followup: ย 18 Changed 9 months ago by
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!
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