In math, i.e. at math.stackexchange and mathoverflow, the blackboard bold symbols for:

  • ℕ — Natural Numbers
  • ℤ — Integers
  • ℚ — Rational Numbers
  • ℝ — Real Numbers
  • ℂ — Complex Numbers

are used very frequently. They can be generated by $\mathbb N$ etc. for example, but TeX macros like $\N$ for $\mathbb N$would be very convenient and obvious.

For example, Wikipedia is supporting the TeX macros above in <math>-tags.

Also used frequently are:

  • ℙ — integer primes and also in the context of probabilities.
  • 𝔽 — the context of Galois Fields.
  • ℍ — the upper complex half plane (less common).

Providing these additional macros would only require minor changes to the MathJax configuration, not to the MathJax or Markdown implementation itself.

Note: Some posts are defining their own macros, but macros can be overridden:


emits ℂ as expected. My feature request would just supply convenient defaults for some macros.

  • 7
    𝕀 𝕙𝕖𝕒𝕣𝕥𝕚𝕝𝕪 𝕖𝕟𝕕𝕠𝕣𝕤𝕖 𝕥𝕙𝕚𝕤 𝕖𝕧𝕖𝕟𝕥 𝕠𝕣 𝕡𝕣𝕠𝕕𝕦𝕔𝕥. – Robert Columbia Feb 10 '20 at 14:46
  • 1
    i always wondered why they do not exist tbh. Especially $\mathbb{R}$ is driving me nuts sometimes. – Zest Feb 10 '20 at 14:48
  • What is the question? I don't understand what you are requesting. – Stormblessed Feb 10 '20 at 14:50
  • 4
    It is worth knowing that the functionality is provided by the mathjax javascript library . I suspect that the library needs to support these Tex macros in the first place and if not, SE devs can't do much as the code of the lib isn't maintained by SE. – rene Feb 10 '20 at 14:53
  • @Zest: $\mathbb R$ will do, hence typing 2 symbols less: This applies to all TeX commands, e.g you can use \frac12 instead of \frac{1}{2}. – emacs drives me nuts Feb 10 '20 at 14:55
  • You could also memorise the unicode number of the desired symbols :) – Luuklag Feb 10 '20 at 14:56
  • 2
    @Stormblessed The request is to support TeX macros like \N that expand to \mathbb N because the latter if typed very (like in VERY) often in Math. For example, an according TeX macro would read \def\N{{\mathbb N}}. – emacs drives me nuts Feb 10 '20 at 14:58
  • @rene Isn't it enough to support it in TeX? After all, \N would just be macro and result in text replacement \N\mathbb{N}whatever-mathbb-is-def'ed-to{N}. – emacs drives me nuts Feb 10 '20 at 15:02
  • I believe everything you say at this point. I only know the MathJax lib due to some assistance I offered when they had to re-locate the library. What it actually can or does is unknown to me. If there are options to add standard macro's then this might be possible to adjust at the SE side. Let's wait for Ilmari karonen. I expect he knows how this might work. – rene Feb 10 '20 at 15:29
  • 1
    Previous discussion on math.SE: math.meta.stackexchange.com/q/25283 – Emil Jeřábek Feb 10 '20 at 16:40
  • Well, when I would want such a macro in one of my (La)TeX documents, then I'd just add a trivial one-liner... Are you saying that the TeX engine that's being used does not actually understand TeX and hence does not understand \def? – emacs drives me nuts Feb 10 '20 at 16:50
  • 2
    Of course, it is possible to use also in MathJax $\newcommand{\N}{\mathbb N}$ or $\def\N{\mathbb N}$ and you can find many posts where various macros are defined using \newcommand, \def, \renewcommand, \let, \DeclaremathOperator. (The searches I linked contain also some false positives.) In fact, on Mathematics Meta there is a separate tag (newcommand) for questions related to this. – Martin Feb 12 '20 at 7:45
  • My question was whether it was possible for all users, not if it possible to write \def\N{\mathbb N} at the start of each post or $...$ snippet. – emacs drives me nuts Feb 12 '20 at 7:49
  • Emil Jeřábek already linked to this post: $\LaTeX$ shortcuts. Another discussion on Mathematics Meta on similar issue can be found here: Can custom TeX/MathJax commands be defined by default for a site? – Martin Feb 12 '20 at 15:54

One important thing to keep in mind if this change is considered is whether this changes posts which already contain the macro with this name. Especially in cases where it is defined differently.

