\ rowcolor e @ {} problema

Sep 15 2020

Nel prossimo esempio possiamo vedere che \rowcolornon tiene conto della dichiarazione @{}nei tabularpreamboli.

È un comportamento normale? C'è un modo elegante per evitare quello spazio riempito spurio?

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

\begin{document}

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

\end{document}

Risposte

2 jsbibra Sep 15 2020 at 15:59

Questo potrebbe soddisfare le tue esigenze

\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

Il pacchetto nicematrixcon il suo ambiente {NiceTabular}cerca di risolvere i problemi del pacchetto colortbl.

Ecco l'output di {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}

Hai bisogno di diverse compilation.

2 Zarko Sep 15 2020 at 16:43

Cerchi:

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