mgalloy / idldoc

Documenting IDL code
Other
20 stars 13 forks source link

Equation Formatting in IDLDoc output #51

Closed mgalloy closed 11 years ago

mgalloy commented 11 years ago

It would be quite useful to be able to put rendered equations into the IDLDoc output. Possibly Latex could be used to do the work? Right now we can insert images into the output, which is fantastic and allows anything - including equations - to be inserted. If its not too much effort, it would be nice to be able to insert a Latex (or similar) style equation and have it render in the output.

mgalloy commented 11 years ago

It looks like [http://www.math.union.edu/~dpvc/jsMath/ jsMath] would be a good solution for this.

mgalloy commented 11 years ago

This is how the HTML output would look:

<html>
  <head>
  </head>

  <body>
<SCRIPT>
  jsMath = {
    Controls: {
      cookie: {scale: 133},
      CheckVersion: function () {
        jsMath.Script.delayedLoad('http://www.math.union.edu/locate/jsMath/jsMath/jsMath-version-check.js');
      }
    },
    Parser: {prototype: {
      macros: {warning: ["Macro","\\color{##00CC00}{\\rm jsMath\\ appears\\ to\\ be\\  working!}",1]}
    }}
  }
</SCRIPT>
<SCRIPT SRC="jsMath-3.6e/plugins/noImageFonts.js"></SCRIPT>
<SCRIPT SRC="jsMath-3.6e/jsMath.js"></SCRIPT>

    <p>This is some inline math: <span class="math">\sqrt{1-x^2}</span></p>

    <div class="math">
      \left(\, \sum_{k=1}^n a_k b_k \right)^2 \le
      \left(\, \sum_{k=1}^n a_k^2 \right) \left(\, \sum_{k=1}^n b_k^2 \right)
    </div>

<SCRIPT>
jsMath.Process(document);
</SCRIPT>    
  </body>
</html>
mgalloy commented 11 years ago

[http://www.mathjax.org/ MathJax] is another option.

mgalloy commented 11 years ago

Added in r758.