Enabling dollar delimiter for inline math

289 views
Skip to first unread message

za...@klacto.net

unread,
Dec 18, 2012, 3:27:26 PM12/18/12
to MathJax Users
Hi,

My pages use MathJax by means of the scripts line

<script type="text/javascript"
src="/static/mathjax/MathJax.js?config=TeX-AMS_HTML"></
script>

Wishing to enable dollar delimiters for inline math mode, I have tried
to modify the file MathJax/config/TeX-AMS_HTML.js by changing the line
that starts

MathJax.Extension.tex2jax={version:"1.1.3",config:{inlineMath:[["\\
(","\\)"]],displayMath: (etc.)

into

MathJax.Extension.tex2jax={version:"1.1.3",config:{inlineMath:
[['$','$'],["\\(","\\)"]],displayMath: (etc.)

but I still see no effect ("$f$" gets rendered simply as itself).

What am I doing wrong?

Peter Krautzberger

unread,
Dec 18, 2012, 3:32:22 PM12/18/12
to mathja...@googlegroups.com
Please read the documentation at http://docs.mathjax.org/en/latest/tex.html#tex-and-latex-math-delimiters for how to do that.

You should not edit the config files that MathJax ships with. (But you can writer your own or modify a copy.)

za...@klacto.net

unread,
Dec 18, 2012, 4:03:01 PM12/18/12
to MathJax Users, za...@klacto.net


On Dec 18, 3:32 pm, Peter Krautzberger <p.krautzber...@gmail.com>
wrote:
> Please read the documentation athttp://docs.mathjax.org/en/latest/tex.html#tex-and-latex-math-delimitersfor
> how to do that.
>
> You should *not* edit the config files that MathJax ships with. (But you
> can writer your own or modify a copy.)

Thanks Peter. Actually what I did was working, I had only neglected to
clear my browser's cache.

I had also read the doc you suggest, (although in the version
http://docs.mathjax.org/en/v1.1-latest/tex.html), and I wholeheartedly
agree with you for preferring to have a personal configuration file,
rather than edit the file shipped by MathJax. However, I don't know
how to include a personal configuration without editing TeX-
AMS_HTML.js. In fact, I saw that default.js has a hook for that:

MathJax.Hub.Config({

//
// A comma-separated list of configuration files to load
// when MathJax starts up. E.g., to define local macros, etc.
// The default directory is the MathJax/config directory.
//
// Example: config: ["local/local.js"],
// Example: config: ["local/local.js","MMLtoHTML.js"],
//
config: [],

but I found no such provision in TeX-AMS_HTML.js. How am I to proceed?
Does this mean that I should make my own config file and have *that*
include TeX-AMS_HTML.js?

Thanks again,
Francois Z.

Peter Krautzberger

unread,
Dec 18, 2012, 4:22:58 PM12/18/12
to mathja...@googlegroups.com, za...@klacto.net
ah, glad it worked out. 

If you the TeX-AMS_HTML basically serves your purpose (input-output-wise), then just put your personal configuration (delimiters, TeX-macros etc) in a separate file.

MathJax can load multiple configuration files. The instructions at http://docs.mathjax.org/en/latest/configuration.html#using-a-local-configuration-file-with-the-cdn work also with any other installation of MathJax (not just with the CDN).

Hope this helps.
Peter.

Marc Grober

unread,
Dec 18, 2012, 4:31:04 PM12/18/12
to mathja...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Some confusion is possible over the interaction between invoking a
default configuration and configuration lines added to change tokens
and the like. The examples all suggest that a line like
inlineMath: [['$','$'], ['\\(','\\)']],
will replace in toto all prior inlineMath statements for tex2jax, for
example, but I don't think this is expressed in so many words. In
other words, if you want to add @i to the list of tokens employed, you
have to list all the token you wish to use in the inlineMath
configuration statement, not just the tokens you wish to add.

Also, I noticed that the asciimath2jax parameters are not parallel to
delimiters for tex2jax in that the former requires a 'delimiter'
statement and then allows for inlineMath or displayMath statements,
while the latter omits the 'delimiter' statement. Why wouldn't these
use parallel structures?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.16 (Darwin)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iQEcBAEBAgAGBQJQ0OCYAAoJEMCi9wxDaNqE4GgIAL1MvAJMc8NYZeKtQNC+gYds
jqcEwp1gY/K2/+aV64oSti2UQg4cL4Yz+vOS2wNus/lijXOyAt7BVULX71IDRzRB
wEZ4KDC0EXiMGVCOrHcBwsIZ3bns3ZDXexr7Gl+3BZDsDST63u/nGLHtUmskP7fY
UGjxEnTjJFJHci1iOuejTcW4CyMDjuQSPlJE7mDi1zPFXku760Om1U0s5rzQcsjY
e0m0HlztdVHyD0RFjz6TQWeLqcsKhbchDDvDW97kpZE+fiHvl6qeZEjsjpqo2c75
wpyPWavUcO+7THc7fxK9Fu3XLPPNNS+rtziyzawLkYdRVBcM8mZl98JY3VDJtGE=
=FUaA
-----END PGP SIGNATURE-----

Davide Cervone

unread,
Dec 18, 2012, 4:38:43 PM12/18/12
to mathja...@googlegroups.com
> Also, I noticed that the asciimath2jax parameters are not parallel to
> delimiters for tex2jax in that the former requires a 'delimiter'
> statement and then allows for inlineMath or displayMath statements,
> while the latter omits the 'delimiter' statement. Why wouldn't these
> use parallel structures?

AsciiMath doesn't distinguish between in-line and display math (it
only has one mode). So rather than have separate inlineMath and
displayMath delimiter arrays, it just has a "delimiter" array. But I
do see that the example in the documentation is in error (it shows
inlineMath rather than delimiters). That should be fixed.

Davide

za...@klacto.net

unread,
Dec 19, 2012, 12:26:18 AM12/19/12
to MathJax Users, za...@klacto.net
Many thanks for the reference, Peter. That taught me about the in-line
configuration option, which turned out to be the most convenient for
my purposes.

Francois Z.

On Dec 18, 4:22 pm, Peter Krautzberger <p.krautzber...@gmail.com>
wrote:
> ah, glad it worked out.
>
> If you the TeX-AMS_HTML basically serves your purpose (input-output-wise),
> then just put your personal configuration (delimiters, TeX-macros etc) in a
> separate file.
>
> MathJax can load multiple configuration files. The instructions athttp://docs.mathjax.org/en/latest/configuration.html#using-a-local-co...

Peter Krautzberger

unread,
Dec 19, 2012, 12:50:02 AM12/19/12
to mathja...@googlegroups.com, za...@klacto.net
No problem at all. Glad the documentation could help out.
Reply all
Reply to author
Forward
0 new messages