# Problem with sideways table

I have this sideways tables, but the text doesn't wrap properly inside the cells, here's my code

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[margin=2.5cm,a4paper]{geometry}

\usepackage[frenchb]{babel}
\usepackage{rotating,multirow}
\begin{document}

\begin{sidewaystable}
\centering\small
\renewcommand{\arraystretch}{1.5}

\begin{tabular}{|c|c|c|c|c|p{5cm}|p{5cm}|p{5.5cm}|}
\hline
\multicolumn{8}{|c|}{\textbf{ANALYSE DE RISQUE}}\\
\hline
\multicolumn{8}{|c|}{\textbf{Poste de travail ou machine:}}\\
\hline
\multicolumn{4}{|c|}{\textbf{Risque}} & \textbf{Indice} &  \textbf{Situation Dangereuse} &  \textbf{Conséquence} &  \textbf{Mesure Corrective}\\
\hline
%%%%%%%%%%%%%%%%%%% Part to duplicate if needed %%%%%%%%%%%
\multicolumn{4}{|c|}{Heavy weight of mother roller} & \multirow{ 2}{*}{} &  \multirow{ 2}{5cm}{The heavy mother coil is lifted to a high level and has the possibility of falling.} &  \multirow{ 2}{5cm}{The operator working in the moving range may be hited or crushed by the falling mother coil. } &   \multirow{ 2}{5.5cm}{Install a laser sensor to detect the operator moving around the crane and lower the mother coil if it detects someone is approaching this area.}\\
\cline{1-4}
G:1 & F:1 & O:1 & P:1 & & & & \\
\hline
%%%%%%%%%%%%%%%%%%% Part to duplicate if needed %%%%%%%%%%%
\multicolumn{4}{|c|}{} & \multirow{ 2}{*}{} &  \multirow{ 2}{*}{} &  \multirow{ 2}{*}{} &   \multirow{ 2}{*}{}\\
\cline{1-4}
G: & F: & O: & P: & & & & \\
\hline
%%%%%%%%%%%%%%%%%%% Part to duplicate if needed %%%%%%%%%%%
\multicolumn{4}{|c|}{} & \multirow{ 2}{*}{} &  \multirow{ 2}{*}{} &  \multirow{ 2}{*}{} &   \multirow{ 2}{*}{}\\
\cline{1-4}
G: & F: & O: & P: & & & & \\
\hline
%%%%%%%%%%%%%%%%%%% Part to duplicate if needed %%%%%%%%%%%
\multicolumn{4}{|c|}{} & \multirow{ 2}{*}{} &  \multirow{ 2}{*}{} &  \multirow{ 2}{*}{} &   \multirow{ 2}{*}{}\\
\cline{1-4}
G: & F: & O: & P: & & & & \\
\hline
%%%%%%%%%%%%%%%%%%% Part to duplicate if needed %%%%%%%%%%%
\multicolumn{4}{|c|}{} & \multirow{ 2}{*}{} &  \multirow{ 2}{*}{} &  \multirow{ 2}{*}{} &   \multirow{ 2}{*}{}\\
\cline{1-4}
G: & F: & O: & P: & & & & \\
\hline
%%%%%%%%%%%%%%%%%%% Part to duplicate if needed %%%%%%%%%%%
\multicolumn{4}{|c|}{} & \multirow{ 2}{*}{} &  \multirow{ 2}{*}{} &  \multirow{ 2}{*}{} &   \multirow{ 2}{*}{}\\
\cline{1-4}
G: & F: & O: & P: & & & & \\
\hline
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{tabular}

\end{sidewaystable}
\end{document}


And i get this The width is fine cause I define it in multirow, but why is the height not changing? Cheers

• You ask, "Why is the height not changing?" Most likely, it is because the \multirow{ 2}{5cm}{...} statements allocate exactly 2 rows to typeset the material in the third argument of the command. Question: Do you need the \multirow wrappers at all? – Mico Feb 5 '16 at 21:33
• I just need the text in those cells to wrap, in width but i don't mind if the height changes – Dorian Kartalovski Feb 5 '16 at 21:35
• Then omit the \multirow wrappers. – Mico Feb 5 '16 at 21:36
• but if I do, will there not be a white space of the bottom of the cells? – Dorian Kartalovski Feb 5 '16 at 21:38
• Well, you either get rid of the \multirow wrappers and get some whitespace at the bottom of some of the rows, or you must accept that massive spillovers will result from not providing enough rows for the material to have a chance of fitting in the respective cells. Aside: I must confess that I don't understand the structure of your table all that well. Your readers may well appreciate if you redesign the table and make clear(er) how the multiple little boxes on the left-hand side of the table relate to the bigger ones on the right. – Mico Feb 5 '16 at 21:52

I suspect, that you like to have the following appearance of table:

The problem is that the height of text in multi row cel is bigger than corresponding of rows, which are spanning by multirow. As one (rude) solution is to make one of this row higher. With Assumption, that multirow cells will have maximal 4 lines of text, I define two new commands (for convenient table setting):

• \newcommand\mch[1]{\multicolumn{4}{@{\rule[-1.2em]{0pt}{3.2em}}|c|}{#1}}, which is used for upper row higher for amount for 4 lines text in multirow cell (see complete code) and

• \newcommand\mrh[2][0ex]{\multirow{2}*[#1]{\begin{minipage}{\hsize}#2\end{minipage}}}, which enable manual adjustment of text in multirow environment

The complete code for relevant part of table:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[margin=2.5cm,a4paper]{geometry}

\usepackage[frenchb]{babel}
\usepackage{makecell,multirow}
\usepackage{rotating}

\newcommand\mch[1]{\multicolumn{4}{@{\rule[-1.2em]{0pt}{3.2em}}|c|}{#1}}
\newcommand\mrh[2][0ex]{\multirow{2}*[#1]{\begin{minipage}{\hsize}#2\end{minipage}}}
\begin{document}

\begin{sidewaystable}
\centering\small
\renewcommand{\arraystretch}{1.5}

\begin{tabular}{|c|c|c|c|c|p{5cm}|p{5cm}|p{5.5cm}|}
\hline
\multicolumn{8}{|c|}{\textbf{ANALYSE DE RISQUE}}\\
\hline
\multicolumn{8}{|c|}{\textbf{Poste de travail ou machine:}}\\
\hline
\multicolumn{4}{|c|}{\textbf{Risque}} & \textbf{Indice} &  \textbf{Situation Dangereuse} &  \textbf{Conséquence} &  \textbf{Mesure Corrective}\\
\hline
%%%%%%%%%%%%%%%%%%% Part to duplicate if needed %%%%%%%%%%%
\mch{Heavy weight of mother roller}
&   \mrh{}
&   \mrh[1.5ex]{The heavy mother coil is lifted to a high level and has the possibility of falling.}
&   \mrh[1.5ex]{The operator working in the moving range may be hited or crushed by the falling mother coil. }
&   \mrh[1ex]{
Install a laser sensor to detect the operator moving around the crane and lower the mother coil if it detects someone is approaching this area.
}
\\
\cline{1-4}
G:1 & F:1 & O:1 & P:1 & & & & \\
\hline
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{tabular}