# Add math formula support for Markdown interpretter

## Details

• Type: Improvement
• Status: Resolved
• Priority: Minor
• Resolution: Fixed
• Affects Version/s: None
• Fix Version/s:
• Component/s: None
• Labels:
None

## Description

One of the leading use cases for Zeppelin is for doing collaborative data science. Being able to easily describe the mathematics of algorithms in local notebooks would be a very useful improvement.

## Activity

Hide
Danilo Ascione added a comment -

TeX support would be great.

Show
Danilo Ascione added a comment - TeX support would be great.
Hide
ASF GitHub Bot added a comment -

GitHub user Leemoonsoo opened a pull request:

ZEPPELIN-777 Math formula support

1. What is this PR for?
This PR adds support for formatting math formula formatting in %html display system using MathJax library.

Note that, it works

1. What type of PR is it?
Feature
1. Todos
• [x] - Format math formula with MathJax library
1. What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-777
1. How should this be tested?
try run following codes.

%md
When
(a
ne 0
), there are two solutions to
(ax^2 + bx + c = 0
) and they are
$$x = {-b \pm \sqrt {b^2-4ac} \over 2a}.$$

Note MathJax works better with markdown.parser.type property set pegdown, in markdown interpreter. With default markdown4j parser, some formula is not well displayed. (for example, ax^2) I think this will not be a big problem because of we'll remove markdown4j https://github.com/apache/zeppelin/pull/1594


%sh echo -e "%html \$\$a = b\$\$"



%spark println("%html $$b = c$$")


