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

Fix various issues in content-mathml.js #2184

Open
wants to merge 4 commits into
base: legacy-v2-develop
Choose a base branch
from

Conversation

sylee957
Copy link

@sylee957 sylee957 commented Aug 30, 2019

HTML code for test examples

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <script>window.MathJax = {MathML: {extensions: ["content-mathml.js"]}};</script>
  <script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML"></script>
</head>
<body>

<h1 align='Center'>Set Operations</h1>

<h2 align='Center'>Unions</h1>

<math display="block">
<apply>
    <union/>
    <ci> A </ci>
    <ci> B </ci>
</apply>
</math>

<math display="block">
<apply>
    <union/>
    <ci> A </ci>
    <ci> B </ci>
    <ci> C </ci>
</apply>
</math>

<math display="block">
<apply>
    <union/>
    <ci> A </ci>
    <ci> B </ci>
    <ci> C </ci>
    <ci> D </ci>
</apply>
</math>

<math display="block">
<apply>
    <union/>
    <ci> A </ci>
    <apply>
        <union/>
        <ci> B </ci>
        <ci> C </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <union/>
    <apply>
        <union/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <ci> C </ci>
</apply>
</math>

<math display="block">
<apply>
    <union/>
    <apply>
        <union/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <union/>
        <ci> C </ci>
        <ci> D </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <union/>
    <bvar><ci type="set"> S </ci></bvar>
    <domainofapplication><ci type="list">L</ci></domainofapplication>
    <ci type="set"> S </ci>
</apply>
</math>

<h2 align='Center'>Complement</h1>

<math display="block">
<apply>
    <setdiff/>
    <ci> A </ci>
    <ci> B </ci>
</apply>
</math>

<h2 align='Center'>Combined</h1>

<math display="block">
<apply>
    <in/>
    <ci> a </ci>
    <apply>
        <intersect/>
        <ci> B </ci>
        <ci> C </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <notin/>
    <apply>
        <times/>
        <ci> a </ci>
        <ci> b </ci>
    </apply>
    <apply>
        <intersect/>
        <ci> B </ci>
        <ci> C </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <notin/>
    <ci> a </ci>
    <apply>
        <setdiff/>
        <ci> B </ci>
        <ci> C </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <subset/>
    <ci> A </ci>
    <apply>
        <intersect/>
        <ci> B </ci>
        <ci> C </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <prsubset/>
    <apply>
        <intersect/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <intersect/>
        <ci> C </ci>
        <ci> D </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <union/>
    <ci> A </ci>
    <apply>
        <intersect/>
        <ci> B </ci>
        <ci> C </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <union/>
    <apply>
        <intersect/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <ci> C </ci>
</apply>
</math>

<math display="block">
<apply>
    <union/>
    <apply>
        <intersect/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <intersect/>
        <ci> C </ci>
        <ci> D </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <intersect/>
    <apply>
        <union/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <union/>
        <ci> C </ci>
        <ci> D </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <intersect/>
    <apply>
        <union/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <intersect/>
        <ci> C </ci>
        <ci> D </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <union/>
    <apply>
        <intersect/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <union/>
        <bvar><ci type="set"> S </ci></bvar>
        <domainofapplication><ci type="list">L</ci></domainofapplication>
        <ci type="set"> S </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <intersect/>
    <apply>
        <setdiff/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <setdiff/>
        <ci> C </ci>
        <ci> D </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <intersect/>
    <apply>
        <cartesianproduct/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <cartesianproduct/>
        <ci> C </ci>
        <ci> D </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <cartesianproduct/>
    <apply>
        <intersect/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <intersect/>
        <ci> C </ci>
        <ci> D </ci>
    </apply>
</apply>
</math>

<h1 align='Center'>Arithmetic Operations</h1>

<h2 align='Center'>Additions</h1>

<math display="block">
<apply>
    <plus/>
    <apply>
        <plus/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <plus/>
        <ci> C </ci>
        <ci> D </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <plus/>
    <ci> A </ci>
    <ci> B </ci>
    <ci> C </ci>
    <ci> D </ci>
</apply>
</math>

<h2 align='Center'>Multiplications</h1>

<math display="block">
<apply>
    <times/>
    <apply>
        <times/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <times/>
        <ci> C </ci>
        <ci> D </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <times/>
    <ci> A </ci>
    <ci> B </ci>
    <ci> C </ci>
    <ci> D </ci>
</apply>
</math>

<h2 align='Center'>Divisions</h1>

<math display="block">
    <apply>
        <divide/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
</math>

<math display="block">
<apply>
    <divide/>
    <apply>
        <divide/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <divide/>
        <ci> C </ci>
        <ci> D </ci>
    </apply>
</apply>
</math>

<h2 align='Center'>Quotients</h1>

<math display="block">
    <apply>
        <quotient/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
</math>

<math display="block">
<apply>
    <quotient/>
    <apply>
        <quotient/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <quotient/>
        <ci> C </ci>
        <ci> D </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <quotient/>
    <apply>
        <plus/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <times/>
        <ci> C </ci>
        <ci> D </ci>
    </apply>
</apply>
</math>

<h2 align='Center'>Subtractions</h1>

<math display="block">
<apply>
    <minus/>
    <ci> A </ci>
    <ci> B </ci>
</apply>
</math>

<math display="block">
<apply>
    <minus/>
    <apply>
        <minus/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <minus/>
        <ci> C </ci>
        <ci> D </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <minus/>
    <apply>
        <minus/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <minus/>
    <ci> A </ci>
</apply>
</math>

<h2 align='Center'>Powers</h1>

<math display="block">
<apply>
    <power/>
    <ci> A </ci>
    <ci> b </ci>
</apply>
</math>

<math display="block">
<apply>
    <power/>
    <ci> A </ci>
    <apply>
        <power/>
        <ci> b </ci>
        <ci> c </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <power/>
    <ci> A </ci>
    <apply>
        <power/>
        <ci> b </ci>
        <apply>
            <power/>
            <ci> c </ci>
            <ci> d </ci>
        </apply>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <power/>
    <apply>
        <power/>
        <ci> A </ci>
        <ci> b </ci>
    </apply>
    <ci> c </ci>
</apply>
</math>

<h2 align='Center'>Factorials</h1>

<math display="block">
<apply>
    <factorial/>
    <ci> a </ci>
</apply>
</math>

<math display="block">
<apply>
    <factorial/>
    <apply>
        <factorial/>
        <ci> a </ci>
    </apply>
</apply>
</math>

<h2 align='Center'>Combined</h1>

<math display="block">
<apply>
    <plus/>
    <apply>
        <times/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <times/>
        <ci> C </ci>
        <ci> D </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <plus/>
    <apply>
        <minus/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <rem/>
        <ci> C </ci>
        <ci> D </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <times/>
    <apply>
        <plus/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <plus/>
        <ci> C </ci>
        <ci> D </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <rem/>
    <apply>
        <plus/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <plus/>
        <ci> C </ci>
        <ci> D </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <factorial/>
    <apply>
        <exp/>
        <ci>a</ci>
    </apply>
</apply>
</math>

<h1 align='Center'>Matrices</h1>

<h2 align='Center'>Selector</h1>

<math display="block">
<apply>
    <selector/>
    <ci> A </ci>
    <ci> m </ci>
</apply>
</math>

<math display="block">
<apply>
    <selector/>
    <ci> A </ci>
    <ci> m </ci>
    <ci> n </ci>
</apply>
</math>

<math display="block">
<apply>
    <selector/>
    <apply>
        <selector/>
        <ci> A </ci>
        <ci> m </ci>
    </apply>
    <ci> n </ci>
</apply>
</math>

<math display="block">
<apply>
    <selector/>
    <apply>
        <selector/>
        <ci> A </ci>
        <ci> m </ci>
        <ci> n </ci>
    </apply>
    <ci> o </ci>
    <ci> p </ci>
