Defining a macro for \displaystyle

60 views
Skip to first unread message

sea-shadow

unread,
Mar 25, 2011, 9:41:46 PM3/25/11
to MathJax Users
To save some typing, I want to abbreviate \displaystyle to \ds. Thus,
I do:

MathJax.Hub.Config({
MMLorHTML: { prefer: {Firefox: "HTML", MSIE: "MML", other:
"HTML"} },
TeX: {
Macros: { ds: '{\\displaystyle}' }
}
});

But this does not seem to work as intended. For instance, \( \ds \int
\) fails to produce a large integral sign.

See http://www.math.umbc.edu/~rouben/zz.html for a sample.

I may have misunderstood MathJax's syntax. Please correct me.

-- Rouben Rostamian

PS: Changing the definition of \ds to:

Macros: { ds: ['{\\displaystyle #1}',1] }

sort of solves the problem. But this makes \ds into what Lamport
calls a "command" as opposed to a "declaration" (page 27 of the
LaTeX2e manual).

Davide P. Cervone

unread,
Mar 25, 2011, 9:51:04 PM3/25/11
to mathja...@googlegroups.com
Remove the braces from the definition string. Your macro is the
equivalent of

\newcommand{\ds}{{\displaystyle}}

which would make \ds be replaced by {\displaystyle} when you just want
\displaystyle. The extra braces isolate the \displaystyle to within
the braces, which is not what you want.

Davide

sea-shadow

unread,
Mar 25, 2011, 10:30:57 PM3/25/11
to MathJax Users
Oh, that's good. I had completely misunderstood the syntax :-(

Rouben

Davide P. Cervone

unread,
Mar 25, 2011, 11:08:22 PM3/25/11
to mathja...@googlegroups.com
Glad we got it straightened out. Good luck with the rest of your
project.

Davide

Reply all
Reply to author
Forward
0 new messages