最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to use Mathquill on my website - Stack Overflow

programmeradmin0浏览0评论

I'm having problems in using mathquill on my website. I'm new to this. I'm stuck in this part

  <link rel="stylesheet" type="text/css" href="/path/to/mathquill.css">`
  <script src="/path/to/mathquill.min.js"></script>

I dont know what to put on the hrefs because I'm not seeing those files from mathquill file i got from github..

i downloaded the latest mathquill files and its inside htdocs(xampp) or www(wamp) together with my index.php.

Do i have to place my index.php inside mqthquill-0.10.1 folder?

Here is my

  <link rel="stylesheet" href="/path/to/mathquill.css"/>
  <script src="jquery-3.2.1.min.js"></script>
  <script src="/path/to/mathquill.js"></script>

I appreciate if someone could give me the steps on how to use mathquill. thanks in advance

I'm having problems in using mathquill on my website. I'm new to this. I'm stuck in this part

  <link rel="stylesheet" type="text/css" href="/path/to/mathquill.css">`
  <script src="/path/to/mathquill.min.js"></script>

I dont know what to put on the hrefs because I'm not seeing those files from mathquill file i got from github..

i downloaded the latest mathquill files and its inside htdocs(xampp) or www(wamp) together with my index.php.

Do i have to place my index.php inside mqthquill-0.10.1 folder?

Here is my

  <link rel="stylesheet" href="/path/to/mathquill.css"/>
  <script src="jquery-3.2.1.min.js"></script>
  <script src="/path/to/mathquill.js"></script>

I appreciate if someone could give me the steps on how to use mathquill. thanks in advance

Share Improve this question edited May 17, 2017 at 2:56 Ian asked May 17, 2017 at 1:31 IanIan 391 silver badge3 bronze badges 4
  • I just downloaded the .zip off Github via the "latest release" link in the docs and there's a mathquill.js and mathquill.css file right there in it. – ceejayoz Commented May 17, 2017 at 1:35
  • i already downloaded the file but i don't know how to use it in.. like the codes. and calling it. i copied and pasted it on my site but its not working. i think theres something im not doing.. – Ian Commented May 17, 2017 at 1:41
  • The docs have an entire section on "getting started". Read it and follow along. – ceejayoz Commented May 17, 2017 at 1:42
  • dude what i want to know is i dont know what to put on the href. do i need to leave it as is or do i need to change it. im new to this thing. im not that knowledgeable in programming – Ian Commented May 17, 2017 at 1:44
Add a ment  | 

2 Answers 2

Reset to default 3

Option 1

You can either download the mathquill.css and mathquill.js files from github and use them from your directory.

If you have your folder (directory) structure as below:

appFolder
.. scripts
.... mathquill.js
.... index.js
.. css
.... mathquill.css
 myPage.html

Here's how you would reference the CSS and JS files:

<link rel="stylesheet" type="text/css" href="/css/mathquill.css">`
<script src="/scripts/mathquill.min.js"></script>

An easy way to check if your paths are correct is to put the entire URL in the browser's address bar. For example, if you are browsing the page as:

www.mydomain./mypage.html

The links to css and js files in the example folder structure I mentioned above would be:

www.mydomain./scripts/mathquill.js
www.mydomain./css/mathquill.css

Option 2

You could use the CDN to get the JS and CSS files on your page. Just copy the below two lines on to your html page, and you are ready to go.

<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare./ajax/libs/mathquill/0.10.1/mathquill.min.css">`
<script src="https://cdnjs.cloudflare./ajax/libs/mathquill/0.10.1/mathquill.min.js" type="text/javascript"></script>
<!-- COPY AND PAST THIS CODE HTML IN SOME EDITOR FOR BETTER VISUALIZATION, AFTER RUN-->

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Run  Mathquill</title>


        <!-- YOU NEED  mathquill.css , jquery and mathquill.js SEARCH AND PICK IT SOMEWHERE, SEARCH ON THE WEB IF THIS DOWN  NOT RUN-->
        <link rel="stylesheet" href="https://cdnjs.cloudflare./ajax/libs/mathquill/0.10.1/mathquill.css"/> 
        <script src="https://ajax.googleapis./ajax/libs/jquery/3.4.1/jquery.min.js"></script>
        <script src="https://cdnjs.cloudflare./ajax/libs/mathquill/0.10.1/mathquill.js"></script>

        <!-- INFORM  THE LATEST AVERSION INTERFACE WITH THIS CODE   -->
        <script>
            var MQ = MathQuill.getInterface(2);
        </script>


    </head>

    <body>

          <!--EXAMPLE COMMON TEXT TRANSFORMED WITH MATHQUILL  -->
         <p>Solve <span id="problem">f(x) = ax^2 + bx + c + = 0</span>.</p>
            <script>
                  var problemSpan = document.getElementById('problem');
                 MQ.StaticMath(problemSpan);
            </script> 




        <!-- EXAMPLE TO  CREATE AN EDITABLE MATH FIELD  -->
        <p><span id="answer">x=</span></p>
        <script>
            var answerSpan = document.getElementById('answer');
            var answerMathField = MQ.MathField(answerSpan, {
                handlers: {
                edit: function() {
                    var enteredMath = answerMathField.latex(); // Get entered math in LaTeX format
                    checkAnswer(enteredMath);
                }
                }
            });
        </script>

    </body>
</html>
发布评论

评论列表(0)

  1. 暂无评论