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.

I'd appreciate if somebody could help me with this. I'd like to eliminate the vertical lines of the 8th row. I haven't been able to get it.

\begin{table}
\footnotesize
\begin{tabular}{| >{\centering\arraybackslash}m{0.50in} | >    {\centering\arraybackslash}m{0.9in} || >{\centering\arraybackslash}m{0.50in} | >{\centering\arraybackslash}m{0.9in} || >{\centering\arraybackslash}m{0.50in} | >{\centering\arraybackslash}m{0.9in}|}\hline
Category Index  & Category Name & Category Index  & Category Name & Category Index  & Category Name\\
\hline\hline
1         & animation  & 7   & sci-fi   & 13 & war \\
\hline
2         & action     & 8   & comedy   & 14 & mystery \\
\hline
3         & film-noir  & 9   & thriller & 15 & musical \\
\hline
4         & children's & 10  & fantasy  & 16 & romance \\
\hline
5         & adventure  & 11  & horror   & 17 & IMAX \\
\hline
6         & crime      & 12  & western  & 18 & drama \\
\hline
          &            &     &          & 19  & documentary\\ \cline{5-6}
\end{tabular}
\end{table}

Many thanks in advance for your help.

share|improve this question
    
Welcome to TeX.sx! A standard trick is to use a \multicolumn for that particular 'cell' –  cmhughes Feb 21 '13 at 18:14
    
Just leave out the respective | in the table header. –  vonbrand Feb 22 '13 at 1:19

2 Answers 2

So many lines!

Here is a suggestion that does not use vertical lines and only a few horizontal ones from the booktabs package.

As your setting made the tabular wider than the standard text width of the article class, I have set the content in a tabularx from the package of the same name.

I also think that it is not necessary to add “Category” to the header of the “Index” column. Context or a good caption should be enough for the readers to figure that out on their own. (One might even remove “Category” from the “Name” column.)

If you still want to use a two-liner as a header, you can use a nested tabular and the \ml macro defined as

\newcommand*{\ml}[2][c]{\begin{tabular}[t]{@{}#1@{}}#2\end{tabular}}

and used as

\ml{Category\\ Index} & Category Name & \ml{Category\\ Index} & Category Name
                                      & \ml{Category\\ Index} & Category Name \\ 

Code

\documentclass{article}
\usepackage{tabularx,booktabs}
\setlength{\cmidrulekern}{.25em}
\begin{document}
\footnotesize
\begin{table}
\caption{Available genre categories and their respective index.}
\footnotesize
\begin{tabularx}{\linewidth}{*3{c >{\centering\arraybackslash}X}}
    \toprule
    Index & Category Name & Index & Category Name & Index & Category Name \\ \cmidrule(lr){1-2} \cmidrule(lr){3-4} \cmidrule(lr){5-6}
    1     & animation     & 7     & sci-fi        & 14    & mystery       \\
    2     & action        & 8     & comedy        & 15    & musical       \\
    3     & film-noir     & 9     & thriller      & 16    & romance       \\
    4     & children's    & 10    & fantasy       & 17    & IMAX          \\
    5     & adventure     & 11    & horror        & 18    & drama         \\
    6     & crime         & 12    & western       & 19    & documentary   \\
          &               & 13    & war           &       &  \\ \bottomrule
\end{tabularx}
\end{table}
\end{document}

Output

enter image description here

Output without \footnotesize and “Category”

enter image description here

share|improve this answer
    
Thanks a bunch for your help, Qrrbrbirlbel! It looks very nice :) –  user26281 Feb 25 '13 at 17:30

To avoid the vertical lines you coud use empty multicolumns, i.e. \multicolumn{1}{c}{} this would span only 1 column; for the last column without content you might want to keep the right verical line, then use \multicolumn{1}{c|}{}.

Another advise, if you use a specific columntype definition multiple times simply define a new one, like so \newcolumntype{a}{>{\centering\arraybackslash}m{0.50in}}. In general it would be better to use relative dimensions to maintain consistency even after changing fontsize etc.

Here my take on your problem.

Code

\documentclass{article}
\usepackage{array}

\newcommand{\mcs}{\multicolumn{4}{c|}{}}
\newcolumntype{a}[1]{>{\centering\arraybackslash}m{#1}}

\begin{document}
\footnotesize
\begin{tabular}{| a{0.50in} | a{0.90in} || a{0.50in} | a{0.90in} || a{0.50in} | a{0.90in} |}
\hline
Category Index  & Category Name & Category Index  & Category Name & Category Index  & Category Name\\ \hline\hline
1         & animation  & 7   & sci-fi   & 13 & war         \\ \hline
2         & action     & 8   & comedy   & 14 & mystery     \\ \hline
3         & film-noir  & 9   & thriller & 15 & musical     \\ \hline
4         & children's & 10  & fantasy  & 16 & romance     \\ \hline
5         & adventure  & 11  & horror   & 17 & IMAX        \\ \hline
6         & crime      & 12  & western  & 18 & drama       \\ \hline
\mcs                                    & 19 & documentary \\ \cline{5-6}
\end{tabular}
\end{document}

Result

image

share|improve this answer
    
Many thanks for suggestions, Christian R. :) That's just what I wanted. Best regards, Beth. –  user26281 Feb 25 '13 at 17:32

Your Answer

 
discard

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