1

enter image description here

I want to replicate this in latex, where the cell of the bottom row is not as wide as the others on top, so far my code and output is:

\begin{center}
\begin{tabular}{|l | p{13cm}|}
\hline
    {Tested By} & {SQA Team}\\    
\hline
    {Test Type} & {Acceptance Test}\\    
\hline
    {Test Case Number} & {TC-1.1 Create a client successfully}\\    
\hline
    {Test Case Description} & {This test case is used to check if a visitor can create a client with the system}\\    
\hline
    \multicolumn{2}{|c|}{Item(s) to be tested}\\
\hline
    {1.} & {SRS 3.1.1.1}\\    
\hline


\end{tabular}
\end{center}

resulting in:

enter image description here

3

One way :

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[frenchb]{babel}
\usepackage{array}
\usepackage[table,x11names]{xcolor}
\usepackage{colortbl}
\usepackage[a4paper, margin={1cm,1cm}]{geometry}

\begin{document}
\begin{center}
\begin{tabular}{|ll| p{13cm}|}
\hline
\multicolumn{2}{|l|}{\cellcolor{Gray0}Tested By} & {SQA Team}\\
\hline
\multicolumn{2}{|l|}{\cellcolor{Gray0}Test Type} & {Acceptance Test}\\    
\hline
\multicolumn{2}{|l|}{\cellcolor{Gray0}Test Case Number} & {TC-1.1 Create a client successfully}\\    
\hline
  \multicolumn{2}{|l|}{\cellcolor{Gray0}Test Case Description} & {This test case is used to check if a visitor can create a client with the system}\\    
\hline
  \multicolumn{3}{|c|}{\cellcolor{Gray0}Item(s) to be tested}\\
\hline
1.\hspace{1cm} & \multicolumn{2}{|l|}{\fcolorbox{white}{DeepSkyBlue1}{SRS 3.1.1.1}}\\    
\hline


\end{tabular}
\end{center}
\end{document}

enter image description here

| improve this answer | |
1

There are a number of ways to do this. My preference would be to simply fake the last row using \makebox and \vrule.

\documentclass{article}
\usepackage[a4paper, margin={1cm,1cm}]{geometry}

\newcommand{\myrow}[2]% #1=first column, #2=second column
{\multicolumn{2}{|l|}{\makebox[1cm][l]{#1}\hspace{\tabcolsep}\vrule\hspace{\tabcolsep}#2}}

\begin{document}
\begin{center}
\begin{tabular}{|l | p{13cm}|}
\hline
    {Tested By} & {SQA Team}\\    
\hline
    {Test Type} & {Acceptance Test}\\    
\hline
    {Test Case Number} & {TC-1.1 Create a client successfully}\\    
\hline
    {Test Case Description} & {This test case is used to check if a visitor can create a client with the system}\\    
\hline
    \multicolumn{2}{|c|}{Item(s) to be tested}\\
\hline
    \myrow{1.}{SRS 3.1.1.1 }\\
\hline
\end{tabular}
\end{center}
\end{document}

demo

| improve this answer | |
0

Another option is to think that there are three columns; in rows 1--4, the first column spans two columns, and in row 5 onwards, the second column spans two column. Here is how to implement this in ConTeXt (the solution should be easy to port to LaTeX):

\startsetups testing
  \setupTABLE[toffset=0.5ex, boffset=0.5ex]
  \setupTABLE[column][1][width=4em]
  \setupTABLE[column][2][width=6em]
  \setupTABLE[column][3][width=broad]

  \setupTABLE[1,2][1,2,3,4][background=color, backgroundcolor=gray]
  \setupTABLE[row][5][align=middle, background=color, backgroundcolor=gray]
\stopsetups

\starttext
\startTABLE[setups=testing]
  \NC[nc=2] Tested By \NC SQA Team \NC \NR
  \NC[nc=2] Test Type \NC Acceptance Test \NC \NR
  \NC[nc=2] Test Case Number \NC TC-1.1 Create a client successfully \NC \NR
  \NC[nc=2] Test Case Description \NC This test case is used to check if a visitor can create a client with the system \NC \NR
  \NC[nc=3] Item(s) to be tested \NC \NR
  \NC 1. \NC[nc=2] SRS 3.1.1.1 \NC \NR
\stopTABLE
\stoptext

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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