MathJax v4 Custom TeX Extension

This file uses a custom combined component file with toggle included. Click on the "x" in the expression to see.

$$\toggle{x}{y}{z}\endtoggle + 1$$

This example shows how to create a component that combines several of the predefined components into one single custom component that includes exactly the pieces that you want.

The main code for the component is

which contains comments describing it in detail. In order to use the component in your web pages, you must turn this into a MathJax component file, which you do by first defining the component using the file

which gives the name of the component and where to pus the webpacked version of the code. The dest property being set to '.' means that the component will be placed in the directory with the source file, but with .min.js as the extension rather than .js.

To make the final component, use the commands

from the main directory of this repository. That will create the custom-component.min.js file in the custom-component directory.

To use this in your own web page, you only need one line:

(include the path to the custom-component.min.js file if needed). You can still use a MathJax configuration in your web page, or you could put additional configuration into the file

if you want to set the defaults for other options. This file sets the base Mathjax path to the jsdelivr.net CDN, so that the component can find the language files needed for speech generation, or other components if you were to load the require or autoload TeX extensions.