Problema de \ rowcolor y @ {}

Sep 15 2020

En el siguiente ejemplo podemos ver que \rowcolorno tiene en cuenta la declaración @{}en los tabularpreámbulos.

¿Es este un comportamiento normal? ¿Hay alguna forma elegante de evitar ese espacio lleno de espurios?

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

\begin{document}

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

\end{document}

Respuestas

2 jsbibra Sep 15 2020 at 15:59

Esto podría cumplir con sus requisitos

\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

El paquete nicematrixcon su entorno {NiceTabular}intenta resolver los problemas del paquete colortbl.

Aquí está el resultado de {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}

Necesita varias compilaciones.

2 Zarko Sep 15 2020 at 16:43

Buscas:

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