# What MathJax commands are most often used on this site?

Following Mark Bennet's question on Short and helpful advice on using Mathjax on this site, I've began drafting a tutorial aimed at complete beginners. It can be found here. It is made up of $$5$$ sections:

1. Getting started
2. Understanding MathJax syntax
3. Numbers and arithmetic
4. Functions
5. Chaining syntax together

(There's also a section on calculus notation, but I'm considering breaking that off from the main answer since it doesn't strike me as completely essential that a user knows those commands right off the bat.)

I've tried my best to include the syntax that comes up the most frequently, but it's almost certain that I have omitted a thing or two. Does anyone have the technical know-how to search through this site to find the MathJax commands that come up the most frequently in posts? Perhaps there is a way of finding this out using the site analytics. Thank you.

• A simple way would to use the standard search with common commands. Like \frac, \sum, \int etc. This gives an idea of relative frequency. Since it's about frequent ones its not very likely that something relevant gets forgotten, especially if it is done as a group, posting results here. That said beyond absolute frequency there is also necessity. E.g., I frequently use \dots, but it's hardly essential and the the direct "..." is not that much worse. – quid Feb 22 at 18:18
• \dots!? Why not the slicker, more modern \dotsc, \dotsb, and so on? :P – Xander Henderson Feb 22 at 18:20
• Heretics! Embrace the superior \cdots. – Alexander Gruber Feb 22 at 18:45
• The trigonomtric functions $\sin x , \cos x \tan x$ – Aryadeva Feb 22 at 20:50
• I think the comments here suggest a short section on the fact that there are alternative ways of doing the same thing, and occasionally there are people who will insist that one is better than the other ... . Elegance can be possible, but comprehensibility is essential. – Mark Bennet Feb 22 at 21:28
• In reference to Arydeva's comment, we have \sin x, \cos x, \tan x, etc. – amWhy Feb 22 at 21:56
• @Xander How'd you forget \cdots? Also, separate from that, users should know that to write a set, using braces, then need to write \{ fee, fie, fum\}; without the backslash they will not render when surrounded with dollar signs, e.g. ${1, 2, \ldots}$ renders as ${1, 2, \ldots}$ – amWhy Feb 22 at 22:03
• Oops, I meant @AlexanderGruber: just as important as \cdots are \ldots!!! – amWhy Feb 22 at 22:20
• To @Joe, nothing in either your post suggests, and in Mark's post it is entirely overlooked the huge field that logic plays in math: implies, if and only if, and, or, not, occur throughout most areas of mathematics: In order: \rightarrow or \to, \leftrightarrow or \iff, \land or \wedge, \lor or \vee, \lnot or \neg – amWhy Feb 22 at 22:26
• @amWhy I don't use \cdots or \ldots. I use \dotsc for dots in lists (this is essentially \ldots, but with slightly more semantic information, \dotsb between binary operators (like \cdots, but with better spacing), and \dotsi between integrals (like \cdots, but with better spacing for integrals. There are several similar commands: tex.stackexchange.com/questions/122491/difference-of-the-dots . – Xander Henderson Feb 22 at 22:27
• I suggest that in different fields of math, the most basic commands needed to initially post questions are far more than calculus-oriented commands. Perhaps we need to identify the primary commands needed Freshman/Sophomore/Junior level classes. – amWhy Feb 22 at 22:31
• @Xander Heretic! No seriously, that's good to know! – amWhy Feb 22 at 22:33
• Joe, has anything been mentioned about writing fractions? Instead of seeing countless examples of "how to reduce 1+x/(1-x)^2 which is entirely ambiguous, highlighting \frac {1+x}{(1-x^2} would save askers and potential answerers a whole lot of time and spare them from frustration. Similar, \gcd(foo, fie) \mid. If you want basic think basic. – amWhy Feb 22 at 23:02
• \mod, \bmod and \pmod might be worth a mention. – Peter Phipps Feb 22 at 23:38
• \Bbb for our favourite sets, \tag for equation numbering, align environment for long chains of equations, ... – Hagen von Eitzen Feb 23 at 2:33

It's possible to analyze this with help of the Stack Exchange Data Explorer if you know a bit of SQL. The procedure is as follows:

• Split the body of the post into several chunks, splitting on the \ character
• Check which alphabetical characters appear at the beginning of each chunk
• Luckily, all posts starts with <p> so the first chunk, which is not a MathJax command, is ignored

Aggregate all the results, and you get this query. I'm actually surprised it didn't timeout on the volume of posts, but here are the commands which are used over a million times:

Command Times used
\frac 5248808
\mathbb 1861001
\in 1668461
\right 1552969
\left 1539656
\sqrt 1248791
\infty 1205941
\pi 1059025
\int 1042355
\sum 1036783

Of course, this does not cover the other syntaxes (e.g. curly braces), but at least it's a start.

• This is precisely what I needed. Thank you very much. – Joe Feb 23 at 14:46
• How does one have \right without a matching \left? – TheSimpliFire Feb 24 at 9:48
• @TheSimpliFire no idea, but it doesn't feel \right ... – Glorfindel Feb 24 at 9:52
• I don't know SQL but perhaps can search for all posts CONTAINING \right NOT \left -- I suspect most of them will actually be examples of incorrect MathJax where the equations aren't displayed correctly. – TheSimpliFire Feb 24 at 9:55
• @TheSimpliFire Some of those occurrences might be outside MathJax. (AFAICT it would be rather difficult to include also a test whether the text is inside MathJax, because there are many various ways how one could enter MathJax.) – Martin Sleziak Feb 24 at 13:12
• If somebody wants play around a bit more, here are Posts with macro1 but not macro2. There are at least some posts which contain the string "left\right" in the text (outside MathJax). My guess would be that various similar cases might be responsible for the difference. (You might notice that there's also a different number of occurrences of \begin and \end - maybe for similar reasons.) – Martin Sleziak Feb 24 at 13:26