LaTeX使用入門之表格?

Tags: 表格, 篇文章,

這篇文章主要介紹LaTex排版系統表格的生成

方法/步驟

上一篇《LaTeX使用入門》中忘記介紹怎麼換行了

很簡單

就在換行的位置加上兩個反斜槓\\

一個簡單的兩行五列的表格

\documentclass{article}

\usepackage{multirow}

\author{authorname}

\title{papertitle}

\begin{document}

\maketitle

this is table% This is comment

\\

\\

\begin{table}[!hbp]

\begin{tabular}{ c c c c c }

\hline

\hline

lable 1-1 & label 1-2 & label 1-3 & label 1 -4 & label 1-5 \\

\hline

label 2-1 & label 2-2 & label 3-3 & label 4-4 & label 5-5 \\

\hline

\end{tabular}

\caption{example of table}

\end{table}

\end{document}

如下圖所示

LaTeX使用入門之表格

LaTeX使用入門之表格

有的表格可能比較複雜,涉及跨行跨列。下面這個例子就是跨行跨列。

程式碼如下圖所示:

LaTeX使用入門之表格

LaTeX使用入門之表格

解釋如下:

(1)begin{table}[!hbp]——開始表格

(2)begin{tabular}{ c c c c c }——開始繪製表格,{ c c c c c } 表示會有5列, 每格方式居中(c), 其中 表示繪製列線

(3)hline ——繪製一條水平的線

(4)lable 1-1 & label 1-2 & label 1-3 & label 1 -4 & label 1-5——這是表格的一行, 其中5個元素, 用 &隔開.

(5)multirow{2}{*}{Multi-Row} & \multicolumn{2}{ c }{Multi-Column} & \multicolumn{2}{ c }{\multirow{2}{*}{Multi-Row and Col}} \\——上面開始兩行合併, 然後又是正常的兩列合併, 接下來是兩行兩列合併

(7)& column-1 & column-2 & \multicolumn{2}{ c }{}\\——填補上面的兩列合併的那一行

(8)multirow{2}{*}{text}——第一個引數表示行的數目,*表示由系統自動調整文字,text表示要寫入的文字

(9)multicolumn{2}{ c }{text}——表示跨2行,採用中心對齊的方式,text是要寫入的文字。

(10)cline用於畫橫線,cline{i-j}表示從第i列畫到第j列.

注意事項

注意引用多欄巨集包\usepackage{multirow}

相關問題答案