本系列文章由 @YhL_Leo 出品,转载请注明出处。
文章链接: http://blog.csdn.net/yhl_leo/article/details/50066137
一些LaTeX中表格的使用方法如下:
1.table
\documentclass{article}\begin{document}\begin{table}[h]\centering\begin{tabular}{|l|c|c|}\hlineSetting&\multicolumn{2}{c|}{A4 size paper}\\\hline&mm&inches\\Top&25&1.0\\Bottom&25&1.0\\Left&20&0.8\\Right&20&0.8\\Column Width&82&3.2\\Column Spacing&6&0.25\\\hline\end{tabular}\caption{Margin settings for A4 size paper}\label{tab:Margin_settings}\end{table}\end{document}
2.tabular
\begin{tabular}{|c|c|c|}\hline 2&9&4\\\hline 7&5&3\\\hline 6&1&8\\\hline
\end{tabular}
例子里面的|c|这样的,那个地方叫做导言区,来约定表格的每列属性的:
l | left-justified column |
c | centered column |
r | right-justified column |
b | bottom |
c | center (default) |
t | top |
p{'width'} | paragraph column with text vertically aligned at the top |
m{'width'} | paragraph column with text vertically aligned in the middle (requires array package) |
b{'width'} | paragraph column with text vertically aligned at the bottom (requires array package) |
| | vertical line |
|| | double vertical line |
另外,还有一些常用的命令:
& | column separator |
\\ | start new row (additional space may be specified after \\ using square brackets, such as \\[6pt] |
\hline | horizontal line |
\newline | start a new line within a cell (in a paragraph column) |
\tabularnewline | start a new line within a cell (in a paragraph column) instead of \\ to avoid a Misplaced \noalign error in the tabular |
\cline{i-j} | partial horizontal line beginning in column i and ending in column j |
除了最简单的用例外,还可以这样:
% example 1:
\begin{center}\begin{tabular}{ | l || c || r }\hline1 & 2 & 3 \\ \hline4 & 5 & 6 \\ \hline \hline7 & 8 & 9 \\\hline\end{tabular}
\end{center}
example 1 % example 2:
%\multicolumn{n}{format}{item}
\begin{tabular}{|c|c|c|}\hline \multicolumn{3}{|c|}{?}\\\hline 7&5&3\\\hline 6&1&8\\\hline
\end{tabular}
example 2 % example 3:
\begin{tabular}{|r|l|}\hline7C0 & hexadecimal \\3700 & octal \\ \














