关于绘制带有适合单元格的文本的多列表格

关于绘制带有适合单元格的文本的多列表格

我将非常感激能够帮助解决这个问题。我正在尝试附图中的这个表格,但文本超出了边距

这是我的代码:

\begin{table*}
\setlength\tabcolsep{3pt}
\begin{tabularx}{\textwidth}{| *{7}{l|} X | X | l |}
\hline

Paper & 
Contribution & 
Game Model & 
\multicolumn{3}{c|}{VFC aspects} & 
Advantages & 
Drawbacks \\ 
\cline{4-6}
 &  &  & 
\begin{tabular}[c]{@{}c@{}}Game\\ Model\end{tabular} & 
\begin{tabular}[c]{@{}c@{}}Computation\\ Offloading\end{tabular} & 
Security& 
& \\ 
\hline


                        
\cite{137}  &   \begin{tabular}[c]{@{}c@{}}Likely focuses on reputation\\ management for security \\ and efficiency in VEC \end{tabular} & Bargaining game                                                 &  \ding{55}   &  \ding{55} & \ding{51}                                                  &             \begin{tabular}[c]{@{}c@{}} Enhances trust and collaboration among \\vehicular network participants \end{tabular}                &      \begin{tabular}[c]{@{}c@{}} Lack of an incentive mechanism to \\mitigate selfish behavior of VF nodes \end{tabular}                      \\ \hline

                        
\end{tabularx}
\caption{Summary of game theoretic-based approaches in VFC}
\label{tab:game-theory-in-VFC}
\end{table*}

在此处输入图片描述

答案1

这是一个tabularx基于 的解决方案,通过删除所有内部tabular类型的包装器来实现。请注意,我还将删除所有垂直规则和用户较少但间距适当的水平规则。

在此处输入图片描述

\documentclass[twocolumn]{article}
\usepackage[letterpaper,margin=1in]{geometry} % set page size parameters suitably
\usepackage{tabularx,ragged2e,booktabs,pifont}
\newcolumntype{L}{>{\RaggedRight\hsize=1.1\hsize}X}
\newcolumntype{C}{>{\Centering\hspace{0pt}\hsize=0.8\hsize}X}
\usepackage[english]{babel}

\begin{document}

\begin{table*}
\setlength\tabcolsep{3pt} % default: 6pt
\begin{tabularx}{\textwidth}{@{} l LL CCc LL @{}}
\toprule
Paper & Contribution & Game Model & 
\multicolumn{3}{c}{VFC aspects} & 
Advantages & Drawbacks \\ 
\cmidrule{4-6}
& & & Game Model & Computation Off\kern0.2pt loading & Security \\ 
\midrule                
\cite{137} & Likely focuses on reputation management for security and efficiency in VEC & Bargaining game                                                 & \ding{55} & \ding{55} & \ding{51}                                                  & Enhances trust and collaboration among vehicular network participants & Lack of an incentive mechanism to mitigate selfish behavior of VF nodes  \\ 
\addlinespace
\cite{138} & \dots & \dots 
& \ding{55} & \ding{55} & \ding{55} 
& \dots & \dots \\                                               
\bottomrule
         
\end{tabularx}

\caption{Summary of game theoretic-based approaches in VFC}
\label{tab:game-theory-in-VFC}
\end{table*}

\end{document}

答案2

  • 您应该提供一个 MWE,即一个完整的小文档,以便我们可以对其进行测试。
  • 由于缺少它们,我们没有关于您的文件的任何信息......
  • 从代码片段中不能完全清楚你想要什么,我只得到的印象是,表格代码没有必要那么复杂,所以我只是尝试用从头开始写的代码来重现显示的表格图像:
    • 使用的是tabularrayragged2e
    • 单元格中的文本直接插入
    • 列类型根据其单元格中的预期内容确定
\documentclass[twocolumn]{article}
\usepackage{ragged2e}
\usepackage{tabularray}
\usepackage{pifont}


\begin{document}
\begin{table*}
\begin{tblr}{hlines, vlines,
             cells  = {font=\small},
             colspec = {Q[l,h]  X[2.1,h, cmd=\RaggedRight] 
                        X[1.2, c] 
                        *{3}{Q[c,m]}
                        *{2}{X[2,h, cmd=\RaggedRight]}},
             colsep = 3pt,
             cell{1}{1,2,3,7,8} = {r=2}{m}
             }
Paper
    &   Contribution 
        &   {Game\\ Model} 
            &   \SetCell[c=3]{}    VFC aspects 
                &   &   &   Advantages
                            &   Drawbacks   \\
    &   &   &   {Game\\ Model}
                & {Computation\\ Offloading}
                    &   Security
                        &   &               \\
%
\cite{137}  
    & Likely focuses on reputation management for security and efficiency in VEC 
        & Bargaining game
            &  \ding{55}   
                &  \ding{55} 
                    & \ding{51}                                                  
                        &   Enhances trust and collaboration among 
                            vehicular network participants
                            &   Lack of an incentive mechanism to mitigate 
                                selfish behavior of VF nodes        \\
\end{tblr}
\caption{Summary of game theoretic-based approaches in VFC}
\label{tab:game-theory-in-VFC}
\end{table*}
\end{document}

在此处输入图片描述

答案3

我首先使用保存框来制作表格,但结果对于页面来说太大了。我为一些较宽的列使用了 X 列,但仍然需要进一步缩减。

\documentclass{article}
\usepackage{tabularx}
\usepackage{pifont}% for \ding

\begin{document}
\begin{table*}
\setlength\tabcolsep{3pt}
\sbox0{\begin{tabular}[c]{@{}c@{}}Game\\ Model\end{tabular}}%
\sbox1{\begin{tabular}[c]{@{}c@{}}Computation\\ Offloading\end{tabular}}%
\sbox2{\begin{tabular}[c]{@{}c@{}}Likely focuses on reputation\\ management for security \\ and efficiency in VEC \end{tabular}}%

\begin{tabularx}{\textwidth}{|l|l|X|l|l|l| X | X |}
\hline
Paper & 
Contribution & 
Game Model & 
\multicolumn{3}{c|}{VFC aspects} & 
Advantages & 
Drawbacks \\ 
\cline{4-6}
 &  &  & \usebox0 & \usebox1 & 
Security& 
& \\ \hline
\cite{137}  &   \usebox3 & Bargaining game  &  \ding{55}   &  \ding{55} & \ding{51}
            & Enhances trust and collaboration among vehicular network participants
            & Lack of an incentive mechanism to mitigate selfish behavior of VF nodes   
\\ \hline
\end{tabularx}
\caption{Summary of game theoretic-based approaches in VFC}
\label{tab:game-theory-in-VFC}
\end{table*}
\end{document}

相关内容