1

I am using this code:

\documentclass{article}
\usepackage{collcell}
\usepackage{array}% actually already loaded by `collcell`
\newcommand*{\mymacro}[1]{\fbox{#1}}% Do anything you like with `#1`
\newcolumntype{C}{>{\collectcell\mymacro}c<{\endcollectcell}}

\begin{document}

\begin{tabular}{Cc}
  TestA  & A longer test cell \\
  \empty & The new version supports 'verb'! \\
\end{tabular}

\end{document}

, to apply some attributes to a single column. Is there a way to escape this for one cell (e.g. the top cell) of that column?

3

With \multicolumn that is easy:

\documentclass[svgnames]{article}
\usepackage{collcell}
\usepackage{array, makecell, xcolor}
\renewcommand\theadfont{\bfseries\color{Crimson!60!}}% actually already loaded by `collcell`
\newcommand*{\mymacro}[1]{\fbox{#1}}% Do anything you like with `#1`
\newcolumntype{C}{>{\collectcell\mymacro}c<{\endcollectcell}}

\begin{document}

\begin{tabular}{Cc}
\multicolumn{1}{c}{\thead{First Head}} & \thead{Second Head}\\
  TestA & A longer test cell \\
  \empty & The new version supports 'verb'! \\
\end{tabular}

\end{document} 

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.