赞
踩
Latex表格需要两个环境:
如果是一整行,则为table后面加*号,如下:
\begin{table*}[htb]
%%%
\end{table*}
一个简单的例子:
\begin{table}[htb]
\begin{center}
\caption{Beecy.}
\label{table:1}
\begin{tabular}{|c|c|c|}
\hline \textbf{Algorithms} & \textbf{Complexity} & \textbf{Overhead} \\
\hline algorithm 1 & high & low \\
\hline algorithm 2 & high & low \\
\hline
\end{tabular}
\end{center}
\end{table}
具体取值如下表:在\begin{table}[htb]
\begin{tabular}{|c|c|c|} 这里的c是用来约定表格的每列属性的,如下表:
其他符号说明:
改变列宽
%原始表达:
\begin{tabular}{|c|c|c|}
% 固定列宽:
\begin{tabular}{|m{2.8cm}<{\centering}|m{2.6cm}<{\centering}|m{2.2cm}<{\centering}|}
\documentclass{article} \begin{document} \begin{table}[h!] \begin{center} \caption{Your first table.} \begin{tabular}{l|c|r} % <-- Alignments: 1st column left, 2nd middle and 3rd right, with vertical lines in between \textbf{Value 1} & \textbf{Value 2} & \textbf{Value 3}\\ $\alpha$ & $\beta$ & $\gamma$ \\ \hline 1 & 1110.1 & a\\ 2 & 10.1 & b\\ 3 & 23.113231 & c\\ \end{tabular} \end{center} \end{table} \end{document}
这里需要引用到对应包的 multirow 和 multicolum
\usepackage{multirow} % Required for multirows
\usepackage{multicolum} % Required for multicolum
两个的使用格式分别是:
\multirow{NUMBER_OF_ROWS}{WIDTH}{CONTENT}
\multicolumn{NUMBER_OF_COLUMNS}{ALIGNMENT}{CONTENT}
\begin{table}[h!] \begin{center} \caption{Multirow table.} \label{tab:table1} \begin{tabular}{l|S|r} \textbf{Value 1} & \textbf{Value 2} & \textbf{Value 3}\\ $\alpha$ & $\beta$ & $\gamma$ \\ \hline \multirow{2}{*}{12} & 1110.1 & a\\ % <-- Combining 2 rows with arbitrary with (*) and content 12 & 10.1 & b\\ % <-- Content of first column omitted. \hline 3 & 23.113231 & c\\ 4 & 25.113231 & d\\ \end{tabular} \end{center} \end{table}
\begin{table}[h!] \begin{center} \caption{Multicolumn table.} \label{tab:table1} \begin{tabular}{l|S|r} \textbf{Value 1} & \textbf{Value 2} & \textbf{Value 3}\\ $\alpha$ & $\beta$ & $\gamma$ \\ \hline \multicolumn{2}{c|}{12} & a\\ % <-- Combining two cells with alignment c| and content 12. \hline 2 & 10.1 & b\\ 3 & 23.113231 & c\\ 4 & 25.113231 & d\\ \end{tabular} \end{center} \end{table}
\begin{table}[h!] \begin{center} \caption{Multirow and -column table.} \label{tab:table1} \begin{tabular}{l|S|r} \textbf{Value 1} & \textbf{Value 2} & \textbf{Value 3}\\ $\alpha$ & $\beta$ & $\gamma$ \\ \hline \multicolumn{2}{c|}{\multirow{2}{*}{1234}} & a\\ % <-- Multicolumn spanning 2 columns, content multirow spanning two rows \multicolumn{2}{c|}{} & b\\ % <-- Multicolumn spanning 2 columns with empty content as placeholder \hline 3 & 23.113231 & c\\ 4 & 25.113231 & d\\ \end{tabular} \end{center} \end{table}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。