Basic Latex markup (1)

The easiest way to get started writing mathematics is probably using some websites and write online. Some examples of such websites are: 

http://www.hostmath.com

https://www.sharelatex.com

https://www.overleaf.com

https://latexbase.com

https://zohooo.github.io/jaxedit

http://latex.91maths.com/ (Chinese 中文)

https://www.verbosus.com


To display math inline at mathwit.com, we wrap code between \( and \).  To display an equation in a new line, include the code inside \( \left[ \begin{array}{c} \text{ and }   \end{array}\right] \). Most of you already know superscript and subscript like  \(a^n\) gives you \(a^n\) and \(a_n\) gives you \(a_n\). For superscripts and subscripts involves more than one characters, you need to enclose them in brackets {and }. For example \(a_{1,2}\) gives you \(a_{1,2}\).


Fractions

\(\frac{b}{a}\) gives you \(\frac{b}{a}\). Also \(\frac ba\) gives you the same result. The trick is, for single characters you do not have to enclose them in the brackets { and } (not even a space in between is needed!). But for complex expressions, you have to, for example \(\frac{c^2}{a^2+b^2}\) gives you \(\frac{c^2}{a^2+b^2}\).

Square root and nth root

\(\sqrt a\) gives you \(\sqrt a\). Notice the space before a. At least one space needed. Also \(\sqrt {a}\) gives you the same result. But \(\sqrt a+b\) will not give you \(\sqrt {a+b}\), instead, displays \(\sqrt a+b\). Only the first character after \sqrt and space will be under square root sign. Instead, you have to enclose the expression \(a+b\) inside { and }: \(\sqrt {a+b}\).

The nth root like \(\sqrt[3]{a^2+b^2}\) is achieved by typing \(\sqrt[3]{a^2+b^2}\). Notice that the 3 is enclosed in square brackets.

Matrices

In the previous article, you have learned how to type a matrix. Now look at this matrix, with square brackets:
\(\left[ \begin{array}{ccc} a & b & c \\\\ d & e & f \end{array}\right]\).

To see the code to generate this matrix: right-click the above equation then choose to view code. See the following pictureView Latex code MathWit tutorial

If you just post on the forums, you are done. But depends on text editors, especially for course developers, instructors, managers, you may have to escape \\ by typing \\\\ to get a single \\. Thus, sometimes you have to type \\\\\\\\ to get \\\\, which means new line in latex.

\Left[ at the beginning and \Right] at the end to indicate the contents in between are to be enclosed in a resized square brackets. If you forget "\right]", your code will not be converted to math notations. 


Integrals: \int = \(\int\), \oint=\(\oint\)

\(\int f(x)dx\) gives you \(\int f(x)dx\). Another example, \(\int_a^bf(x)dx\) gives you \(\int_a^bf(x)dx\).

Last modified: Thursday, 23 November 2017, 4:41 PM