网上搜到的名为《LaTex新人教程,30分钟从完全陌生到基本入门》,实践了一下。
安装CTEX后,打开WinEdt进行编辑,保存时选UTF-8,编译时选XeLaTex。
1,基本
\documentclass{article}
\begin{document}
hello, world
\end{document}
2,标题、作者和注释
\documentclass{article}
\author{My Name}
\title{The Title}
\begin{document}
\maketitle
hello, world % This is comment
\end{document}
3,章节和段落
\documentclass{article}
\title{Hello World}
\begin{document}
\maketitle
\section{Hello China} China is in East Asia.
\subsection{Hello Beijing} Beijing is the capital of China.
\subsubsection{Hello Dongcheng District}
\paragraph{Tian‘anmen Square}is in the center of Beijing
\subparagraph{Chairman Mao} is in the center of Tian‘anmen Square
\subsection{Hello Guangzhou}
\paragraph{Sun Yat-sen University} is the best university in Guangzhou.
\end{document}
4,目录
\documentclass{article}
\begin{document}
\tableofcontents
\section{Hello China} China is in East Asia.
\subsection{Hello Beijing} Beijing is the capital of China.
\subsubsection{Hello Dongcheng District}
\paragraph{Hello Tian‘anmen Square}is in the center of Beijing
\subparagraph{Hello Chairman Mao} is in the center of Tian‘anmen Square
\end{document}
5,换行
\documentclass{article}
\begin{document}
Beijing is
the capital
of China.
New York is
the capital
of America.
Amsterdam is \\ the capital \\
of Netherlands.
\end{document}
6,数学公式
\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
The Newton‘s second law is F=ma.
The Newton‘s second law is $F=ma$.
The Newton‘s second law is
$$F=ma$$
The Newton‘s second law is
\[F=ma\]
Greek Letters $\eta$ and $\mu$
Fraction $\frac{a}{b}$
Power $a^b$
Subscript $a_b$
Derivate $\frac{\partial y}{\partial t} $
Vector $\vec{n}$
Bold $\mathbf{n}$
To time differential $\dot{F}$
Matrix (lcr here means left, center or right for each column)
\[
\left[
\begin{array}{lcr}
a1 & b22 & c333 \\
d444 & e555555 & f6
\end{array}
\right]
\]
Equations(here \& is the symbol for aligning different rows)
\begin{align}
a+b&=c\\
d&=e+f+g
\end{align}
\[
\left\{
\begin{aligned}
&a+b=c\\
&d=e+f+g
\end{aligned}
\right.
\]
\end{document}
7,插入图片
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics[width=4.00in,height=3.00in]{figure1.jpg}
\end{document}
8,简单表格
\documentclass{article}
\begin{document}
\begin{tabular}{|c|c|}
aaa & b \\
c & ddddd\\
\end{tabular}
\begin{tabular}{|l|r|}
\hline
aaaa & b \\
\hline
c & ddddd\\
\hline
\end{tabular}
\begin{center}
\begin{tabular}{|c|c|}
\hline
a & b \\ \hline
c & d\\
\hline
\end{tabular}
\end{center}
\end{document}
9,中文支持
\documentclass[UTF8]{ctexart}
\begin{document}
你好,世界
\end{document}