asciimathextend.html 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <html>
  2. <head>
  3. <title>Extending ASCIIMathML</title>
  4. <script type="text/javascript" src="ASCIIMathML.js"></script>
  5. <script type="text/javascript">
  6. define("!<=","\u2270")
  7. define("!>=","\u2271")
  8. newcommand("\\nle","\u2270")
  9. newcommand("\\nge","\u2271")
  10. </script>
  11. </head>
  12. <body bgcolor="beige">
  13. <h2>ASCIIMathML.js: Extending the symbol table</h2>
  14. <p>
  15. The standard symbol table of ASCIIMathML.js does not contain many symbols.
  16. It can be extended by adding additional symbols on any webpage that
  17. requires them. This is done by adding a few lines of JavaScript code.
  18. </p>
  19. <p>
  20. For example, suppose we want to add symbols for "not less or equal" and
  21. "not greater or equal".
  22. </p>
  23. <p>
  24. We first have to find the four-digit hexadecimal Unicode value for
  25. these symbols by looking them up at, say, <a
  26. href="http://www.w3.org/TR/MathML2/chapter6.html#chars.entity.tables">http://www.w3.org/TR/MathML2/chapter6.html#chars.entity.tables</a>
  27. </p>
  28. <p>
  29. Next we have to decide what input strings we want to associate with these
  30. symbols, say "!<=" and "!>=".
  31. </p>
  32. <p>
  33. Finally we add the following lines to the head or body of our HTML file:
  34. <pre style="border-style:groove">&lt;script type="text/javascript">
  35. define("!<=","\u2270")
  36. define("!>=","\u2271")
  37. &lt;/script>
  38. </pre>
  39. </p>
  40. <p>
  41. Here we test the modified symbol table:
  42. <tt>\`a !<= b !>= c\`</tt> produces `a !<= b !>= c`
  43. </p>
  44. <p>To add a symbol to the LaTeX commands, use the following alternate syntax:
  45. <pre style="border-style:groove">&lt;script type="text/javascript">
  46. newcommand("\\nle","\u2270")
  47. newcommand("\\nge","\u2271")
  48. &lt;/script>
  49. </pre>
  50. </p>
  51. <p>
  52. Now
  53. <tt>\$a \nle b \nge c\$</tt> produces $a \nle b \nge c$.
  54. </p>
  55. <hr/>
  56. <p>
  57. If you know the numeric entity reference of the symbol you want to use
  58. on an ASCIIMathML webpage, you can also refer to the symbol directly
  59. by using that reference. E.g \`&amp;#x2270;\` produces `&#x2270;`.
  60. If a symbol is only used occasionally, this is certainly the simplest
  61. way to include it.
  62. </p>
  63. </body>
  64. </html>