Introduction to using latex to write mathematical formulas

Source: Internet
Author: User
Tags add numbers

Latex uses a special pattern to typeset mathematical symbols and formulas. The mathematical expression in a paragraph should be placed between (and), $ and $ or begin {math} and end {math.

$ C ^ {2} = a ^ {2} + B ^ {2} $

For larger mathematical formulas, the best way is to use the display style for formatting: place them between [and] or begin {displaymath} and end {displaymath. In this way, the formula is numbered. If you wantLatexYou can use the equation environment to add numbers for this purpose.
Compare the results of different typographical formats:

$ LiM _ {n to infty}
Sum _ {k = 1} ^ n frac {1} {k ^ 2}
= Frac {PI ^ 2} {6} $
Begin {displaymath}
Lim _ {n to infty}
Sum _ {k = 1} ^ n frac {1} {k ^ 2}
= Frac {PI ^ 2} {6}
End {displaymath}

Special characters

The following characters are:LatexThe reserved characters of, orLatexIt has specific usage or is not necessarily included in all font libraries. If you use them directly in the text, these characters are usually not obtained in the typographical results, andLatexDo something you don't want to happen.
# $ % ^ &_{}~
Of course, you can get them in the text by adding a backslash before these characters.
# $ % ^ {}&_{}~ {}
Other symbols can be obtained by special commands or as stress commands. The backslash cannot be obtained by adding another backslash before it. On the contrary, it is a command used to break the line.

1. The input command for lowercase Greek letters (lowercase Greek letters) is Alpha,
In beta, gamma,..., the input commands in uppercase are: gamma, Delta ,....
$ Lambda, XI, PI, Mu, Phi, Omega $

2. The index and subscript can be achieved by adding corresponding characters After ^ and.
$ A _ {1} $ qquad $ x ^ {2} $ qquad
$ E ^ {-Alpha T} $ qquad
$ A ^ {3 }_{ IJ} $
$ E ^ {x ^ 2} NEQ {e ^ x} ^ 2 $

3. The square root input command is: SQRT, and the N-power root is: SQRT [N]. The size of the Delimiter is determinedLatexIt is automatically adjusted. You can also use Surd to provide only symbols.
$ SQRT {x} $ qquad
$ SQRT {x ^ {2} + SQRT {y} $
Qquad $ SQRT [3] {2} $ [3pt]
$ Surd [x ^ 2 + y ^ 2] $

4. Command overline and underline draw a horizontal line above and below the expression.
$ Overline {m + n} $ qquad
$ Underline {m + n} $

5. The overbrace and underbrace commands provide a Horizontal Braces at the top and bottom of the expression.
$ Underbrace {A + B + cdots + z }_{ 26} $

6. vectors are usually represented by variables with a small arrow above (arrow symbols. This can be obtained by Vec. The other two commands overrightarrow and overleftarrow
It is useful when defining vectors from A to B.
Begin {displaymath}
VEC aquadoverrightarrow {AB}
End {displaymath}

7. The dot character in the multiplication formula can be omitted. However, sometimes to help readers interpret complex formulas, it is necessary to use the command cdot to express the dot.
Begin {displaymath}
V = {Sigma} _ 1 cdot {Sigma} _ 2
{Tau} _ 1 cdot {Tau} _ 2
End {displaymath}

8. The function name is usually used in the front-body layout of the Rome font, rather than using the Italian style layout like the variable name. Therefore,LatexProvide the following commands to typeset the most important function names.

Arcsin cosh deg gcd lg ln PR
Arctan cot det hom Lim log Sec
Arg coth dim INF liminf Max sin
Sinh sup tan tanh
[LiM _ {x rightarrow 0}
Frac {SiN x} {x} = 1]

9. fraction uses the frac {...} layout.
$1 frac {1} {2} $ ~ Hours
Begin {displaymath}
Frac {x ^ {2 }}{ k + 1} qquad
X ^ {frac {2} {k + 1} qquad
End {displaymath}

10. You can use the command {... choose...} or {... atop...} to typeset the two coefficients or similar structures ...}. The second command is the same as the output of the first command, but it does not include
Begin {displaymath}
{N choose k} qquad {x atop y + 2}
End {displaymath}

11. The integral operator is generated using Int. Sum Operator is generated by sum. Product Operator is generated by prod. The upper and lower limits are generated using ^ and _, similar to superscripts and subscripts.
Begin {displaymath}
Sum _ {I = 1} ^ {n} qquad
Int _ {0} ^ {frac {PI} {2} qquad
End {displaymath}

12. For parentheses (braces) and other delimiters, there are various symbols in tex (for example, [h k l ). Parentheses and square brackets can be input with corresponding keys. Curly braces use {. Other separators are generated using special commands (such as updownarrow.
Begin {displaymath}
{A, B, c} NEQ {a, B, c}
End {displaymath}

13. input the three dots (three dots) into the formula using several commands. Ldots arranges vertices on the base line. Cdots sets them to center. In addition, you can use the vdots command to make it vertical, and use ddots to get the diagonal dots ).
Begin {displaymath}
X _ {1}, ldots, X _ {n} qquad
X _ {1} + cdots + X _ {n}
End {displaymath}

14. If the space selected by tex in the formula is unsatisfactory, you can adjust it by inserting a special space command. There are several commands for small spaces:, corresponding to 3/18 Quad (),: corresponds to 4/18 Quad (), and corresponds to 5/18 Quad (). Returns a medium-size space. Quad () and qquad () generate large spaces. The size of Quad corresponds to the width of the 'M' character in the current font .! Command to generate a negative space-3/18 Quad ().
Newcommand {UD} {mathrm {d }}
Begin {displaymath}
Int !!! Int _ {d} g (x, y)
, Ud x, UD y
End {displaymath}
Begin {displaymath}
Intint _ {d} g (x, y) UD x UD y
End {displaymath}

15. The layout arrays uses the array environment for the layout matrix (arrays ). It is similar to the tabular environment and uses commands for branch.
Begin {displaymath}
Mathbf {x} =
Left (begin {array} {CCC}
X _ {11} & X _ {12} & ldots
X _ {21} & X _ {22} & ldots
Vdots & ddots
End {array} right)
End {displaymath}

The array environment can also use "." As the hidden right separator to typeset expressions with only one large separator.
Begin {displaymath}
Y = left {begin {array} {ll}
A & textrm {if $ D> C $}
B + X & textrm {in the morning}
L & textrm {all day long}
End {array} Right.
End {displaymath}

Like in the tabular environment, you can draw lines in the array environment. For example, the elements in the separator matrix.
Begin {displaymath}
Left (begin {array} {c | c}
1 & 2
3 & 4
End {array} right)
End {displaymath}

For formulas or equations distributed in several rows (equation system), you can use the eqnarray and eqnarray * environments to replace equation. In eqnarray, each row has an equation number. Eqnarray * Does not number the equation. The eqnarray and eqnarray * environments are similar to the three-column table in the form of {RCL. A column in the middle can be used as an equal or non-equal sign, or another symbol that looks suitable. Use the command line.
Begin {eqnarray}
F (x) & = & Cos x
F' (x) & = &-SiN x
Int _ {0} ^ {x} f (y) dy &
= & SiN x
End {eqnarray}

16. InLatexIt is difficult to obtain the bold symbol. This may be intentional, because amateurs always use bold words too much. The font change command mathbf gives bold letters, but these are Roman fonts (vertical), while mathematical symbols are usually italics. There is a boldmath command, but this can only be used outside the mathematical mode. This is also true for symbols.
Begin {displaymath}
Mu, M qquad mathbf {m} qquad
Mbox {boldmath $ Mu, M $}
End {displaymath}
It is easy to use amsbsy (including amsmath) and BM in the Toolkit because they contain the boldsymbol command.
Begin {displaymath}
Mu, M qquad
Boldsymbol {Mu}, boldsymbol {m}
End {displaymath}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.