File: bbox.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 (62 lines) | stat: -rw-r--r-- 1,683 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
.. _tex-bbox:

####
bbox
####

The `bbox` extension defines a new macro for adding background colors,
borders, and padding to your math expressions.

.. describe:: \\bbox[options]{math}

    puts a bounding box around ``math`` using the provided ``options``.
    The options can be one of the following:

    1.  A color name used for the background color.
    2.  A dimension (e.g., ``2px``) to be used as a padding around the
        mathematics (on all sides).
    3.  Style attributes to be applied to the mathematics (e.g.,
        ``border: 1px solid red``).
    4.  A combination of these separated by commas.

Here are some examples:

.. code-block:: latex

    \bbox[red]{x+y}      % a red box behind x+y
    \bbox[2pt]{x+1}      % an invisible box around x+y with 2pt of extra space
    \bbox[red,2pt]{x+1}  % a red box around x+y with 2pt of extra space
    \bbox[5px, border: 2px solid red]
                         % a 2px red border around the math 5px away

This extension is loaded automatically when the `autoload` extension
is used.  To load the `bbox` extension explicitly, add
``'[tex]/bbox'`` to the ``load`` array of the ``loader`` block of
your MathJax configuration, and add ``'bbox'`` to the ``packages``
array of the ``tex`` block.

.. code-block:: javascript

   window.MathJax = {
     loader: {load: ['[tex]/bbox']},
     tex: {packages: {'[+]': ['bbox']}}
   };

Alternatively, use ``\require{bbox}`` in a TeX expression to load it
dynamically from within the math on the page, if the `require`
extension is loaded.

-----


.. _tex-bbox-commands:


bbox Commands
-------------

The `bbox` extension implements the following macros:
``\bbox``


|-----|