This is related to a previous question that was well answered by egreg. I would like to typeset the following without the vlines around cells (1,0) and (3,0):
Using the code below, would, in principle, do that. However, the \refstepcounter call before the \multicolumn gives an \omit related error, like in the previous question. Tried various things, but in general the question is, how to affect some logic per table row, in a single macro, when the first cell in that row is a \multicolumn given that, apparently, \multicolumn must be the first command in an expansion?
\documentclass{article}
\usepackage{longtable}
\newcounter{tablerowi}
\NewExpandableDocumentCommand{\mc}{m}{\multicolumn{1}{l}{#1}}
\NewExpandableDocumentCommand{\tableRow}{smm}{%
\IfBooleanTF{#1}{%
\mc{} & \mc{#3} & \mc{\thetablerowi} \
}{%
\refstepcounter{tablerowi}
\mc{#2} & \mc{#3} & \mc{\thetablerowi} \
}
}
\begin{document}
\begin{longtable}[c]{|p{2.5cm}|p{2.5cm}|p{2.5cm}|}
\hline
month & name & month #\\hline
\tableRow{November}{Election Day}
\tableRow{November}{Thanksgiving}
\tableRow{December}{Advent}
\tableRow{December}{Christmas}\hline
\end{longtable}
\end{document}
