2011年12月3日星期六

Latex:算法


1、用到的包有:
\usepackage[boxed,linesnumbered]{algorithm2e} 
% 算法的宏包,注意宏包兼容性,先后顺序为float、hyperref、algorithm(2e),否则无法生成算法列表,现在大部分都在用这个包
说明文档:http://mirror.bjtu.edu.cn/CTAN/macros/latex/contrib/algorithm2e/algorithm2e.pdf

\usepackage{algorithm}
\usepackage{algorithmic} %format of the algorithm
用这两个包的不多了,好像都被algorothms包中了
说明文档:http://mirrors.ustc.edu.cn/CTAN/macros/latex/contrib/algorithms/algorithms.pdf

LaTex:其他用法记录


1、条件编译
\def\mymain{a}
\def\mysub{a}

\ifx\mymain\mysub
  equal
\else
  inequal
\fi

LaTex:幻灯片beamer


1、让条目一个一个的出现
有三种方法:
(1)在要隐藏的条目前使用
\pause
(2)在导言区添加

LaTex:参考文献bibtex


1、插入网页条目
@MISC{breimandescription,
  author =       {Breiman, L.},
  title =        {Random Forests Classifier Description},
  howpublished = {"\url{http://oz.berkeley.edu/users/breiman/RandomForests/cc_home.htm}"},
}

LaTex:Tikz画图


1、画虚线
\begin{tikzpicture}[dash pattern=on 2pt off 3pt on 4pt off 4pt]
\draw (0pt,0pt) -- (3.5cm,0pt);
\end{tikzpicture}

代码的意思是:on 2pt off 3pt on 4pt off 4pt means \draw 2pt, then leave out 3pt, then draw 4pt oncemore, then leave out 4pt again, repeat。

LaTex:图像


1、subfigure,子图像用法
\begin{figure}[htbp]
    \centering
    \subfigure[]{
        \label{fig:fr}
        \includegraphics[width=.4\textwidth]{pic/f.jpg}
    }
    \subfigure[]{
        \label{fig:g}
        \includegraphics[width=.4\textwidth]{pic/g.jpg}
    }
    \caption{{\bf (a)} F, {\bf (b)} G.}
    \label{fig:c}
\end{figure}

LaTex:文档处理


1、设置段落的缩进
   段落前加上
\hangafter=0     %悬挂缩进?
\setlength{\hangindent}{4em} %4em为缩进的长度,一般的段落缩进为2em
\noindent     %去除全局带来的缩进,否则会在全局环境里已有的缩进基础上再缩进

LaTex:数学公式


1、把分数式的大小调整为正常的大小,\displaystyle

2、箭头上方写文字,\stackrel{abc}{\longrightarrow} 

LaTex:表格


1、表格的跨行与跨列
\usepackage{multirow}                   %table mutilline
\usepackage{booktabs}                   %table drawline

LaTex:Tikz调用gnuplot作图

首先是配置:
我的平台是ctex套件CTeX_2.9.0.152_Full,使用winedt。步骤如下
1、安装 gnuplot
      gnuplot 的主页是:http://www.gnuplot.info/
    可从 SourceForge 下载如 gp443win32.zip,

然后将gnuplot整个文件夹放到了D:\Program Files\ctex\miktex\scripts下;