2

enter image description here

Please, Help me inserting a table like this. I could not prepare this table even after using the \multicolumn package. I am facing difficulties with merging the rows and columns. I am in an urgent need. Please Help !

  • Welcome to TeX.SE! You will need to load the multirow package, not the multicol package. – Mico Dec 13 '13 at 18:42
  • Thanks @Mico . I have included multirow also that I forgot to mention. Still I could not manage it. – Suvra Kanti Dec 13 '13 at 18:50
  • Thanks @Werner . The links seem helpful. I am new in latex writing. I will learn how to make this type of tables.But, as I am in urgent need and I am new in LaTeX, would you do a favor of me ? Would you please supply the code of the table what exactly I need ? – Suvra Kanti Dec 13 '13 at 18:58
  • 2
    Please provide (a lot) more information about the table design you need: Should all eight columns be equally wide, or should just columns 3 through 8 be equally wide, or does it not matter at all how wide the columns are? Should the contents be fully-justified, left-justified, centered, or right-justified? Are you literally going to typeset strings like aaaaaa? It that's not the case (and I sincerely hope it's not...), should the text in a cell be allowed to "wrap" to the next line? – Mico Dec 13 '13 at 19:27
  • @Mico Thanks for your reply.

    All should be centred. In Column D, I will put some mathematical function in place of "aaaaaa". In a line it is impossible to put the whole function. So wrap to the next line can be allowed for the column D. Otherwise, it does not matter how wide columns are.

    – Suvra Kanti Dec 13 '13 at 19:34
  • 1
    Off-topic: Please start your first latex minimal working example (MWE) by copying and tweaking code from duplicates Q's from today so that you will feel and experience better than making others do for you in a hurry. LaTeX is not the right tool for last minute jobs for sure atleast in beginners stage. Some editors(Texmaker,Texstudio...) have already GUI wizard boxes for table design. Have a quick read at http://en.wikibooks.org/wiki/LaTeX/Tables and search tex.sx with tags – texenthusiast Dec 13 '13 at 19:47

2 Answers2

3

Here's an implementation of what I understand your requirements are. It uses the multirow package and tries to maximize the width of column "D". If more material than currently included shows up in the other columns, the width of column "D" will shrink accordingly. If, in the end, you do not need the table to be as wide as the text block, use some multiple of \textwidth less than 1.0 in the first argument of the tabularx column definitions.

enter image description here

\documentclass{article}
\usepackage{tabularx,multirow}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\begin{document}
\begin{table}
\begin{tabularx}{1.0\textwidth}{|c| Y| *{6}{c|} }
\cline{3-8}
\multicolumn{1}{c}{} &  & 
\multicolumn{3}{c|}{A} & \multicolumn{3}{c|}{B}\\
\hline
C & D & E & F & G & H & I & J\\
\hline
\multirow{4}{*}{l} &
\multirow{4}{*}{aaaaaa} &
\multirow{2}{*}{bbbb} &
\multirow{2}{*}{cccc} &
\multirow{4}{*}{eeee} &
ffff & hhhh &
\multirow{4}{*}{iiii}\\
& & & & & ffff & hhhh & \\
& & 
\multirow{2}{*}{bbbb} &
\multirow{2}{*}{cccc} & & ffff & hhhh & \\
& & & & & ffff & hhhh & \\
\hline
\end{tabularx}
\caption{Enter the table's caption here}
\end{table}
\end{document}
Mico
  • 506,678
2

Your tabular might not be easy for beginner, so for a good start at TeX.SE:

\documentclass{article}
\begin{document}

\begin{tabular}{|*8{l|}}
\cline{3-8}
\multicolumn{2}{c|}{}&\multicolumn{3}{c|}{A}&\multicolumn{3}{c|}{B}\\
\hline
C&D&E&F&\multicolumn{1}{c|}{G}&H&I&\multicolumn{1}{c|}{J}\\ % for example G and J centered
\hline
\begin{tabular}{l}
1
\end{tabular}&
\begin{tabular}{l}
aaaa
\end{tabular}&
\begin{tabular}{l}
bbbb\\
{}\\
bbbb
\end{tabular}&
\begin{tabular}{l}
cccc\\
{}\\
cccc
\end{tabular}&
\begin{tabular}{l}
eeee
\end{tabular}&
\begin{tabular}{l}
ffff\\
ffff\\
ffff\\
ffff
\end{tabular}&
\begin{tabular}{l}
hhhh\\
hhhh\\
hhhh\\
hhhh
\end{tabular}&
\begin{tabular}{l}
iiii
\end{tabular}\\
\hline
\end{tabular}

\end{document}

enter image description here

Mico
  • 506,678
  • @Przemystaw Scherwenti Thank you very much ! – Suvra Kanti Dec 13 '13 at 19:52
  • @Texenthusiast Thanks for your suggestions. Actually seeing the wiki books I could not manage to make the table. However, I will learn and no other than me will be happier if I can make this type of complex table on my own in future. – Suvra Kanti Dec 13 '13 at 19:55
  • In order to avoid excessive amounts of inter-column whitespace, you may want to use \begin{tabular}{@{}l@{}} rather than simply \begin{tabular}{l} for the eight "inner" tabular environments. That, or issue the command \setlength\tabcolsep{3pt} to reduce the value of that parameter by 50%. – Mico Dec 13 '13 at 21:14
  • @Mico Certainly. I would also take rows as a parameter of command; but not too much for a beginner. – Przemysław Scherwentke Dec 14 '13 at 04:24
  • How can I do it with the TexStudio wizard? – skan Dec 01 '16 at 17:25