O'Reilly logo

LaTeX Beginners Guide by Stefan Kottwitz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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:

  1. 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} ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required