Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#19374 closed defect (fixed)

LaTeX display broken in Jupyter output cells

Reported by: egourgoulhon Owned by:
Priority: blocker Milestone: sage-6.9
Component: interfaces Keywords: jupyter, latex
Cc: Merged in:
Authors: Volker Braun, Jeroen Demeyer Reviewers: Eric Gourgoulhon, Jeroen Demeyer
Report Upstream: N/A Work issues:
Branch: fbbb44d (Commits, GitHub, GitLab) Commit:
Dependencies: Stopgaps:

Status badges

Description

The LaTeX display of output cells in the Jupyter notebook, which was working in Sage 6.8, is broken in Sage 6.9rc3: the LaTeX code is shown instead of the formula:

./sage -n jupyter
In[1]: %display latex
In[2]: sin(x^2)
Out[2]: \newcommand{\Bold}[1]{\mathbf{#1}}\sin\left(x^{2}\right)

Change History (28)

comment:1 follow-up: Changed 6 years ago by jdemeyer

Since I'm in Jupyter mood anyway, I'm having a look.

comment:2 in reply to: ↑ 1 Changed 6 years ago by egourgoulhon

Very good. Tell me if I can help at some point.

comment:3 Changed 6 years ago by jdemeyer

  • Authors set to Jeroen Demeyer
  • Dependencies set to #19371

comment:4 Changed 6 years ago by jdemeyer

  • Branch set to u/jdemeyer/latex_display_broken_in_jupyter_output_cells

comment:5 Changed 6 years ago by jdemeyer

  • Commit set to 9826af55f96a63740e46f9865ebd86dc5c64f5e4
  • Status changed from new to needs_review

New commits:

7c916efInstall Jupyter kernel spec in $SAGE_LOCAL
9826af5Fix MathJax path for Jupyter

comment:6 Changed 6 years ago by egourgoulhon

  • Reviewers set to Eric Gourgoulhon
  • Status changed from needs_review to positive_review

Thanks for the fix ! Seems good to me: LaTeX display is OK now and all doctests in src/sage/repl/ipython_kernel are passed. A remark though: sage -coverage src/sage/repl/ipython_kernel reports some missing documentation.

comment:7 follow-up: Changed 6 years ago by jdemeyer

Does this imply also a positive review for the dependency #19371?

comment:8 in reply to: ↑ 7 Changed 6 years ago by egourgoulhon

Replying to jdemeyer:

Does this imply also a positive review for the dependency #19371?

Yes, but I said there, it would be nice if somebody else gives a second look at it.

comment:9 Changed 6 years ago by jdemeyer

  • Status changed from positive_review to needs_work

comment:10 Changed 6 years ago by jdemeyer

  • Dependencies #19371 deleted

I am going to make this independent of #19371.

comment:11 Changed 6 years ago by vbraun

  • Branch changed from u/jdemeyer/latex_display_broken_in_jupyter_output_cells to 9826af55f96a63740e46f9865ebd86dc5c64f5e4
  • Resolution set to fixed
  • Status changed from needs_work to closed

comment:12 Changed 6 years ago by vbraun

  • Branch changed from 9826af55f96a63740e46f9865ebd86dc5c64f5e4 to u/jdemeyer/latex_display_broken_in_jupyter_output_cells
  • Resolution fixed deleted
  • Status changed from closed to new

comment:13 follow-up: Changed 6 years ago by vbraun

Is this still a blocker? I would like to push the next release out some time soon...

comment:14 Changed 6 years ago by git

  • Commit changed from 9826af55f96a63740e46f9865ebd86dc5c64f5e4 to a2fb2e2bc688ae526f0580a6b931e6ea45f68b4d

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

a2fb2e2Fix MathJax path for Jupyter

comment:15 Changed 6 years ago by jdemeyer

  • Status changed from new to needs_review

comment:16 in reply to: ↑ 13 ; follow-up: Changed 6 years ago by jdemeyer

Replying to vbraun:

Is this still a blocker? I would like to push the next release out some time soon...

I personally don't care so much. The unrebased branch here seems to work but somebody needs to review it.

comment:17 in reply to: ↑ 16 Changed 6 years ago by egourgoulhon

Replying to jdemeyer:

Replying to vbraun:

Is this still a blocker? I would like to push the next release out some time soon...

I personally don't care so much. The unrebased branch here seems to work but somebody needs to review it.

I am on it (the recompilation of the cython part triggered by make takes time) and shall report asap.

comment:18 Changed 6 years ago by vbraun

  • Branch changed from u/jdemeyer/latex_display_broken_in_jupyter_output_cells to u/vbraun/latex_display_broken_in_jupyter_output_cells

comment:19 Changed 6 years ago by vbraun

  • Commit changed from a2fb2e2bc688ae526f0580a6b931e6ea45f68b4d to 4fcdb6ee743d6d73f90017bf919b87a7095e8fab

I think its better to use jupyter's builtin configuration mechanism instead of digging into the jupyter internals, here is an alternative fix.


New commits:

4fcdb6eUse jupyter_notebook_config.py to setup mathjax url

comment:20 Changed 6 years ago by jdemeyer

It indeed looks like a better strategy.

By the way, a git question: is there a simple way to do git trac pull <ticket> and completely overwrite any existing branch on my side? I just want your branch, not a merge of my and your branch. I usually do something like

$ git checkout 6.9.rc3   # or any other commit/branch
$ git branch -D t/19374/latex_display_broken_in_jupyter_output_cells
$ git trac checkout 19374

but it would be nice to be able to do this in a simpler way.

comment:21 Changed 6 years ago by jdemeyer

  • Authors changed from Jeroen Demeyer to Volker Braun
  • Reviewers changed from Eric Gourgoulhon to Eric Gourgoulhon, Jeroen Demeyer

comment:22 follow-up: Changed 6 years ago by vbraun

The normal git pull will never throw away your local branch, git trac pull just mirrors that.

If you want to reuse the existing local branch you can fetch+reset instead of delete+checkout:

git trac fetch 19374
git reset --hard FETCH_HEAD

just like how you would use git directly.

comment:23 Changed 6 years ago by jdemeyer

  • Branch changed from u/vbraun/latex_display_broken_in_jupyter_output_cells to u/jdemeyer/latex_display_broken_in_jupyter_output_cells

comment:24 Changed 6 years ago by jdemeyer

  • Commit changed from 4fcdb6ee743d6d73f90017bf919b87a7095e8fab to fbbb44dbb56529080b8229ad857a209ac54495c8

Better use a relative path: absolute paths don't work with Jupyterhub (see also #19373)

If somebody can review my commit, you can set this ticket to positive_review.


New commits:

fbbb44dUse relative path to MathJax; minor fixes

comment:25 Changed 6 years ago by vbraun

  • Authors changed from Volker Braun to Volker Braun, Jeroen Demeyer
  • Status changed from needs_review to positive_review

Thanks!

comment:26 Changed 6 years ago by egourgoulhon

I confirm that the latest commit works. Thanks to both of you for this fix!

comment:27 Changed 6 years ago by vbraun

  • Branch changed from u/jdemeyer/latex_display_broken_in_jupyter_output_cells to fbbb44dbb56529080b8229ad857a209ac54495c8
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:28 in reply to: ↑ 22 Changed 6 years ago by jdemeyer

  • Commit fbbb44dbb56529080b8229ad857a209ac54495c8 deleted

Replying to vbraun:

If you want to reuse the existing local branch you can fetch+reset instead of delete+checkout:

git trac fetch 19374
git reset --hard FETCH_HEAD

just like how you would use git directly.

Thanks! I didn't know the command git reset --hard <something> but it looks very useful indeed.

Note: See TracTickets for help on using tickets.