</apply>
</math>

<h2 align='Center'>Matrix Transpose</h1>

<math display="block">
<apply>
    <transpose/>
    <ci> A </ci>
</apply>
</math>

<math display="block">
<apply>
    <transpose/>
    <apply>
        <transpose/>
        <ci> A </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <transpose/>
    <apply>
        <transpose/>
        <apply>
            <transpose/>
            <ci> A </ci>
        </apply>
    </apply>
</apply>
</math>

<h1 align='Center'>Logical Operations</h1>

<math display="block">
<apply>
    <and/>
    <apply>
        <or/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <or/>
        <ci> C </ci>
        <ci> D </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <or/>
    <apply>
        <and/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <and/>
        <ci> C </ci>
        <ci> D </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <or/>
    <apply>
        <xor/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <xor/>
        <ci> C </ci>
        <ci> D </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <xor/>
    <apply>
        <xor/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <xor/>
        <ci> C </ci>
        <ci> D </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <xor/>
    <ci> A </ci>
    <ci> B </ci>
    <ci> C </ci>
    <ci> D </ci>
</apply>
</math>

<math display="block">
<apply>
    <implies/>
    <apply>
        <and/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <and/>
        <ci> C </ci>
        <ci> D </ci>
    </apply>
</apply>
</math>


<math display="block">
<apply>
    <and/>
    <apply>
        <gt/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <lt/>
        <ci> C </ci>
        <ci> D </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <and/>
    <apply>
        <eq/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <neq/>
        <ci> C </ci>
        <ci> D </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <or/>
    <apply>
        <and/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <and/>
        <ci> C </ci>
        <ci> D </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <and/>
    <apply>
        <and/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
    <apply>
        <and/>
        <ci> C </ci>
        <ci> D </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <and/>
    <ci> A </ci>
    <ci> B </ci>
    <ci> C </ci>
    <ci> D </ci>
</apply>
</math>

<math display="block">
<apply>
    <not/>
    <ci>a</ci>
</apply>
</math>

<math display="block">
<apply>
    <not/>
    <apply>
        <not/>
        <ci>a</ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <not/>
    <apply>
        <ci>f</ci>
        <ci>a</ci>
    </apply>
</apply>
</math>

<h1 align='Center'>Sums, Products</h1>

<math display="block">
<apply>
    <plus/>
    <apply>
        <sum/>
        <bvar><ci> x </ci></bvar>
        <lowlimit>
            <ci> a </ci>
        </lowlimit>
        <uplimit>
            <ci> b </ci>
        </uplimit>
        <ci> x </ci>
    </apply>
    <ci> y </ci>
</apply>
</math>

<math display="block">
<apply>
    <sum/>
    <bvar><ci> x </ci></bvar>
    <lowlimit>
        <ci> a </ci>
    </lowlimit>
    <uplimit>
        <ci> b </ci>
    </uplimit>
    <apply>
        <plus/>
        <ci> x </ci>
        <ci> y </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <times/>
    <apply>
        <sum/>
        <bvar><ci> x </ci></bvar>
        <lowlimit>
            <ci> a </ci>
        </lowlimit>
        <uplimit>
            <ci> b </ci>
        </uplimit>
        <ci> x </ci>
    </apply>
    <ci> y </ci>
</apply>
</math>

<math display="block">
<apply>
    <sum/>
    <bvar><ci> x </ci></bvar>
    <lowlimit>
        <ci> a </ci>
    </lowlimit>
    <uplimit>
        <ci> b </ci>
    </uplimit>
    <apply>
        <times/>
        <ci> x </ci>
        <ci> y </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <sum/>
    <bvar><ci> y </ci></bvar>
    <lowlimit>
        <ci> a </ci>
    </lowlimit>
    <uplimit>
        <ci> b </ci>
    </uplimit>

    <apply>
        <sum/>
        <bvar><ci> x </ci></bvar>
        <lowlimit>
            <ci> a </ci>
        </lowlimit>
        <uplimit>
            <ci> b </ci>
        </uplimit>
        <apply>
            <plus/>
            <ci> x </ci>
            <ci> y </ci>
        </apply>
    </apply>
