rowcolor는 테이블의 수직선을 제거합니다.

rowcolor는 테이블의 수직선을 제거합니다.

pdflatex다음을 컴파일(사용)한 후

\documentclass[12pt]{amsart}
\usepackage{amsmath,amsthm,amssymb,amsxtra,amsopn}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{etoolbox}
\begin{document}
\begin{tabular}{|c|c|c|}
\hline
\rowcolor{lime!20}Item 1 & Item 2 & Item 3 \\
\hline
text & text & text\\
\hline
\end{tabular}
\end{document}

테이블의 일부 테두리가 보이지 않습니다. 확대하면 테두리가 보입니다. 나는 \rowcolor또는 명령을 사용하여 그러한 테이블을 처리할 때 이런 유형의 이상한 동작을 관찰합니다 \cellcolor. 확대/축소 없이 출력 테이블의 테두리가 보이도록 코드를 수정하는 방법.

답변1

또 다른 옵션은 새 tabularray패키지(CTAN). 여기 \SetRow에는 색상을 포함하여 현재 행의 모든 ​​속성을 수정하는 데 사용할 수 있는 명령이 있습니다 . 이를 사용하면 Adobe Acrobat Reader에서 수직선이 올바르게 나타납니다.

올바른 수직선

\documentclass[12pt]{amsart}
\usepackage{amsmath,amsthm,amssymb,amsxtra,amsopn}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{etoolbox}
\usepackage{tabularray}

\begin{document}
    rowcolor solution
    
    \begin{tabular}{|c|c|c|}
        \hline
        \rowcolor{lime!20}Item 1 & Item 2 & Item 3 \\
        \hline
        text & text & text\\
        \hline
    \end{tabular}
    \vspace{1cm}
    
    tabularray solution
    
    \begin{tblr}{|c|c|c|}
        \hline
        \SetRow{lime!20} Item 1 & Item 2 & Item 3 \\
        \hline
        text & text & text\\
        \hline
    \end{tblr}
\end{document}

참고: 패키지에는 다른(더 나은) 기본 간격이 있으며 원하는 대로 rowsep및 키를 사용하여 수정할 수 있습니다.colsep

편집: 정확히 원인이 무엇인지는 모르지만 수직그리고수평선은 솔루션 이 있는 컬러 셀의 너비가 모두 동일하지 않습니다 colortbl. tabularray확대/축소 수준에 관계없이 아티팩트가 발생하지 않기 때문에 "인코딩"이 우수한 것 같습니다 .

Zarko가 자신의 의견에서 지적했듯이 tabularray패키지는 서식 지정을 위한 매우 훌륭한 키-값 인터페이스도 지원합니다.

\begin{tblr}{
        hlines, vlines, cells = {c}, 
        row{1} = {bg=lime!20},
    }
    Item 1 & Item 2 & Item 3 \\ 
    text   & text   & text   \\     
\end{tblr}

답변2

{NiceTabular}을 사용할 수 있습니다 nicematrix. 사용하는 PDF 뷰어(및 확대/축소 수준)에 관계없이 규칙은 사라지지 않는 것 같습니다.

\documentclass[12pt]{amsart}
\usepackage[table]{xcolor}
\usepackage{nicematrix}

\begin{document}

With \verb|{tabular}| (and \verb|colortbl|).

\medskip
\begin{tabular}{|c|c|c|}
\hline
\rowcolor{lime!20}Item 1 & Item 2 & Item 3 \\
\hline
text & text & text\\
\hline
\end{tabular}


\vspace{1cm}

With \verb|{NiceTabular}| of \verb|nicematrix|.

\medskip
\begin{NiceTabular}{|c|c|c|}[colortbl-like]
\hline
\rowcolor{lime!20}Item 1 & Item 2 & Item 3 \\
\hline
text & text & text\\
\hline
\end{NiceTabular}

\end{document}

여러 컴파일이 필요합니다( nicematrix내부적으로 PGF/Tikz 노드를 사용하기 때문에).

위 코드의 출력

관련 정보