| 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 in your configuration, or as part |
| 13 |
| of the body of the page itself. |
| 14 |
| |
| 15 |
|--> |
| 16 |
|
| 17 |
<script type="text/x-mathjax-config"> |
| 18 |
MathJax.Hub.Config({ |
| 19 |
TeX: { |
| 20 |
Macros: { |
| 21 |
RR: '{\\bf R}', // a simple string replacement |
| 22 |
bold: ['\\boldsymbol{#1}',1] // this macro has one parameter |
| 23 |
} |
| 24 |
} |
| 25 |
}); |
| 26 |
</script> |
| 27 |
<script type="text/javascript" src="../MathJax.js?config=TeX-AMS_HTML-full"></script> |
| 28 |
|
| 29 |
</head> |
| 30 |
<body> |
| 31 |
|
| 32 |
<!-- |
| 33 |
| |
| 34 |
| Here we use a math block that contains nothing but definitions in |
| 35 |
| standard TeX format. It is enclosed in a DIV that doesn't display, so |
| 36 |
| that there are no extra spaces generated by having the extra |
| 37 |
| mathematics in the text. |
| 38 |
| |
| 39 |
| The first macro makes it easy to display vectors using \<x,y,z> |
| 40 |
| the second uses \newcommand to create a macro |
| 41 |
| |
| 42 |
|--> |
| 43 |
<div style="display:none"> |
| 44 |
\( |
| 45 |
\def\<#1>{\left<#1\right>} |
| 46 |
\newcommand{\CC}{\mathbf{C}} |
| 47 |
\) |
| 48 |
</div> |
| 49 |
|
| 50 |
<p> |
| 51 |
This page uses two different methods to define macros: either putting them |
| 52 |
in JavaScript notation in the MathJax configuration, or in TeX notation in |
| 53 |
the body of the document. |
| 54 |
</p> |
| 55 |
|
| 56 |
<p>Some math that used the definitions: |
| 57 |
\[ |
| 58 |
f\colon\RR\to\RR^3 \hbox{ by } f(t)=\< t+1,{1\over 1+t^2}, \sqrt{t^2+1} > |
| 59 |
\] |
| 60 |
and |
| 61 |
\[ |
| 62 |
\{\,z\in\CC \mid z^2 = \bold{\alpha}\,\} |
| 63 |
\] |
| 64 |
</body> |
| 65 |
</html> |