Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
\begin{table*}
\renewcommand\arraystretch{2}
    \begin{tabular}{|c|c|c|c|c|c|c|c|c|}
    \cline{3-9} 
&&\multicolumn{7}{|c|}{Hashtag-dataset}
\\\cline{3-9} 
    &&Joy & Fear &Sadness &Thankfulness & Anger & Surprise & Love
   \\  \cline{1-9} 

&    Joy          & 70,80\% & 5,78\% & 3,53\% & 22,89\% & 1,62\% & 16,73\% & 19,63\% \\ \cline{2-9}
   \multirow{4}{*}{\rotatebox[origin=c]{90}{Crowdsource-set}} &  Fear         & 3,53\% & 69,77\% & 2,94\% & 1,66\% & 1,37\% & 5,53\% & 1,32\% \\ \cline{2-9}
   &  Sadness      & 5,61\% & 12,97\% & 74,33\% & 4,72\% & 16,06\% & 40,84\% & 6,12\% \\  \cline{2-9}
   & Thankfulness & 4,31\% & 0,59\% & 0,56\% & 53,22\% & 0,20\% & 1,36\% & 6,59\% \\ \cline{2-9}
   & Anger        & 2,74\% & 9,13\% & 15,06\% & 2,79\% & 79,28\% & 20,40\% & 2,21\% \\ \cline{2-9}
   & Surprise     & 0,70\% & 0,21\% & 0,23\% & 0,35\% & 0,18\% & 8,12\% & 0,30\% \\ \cline{2-9}
   & Love         & 12,31\% & 1,56\% & 3,34\% & 14,37\% & 1,30\% & 7,03\% & 63,83\% \\ 
\hline
    \end{tabular}
    \caption {Redistribution of the labels from the hasthag-dataset to the crowdsource-dataset}
\end{table*}

enter image description here

I'm not sure how to remove those 2 vertical lines at the left-hand side of the table.

Any help?

share|improve this question
1  
That did the trick. Thank you. If you want you can answer the question so I can accept your answer. –  Ojtwist Jan 8 at 15:41

2 Answers 2

up vote 7 down vote accepted

You need to re-set the first two columns in the location where you want to remove the vertical rules, since these rules are set in the tabular column specification, and filters down with each row. Below I've corrected for that, plus I've added a booktabs view on things:

enter image description here

\documentclass{article}
\usepackage{graphicx,booktabs,multirow}% http://ctan.org/pkg/{graphicx,booktabs,multirow}
\begin{document}
\begin{table}
  \renewcommand\arraystretch{2}
  \begin{tabular}{|c|c|c|c|c|c|c|c|c|}
    \cline{3-9} 
    \multicolumn{2}{c|}{} & \multicolumn{7}{c|}{Hashtag-dataset} \\
    \cline{3-9} 
    \multicolumn{2}{c|}{} & Joy & Fear & Sadness & Thankfulness & Anger & Surprise & Love \\
    \hline 
    &    Joy          & 70,80\% & 5,78\% & 3,53\% & 22,89\% & 1,62\% & 16,73\% & 19,63\% \\
    \cline{2-9}
    \multirow{5}{*}{\rotatebox[origin=c]{90}{Crowdsource-set}} 
      & Fear & 3,53\% & 69,77\% & 2,94\% & 1,66\% & 1,37\% & 5,53\% & 1,32\% \\
    \cline{2-9}
      &  Sadness      & 5,61\% & 12,97\% & 74,33\% & 4,72\% & 16,06\% & 40,84\% & 6,12\% \\
    \cline{2-9}
      & Thankfulness & 4,31\% & 0,59\% & 0,56\% & 53,22\% & 0,20\% & 1,36\% & 6,59\% \\
    \cline{2-9}
      & Anger        & 2,74\% & 9,13\% & 15,06\% & 2,79\% & 79,28\% & 20,40\% & 2,21\% \\
    \cline{2-9}
      & Surprise     & 0,70\% & 0,21\% & 0,23\% & 0,35\% & 0,18\% & 8,12\% & 0,30\% \\
    \cline{2-9}
      & Love         & 12,31\% & 1,56\% & 3,34\% & 14,37\% & 1,30\% & 7,03\% & 63,83\% \\ 
    \hline
  \end{tabular}
  \caption {Redistribution of the labels from the hasthag-dataset to the crowdsource-dataset}
\end{table}

