1

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 :) )

2 Answers 2

2

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

3
  • Thank you. But there is one more line over. If you look on 'My purpose' on right bottom corner looks like flipped 'L'
    – Mark
    May 14, 2015 at 14:34
  • @Mark updated...
    – user11232
    May 14, 2015 at 14:34
  • Now I noticed that the last column in first row should not be there... and also content "Question yes/no" should be entered vertical and horizontal...
    – Mark
    May 18, 2015 at 13:21
1

Because all cell widths are known you needn't to use tabular (nor \halign) because \hbox to<given width> is sufficient. I composed your table from parts and I used classical \hbox, \vbox, \hrule and \vrule. This is a basic exercise how TeX works with those elements.

\def\tabstrut{\lower6pt\vbox to20pt{}}
\def\tline#1#2#3#4{\hbox{\tabstrut
    \hbox to#1cm{\hss#2\hss}\vrule
    \hbox to#1cm{\hss#3\hss}\vrule
    \hbox to#1cm{\hss#4\hss}}\hrule}
\def\oline#1#2{\hbox to#1cm{\tabstrut\hss#2\hss}\hrule}
\def\ques{\hbox{\quad question\quad $\bigcirc$ yes\quad $\bigcirc$ no}}

\vbox{\hrule
\hbox{\vrule
   \vtop{\tline{1.4}{a}{b}{c}\tline{1.4}{d}{e}{f}\tline{1.4}{g}{h}{i}}\vrule
   \vtop{\oline{4.6}{j}\medskip\ques\ques\ques\ques\ques\ques\ques\medskip}\vrule
   \vtop{\oline{3.4}{k}}\vrule
   \vtop{\hbox{\vtop{\tline{1.2}{l}{m}{n}
                     \tline{1.2}{o}{p}{q}\tline{1.2}{r}{s}{t}}\vrule}}%
   \kern1.2cm
   \vrule
}\hrule
}

The result:

tab

I did change some partial widths (column j and k) because the global width of the table was greater than the A4 paper width.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .