Skip to content

Place LaTeX Math equation on anywhere as <img> tag.

License

Notifications You must be signed in to change notification settings

dica-solution/math-api

 
 

Repository files navigation

Math API

Place LaTeX Math equation on anywhere as <img> tag.

https://math.giainhanh.vn

Usage

Image format (svg or png)

Normal

<img src="https://math.giainhanh.vn/img?from=\log\prod^N_{i}x_{i}=\sum^N_i\log{x_i}" />

Inline

<img src="https://math.giainhanh.vn/img?inline=\log\prod^N_{i}x_{i}=\sum^N_i\log{x_i}" />

Mathml format

curl https://math.giainhanh.vn/mathml?from=\log\prod^N_{i}x_{i}=\sum^N_i\log{x_i}

Option

.svg or .png extension

URL ends with .svg extension will be treated as a normal math formula.

Some Markdown blog services won't treat image tags correctly whose URL has no any image extension in it. This option may give fixes to these situations.

<img src="https://math.giainhanh.vn/img?from=\log\prod^N_{i}x_{i}=\sum^N_i\log{x_i}.png" />

Optional input format type

Math-api support latex, asciimath and mathml

<img src="https://math.giainhanh.vn/img?from=root(4)(x)&type=asciimath" />

Output format type:

  • svg
  • png
  • mathml

Svg to png

curl --location --request POST 'http://localhost:8080/svg-to-png' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'svg=<svg xmlns:xlink="http://www.w3.org/1999/xlink" width="7.351ex" height="2.509ex" viewBox="0 -791.3 3164.9 1080.4" role="img" focusable="false" xmlns="http://www.w3.org/2000/svg" aria-labelledby="MathJax-SVG-1-Title"><title id="MathJax-SVG-1-Title">H_{2n−&nbsp;+3}</title><defs aria-hidden="true"><path stroke-width="1" id="E1-MJMATHI-48" d="M228 637Q194 637 192 641Q191 643 191 649Q191 673 202 682Q204 683 219 683Q260 681 355 681Q389 681 418 681T463 682T483 682Q499 682 499 672Q499 670 497 658Q492 641 487 638H485Q483 638 480 638T473 638T464 637T455 637Q416 636 405 634T387 623Q384 619 355 500Q348 474 340 442T328 395L324 380Q324 378 469 378H614L615 381Q615 384 646 504Q674 619 674 627T617 637Q594 637 587 639T580 648Q580 650 582 660Q586 677 588 679T604 682Q609 682 646 681T740 680Q802 680 835 681T871 682Q888 682 888 672Q888 645 876 638H874Q872 638 869 638T862 638T853 637T844 637Q805 636 794 634T776 623Q773 618 704 340T634 58Q634 51 638 51Q646 48 692 46H723Q729 38 729 37T726 19Q722 6 716 0H701Q664 2 567 2Q533 2 504 2T458 2T437 1Q420 1 420 10Q420 15 423 24Q428 43 433 45Q437 46 448 46H454Q481 46 514 49Q520 50 522 50T528 55T534 64T540 82T547 110T558 153Q565 181 569 198Q602 330 602 331T457 332H312L279 197Q245 63 245 58Q245 51 253 49T303 46H334Q340 38 340 37T337 19Q333 6 327 0H312Q275 2 178 2Q144 2 115 2T69 2T48 1Q31 1 31 10Q31 12 34 24Q39 43 44 45Q48 46 59 46H65Q92 46 125 49Q139 52 144 61Q147 65 216 339T285 628Q285 635 228 637Z"></path><path stroke-width="1" id="E1-MJMAIN-32" d="M109 429Q82 429 66 447T50 491Q50 562 103 614T235 666Q326 666 387 610T449 465Q449 422 429 383T381 315T301 241Q265 210 201 149L142 93L218 92Q375 92 385 97Q392 99 409 186V189H449V186Q448 183 436 95T421 3V0H50V19V31Q50 38 56 46T86 81Q115 113 136 137Q145 147 170 174T204 211T233 244T261 278T284 308T305 340T320 369T333 401T340 431T343 464Q343 527 309 573T212 619Q179 619 154 602T119 569T109 550Q109 549 114 549Q132 549 151 535T170 489Q170 464 154 447T109 429Z"></path><path stroke-width="1" id="E1-MJMATHI-6E" d="M21 287Q22 293 24 303T36 341T56 388T89 425T135 442Q171 442 195 424T225 390T231 369Q231 367 232 367L243 378Q304 442 382 442Q436 442 469 415T503 336T465 179T427 52Q427 26 444 26Q450 26 453 27Q482 32 505 65T540 145Q542 153 560 153Q580 153 580 145Q580 144 576 130Q568 101 554 73T508 17T439 -10Q392 -10 371 17T350 73Q350 92 386 193T423 345Q423 404 379 404H374Q288 404 229 303L222 291L189 157Q156 26 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 112 180T152 343Q153 348 153 366Q153 405 129 405Q91 405 66 305Q60 285 60 284Q58 278 41 278H27Q21 284 21 287Z"></path><path stroke-width="1" id="E1-MJMAIN-2212" d="M84 237T84 250T98 270H679Q694 262 694 250T679 230H98Q84 237 84 250Z"></path><path stroke-width="1" id="E1-MJMAIN-2B" d="M56 237T56 250T70 270H369V420L370 570Q380 583 389 583Q402 583 409 568V270H707Q722 262 722 250T707 230H409V-68Q401 -82 391 -82H389H387Q375 -82 369 -68V230H70Q56 237 56 250Z"></path><path stroke-width="1" id="E1-MJMAIN-33" d="M127 463Q100 463 85 480T69 524Q69 579 117 622T233 665Q268 665 277 664Q351 652 390 611T430 522Q430 470 396 421T302 350L299 348Q299 347 308 345T337 336T375 315Q457 262 457 175Q457 96 395 37T238 -22Q158 -22 100 21T42 130Q42 158 60 175T105 193Q133 193 151 175T169 130Q169 119 166 110T159 94T148 82T136 74T126 70T118 67L114 66Q165 21 238 21Q293 21 321 74Q338 107 338 175V195Q338 290 274 322Q259 328 213 329L171 330L168 332Q166 335 166 348Q166 366 174 366Q202 366 232 371Q266 376 294 413T322 525V533Q322 590 287 612Q265 626 240 626Q208 626 181 615T143 592T132 580H135Q138 579 143 578T153 573T165 566T175 555T183 540T186 520Q186 498 172 481T127 463Z"></path></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)" aria-hidden="true"> <use xlink:href="#E1-MJMATHI-48" x="0" y="0"></use><g transform="translate(831,-150)"> <use transform="scale(0.707)" xlink:href="#E1-MJMAIN-32" x="0" y="0"></use> <use transform="scale(0.707)" xlink:href="#E1-MJMATHI-6E" x="500" y="0"></use> <use transform="scale(0.707)" xlink:href="#E1-MJMAIN-2212" x="1101" y="0"></use> <use transform="scale(0.707)" xlink:href="#E1-MJMAIN-2B" x="1879" y="0"></use> <use transform="scale(0.707)" xlink:href="#E1-MJMAIN-33" x="2658" y="0"></use></g></g></svg>'

Output : png

AsciimathToLatex

curl https://math.giainhanh.vn/asciimath-to-latex?from=int_(i=1)^10x^2/2dx

About

Place LaTeX Math equation on anywhere as <img> tag.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 69.0%
  • HTML 17.4%
  • TypeScript 13.2%
  • Other 0.4%