0

There are plenty of questions here which covers this problem, out of which none solves my problem. I don’t know why even going thorough many websites, documentations.

I am working on this table in one of my papers and can’t seem to make it the way it should be. The text should be above and below the table, not in between the table. The table should have supposed to be along 1-column (whole page) without affecting the rest of the text. It doesn’t even work with table* environment.

img

MWE:

\documentclass[conference]{IEEEtran}
\usepackage{longtable}
\usepackage[margin=1in]{geometry} 
\usepackage{graphicx}
\usepackage[shortlabels]{enumitem}
\usepackage{tabularx}
\usepackage{array}
\usepackage{lipsum}

\begin{document} \small \setlength\LTleft{0pt} \setlength\LTright{0pt}

\lipsum[1]

\begin{table}[h!] \centering \caption{Comparison of some unique works in IoT Transportation} \begin{tabularx}{\textwidth}{p{2cm}p{1cm}p{3cm}p{1cm}p{3cm}p{4cm}}

\hline
\textbf{Author} 
& \textbf{Year } 
& \textbf{Mainly focusing problem/area} 
& \textbf{Layers} 
& \textbf{Main points} 
& \textbf{Shortcomings} \\

\hline
Al-Ali [21] 
&2021   
&Architecture for ‘short-range’ travel  
&4
&Designing and linking with Software application    
&Subject-specific \\

\hline
Minal Patel [26]    
&2021   
&Dashboard for Smart Cities 
&4
&Focusing on data flow and control   
& N/A \\

\hline
Sruthy Anand [24]   
&2021   
&Generalized structure  
&4  
&N/A
&Requires to be redesigned according to necessity  \\

\hline
BP Raj [20] 
&2020   
&Everyday traffic   
&3  
&Route optimization to reduce pollution 
&Not practically scalable \\

\hline
Muhmmad Derawi [28] 
&2020   
&Focuses on V2I communications      
&N/A
&Integration based on COMLIGHT, IQRF \& Telenor 
&Prone to situations enabling more accidents \\

\hline
Nagarjuna G R [22]  
&2020   
&Designed specifically for fire brigades \& ambulances      
& 6
&Practically hardware demonstrated  
&Applicable to rather simple traffic junctions \\ 

\hline
Yi-Yun Chu [23] 
&2020   
&Smart parking      
&N/A
&Different hardware for different parking applications  
&Not practically implemented \\

\hline 
Jin-ho Park [27]    
&2019   
&Scalability and flexibility in cognitive computing in smart city applications  
&5  
&DL incorporated to facilitate “unstructured” data  
&Unsecured sensor nodes \\

\hline
Umar Ali [19]   
&2019   
&Enhanced control and flow of data  
&4
&N/A
&Not very much flexible \\ 

\hline
Hamed Rahimi [25]   
&2018   
&Incorporating 11 technologies to solve multiple problems   
&8  
&Num of layers selected according to technologies   
&Too complex to practically implement and manage\\

\hline
Nallapaneni [1] 
&2017   
&Survey on use of IoTs in Transportation        
& N/A
&Monitoring vehicles using sensor nodes 
&  N/A \\

\hline
S. H. Sutar [3]
&2016   
&Dynamic route assignment to buses      
& N/A
&Management of fuel consumption 
&  N/A \\

\hline
D. Kyriazis [2]
&2013   
&Using Street lights as IoTs    
&3  
&Energy conservation    
&Theoretical level implementation required \\
\hline

\end{tabularx} \end{table}

\lipsum[1] \lipsum[1] \lipsum[1] \lipsum[1] \end{document}

I am looking for a format something like i.e. spread across whole page without disrupting the text:

enter image description here

Also, can somebody also recommend some changes in the table that would make the table look better than the current one? I’ve also been trying to change it, but couldn’t get somewhere. For instance, shrinking the ‘Year’ column (to make it compact and readable), aligning the text horizontally and vertically in every cell, just like Word does; or any other change.

Thanks.

