.. _whats-new-2.0: ************************** What's New in MathJax v2.0 ************************** MathJax version 2.0 includes many new and improved features, including much better speeds in Internet Explorer, a new AsciiMath input processor, a new :term:`SVG` output processor, support for additional LaTeX commands, and many bug fixes, to name just a few of the changes. Major speed improvement for HTML-CSS output, particularly in IE =============================================================== The HTML-CSS output processing was redesigned to avoid the page reflows that were the main source of the speed problem in Internet Explorer 8 and 9. For test pages having between 20 and 50 typeset expressions, we see an 80% reduction in output processing time for IE8, a 50% reduction for IE9, and between 15% and 25% reduction for most other browsers over the corresponding v1.1a times. Since the processing time in v1.1a grows non-linearly in IE, you should see even larger savings for pages with more equations when using v2.0. Forcing IE7 emulation mode is no longer necessary (and indeed is no longer recommended). Reduced flickering during typsetting ==================================== In the past, each expression was displayed as soon as it was typeset, which caused a lot of visual flickering as MathJax processed the page. In v2.0, the output is processed in blocks so that typeset expressions are revealed in groups. This reduces the visual distraction, and also speeds up the processing. The number of equations in a block can be controlled through the ``EqnChunk`` parameter in the HTML-CSS or SVG block of your configuration. See the :ref:`configuration options for HTML-CSS ` and :ref:`configuration options for SVG ` pages for details. If the page URL includes a hash reference (a link to a particular location within the page), MathJax v2.0 will jump to that location after the page has finished typsetting. (Since the size of the page may have changed due to the mathematical typsetting, that location may no longer be visible on screen, so MathJax moves there when it is done with the initial typesetting.) You can control this behavior with the ``positionToHash`` parameter in the main section of your configuration. See the :ref:`core configuration options ` page for details. Automatic equation numbering of TeX formulas ============================================ The TeX input jax now can be configured to add equation numbers (though the default is not to number equations so that existing pages will not change their appearance). This is controlled through the ``equationNumbers`` section of the ``TeX`` block of your configuration (see the :ref:`equation numbering ` section for details). You can request that the numbering follow the AMS-style numbering of environments, or you can request that every displayed equation be numbered. There are now ``\label``, ``\ref``, and ``\eqref`` commands to make it easier to link to particular equations within the document. Automatic line breaking of long displayed equations =================================================== MathJax now implements the MathML3 specification for automatic line breaking of displayed equations in its HTML-CSS output. This is disabled by default, but can be enabled via the ``linebreaks`` section of the ``HTML-CSS`` or ``SVG`` block of your configuration (see the :ref:`automatic line breaking ` section for details). Note that automatic line breaking only applies to displayed equations, not in-line equations, unless they are themselves longer than a line. The algorithm uses the nesting depth, the type of operator, the size of spaces, and other factors to decide on the breakpoints, but it does not know the meaning of the mathematics, and may not choose the optimal breakpoints. We will continue to work on the algorithm as we gain information from its actual use in the field. New AsciiMath input jax and SVG output jax ========================================== MathJax currently processes math in either :term:`TeX` and :term:`LaTeX` format, or :term:`MathML` notation; version 2.0 augments that to include :term:`AsciiMath` notation (see `the ASCIIMathML home page `_ for details on this format). This is a notation that is easier for students to use than TeX, and has been requested by the user community. See the :ref:`AsciiMath support ` page for details. In addition to the HTML-CSS and Native MathML output available in v1.1, MathJax v2.0 includes an :term:`SVG`-based output jax. This should prove to be more reliable than the HTML-CSS output, as it avoids some CSS, web-font, and printing issues that the HTML-CSS output suffers from, and it currently has no browser-dependent code. The SVG mode even works in some ebook readers (like Apple iBooks and Calibre). See the :ref:`output formats ` documentation for details. New combined configuration files ================================ Pre-defined configuration files that include the AsciiMath and SVG processors are now available with MathJax v2.0. These include ``AM_HTMLorMML``, ``TeX-AMS-MML_SVG``, and ``TeX-MML-AM_HTMLorMML``. See the :ref:`common configurations ` section for details. MathJax contextual menu now available on mobile devices ======================================================= MathJax v2.0 provides access to its contextual menu in mobile devices that are based on the WebKit (Safari) and Gecko (Firefox) engines. For Mobile Firefox, the menu is accessed by a tap-and-hold on any expression rendered by MathJax (this is Mobile Firefox's standard method of triggering a contextual menu). In Mobile Safari, use a double-tap-and-hold (you may need to zoom in a bit to be able to accomplish this). This is the first step toward providing a better interface for mobile devices. Improved support for screen readers =================================== Some issues surrounding the use of screen readers and their interaction with MathPlayer have been resolved in MathJax v2.0. In particular, there are additional menu items that allow the user finer control over some aspects of MathJax's interface that were interfering with some screen readers' ability to properly identify the mathematics. Several stability issues with MathPlayer have also been addressed. In Internet Explorer when MathPlayer is installed, there is now a new contextual menu item to allow you to specify what events are handled by MathJax and what should be handled by MathPlayer. This gives you finer control over MathPlayer's interaction with some screen readers. Many new TeX additions and enhancements ======================================= * New `mhchem` chemistry extension (adds ``\ce``, ``\cf``, and ``\cee`` macros) * New `cancel` extension (adds ``\cancel``, ``\bcancel``, ``\xcancel``, and ``\cancelto`` macros) * New `extpfeil` extension (adds more stretchy arrows) * New `color` extension (makes ``\color`` work as a switch, as in LaTeX). Adds ``\definecolor``, other color models, LaTeX named colors, ``\colorbox``, ``\fcolorbox``, etc. * New `begingroup` extension to allow macro definitions to be localized. Adds ``\begingroup`` and ``\endgroup`` for isolating macro declarations, and defines ``\let``, ``\renewenvironment``, ``\global``, and ``\gdef``. * New `enclose` extension to give TeX access to ```` elements. Adds ``\enclose{type}[attributes]{math}`` macro. * New `action` extension to give TeX access to ```` elements. Adds ``\mathtip{math}{tip}``, ``\texttip{math}{tip}``, and ``\toggle{math1}{math2}...\endtoggle`` macros. * New ``\mmToken{type}[attributes]{text}`` macro for producing ````, ````, ````, and other token MathML elements directly. * New ``\bbox[color;attributes]{math}`` macro to add background color, padding, borders, etc. * New ``\middle`` macro for stretchy delimiters between ``\left`` and ``\right``. * New ``\label``, ``\ref``, and ``\eqref`` macros for numbered equations. * Better implementation of ``\not`` so it produces proper MathML when possible. * Better implementation of ``\dots`` that selects ``\ldots`` or ``\cdots`` depending on the context. * Better implementation of ``\cases`` that automatically uses ``\text`` on the second entry in each row. * Safer implementation of ``\require`` that only allows loading from extensions directory. * Allow ``\newcomand`` to provide a default parameter. * Allow ``\\`` to take an optional argument that specifies additional space between lines. * Allow ``\\`` to be used anywhere (to force a line break), not just in arrays. * Allow optional alignment parameter for array, aligned, and gathered environments. See the :ref:`TeX support ` page for details on these extensions and macros. Font enhancements ================= * Work around for the OS X Lion STIX font problem. * Support for STIX-1.1 fonts (detection of which version you have, and use data appropriate for that). * New WOFF versions of the web fonts (smaller, so faster to download). * Data for more stretchy characters in HTML-CSS output. * Add support for Unicode planes 1 through 10 (not just the Math Alphabet block) in HTML-CSS output. * Increased timeout for web fonts (since it was switching to image fonts too often, especially for mobile devices). * Only switch to image fonts if the first web font fails to load (if we can access one, assume we can access them all). * Allow ```` elements to use the page font rather than MathJax fonts (optionally). This is controlled by the ``mtextFontInerhit`` configuration parameter for HTML-CSS and SVG output jax. * Provide better control over the font used for characters that are not in the MathJax fonts. * Allow Firefox to use web-based fonts when a local URL uses MathJax from the CDN (in the past it would force image fonts when that was not necessary). Interface improvements ====================== * The MathJax contextual menu has been reorganized to make it easier to get the source view, and to control the parameters for MathPlayer in IE. * The MathJax contextual menu is available in mobile devices (see description above). * Warning messages are issued if you switch renderers to one that is inappropriate for your browser. * MathJax now starts processing the page on the ``DOMContentLoaded`` event rather than the page ``onload`` event (this allows the mathematics to appear sooner). * Native MathML output is now scaled to better match the surrounding font (like it is for HTML-CSS output). * Better CSS styling for NativeMML output in Firefox in order to handle ``\cal`` and other fonts. * MathML output now (optionally) includes class names to help mark special situations generated by the TeX input jax. (This lets the MathML from the Show Source menu item better reproduce the original TeX output.) * MathJax now loads the menu and zoom code (if they haven't been loaded already) after the initial typesetting has occured so that they will be available immediately when a user needs those features, but do not delay the initial typesetting of the mathematics. * For the `tex2jax` preprocessor, the ``processClass`` can now be used to override the ``skipTags`` to force a tag that is usually skipped to have its contents be processed. * The `noErrors` and `noUndefined` extensions can now be disabled via a configuration option (since they are included in many of the combined configuration files). See the `noErrors` and `noUndefined` sections of the :ref:`TeX support ` page for more information. * There is a new :meth:`MathJax.Hub.setRenderer()` function that can be used to switch the current renderer. See the :ref:`MathJax Hub API ` documentation for details. * A user-defined macros is no longer overridden if an extension is loaded that redefines that macro. * Improved web-font detection reliability. .. _important-changes-2.0: Important changes from previous versions ======================================== * The default renderer for Firefox has been changed from `NativeMML` to `HTML-CSS` (in those configurations that choose between the two). The only browser that defaults to `NativeMML` is now IE with MathPlayer installed. You can configure this to your liking using the :ref:`MMLorHTML configuration options `. * `NativeMML` output will now be selected in IE9 when MathPlayer is present (since IE9 was released the same day as MathJax v1.1a, and there had been problems with IE9 beta releases, we weren't sure if MathPlayer would work with the official release, and so did not select NativeMML by default.) * The performance improvements in IE8 and IE9 now make it unnecessary to use a ```` tag to force IE7 emulation mode. In fact IE9 in IE9 standards mode now runs faster than IE9 in IE7 standards mode, and IE8 in IE8 standards mode is comparable to IE8 in IE7 standards mode. We now recommend that you use .. code-block:: html to obtain the highest emulation mode available in IE, which will be the fastest one for MathJax 2.0. * The `tex2jax` preprocessor now balances braces when looking for the closing math delimiter. That allows expressions like .. code-block:: latex $y = x^2 \hbox{ when $x > 2$}$ to be properly parsed as a single math expression rather than two separate ones with unbalanced braces. The old behavior can be obtained by setting ``balanceBraces`` to false in the ``tex2jax`` block of your configuration. (See the :ref:`tex2jax configuration options ` for details.) * If you are hosting your own copy of MathJax on your server, and that copy is being used from pages in a different domain, you will have set up the access control paramters for the font directory to allow Firefox to access the font files properly. Since MathJax 2.0 includes fonts in WOFF format, you will need to include ``woff`` in you access control declaration for the fonts. E.g., use :: Header set Access-Control-Allow-Origin "*" in the ``.htaccess` file for the ``Mathjax/fonts`` directory if you are using the Apache web server. See :ref:`Notes about shared installations ` for details. * The ``\cases`` macro now properly places the second column in text mode not math mode. In the past, one needed to use ``\text`` in the second column to achieve the proper results; pages that did this will still work properly in v2.0. Pages that took advantage of the math mode in the second column will need to be adjusted. * The ``\dots`` macro now produces ``\ldots`` or ``\cdots`` depending on the context (in the past, ``\dots`` always produced ``\ldots``). * A one pixel padding has been added above and below HTML-CSS and SVG output so that math on successive lines of a paragraph won't bump into each other. * There is a new `MathPlayer` submenu of the `Math Settings` menu in the MathJax contextual menu that allows the user to control what events are passed on to MathPlayer. This allows better control for those using assistive devices like screen readers. When menu events are being passed on to MathPlayer, the MathJax menu can be obtained by ALT-clicking on a typeset expression (so the user can still access MathJax's other features). * In order to improve stability with IE when MathPlayer is installed, MathJax now adds the namespace and object bindings that are needed for MathPlayer at the time that Mathjax is first loaded, rather than waiting for the `NativeMML` output jax to be loaded. Since this is before the configuration information has been obtained, this will happen regardless of whether the `NativeMML` output jax is requested. This means that IE may ask the user to allow MathPlayer to be used, and may show the MathPlayer splash dialog even when MathPlayer is not in the end used by MathJax. Note that this setup can only be performed if MathJax is loaded explicitly as part of the initial web page; if it is injected into the page later by adding a ``