LaTeX常用用法
常用的環境
document 環境
所有文檔必須在document環境下編輯
sheetsummary 環境
摘要內容環境
keywords 環境
關鍵詞環境
itemize 環境
條目執行環境(配合\item)
Theorem 環境
定理闡述環境
Lemma 環境
引理闡述環境
proof 環境
證明的環境
figure 環境
圖片的環境
equation 環境
等式環境,自動編號
matrix,pmatrix,vmatrix 等環境
生成矩陣的環境
cases 環境
生成花括號環境
center 環境
居中環境
tabular 環境
表格環境
minipage 環境
生成2*2格子環境,可以做到讓兩個圖或者表進行並排顯示
thebibliography 環境
用於書寫應用的環境
appendices 環境
用於書寫附錄說明的環境
用到的包
palatino:字體 amsthm, abstract, amsmath, amssymb,amstext,wasysym,enumerate,graphicx
\usepackage[UTF8, nocap]{ctex} 可以中文輸入
title
\title{Freeway Traffic Modal Based on Celluar Automata and Monte-carlo Method }
\maketitle
其他用法
\newpage 開啟新的一頁
\label{fig-1}
\ref{fig-1} %引用
浮動體
\documentclass{ctexart}
\usepackage{graphicx}
\graphicspath{{figures/}}
\begin{document}
排版位置默認tbp\\
h, here 上下文位置\\
t, top 頂部\\
b, bottom 頁底\\
p, page 獨立的一頁
標題控制(caption ,bicaption)
\LaTeX{}中:\TeX 暑假訓練思維導圖 \ref{fig-1}
\begin{figure}[htbp]
\centering
\includegraphics[scale=0.1]{train}
\caption{\TeX 暑假訓練思維導圖}
\label{fig-1}
\end{figure}
\LaTeX{}中使用表格\ref{tab-score}
\begin{table}[h]
\centering
\caption{我的成績單}\label{tab-score}
\begin{tabular}{|p{20mm}|p{20mm}|p{20mm}|p{20 mm}|}
\hline
姓名 & 語文 & 數學 & 外語 \\
\hline
zh & 89 & 88 & 99 \\
\hline
li & 99 & 99 & 99 \\
\hline
wang & 100 & 12 & 232\\
\hline
dong & 100 & 100 &100 \\
\hline
\end{tabular}
\end{table}
\end{document}
字體設置
\documentclass{article}
\usepackage{ctex}
\begin{document}
%設置字體族
\textrm{Roman Family}
\textsf{Sans Serif Family}
\texttt{Typewriter Family}
\rmfamily Roman Family
{\sffamily Sans Serif Family}
{\ttfamily Typewriter Family}
%字體系列設置
\textmd{Medium Series}
\textbf{Boldface Series}
{\mdseries Medium Series}
{\bfseries Boldface Series}
%字體形狀系列
\textup{Upright Shape}
\textit{Italic Shape}
\textsl{Slanted Shape}
\textsc{Small Caps Shape}
{\upshape Upright Shape}
{\itshape \ Italic Shape}
{\slshape Slanted Shape}
{\scshape Small caps Shape}
\end{document}
論文頭部設置
\documentclass{article} %book,report,letter
\usepackage{ctex}
\title{My First Article}
\author{董佩傑}
\date{\today}
\newcommand\degree{^\circ}
%正文區
\begin{document}
\maketitle
Hello world
Let $f(x)$ be defined by the formula
$$f(x)=3x^2+2x$$ which is a polynomial of degree 2.
$\angle C = 90\degree$.
\begin{equation}
AB^2 = BC^2 + AC^2.
\end{equation}
\end{document}
數學上的用法
\documentclass{ctexart}
\usepackage{graphicx}
\graphicspath{{figures/}}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\tableofcontents
\section{行內公式}
\subsection{美元符號}
交換律是 $ a+b = b+a$
\subsection{math環境}
\begin{math}
交換律是$ a + b = b + a$
\end{math}
\subsection{小括號}
交換律是 \(a+b=b+a\)
\section{上下標}
$3x^{30}+2x^2+x+4$\\
\ $3x^{3x^{30}+2x^2+x+4}+2x^2+x+4$ \\
$a_0,b_0,c_0,d_{000}$
\section{希臘字母}
$\alpha$\\
$\beta$\\
$\gamma$\\
$\epsilon$\\
$\pi$\\
$\omega$\\
$\Gamma$\\
$\Delta$\\
$\Theta$\\
$\Pi$\\
$\Omega$
\section{數學函數}
$\log \sin \cos \arcsin \arccos \ln$
$\sqrt[4]{2}$
\section{分式}
$3/4 \\ \frac{4}{5}$
\section{行間公式}
$$ a+b = b+a $$
\section{equation}
\begin{equation}
a+b = b+a\label{eq:commutative}
\end{equation}
\section{矩陣的表示}
\centering
\[
\begin{matrix}
3 & 4 & 5\\
4 & 5 & 5\\
3\\
\end{matrix}
\begin{pmatrix}
3 & 4 & 5\\
4 & 5 & 5\\
3\\
\end{pmatrix}
\begin{bmatrix}
3 & 4 & 5\\
4 & 5 & 5\\
3\\
\end{bmatrix}
\begin{Bmatrix}
3 & 4 & 5\\
4 & 5 & 5\\
3\\
\end{Bmatrix}
\begin{vmatrix}
3 & 4 & 5\\
4 & 5 & 5\\
3\\
\end{vmatrix}
\begin{Vmatrix}
3 & 4 & 5\\
4 & 5 & 5\\
3\\
\end{Vmatrix}
\]
省略號
\[
A = \begin{bmatrix}
a_{11} & \dots & a_{1n}\\
&\ddots & \vdots\\
0&&a_{nn}
\end{bmatrix}_{n \times n}
\]
\[
\begin{pmatrix}
\hdotsfor{4}
\end{pmatrix}
\]
行內小矩陣
\begin{math}
\left(
\begin{smallmatrix}
x & y\\ a & b
\end{smallmatrix}
\right)
\end{math}
%array環境
\[
\begin{array}{r|r}
\frac{1}{2} & 0 \\
\hline
0 & 1
\end{array}
\]
\section{多行公式排版問題}
\begin{gather}
a + b = b + c\\
ab = bc
\end{gather}
\section{對齊}
\begin{align}
x &= t + t ^2\\
y &= t^4 + 2
\end{align}
% split 環境實現一個公式多行拍板
\begin{equation}
\begin{split}
y &= 2\cos x + 3\sin ^2 x\\
&= 3\sin^2 x + 2\cos x
\end{split}
\end{equation}
% cases 環境 實現兩部分分段函數的處理
%text命令在數學中處理中文
\begin{equation}
D(x) = \begin{cases}
1,& \text{如果} x \in \mathbb{Q};\\
0,& \text{如果} x \in \mathbb{R} \setminus\mathbb{Q}
\end{cases}
\end{equation}
\end{document}
參考文獻寫法
dpj.bib
@article{Athanassopoulos:1995iw,
author = "Athanassopoulos, C. and others",
title = "{Candidate events in a search for anti-muon-neutrino --->
anti-electron-neutrino oscillations}",
collaboration = "LSND",
journal = "Phys. Rev. Lett.",
volume = "75",
year = "1995",
pages = "2650-2653",
doi = "10.1103/PhysRevLett.75.2650",
eprint = "nucl-ex/9504002",
archivePrefix = "arXiv",
primaryClass = "nucl-ex",
reportNumber = "LA-UR-95-1238",
SLACcitation = "%%CITATION = NUCL-EX/9504002;%%"
}
@article{MacGibbon:1995in,
author = "MacGibbon, B. E. and Garino, G. and Lucas, M. A. and
Nathan, A. M. and Feldman, G. and Dolbilkin, B.",
title = "{Measurement of the electric and magnetic
polarizabilities of the proton}",
journal = "Phys. Rev.",
volume = "C52",
year = "1995",
pages = "2097-2109",
doi = "10.1103/PhysRevC.52.2097",
eprint = "nucl-ex/9507001",
archivePrefix = "arXiv",
primaryClass = "nucl-ex",
SLACcitation = "%%CITATION = NUCL-EX/9507001;%%"
}
@article{Athanassopoulos:1996wc,
author = "Athanassopoulos, C. and others",
title = "{Evidence for neutrino oscillations from muon decay at
rest}",
collaboration = "LSND",
journal = "Phys. Rev.",
volume = "C54",
year = "1996",
pages = "2685-2708",
doi = "10.1103/PhysRevC.54.2685",
eprint = "nucl-ex/9605001",
archivePrefix = "arXiv",
primaryClass = "nucl-ex",
reportNumber = "LA-UR-96-1326",
SLACcitation = "%%CITATION = NUCL-EX/9605001;%%"
}
latexReference.tex
\documentclass{article}
\bibliographystyle{plain}
\begin{document}
\centering
這是一個參考文獻的引用:\cite{Athanassopoulos:1995iw}
這是第二個參考文獻的引用:\cite{MacGibbon:1995in}
這是第三篇參考文獻的引用\cite{Athanassopoulos:1996wc}
應用\cite{art1}
\bibliography{dpj}
\begin{thebibliography}{99}
\bibitem{art1}Collaboration, L. S. N. D., et al.\emph{Top Cited Articles during 1994 in nucl-ex.} Phys. Rev. Lett Phys Rev Lett 75 (1995): 2650.
\end{thebibliography}
\end{document}
文章結構
\documentclass{article}
\usepackage{ctex}
\begin{document}
\tableofcontents
\section{引言}
\section{試驗方法}
\section{實驗結果}
\subsection{1}
\subsubsection{1. 1}
\subsection{2}
\section{結論}
'' 、、
\section{致謝}
\end{document}