For example, people use both $\mathbf N$ (boldface N) and $\mathbb N$ (blackboard bold ℕ) for natural numbers, similarly for integers, rationals, reals. (This is explicitly mentioned in Wikipedia articles Natural number, Integer, Rational number, Real number, Complex number. This was also pointed out in the previous discussion on Mathematics Meta: $\LaTeX$ shortcuts.) It is going to be rather rare, but some people might use the macros \N, \Q, \R, \Z, \Q in different meaning.

What happens if the definition of some of the macros is added to MathJax configuration as suggested and if a post already contains definition of some of the macros, for example, $\newcommand{\N}{\mathbf N}$ (which is different from $\mathbb N$ - the one proposed in the question)? Which definition will be used after this change? (Although \mathbb N and \Bbb N are more common, you can find posts where \N is used as \mathbf N or as \mathcal N.)

I think that when changing to MathJax (or MarkDown or anything else), one should keep in mind also whether this influences how the existing posts are rendered. When some changes are applied retroactively - without user knowing that their posts are going to be changed - it is definitely not optimal.

The most recent change to rendering of MathJax that I am aware of was restricting the scope of \newcommand (and other commands for defining macros such as \renewcommand, \def, \let, \DeclareMathOperator) to a single post/single comment. This was changed in January 2019 as announced on Mathematics Meta. This change is also mentioned in this list: Recent feature changes to Stack Exchange. While this makes perfect sense and prevents possible clashes of macros defined in different posts, at the same time this also broke rendering of many posts and comments - which were rendered perfectly fine at the time when they were posted. You can find examples of such posts and comments on MathOverflow, on Physics and Cross Validated, but larger number of posts and comments influenced by this can be found on Mathematics.

  • The semantics of \N would just be to produce symbol ℕ. Whether or not a symbol is appropriate in a given context is up to the user – just like with any other symbol or notation. I did not want to imply that ℕ should always denote Natural numbers, just that ℕ is used very frequently, namely in the context of Natural numbers. Hence respective macros would be convenient. Moreover, you can use \def multiple time and override to what it expands. Hence my proposal is just to supply a convenient default definitions for very frequently used symbols. – emacs drives me nuts Feb 13 '20 at 9:34
  • @emacsdrivesmenuts My main question is what happens with the post where the macros such as \N, \Z, \Q, \R, \C are already defined. If you know for a fact that the change you suggesting would not influence such posts, it would be useful to clarify that in your question. – Martin Feb 13 '20 at 9:41
  • I can tell how it's working in TeX, but I know nothing about MathJax or whatever fancy tools would be needed or are in the way there... – emacs drives me nuts Feb 13 '20 at 9:55
  • @emacsdrivesmenuts I use LaTeX a lot - so there is no need to explain to me how it works there. However, MathJax - not LaTeX - is used for rendering mathematical formulas here on Stack Exchange. So for this to work it is important to know how things work in MathJax. – Martin Feb 13 '20 at 9:58
  • ...if you let parse $\def\N{\mathbb X}$ $\def\N{\mathbb Y}$ $\newcommand\N{\mathbb Z}$ $\renewcommand\N{\mathbb A}$ $\N$ then what shows up is $\mathbb A$ (rendered, of course) as expected. – emacs drives me nuts Feb 13 '20 at 9:58
  • It would be pretty easy to search the data explorer to see if any posts already define such a macro. I bet the number will be pretty small and in the realm of fixable. – Caleb Feb 13 '20 at 14:59
  • @Caleb The search results which I linked in the post give only about 30 results for \N with mathbf and \mathcal (about 100 with \mathbb), so I agree the the number is likely to be relatively low. To make a more extensive search, one should keep in mind all various ways how macros can be defined. (For example, \newcommand{\N}, \newcommand{N} and \newcommand\N are all valid. One can also use \let, \def, \renewcommand, Maybe with this number of possibilities, directly analyzing the data dump might be more viable than using SEDE. (But this is for more experienced users to say.) – Martin Feb 13 '20 at 15:06
  • @Caleb I don't have much experience with SQL, but I tried at least a very naive attempt to create a query searching for definitions of a macro. I got some results on MathOverflow, but on Mathematics I got "Execution Timeout Expired". When I tried only \newcommand - and not the other potions - I got 131 posts on Mathematics. – Martin Feb 13 '20 at 15:29

You must log in to answer this question.

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