Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Double brackets in MathJax

How can I achieve stretchy double brackets in MathJax using TeX? For example,

Math using double brackets

The TeX package stmaryrd has this but MathJax doesn't support the import of arbitrary packages.

I'd like the double brackets to look good at all sizes.

Bonus: Is this possible in AsciiMath?

like image 209
mjk99 Avatar asked Mar 13 '17 16:03

mjk99


1 Answers

The MathJax TeX fonts don't include the characters needed for these brackets. But you can get a similar effect using something like \left[\!\!\left[x^2\over 2\right]\!\!\right] or \left[\!\left[x+1\right]\!\right] or even [\![x+1]\!]. Unfortunately, the number of backspaces (\!) that you need depends on the content, so it is not easy to automate this. This is also dependent on the font in use, so if you are doing this on your own web site and using HTML-CSS (as opposed to SVG or CommonHTML output), you might want to disable the use of local STIX fonts, since the spacing would be different for that.

Alternatively, you could configure your page to use the STIX-Web fonts, which do include the needed characters (though not everyone likes the look of them), but you would also have to add the proper names and characters to the TeX delimiters list. Something like

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
  "HTML-CSS": {fonts: ['STIX-web']},
  SVG: {font: 'STIX-Web'},
  TeX: {Augment: {
    Definitions: {
      delimiter: {
        '\\llbracket': '27E6',
        '\\rrbracket': '27E7
      }
    }
  }}
});
</script>

added just before the script that loads MathJax.js itself should do it. Note that this works for HTML-CSS and SVG output, but not CommonHTML output, since the latter only uses the MathJax TeX fonts at the moment.

like image 53
Davide Cervone Avatar answered Sep 22 '22 10:09

Davide Cervone