I am trying to create a table in which a column consists entirely of chemical formulae. I would like to use the array package to automatically insert the \ce{...} command, taking the cell's content as argument.
I understand from “\bgroup and \egroup? ” that \bgroup and \egroup only work for replacements for low level commands like \textbf. Unfortunately I do not understand how to use the realboxes package provided there to make it work. I cannot assess if it is appropriate for that task in the first place.
Here is a minimal not working example of what I am trying to do:
\documentclass{article}
\usepackage[version=4]{mhchem}
\usepackage{array}
\begin{document}
\begin{tabular}{>{\textbf\bgroup}l<{\egroup}%
>{\ce\bgroup}l<{\egroup}}\hline
R1 & -C6H5 \\
R2 & -C6H4F \\\hline
\end{tabular}
\end{document}

\bgroupand\egroupwork with\textbf. They just seem to, but it's by pure chance. – egreg Jun 28 '16 at 09:03\textbfis a low level command. – Martin - マーチン Jun 28 '16 at 09:05