</apply>
</math>

<h1 align='Center'>Integrals</h1>

<math display="block">
<apply>
    <int/>
    <bvar><ci> x </ci></bvar>
    <lowlimit><cn> 0 </cn></lowlimit>
    <uplimit><ci> a </ci></uplimit>
    <apply>
        <ci> f </ci>
        <ci> x </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <int/>
    <bvar><ci> x </ci></bvar>
    <lowlimit><cn> 0 </cn></lowlimit>
    <uplimit><ci> a </ci></uplimit>
    <apply>
        <int/>
        <bvar><ci> x </ci></bvar>
        <lowlimit><cn> 0 </cn></lowlimit>
        <uplimit><ci> a </ci></uplimit>
        <apply>
            <ci> f </ci>
            <ci> x </ci>
        </apply>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <int/>
    <bvar><ci> y </ci></bvar>
    <lowlimit><cn> 0 </cn></lowlimit>
    <uplimit><ci> b </ci></uplimit>
    <apply>
        <int/>
        <bvar><ci> x </ci></bvar>
        <lowlimit><cn> 0 </cn></lowlimit>
        <uplimit><ci> a </ci></uplimit>
        <apply>
            <plus/>
            <ci> x </ci>
            <ci> y </ci>
        </apply>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <int/>
    <sin/>
</apply>
</math>

<math display="block">
<apply>
    <int/>
    <apply>
        <int/>
        <sin/>
    </apply>
</apply>
</math>

<h1 align='Center'>n-ary set operations</h1>

<math display="block">
<apply>
    <union/>
    <bvar><ci> A </ci></bvar>
    <domainofapplication><ci type="list">L</ci></domainofapplication>
    <ci> A </ci>
</apply>
</math>

<math display="block">
<apply>
    <intersect/>
    <apply>
        <union/>
        <bvar><ci> A </ci></bvar>
        <domainofapplication><ci type="list">L</ci></domainofapplication>
        <ci> A </ci>
    </apply>
    <ci>B</ci>
</apply>
</math>

<math display="block">
<apply>
    <union/>
    <bvar><ci> A </ci></bvar>
    <domainofapplication><ci type="list">L</ci></domainofapplication>
    <apply>
        <intersect/>
        <ci> A </ci>
        <ci> B </ci>
    </apply>
</apply>
</math>

<h1 align='Center'>Exponential</h1>

<math display="block">
<apply>
    <exp/>
    <ci> a </ci>
</apply>
</math>

<math display="block">
<apply>
    <exp/>
    <apply>
        <exp/>
        <ci> a </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <exp/>
    <apply>
        <times/>
        <ci> a </ci>
        <ci> b </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <exp/>
    <apply>
        <plus/>
        <ci> a </ci>
        <ci> b </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <exp/>
    <apply>
        <power/>
        <ci> a </ci>
        <ci> b </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <power/>
    <apply>
        <exp/>
        <ci>a</ci>
    </apply>
    <ci>b</ci>
</apply>
</math>

<math display="block">
<apply>
    <power/>
    <ci>a</ci>
    <apply>
        <exp/>
        <ci>b</ci>
    </apply>
</apply>
</math>

<h1 align='Center'>Vectors</h1>

<h2 align='Center'>Gradient, Curl, Divergence, Laplacian</h2>

<math display="block">
<vector>
    <cn> x </cn>
    <cn> y </cn>
    <ci> z </ci>
</vector>
</math>

<math display="block">
<apply>
    <grad/>
    <vector>
        <cn> x </cn>
        <cn> y </cn>
        <ci> z </ci>
    </vector>
</apply>
</math>

