Sorry in advance if this is an old topic, but I am new to this so I wasn't sure what to search for:

I am trying to create a dynamic equation displayed in LaTeX on my website, and I am not sure what method of rendering will be best for this.

for example, I want to show

$f(x)=2x+5$ and then have the user click a button to change the numbers and have the display show $f(x)=3x+8$ and another click to give $f(x)=5x+1$.

Of course this isnt all I want to display, but I am having trouble figuring out which renderer will be the right one for what im trying to do here (have dynamic constants in my LaTeX display).

migrated from stackoverflow.com Jul 11 '12 at 15:49

This question came from our site for professional and enthusiast programmers.

  • 1
    MathJax might be what you are looking for. MathJax is an open source JavaScript display engine for mathematics that works in all modern browsers. – kiss my armpit Jul 11 '12 at 16:03
  • Possibly related: tex.stackexchange.com/questions/23804 – Paulo Cereda Jul 11 '12 at 16:22
  • im sorry if i was misleading.. i know how to make a static latex formula appear on a site.. its the concept of the changing values that im not sure of. it seems if i make a function in latex and reference it in the formula, it doesnt display the numbers. – user1515301 Jul 11 '12 at 17:44

The rough idea is as follows:

  1. You can use either server side script (PHP, ASP.NET, etc) or browser side script (javascript, vbscript, etc) to dynamically generate the math expressions.
  2. On the browser side, the math expression in (La)TeX form will be rendered by a special javascript library named MathJax (the famous one).
  • so would i write a javascript that would output the latex code and then use some command to run the renderer on it? or would it run the renderer all at once? – user1515301 Jul 11 '12 at 17:46
  • @user1515301: The former is correct! – kiss my armpit Jul 11 '12 at 17:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.