This question already has an answer here:

I need help with formatting like how to use logs, lims, superscripts and subscripts etc.

marked as duplicate by user61527, apnorton, Thomas, Grigory M, Ayman Hourieh Feb 1 '14 at 23:16

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

migrated from math.stackexchange.com Feb 1 '14 at 20:31

This question came from our site for people studying math at any level and professionals in related fields.

Well, above the upper right corner of the text box for your question/answer there is little '?' sign. After clicking the sign it will show you list of basic formatting or you can get to a different site for 'advanced help'. Also you can use LaTeX for math formatting because the server runs MathJax script.


But to cover just the basics:

To format math expressions you can must enclose the math in '\$' from each side. So, in order to write something like this: $x^2 + 2$, I had to write \$x^2 + 2\$. As you can probably tell from the example the superscript/upper index/exponent you can write using this '^' sign. The subscript uses '_'. For example $2x_1^2 + x_2$ is in fact: \$2x_1^2 + x_2\$.

If the expression in the super/subscript is more complicated you must use curly brackets. E.g. \$ x^-1\$ executes as $ x^-1$, so in order to get $ x^{-1}$ you must write \$ x^{-1}\$. The same goes for the subscript.

Basic mathematical functions are probably known to MathJax and you can get the right format by writing '\' before the name of the function without any space. So e.g. \$lim\$ compiles as $lim$ while \$\lim\$ is $\lim$. Btw. subscript with limits: \$\lim_{n \to \infty}\$ stands for $\lim_{n \to \infty}$. More examples: \$\sin, \cos, \log_a, \sum_{n=1}^\infty \ldots\$ is $\sin, \cos, \log_a, \sum_{n=1}^\infty, \int_0^1 \ldots$.

If the function isn't know to $\LaTeX$ you can write \$\operatorname{sgn}x\$ and it will give the 'sgn' proper font and spacing $\operatorname{sgn} x$.

When the mathematical object is bigger or longer you can use double dollars instead of single. Then the object will be put in the middle and will be slightly bigger. E.g. \$\$\int_0^1 x_1^2 \;\mathrm{dx}\$\$ will look like this

$$\int_0^1 x_1^2\; \mathrm{dx}$$

Don't worry about the '\;' it is just space in mathematical mode(also '\,' and '\:') and '\mathrm{dx}' just changes the family font.

Hope that will help you to get into it. Bear in mind, that this is very little, so you will have to learn a lot by yourself. But feel free to ask. Good luck!

This should probably go in Mathematics Meta, but when you make posts on the right side there are 3 links for formatting and MathJaX help.

I don't think there's a formatting guide on Stack Overflow because very rarely do people use math equations, most of the time it's code.

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