2

I've used a tool to produce a rather complex table that uses multiple instances of multi-row and multi-columns. I want to color some of the multicolumns, but when I do so, a thin white line appears where the hhline should be. I changed this to a darker color than I intend to use, so the defect is a bit more visible.

enter image description here

Compile with lualatex or xelatex.

\documentclass{article}

\usepackage{multirow}
\usepackage{hhline}
\usepackage{xcolor,colortbl}
\usepackage{tablefootnote}
\definecolor{table}{rgb}{0.427,0.427,0.427}

\begin{document}

  \begin{table}
    \centering
    \caption{Consonant Phoneme Chart}
    \arrayrulecolor{black}
    \begin{tabular}{|c|c|c|c|c|c|c|c|} 
        \hline
        \rowcolor{table} \multicolumn{2}{|c|}{}                                       & Alveolar                                                           & Palatal\tablefootnote{Palatoalveolar} & Velar  & Uvular & Pharyngeal & Glottal  \\ \hline
        \multicolumn{2}{|c|}{{\cellcolor{table}}Nasal}                                & n                                                                  &                                       & ŋ ⟨ň⟩  & ɴ ⟨ṅ⟩  &            &          \\ \hline
        {\cellcolor{table}}                            & {\cellcolor{table}}voiced    & d                                                                  &                                       & g      & ɢ ⟨ġ⟩  &            &          \\ \hhline{|>{\arrayrulecolor{table}}->{\arrayrulecolor{black}}-------|}
        {\cellcolor{table}}                            & {\cellcolor{table}}voiceless & t                                                                  &                                       & k      & q      &            & ʔ ⟨’⟩    \\[-0.1pt] \hhline{|>{\arrayrulecolor{table}}->{\arrayrulecolor{black}}-------|}
        \multirow{-3}{*}{{\cellcolor{table}}Plosive}   & {\cellcolor{table}}ejective  & tʼ                                                                 &                                       & kʼ     & qʼ     &            &          \\ \hline
        {\cellcolor{table}}                            & {\cellcolor{table}}voiced    & \multirow{2}{*}{s ⟨s⟩}                                             & \multirow{2}{*}{ʃ ⟨š⟩}                &        & χ ⟨x⟩  &            &          \\ \hhline{|>{\arrayrulecolor{table}}->{\arrayrulecolor{black}}-~~----|}
        \multirow{-2}{*}{{\cellcolor{table}}Fricative} & {\cellcolor{table}}voiceless &                                                                    &                                       &        & ʁ ⟨r⟩  & ħ ⟨ẋ⟩      & h        \\ \hline
        {\cellcolor{table}}                            & {\cellcolor{table}}voiceless & ts ⟨z⟩                                                             & t͡ʃ~ ⟨c⟩                               &        &        &            &          \\ \hhline{|>{\arrayrulecolor{table}}->{\arrayrulecolor{black}}-------|}
        \multirow{-2}{*}{{\cellcolor{table}}Affricate} & {\cellcolor{table}}ejective  & tsʼ ⟨zʼ⟩                                                           & t͡ʃ ’ ⟨c’⟩                             &        &        &            &          \\ \hline
        \multicolumn{2}{|c|}{{\cellcolor{table}}Approximant}                          & l \tablefootnote{More accurately, a lateral alveolar approximant.} & j                                     & ɰ ⟨ğ⟩  &        & ʕ ⟨â⟩      &          \\ \hline
    \end{tabular}
\end{table}
\end{document}

I came across a couple of solutions. One of them was to use nicematrix, but I'm not sure how to get it to work. Another was to do something involving \vskip, but again, I'm not sure where to put it exactly, and so far I couldn't get it to fix my issue. So yes, this might be a duplicate, but I really don't know how to use these solutions properly.

1
  • Welcome to TeX SE! You should provide a complete MWE (minimal working exemple), that is to say an example with the \documentclass, the \begin{document}, \end{document}, etc. May 7 at 8:14
1

These thin white lines appear in some PDF viewers. More precisely, they appear in the PDF viewers which use the PDF renderers PDF.js (eg: Firefox, DropBox, Papeeria) or MuPDF (eg; SumatraPDF). They don't appear in Adobe Reader but, with that PDF reader, the rules seem to vanish under the colored panels at some levels of zoom.

The package nicematrix solves those problems. However, with nicematrix, you need several compilations.

\documentclass{article}
\usepackage{nicematrix,enumitem,caption}
\usepackage{xltxtra}
\definecolor{table}{rgb}{0.427,0.427,0.427}


\usepackage{xcolor}

\begin{document}

\begin{table}
\centering
\caption{Consonant Phoneme Chart}
\begin{NiceTabular}{cccccccc}[hvlines,cell-space-limits=2pt]
\CodeBefore
   \rowcolor{gray}{1}
   \columncolor{gray}{1,2}
