1

I have the exact opposite problem described in this question : Remove vertical line in tabular head

In my case, I am using this code :

\documentclass[a4paper, 10pt]{article}
\usepackage{booktabs}
\usepackage{tabularx}

\begin{document}
\begin{tabularx}{\textwidth}{@{}lX|llll|llllllll@{}}
\toprule
 Title 1 & Title 2 & \multicolumn{4}{l}{Title 3} & \multicolumn{4}{l}{Title 4} \\
         &         & N & R & F & I            &  N & R & F & I           \\
\midrule
Foo      & Bar     & f & o & o & o            &  b & a & r & r            \\
\bottomrule

\end{tabularx}
\end{document}

As you can see, the vertical line on the left of the 3rd column does not show in the header, which is exactly the expected behaviour when using multicolumn according to the question I linked.

What should I do for the vertical line to show in the heading line ?

2

You need to put \multicolumn{4}{l|}{Title 3} (note l|) so as to put a vertical line after Title 3.

\documentclass[a4paper, 10pt]{article}
\usepackage{booktabs}
\usepackage{tabularx}

\begin{document}
\begin{tabularx}{\textwidth}{@{}lX|llll|llllllll@{}}
\toprule
 Title 1 & Title 2 & \multicolumn{4}{l|}{Title 3} & \multicolumn{4}{l}{Title 4} \\
         &         & N & R & F & I            &  N & R & F & I           \\
\midrule
Foo      & Bar     & f & o & o & o            &  b & a & r & r            \\
\bottomrule

\end{tabularx}
\end{document}

enter image description here

But as the saying goes here in the site, vertical lines are evil and you should be using booktabs (See the gap in those vertical lines at horizontal line intersections..

  • @ThomasF.Sturm I had been away for a while so still picking up my speed. :) Thanks. – user11232 Jan 16 '15 at 12:26

Your Answer

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