| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<title>Example of defining a macro that autoloads an extension</title> |
| 5 |
<!-- Copyright (c) 2012-2020 The MathJax Consortium --> |
| 6 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| 7 |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> |
| 8 |
<meta name="viewport" content="width=device-width, initial-scale=1"> |
| 9 |
|
| 10 |
<!-- |
| 11 |
| |
| 12 |
| This page shows how to define macros that autoloads an extension |
| 13 |
| where those macros are implemented. |
| 14 |
| |
| 15 |
| The \cancel, \bcancel, \xcancel, and \cancelto macros are |
| 16 |
| all defined within the cancel extension, so we tie these |
| 17 |
| macros to the function that loads an extension, passing it |
| 18 |
| the name of the extension to load. |
| 19 |
| |
| 20 |
|--> |
| 21 |
|
| 22 |
<script type="text/x-mathjax-config"> |
| 23 |
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { |
| 24 |
MathJax.Hub.Insert(MathJax.InputJax.TeX.Definitions.macros,{ |
| 25 |
cancel: ["Extension","cancel"], |
| 26 |
bcancel: ["Extension","cancel"], |
| 27 |
xcancel: ["Extension","cancel"], |
| 28 |
cancelto: ["Extension","cancel"] |
| 29 |
}); |
| 30 |
}); |
| 31 |
</script> |
| 32 |
<script type="text/javascript" src="../MathJax.js?config=TeX-AMS_HTML-full"></script> |
| 33 |
|
| 34 |
</head> |
| 35 |
<body> |
| 36 |
|
| 37 |
<p> |
| 38 |
This page makes <code>\cancel</code>, <code>\bcancel</code>, |
| 39 |
<code>\xcancel</code>, and <code>\cancelto</code> all be defined so that |
| 40 |
they will load the <code>cancel.js</code> extension when first used. |
| 41 |
</p> |
| 42 |
|
| 43 |
<p> |
| 44 |
Here is the first usage: \(\cancel{x+1}\). It will cause the cancel |
| 45 |
package to be loaded automatically. |
| 46 |
</p> |
| 47 |
|
| 48 |
</body> |
| 49 |
</html> |