<math display="block">
<apply>
    <grad/>
    <ci>x</ci>
</apply>
</math>

<math display="block">
<apply>
    <laplacian/>
    <vector>
        <cn> x </cn>
        <cn> y </cn>
        <ci> z </ci>
    </vector>
</apply>
</math>

<math display="block">
<apply>
    <laplacian/>
    <ci>x</ci>
</apply>
</math>

<math display="block">
<apply>
    <curl/>
    <vector>
        <cn> x </cn>
        <cn> y </cn>
        <ci> z </ci>
    </vector>
</apply>
</math>

<math display="block">
<apply>
    <curl/>
    <ci>x</ci>
</apply>
</math>

<math display="block">
<apply>
    <curl/>
    <apply>
        <curl/>
        <ci>x</ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <divergence/>
    <vector>
        <cn> x </cn>
        <cn> y </cn>
        <ci> z </ci>
    </vector>
</apply>
</math>

<math display="block">
<apply>
    <divergence/>
    <ci>x</ci>
</apply>
</math>

<h2 align='Center'>Combined</h2>

<math display="block">
<apply>
    <divergence/>
    <apply>
        <curl/>
        <ci>x</ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <curl/>
    <apply>
        <grad/>
        <ci>x</ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <divergence/>
    <apply>
        <grad/>
        <ci>x</ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <divergence/>
    <apply>
        <times/>
        <ci>a</ci>
        <ci>x</ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <grad/>
    <apply>
        <times/>
        <ci>a</ci>
        <ci>x</ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <grad/>
    <apply>
        <plus/>
        <ci>a</ci>
        <ci>x</ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <laplacian/>
    <apply>
        <plus/>
        <ci>a</ci>
        <ci>x</ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <grad/>
    <apply>
        <conjugate/>
        <ci>x</ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <curl/>
    <apply>
        <conjugate/>
        <ci>x</ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <laplacian/>
    <apply>
        <conjugate/>
        <ci>x</ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <divergence/>
    <apply>
        <conjugate/>
        <ci>x</ci>
    </apply>
</apply>
</math>

<h1 align='Center'>Functions</h1>

<math display="block">
<apply>
    <ci>f</ci>
    <ci>x</ci>
</apply>
</math>

<math display="block">
<apply>
    <apply>
        <inverse/>
        <ci>f</ci>
    </apply>
    <ci>x</ci>
</apply>
</math>

<math display="block">
<apply>
    <apply>
        <inverse/>
        <apply>
            <inverse/>
            <ci>f</ci>
        </apply>
    </apply>
    <ci>x</ci>
</apply>
</math>

<math display="block">
<apply>
    <apply>
        <inverse/>
        <apply>
            <compose/>
            <ci>f</ci>
            <ci>g</ci>
        </apply>
    </apply>
    <ci>x</ci>
</apply>
</math>

<h1 align='Center'>Derivatives</h1>

<math display="block">
<apply>
    <diff/>
    <ci> f </ci>
</apply>
</math>

<math display="block">
<apply>
    <diff/>
    <apply>
        <diff/>
        <ci> f </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <diff/>
    <apply>
        <compose/>
        <ci> f </ci>
        <ci> g </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <diff/>
    <bvar><ci> x </ci></bvar>
    <apply>
        <ci> f </ci>
        <ci> x </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <diff/>
    <bvar>
        <ci> x </ci>
        <degree><ci>2</ci></degree>
    </bvar>
    <apply>
        <ci> f </ci>
        <ci> x </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <diff/>
    <bvar>
        <ci> x </ci>
    </bvar>
    <apply>
        <plus/>
        <apply>
            <ci> f </ci>
            <ci> x </ci>
        </apply>
        <apply>
            <ci> g </ci>
            <ci> x </ci>
        </apply>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <diff/>
    <bvar>
        <ci> x </ci>
    </bvar>
    <apply>
        <times/>
        <apply>
            <ci> f </ci>
            <ci> x </ci>
        </apply>
        <apply>
            <ci> g </ci>
            <ci> x </ci>
        </apply>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <diff/>
    <bvar><ci> x </ci></bvar>
    <apply>
        <diff/>
        <bvar>
            <ci>x</ci>
        </bvar>
        <apply>
            <ci> f </ci>
            <ci> x </ci>
        </apply>
    </apply>
