在表格中的特定列中添加行?

在表格中的特定列中添加行?

我想做一个像这样的表格

这是我的 LaTeX 代码:

\begin{table}[!htbp]
\centering
\caption{Comparison of all discussed Classifiers} \begin{tabular}{|>
{\raggedright}p{1cm}|>{\raggedright}p{3cm}|>{\raggedright}p{5cm}|>{\raggedright}p{5cm}|}
\hline

 3. & Template Matching (TM) & Computed very simple and Need matching the template over 
 the image & Rotation and Scalling variant \tabularnewline
  & & Easy change if there are a new classes of signs &  \tabularnewline
 \hline
  \end{tabular}
  \label{Classifiers_Com}
  \end{table}

我想让第三列有一条线来分隔这些句子

“计算非常简单,需要匹配图像上的模板

“如果有新的标志类别,可以轻松更改”

怎么做??

答案1

像这样?

\documentclass{article}
\usepackage{array}
\usepackage{enumitem}
\begin{document}
  \begin{table}[!htbp]
\centering
\caption{Comparison of all discussed Classifiers} 
\begin{tabular}{|>
{\raggedright}p{1cm}|>{\raggedright}p{3cm}|>{\raggedright}p{5cm}|>{\raggedright}p{5cm}|}
\hline

 3. & Template Matching (TM) & 
 \begin{minipage}[t]{\linewidth}
 \begin{itemize}[label= \textbf{--},leftmargin=*,itemsep=0ex]
 \item Computed very simple and Need matching the template over
 the image 
 \item Easy change if there are a new classes of signs
 \end{itemize}
 \end{minipage}
 & Rotation and Scalling variant \tabularnewline

 \hline
\end{tabular}
\end{table}
\end{document}

在此处输入图片描述

或者像这样?

\documentclass{article}
\usepackage{array}
\usepackage{enumitem}
\begin{document}
  \begin{table}[!htbp]
\centering
\caption{Comparison of all discussed Classifiers}
\begin{tabular}{|>
{\raggedright}p{1cm}|>{\raggedright}p{3cm}|>{\raggedright}p{5cm}|>{\raggedright}p{5cm}|}
\hline

 3. & Template Matching (TM) & Computed very simple and Need matching the template over
 the image & Rotation and Scalling variant \tabularnewline\cline{3-3}
  & & Easy change if there are a new classes of signs &  \tabularnewline
 \hline
\end{tabular}
\end{table}
\end{document}

在此处输入图片描述

答案2

使用该makecell包,可以减少打字次数。如果第一列完全是行号,您还可以使用它listliketab以便可以交叉引用行:

        \documentclass{article}

        \usepackage[utf8]{inputenc}
        \usepackage{array}
        \usepackage{enumitem}
        \usepackage{makecell}
        \usepackage{listliketab}
        \usepackage[textwidth = 16cm, nomarginpar, showframe]{geometry}

        \begin{document}
          \begin{table}[!htbp]
        \centering
        \caption{Comparison of all discussed Classifiers}
        \storestyleof{enumerate}
        \begin{listliketab}
        \newcounter{rowenum}\setcounter{rowenum}{2}
        \newcommand{\nextrow}{\refstepcounter{rowenum}\therowenum.}
          \begin{tabular}{|L p{3cm}|>{\raggedright}p{5cm}|>{\raggedright}p{5cm}|}
         \hline
        \nextrow\label{tm} & Template Matching (TM) & \makecell*[c{p{5cm}}]{Computed very simple and Need matching the template over
         the image\medskip\\Easy change if there are a new classes of signs} & Rotation and Scaling variant \tabularnewline
         \hline
        \end{tabular}
        \end{listliketab}
        \end{table}
        As one can see in row \ref{tm}, […]
        \end{document} 

在此处输入图片描述

相关内容