9

I have been using \rowcolor{color} command and I have noticed that there is always some white space between one cell and the next one in the row.

Here is my code:

\documentclass[11pt,letterpaper]{report}
\usepackage{xcolor,colortbl}
\usepackage{booktabs}
\definecolor{azultabla}{RGB}{203,220,250}

\begin{document}

\begin{table}[h]
\centering
\footnotesize
\begin{tabular}{ l l l l l l l } \toprule
Nombre & E (m) & N (m) & Z (m) & E+ $\Delta$ E (m)  & N+ $\Delta$ N(m) & Z+ $\Delta$ Z (m.s.n.m)\\ \toprule
PR1 & 1002,723 & 309,042 & 977,471 & 1134,723 & 182,042 & 940,471\\
PR2 & 1002,723 & 309,042 & 977,471 & 1134,723 & 182,042 & 940,471\\
PR3 & 940,739 & 481,138 & 1005,466 & 1072,739 & 354,138 & 968,466\\
PR4 & 918,88 & 680,901 & 1028,026 & 1050,88 & 553,901 & 991,026\\
PR5 & 896,946 & 962,638 & 1075,09 & 1028,946 & 835,638 & 1038,09\\
PR6 & 896,946 & 962,638 & 1075,09 & 1028,946 & 835,638 & 1038,09\\
PR7 & 913,684 & 787,489 & 1043,07 & 1045,684 & 660,489 & 1006,07\\
\rowcolor{azultabla}PR8 & 947,612 & 633,854 & 1020,237 & 1079,612 & 506,854 & 983,237\\
PR9 & 972,277 & 540,103 & 1006,518 & 1104,277 & 413,103 & 969,518\\
PR10 & 1052,608 & 467,588 & 993,868 & 1184,608 & 340,588 & 956,868\\
\rowcolor{azultabla}J1 & 760,255 & 522,173 & 1099,546 & 892,255 & 395,173 & 1062,546\\
J2 & 708,368 & 815,587 & 1141,531 & 840,368 & 688,587 & 1104,531\\
\rowcolor{azultabla}J3 & 705,587 & 955,072 & 1157,92 & 837,587 & 828,072 & 1120,92\\
J4 & 693,069 & 1132,449 & 1169,837 & 825,069 & 1005,449 & 1132,837\\
A & 770,443 & 1270,618 & 1167,742 & 902,443 & 1143,618 & 1130,742\\
\rowcolor{azultabla}J5 & 1095,914 & 789,757 & 1087,632 & 1227,914 & 662,757 & 1050,632\\
J6 & 1227,941 & 606,524 & 1074,445 & 1359,941 & 479,524 & 1037,445\\
J7 & 1127,539 & 265,15 & 972,463 & 1259,539 & 138,15 & 935,463\\
\rowcolor{azultabla}C & 1080,741 & 242,177 & 968,569 & 1212,741 & 115,177 & 931,569\\ \bottomrule
\end{tabular}
\caption{Coordenada de los puntos conocidos después de sumar las coordenadas individuales}
\label{tab:coordsconocidas}
\end{table}

\end{document}

Most annoying thing in the world

Is there a way I can fix that?

4
  • 2
    Please always post a complete document showing all packages used. If I zoom in on your image I don't see gaps. In fact TeX places the colour panels exactly adjacent, but some pdf viwers will snap them to pixel boundaries and panels may snap in opposite directions leaving a pixel gap. Please clarify where you are seeing the gap (and what viewer) Commented Feb 13, 2013 at 21:52
  • Oh, I am sorry. I'm seeing this white gaps (they are quite small) using 'Preview.app'. Although the code's output is a pdf, I posted the image with the .png termination because if you zoom that, the pixels will show you exactly what I'm talking about. I just noticed that this doesn't happen with acrobat reader.
    – Francisco
    Commented Feb 13, 2013 at 22:00
  • Hence the problem is with the pdf viewer. Thank you.
    – Francisco
    Commented Feb 13, 2013 at 22:06
  • 1
    It's still a legitimate question though IMHO because oftentimes documents are produced for screen reading and you can't rely on people using a certain PDF viewer and not another.
    – Christian
    Commented Feb 14, 2013 at 3:06

2 Answers 2

4

There is an ad hoc solution, which may not be preferable, but it works.

I used the array package and set the vertical rule to -1pt, which dealt with the white space --- !{\vrule width -1pt}. vrule is used to set thick vertical lines (e.g., !{\vrule width 2pt}).

Below is the output and my MWE.

enter image description here

\documentclass{article} 

\usepackage{array}
\usepackage{colortbl}
\usepackage{booktabs}

