1. 插入图片的一般方法
%文件开始加入宏包\usepackage{graphicx}
\includegraphics[width=3in]{file.eps} //3英寸
\includegraphics[width=\textwidth]{graphics.eps}将所插入图形缩放到和文本行的宽度一样宽
\includegraphics[width=0.80\textwidth]{graphics.eps}使得插入图形的宽度为文本行宽的 80%。
\includegraphics[width=8cm]{image/g.eps}\\ 图片在image文件夹下面
\begin{figure}[htbp] //htbp指定位置
h 当前位置
t 顶部
b 底部
p 浮动页
\begin{figure}
\setlength{\abovecaptionskip}{0pt}
\setlength{\belowcaptionskip}{10pt}
\centering
\caption{Caption Above Graphic}
\includegraphics[width=2in]{graphic.eps}
\end{figure} 得到图 18.2。其中标题的上方没有额外的空白,与图形之间则有 10pt 的距离。
\begin{figure}
\centering
\includegraphics[width=2in]{graphic.eps}
\renewcommand{\figurename}{Fig.}
\caption{This is the Caption}
\end{figure} //将figure 改为了Fig
%文件开始加入宏包:\usepackage{subfigure}
\begin{figure}[htbp]
\centering
\subfigure[green]{
\begin{minipage}{8cm}
\centering
\includegraphics[width=8cm]{g.eps}
%hspace(2cm)
\end{minipage}
}% 有%横排,没有竖排
\subfigure[red]{
\begin{minipage}{8cm}
\centering
\includegraphics[width=8cm]{g.eps}
%hspace(2cm)
\end{minipage}
}
\caption{two pictures}
\end{figure}
%插入图片2*2的格式
\begin{figure}[htbp]
\centering
\subfigure[subfigure 1-1]{\label{fig:subfig:a}
\includegraphics[width=0.45\linewidth]{fig2.eps}}
\hspace{0.01\linewidth}
\subfigure[subfigure 1-2]{\label{fig:subfig:b}
\includegraphics[width=0.45\linewidth]{fig4a.eps}}
\vfill
\subfigure[subfigure 2-1]{\label{fig:subfig:a}
\includegraphics[width=0.45\linewidth]{fig3.eps}}
\hspace{0.01\linewidth}
\subfigure[subfigure 2-2]{\label{fig:subfig:b}
\includegraphics[width=0.45\linewidth]{fig4b.eps}}
\caption{two figures}
\label{fig:subfig}
\end{figure}
2.基本公式的使用与编辑
//处于段内的数学文本要放在\( 与\) 之间, $ 与$ 之间, 或者\begin{math}与\end{math} 之间。
$c^{2}=a^{2}+b^{2}$
// 使得编辑的公式单独一行,不编号
\begin{displaymath}
c^{2}=a^{2}+b^{2}
\end{displaymath}
or you can type less with:
\[a+b=c\]
\frac{1}{2}-- 表示1/2
c=\left|a+b\right| --c=abs{a+b}
演示代码:
\documentclass{article}
\setlength\textwidth{245.0pt}
\usepackage{CJK}
\usepackage{indentfirst}
\usepackage{amsmath}
\begin{CJK*}{GBK}{song}
\begin{document}
方法一:
$$ f(x)=\left\{
\begin{aligned}
x & = & \cos(t) \\
y & = & \sin(t) \\
z & = & \frac xy
\end{aligned}
\right.
$$
方法二:
$$ F^{HLLC}=\left\{
\begin{array}{rcl}
F_L & & {0 < S_L}\\
F^*_L & & {S_L \leq 0 < S_M}\\
F^*_R & & {S_M \leq 0 < S_R}\\
F_R & & {S_R \leq 0}
\end{array} \right. $$
方法三:
$$f(x)=
\begin{cases}
0& \text{x=0}\\
1& \text{x!=0}
\end{cases}$$
\end{CJK*}
\end{document}
3. algorithm pseudo-code
%%%宏包%%%
\usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry}
\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode}
\usepackage{amsmath}
%%%%algorithm 1%%%
\renewcommand{\algorithmicrequire}{\textbf{Notation:}} % Use Input in the format of Algorithm
\renewcommand{\algorithmicensure}{\textbf{Notation:}} % Use Output in the format of Algorithm
\begin{algorithm}[htb]
\caption{ Framework of ensemble learning for our system.}
\label{alg:Framwork}
\begin{algorithmic}[1]
\Require
The set of positive samples for current batch, $P_n$;
The set of unlabelled samples for current batch, $U_n$;
Ensemble of classifiers on former batches, $E_{n-1}$;
\Ensure
Ensemble of classifiers on the current batch, $E_n$;
\State Extracting the set of reliable negative and/or positive samples $T_n$ from $U_n$ with help of $P_n$;
\label{code:fram:extract}
\State Training ensemble of classifiers $E$ on $T_n \cup P_n$, with help of data in former batches;
\label{code:fram:trainbase}
\State $E_n=E_{n-1}cup E$;
\label{code:fram:add}
\State Classifying samples in $U_n-T_n$ by $E_n$;
\label{code:fram:classify}
\State Deleting some weak classifiers in $E_n$ so as to keep the capacity of $E_n$;
\label{code:fram:select} \\
\Return $E_n$;
\end{algorithmic}
\end{algorithm}
%%%%%%algorithm 2%%%if else for while function %%%
\renewcommand{\algorithmicrequire}{\textbf{Notation:}} % Use Input in the format of Algorithm
\renewcommand{\algorithmicensure}{\textbf{Notation:}} % Use Output in the format of Algorithm
\begin{algorithm}
\caption{Framework of ensemble learning for our system.}
\begin{algorithmic}[1] %每行显示行号
\Require he set of positive sampl
\Ensure he set of positive sampl
\Function {MergerSort}{$Array, left, right$}
\State $result \gets 0$
\If {$left < right$}
\State $middle \gets (left + right) / 2$
\State $result \gets result +$ \Call{MergerSort}{}
\State $result \gets result +$ \Call{MergerSort}{}
\State $result \gets result +$ \Call{Merger}{}
\EndIf
\State \Return{$result$}
\EndFunction
\State
\Function{Merger}{$Array, left, middle, right$}
\State $i\gets left$
\State $j\gets middle$
\State $k\gets 0$
\State $result \gets 0$
\While{$i<middle$ \textbf{and} $j<right$}
\If{$Array[i]<Array[j]$}
\State $B[k++]\gets Array[i++]$
\Else
\State $B[k++] \gets Array[j++]$
\State $result \gets result + (middle - i)$
\EndIf
\EndWhile
\While{$i<middle$}
\State $B[k++] \gets Array[i++]$
\EndWhile
\While{$j<right$}
\State $B[k++] \gets Array[j++]$
\EndWhile
\For{$i = 0 \to k-1$}
\State $Array[left + i] \gets B[i]$
\EndFor
\State \Return{$result$}
\EndFunction
\end{algorithmic}
\end{algorithm}