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 !

closed as too broad by jub0bs, dustin, Claudio Fiandrino, Peter Jansson, Ludovic C. Dec 13 '13 at 21:40

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Welcome to TeX.SE! You will need to load the multirow package, not the multicol package. – Mico Dec 13 '13 at 18:42
  • Possible duplicate(s): Table with multiple merging; Combine 4 cells in a table – Werner Dec 13 '13 at 18:43
  • 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
  • 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
  • 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 en.wikibooks.org/wiki/LaTeX/Tables and search tex.sx with tags – texenthusiast Dec 13 '13 at 19:47
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}
  • How can I do it with the TexStudio wizard? – skan Dec 1 '16 at 17:25
  • @skan - Sorry, no idea. I don't use TeXstudio. – Mico Dec 1 '16 at 17:26
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

  • @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 4:24
  • How can I do it with the TexStudio wizard? – skan Dec 1 '16 at 17:25

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