Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I combine cells in a row in a latex-table?

Tags:

latex

tex

In a table I want to combine some of the columns, but not in all rows. How can I realize this with LaTeX?

like image 516
Mnementh Avatar asked Jan 13 '09 18:01

Mnementh


People also ask

How do I merge cells in a row in LaTeX?

Merging cells In LaTeX you can merge cells horizontally by using the \multicolumn command. It has to be used as the first thing in a cell. \multicolumn takes three arguments: The number of cells which should be merged.

How do I merge cells in a row in a table?

Highlight two or more cells in your table. Right-click the highlighted cells. Click Table and then select Merge Cells.

How can you merge two cells in a table horizontally?

Merge cells For example, you can merge several cells horizontally to create a table heading that spans several columns. Select the cells that you want to merge. Under Table Tools, on the Layout tab, in the Merge group, click Merge Cells.


1 Answers

\multicolumn{<number>}{<formatting>}{<contents>}

Where the arguments are

  1. Number of columns to merge
  2. the justification and formating string (just like you use in the table header, i.e. "|c|" or the like)
  3. The contents to put in the merged columns

This command simply replaces the <number> columns and is used inline.


Addition: This is also how you change the formatting of a single field in only one row of the table. Just use \multicolumn{1}{<new format>}{<contents>}.

like image 128
dmckee --- ex-moderator kitten Avatar answered Oct 18 '22 19:10

dmckee --- ex-moderator kitten