table of Contents
Updated: 2019.10.01
1. Introduction
When we first enter the formula in the document, we first thought is the word, after all, this is one of our extremely popular three-piece suit. In fact, the use of the word ink formula (grinding grumble ??? ) to write a simple mathematical formula is also quite easy. However, when we need a lot of input complex mathematical formulas, with a word on the very collapse. On this day, I finally remembered once dominated by the word terror and humiliation hand lost mathematical formula of a night? ? ? .
In order to prevent the nightmare reproduce, let's sum up this invincible latex typesetting tools common usage (divided into several terms). Of course, not only to learn latex research of great benefit to the future of the paper, and jupyter the notebook also supports the latex input.
2. Commands
In the previously mentioned how the mathematical expression input, we first look at the command looks like latex of .
- Command without parameters: mainly \ form of command input, for example,
\hline
- There are n parameters command: mainly \ {Command Parameter Parameter. 1} {2} \ (\ cdots \) {n} Parameter entered in the form, for example
\begin{equation}
. - There are alternative command parameters: mainly \ Command [Arg] Parameter. 1} {2} {Parameter \ (\ cdots \) {} Parameter n-entered in the form, e.g.
\sqrt[n]{x^2 + y^2}
3. Enter the formula
In the latex, there are various ways of input formulas, for example, between the inner row and the row formula formula, or direct use \begin{}
and \end{}
commands
3.1 unnumbered formula
I usually use are no numbers formula, after all, not in writing papers, the basic formula does not need to be numbered , unnumbered formula is divided into two input methods.
3.1.1 row official
Direct use of a set of $
one example of content want to enter the package, particularly to see:
随机变量$X$的分布函数为$F(x)$,求出它的对应的密度函数$f(x)$
Display:
the random variable \ (X-\) distribution function \ (F. (X) \) , which is obtained corresponding density function \ (f (x) \)
3.1.2 line 间公 formula
And the formula is slightly different line, between the lines using a set of equations is $$
wrapped content to be inputted to a specific example see:
我们熟知的勾股定理是:$$a^2 + b^2 = c^2$$
Display:
We are familiar Pythagorean theorem: \ [A ^ B ^ 2 + 2 ^ 2 = C \]
3.2 Numbered formula
Sometimes we write papers, to be numbered label on formula, then you can use the following ways:
3.2.1 Manual No.
A relatively simple method is to directly add the formula in \tag{}
which {}
put numbers. The advantage of this approach is that we are able to carry out diverse set of numbers
$$a^2 + b^2 = c^2 \tag{1.1}$$
$$a^2 + b^2 = c^2 \tag{no.1}$$
Display:
\ [A ^ B ^ 2 + 2 ^ 2 = C \ Tag {1.1} \]
\ [A ^ B ^ 2 + 2 ^ 2 = C \ Tag Nos. 1} {\]
3.2.2 Automatic Number
We can use \begin{equation}
and \end{equation}
be input formula, which should be noted that begin and end is a set of commands to be used simultaneously, and the number can not be modified.
\begin{equation}
a^2 + b^2 = c^2
\end{equation}
Display:
\ the begin Equation} {
A ^ B ^ 2 + 2 ^ 2 = C
\ Equation End {}
In addition, in support of some latex editor can also be used \label{}
to add an equation label, use \ref{}
to reference number
\begin{equation}\label{eq2}
a^2 + b^2 = c^2
\end{equation}
这是第(\ref{eq2})个公式
Display:
\ the begin Equation} {\ label EQ2} {
A ^ B ^ 2 + 2 ^ 2 = C
\ Equation End {}
This is the first (\ ref {eq2}) of the formula
3.2.3 aligned equation
When we need to enter multiple formulas numbered, and they are automatically aligned to make, you can use the parametersalign
<!--不加align参数-->
\begin{equation}
x + y = 1\\\\
2x + y \neq 1\\\\
3x +4y \leq 2\\\\
4x \geq y
\end{equation}
Display: \ the begin Equation} { X + Y \\. 1 = 2x + Y \ \\ NEQ. 1 3x + 4Y \ \\ 2 Leq 4x \ GEQ Y \ Equation End {}
- tip1: blog in the garden of
\\
a representative after the escape\
, in fact, in some editing tools, the direct\\
will be able to direct for the trip (like jupyter notebook), does not require the use of\\\\
- tip2: in the latex, is not equal to \ (\ NEQ \) using
$\neq$
said less \ (\ Leq \) using$\leq$
said not less than \ (\ GEQ \) used$\geq$
represents - ps: you can see, enter the formula is looking into a whole, and not each of these formulas are numbered.
<!--使用align参数-->
\begin{align}
x + y = 1\\\\
2x + y \neq 1\\\\
3x +4y \leq 2\\
4x \geq y
\end{align}
Display: \ the begin {align = left} X + Y \\. 1 = 2x + Y \ \\ NEQ. 1 3x + 4Y \ \\ 2 Leq 4x \ GEQ Y \ End align = left {}
- ps: you can see, enter the formula is numbered separately.
3.2.4 separate input
When the formula is very long, can not be displayed in a row; or when calculation step, the formula needs to be split, then you can use split
the parameters
\begin{equation}
\begin{split}
(x + y)(x + 4y) & = x^2 + 4xy + xy + 4y^2\\\\
& = x^2 +5xy + 4y^2
\end{split}
\end{equation}
\begin{equation}
\begin{split}
(x + y)(x + 4y) & = x^2 + 4xy + xy + 4y^2\\
& = x^2 +5xy + 4y^2
\end{split}
\end{equation}
3.2.5 Classification Input
When the formula is a piecewise function, you need to use cases
the parameter
\begin{equation}
a_{i1}A_{j1} + a_{i2}A_{j2} + \cdots + a_{in}A_{jn} =
\begin{cases}
\begin{vmatrix}A\end{vmatrix},& i =j\\\\
0, & i \neq j
\end{cases}
\end{equation}
\begin{equation}
a_{i1}A_{j1} + a_{i2}A_{j2} + \cdots + a_{in}A_{jn} =
\begin{cases}
\begin{vmatrix}A\end{vmatrix},& i =j\\
0, & i \neq j
\end{cases}
\end{equation}
- ps: If the formula in each case should have a number, you can use
numcases
parameters, but to call in a special latex kitcases
packages