2
\begin{tabular}{| p{10cm} | c |}
\hline
& \\
{\bf Requirement:} & {\bf Categorie:} \\
& \\
\hline
& {\cellcolor{green}}\\
text & {\cellcolor{green}{\bf Must Have}} \\
& {\cellcolor{green}}\\
\hline
& {\cellcolor{green}}\\
text & {\cellcolor{green}{\bf Must Have}} \\
& {\cellcolor{green}}\\
\hline
& {\cellcolor{green}}\\
text & {\cellcolor{green}{\bf Must Have}} \\
& {\cellcolor{green}}\\
\hline
& {\cellcolor{orange}}\\
text & {\cellcolor{orange}{\bf Could Have}} \\
& {\cellcolor{orange}}\\
\hline
\end{tabular}

enter image description here

One of the \hline commands isn't comming through? See my picture for the error.

Pim
  • 167
  • Try to zoom into the PDF -- I think the line is there, but this is a well-known PDF viewer issue –  Apr 16 '16 at 09:49
  • wow, I generated the PDF, now I do see the line indeed. Thank you! @ChristianHupfer – Pim Apr 16 '16 at 09:51

2 Answers2

5

This is a known viewer issue, as also pointed out by @ChristianHupfer. In this case, you can increase the \arrayrulewidth or just open with another viewer.

\documentclass[12pt,a4paper]{article}
\usepackage{colortbl}
\usepackage{xcolor}
\begin{document}

\setlength{\arrayrulewidth}{1.5pt}
\begin{tabular}{| p{10cm} | c |}
\hline
& \\
{\bf Requirement:} & {\bf Categorie:} \\
& \\
\hline
& {\cellcolor{green}}\\
text & {\cellcolor{green}{\bf Must Have}} \\
& {\cellcolor{green}}\\
\hline
& {\cellcolor{green}}\\
text & {\cellcolor{green}{\bf Must Have}} \\
& {\cellcolor{green}}\\
\hline
& {\cellcolor{green}}\\
text & {\cellcolor{green}{\bf Must Have}} \\
& {\cellcolor{green}}\\
\hline
& {\cellcolor{orange}}\\
text & {\cellcolor{orange}{\bf Could Have}} \\
& {\cellcolor{orange}}\\
\hline
\end{tabular}

\end{document}

enter image description here

AboAmmar
  • 46,352
  • 4
  • 58
  • 127
0

The package nicematrix has tools designed to address that kind of problem. In the following code, I have loaded nicematrix (and unloaded colortbl) and replaced the environment {tabular} with the environment {NiceTabular} with the key color-inside (alias colortbl-like) which means that there will be color instructions within the tabular.

You have directly the expected output.

\documentclass[12pt,a4paper]{article}
\usepackage{nicematrix}
\usepackage{xcolor}
\begin{document}

\begin{NiceTabular}{| p{10cm} | c |}[color-inside] \hline & \ {\bf Requirement:} & {\bf Categorie:} \ & \ \hline & {\cellcolor{green}}\ text & {\cellcolor{green}{\bf Must Have}} \ & {\cellcolor{green}}\ \hline & {\cellcolor{green}}\ text & {\cellcolor{green}{\bf Must Have}} \ & {\cellcolor{green}}\ \hline & {\cellcolor{green}}\ text & {\cellcolor{green}{\bf Must Have}} \ & {\cellcolor{green}}\ \hline & {\cellcolor{orange}}\ text & {\cellcolor{orange}{\bf Could Have}} \ & {\cellcolor{orange}}\ \hline \end{NiceTabular}

\end{document}

You need several compilations (because nicematrix uses PGF/Tikz nodes under the hood).

Remark \bf is considered as deprecated in LaTeX and one should use \bfseries instead.

Output of the first code

F. Pantigny
  • 40,250