Release Notes > 12.0.0.0 > Updates in This Release > MathJax and Arbortext Layout Developer > Using the MathJax Library to Create SVG
  
Using the MathJax Library to Create SVG
Enabling the MathJax Library in Your Template
The MathJax add-on library provides a menu item to enable the namespace in your template. Selecting this option will associate the namespace with the current template and provide access to the mathjax:createGraphic function.
* 
If you have removed the mathjax_scripts.3ns file from your library, the first time the createGraphic function is run in the template, code will create a new Layout Developer namespace file for the mathjax_scripts namespace and link it to the template via the mathjax namespace. This namespace contains tag versions of the JavaScript files in the ‘mathjax_scripts’ folder. Should Layout Developer be required to rebuild the mathjax_scripts namespace, it will happen automatically the first time the createGraphic function is used. This process takes a few seconds to complete, but should only ever been required once when developing a template and only then if the namespace has been removed.
The mathjax:createGraphic function is the usable part of the integration.
Using the mathjax:createGraphic Function
With the library enabled, the mathjax:createGraphic function is available. This function is provided as a tool to create SVG from mathematics (TeX or MathML). Therefore, the function takes a number of arguments (or attributes) to enable this to work:
type — can be either ‘mathml’ or ‘tex’ and specifies the type of input content
output — the name of the object graphic to create for the SVG
content — a string specifying the equation (MathML or TeX)
unescape — will unescaped the predefined entity references in the content before it gets parsed and processed, and is provided as a way of getting content past Layout Developer’s stream tokeniser, for example when trying to put XML inside an attribute
This function can be used as a JavaScript function or as a tag.
Using it as a function, pass an object into the function with the properties set like this:
var mathObject = {};
mathObject.type = "mathml";
mathObject.output = "newSVG";
mathObject.content = '<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">' + formatting.evaluateXPath('x3b2:content-markup(.)') + '<\/math>';

content.functions.mathjax.createGraphic(mathObject);
Or like this:
content.functions.mathjax.createGraphic({type: “mathml”, output: “newSVG”, content: '<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">' + formatting.evaluateXPath('x3b2:content-markup(.)') + '<\/math>'});
The function can be used as a tag like this:
<mathjax:createGraphic type="tex" output="newSVG" content="G_n=\left (\prod _{j=1}^n X_j\right )^{1/n}"/>
When the graphic has been created it can be used, perhaps like this:
formatting.addImage(svgName, 0, fFormatting.SCALE_PERCENT, "40", fFormatting.SCALE_PRESERVE,"");
where ‘svgName’ is a variable which holds the name of the SVG graphic tag (in the cases above, ‘newSVG’).