1

How can I achieve this table in latex

enter image description here

As of now this is the result

enter image description here

by using this code

\begin{table}[]
    \centering
    \caption{My caption}
    \label{my-label}
    \begin{tabular}{|l|l|l|l|l|l|l|l|}
    \hline
    \multirow{2}{*}{Criteria} & \multirow{2}{*}{Expected} &  \multicolumn{3} 
     {l|}{Actual } & \multirow{2}{*}{Matching Rate} \\ \cline{3-7}
  &  & Trial 1 & Trial 2 & Trial 3 & Trial 4 & Trial 5 \\ \cline{3-7} \hline
    \end{tabular}
\end{table}
  • this can be achieved via \multirow and \multicolumn – Raaja Feb 1 at 7:57
  • how sir im new to latex – Beginner Feb 1 at 7:58
2

Something like this?

\documentclass[10pt,a4paper]{article}
\usepackage{multirow}
\begin{document}
\begin{table}[]
    \begin{tabular}{|c|c|c|c|c|c|c|c|}
        \hline
        \multirow{2}{*}{\textbf{Criteria}}                                                               & \multirow{2}{*}{\textbf{Expected}}                                 & \multicolumn{5}{c|}{\textbf{Actual}}                                                                                                                                                                                                                                                                           & \multirow{2}{*}{\textbf{\begin{tabular}[c]{@{}c@{}}Matching\\ rate\end{tabular}}} \\ \cline{3-7}
        &                                                                    & \textbf{\begin{tabular}[c]{@{}c@{}}Trial\\ 1\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Trial\\ 2\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Trial\\ 3\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Trial\\ 4\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Trial\\ 5\end{tabular}} &                                                                                   \\ \hline
        \multicolumn{1}{|l|}{\begin{tabular}[c]{@{}l@{}}The device can\\ detect drowsiness\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}2 to 3 \\ seconds\end{tabular}} & 2 sec                                                      & 3 sec                                                      & 2 sec                                                      & 2 sec                                                      & 2 sec                                                      & 100\%                                                                             \\ \hline
        \multicolumn{7}{|r|}{\textbf{Functionality}}                                                                                                                                                                                                                                                                                                                                                                                                                                           & \textbf{100\%}                                                                    \\ \hline
    \end{tabular}
\end{table}
\end{document}

to get:

enter image description here

  • can you fix the spacing sir? I'm a little bit confuse to it thanks – Beginner Feb 1 at 8:09
  • @Raaja I will look into that. And, do you mean the first and second rows? – Raaja Feb 1 at 8:12

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.