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 $\Bbb 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.

  • 1
    i always wondered why they do not exist tbh. Especially $\mathbb{R}$ is driving me nuts sometimes.
    – Zest
    Commented Feb 10, 2020 at 14:48
  • What is the question? I don't understand what you are requesting. Commented Feb 10, 2020 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
    Commented Feb 10, 2020 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}. Commented Feb 10, 2020 at 14:55
  • You could also memorise the unicode number of the desired symbols :)
    – Luuklag
    Commented Feb 10, 2020 at 14:56
  • 3
    @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}}. Commented Feb 10, 2020 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}. Commented Feb 10, 2020 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
    Commented Feb 10, 2020 at 15:29
  • 2
    Previous discussion on math.SE: LaTeX shortcuts Commented Feb 10, 2020 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? Commented Feb 10, 2020 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
    Commented Feb 12, 2020 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. Commented Feb 12, 2020 at 7:49
  • 1
    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
    Commented Feb 12, 2020 at 15:54

2 Answers 2


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 𝐍) 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. Commented Feb 13, 2020 at 9:34
  • 1
    @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
    Commented Feb 13, 2020 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... Commented Feb 13, 2020 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
    Commented Feb 13, 2020 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. Commented Feb 13, 2020 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
    Commented Feb 13, 2020 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
    Commented Feb 13, 2020 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
    Commented Feb 13, 2020 at 15:29

I'm a very frequent poster on MO and somewhat frequent on math.SE. I am not a fan of this idea. First, since there seems to be some confusion, let me clarify what the current state of affairs is:

  1. MathJax supports commands like $\mathbb{R}$, which generates the character ℝ. Any formula which a user wants can be made in MathJax, using standard LaTeX syntax.

  2. MathJax supports defining macros, with commands like $\def\RR{\mathbb{R}}$. (And also $\newcommand{}$.) These work the same way that they do in LaTeX, except that they must be encased in dollars signs in order to draw MathJax's attention to them.

    Thus, any user who understands this can start their answer with a preamble which defines shortcuts for all the symbols that they want. It's quite normal for me to begin a long answer with a list of macros that I intend to use: If you open up the edit window for my answer here, you'll see that it starts $\def\ZZ{\mathbb{Z}}\def\SL{\text{SL}}\def\Id{\text{Id}}$. This is invisible to the user viewing the question page, but gives me the macros that I plan to use.

    Thus, users who understand MathJax already have access to the commands that they want, and the ability to define shorthand macros for them. The request here is to.

  3. Add in "standard" short macros that many users will want, like $\R$ for $\mathbb{R}$ or $\ra$ for $\rightarrow$.

My objection is that I don't think there is a useful standard to appeal to here. Anyone who spends a lot of time in LaTeX develops a set of macros which they are used to , but I don't think that there is much agreement as to what they are. I, for example, usually use $\RR$ for $\mathbb{R}$, and I use the already existing two letter command $\to$ for $\rightarrow$. By using up so many of the one letter and two letter macro names with these defaults, this would create more collisions with each individual users' preferences. The standard is the long command names which LaTeX and MathJax already use.

  • 1
    I am aware of all of this, and I lined it out in the question. What point are you trying to make? Commented Mar 20 at 21:18
  • 2
    @emacs One point is that there is no reason to prefer one user’s (= yours) set of favourite macros over another user’s. You want your shorthands for blackboard bold letter. I want my shorthands for \subseteq, \smallsetminus and \varnothing, and a redefinition of the god-awful LaTeX \Re and \Im to \operatorname{Re} and \operatorname{Im}. Someone else will want something else. If we all get ours in, it will result in an unmanageable bloated hodge-podge of random macros. The only sensible default is that the installation should only define standard macros, as it does now. Commented Mar 21 at 10:28
  • Back when I wrote TeX a lot, I preferred \Nat, \Zahl and \Compl for \mathbb N, \mathbb Z and \mathbb C, so that I could disambiguate them from \Normal (\mathcal N), \Zentrum (\mathrm Z) or \Cont (\mathrm C). It got to the point where I considered the TeX source more readable than the rendered output… Commented Mar 21 at 14:47

You must log in to answer this question.

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