afaq
  • 347
  • 1
    With the code you provided so far, I can't confirm your statement "doesn’t [...]work with table* environment.". What's wrong with the output when you use table* instead of table? – leandriis Mar 13 '22 at 17:06
  • 1
    Unrelated to the issue but why do you use a tabularx environment without any X type column? tabularx can only work properly if there is at least one X type column. – leandriis Mar 13 '22 at 17:08
  • @leandriis 1) using table* sends the whole table to the next page, which i dont need 2) using X adds extra white space in each column to spread it across which kind of turns out awkward. – afaq Mar 13 '22 at 17:14
  • 1
    Your table is wider than the column width. So, the table overlaps with the text of the 2nd column. If you want a table that spans both columns, use the table* environment. Also for " using table* sends the whole table to the next page", try moving the table up in the code after finishing the whole document. – Imran Mar 13 '22 at 17:23
  • @Imran i've mentioned twice. using table* doesn't do the job. table goes on next page irrespective of placement in the code. it appears that something is not working the way it should – afaq Mar 13 '22 at 17:39
  • 1
    I didn't notice that you want the table to be on the first page. Note that double-column tables don't appear on the page they are defined. So, if you use a floating environment, you won't get a double-column table on the very first page. – Imran Mar 13 '22 at 17:58

2 Answers2

2

To make the table look better, you may remove most of the horizontal lines. You may also widen the separation between rows using the arraystrech command. In the following example, I have used the tabularray package which by default inserts more gap around rows. This package also has many other benefits.

\documentclass[conference]{IEEEtran}
\usepackage[margin=1in]{geometry} 
\usepackage{lipsum}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}

\begin{document} \small

\lipsum[1]

\begin{table*} \centering \caption{Comparison of some unique works in IoT Transportation} \begin{tblr}{ width = {\textwidth}, colspec = {@{}X[l, 0.5]cX[l]cX[l]X[0.75,l]@{}}, rows = {m}, % centers all of the rows vertically row{1} = {c,font=\bfseries} %centers the 1st row horizontally and makes the font bold } \toprule Author & Year & Mainly focusing problem/area & Layers & Main points & Shortcomings \ \midrule

Al-Ali [21] 
&2021   
&Architecture for ‘short-range’ travel  
&4
&Designing and linking with Software application    
&Subject-specific \\

Minal Patel [26]    
&2021   
&Dashboard for Smart Cities 
&4
&Focusing on data flow and control   
& N/A \\

Sruthy Anand [24]   
&2021   
&Generalized structure  
&4  
&N/A
&Requires to be redesigned according to necessity  \\

BP Raj [20] 
&2020   
&Everyday traffic   
&3  
&Route optimization to reduce pollution 
&Not practically scalable \\

Muhmmad Derawi [28] 
&2020   
&Focuses on V2I communications      
&N/A
&Integration based on COMLIGHT, IQRF \& Telenor 
&Prone to situations enabling more accidents \\

Nagarjuna G R [22]  
&2020   
&Designed specifically for fire brigades \& ambulances      
& 6
&Practically hardware demonstrated  
&Applicable to rather simple traffic junctions \\ 

Yi-Yun Chu [23] 
&2020   
&Smart parking      
&N/A
&Different hardware for different parking applications  
&Not practically implemented \\

Jin-ho Park [27]    
&2019   
&Scalability and flexibility in cognitive computing in smart city applications  
&5  
&DL incorporated to facilitate “unstructured” data  
&Unsecured sensor nodes \\

Umar Ali [19]   
&2019   
&Enhanced control and flow of data  
&4
&N/A
&Not very much flexible \\ 

Hamed Rahimi [25]   
&2018   
&Incorporating 11 technologies to solve multiple problems   
&8  
&Num of layers selected according to technologies   
&Too complex to practically implement and manage\\

Nallapaneni [1] 
&2017   
&Survey on use of IoTs in Transportation
& N/A
&Monitoring vehicles using sensor nodes 
&  N/A \\

S. H. Sutar [3]
&2016   
&Dynamic route assignment to buses      
& N/A
&Management of fuel consumption 
&  N/A \\

D. Kyriazis [2]
&2013   
&Using Street lights as IoTs    
&3  
&Energy conservation    
&Theoretical level implementation required \\
\bottomrule
\end{tblr}

\end{table*}

\lipsum[1-5] \end{document}

enter image description here

I have also changed the column types a bit.

Now if you really want to place a double-column table on the first page, you may remove the floating (table) environment and use the talltblr environment (possible to insert a caption using this environment) with the strip environment from the cuted package (courtesy of this answer) (though I am not sure if IEEE prefers placing a double-column table on the first page).

