[Tex/LaTex] Table with COLSPAN and ROWSPAN together

columnsmultirowtables

I need help with my table. I need to (probably) mix row and colspan (see right bottom corner and 2 columns in the center) but i do not know how. Also I need more lines (questions) in 4th column – is another table good idea?

This is what I have:

enter image description here

My purpose looks like this:

enter image description here

And my code:

\documentclass{article}
\usepackage{geometry}                
\geometry{paper=a4paper,landscape,hmargin=28.5mm,vmargin=20mm} 

\newcolumntype{M}[1]{>{\centering\arraybackslash}m{\dimexpr#1-\arrayrulewidth\relax}}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{\dimexpr#1-\arrayrulewidth\relax}}

  \begin{tabular}{
  | P{1.4cm}
  | M{1.4cm}
  | M{1.4cm}
  | P{7.6cm}
  | P{6.4cm}
  | P{1.2cm}
  | P{1.2cm}
  | P{1.2cm}
  | P{2.2cm}
  |
}
\hline
a & b & c & & d & e & f & g \tabularnewline
\hline

\rule{0cm}{1cm} & & & & & & & & \tabularnewline
\hline
\rule{0cm}{1cm} & & & & & & & & \tabularnewline
\hline
\multicolumn{2}{P{2.8cm}}{\rule{0cm}{1cm}}  & & & & \multicolumn{3}{P{2.8cm}}{\rule{0cm}{1cm}}  \tabularnewline
\hline

\end{tabular}

I was trying a lot of combinations but latex is too hard for me and too complicated i mean… (beautiful HTML/CSS 🙂 )

Best Answer

You can use multirow and \cline.

\documentclass{article}
\usepackage{geometry,array}
\geometry{a4paper,landscape,hmargin=8.5mm,vmargin=20mm}

\newcolumntype{M}[1]{>{\centering\arraybackslash}m{\dimexpr#1-\arrayrulewidth\relax}}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{\dimexpr#1-\arrayrulewidth\relax}}

\usepackage{multirow}
\usepackage{amssymb}
\begin{document}
  \begin{tabular}{
  | P{1.4cm}
  | M{1.4cm}
  | M{1.4cm}
  | P{7.6cm}
  | P{6.4cm}
  | P{1.2cm}
  | P{1.2cm}
  | P{1.2cm}
  | P{2.2cm}
  |
}
\hline
a & b & c & & d & e & f & g &\\
\hline

\rule[-0.8cm]{0cm}{1cm} & & &
\multirow{3}{7.6cm}{%
Question \hfill $\bigcirc$ \strut  Yes  $\bigcirc$ No \newline
Question \hfill $\bigcirc$ \strut  Yes  $\bigcirc$ No \newline
Question \hfill $\bigcirc$ \strut  Yes  $\bigcirc$ No \newline
Question \hfill $\bigcirc$ \strut  Yes  $\bigcirc$ No \newline
Question \hfill $\bigcirc$ \strut  Yes  $\bigcirc$ No \newline
Question \hfill $\bigcirc$ \strut  Yes  $\bigcirc$ No \newline
Question \hfill $\bigcirc$ \strut  Yes  $\bigcirc$ No \newline
Question \hfill $\bigcirc$ \strut  Yes  $\bigcirc$ No%  <--- % needed
}
  & & & & & \\
\cline{1-3}\cline{5-8}
\rule[-0.8cm]{0cm}{1cm} & & & & & & & & \\\cline{1-3}\cline{5-8}
\multicolumn{2}{|P{2.8cm}}{\rule{0cm}{1cm}}  & & & & \multicolumn{3}{P{2.8cm}}{\rule{0cm}{1cm}}  &\\
\hline

\end{tabular}
\end{document}

enter image description here

Related Question