0

How do I take out that little vertical line underneath "this"??? Where do i have to fix it? Also how to adjust spacing between the rows?

enter image description here

`

\documentclass{article}
\usepackage{multirow}

\begin{document}
    \begin{table}
    \begin{tabular}{ |c|c|c|c|c|c|c | }
    \cline{1-7}
        \multirow{3}{*}{State} & \multicolumn{2}{c|}{\multirow{2}{*}{this}} & \multicolumn{4}{c|}{This work  } \\ 
        \cline {4-7} 
        { } & {} & {} & \multicolumn{2}{c|}{real} & \multicolumn{2}{c|}{complex} \\
        \cline{2-7}
    {} & 1 & 2 & 3 & 4 & 5 & 6\\
             \cline{1-7}
     $2$ & 0 & 0 & 0 & 0 & 0 & 0 \\
     $2$ & 1 & 5 & 2 & 5 & 2 & 5 \\
    \cline{1-7}
    \end{tabular}
    \end{table}
\end{document}`
1
  • Welcome to TeX.SX! It is easier to help you if you post a full minimal working example rather than just small chunks of code. A MWE should compile and be as small as possible to demonstrate your problem. You can highlight code in your post using back-ticks. To highlight code-blocks, either indent them by four spaces or use the {} on the gui. – user30471 Sep 22 '16 at 3:38
2

To get rid of the vertical line below "this" you just put \multicolumn2{c|}{} into the second line of your tabular environment.

Having said this, there are good typographical reasons not to use vertical rules in your tables at all: see the booktabs manual for a discussion of this issue. For these reasons I recommend removing all of the vertical rules from your table. For comparison, here is your table together with a second version that uses horizontal rules from booktabs:

enter image description here

Of course, you should use whichever version you think is better!

Here is the updated MWE:

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

\begin{tabular}{ |c|c|c|c|c|c|c | }
\cline{1-7}
    \multirow{3}{*}{States} & \multicolumn{2}{c|}{\multirow{2}{*}{this}} & \multicolumn{4}{c|}{This work  } \\
    \cline {4-7}
    { } & \multicolumn2{c|}{} & \multicolumn{2}{c|}{real-range} & \multicolumn{2}{c|}{complex-range} \\
    \cline{2-7}
{} & 1 & 2 & 3 & 4 & 5 & 6\\
         \cline{1-7}
 $2^{-}$ & 0.798 & 0.648 & 0.74 & 0.59 & 0.78 & 0.60 \\
 $2^{-}$ & 1.27 & 5.57 & 2.10 & 5.82 & 2.05 & 5.60 \\
\cline{1-7}
\end{tabular}

\bigskip

\begin{tabular}{ *7c }\toprule
    \multirow{3}{*}{States} & \multicolumn{2}{c}{\multirow{2}{*}{This}} & \multicolumn{4}{c}{This work  } \\
    \cmidrule {4-7}
     & & & \multicolumn{2}{c}{real-range} & \multicolumn{2}{c}{complex-range} \\
    \midrule
    & 1 & 2 & 3 & 4 & 5 & 6\\
   \midrule
   $2^{-}$ & 0.798 & 0.648 & 0.74 & 0.59 & 0.78 & 0.60 \\
   $2^{-}$ & 1.27 & 5.57 & 2.10 & 5.82 & 2.05 & 5.60 \\ \bottomrule
\end{tabular}
\end{document}

The advantage of the booktabs macros \toprule, \midrule, \cmidrule and \bottomrule, over the standard \hline and \cline, is that they have slightly different widths.

3
  • Oh god thank you so much! I was trying to fix/add some stuff as you advised. Will post full mini examples from now on. Have a good day :) – Bell Sep 22 '16 at 4:06
  • @Mico Thanks, you're right of course. I've taken them out. – user30471 Sep 22 '16 at 5:24
  • I would take rid of \multirow altogether; there's no point in making such a stair-shaped pattern if you adopt booktabs rules; probably there should be a \cmidrule(lr){2-3} below “This”, which also requires \cmidrule(l){4-7} below “This work”. – egreg Sep 22 '16 at 9:35

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.