reveal-js-base-theme/plugin/math/mathjax/test/sample-macros.html

65 lines
1.6 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE html>
<html>
<head>
<title>Example of defining a macro that autoloads an extension</title>
<!-- Copyright (c) 2012-2013 The MathJax Consortium -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!--
|
| This page shows how to define macros in your configuration, or as part
| of the body of the page itself.
|
|-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: {
Macros: {
RR: '{\\bf R}', // a simple string replacement
bold: ['\\boldsymbol{#1}',1] // this macro has one parameter
}
}
});
</script>
<script type="text/javascript" src="../MathJax.js?config=TeX-AMS_HTML-full"></script>
</head>
<body>
<!--
|
| Here we use a math block that contains nothing but definitions in
| standard TeX format. It is enclosed in a DIV that doesn't display, so
| that there are no extra spaces generated by having the extra
| mathematics in the text.
|
| The first macro makes it easy to display vectors using \<x,y,z>
| the second uses \newcommand to create a macro
|
|-->
<div style="display:none">
\(
\def\<#1>{\left<#1\right>}
\newcommand{\CC}{\mathbf{C}}
\)
</div>
<p>
This page uses two different methods to define macros: either putting them
in JavaScript notation in the MathJax configuration, or in TeX notation in
the body of the document.
</p>
<p>Some math that used the definitions:
\[
f\colon\RR\to\RR^3 \hbox{ by } f(t)=\< t+1,{1\over 1+t^2}, \sqrt{t^2+1} >
\]
and
\[
\{\,z\in\CC \mid z^2 = \bold{\alpha}\,\}
\]
</body>
</html>