1、LaTex实现三个表格并列排版
刚接触LaTeX排版不久,表格排版一直在摸索中前进,代码中可能还存在冗余或者其他问题,欢迎大家指正我的错误.
代码:
\begin{table*}[!htp]
\floatsetup{floatrowsep=qquad,captionskip=10pt} \tabcolsep=8pt
\begin{floatrow}
\begin{minipage}{0.3\linewidth}
\centering
\renewcommand\arraystretch{1.112}
\ttabbox{\caption{Basic feature}}{%
\begin{tabular}[t]{|c|c|c|c|}
\hline
% \begin{minipage}{1cm}\vspace{1mm} \centering Type\vspace{1mm} \end{minipage}
Type & Kenel & stride & Output
\\
\hline
* & * & * & * \\
* & * & * & * \\
\hline
* & * & * & * \\
* & * & * & * \\
\hline
* & * & * & * \\
* & * & * & * \\
* & * & * & * \\
\hline
* & * & * & * \\
* & * & * & * \\
* & * & * & * \\
\hline
\end{tabular}}
\end{minipage}
\begin{minipage}{0.33\linewidth}
\centering
\renewcommand\arraystretch{1.53}
\floatsetup{floatrowsep=qquad,captionskip=8pt}
\begin{floatrow}
\ttabbox{\caption{Rough Classifier}}{%
\begin{tabular}[t]{|c|c|c|c|}
\hline
Type & Kenel & stride & Output
\\
\hline
* & * & * & * \\
* & * & * & * \\
* & * & * & * \\
\hline
* & * & * & * \\
* & * & * & * \\
\hline
* & * & * & * \\
* & * & * & * \\
\hline
\end{tabular}}
\end{floatrow}
\end{minipage}
\begin{minipage}{0.33\linewidth}
\centering
\renewcommand\arraystretch{2.03}
\ttabbox{\caption{Decolorization Network}}{%
\begin{tabular}[t]{|c|c|c|c|}
\hline
Type & Kenel & stride & Output
\\
\hline
* & * & * & * \\
\hline
* & * & * & * \\
\hline
* & * & * & * \\
\hline
* & * & * & * \\
\hline
* & * & * & * \\
\hline
\end{tabular}}
\end{minipage}
\end{floatrow}
\end{table*}
效果如下:
说明:
\begin{table*}[!htp]
*代表表格要占整个版面
\floatsetup{floatrowsep=qquad,captionskip=10pt} \tabcolsep=8pt
\begin{floatrow}
设置浮动格式,captionskip:表头与表格间距 tabcolsep:整体表格列的宽度
\begin{minipage}{0.3\linewidth}
设置第一个表格,使用minipage格式,{ }内为表格宽度设置
\centering
居中
\renewcommand\arraystretch{1.112}
第一个表格中每个单元格的高度设置(需要根据三个表格的整体高度和每个表格的行数计算每行的高度)
\ttabbox{\caption{Basic feature}}{%
第一个表格的表头
\begin{tabular}[t]{|c|c|c|c|}
第一个表格表格体
\hline
显示横线
此条注释掉了,这条语句的作用是单独设置每行的高度
Type & Kenel & stride & Output \\
第一行的内容,后面的语句作用都同此条
\hline
* & * & * & * \\
* & * & * & * \\
\hline
* & * & * & * \\
* & * & * & * \\
\hline
* & * & * & * \\
* & * & * & * \\
* & * & * & * \\
\hline
* & * & * & * \\
* & * & * & * \\
* & * & * & * \\
\hline
\end{tabular}}
\end{minipage}
第一个表格的设置完成
第二三个表格的设置同上
\end{floatrow}
\end{table*} \begin{table*}[!htp]*代表表格要占整个版面\floatsetup{floatrowsep=qquad,captionskip=10pt} \tabcolsep=8pt \begin{floatrow}设置浮动格式,captionskip:表头与表格间距 tabcolsep:整体表格列的宽度\begin{minipage}{0.3\linewidth}设置第一个表格,使用minipage格式,{ }内为表格宽度设置\centering居中\renewcommand\arraystretch{1.112}第一个表格中每个单元格的高度设置(需要根据三个表格的整体高度和每个表格的行数计算每行的高度)\ttabbox{\caption{Basic feature}}{%第一个表格的表头\begin{tabular}[t]{|c|c|c|c|}第一个表格表格体\hline显示横线此条注释掉了,这条语句的作用是单独设置每行的高度 Type & Kenel & stride & Output \\第一行的内容,后面的语句作用都同此条 \hline * & * & * & * \\ * & * & * & * \\ \hline * & * & * & * \\ * & * & * & * \\\hline * & * & * & * \\ * & * & * & * \\ * & * & * & * \\\hline * & * & * & * \\ * & * & * & * \\ * & * & * & * \\\hline\end{tabular}}\end{minipage}第一个表格的设置完成第二三个表格的设置同上\end{floatrow}\end{table*}
*代表表格要占整个版面
\floatsetup{floatrowsep=qquad,captionskip=10pt} \tabcolsep=8pt
\begin{floatrow}
设置浮动格式,captionskip:表头与表格间距 tabcolsep:整体表格列的宽度
\begin{minipage}{0.3\linewidth}
设置第一个表格,使用minipage格式,{ }内为表格宽度设置
\centering
居中
\renewcommand\arraystretch{1.112}
第一个表格中每个单元格的高度设置(需要根据三个表格的整体高度和每个表格的行数计算每行的高度)
\ttabbox{\caption{Basic feature}}{%
第一个表格的表头
\begin{tabular}[t]{|c|c|c|c|}
第一个表格表格体
\hline
显示横线
此条注释掉了,这条语句的作用是单独设置每行的高度
Type & Kenel & stride & Output \\
第一行的内容,后面的语句作用都同此条
\hline
* & * & * & * \\
* & * & * & * \\
\hline
* & * & * & * \\
* & * & * & * \\
\hline
* & * & * & * \\
* & * & * & * \\
* & * & * & * \\
\hline
* & * & * & * \\
* & * & * & * \\
* & * & * & * \\
\hline
\end{tabular}}
\end{minipage}
第一个表格的设置完成
第二三个表格的设置同上
\end{floatrow}
\end{table*} \begin{table*}[!htp]*代表表格要占整个版面\floatsetup{floatrowsep=qquad,captionskip=10pt} \tabcolsep=8pt \begin{floatrow}设置浮动格式,captionskip:表头与表格间距 tabcolsep:整体表格列的宽度\begin{minipage}{0.3\linewidth}设置第一个表格,使用minipage格式,{ }内为表格宽度设置\centering居中\renewcommand\arraystretch{1.112}第一个表格中每个单元格的高度设置(需要根据三个表格的整体高度和每个表格的行数计算每行的高度)\ttabbox{\caption{Basic feature}}{%第一个表格的表头\begin{tabular}[t]{|c|c|c|c|}第一个表格表格体\hline显示横线此条注释掉了,这条语句的作用是单独设置每行的高度 Type & Kenel & stride & Output \\第一行的内容,后面的语句作用都同此条 \hline * & * & * & * \\ * & * & * & * \\ \hline * & * & * & * \\ * & * & * & * \\\hline * & * & * & * \\ * & * & * & * \\ * & * & * & * \\\hline * & * & * & * \\ * & * & * & * \\ * & * & * & * \\\hline\end{tabular}}\end{minipage}第一个表格的设置完成第二三个表格的设置同上\end{floatrow}\end{table*}
scalebox{0.9}{} 设置表格的大小,但是不能实现很好
2、设置整个表格的宽度
使用\setlength{\tabcolsep}{ XXXX mm}设置整个表格的宽度:
\begin{table}[!htbp]
\caption{Complex Illumination Between Images}
\begin{center}
\setlength{\tabcolsep}{4mm}{
\begin{tabular}{|c|c|c|}
\hline
* & * & *\\
\hline
* & * & *\\
\hline
* & * & *\\
\hline
* & * & *\\
\hline
* & * & *\\
\hline
\end{tabular}
\label{tab1}}
\end{center}
\end{table}
3、LaTex表格单元格内容自动换行
表格单元格自动换行需要在\begin{tabular}{|p{30pt}|p{30pt}|p{30pt}|p{30pt}|p{30pt}, p{30pt}表示当内容超过30pt时会自动换行。
\begin{table}[!htbp]
\caption{Comparion of Rmse}
\begin{center}
\begin{tabular}{|p{30pt}|p{30pt}|p{30pt}|p{30pt}|p{30pt}|}
\hline
Image & Pouli et al. \cite{b3}(50\%) & Pouli et al. \cite{b3}(100\%) &Piti\'{e} et al. \cite{b10} & Our results\\
\hline
\includegraphics[width=0.5in]{images/13} & 11.7705 & 12.9743 & 12.9317 & 10.4320\\
\hline
\includegraphics[width=0.5in]{images/14} & 11.7705 & 12.9743 & 12.9317 & 10.4320\\
\hline
\includegraphics[width=0.5in]{images/15} & 11.7705 & 12.9743 & 12.9317 & 10.4320\\
\hline
\end{tabular}
\label{tab1}
\end{center}
\end{table}