\begin{document} 
\begin{table}[h]
\centering
\footnotesize
\begin{tabular}{ l !{\vrule width -1pt}l !{\vrule width -1pt}l !{\vrule width -1pt}l !{\vrule width -1pt}l !{\vrule width -1pt}l !{\vrule width -1pt}l } \toprule
Nombre & E (m) & N (m) & Z (m) & E+ $\Delta$ E (m)  & N+ $\Delta$ N(m) & Z+ $\Delta$ Z (m.s.n.m)\\ \toprule
PR1 & 1002,723 & 309,042 & 977,471 & 1134,723 & 182,042 & 940,471\\
PR2 & 1002,723 & 309,042 & 977,471 & 1134,723 & 182,042 & 940,471\\
PR3 & 940,739 & 481,138 & 1005,466 & 1072,739 & 354,138 & 968,466\\
PR4 & 918,88 & 680,901 & 1028,026 & 1050,88 & 553,901 & 991,026\\
PR5 & 896,946 & 962,638 & 1075,09 & 1028,946 & 835,638 & 1038,09\\
PR6 & 896,946 & 962,638 & 1075,09 & 1028,946 & 835,638 & 1038,09\\
PR7 & 913,684 & 787,489 & 1043,07 & 1045,684 & 660,489 & 1006,07\\
\rowcolor{cyan}PR8 & 947,612 & 633,854 & 1020,237 & 1079,612 & 506,854 & 983,237\\
PR9 & 972,277 & 540,103 & 1006,518 & 1104,277 & 413,103 & 969,518\\
PR10 & 1052,608 & 467,588 & 993,868 & 1184,608 & 340,588 & 956,868\\
\rowcolor{cyan}J1 & 760,255 & 522,173 & 1099,546 & 892,255 & 395,173 & 1062,546\\
J2 & 708,368 & 815,587 & 1141,531 & 840,368 & 688,587 & 1104,531\\
\rowcolor{cyan}J3 & 705,587 & 955,072 & 1157,92 & 837,587 & 828,072 & 1120,92\\
J4 & 693,069 & 1132,449 & 1169,837 & 825,069 & 1005,449 & 1132,837\\
A & 770,443 & 1270,618 & 1167,742 & 902,443 & 1143,618 & 1130,742\\
\rowcolor{cyan}J5 & 1095,914 & 789,757 & 1087,632 & 1227,914 & 662,757 & 1050,632\\
J6 & 1227,941 & 606,524 & 1074,445 & 1359,941 & 479,524 & 1037,445\\
J7 & 1127,539 & 265,15 & 972,463 & 1259,539 & 138,15 & 935,463\\
\rowcolor{cyan}C & 1080,741 & 242,177 & 968,569 & 1212,741 & 115,177 & 931,569\\ \bottomrule
\end{tabular}
\caption{Coordenada de los puntos conocidos después de sumar las coordenadas individuales}
\label{tab:coordsconocidas}
\end{table}

\end{document}
2
  • It does work :)
    – Francisco
    Commented Feb 14, 2013 at 3:21
  • 3
    Is there also a non ad-hoc solution? ;-) Commented Mar 4, 2014 at 13:47
0

The package nicematrix has tools designed to address that kind of problem. With the environment {NiceTabular} (and the key colortbl-like), you won't see any thin white lines even with the PDF renderer PDF.js (used for instance by Firefox, Dropbox and Papeeria).

\documentclass[11pt,letterpaper]{report}
\usepackage{xcolor}
\usepackage{booktabs}
\usepackage{nicematrix}
\definecolor{azultabla}{RGB}{203,220,250}

\begin{document}

\begin{table}[h]
\centering
\footnotesize
\begin{NiceTabular}{ l l l l l l l }[colortbl-like] \toprule
Nombre & E (m) & N (m) & Z (m) & E+ $\Delta$ E (m)  & N+ $\Delta$ N(m) & Z+ $\Delta$ Z (m.s.n.m)\\ \toprule
PR1 & 1002,723 & 309,042 & 977,471 & 1134,723 & 182,042 & 940,471\\
PR2 & 1002,723 & 309,042 & 977,471 & 1134,723 & 182,042 & 940,471\\
PR3 & 940,739 & 481,138 & 1005,466 & 1072,739 & 354,138 & 968,466\\
PR4 & 918,88 & 680,901 & 1028,026 & 1050,88 & 553,901 & 991,026\\
PR5 & 896,946 & 962,638 & 1075,09 & 1028,946 & 835,638 & 1038,09\\
PR6 & 896,946 & 962,638 & 1075,09 & 1028,946 & 835,638 & 1038,09\\
PR7 & 913,684 & 787,489 & 1043,07 & 1045,684 & 660,489 & 1006,07\\
\rowcolor{azultabla}PR8 & 947,612 & 633,854 & 1020,237 & 1079,612 & 506,854 & 983,237\\
PR9 & 972,277 & 540,103 & 1006,518 & 1104,277 & 413,103 & 969,518\\
PR10 & 1052,608 & 467,588 & 993,868 & 1184,608 & 340,588 & 956,868\\
\rowcolor{azultabla}J1 & 760,255 & 522,173 & 1099,546 & 892,255 & 395,173 & 1062,546\\
J2 & 708,368 & 815,587 & 1141,531 & 840,368 & 688,587 & 1104,531\\
\rowcolor{azultabla}J3 & 705,587 & 955,072 & 1157,92 & 837,587 & 828,072 & 1120,92\\
J4 & 693,069 & 1132,449 & 1169,837 & 825,069 & 1005,449 & 1132,837\\
A & 770,443 & 1270,618 & 1167,742 & 902,443 & 1143,618 & 1130,742\\
\rowcolor{azultabla}J5 & 1095,914 & 789,757 & 1087,632 & 1227,914 & 662,757 & 1050,632\\
J6 & 1227,941 & 606,524 & 1074,445 & 1359,941 & 479,524 & 1037,445\\
J7 & 1127,539 & 265,15 & 972,463 & 1259,539 & 138,15 & 935,463\\
\rowcolor{azultabla}C & 1080,741 & 242,177 & 968,569 & 1212,741 & 115,177 & 931,569\\ \bottomrule
\end{NiceTabular}
\caption{Coordenada de los puntos conocidos después de sumar las coordenadas individuales}
\label{tab:coordsconocidas}
\end{table}

\end{document}

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

Output of the above code

You must log in to answer this question.

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