乳胶中多列和多行表的困难

乳胶中多列和多行表的困难

在此处输入图片描述

有人能帮我画一下这个表格吗?我试过使用多行和多列,但还是无法画出表格,我使用的代码已附上

\begin{table*}[h!]
\centering
\caption{Research Summary}
\label{table:summary}
\addtolength{\tabcolsep}{3pt}
\begin{tabularx}{\textwidth}{c c c c c c c c c} 
\hline
Approach & Research Paper & Method &\multicolumn{3}{c}{Main} &\multirow{2}{*}{Total}\\
\cline{2-4}
& 1 &2 &3 &\\
\hline
\multirow{3}{4em}{Multiple row} & cell2 & cell3  \\ 
& cell5 & cell6 \\ 
& cell8 & cell9 & cell8 & cell9 & cell8 & cell9 \\ 
\hline
\end{tabularx}
\end{table*}

答案1

抱歉,你的问题我不太清楚。你喜欢重现显示的表格吗?你的 MWE 还不够接近它...

我尝试重现所显示的表格。

编辑:

添加了由dingbat包定义的彩色复选标记,并且单元格内容multirow移动到垂直中心(通过使用正确数量的跨度线)<。

\documentclass[twocolumn]{article}
\usepackage{xcolor}
\usepackage{dingbat}
\newcommand\gcm{\textcolor{teal}{\checkmark}}% GreenCheckMark
\usepackage{booktabs, makecell, multirow, tabularx}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\newlength{\colwidth}
\usepackage[skip=1ex]{caption}
\usepackage{lipsum}

\begin{document}
    \begin{table*}[ht]
\caption{Research Summary}
\label{table:summary}
\renewcommand{\cellset}{\small\linespread{0.84}\selectfont}    \settowidth{\colwidth}{ Geo-Distributed }
\begin{tabularx}{\textwidth}{@{} >{\raggedright}p{\colwidth}
                                 >{\raggedright}p{0.6\colwidth}
                                 L ccc ccc @{}}
    \toprule
\multirow{2.8}{*}{Approach}
    &   \multirow{2.8}{*}{\makecell{Research\\ Paper}}
        &   \multirow{2.8}{*}{Method}
            &   \multicolumn{3}{c}{Power Supply}
                &   \multicolumn{3}{c}{Optimization Objectives}
                    \\
    \cmidrule(r){4-6}
    \cmidrule(l){7-9}
    &         &         & Wind & Solar & \makecell{Energy\\ storage}
                        & Cost & \makecell{RES\\ Utilization}
                                       & Latency                    \\
    \midrule
\multirow{3}{=}{Geo-Distributed, Geo Balancing}
    & cell 2 & Forecasting and Prediction
                        & \checkmark   & \checkmark & \checkmark
                        & \checkmark   & \checkmark & \checkmark    \\
    & cell 2 & Mathematical Optimization with Forecasting
                        & \checkmark   & \checkmark & \checkmark
                        & \checkmark   & \checkmark & \checkmark    \\
    & Proposed algotithm
             & Machine learning Algorithm
                        & \checkmark   & \checkmark & \checkmark
                        & \checkmark   & \checkmark & \checkmark    \\
    \bottomrule%    \midrule
\end{tabularx}
    \end{table*}
\end{document}

在此处输入图片描述

答案2

使用该包,您可以获得既可用作和的命令nicematrix,同时还允许使用内部。\Blockmulticolumnmultirow\\

因此代码更紧凑并且是构建表所需的唯一包。

例如,\Block{6-1}{Geo--Distributed \\ Load Balancing}创建一个单元格,宽一列,高六行,里面有两行,文本居中。

