\ rowcolor e @ {} problema

Sep 15 2020

No próximo exemplo, podemos ver que \rowcolornão leva em consideração a declaração @{}nos tabularpreâmbulos.

Este é um comportamento normal? Existe alguma maneira elegante de evitar esse espaço preenchido espúrio?

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

\begin{document}

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

\end{document}

Respostas

2 jsbibra Sep 15 2020 at 15:59

Isso pode atender às suas necessidades

\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

A embalagem nicematrixcom seu ambiente {NiceTabular}tenta resolver os problemas da embalagem colortbl.

Aqui está o 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}

Você precisa de várias compilações.

2 Zarko Sep 15 2020 at 16:43

Você está procurando por:

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