I'm making a large table. Most rows have three entries. Some rows have two. It'd be nice if there was a multicolumn-like command that could help me with this. E.g. I wish the following code:

 1 &  2 &  3 \\
\multicolumn{3}{c|c}{ 4 &  5} \\
 6 &  7 &  8

Would produce the table it kinda seems like it should. Alas! The multicolumn command cannot take c|c for its second argument. Is there a nice workaround? An alternative defined in some other package? Some obvious hack to accomplish the same thing?

  • 1
    multicolum can merge given number of cells only into one cell! It seems that you like to change table structure with nesting new table into multicolumn cell.
    – Zarko
    Aug 1 '16 at 22:02

Try the following:


 1 &  2 &  3        \\
                         4 &  5
                     \end{tabular}}   \\
 6 &  7 &  8

This in your simple case gives:

enter image description here

You should be aware, that in above code the width of cells is accommodated to their contents, so the table quickly become very ugly. You need to reconsider if such table changes is really necessary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.