\rowcolor 및 @{} 문제

\rowcolor 및 @{} 문제

다음 예에서는 서문 의 \rowcolor선언을 고려하지 않는 것을 볼 수 있습니다 .@{}tabular

여기에 이미지 설명을 입력하세요

이것이 정상적인 행동입니까? 허위로 채워진 공간을 피할 수 있는 우아한 방법이 있나요?

\documentclass{article}
\usepackage{xcolor, colortbl}

\begin{document}

\begin{tabular}{|c|c|c@{}|} 
\rowcolor{gray!30}
text & text & text
\end{tabular}

\end{document}

답변1

이는 귀하의 요구 사항을 충족할 수 있습니다.

여기에 이미지 설명을 입력하세요

\documentclass{article}
\usepackage{xcolor, colortbl}

\begin{document}

\begin{tabular}{|c|c|>{\kern-\tabcolsep}c<{\kern-\tabcolsep}|} 
\rowcolor{gray!30}
text & text & text
\end{tabular}

\end{document}

답변2

패키지는 nicematrix해당 환경과 함께 {NiceTabular}패키지의 문제를 해결하려고 시도합니다 colortbl.

다음은 의 출력입니다 {NiceTabular}.

\documentclass{article}
\usepackage{xcolor}
\usepackage{nicematrix}

\begin{document}
\begin{NiceTabular}{|c|c|c@{}|}[colortbl-like]
\Hline
\rowcolor{gray!30}
text & text & text\\
\Hline
\end{NiceTabular}
\end{document}

여러 가지 편집이 필요합니다.

위 코드의 출력

답변3

당신은 다음을 찾고 있습니까?

여기에 이미지 설명을 입력하세요

\documentclass{article}
\usepackage[table]{xcolor}

\begin{document}
    \begin{tabular}{|c|c| >{\columncolor{white}[\tabcolsep][0pt]}c @{}|}
\rowcolor{gray!30}
text & text & text
    \end{tabular}
\end{document}

관련 정보