使用WinEdt作为编辑latex文本的工具
1.LaTeX的基本语句
\documentclass{book}
\usepackage{amsmath} %使用宏包
\begin{document}
\title{this is my book}
\author{zhenjiang-xzy}
\date{} %用于日期的显示
\maketitle %标题输出结束
\end{document}
2.生成目录、标题等
\documentclass{book}
\usepackage{amsmath}
\begin{document}
\title{this is my book}
\author{xiao zeyu}
\date{}
\maketitle
\tableofcontents
%%生成目录
\mainmatter
%%将正文变为第一页
\part{now}
\chapter{introduction}
\section{first section}
\subsection{i love latex}
\chapter{conclusion}
\chapter{summary}
\part{advance}
\chapter{introduction}
\chapter{conclusion}
\chapter{summary}
\end{document}
生成如下图的PDF文件
3.表格图片等插入操作
3.1 list item的操作
\documentclass{article}
%\usepackage{enumerate}
%\usepackage{lengtable}
\begin{document}
\begin{itemize}
\item this is item1
\begin{itemize}
\item this is subtitle1
\item this is subtitle2
\begin{itemize}
\item this is subsubtitle1
\item this is subsubtitle2
\item this is subsubtitle3
\begin{itemize}
\item 11
\item 22
\item 33
\end{itemize}
\end{itemize}
\end{itemize}
\item this is item2
\item this is item3
\end{itemize}
\end{document}
3.2enumerate的使用
\begin{enumerate}[*\bfseries* A.]%%前导符是大写ABC...+粗体显示
\item this is subtitle1
\begin{enumerate}[a.]%小写abc...
\item this is subsubtitle1
\item this is subsubtitle2
\end{enumerate}
\item this is subtitle2
\item this is subtitle3
\end{enumerate}
使用setcounter将序列号任意改变
\begin{enumerate}[\bfseries A]%%前导符是大写ABC...+
\setcounter{enumi}{4}
\item this is subtitle1
\begin{enumerate}[\sffamily a.]
\item this is subsubtitle1
\item this is subsubtitle2
\end{enumerate}
\item this is subtitle2
\item this is subtitle3
\end{enumerate}
3.3表格环境使用
用tabular做出表格(其中:c表示居中对齐,l为左对齐,r为右对齐)
\begin{tabular}{clr}
221555555555555 & 11112555555 & 44443555555555\\
34343 & 6666 &09099
\end{tabular}
效果图如下显示:
在对齐方式之间加上竖线“|”可以做出竖线边框,加入\hline可以获得横线边框。
代码如下:
\begin{tabular}{c|l|r}
\hline
221555555555555 & 11112555555 & 44443555555555\\
\hline
34343 & 6666 & 09099\\ %%注意反斜杠
\hline
\end{tabular}
用\eject使得文字另起一页
用table给表格自动标号
一般用三线表
\begin{table}
\centering
\begin{tabular}{ccccccccc}
\hline
area& date& start& max& min& deal& close& money& amount\\
\hline
beijing & 2013/11/28 & 51.25 & 51.25 & 51.25 & 51.25 & 51.25 & 41000 & 800\\
beijing & 2013/11/29 & 51.25 & 51.25 & 51.25 & 51.25 & 51.25 & 0 & 0\\
beijing & 2013/11/30 & 51.25 & 51.25 & 51.25 & 51.25 & 51.25 & 0 & 0\\
beijing & 2013/12/1 & 51.25 & 51.25 & 51.25 & 51.25 & 51.25 & 0 & 0\\
\hline
\end{tabular}
\caption{this is my first table}
\end{table}
使用multicolumn将单元格中的元素合并(比如我将第一行的beijing 和 date进行合并)
multicolumn有三个参数:
a.需要合并的单元格数量
b.合并单元格的对齐方式
c.合并单元格具体的内容
\eject
\begin{table}
\centering
\begin{tabular}{ccccccccc}
\hline
area& date& start& max& min& deal& close& money& amount\\
\hline
\multicolumn{2}{c}{beijing 2013/11/28} & 51.25 & 51.25 & 51.25 & 51.25 & 51.25 & 41000 & 800\\%注意multicolumn的写法
beijing & 2013/11/29 & 51.25 & 51.25 & 51.25 & 51.25 & 51.25 & 0 & 0\\
beijing & 2013/11/30 & 51.25 & 51.25 & 51.25 & 51.25 & 51.25 & 0 & 0\\
beijing & 2013/12/1 & 51.25 & 51.25 & 51.25 & 51.25 & 51.25 & 0 & 0\\
\hline
\end{tabular}
\caption{this is my first table}
\end{table}
在某些单元格下方加上横线,使用\cline{3-4} 【表示在第三第四个单元格下面加入下划线】