7

In ConTeXt wiki: Math, it is said that \m, \math, \mathematics are the same as $...$. My guess is that \m wraps $...$ in ConTeXt the same way as \(\) wraps $...$, is that so? Are there any advantage or disadvantage between $...$ and \m? (Like, better robustness, or clearer error messages) I really expect that a lookup of manual suffices, but I can't find anything in ConTeXt, the Manual, nor in ConTeXt, an Excursion.

0

1 Answer 1

4

First it should be noted that \m and \math are actually just shorthands for \mathematics.


The biggest difference between \m{...} and $...$ is that you can nest \m{...}.

\starttext
\m{e^x = \sum_{k = 0}^\infty \m{\frac{x^k}{k!}}}
\stoptext

That allows you to set a value to \m{...} and use the value both in text and math mode.


In principle \mathematics has an optional argument using which you can locally use \setupmathematics. However, when preparing a MWE for this answer I might have found a bug in there (https://mailman.ntg.nl/pipermail/ntg-context/2019/094137.html). Adding \everymathematics manually fixes the problem.

\starttext

The greek letter should be upright here

\m[lcgreek=normal]{\varphi}

\m[lcgreek=normal]{\the\everymathematics\varphi}

\stoptext

An additional convenience is that \m{...} is a command, whereas $...$ is not, so you can use \m in places where a command is required, e.g. in setups.


Personally I still use $...$ all the time because of editor shortcuts and syntax highlighting.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .