I try to define macro for shortcut form \multiline{1}{<pcolumn type>}{\textbf{text}}
:
\documentclass[12pt,border=1mm,preview]{standalone}
\newcommand\mcbf[2]{\multicolumn{1}{#1}{\textbf{#2}}}
\begin{document}
\begin{tabular}{lr}
\hline
\mcbf{|c|}{AAA} & \mcbf{c|}{BBB} \\ \hline
\end{tabular}
\end{document}
Which work as expected. Since in the most a case I use the same column specifier i try to redefine this macro so, that the default column type is for example c|
:
\documentclass[12pt,border=1mm,preview]{standalone}
\newcommand\xmcbf[2][c|]{\multicolumn{1}{#1}{\textbf{#2}}}
\begin{document}
\begin{tabular}{lr}
\xmcbf[|c|]{AAA} & \mcbf{BBB} \\ \hline
C & D \\ \hline
\end{tabular}
\end{document}
Which gives error:
\multispan ->\omit
\@multispan
What I miss in \newcommand
definition? My (probably clumsy) search in SE doesn't gives useful information.
\mcbf
is a typo for\xmcbf