\documentclass[conference]{IEEEtran}
\usepackage[margin=1in]{geometry} 
\usepackage{lipsum}
\usepackage{cuted}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}

\begin{document} \small

\lipsum[1]

% \begin{table*} % \centering % \caption{Comparison of some unique works in IoT Transportation} \begin{strip} \centering \begin{talltblr}[ caption = {Comparison of some unique works in IoT Transportation} ]{ width = {\textwidth}, colspec = {@{}X[l, 0.5]cX[l]cX[l]X[0.75,l]@{}}, rows = {m}, row{1} = {c,font=\bfseries} } \toprule Author & Year & Mainly focusing problem/area & Layers & Main points & Shortcomings \ \midrule

Al-Ali [21] 
&2021   
&Architecture for ‘short-range’ travel  
&4
&Designing and linking with Software application    
&Subject-specific \\

Minal Patel [26]    
&2021   
&Dashboard for Smart Cities 
&4
&Focusing on data flow and control   
& N/A \\

Sruthy Anand [24]   
&2021   
&Generalized structure  
&4  
&N/A
&Requires to be redesigned according to necessity  \\

BP Raj [20] 
&2020   
&Everyday traffic   
&3  
&Route optimization to reduce pollution 
&Not practically scalable \\

Muhmmad Derawi [28] 
&2020   
&Focuses on V2I communications      
&N/A
&Integration based on COMLIGHT, IQRF \& Telenor 
&Prone to situations enabling more accidents \\

Nagarjuna G R [22]  
&2020   
&Designed specifically for fire brigades \& ambulances      
& 6
&Practically hardware demonstrated  
&Applicable to rather simple traffic junctions \\ 

Yi-Yun Chu [23] 
&2020   
&Smart parking      
&N/A
&Different hardware for different parking applications  
&Not practically implemented \\

Jin-ho Park [27]    
&2019   
&Scalability and flexibility in cognitive computing in smart city applications  
&5  
&DL incorporated to facilitate “unstructured” data  
&Unsecured sensor nodes \\

Umar Ali [19]   
&2019   
&Enhanced control and flow of data  
&4
&N/A
&Not very much flexible \\ 

Hamed Rahimi [25]   
&2018   
&Incorporating 11 technologies to solve multiple problems   
&8  
&Num of layers selected according to technologies   
&Too complex to practically implement and manage\\

Nallapaneni [1] 
&2017   
&Survey on use of IoTs in Transportation
& N/A
&Monitoring vehicles using sensor nodes 
&  N/A \\

S. H. Sutar [3]
&2016   
&Dynamic route assignment to buses      
& N/A
&Management of fuel consumption 
&  N/A \\

D. Kyriazis [2]
&2013   
&Using Street lights as IoTs    
&3  
&Energy conservation    
&Theoretical level implementation required \\
\bottomrule
\end{talltblr}

\end{strip}

\lipsum[1-4] \end{document}

enter image description here

Note how the strip environment changes the placement of text before the table. So, this solution might not be acceptable in the case of a submission to a conference.

Imran
  • 3,096
  • table is sure better than before. i was missing cuted the whole time as i wasn't aware of it. one thing, how does X[l,0.75 ] , X[l,1] work? l is left-justify, 0.75 and 1 are the widths. am i right? – afaq Mar 15 '22 at 08:38
  • @afaq Yes, 0.75 and 1 are for determining the width of the cell, but not absolute width rather relative width. – Imran Mar 15 '22 at 10:58
  • relative with respect to? – afaq Mar 15 '22 at 16:13
  • 1
    Usually the width of all X columns in a tabular environment are same. It can be changed by inserting this optional coefficient. So, in this table the width of the 1st X column will be half of the standard X column width and the width of the last X column will be 75% of standard X column width. – Imran Mar 16 '22 at 07:25
1

Use the package cuted to insert material (like your tabularx, without any changes) two-columns wide.

Since obviously floats can not be supported you must use \captionof to insert the caption instead of \caption.

a

\documentclass[conference]{IEEEtran}
\usepackage{longtable}
\usepackage[margin=1in]{geometry} 
\usepackage{graphicx}
\usepackage[shortlabels]{enumitem}
\usepackage{tabularx}
\usepackage{array}
\usepackage{lipsum}