\Body
   \Block{1-2}{}            &           & Alveolar           & Palatal            & Velar  & Uvular     & Pharyngeal & Glottal \\
   \Block{1-2}{Nasal}       &           & n                  &                    & ŋ ⟨ň⟩  & ɴ ⟨ṅ⟩      &       \\ 
   \Block{3-1}{Plosive}     & voiced    & d                  &                    & g      & ɢ ⟨ġ⟩      &            &       \\ 
                            & voiceless & t                  &                    & k      & q          &            & ʔ ⟨’⟩ \\
                            & ejective  & tʼ                 &                    & kʼ     & qʼ         &            &       \\ 
   \Block{2-1}{Fricative}   & voiced    & \Block{2-1}{s ⟨s⟩} & \Block{2-1}{ʃ ⟨š⟩} &        & χ ⟨x⟩      &            &       \\ 
                            & voiceless &                    &                    &        & ʁ ⟨r⟩      & ħ ⟨ẋ⟩      & h     \\ 
   \Block{2-1}{Affricate}   & voiceless & ts ⟨z⟩             & t͡ʃ~ ⟨c⟩           &        &            &            &       \\ 
                            & ejective  & tsʼ ⟨zʼ⟩            & t͡ʃ ’ ⟨c’⟩          &         &            &            &       \\ 
   \Block{1-2}{Approximant} &           & l \tabularnote{More accurately, a lateral alveolar approximant.}& j & ɰ ⟨ğ⟩  & & ʕ ⟨â⟩      &          \\ 
\end{NiceTabular}
\end{table}

\end{document}

Output of the above code

0

When I zoom in it looks like the white stripes are caused by rounding errors in the positions of the cell borders and the horizontal lines. As in the solution you mentioned a small negative \vskip can solve this, but it seems that you need a bit more than -0.1pt. I got good results with -0.8pt. To compensate you can increase \arraystretch a bit. I put the \\[-0.8pt] together with the \\hline stuff in a macro so that it is easier to experiment. I also added a | to remove a small gap in the vertical line after the first column.

\documentclass{article}

\usepackage{multirow}
\usepackage{hhline}
\usepackage{xcolor,colortbl}
\usepackage{tablefootnote}
\definecolor{table}{rgb}{0.427,0.427,0.427}
\renewcommand{\arraystretch}{1.2}
\newcommand{\hhhline}[1]{\\[-0.8pt]\hhline{|>{\arrayrulecolor{table}}->{\arrayrulecolor{black}}|#1|}}
\begin{document}

  \begin{table}
    \centering
    \caption{Consonant Phoneme Chart}
    \arrayrulecolor{black}
    \begin{tabular}{|c|c|c|c|c|c|c|c|} 
        \hline
        \rowcolor{table} \multicolumn{2}{|c|}{}                                       & Alveolar                                                           & Palatal\tablefootnote{Palatoalveolar} & Velar  & Uvular & Pharyngeal & Glottal  \\ \hline
        \multicolumn{2}{|c|}{{\cellcolor{table}}Nasal}                                & n                                                                  &                                       & ŋ ⟨ň⟩  & ɴ ⟨ṅ⟩  &            &          \\ \hline
        {\cellcolor{table}}                            & {\cellcolor{table}}voiced    & d                                                                  &                                       & g      & ɢ ⟨ġ⟩  &            &           \hhhline{-------}
        {\cellcolor{table}}                            & {\cellcolor{table}}voiceless & t                                                                  &                                       & k      & q      &            & ʔ ⟨’⟩    \hhhline{-------}
        \multirow{-3}{*}{{\cellcolor{table}}Plosive}   & {\cellcolor{table}}ejective  & tʼ                                                                 &                                       & kʼ     & qʼ     &            &          \\ \hline
        {\cellcolor{table}}                            & {\cellcolor{table}}voiced    & \multirow{2}{*}{s ⟨s⟩}                                             & \multirow{2}{*}{ʃ ⟨š⟩}                &        & χ ⟨x⟩  &            &          \hhhline{-~~----|}
        \multirow{-2}{*}{{\cellcolor{table}}Fricative} & {\cellcolor{table}}voiceless &                                                                    &                                       &        & ʁ ⟨r⟩  & ħ ⟨ẋ⟩      & h        \\ \hline
        {\cellcolor{table}}                            & {\cellcolor{table}}voiceless & ts ⟨z⟩                                                             & t͡ʃ~ ⟨c⟩                               &        &        &            &          \hhhline{-------}
        \multirow{-2}{*}{{\cellcolor{table}}Affricate} & {\cellcolor{table}}ejective  & tsʼ ⟨zʼ⟩                                                           & t͡ʃ ’ ⟨c’⟩                             &        &        &            &          \\ \hline
        \multicolumn{2}{|c|}{{\cellcolor{table}}Approximant}                          & l \tablefootnote{More accurately, a lateral alveolar approximant.} & j                                     & ɰ ⟨ğ⟩  &        & ʕ ⟨â⟩      &          \\ \hline
    \end{tabular}
\end{table}
\end{document}

enter image description here

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.