Article Directory
We usually create a doc(x) file in word, enter the content, adjust the margins, font size, line spacing, etc., and then hand it to the printer to print.
If you write an article about Xinjiang cotton, 2,000 words, you can quickly get the effect you want by adjusting it in word.
But if you want to print out the notes you took about matrix multiplication, because your handwriting is too ugly, you will find that you have encountered difficulties: how should those mathematical symbols be formatted to look good, especially for large pieces of content like matrices .
So you know how to insert a formula in word by looking for information, but you have to click Insert-Formula (or Alt + =) every time to insert a formula block at the current position.
If you want to add a subscript, click Subscript-Subscript.
Maybe you have noticed that word has an ink formula function, so you can't wait to open it, and find that this thing is also rubbish, handwriting is not suitable for the mouse, maybe it is better for the touch screen.
In the end, you discovered the good thing of LaTeX through the omnipotent Internet.
LaTeX birth background
Knuth , the old man in the picture was born in the United States. He is a famous computer scientist and an emeritus professor of computer science at Stanford University. Professor Knuth is a pioneer of modern computer science, created the field of algorithm analysis, and made cornerstone contributions in several branches of theoretical computer science. He has published many influential papers and books in the fields of computer science and mathematics. Winner of the Turing Award in 1974.
In 1966, Gartner's book reached more than 3,000 pages. It agreed with the publishing house to compile a masterpiece of computer programming "The Art of Computer Programming". deep influence.
But at that time, computer typesetting technology was very rough, which had affected the printing quality of his works. With a typical hacker thinking mode, he decided to write a typesetting software by himself: TeX. He planned to finish the work during his sabbatical in 1978, but in fact, the TeX language was not available until 1989, more than a decade later.
TeX and LaTeX
TeX (transliteration "Taihe", "Tek", written as "TeX") is a typesetting software written by American computer professor Donald Ervin Knuth. It is very popular in academia, especially mathematics, physics, and computer science. TeX is generally considered to be an excellent typesetting tool, especially for processing complex mathematical formulas. Using terminal software such as LaTeX, TeX can format text beautifully to help people recognize and find it.
LaTeX (Latek, written "LATEX"), is a TEX-based typesetting system developed by American computer scientist Leslie Lambert in the early 1980s, which takes advantage of the processing of this formatting system, even if the user does not The knowledge of typesetting and programming can also give full play to the powerful functions provided by TEX. It is not necessary to design or proofread one by one, and can generate a lot of book-quality prints in a few days or even a few hours. This is especially true for generating complex tables and mathematical formulas.
LaTeX main functions
TeX is essentially a macro language. LaTeX is a typesetting format based on this macro language, which has been continuously improved by future generations.
LaTex files have the extension .tex
. After creating the file, enter the code, save the file, and compile it into LaTeX through the tools provided by the editor. If it runs normally, you can see the exported PDF file.
document structure
Take the article (article) template as an example:
\documentclass[UTF8]{ctexart} %模板类型为中文article
\title{title} %标题
\author{author} %作者
\date{} %时间
\begin{document} %开始正文
\maketitle
\tableofcontents
\section{section1}
\subsection{subsection1}
这是文章第一节第一小节
\subsection{subsection2}
这是文章第一节第二小节
\section{section2}
\subsection{subsection1}
这是文章第二节第一小节
\subsection{subsection2}
这是文章第二节第二小节
\end{document}
Mathematical formula
Compared with word, latex editing formulas can adjust the size of formula letters and choose the appropriate line spacing to make the typesetting look more neat. And although it is to enter the code, the efficiency is much higher than that of mouse clicks.
There are two types of latex formulas, which are inline formulas and interline formulas (there are two insertion methods for interline formulas):
一元二次方程 $ax^2+bx+c=0 (b^2-4ac \geqslant 0) $ 的解为:
\[x=\dfrac{-b\pm \sqrt{b^2-4ac}}{2a}\]
Output result:
formula block
Entering mathematical formulas generally requires two macro packages: mathtools and amsmath.
By looking up official documents or using editor plug-ins, you can get the code corresponding to the symbol with just a mouse click.
定义:设 $A$ 是一个 $m \times n$ 矩阵,$B$ 是一个 $n \times s$ 矩阵,即
\[
A = \begin{pmatrix}
a_{11} & a_{12} & \dots & a_{1n} \\
a_{21} & a_{22} & \dots & a_{2n} \\
\vdots & \vdots & \ddots & \vdots \\
a_{m1} & a_{m2} & \dots & a_{mn} \\
\end{pmatrix}
,
B = \begin{pmatrix}
b_{11} & b_{12} & \dots & b_{1s} \\
b_{21} & b_{22} & \dots & b_{2s} \\
\vdots & \vdots & \ddots & \vdots \\
b_{n1} & b_{n2} & \dots & b_{ns} \\
\end{pmatrix}
.
\]
则 $A$ 与 $B$ 之乘积 $AB$ (记作 $C=(c_{ij})$ )是一个 $m \times n$ 矩阵,且
\[
c_{ij} = a_{i1}b_{1j} + a_{i2}b_{2j} + \dots + a_{im}b_{nj} = \sum_{k = 1}^{n} a_{ik}b_{kj}
\]
即矩阵 $C=AB$ 的第 $i$ 行第 $j$ 列元素 $c_{ij}$ ,是 $A$ 的第 $i$ 行 $n$ 个元素与 $B$ 的第 $j$ 列相应的 $n$ 个元素分别相乘的乘积之和。
For comparison, the first one is a word insertion formula, and the second one is generated by LaTeX.
Seeing this, you should feel the power of LaTeX, right?
It is very simple to get started with word, but it is difficult to learn more advanced functions; the learning curve at the introductory stage of LaTeX is extremely steep, but once you are proficient, you will be very handy and can typesetting the format you want.
I still use markdown a little more in daily life. There is not much demand for comparing formulas, and it is easy to spread on the Internet.
This article is just a very brief introduction. If you want to know more, please find the information yourself.
Finally, I have to say: LaTeX is awesome! ! !