Latex中的表格设计得有些奇特,使用普通的字符来精确划线,很多类似的软件都采用了这样的principle。一个具体的例子:
\begin{table}[h]%开始一个表格environment,表格的位置是h,here。因为latex会根据情况,把表格放在页面的适当的位置,设置了h选项,就不会随便乱放了
\begin{tabular}{p{3.5cm}p{3cmp{2.5cm}}p{5cm}}%开始一个具体的表格,设置第一列的宽度是3.5cm,第二列的宽度是2.5cm,第三列的宽度是5cm。默认情况下latex的textwrap不是很好,所以,这里我就设置了每一列的宽度,强制转换。而且,我没有使用分割单元格的竖线。如果需要的话,可以这样设置{c|c|c},这里的c表示center,当然还可以使用l和r,意思很没白了。这样,就定义了一个3列的表格,而且有单元格分割线。对了,就是使用|来表示分割线的。
%下面就是单元格的具体内容了
Format & Extension& Description \\%用&来分隔单元格的内容 \\表示进入下一行
\hline%画一个横线,下面的就都是一样了,这里一共有4行内容
Bitmap & .bmp& Bitmap images are recommended because they offerthe most control over the exact image and colors.\\
\hline
Graphics Interchange Format (GIF) & .gif& Compressed image format used for Web pages.Animated GIFs are supported.\\
\hline
Joint Photographic Experts Group (JPEG) & .jpeg,.jpg & Compressed image format used for Webpages.\\
\hline
Portable Network Graphics (PNG) & .png& Compressed image format used for Web pages.
\end{tabular}
\caption{Art File Formats}%显示表格的标题
\begin{table}[h]%开始一个表格environment,表格的位置是h,here。因为latex会根据情况,把表格放在页面的适当的位置,设置了h选项,就不会随便乱放了
\begin{tabular}{p{3.5cm}p{3cmp{2.5cm}}p{5cm}}%开始一个具体的表格,设置第一列的宽度是3.5cm,第二列的宽度是2.5cm,第三列的宽度是5cm。默认情况下latex的textwrap不是很好,所以,这里我就设置了每一列的宽度,强制转换。而且,我没有使用分割单元格的竖线。如果需要的话,可以这样设置{c|c|c},这里的c表示center,当然还可以使用l和r,意思很没白了。这样,就定义了一个3列的表格,而且有单元格分割线。对了,就是使用|来表示分割线的。
%下面就是单元格的具体内容了
Format & Extension& Description \\%用&来分隔单元格的内容 \\表示进入下一行
\hline%画一个横线,下面的就都是一样了,这里一共有4行内容
Bitmap & .bmp& Bitmap images are recommended because they offerthe most control over the exact image and colors.\\
\hline
Graphics Interchange Format (GIF) & .gif& Compressed image format used for Web pages.Animated GIFs are supported.\\
\hline
Joint Photographic Experts Group (JPEG) & .jpeg,.jpg & Compressed image format used for Webpages.\\
\hline
Portable Network Graphics (PNG) & .png& Compressed image format used for Web pages.
\end{tabular}
\caption{Art File Formats}%显示表格的标题
\end{table}
原文地址:http://blog.sina.com.cn/s/blog_5e16f1770100fywe.html