1. Screenshots (if appropriate)
![image](https://cloud.githubusercontent.com/assets/1540981/20040864/3b69c540-a414-11e6-8f8a-fdf7ee1370a6.png)
1. Questions:
• Does the licenses files need update? yes
• Is there breaking changes for older versions? no
• Does this needs documentation? yes

You can merge this pull request into a Git repository by running:

Alternatively you can review and apply these changes as the patch at:

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1606

Author: Lee moon soo <moon@apache.org>
Date: 2016-11-06T19:21:02Z

Format formula using MathJax

Show
ASF GitHub Bot added a comment - GitHub user Leemoonsoo opened a pull request: https://github.com/apache/zeppelin/pull/1606 ZEPPELIN-777 Math formula support What is this PR for? This PR adds support for formatting math formula formatting in %html display system using MathJax library. Note that, it works What type of PR is it? Feature Todos [x] - Format math formula with MathJax library What is the Jira issue? https://issues.apache.org/jira/browse/ZEPPELIN-777 How should this be tested? try run following codes.  %md When (a ne 0 ), there are two solutions to (ax^2 + bx + c = 0 ) and they are $$x = {-b \pm \sqrt {b^2-4ac} \over 2a}.$$  Note MathJax works better with markdown.parser.type property set pegdown, in markdown interpreter. With default markdown4j parser, some formula is not well displayed. (for example, ax^2) I think this will not be a big problem because of we'll remove markdown4j https://github.com/apache/zeppelin/pull/1594  %sh echo -e "%html \$\$a = b\$\$"   %spark println("%html $$b = c$$")  Screenshots (if appropriate) ! [image] ( https://cloud.githubusercontent.com/assets/1540981/20040864/3b69c540-a414-11e6-8f8a-fdf7ee1370a6.png ) Questions: Does the licenses files need update? yes Is there breaking changes for older versions? no Does this needs documentation? yes You can merge this pull request into a Git repository by running: $git pull https://github.com/Leemoonsoo/zeppelin ZEPPELIN-777 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/zeppelin/pull/1606.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1606 commit 05a699939b18332e20b99a0ad4def1fb63b07a24 Author: Lee moon soo <moon@apache.org> Date: 2016-11-06T19:21:02Z Format formula using MathJax Hide ASF GitHub Bot added a comment - Github user Leemoonsoo commented on the issue: cc @1ambda @AhyoungRyu Show ASF GitHub Bot added a comment - Github user Leemoonsoo commented on the issue: https://github.com/apache/zeppelin/pull/1606 cc @1ambda @AhyoungRyu Hide ASF GitHub Bot added a comment - Github user Leemoonsoo commented on the issue: @AhyoungRyu @anthonycorbacho addressed your comments. Show ASF GitHub Bot added a comment - Github user Leemoonsoo commented on the issue: https://github.com/apache/zeppelin/pull/1606 @AhyoungRyu @anthonycorbacho addressed your comments. Hide ASF GitHub Bot added a comment - Github user AhyoungRyu commented on the issue: Tested and it works well as expected 👍 Show ASF GitHub Bot added a comment - Github user AhyoungRyu commented on the issue: https://github.com/apache/zeppelin/pull/1606 Tested and it works well as expected 👍 Hide ASF GitHub Bot added a comment - Github user tae-jun commented on the issue: So cooool! 👍 Show ASF GitHub Bot added a comment - Github user tae-jun commented on the issue: https://github.com/apache/zeppelin/pull/1606 So cooool! 👍 Hide ASF GitHub Bot added a comment - Github user minahlee commented on the issue: It works with dev mode (grunt serve) but doesn't work if you build source with mvn. Attaching screenshot: <img width="1274" alt="screen shot 2016-11-07 at 11 46 33 pm" src="https://cloud.githubusercontent.com/assets/8503346/20061744/8b2b1508-a544-11e6-8347-00ad672fd6b9.png"> Show ASF GitHub Bot added a comment - Github user minahlee commented on the issue: https://github.com/apache/zeppelin/pull/1606 It works with dev mode (grunt serve) but doesn't work if you build source with mvn. Attaching screenshot: <img width="1274" alt="screen shot 2016-11-07 at 11 46 33 pm" src="https://cloud.githubusercontent.com/assets/8503346/20061744/8b2b1508-a544-11e6-8347-00ad672fd6b9.png"> Hide ASF GitHub Bot added a comment - Github user rawkintrevo commented on the issue: @Leemoonsoo awesome work! so happy to see this coming through! I am running into the same problem as @minahlee Thoughts on why mvn build wouldn't make this come out right? Show ASF GitHub Bot added a comment - Github user rawkintrevo commented on the issue: https://github.com/apache/zeppelin/pull/1606 @Leemoonsoo awesome work! so happy to see this coming through! I am running into the same problem as @minahlee Thoughts on why mvn build wouldn't make this come out right? Hide ASF GitHub Bot added a comment - Github user Leemoonsoo commented on the issue: @minahlee @rawkintrevo I have fixed the problem. Now packaged version works as well. Show ASF GitHub Bot added a comment - Github user Leemoonsoo commented on the issue: https://github.com/apache/zeppelin/pull/1606 @minahlee @rawkintrevo I have fixed the problem. Now packaged version works as well. Hide ASF GitHub Bot added a comment - Github user rawkintrevo commented on the issue: @Leemoonsoo still not working for me, but it could be on my end- I have a hell of a time with git Did a fetch /hard reset within the last hour. bash$ git fetch leemoonsoo
$git reset --hard leemoonsoo/zeppelin-777$ mvn clean package -DskipTests
<build success>
$bin/zeppelin-daemon.sh start  Cleared browser cache / history / app data. ![screenshot from 2016-11-08 10-57-45](https://cloud.githubusercontent.com/assets/5852441/20108606/3bbcfece-a5a2-11e6-9533-d01304ea91f8.png) Show ASF GitHub Bot added a comment - Github user rawkintrevo commented on the issue: https://github.com/apache/zeppelin/pull/1606 @Leemoonsoo still not working for me, but it could be on my end- I have a hell of a time with git Did a fetch /hard reset within the last hour. bash$ git fetch leemoonsoo $git reset --hard leemoonsoo/zeppelin-777$ mvn clean package -DskipTests <build success> $bin/zeppelin-daemon.sh start  Cleared browser cache / history / app data. ! [screenshot from 2016-11-08 10-57-45] ( https://cloud.githubusercontent.com/assets/5852441/20108606/3bbcfece-a5a2-11e6-9533-d01304ea91f8.png ) Hide ASF GitHub Bot added a comment - Github user Leemoonsoo commented on the issue: @rawkintrevo I clean cloned this PR, build and tried with browser cache clean, but couldn't reproduce the problem. Could you see zeppelin-web/dist/jax directory after the build? Show ASF GitHub Bot added a comment - Github user Leemoonsoo commented on the issue: https://github.com/apache/zeppelin/pull/1606 @rawkintrevo I clean cloned this PR, build and tried with browser cache clean, but couldn't reproduce the problem. Could you see zeppelin-web/dist/jax directory after the build? Hide ASF GitHub Bot added a comment - Github user rawkintrevo commented on the issue: lgtm. +1 to merge again, awesome add @Leemoonsoo Show ASF GitHub Bot added a comment - Github user rawkintrevo commented on the issue: https://github.com/apache/zeppelin/pull/1606 lgtm. +1 to merge again, awesome add @Leemoonsoo Hide ASF GitHub Bot added a comment - Github user Leemoonsoo commented on the issue: Thanks @rawkintrevo and @minahlee for the review. Merge to master if there's no further comment. Show ASF GitHub Bot added a comment - Github user Leemoonsoo commented on the issue: https://github.com/apache/zeppelin/pull/1606 Thanks @rawkintrevo and @minahlee for the review. Merge to master if there's no further comment. Hide ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: Show ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/zeppelin/pull/1606 Hide ASF GitHub Bot added a comment - Github user giaosudau commented on the issue: I build a distribution from source code but it's failed because of missing /jax /extesions/ Did you guys test this case? How to fix it? Thanks. Show ASF GitHub Bot added a comment - Github user giaosudau commented on the issue: https://github.com/apache/zeppelin/pull/1606 I build a distribution from source code but it's failed because of missing /jax /extesions/ Did you guys test this case? How to fix it? Thanks. Hide ASF GitHub Bot added a comment - Github user tae-jun commented on the issue: @giaosudau Hi! Thanks for sharing the issue Could you please share your building command line and error log? I don't know why, but I guess MathJax library wasn't downloaded from bower. Show ASF GitHub Bot added a comment - Github user tae-jun commented on the issue: https://github.com/apache/zeppelin/pull/1606 @giaosudau Hi! Thanks for sharing the issue Could you please share your building command line and error log? I don't know why, but I guess MathJax library wasn't downloaded from bower. Hide ASF GitHub Bot added a comment - Github user giaosudau commented on the issue: @tae-jun No error at building source code. But the error happens when I deploy with ZEPPELIN_SERVER_CONTEXT_PATH is /zeppelin/ ![Log](http://i.imgur.com/DE1Ugix.jpg) Show ASF GitHub Bot added a comment - Github user giaosudau commented on the issue: https://github.com/apache/zeppelin/pull/1606 @tae-jun No error at building source code. But the error happens when I deploy with ZEPPELIN_SERVER_CONTEXT_PATH is /zeppelin/ ! [Log] ( http://i.imgur.com/DE1Ugix.jpg ) Hide ASF GitHub Bot added a comment - Github user tae-jun commented on the issue: @giaosudau Thanks for the prompt response! So you mean it doesn't happen without ZEPPELIN_SERVER_CONTEXT_PATH? I've never used that option so I might not be helpful ^^; But could you please check $ZEPPELIN_HOME/zeppelin-web/bower_components/MathJax/jax directory exists? To ensure that bower downloaded dependencies well 😄

Show
ASF GitHub Bot added a comment - Github user tae-jun commented on the issue: https://github.com/apache/zeppelin/pull/1606 @giaosudau Thanks for the prompt response! So you mean it doesn't happen without ZEPPELIN_SERVER_CONTEXT_PATH? I've never used that option so I might not be helpful ^^; But could you please check \$ZEPPELIN_HOME/zeppelin-web/bower_components/MathJax/jax directory exists? To ensure that bower downloaded dependencies well 😄
Hide
ASF GitHub Bot added a comment -

Github user giaosudau commented on the issue:

@tae-jun
I checked there is a folder MathJax in the source I use to build but what I mean here is the URL calling jax lib was wrong. You can check the URL of jax in the image above.
=>>> It must be append /zeppelin/jax will be right and I already tested if I change url to this it works.
That mean configuration of this library was wrong and I already have the library included.

Show
ASF GitHub Bot added a comment - Github user giaosudau commented on the issue: https://github.com/apache/zeppelin/pull/1606 @tae-jun I checked there is a folder MathJax in the source I use to build but what I mean here is the URL calling jax lib was wrong. You can check the URL of jax in the image above. =>>> It must be append /zeppelin/jax will be right and I already tested if I change url to this it works. That mean configuration of this library was wrong and I already have the library included.
Hide
ASF GitHub Bot added a comment -

Github user tae-jun commented on the issue:

@giaosudau You clarified the issue! Would you like to create a [JIRA](https://issues.apache.org/jira/browse/ZEPPELIN) ticket for that? Then other developers will see the issue. Since this PR is already merged, so it seems to be handled on another PR. Thanks.

Show
ASF GitHub Bot added a comment - Github user tae-jun commented on the issue: https://github.com/apache/zeppelin/pull/1606 @giaosudau You clarified the issue! Would you like to create a [JIRA] ( https://issues.apache.org/jira/browse/ZEPPELIN ) ticket for that? Then other developers will see the issue. Since this PR is already merged, so it seems to be handled on another PR. Thanks.
Hide
ASF GitHub Bot added a comment -

Github user giaosudau commented on the issue:

Show
ASF GitHub Bot added a comment - Github user giaosudau commented on the issue: https://github.com/apache/zeppelin/pull/1606 @tae-jun https://issues.apache.org/jira/browse/ZEPPELIN-1723
Hide
ASF GitHub Bot added a comment -

Github user tae-jun commented on the issue:

@giaosudau Thanks! 👍 I appreciate it 😄

Show
ASF GitHub Bot added a comment - Github user tae-jun commented on the issue: https://github.com/apache/zeppelin/pull/1606 @giaosudau Thanks! 👍 I appreciate it 😄

## People

• Assignee:
Lee moon soo
Reporter:
Trevor Grant