Oscar.jl icon indicating copy to clipboard operation
Oscar.jl copied to clipboard

printing an integer inside jupyter kernel

Open edgarcosta opened this issue 2 years ago • 8 comments

Describe the bug Should not be seeing \toggle or \endtoggle inside jupyter kernel.

To Reproduce

@time using Oscar;
ZZ(10)^50

output:

\toggle(10000..(51 digits)..00000)100000000000000000000000000000000000000000000000000\endtoggle

See screenshot:

Screen Shot 2022-06-27 at 13 57 23

Expected behavior I would expect to see the output that Nemo gives.

System (please complete the following information):

julia> Oscar.versioninfo(full=true)
OSCAR version 0.9.0
  combining:
    AbstractAlgebra.jl   v0.26.0
    GAP.jl               v0.8.1
    Hecke.jl             v0.14.7
    Nemo.jl              v0.31.1
    Polymake.jl          v0.7.2
    Singular.jl          v0.10.2
  building on:
    Antic_jll               v0.200.501+0
    Arb_jll                 v200.2200.0+0
    Calcium_jll             v0.400.102+0
    FLINT_jll               v200.800.500+0
    GAP_jll                 v400.1192.2+1
    Singular_jll            v403.1.300+0
    libpolymake_julia_jll   v0.8.0+2
    libsingular_julia_jll   v0.23.1+0
    msolve_jll              v0.2.3+1
    polymake_jll            v400.600.0+0
See `]st -m` for a full list of dependencies.

Julia Version 1.7.3
Commit 742b9abb4d (2022-05-06 12:58 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU @ 2.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, cascadelake)
Official https://julialang.org/ release
...

edgarcosta avatar Jun 27 '22 17:06 edgarcosta

the culprit: https://github.com/thofma/Hecke.jl/blob/master/src/Misc/IJulia.jl#L213=

tks @alexjbest

edgarcosta avatar Jun 27 '22 18:06 edgarcosta

@fieker Do you remember how that toggle business works?

thofma avatar Jun 27 '22 18:06 thofma

Looks like one way of getting this feature working is to ensure that the following jupyterlab extension is installed: https://github.com/jupyterlab/jupyter-renderers/tree/master/packages/mathjax3-extension you can do this with jupyter labextension install @jupyterlab/mathjax3-extension when in the appropriate environment

alexjbest avatar Jun 27 '22 18:06 alexjbest

@alexjbest yup, I can also confirm that it works with the extension, however, not obvious that I needed the extension

edgarcosta avatar Jun 27 '22 20:06 edgarcosta

maybe something should be added to https://oscar.computeralgebra.de/install/ in the IJulia section?

edgarcosta avatar Jun 27 '22 20:06 edgarcosta

Ideally Hecke should be able to check that mathjax 3 is available somehow, it already detects that ijulia is loaded and otherwise doesn't use the toggle feature, I imagine it's slightly harder to detect mathjax3 though. So instead maybe some TeX code could be emitted that does the switching? I'm not sure how precisely that would work, but there is surely some detectable difference between latex and mathjax?

alexjbest avatar Jun 27 '22 20:06 alexjbest

On Mon, Jun 27, 2022 at 11:36:00AM -0700, Tommy Hofmann wrote:

@fieker Do you remember how that toggle business works?

In Hecke.jl init:

#if inNotebook() # to make toggle work in IJulia

display("text/html", "$\require{action}$")

#end

why we disallowed: no idea. Maybe there was a jupyter change?

-- Reply to this email directly or view it on GitHub: https://github.com/oscar-system/Oscar.jl/issues/1424#issuecomment-1167723861 You are receiving this because you were mentioned.

Message ID: @.***>

fieker avatar Jun 28 '22 07:06 fieker

Ah, I think at some point I wanted the pure julia output (no LaTeX shenanigans) in the notebook. I am also not sure how nice these things play with the set_html_as_latex toggle (https://nemocas.github.io/AbstractAlgebra.jl/dev/misc/#Printing-options).

thofma avatar Jun 28 '22 08:06 thofma

I just checked with Oscar v0.11.3 and cannot produce the issue. It seems like the issue was fixed over the course of the last 10 months.

YueRen avatar Mar 20 '23 17:03 YueRen

Thanks for checking @YueRen

thofma avatar Mar 20 '23 17:03 thofma