Using Macros vs. preamble in a MathJax config file

163 views
Skip to first unread message

saf....@gmail.com

unread,
Dec 16, 2016, 11:12:04 AM12/16/16
to MathJax Users
In MathJax documentation here author(s) have defined content of a local config file (as an example) as:

Example 1:
MathJax.Hub.Config({
  TeX: {
    Macros: {
      RR: "{\\bf R}",
      bold: ["{\\bf #1}",1]
    }
  }
});

MathJax.Ajax.loadComplete("[MathJax]/config/local/local.js");
Whereas; at some other example I saw somewhere, the content of a local config file as:
Example 2:
MathJax.Hub.Config({
    TeX: {
        extensions: ["http://cs.jsu.edu/mathjax-ext/github/preamble/preamble.js"],
        preamble: [
          "\\def\\RR{\\mathbf{R}}",
          "\\def\\CC{\\mathbf{C}}"
        ]
    }
});
MathJax.Ajax.loadComplete("[MathJax]/config/local/local.js");
Question: I notice that in example 1 the same macro RR is defined differently then in example 2. a) What is the best approach b) Is preamble built-in configuration or one has to include premble.js?

David Farmer

unread,
Dec 16, 2016, 11:37:11 AM12/16/16
to MathJax Users

I don't have an answer to your specific question, but there are
other options:

Example 3:

Put this in the body of the document:

\(
\def\RR{\mathbf{R}}
\def\CC{\mathbf{C}}
\)

Or use the "newcommand" version.

Note: it is bad/antiquated style to use \bf, but that is a
LaTeX topic which has nothing to do with MathJax.
> --
> You received this message because you are subscribed to the Google Groups "MathJax Users"
> group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> mathjax-user...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>

Peter Krautzberger

unread,
Dec 19, 2016, 3:20:18 AM12/19/16
to mathja...@googlegroups.com
Hi,

> a) What is the best approach 

There's little difference. But I would always suggest to use the default.

> b) Is preamble built-in configuration or one has to include premble.js?

preamble.js is a third party contribution available via the third party extension repository, http://docs.mathjax.org/en/latest/options/ThirdParty.html#mathjax-third-party-extension-repository. In particular, we do not provide support for it.

Regards,
Peter.



For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-users+unsubscribe@googlegroups.com.

Davide Cervone

unread,
Dec 19, 2016, 3:18:56 PM12/19/16
to mathja...@googlegroups.com
As Peter points out, the preamble.js file is in the third-party repository. If you are using MathJax v2.7, you should be able to use

extensions: ["[Contrib]/preamble/preamble.js"],

as the location of the file (rather than jsu.edu address). This will get you the "official" copy from the third-party repository rather than a possibly outdated copy hosted elsewhere.

Davide

saf....@gmail.com

unread,
Dec 27, 2016, 6:43:15 PM12/27/16
to MathJax Users
I'm using MathJax v2.7 and what you suggested is what I was looking for. Thanks..Saf
Reply all
Reply to author
Forward
0 new messages