Time for action – merging cells
Regarding our example table, commands and declarations are both input, whereas, the remaining column contains output. We shall emphasize that in our header:
In our example, insert another header row. Use
\multicolumn
to merge cells. Alter the column formatting argument and the middle rule. Changes are highlighted:\begin{tabular}{@{}*3l@{}} \toprule[1.5pt] \multicolumn{2}{c}{\head{Input}} & \multicolumn{1}{c}{\head{Output}}\\ \head{Command} & \head{Declaration} & \\ \cmidrule(r){1-2}\cmidrule(l){3-3} \verb|\textrm| & \verb|\rmfamily| & \rmfamily Example text\\ \verb|\textsf| & \verb|\sffamily| & \sffamily Example text\\ \verb|\texttt| & \verb|\ttfamily| & \ttfamily Example text\\ \bottomrule[1.5pt] \end{tabular}
Typeset and see the output:
What just happened?
We used the command \multicolumn
twice; once to merge two cells and surprisingly another time just for one cell. Let's first look at its definition:
\multicolumn...