如何调整表格列中的文本?

如何调整表格列中的文本?

这张表有什么问题?

\newlength\origheight
\setlength\origheight{\textheight}

\begin{landscape}

\begin{table}
    \scalebox{0.5}{
    \begin{tabularx}{\origheight}{@{} >{\bfseries}l *{7}{L} @{}} 

        \toprule
        Protocol name & \textbf{QT} & \textbf{OQTT} & \textbf{STT} 
        & \textbf{BS} & \textbf{CT} & \textbf{QwT} & \textbf{CwT} \\ 
        \midrule

        Protocol feature
        & They use random multi-access way to identify tags. In case of collision, the tags will be asked to send data later with a random time relay.
        & They identify the total number of tags in the interrogation zone. The reader controls every step of the protocol, using commands or queries to split colliding tags into subsets, and further repeatedly split those subsets until identifies all the tags.
        & They are mixture of Aloha and Tree-based protocols. They use two methods. The first is using randomized divisions in Tree-based algorithms, and another is using tree strategies after a collision in Aloha algorithms.
        & It involves transmitting a serial number from the reader to all the tags. Only tags which have equal or lower ID value than the received serial number will respond on request.
        & It is an improvement of QT which uses Bit tracking technology in order to find which bits collided and also where they are.
        & It applies a dynamic bit window to QT. All the tags compare their ID value with the query received and transmit a certain bit amount managed by the reader.
        & It applies the dynamic bit window to CT and adopts two techniques: bit tracking and the bit window.
        \\ \addlinespace
        Disadvantages
        & The reader sends a query and tags, whose ID prefix match that query, respond their full ID.
        & Very complex protocol, uses three technologies. The preprocessing increases the energy consumption of the protocol, especially in dense tag environments.
        & On every collision, the full tag response, apart from the initial query bits, is wasted.
        & The reader restart the reading process after a tag is identified.
        & It wastes a high number of tag bits on every collision, which increases the energy consumed by the reader during the process.
        & When the calculated ws is high, the reader command needs a high number of bits to represent it. That leads to a wastage of the reader bits.
        & Increase the number of reader bits
        \\ \addlinespace
        RTF/TTF 
        & RTF & RTF & RTF & RTF & RTF & RTF & RTF 
        \\
        Efficiency
        & 34.6\% & 61.4\% & 58\% & & 35\% & 80\% & 61\% 
        \\
        System cost 
        & Very low & Very expensive & Expensive & Medium & Low & Medium & Medium
        \\
        Complexity 
        & Very simple & Very high & High & Medium & Simple & Medium & Medium 
        \\
        \bottomrule 
    \end{tabularx}
}
    \caption{A comparison of tree-based protocols}
    \label{tab:ComparationThree}
\end{table}
\end{landscape}

看看现在的样子。我希望更宽一些以适合整个页面 在此处输入图片描述

答案1

(此版本的答案解决了 OP 的查询和代码的大量修改形式,它基于我答案的原始形式。)

修改后的查询中的代码包含指令

\begin{tabularx}{\textwidth}{@{} >{\bfseries}l *{5}{X} @{}}

由于您的表现在包含 7 个数据列,而不是之前的 5 个,因此您需要将此指令更改为

\begin{tabularx}{\textwidth}{@{} >{\bfseries}l *{7}{X} @{}}

X类型执行完全对齐。鉴于 7 个数据列非常窄,完全对齐必然会产生大而难看的字间间隙。在我看来,最好将材料排版为右边不齐。这可以通过添加说明来实现

\usepackage{ragged2e}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}

序言和后来的写作

\begin{tabularx}{\textwidth}{@{} >{\bfseries}l *{7}{L} @{}}

但是,如果你不喜欢最终的效果,只需恢复为

\begin{tabularx}{\textwidth}{@{} >{\bfseries}l *{7}{X} @{}}

另一个要点:根据您的评论,我将其从设置更改sidewaystable为组合landscape/table设置。这样,表格会在 pdf 文件本身中旋转,读者无需伸长脖子。

在此处输入图片描述

\documentclass{article}
\usepackage[a4paper,margin=2.5cm]{geometry} 
\usepackage{pdflscape,booktabs,tabularx,ragged2e}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X} % raggedright rather than full justification
\begin{document}

%% save the original value of the \textheight parameter:
\newlength\origheight
\setlength\origheight{\textheight}

\begin{landscape}
\begin{table}
\begin{tabularx}{\origheight}{@{} >{\bfseries}l *{7}{L} @{}} 

\toprule
Protocol name & \textbf{QT} & \textbf{OQTT} & \textbf{STT} 
& \textbf{BS} & \textbf{CT} & \textbf{QwT} & \textbf{CwT} \\ 
\midrule

Protocol feature
& They use random multi-access way to identify tags. In case of collision, the tags will be asked to send data later with a random time relay.
& They identify the total number of tags in the interrogation zone. The reader controls every step of the protocol, using commands or queries to split colliding tags into subsets, and further repeatedly split those subsets until identifies all the tags.
& They are mixture of Aloha and Tree-based protocols. They use two methods. The first is using randomized divisions in Tree-based algorithms, and another is using tree strategies after a collision in Aloha algorithms.
& It involves transmitting a serial number from the reader to all the tags. Only tags which have equal or lower ID value than the received serial number will respond on request.
& It is an improvement of QT which uses Bit tracking technology in order to find which bits collided and also where they are.
& It applies a dynamic bit window to QT. All the tags compare their ID value with the query received and transmit a certain bit amount managed by the reader.
& It applies the dynamic bit window to CT and adopts two techniques: bit tracking and the bit window.
\\ \addlinespace
Disadvantages
& The reader sends a query and tags, whose ID prefix match that query, respond their full ID.
& Very complex protocol, uses three technologies. The preprocessing increases the energy consumption of the protocol, especially in dense tag environments.
& On every collision, the full tag response, apart from the initial query bits, is wasted.
& The reader restart the reading process after a tag is identified.
& It wastes a high number of tag bits on every collision, which increases the energy consumed by the reader during the process.
& When the calculated ws is high, the reader command needs a high number of bits to represent it. That leads to a wastage of the reader bits.
& Increase the number of reader bits
\\ \addlinespace
RTF/TTF 
& RTF & RTF & RTF & RTF & RTF & RTF & RTF 
\\
Efficiency
& 34.6\% & 61.4\% & 58\% & & 35\% & 80\% & 61\% 
\\
System cost 
& Very low & Very expensive & Expensive & Medium & Low & Medium & Medium
\\
Complexity 
& Very simple & Very high & High & Medium & Simple & Medium & Medium 
\\
\bottomrule 
\end{tabularx}
\caption{A comparison of tree-based protocols}
\label{tab:ComparationThree}
\end{table}
\end{landscape}
\end{document}

相关内容