I have a very wide table (code below). I would like to put a small gap between the data under "First Group" and "Second Group" - two of the main multicolumns column headers. I tried putting in a double pipe (||) between these two columns where I specify the longtable. It splits the table but it behaves very weirdly in the multicolumn rows. How can I make the table split cleanly from top to bottom, hopefully without having to wade through the miles of code looking for &s? Thanks for your time!

Code for my table follows:

\usepackage[portrait, total={5.45in, 8.5in}, top=1.25in, bottom=1.25in, right=1.25in, left=1.5in, centering]{geometry}


\scriptsize{\textbf{A very wide table with two groups}}\end{center}

&\multicolumn{9}{c}{First Group}&\multicolumn{9}{c}{Second Group}\\\cmidrule(lr){2-10}\cmidrule(lr){11-19}
something&\multicolumn{2}{c}{AB} & \multicolumn{3}{c}{ABCD} & \multicolumn{4}{c||}{ABCD EFGH}&\multicolumn{2}{c}{AB} & \multicolumn{3}{c}{ABCD} & \multicolumn{4}{c}{ABCD EFGH}\\\cmidrule(lr){2-3}\cmidrule(lr){4-6}\cmidrule(lr){7-10}\cmidrule(lr){11-12}\cmidrule(lr){13-15}\cmidrule(lr){16-19}
Characteristics & + & - & I & II & III & $L^{A}$ & $L^{B}$ & $H^{+}$ & TN & + & - & I & II & III & $L^{A}$ & $L^{B}$ & $H^{+}$ & TN\\
\multicolumn{10}{l}{\textbf{The first subheading}}\\\hline
some variable &+&+&-&+&+&-&-&-&-&-&+&+&-&-&+&+&-&-\\\hline
some other variable &+&+&-&+&+&-&-&-&-&-&+&+&-&-&+&+&-&-\\\hline

Resulting table (after edits suggested by D. Carlisle): Table with pipes and multicolumns as suggested in answer 1.

2 Answers 2


whenever you use a \multicolumn that ends in a column that has any | or @{...} material in its right hand edge, you need to re-insert it so if you have


then typically you will need

\multicolumn{2}{|c||}{heading for 1st 2 columns}&
\multicolumn{2}{c|}{heading for 2nd 2 columns}\\

This applies to all LaTeX tabular environments.

  • Thanks very much for the fast response. I will keep this helpful tip in mind for future tables. Unfortunately, it doesn't help this table completely. I shortened the number of columns for the only multicolumn subheading that crossed the || and have modified the multicolumns with ABCD EFGH and AB as suggested. Now the split doesn't make it in 2 of the rows with regular columns (the one with the H+ TN .. and the last row with "some other variable"). Is there another solution to splitting rather than fighting with pipes?
    – Ariel
    Commented Feb 27, 2012 at 13:35
  • 1
    Your vertical lines are there, but shifted up by strange amounts, whatever \cmidrule(lr){2-10}\cmidrule(lr){11-19} does it really doesn't like vertical rules. If I comment out each line that has those, the vertical lines shift back in to position. You could just use standard LaTeX \cline instead, possibly? Commented Feb 27, 2012 at 14:36
  • I used \cmidrule from the booktabs package. The main advantage of using \cmidrule is that the rule does not touch the "walls" of the cell. Using \cline makes it appear as a continuous rule undistinguished from \hline. \cmidrule comes with a small space before and after the rule separating it from the text in the cells. I wonder if this space is interfering with the vertical rules.
    – Ariel
    Commented Feb 27, 2012 at 15:42
  • 2
    Yes I know but the booktabs documentation famously warns you that vertical rules are considered evil, so its horizontal rule commands not working with vertical rules may perhaps not be considered a bug. perhaps give up with the || and just have @{\hspace{....}} extra gap instead Commented Feb 27, 2012 at 16:44
  • I ended up doing a hacky 5pt wide white vertical rule to achieve the separate blocks effect. (Attached a screenshot above). Not perfect, but better than the || solution. Thanks again for your help.
    – Ariel
    Commented Feb 28, 2012 at 15:41

Based on David Carlisle's answer and comments, this hack gives a better impression of the longtable being split into two distinct blocks. It uses a wide vertical white rule to split the parts of the table. Hence it looks better if the all the table rows (or just alternate rows) are coloured with a different colour other than white.

\begin{longtable}{lp{0.3cm}p{0.3cm}p{0.3cm}p{0.3cm}p{0.3cm}p{0.3cm}p{0.3cm}p{0.3cm}p{0.3cm}!{\color{white}\vrule width 5pt}p{0.3cm}p{0.3cm}p{0.3cm}p{0.3cm}p{0.3cm}p{0.3cm}p{0.3cm}p{0.3cm}p{0.3cm}p{0.3cm}}

lead to: Table with wide 5pt white vertical rule emulating a break in the longtable

One more interesting fact I learnt through this question is that it is possible to make vertical rules play well with multicolumns as well as the tricky booktabs package by using the vrule option.

For example, this code

               p{0.3cm}!{\color{white}\vrule width 4pt}

leads to:

Table with vertical rules and booktabs playing well

Not perfect, but functional and somewhat less ugly than the the | or || solution.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .