latex Typesetting mathematics Good Commands to Know


Example

Some of the most common commands include:

  • Fractions and Square Roots: For fractions, use \frac {numerator}{denominator}. For square roots, use \sqrt[root]{number}.
  • Greek letters: use the commands given in the table below:

enter image description here

  • Operators: \leq gives the less than or equal to symbol, \geq gives the greater than or equal to symbol, \neq gives the not equal symbol, \sum gives the summation symbol, \partial gives the partial derivative symbol, \nabla gives the Laplacian operator, \times gives the cross product or multiplication symbol, \cdot gives the dot product or multiplication symbol, and \int gives the integral symbol.
  • Arrows: \rightarrow and \leftarrow give right and left arrows, respectively.
  • Percents: If typing % in LaTeX, it is important to include a backslash, \% as the percent symbol is normally used for comments.
  • Superscripts and Subscripts: To do a superscript, you can type x^2, or, for longer superscripts, x^{2x}. To do a subscript, you can type x_a, or, for longer subscripts, x_{ab}.
  • Bold: Use \boldmath{...} to make your math symbols bold. Other options are given at this TeX.SX question. Math symbols are automatically italicized; if you don't want this to be true, make your equation text as described below.
  • Infinity: To write infinity, use the command \infty.
  • Moving items over or under another: First, for math operators only, there is an alternate method. You can type the math operator, say \int, and then use the \limits command. An example is \int\limits_{\infty} or \int\limits^{\infty}. Then, for normal cases, you can do \overset{top}{normal} or \underset{bottom}{normal}. This can be very useful for doing vectors. For example, you might do \overset{\rightarrow}{x} The amsmath package is need for overset and underset.
  • Curly Braces: Because curly braces are used in commands, it is necessary to type \{ or \} to get curly braces.
  • Text: To include text in equations, type \usepackage{amsmath} in the preamble, and then type \text{...}.
  • Space: To add space in your equations, type \quad between the two items you want to separate (for example, you might have $2x \quad cos).