%導言區
\documentclass{ctexart}
\usepackage{amsmath}
%正文區
\begin{document}
\section{簡介}
\LaTeX{}将排版分為文本模式和數學模式。文本模式用于普通文本排版,數學模式用于數學公式排版。
\section{行内公式}
\subsection{美元符号}
%一對單個$符号進行排版
交換律是 $a+b=b+a$,如 $1+2=2+1$。
\subsection{小括号}
交換律是 \(a+b=b+a\),如 \(1+2=2+1\)。
\subsection{math環境}
交換律是\begin{math}a+b=b+a\end{math},如
\begin{math}1+2=2+1\end{math}。
\section{上下标}
\subsection{上标}
$3x^2 - x + 2 = 0$
$3x^{20} - x + 2 = 0$
$3x^{3x^{20} - x + 2 = 0} -x + 2 = 0$
\subsection{下标}
$a_0,a_1,a_2$
$a_0,a_1,a_2,...,a_{100},...,a_{3x^{20} - x + 2 = 0}$
\section{希臘字母}
%小寫
$\alpha$
$\beta$
$\gamma$
$\epsilon$
$\pi$
$\omega$
%大寫
$\Gamma$
$\Delta$
$\Theta$
$\Pi$
$\Omega$
$\alpha^3 + \beta^2 + \gamma = 0$
\section{數學函數}
$\log$
$\sin$
$\cos$
$\arcsin$
$\arccos$
$\ln$
$\sin^2 x+ \cos^2 x = 1$
$y = \arccos x $
$y = \sin^{-1} x $
$y = \log_2 x $
$y = \ln x $
$\sqrt{2}$
$\sqrt{x^2+y^2}$
$\sqrt{2+\sqrt{2}}$
$\sqrt[4]{x}$
\section{分式}
大約是原體積的$3/4$
大約是原體積的$frac{3}{4}$
$\frac{x}{x^2+x+1}$
$\frac{\sqrt{x-1}}{\sqrt{x+1}}$
$\frac{1}{1+\frac{1}{x}}$
$\sqrt{\frac{x}{x^2+x+1}}$
\section{行間公式}
\subsection{美元符号}
%一對雙$符号進行排版
交換律是$$a+b=b+a$$,如$$1+2=2+1$$
%可以調整代碼格式 更加直覺
交換律是
$$a+b=b+a$$
如
$$1+2=2+1$$
\subsection{中括号}
交換律是
\[a+b=b+a\]
如
\[1+2=2+1\]
\subsection{displaymath環境}
交換律是
\begin{displaymath}a+b=b+a\end{displaymath}
如
\begin{displaymath}1+2=2+1\end{displaymath}
\subsection{自動編号公式equation環境}
交換律見式\ref{eq:commutative}: %添加引用 實作交叉引用
\begin{equation}
%可以添加标簽
a+b=b+a \label{eq:commutative}
\end{equation}
\subsection{不編号公式equation*環境}
交換律見式\ref{eq:commutative2} :%添加引用 實作交叉引用 此時的引用編号為小節編号
\begin{equation*} %需要導入amsmath宏包
%也可以添加标簽
a+b=b+a \label{eq:commutative2}
\end{equation*}
交換律見式\ref{eq:commutative3}: %添加引用 實作交叉引用
\begin{equation}
%可以添加标簽
x=b+a \label{eq:commutative3}
\end{equation}
公式的編号與交叉引用也是自動實作的,在排版中,要習慣采用自動化的方式處理諸如圖、表、公式的編号與交叉引用(删除一個公式或圖,編号和引用會自動重排)。
\end{document}
預覽效果: