\ rowcolor et @ {} problème

Sep 15 2020

Dans l'exemple suivant, nous pouvons voir que \rowcolorcela ne prend pas en compte la déclaration @{}dans les tabularpréambules.

Est-ce un comportement normal? Existe-t-il un moyen élégant d'éviter cet espace rempli de faux?

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

\begin{document}

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

\end{document}

Réponses

2 jsbibra Sep 15 2020 at 15:59

Cela pourrait répondre à vos besoins

\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

Le package nicematrixavec son environnement {NiceTabular}tente de résoudre les problèmes du package colortbl.

Voici la sortie 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}

Vous avez besoin de plusieurs compilations.

2 Zarko Sep 15 2020 at 16:43

Cherchez-vous:

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