# Word wrap in multicolumn and multirow table

I tried making this table and it still run longer than page width. Also it's longer than a page length. Does anyone know how to make this table work? Also this is the first time I ever use LaTeX and this forum. So I'm sorry if the code below doesn't look right.

\begin{center}
\begin{tabular}{|l|l|l|}
\hline
\multicolumn{2}{|c|}{Risk Parameter} & \multicolumn{1}{c|}{Classification} \\ \hline
\multirow{4}{*}{\parbox{5cm}{Consequence (C) Number of fatalities This can be calculated by determining the numbers of people present when the area exposed to the hazard is occupied and multiplying by the vulnerability to the identified hazard. The vulnerability is determined by  the nature of the hazard being protected against. The following factors can be used: V = 0,01 Small release of flammable or  toxic material V = 0,1 Large release of flammable or toxic material V = 0,5 As above but also a high probability of catching fire or  highly toxic material V = 1 Rupture or explosion} & C_{A} & Minor Injury \\
& C_{B} & Range 0.01 to 0.1 \\
& C_{C} & Range 0.1 to 1 \\
& C_{D} & Range \textgreater1,0 \\ \cline{1-1}
\multirow{2}{*}{\parbox{5cm}{Occupancy (F) This is calculated by determining the proportional length of time the area exposed to the hazard is occupied during a normal working period. NOTE 1 If the time in the hazardous area is different depending on the shift being operated then the maximum should be selected.NOTE 2 It is only appropriate to use FA where it can be shown that the demand rate is random and not related to when occupancy could be higher than normal. The latter is usually the case with demands which occur at equipment start-up or during the investigation of abnormalities.} & F_{A} & Rare to more frequent exposure in the hazardous zone. Occupancy less than 0.1 \\
& F_{B} & Frequent to permanent exposure in the hazardous zone \\ \cline{1-1}
\multirow{2}{5cm}{Probability of avoiding the hazardous event (P) if the protection system fails to operate.} & P_{A} & P_{A} should only be selected if all the following are true: - facilities are provided to alert the operator that the SIS has failed; - independent facilities are provided to shut down such that the hazard can be avoided or which enable all persons to escape to a safe area; - the time between the operator being alerted and a hazardous event occurring exceeds 1 hour or is definitely sufficient for the necessary actions. \\
& P_{B} & Adopted if all the conditions are not satisfied \\ \cline{1-1}
\multirow{4}{*}{\parbox{5cm}{Demand rate (W) The number of times per year that the hazardous event would occur in absence of SIF under consideration. To determine the demand rate it is necessary to consider all sources of failure that can lead to one hazardous event. In determining the demand rate, limited credit can be allowed for control system performance and intervention. The performance which can be claimed if the control system is not to be designed and maintained according to IEC 61511, is limited to below the  performance ranges associated with SIL1.} & W_{1} & Demand rate less than 0.1 D per year \\
& W_{2} & Demand rate between 0.1 D and D per year \\
& W_{3} & Demand rate between D and 10 D per year \\
&  & For demand rates higher than 10 D per year higher integrity shall be needed \\ \cline{1-1}
\end{tabular}
\end{center}


Edit: I change the code a litte now it looks better but it still gives error when compiling with \usepackage{multirow} at the beginning

\documentclass{article}
\usepackage[utf8]{inputenc}
%\usepackage{multirow}
\usepackage{longtable}

\begin{document}

\begin{center}
\begin{longtable}[l]{|l|l|p{5cm}|}
\hline
\multicolumn{2}{|c|}{Risk Parameter} & \multicolumn{1}{c|}{Classification} \\ \hline
\multirow{4}{*}{\parbox{5cm}{Consequence (C) Number of fatalities This can be calculated by determining the numbers of people present when the area exposed to the hazard is occupied and multiplying by the vulnerability to the identified hazard. The vulnerability is determined by  the nature of the hazard being protected against. The following factors can be used: V = 0,01 Small release of flammable or  toxic material V = 0,1 Large release of flammable or toxic material V = 0,5 As above but also a high probability of catching fire or  highly toxic material V = 1 Rupture or explosion} & C_{A} & Minor Injury \\
& C_{B} & Range 0.01 to 0.1 \\
& C_{C} & Range 0.1 to 1 \\
& C_{D} & Range \textgreater1,0 \\ \cline{1-1}
\multirow{2}{*}{\parbox{5cm}{Occupancy (F) This is calculated by determining the proportional length of time the area exposed to the hazard is occupied during a normal working period. NOTE 1 If the time in the hazardous area is different depending on the shift being operated then the maximum should be selected.NOTE 2 It is only appropriate to use FA where it can be shown that the demand rate is random and not related to when occupancy could be higher than normal. The latter is usually the case with demands which occur at equipment start-up or during the investigation of abnormalities.} & F_{A} & Rare to more frequent exposure in the hazardous zone. Occupancy less than 0.1 \\
& F_{B} & Frequent to permanent exposure in the hazardous zone \\ \cline{1-1}
\multirow{2}{*}{\parbox{5cm}{Probability of avoiding the hazardous event (P) if the protection system fails to operate.} & $P_{A}$ & $P_{A}$ should only be selected if all the following are true: - facilities are provided to alert the operator that the SIS has failed; - independent facilities are provided to shut down such that the hazard can be avoided or which enable all persons to escape to a safe area; - the time between the operator being alerted and a hazardous event occurring exceeds 1 hour or is definitely sufficient for the necessary actions. \\
&  $P_{B}$ & Adopted if all the conditions are not satisfied \\ \cline{1-1}
\multirow{4}{*}{\parbox{5cm}{Demand rate (W) The number of times per year that the hazardous event would occur in absence of SIF under consideration. To determine the demand rate it is necessary to consider all sources of failure that can lead to one hazardous event. In determining the demand rate, limited credit can be allowed for control system performance and intervention. The performance which can be claimed if the control system is not to be designed and maintained according to IEC 61511, is limited to below the  performance ranges associated with SIL1.} & W_{1} & Demand rate less than 0.1 D per year \\
& W_{2} & Demand rate between 0.1 D and D per year \\
& W_{3} & Demand rate between D and 10 D per year \\
&  & For demand rates higher than 10 D per year higher integrity shall be needed \\ \cline{1-1}
\end{longtable}
\end{center}
\end{document}

• Welcome to TeX.SX! A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). – Jesse Dec 14 '14 at 11:10
• For the width, the space needed by the | vertical lines and just before and after them (tabcolsep) has to be considered as well – user31729 Dec 14 '14 at 11:15
• Please provide an MWE. I was not able to compile your example, even when I added the obvious packages (multirow, relsize,array). – Sveinung Dec 14 '14 at 11:44
• Thank you all for your reply. What is an MWE? I tweak the code a little and now it looks a bit better – Krisna Murti Dec 14 '14 at 13:19
• You're missing several $ symbols in the second column entry (it shoule be $W_{2}, for instance). You're also forgetting the braces closing the argument to \multirow. However your text in the \multirow is too long and it's quite difficult to understand what's your aim. – egreg Dec 14 '14 at 14:24 ## 1 Answer Here is a solution. I removed all vertical lines, and used the booktabs, makecell and ltablex packages (the latter combines the functionalities of longtable and tabularx, and introduced some itemize inside cells environments and a few other modifications to the table layout: \documentclass[a4paper]{article} \usepackage[utf8]{inputenc} \usepackage{geometry} \usepackage[inline]{enumitem} \usepackage{ragged2e} \usepackage{booktabs} \usepackage{array, multirow, makecell, hhline} \usepackage{ltablex} \renewcommand\cellalign{lt}\renewcommand\theadfont{\normalfont} \setcellgapes{4pt} \makegapedcells \begin{document} \begin{tabularx}{\linewidth}{>{\RaggedRight}p{0.5 \linewidth}l>{\RaggedRight\arraybackslash}X} \hline \multicolumn{2}{c}{Risk Parameter} & \thead{Classification} \\ \toprule \multirow{1}{\linewidth}{{Consequence (C) Number of fatalities This can be calculated by determining the numbers of people present when the area exposed to the hazard is occupied and multiplying by the vulnerability to the identified hazard. The vulnerability is determined by the nature of the hazard being protected against. \\ The following factors can be used: %\\ \begin{itemize}[noitemsep,topsep=4pt, wide = 0pt, leftmargin =2.1em] \item[ \mathrm{V = 0,01:} $]Small release of flammable or toxic material \item[$ \mathrm{V = 0,1:} $]Large release of flammable or toxic material \item[$ \mathrm{V = 0,5:} $]As above but also a high probability of catching fire or highly toxic material \item[$ \mathrm{V = 1:} $]Rupture or explosion \end{itemize}}}% &$ C_{A} $& Minor Injury \\ &$ C_{B} $& Range 0.01 to 0.1 \\ &$ C_{C} $& Range 0.1 to 1 \\ &$ C_{D} $& Range$ > 1,0 $\\[9.5\baselineskip] \cmidrule{1-1} \multirow{2}{\linewidth}{{Occupancy (F) This is calculated by determining the proportional length of time the area exposed to the hazard is occupied during a normal working period. \\[1ex] \small\textsc{Note 1:} If the time in the hazardous area is different depending on the shift being operated then the maximum should be selected.}} &$ F_{A} $& Rare to more frequent exposure in the hazardous zone. Occupancy less than 0.1 \\ &$ F_{B} $& Frequent to permanent exposure in the hazardous zone \\ & & \\[-1ex] \small\textsc{Note 2:} It is only appropriate to use FA where it can be shown that the demand rate is random and not related to when occupancy could be higher than normal. The latter is usually the case with demands which occur at equipment start-up or during the investigation of abnormalities. & & \\ % \cmidrule{1-1} \multirow{2}{\linewidth}{Probability of avoiding the hazardous event (P) if the protection system fails to operate.} &$ P_{A} $&$ P_{A} $should only be selected if all the following are true:% \begin{itemize*}[label = --, itemjoin = \linebreak, before = \linebreak]%[ noitemsep] \item facilities are provided to alert the operator that the SIS has failed; \item independent facilities are provided to shut down such that the hazard can be avoided or which enable all persons to escape to a safe area; \item the time between the operator being alerted and a hazardous event occurring exceeds 1 hour or is definitely sufficient for the necessary actions. \end{itemize*} \\ &$ P_{B} $& Adopted if all the conditions are not satisfied \\ \cmidrule{1-1} \multirow{4}{\linewidth}{{Demand rate (W) The number of times per year that the hazardous event would occur in absence of SIF under consideration. To determine the demand rate it is necessary to consider all sources of failure that can lead to one hazardous event. In determining the demand rate, limited credit can be allowed for control system performance and intervention. The performance which can be claimed if the control system is not to be designed and maintained according to IEC 61511, is limited to below the performance ranges associated with SIL1.}} &$ W_{1} $& Demand rate less than 0.1 D per year \\ &$ W_{2} $& Demand rate between 0.1 D and D per year \\ &$ W_{3} \$ & Demand rate between D and 10 D per year \\
& & For demand rates higher than 10 D per year higher integrity shall be needed \\[2\baselineskip]
\bottomrule
\end{tabularx}

\end{document}