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.

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

2 Answers 2

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

0
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .