# Problem with framelines in tables

I am having a problem with LaTeX at the moment, which I seem completely incapable of solving. I am trying to create a simple table which has 4 columns and (should have in the end) 36 rows, including a header row. That header row, I want it to have a grey background.

Now, I have solved most of the issues concerning that topic, but in the end, my table refuses to put a vertical like between the 3rd and 4th header column - as long as it has the grey background color. Before I tried to use the \cellcolor[...] option, and when I removed it for that 3rd and 4th cell, LaTeX would draw that vertical line. So I tried with the \rowcolor[...] option, but the same thing. It's just either grey background or the missing vertical line.

I have tried two ways to draw that table, but the problem persists. Here is my example document, with two options that I tried to draw that table:

\documentclass[12pt,a4paper,toc=listofnumbered]{scrbook}
\usepackage[table]{xcolor}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}

\definecolor{dunkelgrau}{rgb}{0.8,0.8,0.8}

%First Option, but here is the upper left vertical line and the upper horizontal line missing
\begin{document}
\begin{table}[h]
\begin{tabular}{|c|c|c|c|}
\rowcolor{dunkelgrau}
\hline
\textbf{Proben-Nr.} & \textbf{Lokalität} & \textbf{Höhe in cm} & \textbf{Schliff-Nr.} \\
\hline
A & B & C & D  \\
\hline
A & B & C & D \\
\hline
\end{tabular}
\end{table}

%Second option, here the frame is entirely complete, just the missing vertical line between the 3rd and 4th header cell
\begin{tabular}{|c|c|c|c|}
\rowcolor{dunkelgrau}
\hline Proben-Nr. & Lokalität & Höhe in cm & Schliff-Nr. \\
\hline A & B & C & D \\
\hline A & B & C & D \\
\hline
\end{tabular}

\end{document}

• It looks fine on my system (I see the vertical line). Are you sure it's not just a viewer artifact? – Paul Gessler Jul 23 '14 at 23:51
• By the way: Welcome to TeX.SX! – Paul Gessler Jul 23 '14 at 23:55
• Hehe omg that is so embarrassing. My first question on this site and I already gloriously humiliated myself. You are right, once I zoom in to the created PDF all the lines show perfectly. I honestly would never have come up with that idea unless by mere coincidence. Thank you very much! Question answered :D – Kai Jul 24 '14 at 0:04
• No worries; it's a very common question. :-) Let me see if there's a good duplicate. – Paul Gessler Jul 24 '14 at 0:21
• – David Carlisle Jul 24 '14 at 0:32

Here's a different suggestion for a solution: Instead of trying to figure out which pdf viewer will (or will not) show which vertical and horizontal rules, you could create a table with no vertical rules and, yes, no horizontal rules either. Given the use of color (or, rather, gray) for the header row, there can be no confusion as to what's the header material and what's the body of the table. The "open" look that results from not using horizontal or vertical rules may be refreshing. Give it a try.

\documentclass[12pt,a4paper,toc=listofnumbered]{scrbook}

\usepackage[table]{xcolor}
\definecolor{dunkelgrau}{rgb}{0.8,0.8,0.8}

\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}

\begin{document}

\begin{table}[h]
\centering

\begin{tabular}{cccc}
\rowcolor{dunkelgrau}
\textbf{Proben-Nr.} & \textbf{Lokalität} & \textbf{Höhe in cm} & \textbf{Schliff-Nr.} \\
A & B & C & D  \\
A & B & C & D \\
\end{tabular}

\bigskip
\begin{tabular}{cccc}
\rowcolor{dunkelgrau}
Proben-Nr. & Lokalität & Höhe in cm & Schliff-Nr. \\
A & B & C & D \\
A & B & C & D \\
\end{tabular}
\end{table}
\end{document}