Letax Mathematical Formula Commonly Used Syntax.

This is an automatically translated post by LLM. The original post is in Chinese. If you find any translation errors, please leave a comment to help me improve the translation. Thanks!

Code some frequently used LeTaX mathematical formula syntax

1. Superscript and Subscript

The superscript command is "^", and the subscript command is "_"

\[x_1\] \[x_1^2\] \[x^2_1\] \[x_{22}^{(n)}\] \[{}^*\!x^*\]

1
2
3
4
5
$$x_1$$
$$x_1^2$$
$$x^2_1$$
$$x_{22}^{(n)}$$
$${}^*\!x^*$$

2. Fraction

When entering a short fraction, "/" can be used to input. For fractions with a horizontal fraction line, use ""

\[ (x+y)/2 \]\[ \frac{x+y}{2} \]

1
2
$$ (x+y)/2 $$
$$ \frac{x+y}{2} $$

3. Radical

The typesetting command for radical is: square root: ; nth root:

\[\sqrt{2}<\sqrt[3]{3}\]\[\sqrt{1+\sqrt[p]{1+a^2}}\]\[\sqrt{1+\sqrt[^p\!]{1+a^2}}\]

1
2
3
$$\sqrt{2}<\sqrt[3]{3}$$
$$\sqrt{1+\sqrt[p]{1+a^2}}$$
$$\sqrt{1+\sqrt[^p\!]{1+a^2}}$$

4. Summation and Integration

The typesetting commands for summation symbol and integration symbol are and respectively. They usually have upper and lower limits, which are superscripts and subscripts in typesetting.

\[\sum_{k=1}^{n}\frac{1}{k}\]\[\sum_{k=1}^n\frac{1}{k}\]\[\int_a^b f(x)dx\]\[\int_a^b f(x)dx\]\[\int_a^b f(x)\mathrm{d}x\]

1
2
3
4
5
$$\sum_{k=1}^{n}\frac{1}{k}$$
$$\sum_{k=1}^n\frac{1}{k}$$
$$\int_a^b f(x)dx$$
$$\int_a^b f(x)dx$$
$$\int_a^b f(x)\mathrm{d}x$$

5. Spacing

LaTeX can automatically handle most of the spaces between characters in formulas, but sometimes you need to manually control them.

Tight \(a\!b\) No space \(ab\) Small space \(a\,b\) Medium space \(a\;b\) Large space \(a\ b\) Quad space \(a\quad b\) Two quad spaces \(a\qquad b\)

1
2
3
4
5
6
7
Tight  $a\!b$
No space $ab$
Small space $a\,b$
Medium space $a\;b$
Large space $a\ b$
Quad space $a\quad b$
Two quad spaces $a\qquad b$

6. Matrix

For matrices with less than 10 columns, you can use matrix, pmatrix, bmatrix, Bmatrix, vmatrix, and Vmatrix environments.

\[\begin{matrix}1 & 2\\3 &4\end{matrix}\]\[\begin{pmatrix}1 & 2\\3 &4\end{pmatrix}\]\[\begin{bmatrix}1 & 2\\3 &4\end{bmatrix}\]\[\begin{Bmatrix}1 & 2\\3 &4\end{Bmatrix}\]\[\begin{vmatrix}1 & 2\\3 &4\end{vmatrix}\]\[\begin{Vmatrix}1 & 2\\3 &4\end{Vmatrix}\]

1
2
3
4
5
6
$$\begin{matrix}1 & 2\\3 &4\end{matrix}$$
$$\begin{pmatrix}1 & 2\\3 &4\end{pmatrix}$$
$$\begin{bmatrix}1 & 2\\3 &4\end{bmatrix}$$
$$\begin{Bmatrix}1 & 2\\3 &4\end{Bmatrix}$$
$$\begin{vmatrix}1 & 2\\3 &4\end{vmatrix}$$
$$\begin{Vmatrix}1 & 2\\3 &4\end{Vmatrix}$$

7. Typesetting Arrays

When the matrix size exceeds 10 columns, or the above matrix types do not meet the requirements, you can use the array environment. This environment can arrange some elements into a rectangular array that is aligned horizontally and vertically.

\[ \mathbf{X} = \left( \begin{array}{ccc} x_{11} & x_{12} & \ldots \\ x_{21} & x_{22} & \ldots \\ \vdots & \vdots & \ddots \end{array} \right) \]

1
2
3
4
5
6
7
8
$$
\mathbf{X} =
\left( \begin{array}{ccc}
x_{11} & x_{12} & \ldots \\
x_{21} & x_{22} & \ldots \\
\vdots & \vdots & \ddots
\end{array} \right)
$$

is the uppercase control symbol, \ means line break, and {ccc} represents the column style. The array environment can also be used to typeset expressions like this, using a "." as its hidden delimiter.

\[ y = \left\{ \begin{array}{ll} a & \textrm{if $d>c$}\\ b+x & \textrm{in the morning}\\ l & \textrm{all day long} \end{array} \right. \]

1
2
3
4
5
6
7
$$
y = \left\{ \begin{array}{ll}
a & \textrm{if $d>c$}\\
b+x & \textrm{in the morning}\\
l & \textrm{all day long}
\end{array} \right.
$$

You can also draw lines in the array environment, such as separating elements in a matrix.

\[ \left(\begin{array}{c|c} 1 & 2 \\ \hline 3 & 4 \end{array}\right) \]

1
2
3
4
5
6
7
$$
\left(\begin{array}{c|c}
1 & 2 \\
\hline
3 & 4
\end{array}\right)
$$

8. Limit Symbol

\[ {\lim_{x \to +\infty}} \]

1
$${\lim_{x \to +\infty}}$$

\[ {\lim_{x \to -\infty}} \]

1
$${\lim_{x \to -\infty}}$$

\[ {\lim_{x \to 0}} \]

1
$${\lim_{x \to 0}}$$

\[ {\lim_{x \to 0^+}} \]

```letax \[{\lim_{x \to 0^+}}\]