I want to use tooltips in my MathJax equations. I found this website (
). I tried to copy the document's contents. My head looks like this:
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>
MathJax = {
tex: {
inlineMath: [['$', '$'], ['\\(', '\\)']],
Macros: {
tooltipc: ["\\tooltip{\\color{green}{#1}}{#2}", 2],
texttip: ["\\tooltip{#1}{\\text{#2}}", 2],
texttipc: ["\\tooltip{\\color{green}{#1}}{\\text{#2}}", 2]
}
}
};
MathJax.Hub.Register.StartupHook("TeX Jax Ready", function () {
var TEX = MathJax.InputJax.TeX,
MML = MathJax.ElementJax.mml;
TEX.Definitions.macros.tooltip = "myToolTip";
TEX.Parse.Augment({
myToolTip: function (name) {
var arg = this.ParseArg(name), tip = this.ParseArg(name);
this.Push(MML.maction(arg, tip).With({ actiontype: MML.ACTIONTYPE.TOOLTIP }));
}
});
});
</script>
<script type="text/javascript" id="MathJax-script" async
</script>
<link rel="stylesheet" href="style.css">
\(\newcommand{\r}[1]{\frac{1}{#1}}\)
\(\newcommand{\h}[1]{\frac{#1}{2}}\)
\(\newcommand{\R}{\mathbb{R}}\)
\(\renewcommand{\a}[1]{\left\vert #1 \right\vert}\)
\(\newcommand{\p}[1]{\left( #1 \right)}\)
\(\newcommand{\iff}{\Longleftrightarrow}\)
\(\definecolor{orange}{RGB}{253, 119, 0}\)
\(\definecolor{redd}{RGB}{232,9,0}\)
\(\definecolor{bluee}{RGB}{0,77,255}\)
\(\definecolor{purplee}{RGB}{152,102,255}\)
\(\definecolor{goldd}{RGB}{204, 153, 0}\)
\(\definecolor{pinkk}{RGB}{244, 136, 189}\)
\(\definecolor{lightbluee}{RGB}{0, 176, 240}\)
\(\definecolor{greenn}{RGB}{114, 221, 0}\)
\(\newcommand{\blue}[1]{\textcolor{bluee}{#1}}\)
\(\newcommand{\red}[1]{\textcolor{redd}{#1}}\)
\(\newcommand{\purple}[1]{\textcolor{purplee}{#1}}\)
\(\newcommand{\gold}[1]{\textcolor{goldd}{#1}}\)
\(\newcommand{\pink}[1]{\textcolor{pinkk}{#1}}\)
\(\newcommand{\lightblue}[1]{\textcolor{lightbluee}{#1}}\)
\(\newcommand{\green}[1]{\textcolor{greenn}{#1}}\)
\(\newcommand{\orange}[1]{\textcolor{orange}{#1}}\)
\(\newcommand{\brown}[1]{\textcolor{darkorchid}{#1}}\)
\(\newcommand{\grey}[1]{\textcolor{grey}{#1}}\)
\(\newcommand{\magenta}[1]{\textcolor{magenta}{#1}}\)
\(\newcommand{\white}[1]{\textcolor{white}{#1}}\)
\(\newcommand{\yellow}[1]{\textcolor{yellow}{#1}}\)
\(\newcommand{\rt}{\textcolor{red}{t}}\)
\(\newcommand{\frac} [2]{\genfrac{} {} {2} {0} {#1}{#2}}\)
\(\newcommand{\beq}{\mathrel{\vcenter{\rlap{\Rule{2ex}{3px}{0px}}\raise9px{\Rule{2ex}{3px}{0px}}}}}\)
\(\newcommand{\bm}{\mathrel{\vcenter{\Rule{1.5ex}{2px}{0px}}}}\)
\(\newcommand{\bp}{\boldsymbol{+}}\)
</head>
I believe that the issue is that I am using MathJax.Hub.Register.StartupHook and "Macros" in the wrong place. It would be awesome if someone could help me put them in the correct location so I can use tooltips.