\usepackage{cuted} % added (strip) <<<<<<<<<<<<<< \usepackage{caption} % added (captionof) <<<<<<<<<<<<<<

\begin{document} \small \setlength\LTleft{0pt} \setlength\LTright{0pt}

\lipsum[1]

\begin{strip} % added <<<<<<<<<<<<<< % \begin{table}[h!] \renewcommand{\arraystretch}{1.8}% expand the cell (optional) <<<<<<<<<<<<<<< %\centering \captionof{table}{Comparison of some unique works in IoT Transportation}% changed \smallskip \begin{tabularx}{\textwidth}{p{2cm}p{1cm}p{3cm}p{1cm}p{3cm}p{4cm}}

        \hline
        \textbf{Author} 
        &amp; \textbf{Year } 
        &amp; \textbf{Mainly focusing problem/area} 
        &amp; \textbf{Layers} 
        &amp; \textbf{Main points} 
        &amp; \textbf{Shortcomings} \\

        \hline
        Al-Ali [21] 
        &amp;2021   
        &amp;Architecture for ‘short-range’ travel  
        &amp;4
        &amp;Designing and linking with Software application    
        &amp;Subject-specific \\

        \hline
        Minal Patel [26]    
        &amp;2021   
        &amp;Dashboard for Smart Cities 
        &amp;4
        &amp;Focusing on data flow and control   
        &amp; N/A \\

        \hline
        Sruthy Anand [24]   
        &amp;2021   
        &amp;Generalized structure  
        &amp;4  
        &amp;N/A
        &amp;Requires to be redesigned according to necessity  \\

        \hline
        BP Raj [20] 
        &amp;2020   
        &amp;Everyday traffic   
        &amp;3  
        &amp;Route optimization to reduce pollution 
        &amp;Not practically scalable \\

        \hline
        Muhmmad Derawi [28] 
        &amp;2020   
        &amp;Focuses on V2I communications      
        &amp;N/A
        &amp;Integration based on COMLIGHT, IQRF \&amp; Telenor 
        &amp;Prone to situations enabling more accidents \\

        \hline
        Nagarjuna G R [22]  
        &amp;2020   
        &amp;Designed specifically for fire brigades \&amp; ambulances      
        &amp; 6
        &amp;Practically hardware demonstrated  
        &amp;Applicable to rather simple traffic junctions \\ 

        \hline
        Yi-Yun Chu [23] 
        &amp;2020   
        &amp;Smart parking      
        &amp;N/A
        &amp;Different hardware for different parking applications  
        &amp;Not practically implemented \\

        \hline 
        Jin-ho Park [27]    
        &amp;2019   
        &amp;Scalability and flexibility in cognitive computing in smart city applications  
        &amp;5  
        &amp;DL incorporated to facilitate “unstructured” data  
        &amp;Unsecured sensor nodes \\

        \hline
        Umar Ali [19]   
        &amp;2019   
        &amp;Enhanced control and flow of data  
        &amp;4
        &amp;N/A
        &amp;Not very much flexible \\ 

        \hline
        Hamed Rahimi [25]   
        &amp;2018   
        &amp;Incorporating 11 technologies to solve multiple problems   
        &amp;8  
        &amp;Num of layers selected according to technologies   
        &amp;Too complex to practically implement and manage\\

        \hline
        Nallapaneni [1] 
        &amp;2017   
        &amp;Survey on use of IoTs in Transportation        
        &amp; N/A
        &amp;Monitoring vehicles using sensor nodes 
        &amp;  N/A \\

        \hline
        S. H. Sutar [3]
        &amp;2016   
        &amp;Dynamic route assignment to buses      
        &amp; N/A
        &amp;Management of fuel consumption 
        &amp;  N/A \\

        \hline
        D. Kyriazis [2]
        &amp;2013   
        &amp;Using Street lights as IoTs    
        &amp;3  
        &amp;Energy conservation    
        &amp;Theoretical level implementation required \\
        \hline

    \end{tabularx}
    %   \end{table}

\end{strip}

\lipsum[1]
\lipsum[1]
\lipsum[1]
\lipsum[1]

\end{document}

Simon Dispa
  • 39,141
  • i was missing cuted this whole time. although, does cuted introduce that additional spacing on top of the table? any idea on how to reduce it? – afaq Mar 15 '22 at 08:41