3

Is there any way to force a break in the horizontal rule running across two adjacent cells of a table. To be more precise, here is what I'm looking for:

enter image description here

Notice how I wish the lines to fall short of the left and right borders of the table as well. I would really appreciate it if someone can provide a simple and compact solution.

This is the usual scenario for comparing against:

enter image description here

Here is the simple code for quick access:

\begin{tabular}{ccccc}
\hline
\multirow{2}{*}{C1} & \multicolumn{2}{c}{C2} & \multicolumn{2}{c}{C3} \\ \cline{2-3} \cline{4-5}
                    & C21 & C22              & C31 & C32            \\ \hline
Val1                & Val2 & Val3            & Val4 & Val5 \\ 

\end{tabular}
  • Please add a minimal working example. – Svend Tveskæg Apr 6 '13 at 6:12
  • While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. – Peter Grill Apr 6 '13 at 6:48
  • @PeterGrill - Will keep that in mind from now on. Thank you very much – Chatterjee Apr 6 '13 at 6:56
5

You could use the booktabs package:

enter image description here

Code:

\documentclass{article}
\usepackage{multirow}
\usepackage{booktabs}

\begin{document}
\begin{tabular}{ccccc}
\hline
\multirow{2}{*}{C1} & \multicolumn{2}{c}{C2} & \multicolumn{2}{c}{C3} \\ 
\cmidrule(lr){2-3} \cmidrule(lr){4-5}
                    & C21 & C22              & C31 & C32            \\ 
\cmidrule(lr){1-1} \cmidrule(lr){2-3} \cmidrule(lr){4-5}
Val1                & Val2 & Val3            & Val4 & Val5 \\ 

\end{tabular}
\end{document}

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.