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

[sympyprinting] MathJax can't render \root{m}{n} #1359

Closed
miham opened this issue Jan 31, 2012 · 1 comment
Closed

[sympyprinting] MathJax can't render \root{m}{n} #1359

miham opened this issue Jan 31, 2012 · 1 comment
Milestone

Comments

@miham
Copy link

miham commented Jan 31, 2012

When running IPython notebook (0.12 or git) with sympy profile, latex representation of higher order roots in the output cell doesn't get rendered. To reproduce the problem, run $ ipython2 notebook --profile=sympy and then execute

In [6]: a = 3**(S(1)/4) 
a

Out[6]: \root{4}{3}  # I should see nicely rendered root here, not LaTex code.

SymPy 0.7.1. is used for this examples. The problem is that sympyprinting extension uses iTex markup instead of regular Latex. Why is that good? Here's the difference in root representation:

In [7]: latex(a)
Out[7]: \sqrt[4]{3}   # MathJax can render this.

In [8]: latex(a, itex=True)
Out[8]: \root{4}{3}   # MathJax can't render this.

There are two workarounds:

  • You can set itex=False in extensions.sympyprinting.print_latex(), but that will probably break something else, or
  • add a line that replaces iTex form with LaTex form, import re; s = re.sub(r'\\root\{(.*?)\}\{(.*?)\}', r'\\sqrt[\1]{\2}', s)
ellisonbg added a commit to ellisonbg/ipython that referenced this issue Feb 1, 2012
Previuosly we were using itex=True in the sympy latex printer.
I don't know why where were doing this but we should use regular
printing mode and put the $$ around the equations ourselves.
@fperez
Copy link
Member

fperez commented Feb 2, 2012

See discussion on #1361 for the status of this one, at least on my machine.

ellisonbg added a commit to ellisonbg/ipython that referenced this issue Feb 2, 2012
Older versions of sympy put in an extra $ when using
latex(e, mode='plain'). We are removing those before we add our
own to make sure it works.
@fperez fperez closed this as completed in 54c3e06 Feb 2, 2012
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
Previuosly we were using itex=True in the sympy latex printer.
I don't know why where were doing this but we should use regular
printing mode and put the $$ around the equations ourselves.
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
Older versions of sympy put in an extra $ when using
latex(e, mode='plain'). We are removing those before we add our
own to make sure it works.
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
A number of bug fixes for notebook issues that had crept up recently with all the major improvements done on multiple fronts.

In closing ipython#1359, we've changed slightly how Math() works: it now unconditionally surrounds its input with $$...$$, so that it always appears in displayed math mode.  We have also introduced a new display object, Latex(), which does *not* add any latex markup, for other constructs beyond simple math expressions.  This change makes Math() friendlier to use in simple cases and means that Math(sympy.latex(foo)) will produce the expected displayed math results without the user having to add any $ markup.

Summary of fixes:

Fixes ipython#1344: Ctrl + M + L does not toggle line numbering in htmlnotebook.

Fixes ipython#1337: Tab in the notebook after `(` should not indent, only give a tooltip.

Fixes ipython#1339: Notebook printing broken.

Fixes ipython#1348: `Ctrl-m-Ctrl-m` does not switch to markdown cell

Fixes ipython#1359: [sympyprinting] MathJax can't render \root{m}{n}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants