• If your annotation type is already in the MathML, you can skip this step.

/**
* Callback function that is called after a formula was rendered
* @param MathRenderer $Renderer * @param string|null$Result reference to the rendering result
* @param int $pid * @param int$eid
* @return bool
*/

function wfOnMathFormulaRendered( MathRenderer $Renderer, &$Result = null, $pid = 0,$eid = 0 ) {
$Result = preg_replace ("#</semantics>#", "<annotation encoding=\"yourAnnotation\" >" . annotationVariable . "</annotation>\n</semantics>",$Result );
return true;
}
/* yourAnnotation is the tag that you use to help MathJax find the annotation */
/* annotationVariable is the variable that holds the annotation */

\$wgHooks['MathFormulaRendered'] = array ('wfOnMathFormulaRendered');


to your local settings. Doing this will allow MathJax to find your annotation.

• Now go to the MediaWiki:Common.js page.
• Use the mw.loader.using function with a mediawiki hook to specify when you want the code to execute. Most of the mediawiki hooks do not work optimally for these customizations, so it is best if you create your own hook. If you do not know how to create a hook, go to this link: How to Create an MediaWiki Hook to Customize MathJax
• Redefine the semanticsAnnotations variable, adding your annotation type and tag. If necesary, you can add multiple tags. Here is a link to an example.
• Now your annotation type should be under Show Math As->Annotation->yourAnnotationType