</apply>
</math>

<h1 align='Center'>Partial Derivatives</h1>

<math display="block">
<apply>
    <partialdiff/>
    <bvar>
        <ci> x </ci>
        <degree><ci> m </ci></degree>
    </bvar>
    <bvar>
        <ci> y </ci>
        <degree><ci> n </ci></degree>
    </bvar>
    <degree><ci> k </ci></degree>
    <apply>
        <ci> f </ci>
        <ci> x </ci>
        <ci> y </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <partialdiff/>
    <bvar>
        <ci> x </ci>
    </bvar>
    <bvar>
        <ci> y </ci>
    </bvar>
    <degree><ci> 2 </ci></degree>
    <apply>
        <ci> f </ci>
        <ci> x </ci>
        <ci> y </ci>
    </apply>
</apply>
</math>


<math display="block">
<apply>
    <partialdiff/>
    <bvar>
        <ci> x </ci>
    </bvar>
    <bvar>
        <ci> y </ci>
    </bvar>
    <apply>
        <ci> f </ci>
        <ci> x </ci>
        <ci> y </ci>
    </apply>
</apply>
</math>


<math display="block">
<apply>
    <partialdiff/>
    <bvar>
        <ci> x </ci>
        <degree><ci> 2 </ci></degree>
    </bvar>
    <bvar>
        <ci> y </ci>
        <degree><ci> 3 </ci></degree>
    </bvar>
    <apply>
        <ci> f </ci>
        <ci> x </ci>
        <ci> y </ci>
    </apply>
</apply>
</math>


<math display="block">
<apply>
    <partialdiff/>
    <bvar>
        <ci> x </ci>
        <degree><ci> a </ci></degree>
    </bvar>
    <bvar>
        <ci> y </ci>
        <degree><ci> b </ci></degree>
    </bvar>
    <apply>
        <ci> f </ci>
        <ci> x </ci>
        <ci> y </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <partialdiff/>
    <bvar>
        <ci> x </ci>
        <degree><ci> a </ci></degree>
    </bvar>
    <bvar>
        <ci> y </ci>
        <degree><ci> 3 </ci></degree>
    </bvar>
    <apply>
        <ci> f </ci>
        <ci> x </ci>
        <ci> y </ci>
    </apply>
</apply>
</math>


<math display="block">
<apply>
    <partialdiff/>
    <bvar>
        <ci> x </ci>
    </bvar>
    <bvar>
        <ci> y </ci>
    </bvar>
    <degree><ci> 2 </ci></degree>
    <apply>
        <plus/>
        <apply>
            <ci> f </ci>
            <ci> x </ci>
            <ci> y </ci>
        </apply>
        <apply>
            <ci> f </ci>
            <ci> x </ci>
            <ci> y </ci>
        </apply>
    </apply>
</apply>
</math>


<math display="block">
<apply>
    <partialdiff/>
    <list>
        <cn>1</cn>
        <cn>1</cn>
        <cn>3</cn>
    </list>
    <ci>f</ci>
</apply>
</math>

<math display="block">
<apply>
    <partialdiff/>
    <list>
        <cn>1</cn>
        <cn>1</cn>
    </list>
    <apply>
        <partialdiff/>
        <list>
            <cn>1</cn>
            <cn>1</cn>
        </list>
        <ci>f</ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <partialdiff/>
    <list>
        <cn>1</cn>
        <cn>1</cn>
    </list>
    <apply>
        <compose/>
        <ci>f</ci>
        <ci>g</ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <partialdiff/>
    <list>
        <ci>a</ci>
        <ci>b</ci>
    </list>
    <apply>
        <compose/>
        <ci>f</ci>
        <ci>g</ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <partialdiff/>
    <list>
        <ci> a </ci>
    </list>
    <lambda>
        <bvar><ci> x </ci></bvar>
        <bvar><ci> y </ci></bvar>
        <apply>
            <plus/>
            <ci> x </ci>
            <cn> y </cn>
        </apply>
    </lambda>
