alex_bn_lee

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

【650】LaTeX表格合并实现

LaTex制作表格之合并单元格

latex 表格如何精细控制行高,行距,行与行之间的距离

Latex 表格 行合并,列合并,控制行间距 单元格宽度

Tables Generator

  在制作LaTex表格的时候,常常需要合并行和列,本文介绍的是使用 multirow 包里面的命令完成合并行列的方法。

  需要先导入以下库:

1
\usepackage{multirow}

  举例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
\begin{table * }
% \usepackage{multirow}
\center
\begin{tabular}{|c|c|c|c|c|}
  \hline  % horizontal line
  \multirow{ 2 }{ * }{ 1 \&  2 } & \multicolumn{ 2 }{l|}{  3 \&  4 } &  5 6 \\  % end line
  \cline{ 2 - 5 % short partial horizontal lines  from column  2 to column  5
   7 8 9 10 \\  % first cell  is occupied by the multirow
  \hline
  \hline
  $ s_{ 1 } $ &  2 3 4 5 \\
  $ s_{ 2 } $ &  2 3 4 5 \\
  \hline
  \hline
  $ s_{ 3 } $ &  2 3 4 5 \\
  $ s_{ 4 } $ &  2 3 4 5 \\
  \hline
\end{tabular}
\end{table * }

  效果 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
\begin{table}[h]
    \caption{Optimization summary.}
    \label{tab:summary}
    \begin{tabular}{cccc}
        \toprule
        \multirow{ 2 }{ * }{Design} & \multicolumn{ 2 }{c}{Problem size} & \multirow{ 2 }{ * }{CPU time(s)} \\
        \cline{ 2 - 3 }
        & Binary variables & Constraints\\
        \midrule
        OM1 &  199 13 , 017 000 \\
        OM2 &  199 1 , 525 000 \\
        \bottomrule
    \end{tabular}
    \label{tab:my_label}
\end{table}

  效果(后面有改进版)

  举例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
\begin{table}[h]
    \caption{Optimization summary.}
    \centering
    \vspace{2mm}
    \begin{tabular}{ccccccccc}
        \toprule
        \multirow{2}{*}{Model Name} & \multicolumn{4}{c}{Building Roof} & \multicolumn{4}{c}{Building}\\
        \cline{2-9}
        & Precision & Recall & $F_1$ & IoU & Precision & Recall & $F_1$ & IoU\\
        \midrule
        FCN-8s \cite{long2015fully}             & 69.83   & 69.83   & 69.83   & 69.83    & 69.83   & 69.83    & 69.83   & 69.83\\
        U-Net \cite{ronneberger2015u}           & 69.83   & 69.83   & 69.83   & 69.83    & 69.83   & 69.83    & 69.83   & 69.83\\
        Res-U-Net \cite{xu2018building}         & 69.83   & 69.83   & 69.83   & 69.83    & 69.83   & 69.83    & 69.83   & 69.83\\
        SegNet \cite{badrinarayanan2017segnet}  & 69.83   & 69.83   & 69.83   & 69.83    & 69.83   & 69.83    & 69.83   & 69.83\\
        DeepLabV3+ \cite{chen2018encoder}       & 69.83   & 69.83   & 69.83   & 69.83    & 69.83   & 69.83    & 69.83   & 69.83\\
        DeConvNet \cite{noh2015learning}        & 69.83   & 69.83   & 69.83   & 69.83    & 69.83   & 69.83    & 69.83   & 69.83\\
        Our Model                               & 69.83   & 69.83   & 69.83   & 69.83    & 69.83   & 69.83    & 69.83   & 69.83\\
        \bottomrule
    \end{tabular}
    \label{tab:my_label}
\end{table}

  效果:

上面表格的问题在于两行标题栏距离太近,通过下面解决,也可以参考网站 https://www.tablesgenerator.com (Booktabs table style)

修改代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
% Please add the following required packages to your document preamble:
% \usepackage{booktabs}
% \usepackage{multirow}
 
\begin{table}[h]
    \caption{Optimization summary.}
    \label{tab:summary}
    \begin{tabular}{cccc}
        \toprule
        \multirow{2}{*}{Design} & \multicolumn{2}{c}{Problem size} & \multirow{2}{*}{CPU time(s)} \\
        \cmidrule{2-3}
        & Binary variables & Constraints\\
        \midrule
        OM1 & 199 & 13,017 & 78.7 \\
        OM2 & 199 & 1,525 & 13.8 \\
        \bottomrule
    \end{tabular}
    \label{tab:my_label}
\end{table}

 效果:(更协调了一些,目前最优

  • toprule:最上面的线(粗)
  • cmidrule:标题中间的线(细)
  • midrule:中间的线(中)
  • bottomrule:最下面的线(粗)

 

 

 

  添加表格注释,参考:Latex如何在表格下方显示注脚_小白皮皮-程序员宅基地_latex 表格下方注释

  导入以下库:

1
\usepackage{threeparttable}

  举例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
\begin{table}[h]
    \centering
    \caption{Quantitative comparison of four conventionally used metrics obtained  from the segmentation results  by FCN-8s, U-Net, Res-U-Net, SegNet, DeepLabV3+, DeConvNet, and the proposed model,  where the values  in bold format are the highest numbers  for corresponding metrics.}
    
    \vspace{2mm}
    \begin{threeparttable} % 增加部分
    \begin{tabular}{ccccccccc}
        \toprule
        \multirow{2}{*}{Model Name} & \multicolumn{4}{c}{Building Roof} & \multicolumn{4}{c}{Building}\\
        \cline{2-9}
        & Precision & Recall & $F_1$ & IoU & Precision & Recall & $F_1$ & IoU\\
        \midrule
        FCN-8s \cite{long2015fully}             & 69.83   & 69.83   & 69.83   & 69.83    & 69.83   & 69.83    & 69.83   & 69.83\\
        U-Net \cite{ronneberger2015u}           & 69.83   & 69.83   & 69.83   & 69.83    & 69.83   & 69.83    & 69.83   & 69.83\\
        Res-U-Net \cite{xu2018building}         & 69.83   & 69.83   & 69.83   & 69.83    & 69.83   & 69.83    & 69.83   & 69.83\\
        SegNet \cite{badrinarayanan2017segnet}  & 69.83   & 69.83   & 69.83   & 69.83    & 69.83   & 69.83    & 69.83   & 69.83\\
        DeepLabV3+ \cite{chen2018encoder}       & 69.83   & 69.83   & 69.83   & 69.83    & 69.83   & 69.83    & 69.83   & 69.83\\
        DeConvNet \cite{noh2015learning}        & 69.83   & 69.83   & 69.83   & 69.83    & 69.83   & 69.83    & 69.83   & 69.83\\
        Our Model                               & 69.83   & 69.83   & 69.83   & 69.83    & 69.83   & 69.83    & 69.83   & 69.83\\
        \bottomrule
    \end{tabular}
    \label{tab:my_label}
    \begin{tablenotes}  %增加部分
        \item The bolded numbers indicate the largest number  in the column, easier to find  out which one performs better  in this format.
     \end{tablenotes}  %增加部分
    \end{threeparttable}  %增加部分
\end{table}

   效果:

 


9-Nov-2023

ref: Tables Generator

\begin{table*}[!t]
%\renewcommand{\arraystretch}{1.3}
\caption{Information on GPS trajectory dataset.}
\centering
\begin{tabular}{c|cccc}
\toprule
% this part is the header
\begin{tabular}[c]{@{}c@{}}Transportation \\mode\end{tabular} &
\begin{tabular}[c]{@{}c@{}}Number of \\residential complexes\end{tabular} &
\begin{tabular}[c]{@{}c@{}}Distance \\(km)\end{tabular} &
\begin{tabular}[c]{@{}c@{}}Duration \\(hour)\end{tabular} &
\begin{tabular}[c]{@{}c@{}}Number of \\trajectories\end{tabular}\\
% this part is the header
\midrule
Walking & 376 & 12,295 & 6,630 & 61,356 \\
Cycling & 932 & 44,512 & 13,516 & 163,200 \\
\midrule
Total & 1,308 & 56,807 & 20,146 & 224,556 \\
\bottomrule
\end{tabular}
\label{

posted on   McDelfino  阅读(7353)  评论(1编辑  收藏  举报

编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2016-08-28 【224】◀▶ IDL NetCDF 文件操作说明
2012-08-28 【080】用海变化自动监测
点击右上角即可分享
微信分享提示