桌子横向放置非常合适。(带包装pdflscape

结果与示例非常接近(请检查检查!)。请注意,在原始表格中,第三行第二列单元格未正确对齐。

瓦

这是代码。

\documentclass{article}

\usepackage{booktabs} % horizontal lines

\usepackage{nicematrix} % the table with NiceTabular

\usepackage{pdflscape} % landscape

\usepackage{amssymb} % checkmark
\usepackage{pdfrender}% bold checkmark
\newcommand*{\ck}{% https://tex.stackexchange.com/questions/383324/bold-checkmark
    \textpdfrender{
        TextRenderingMode=FillStroke,
        LineWidth=1pt, 
    }{\Large\color{green!80!black}\checkmark}%
}
    
\begin{document}

\begin{landscape}
\thispagestyle{empty}   
\begin{table}[htb!]
    \centering
    \caption{Research Summary}
    \medskip
    \label{tab:reseach} 
\begin{NiceTabular}{@{}ccc ccc ccc@{}}[cell-space-limits = 4pt] % expand the cells vertically
\toprule
\Block{2-1}{Approach} & \Block{2-1}{Research Paper} & \Block{2-1}{Method} & \Block{1-3}{Power Supply} & & &\Block{1-3}{Optimization Objetives} \\ 
\cmidrule(lr){4-6} \cmidrule(lr){7-9}   
        & & & Wind & Solar  & \Block{}{Energy \\ Storage}   & Cost          & \Block{}{RES \\ Utilization} & Latency \\ 
\midrule
\Block{3-1}{Power \\ Managment}     & Kwon [8]      & Mathematical Optimizations                                                &\ck &    &\ck &\ck &\ck &\ck \\
                                    & I-Swithc [8]  & Online Control Algorithm                                                  &    &    &\ck &\ck &\ck &\ck \\
                                    & Eco-Power [31]& Online Control Algorithm                                                  &\ck &\ck &\ck &\ck &\ck &    \\ 
                                    \midrule
\Block{3-1}{Task Scheduling}        & Greenslot [12]& Online Control Algorithm with Forecasting                                 &\ck &    &    &    &\ck &\ck \\
                                    & Lei [14]      & Mathematical Optimization                                                 &\ck &    &    &    &\ck &\ck \\
                                    & Qi [17]       & Online Control Algorithm                                                  &    &    &    &\ck &    &\ck \\ 
                                    \midrule
\Block{6-1}{Geo--Distributed \\ Load Balancing} & Buyya [11]                        & Forecasting ans Prediction                &\ck &\ck &    &    &    &    \\
                                                & Aksanli [13]                      & Mathematical Optimization with Forecasting&\ck &\ck &    &\ck &\ck &\ck \\
                                                & Toosi [18]                        & Machine Learning Algorithm                &\ck &\ck &    &\ck &\ck &    \\
                                                & Xu [20]                           & Machine Learning Algorithm                &\ck &\ck &    &\ck &    &    \\
                                                & Zhou [19]                         & Machine Learning Algorithm                &    &    &    &\ck &    &\ck \\
                                                & \Block{}{Proposed \\ Algorithm}   & Machine Learning Algorithm                &\ck &\ck &    &\ck &\ck &\ck \\
\bottomrule  
\end{NiceTabular}

\end{table}     
\end{landscape}

\end{document}

第一次将会编译两次。

答案3

我建议使用booktabs

\documentclass{article}

\usepackage{booktabs}
\usepackage{multirow}

\begin{document}
    \begin{table}[htb!]
        \centering
        \caption{Research Summary}
        \label{table:summary}
        \begin{tabular}{@{}ccccccccc@{}}
            \toprule
            \multirow{2}{*}{Approach} & \multirow{2}{*}{Research Paper} & \multirow{2}{*}{Method} & \multicolumn{3}{c}{Main} & \multicolumn{3}{c}{Total} \\ \cmidrule(lr){4-6} \cmidrule(lr){7-9}
            & & & Wind & Solar & ES & Cost & RES U & Latency \\ \midrule
            & & & & & & & & \\
            & & & & & & & & \\
            & & & & & & & & \\ \midrule
            & & & & & & & & \\
            & & & & & & & & \\
            & & & & & & & & \\ \midrule
            & & & & & & & & \\
            & & & & & & & & \\
            & & & & & & & & \\
            & & & & & & & & \\
            & & & & & & & & \\
            & & & & & & & & \\ \midrule
            \multicolumn{9}{l}{ES ... Energy Storage, RES U ... RES Utilization} \\ \bottomrule
        \end{tabular}
    \end{table}
\end{document}

在此处输入图片描述

相关内容