\begin{table}
  \renewcommand\arraystretch{2}
  \begin{tabular}{l*{7}{c}}
    \toprule
    \multirow{2}{*}{\begin{tabular}{@{}c@{}}Crowdsource-\\dataset\end{tabular}} 
      & \multicolumn{7}{c}{\textbf{Hashtag-dataset}} \\
    \cmidrule{2-8} 
    & Joy & Fear & Sadness & Thankfulness & Anger & Surprise & Love \\
    \midrule
      Joy          & 70,80\% & 5,78\% & 3,53\% & 22,89\% & 1,62\% & 16,73\% & 19,63\% \\
      Fear         & 3,53\% & 69,77\% & 2,94\% & 1,66\% & 1,37\% & 5,53\% & 1,32\% \\
      Sadness      & 5,61\% & 12,97\% & 74,33\% & 4,72\% & 16,06\% & 40,84\% & 6,12\% \\
      Thankfulness & 4,31\% & 0,59\% & 0,56\% & 53,22\% & 0,20\% & 1,36\% & 6,59\% \\
      Anger        & 2,74\% & 9,13\% & 15,06\% & 2,79\% & 79,28\% & 20,40\% & 2,21\% \\
      Surprise     & 0,70\% & 0,21\% & 0,23\% & 0,35\% & 0,18\% & 8,12\% & 0,30\% \\
      Love         & 12,31\% & 1,56\% & 3,34\% & 14,37\% & 1,30\% & 7,03\% & 63,83\% \\ 
    \bottomrule
  \end{tabular}
  \caption {Redistribution of the labels from the hasthag-dataset to the crowdsource-dataset}
\end{table}

\end{document}

You could also consider using an r-column or even dcolumn to improve the alignment of your data.

share|improve this answer

A solution using S-columns from the siunitx package:

\documentclass{article}

\usepackage[
%  locale = DE
]{siunitx}
\usepackage{booktabs,multirow}

\begin{document}

\begin{table}
 \renewcommand\arraystretch{1.5}
  \begin{tabular}{l *{7}{S[table-format = 2.2]}}
    \toprule
     \multirow{2}{*}{\begin{tabular}{@{}c@{}}Crowdsource-\\dataset\end{tabular}} & \multicolumn{7}{c}{\textbf{Hashtag-dataset}}                  \\
     \cmidrule{2-8}
                   & {Joy}           & {Fear}          & {Sadness}       & {Thankfulness}  & {Anger}         & {Surprise}      & {Love}          \\
     \midrule
                   & {\si{\percent}} & {\si{\percent}} & {\si{\percent}} & {\si{\percent}} & {\si{\percent}} & {\si{\percent}} & {\si{\percent}} \\
    \midrule
      Joy          & 70.80           &  5.78           &  3.53           & 22.89           &  1.62           & 16.73           & 19.63           \\
      Fear         &  3.53           & 69.77           &  2.94           &  1.66           &  1.37           &  5.53           &  1.32           \\
      Sadness      &  5.61           & 12.97           & 74.33           &  4.72           & 16.06           & 40.84           &  6.12           \\
      Thankfulness &  4.31           &  0.59           &  0.56           & 53.22           &  0.20           &  1.36           &  6.59           \\
      Anger        &  2.74           &  9.13           & 15.06           &  2.79           & 79.28           & 20.40           &  2.21           \\
      Surprise     &  0.70           &  0.21           &  0.23           &  0.35           &  0.18           &  8.12           &  0.30           \\
      Love         & 12.31           &  1.56           &  3.34           & 14.37           &  1.30           &  7.03           & 63.83           \\ 
    \bottomrule
  \end{tabular}
 \caption{Redistribution of the labels from the hasthag-dataset to the crowdsource-dataset.}
\end{table}

\end{document}

output

Note that

(1) the siunitx package can handle both the alignment within the columns and typeset physical quantities correct,

(2) I have moved the units up above the columns; this increases the readability.

P.S. The code for the top of the table is stolen from Werner's answer.

share|improve this answer
1  
You could simplify the setup of the columns by writing *{7}{S[table-format = 2.2]}. I also see little virtue in writing {\si{\percent}} instead of {\%}. –  Mico Jan 8 at 19:42
    
I wouldn't write % in a different line: I would put it next to Joy, Fear, etc. or next to each number (like in the original table. –  Manuel Jan 8 at 20:02
    
@Mico The {\si{\percent}} is simply because I think siunitx allows a very useful notation. (I didn't knew about the possibility of using the simplified notation that you mentioned; I'll update my answer.) –  Svend Tveskæg Jan 8 at 20:07
    
@Manuel I like this way of separating the numbers from the units. It is (much?) easier to read the table. –  Svend Tveskæg Jan 8 at 20:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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