</apply>
</math>

<math display="block">
<apply>
    <partialdiff/>
    <list>
        <ci> 1 </ci>
    </list>
    <lambda>
        <bvar><ci> x </ci></bvar>
        <bvar><ci> y </ci></bvar>
        <apply>
            <plus/>
            <ci> x </ci>
            <cn> y </cn>
        </apply>
    </lambda>
</apply>
</math>


<math display="block">
<apply>
    <partialdiff/>
    <list>
        <ci> 1 </ci>
        <ci> 2 </ci>
    </list>
    <lambda>
        <bvar><ci> x </ci></bvar>
        <bvar><ci> y </ci></bvar>
        <apply>
            <plus/>
            <ci> x </ci>
            <cn> y </cn>
        </apply>
    </lambda>
</apply>
</math>

<math display="block">
<apply>
    <partialdiff/>
    <list>
        <ci> a </ci>
        <ci> b </ci>
    </list>
    <lambda>
        <bvar><ci> x </ci></bvar>
        <bvar><ci> y </ci></bvar>
        <apply>
            <plus/>
            <ci> x </ci>
            <cn> y </cn>
        </apply>
    </lambda>
</apply>
</math>

<math display="block">
<apply>
    <partialdiff/>
    <list>
        <ci> a </ci>
        <ci> 2 </ci>
    </list>
    <lambda>
        <bvar><ci> x </ci></bvar>
        <bvar><ci> y </ci></bvar>
        <apply>
            <plus/>
            <ci> x </ci>
            <cn> y </cn>
        </apply>
    </lambda>
</apply>
</math>

<h1 align='Center'>Complex numbers</h1>

<math display="block">
<apply>
    <complex-cartesian/>
    <ci> a </ci>
    <ci> b </ci>
</apply>
</math>

<math display="block">
<apply>
    <complex-cartesian/>
    <ci> a </ci>
    <apply>
        <plus/>
        <ci> b </ci>
        <ci> c </ci>
    </apply>
</apply>
</math>

<math display="block">
<apply>
    <complex-polar/>
    <ci> a </ci>
    <ci> b </ci>
</apply>
</math>

<math display="block">
<apply>
    <complex-polar/>
    <apply>
        <plus/>
        <ci> a </ci>
        <ci> b </ci>
    </apply>
    <apply>
        <plus/>
        <ci> c </ci>
        <ci> d </ci>
    </apply>
</apply>
</math>

</body>
</html>

I've found a lot of issues in mathml-content-to-presentation converter, regarding parenthesis.
For example, different set operators like union and intersect should be parenthesized correctly according to the apply scope, but they were ignored.
I also see the same problem in the logical operators.

Also, things like nested powers should be parenthesized, or things become undistinguishable.

I've also made the summations and integrals to parenthesis according to the scope, and made summation to have same precedence as addition, and products, integrals as same as the multiplication.
There can be some redundant parenthesis appearing for integrals, but this was the first step for making things correct and consistent.

Also, I have examples of derivatives giving errors or not printed correctly

and also fixed some redundant parenthesis for printing vector operators.

@sylee957
Copy link
Author

sylee957 commented Sep 2, 2019

I see mathjax has its own mathml content-to-presentation converter written in javascript, and I have discovered some bugs in #2184 as well.

@dpvc
Copy link
Member

dpvc commented Sep 6, 2019

@christianp, would you be willing to review this PR?

@christianp
Copy link
Contributor

@dpvc yes, but I can't commit to a timescale

@dpvc dpvc changed the base branch from develop to legacy-v2-develop February 17, 2020 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants