\ rowcolor и @ {} проблема

Sep 15 2020

В следующем примере мы видим, что \rowcolorне учитывается декларация @{}в tabularпреамбулах.

Это нормальное поведение? Есть ли какой-нибудь элегантный способ избежать этого ложного заполненного пространства?

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

\begin{document}

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

\end{document}

Ответы

2 jsbibra Sep 15 2020 at 15:59

Это может удовлетворить ваши требования

\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}
4 F.Pantigny Sep 15 2020 at 16:40

Пакет 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}

Вам нужно несколько сборников.

2 Zarko Sep 15 2020 at 16:43

Вы ищите:

\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}