Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Math formulas can not display in headlines. #14

Open
shanhaiying opened this issue Feb 2, 2017 · 5 comments
Open

Math formulas can not display in headlines. #14

shanhaiying opened this issue Feb 2, 2017 · 5 comments
Labels

Comments

@shanhaiying
Copy link

shanhaiying commented Feb 2, 2017

Math formulas can not display in headlines if the LaTeX_envs activated.

image

The result is :
image

when the LaTeX_envs deactivated the result is:

image

@jfbercher
Copy link
Owner

Thanks. Good spot. I can reproduce. It seems that something has changed between notebook 4.2 and 4.3 in the sanitize_html step. A quick fix is just to exchange two lines in the MarkdownCell.prototype.renderin latex_envs.js to read

                html = security.sanitize_html(html);
		html = thmsInNbConv(marked, html); //<----- thmsInNb patch here

I will fix that shortly (but I have also some other little things to include).

@jfbercher jfbercher added the bug label Feb 2, 2017
@shanhaiying
Copy link
Author

I have tried to fix this as you suggest. I find it is not always effective.
If there are some code cell changed to text cell, then the math formulas in headlines will disappear again until the page is refreshed.

@jfbercher
Copy link
Owner

Sorry, I can not reproduce. Can you describe step by step the scenario?

@shanhaiying
Copy link
Author

The following screencap show what happen. But I can not reproduce it every time.
test

@jfbercher
Copy link
Owner

Actually, I think that this is a rather involved issue involving an interaction between latex_envs and toc2: toc2 copies the headers into links in order to populate: the toc2 widow/sidebar, the table of contents (if enabled) in the notebook, the navigate menu. When latex_envs is enabled, it has the capability to keep all equations and environments correctly numbered: each markdown rendering entails the reset of all equations nubers and the recomputation of all math renderings. Maths are stored as a preview in html, with styling, classes, ids, end embedded scripts. When copying the headers into links, these previews are copied as well. The duplication of ids than cause a mess to the webpage rendering: maths in the toc window/sidebar is sometimes duplicated, maths can disappear in the toc and/or in the navigation menu.
I have made a PR to jupyter_contrib_nbextensions to remove mathjax previews when creating links in toc2. This has also the advantage of restoring a simpler html source (see the toc_cell source for instance).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants