File: menu.rst

package info (click to toggle)
mathjax-docs 3.2%2B20240903-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,184 kB
  • sloc: python: 31; javascript: 28; sh: 20; makefile: 8
file content (140 lines) | stat: -rw-r--r-- 4,692 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
.. _menu-options:

#######################
Contextual Menu Options
#######################

The `ui/menu` component implements the contextual menu that you get
when you right-click (or control-click) on a typeset expression.  The
settings in the menu are "sticky", which means that they are saved
from page to page and session to session (though they web-site
specific, so each web site has its own saved settings).

As a page author, you can alter the default settings of the menu by
using the ``menuOptions`` block of the ``options`` section of your
MathJax configuration, as described below.

The `ui/menu` component adds a render action called ``addMenu`` that
attaches the menu event handlers to the typeset output. (It also adds
a second render action called ``checkLoading`` that mediates the
loading of extensions needed by the contextual menu.  For example,
when the assistive :ref:`explorer-component` component is first
activated, MathJax may need to load the `a11y/explorer` component;
this render action makes sure that has happened before any math is
typeset.)

If you want to disable the contextual menu, you can set the
:attr:`enableMenu` option to ``false``:

-----

The Configuration Block
=======================

.. code-block:: javascript

    MathJax = {
      options: {
        enableMenu: true,          // set to false to disable the menu
        menuOptions: {
          settings: {
            texHints: true,        // put TeX-related attributes on MathML
            semantics: false,      // put original format in <semantic> tag in MathML
            zoom: 'NoZoom',        // or 'Click' or 'DoubleClick' as zoom trigger
            zscale: '200%',        // zoom scaling factor
            renderer: 'CHTML',     // or 'SVG'
            alt: false,            // true if ALT required for zooming
            cmd: false,            // true if CMD required for zooming
            ctrl: false,           // true if CTRL required for zooming
            shift: false,          // true if SHIFT required for zooming
            scale: 1,              // scaling factor for all math
            inTabOrder: true,      // true if tabbing includes math

            assistiveMml: true,    // true if hidden assistive MathML should be generated for screen readers
            collapsible: false,    // true if complex math should be collapsible
            explorer: false,       // true if the expression explorer should be active
          },
          annotationTypes: {
            TeX: ['TeX', 'LaTeX', 'application/x-tex'],
            StarMath: ['StarMath 5.0'],
            Maple: ['Maple'],
            ContentMathML: ['MathML-Content', 'application/mathml-content+xml'],
            OpenMath: ['OpenMath']
          }
        }
      }
    };

-----


Option Descriptions
===================

.. _menu-enableMenu:
.. describe:: enableMenu: true

   This controls whether the MathJax contextual menu will be added to
   the typeset mathematics or not.
   
.. _menu-settings:
.. describe:: settings: {...}

   These settings give the default menu settings for the page, though
   a user can change them using the menu.  These are described in the
   comments in the example above.

.. _menu-annotationTypes:
.. describe:: annotationTypes: {...}

   These are the settings for the "Annotation" submenu of the "Show
   Math As" menu. If the ``<math>`` root element has a ``<semantics>``
   child that contains one of the specified annotation formats, the
   source will be available via the "Show Math As" and "Copy to
   Clipboard" menus. Each format has a list of possible encodings. For
   example, the line

   .. code-block:: javascript
                   
      TeX: ['TeX', 'LaTeX', 'application/x-tex']

   maps an annotation with an encoding of ``TeX``, ``LaTeX``, or
   ``application/x-tex`` to the "TeX" entry in the "Annotation"
   sub-menus.

-----


Developer Options
=================

.. code-block:: javascript

    MathJax = {
      options: {
        MenuClass: Menu,
        menuOptions: {
          jax: {
            CHTML: null,
            SVG: null
          }
        }
      }
    };

.. _menu-MenuClass:
.. describe:: menuClass:  Menu

   The ``Menu`` object class to use for creating the menu.  This
   allows you to create a subclass of ``Menu`` and pass that to
   the document in pace of the default one.

.. _menu-jax:
.. describe:: jax: {CHTML: null, SVG: null}

   This lists the output jax instances to be used for the different
   output formats.  These will get set up automatically by the menu
   code if you don't specify one, so it is only necessary to set these
   if you want to manage the options specially.

|-----|