表格文字调整

表格文字调整

在此处输入图片描述在此处输入图片描述你好,我把文本放在表格中,但我需要设置当句子结束时数字转到下一行,而不是出现在前一个文本之后。看到红色突出显示,我希望数字从新行开始。此外,当我将粗体字体添加到标题时,它会显示错误。

看到红色突出显示,我希望数字从新行开始。

\begin{center}
 %\begin{table}[h!]
 % \bigskip
     \begin{longtable}{ |p{2.1cm} | p{2.5cm} | p{2.4cm} |  p{2.1cm} |  p{2.2cm} | p{2.2cm} |}
     \caption{Comparison Between the Wormhole Attacks } 
     \tabularnewline
     \hline
     Wormhole types & Encapsulation & Out of Band & High Power & Packet Relay & Protocol Deviations \tabularnewline \hline



      Advantages  & 1- there is a smaller probability of RREQ being discarded than other RREQs which are repeatedly received by intermediate nodes. 2- RREQ packet arriving to destination, does not keep middle nodes as hops, and then it appears to have passed through minimum number of hops. & 1- Control packet arrives faster due to no process from middle nodes 2- Less probability of discarding compare to RREQs which are repeatedly received by middle nodes. 3- Control packets arrive at destination, middle nodes not use as hops, pass through less number of hops & 1- Control packets arrive faster 2- Less probability of discarding compare to RREQs which are repeatedly received by middle nodes. 3- Control packets arrive at destination, middle nodes not use as hops, pass through less number of hops    & 1- Two nodes think they are neighbors although they are not, and every RREQ to be sent to neighbors will arrive to relay nodes invisibility. 2- Control packet seems to arrive using minimum number of hops   & control packet arrives faster  \tabularnewline[.5ex] \hline


     \end{longtable}
 %    \end{table}
 \end{center}

答案1

如果在标准中使用,您的表格太宽了article。这就是我将其放在横向的原因。在以后的问题中,请提供真实的 MWE。

% arara: pdflatex

\documentclass{article}
\usepackage[english]{babel}
\usepackage{longtable}
\usepackage{microtype}
\usepackage{ragged2e}
\usepackage{array}
\usepackage{lscape}
\usepackage{caption}
\newcounter{temp}
\newcommand{\first}{\setcounter{temp}{1}\thetemp- }
\newcommand{\following}{\stepcounter{temp}\par\thetemp- }

\begin{document}
\begin{landscape}
    \begin{center}
        \captionof{table}{Comparison Between the Wormhole Attacks}
        \begin{longtable}{|p{1.8cm}|>{\RaggedRight}p{2.5cm}|>{\RaggedRight}p{2.4cm}|>{\RaggedRight}p{2.1cm}|>{\RaggedRight}p{2.2cm}|>{\RaggedRight}p{2.2cm}|} 
            \hline
            \textbf{Wormhole types} & \textbf{Encapsulation} & \textbf{Out of Band} & \textbf{High Power} & \textbf{Packet Relay} & \textbf{Protocol Deviations} \\\hline      
            Advantages  
            & \first there is a smaller probability of RREQ being discarded than other RREQs which are repeatedly received by intermediate nodes.
                \following RREQ packet arriving to destination, does not keep middle nodes as hops, and then it appears to have passed through minimum number of hops. 
            & \first Control packet arrives faster due to no process from middle nodes
                \following Less probability of discarding compare to RREQs which are repeatedly received by middle nodes.
                \following Control packets arrive at destination, middle nodes not use as hops, pass through less number of hops 
            & \first Control packets arrive faster
                \following Less probability of discarding compare to RREQs which are repeatedly received by middle nodes.
                \following Control packets arrive at destination, middle nodes not use as hops, pass through less number of hops    
            & \first Two nodes think they are neighbors although they are not, and every RREQ to be sent to neighbors will arrive to relay nodes invisibility.
                \following Control packet seems to arrive using minimum number of hops   
            & control packet arrives faster \\\hline        
        \end{longtable}
    \end{center}
\end{landscape}
\end{document}

在此处输入图片描述

相关内容