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 only know how to use \multirow, but how to use generate the following table in LaTeX?

enter image description here

share|improve this question

migrated from stackoverflow.com Mar 24 '13 at 19:10

This question came from our site for professional and enthusiast programmers.

2  
Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Mar 24 '13 at 19:21
add comment

1 Answer

up vote 4 down vote accepted

I guess you need to combine columns spanning multiple rows, and rows spanning multiple columns. Here's an example from wikibooks : http://en.wikibooks.org/wiki/LaTeX/Tables#Spanning_in_both_directions_simultaneously

enter image description here

Here's the tex code as given in the link:

\usepackage{multirow}

\begin{tabular}{cc|c|c|c|c|l}
\cline{3-6}
& & \multicolumn{4}{ c| }{Primes} \\ \cline{3-6}
& & 2 & 3 & 5 & 7 \\ \cline{1-6}
\multicolumn{1}{ |c| }{\multirow{2}{*}{Powers} } &
\multicolumn{1}{ |c| }{504} & 3 & 2 & 0 & 1 &     \\ \cline{2-6}
\multicolumn{1}{ |c  }{}                        &
\multicolumn{1}{ |c| }{540} & 2 & 3 & 1 & 0 &     \\ \cline{1-6}
\multicolumn{1}{ |c  }{\multirow{2}{*}{Powers} } &
\multicolumn{1}{ |c| }{gcd} & 2 & 2 & 0 & 0 & min \\ \cline{2-6}
\multicolumn{1}{ |c  }{}                        &
\multicolumn{1}{ |c| }{lcm} & 3 & 3 & 1 & 1 & max \\ \cline{1-6}
\end{tabular}
share|improve this answer
1  
Some thoughts: Inorder to stand the answer by itself what about adding the LaTeX code in answer and declaring wikibooks reference. –  texenthusiast Mar 25 '13 at 2:40
    
@texenthusiast: thanks for the suggestion. done. –  Neha Karanjkar Jun 25 '13 at 5:55
add comment

Your Answer

 
discard

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