2

i will be grateful to help to deal with this. i'm trying this table in the figure attached but the text exceeds margins

here is my code:

\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*}

enter image description here

1
  • 1
    remove all the nested tabular which are preventing line breaking so the outer table can not adjust the column widths. Aug 26, 2023 at 16:37

3 Answers 3

2

Here's a tabularx-based solution that works by removing all of the interior tabular-type wrappers. Note that I would also get rid of all vertical rules and user fewer, but well-spaced, horizontal rules.

enter image description here

\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}
1
  • +1! When I compare your an my solution, I see that I overcomplicated width columns width (that cells in the second row would have only two lines). Abd result is less nice than with your design ...
    – Zarko
    Aug 26, 2023 at 21:04
2
  • You should provide an MWE, a complete small document, which we can test at is.
  • Since lack of them we haven't any information about your document ...
  • From code fragment is not entirely clear what you after, I only got impression, that table code is unnecessary complicated, so I just try to reproduce showed image of table with code wroted from scratch:
    • used is tabularray and ragged2e packages
    • text in cells are inserted directly
    • column types are determined regarding to expected contents in their cells
\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}

enter image description here

1

I first used saveboxes to do the tabulars, but the result was way too large for thepage. I used X columns for some of the wider columns, but it still needs more reduction.

\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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .