如何在两列设置中将表格铺满整个页面?

如何在两列设置中将表格铺满整个页面?

这里有很多问题涉及这个问题,但没有一个能解决我的问题。我不知道为什么要浏览这么多网站和文档。

我正在处理一篇论文中的这张表格,但似乎无法将其调整到应有的样子。文本应该位于表格上方和下方,而不是表格之间。表格应该位于 1 列(整页)内,而不会影响其余文本。它甚至无法与table*环境配合使用。

图片

梅威瑟:

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

我正在寻找一种类似于分布在整个页面而不会破坏文本的格式:

在此处输入图片描述

另外,有人能推荐一些表格修改,让表格看起来比现在更好吗?我也一直在尝试改变它,但无果而终。例如,缩小“年份”列(使其紧凑且易读),在每个单元格中水平和垂直对齐文本,就像 Word 所做的那样;或者任何其他更改。

谢谢。

答案1

为了使表格看起来更好,您可以删除大部分水平线。您也可以使用命令加宽行之间的间隔arraystrech。在下面的例子中,我使用了tabularray包裹默认情况下,它会在行周围插入更多间隙。此包还有许多其他好处。

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

在此处输入图片描述

我也稍微改变了一下列类型。

现在,如果您确实想在第一页放置双列表格,则可以删除浮动 ( table) 环境,并使用环境talltblr(可以使用此环境插入标题)和strip来自cuted包裹(图片来源:这个答案)(尽管我不确定 IEEE 是否更喜欢在第一页放置双列表格)。

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

在此处输入图片描述

请注意 strip 环境如何改变表格前文本的位置。因此,在提交给会议的情况下,此解决方案可能不可接受。

答案2

使用包cuted插入tabularx两列宽的材料(像您的一样,没有任何更改)。

由于显然无法支持浮点数,因此您必须使用\captionof而不是 插入标题\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} 
            & \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}
\end{strip} 

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

相关内容