1

I am trying to create the following table. I tried to rotate the Impact areas column which i succeeded in but for some reason the column doesn't shrink to the text afterwards. Here is the code:

[![enter image description here][1]][1]\multicolumn{1}{l|}{\multirow{-8}{*}{\cellcolor[HTML]
{C0C0C0}\textbf{\rotatebox{90}{Impact Areas}}}}                                          

image of table

does anyone know how to fix this?

edit:

\documentclass{article}
\usepackage{colortbl,xcolor,multirow,graphicx}
\begin{document}
\begin{table}[]
\centering
\caption{My caption}
\label{my-label}
\begin{tabular}{r>{\centering\arraybackslash}m{1.7cm}lll|l|}
\hline
\multicolumn{2}{|l|}{\cellcolor[HTML]{000000}{\color[HTML]{FFFFFF} Allegro Worksheet 10}}                                                                                                                                    & \multicolumn{4}{l|}{Information Asset Risk Worksheet}                                                                                                                                                                                                                            \\ \hline
\multicolumn{1}{|r|}{\cellcolor[HTML]{C0C0C0}}                                               & \multicolumn{1}{l|}{\cellcolor[HTML]{C0C0C0}}                                                                                 & \multicolumn{1}{>{\centering\arraybackslash}m{1.7cm}|}{\cellcolor[HTML]{C0C0C0}Information Asset}                                                 & \multicolumn{3}{>{\centering\arraybackslash}m{3.7cm}|}{}                                                                                                                                           \\ \cline{3-6} 
\multicolumn{1}{|r|}{\cellcolor[HTML]{C0C0C0}}                                               & \multicolumn{1}{l|}{\cellcolor[HTML]{C0C0C0}}                                                                                 & \multicolumn{1}{>{\centering\arraybackslash}m{1.7cm}|}{\cellcolor[HTML]{C0C0C0}Area of concern}                                                   & \multicolumn{3}{>{\centering\arraybackslash}m{3.7cm}|}{}                                                                                                                                           \\ \cline{3-6} 
\multicolumn{1}{|r|}{\cellcolor[HTML]{C0C0C0}}                                               & \multicolumn{1}{l|}{\cellcolor[HTML]{C0C0C0}}                                                                                 & \multicolumn{1}{>{\centering\arraybackslash}m{1.7cm}|}{\cellcolor[HTML]{EFEFEF}(1) Actor}                                                         & \multicolumn{3}{>{\centering\arraybackslash}m{3.7cm}|}{}                                                                                                                                           \\ \cline{3-6} 
\multicolumn{1}{|r|}{\cellcolor[HTML]{C0C0C0}}                                               & \multicolumn{1}{l|}{\cellcolor[HTML]{C0C0C0}}                                                                                 & \multicolumn{1}{>{\centering\arraybackslash}m{1.7cm}|}{\cellcolor[HTML]{EFEFEF}(2) Means}                                                         & \multicolumn{3}{>{\centering\arraybackslash}m{3.7cm}|}{}                                                                                                                                           \\ \cline{3-6} 
\multicolumn{1}{|r|}{\cellcolor[HTML]{C0C0C0}}                                               & \multicolumn{1}{l|}{\cellcolor[HTML]{C0C0C0}}                                                                                 & \multicolumn{1}{>{\centering\arraybackslash}m{1.7cm}|}{\cellcolor[HTML]{EFEFEF}(3) Motive}                                                        & \multicolumn{3}{>{\centering\arraybackslash}m{3.7cm}|}{}                                                                                                                                           \\ \cline{3-6} 
\multicolumn{1}{|r|}{\cellcolor[HTML]{C0C0C0}}                                               & \multicolumn{1}{l|}{\cellcolor[HTML]{C0C0C0}}                                                                                 & \multicolumn{1}{>{\centering\arraybackslash}m{1.7cm}|}{\cellcolor[HTML]{EFEFEF}(4) Outcome}                                                       & \multicolumn{3}{>{\centering\arraybackslash}m{3.7cm}|}{\textbf{\begin{tabular}[c]{@{}l@{}}Disclosure              Destruction  \\ Modification          Interruption\end{tabular}}}                \\ \cline{3-6} 
\multicolumn{1}{|r|}{\cellcolor[HTML]{C0C0C0}}                                               & \multicolumn{1}{l|}{\cellcolor[HTML]{C0C0C0}}                                                                                 & \multicolumn{1}{>{\centering\arraybackslash}m{1.7cm}|}{\cellcolor[HTML]{EFEFEF}(5) Security requirements}                                         & \multicolumn{3}{>{\centering\arraybackslash}m{3.7cm}|}{}                                                                                                                                           \\ \cline{3-6} 
\multicolumn{1}{|r|}{\cellcolor[HTML]{C0C0C0}}                                               & \multicolumn{1}{l|}{\multirow{-8}{*}{\cellcolor[HTML]{C0C0C0}\textbf{\rotatebox{90}{Impact Areas}}}}                                          & \multicolumn{1}{>{\centering\arraybackslash}m{1.7cm}|}{\cellcolor[HTML]{EFEFEF}(6) Probability}                                                   & \multicolumn{1}{>{\centering\arraybackslash}m{3.7cm}|}{\textbf{High}}                                             & \textbf{Medium}                        & \textbf{Low}                          \\ \cline{2-6} 
\multicolumn{1}{|r|}{\cellcolor[HTML]{C0C0C0}}                                               & \multicolumn{2}{l|}{}                                                                                                                                                                                                                          & \multicolumn{3}{l|}{\begin{tabular}[c]{@{}l@{}}(8) Severity\end{tabular}} \\ \cline{4-6} 
\multicolumn{1}{|r|}{\cellcolor[HTML]{C0C0C0}}                                               & \multicolumn{2}{l|}{\multirow{-2}{*}{\begin{tabular}[c]{@{}l@{}}(7) Consequences \end{tabular}}} & \multicolumn{1}{l|}{\textbf{Impact Area}}                                      & \textbf{Value}                         & \textbf{Score}                        \\ \cline{2-6} 
\multicolumn{1}{|r|}{\cellcolor[HTML]{C0C0C0}}                                               & \multicolumn{2}{l|}{}                                                                                                                                                                                                                          & \multicolumn{1}{>{\centering\arraybackslash}m{2.7cm}|}{Reputation \& Customer Confidence}                         &                                        &                                       \\ \cline{4-6} 
\multicolumn{1}{|r|}{\cellcolor[HTML]{C0C0C0}}                                               & \multicolumn{2}{l|}{\multirow{-2}{*}{}}                                                                                                                                                                                                        & \multicolumn{1}{>{\centering\arraybackslash}m{2.7cm}|}{Financial}                                                 &                                        &                                       \\ \cline{2-6} 
\multicolumn{1}{|r|}{\cellcolor[HTML]{C0C0C0}}                                               & \multicolumn{2}{l|}{}                                                                                                                                                                                                                          & \multicolumn{1}{>{\centering\arraybackslash}m{2.7cm}|}{Productivity}                                              &                                        &                                       \\ \cline{4-6} 
\multicolumn{1}{|r|}{\cellcolor[HTML]{C0C0C0}}                                               & \multicolumn{2}{l|}{\multirow{-2}{*}{}}                                                                                                                                                                                                        & \multicolumn{1}{>{\centering\arraybackslash}m{2.7cm}|}{Safety \& Health}                                          &                                        &                                       \\ \cline{2-6} 
\multicolumn{1}{|r|}{\cellcolor[HTML]{C0C0C0}}                                               & \multicolumn{2}{l|}{}                                                                                                                                                                                                                          & \multicolumn{1}{>{\centering\arraybackslash}m{2.7cm}|}{Fines \& Legal Penalties}                                  &                                        &                                       \\ \cline{4-6} 
\multicolumn{1}{|r|}{\multirow{-16}{*}{\cellcolor[HTML]{C0C0C0}\textbf{\rotatebox{90} {Internal Personnel}}}} & \multicolumn{2}{l|}{\multirow{-2}{*}{}}                                                                                                                                                                                                        & \multicolumn{1}{>{\centering\arraybackslash}m{2.7cm}|}{User Defined Impact Area}                                  &                                        &                                       \\ \hline
\multicolumn{5}{r}{Relative Risk Score}                                                                                                                                                                                                                                                                                                                                                                                                                                 &                                       \\ \hline
\multicolumn{6}{|l|}{\cellcolor[HTML]{C0C0C0}\begin{tabular}[c]{@{}l@{}}(9) Risk Mitigation\\ Based on the total score for this risk, what action will you take?\end{tabular}}                                                                                                                                                                                                                                                                                                                                  \\ \hline
\multicolumn{2}{|l|}{Accept}                                                                                                                                                                                                 & \multicolumn{1}{l|}{Defer}                                                                                     & \multicolumn{1}{>{\centering\arraybackslash}m{2.7cm}|}{\cellcolor[HTML]{C0C0C0}Mitigate}                          & \multicolumn{2}{l|}{Transfer}                                                  \\ \hline
\multicolumn{6}{|l|}{\cellcolor[HTML]{C0C0C0}For the risks that you decide to mitigate, do the following:}                                                                                                                                                                                                                                                                                                                                                                                                      \\ \hline
\multicolumn{2}{|l|}{\cellcolor[HTML]{C0C0C0}On what container would you apply controls?}                                                                                                                                    & \multicolumn{4}{>{\centering\arraybackslash}m{9.5cm}|}{\cellcolor[HTML]{C0C0C0}What administrative, technical, and physical controls would you apply on this container? What residual risk would still be accepted by the organization?}                                                                            \\ \hline
\multicolumn{2}{|l|}{}                                                                                                                                                                                                       & \multicolumn{4}{l|}{}                                                                                                                                                                                                                                                            \\ \hline
\end{tabular}
\end{table}
\end{document}
8
  • 2
    Welcome to TeX.SE! Please show us a short, compilable code resulting in your problem ...
    – Mensch
    Feb 24, 2018 at 16:54
  • i edited the post
    – Micha
    Feb 24, 2018 at 16:57
  • 1
    where is your small but complete document, which demonstrate your problem? it should started with \documentclass{...} and end with \end{document}
    – Zarko
    Feb 24, 2018 at 17:00
  • There are myriads of thesis classes on the web!
    – Bernard
    Feb 24, 2018 at 17:15
  • You would benefit from writing \usepackage{colortbl,xcolor,multirow,graphicx} in the preamble of your document. When posting an MWE, the W is important, i.e. it is probably not too much to ask to make sure that the thing compiles. And it is unfortunately not clear what the desired output will look like. That is, what is the target width of the column "Impact Areas"?
    – user121799
    Feb 24, 2018 at 18:42

2 Answers 2

0

This is certainly not an answer, the only purpose is to show you that the width is controlled by the lower rows, which are not shown in your screenshot, and that first row. All I did was to change the next-to-last row to p{2cm} to obtain enter image description here

As you can see, the width of "Impact Areas" column does decrease, it is now set by the first row (i.e. the widths of the first and second rows need to fit "Allegro Worksheet 10". All further changes will depend on how you want to structure the first and lower rows.

1
  • Thanks very much for this clear explanation. I am quite new to latex and while i do know the basics of tables i did not know this. It certainly fixed my problem so thanks again!
    – Micha
    Feb 24, 2018 at 20:43
1

off-topic: (mostly, but can be very usable in your future table design) in code for your table is simple go to lost. i tray to (for exercise) clean-up as much as figured out, what the table should look out. in this i for one cell use \makecell macro from package makecell, remove all unnecessary \multicolumn{1}{...}{...} and define table width by use \begin{tabular*}{\linewidth}{...}. this enable me to calculate width of some multi column cells in table.

enter image description here

(red lines indicate text borders)

\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{makecell, multirow}
\usepackage{graphicx}

%-------------------------------- show page layout, only for test
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
    \begin{table}[]
    \centering
\caption{My caption}
    \label{my-label}
    \setlength\tabcolsep{4pt}
\begin{tabular*}{\linewidth}{
                |>{\columncolor{gray!50}}l
                |l
                |>{\centering\arraybackslash}m{2.4cm}
                |>{\centering\arraybackslash}m{2.4cm}
                |l|l|}
\hline
\multicolumn{2}{l|}{\cellcolor{black}{\color{white} Allegro Worksheet 10}}
    & \multicolumn{4}{l|}{Information Asset Risk Worksheet} \\ \hline
    & \cellcolor{gray!50}
    & \cellcolor{gray!50} Information Asset                                                 & \multicolumn{3}{c|}{}                                                                                                                                           \\ \cline{3-6}
    & \cellcolor{gray!50}                                                                                & \cellcolor{gray!50} Area of concern                                                   & \multicolumn{3}{c|}{}                                                                                                                                           \\ \cline{3-6}
    & \cellcolor{gray!50}                                                                               & \cellcolor{gray!15}(1) Actor                                                         & \multicolumn{3}{c|}{}                                                                                                                                           \\ \cline{3-6}
    & \cellcolor{gray!50}                                                                                 & \cellcolor{gray!15}(2) Means                                                         & \multicolumn{3}{c|}{}                                                                                                                                           \\ \cline{3-6}
    & \cellcolor{gray!50}                                                                                 & \cellcolor{gray!15}(3) Motive                                                       & \multicolumn{3}{c|}{}                                                                                                                                           \\ \cline{3-6}
    & \cellcolor{gray!50}                                                                                 & \cellcolor{gray!15}(4) Outcome                                                       & \multicolumn{3}{l|}
            {\bfseries\makecell[l]{Disclosure Destruction\\
                                   Modification Interruption}}
    \\ \cline{3-6}
    & \cellcolor{gray!50}                                                                              & \cellcolor{gray!15}(5) Security requirements                                        & \multicolumn{3}{c|}{}                                                                                                                                           \\ \cline{3-6}
    & \cellcolor{gray!50}\multirow{-8}{*}{\textbf{\rotatebox{90}{Impact Areas}}}                                          & \cellcolor{gray!15}(6) Probability                                                   & \textbf{High}
    & \textbf{Medium}
    & \textbf{Low}
    \\ \cline{2-6}
    & \multicolumn{2}{l|}{}                                                                                                                                                                                                                          & \multicolumn{3}{l|}{ Severity}
    \\ \cline{4-6}
   & \multicolumn{2}{l|}{\multirow{-2}{*}{(7) Consequences}}
    & \textbf{Impact Area}
    & \textbf{Value}
    & \textbf{Score}
    \\ \cline{2-6}
    & \multicolumn{2}{l|}{}                                                                                                                                                                                                                          & Reputation \& Customer Confidence &   &
    \\ \cline{4-6}
    & \multicolumn{2}{l|}{\multirow{-2}{*}{}}                                                                                                                                                                                                        & Financial                         &   &
    \\ \cline{2-6}
    & \multicolumn{2}{l|}{}                                                                                                                                                                                                                          & Productivity                      &   &
    \\ \cline{4-6}
    & \multicolumn{2}{l|}{\multirow{-2}{*}{}}                                                                                                                                                                                                        & Safety \& Health                  &   &
    \\ \cline{2-6}
    & \multicolumn{2}{l|}{}                                                                                                                                                                                                                          & Fines \& Legal Penalties          &   &
    \\ \cline{4-6}
\multirow{-24}{*}{\rotatebox{90}{\textbf{Internal Personnel}}}
    & \multicolumn{2}{l|}{}                                                                                                                                                                                                        & User Defined Impact Area          &   &
    \\ \hline
%
 \multicolumn{3}{c}{}
    &   \multicolumn{3}{c}{Relative Risk Score}
    \\ \hline
%
    \rowcolor{gray!50}
\multicolumn{6}{|p{\dimexpr\linewidth-2\tabcolsep-2\arrayrulewidth\relax}|}{(9) Risk Mitigation\newline
                     Based on the total score for this risk, what action will you take?}
    \\  \hline
\multicolumn{2}{|l|}{Accept}
    & Defer                                                                                    & \cellcolor{gray!50}Mitigate
    & \multicolumn{2}{l|}{Transfer}                                                  \\ \hline
    \rowcolor{gray!50}
\multicolumn{6}{|l|}{For the risks that you decide to mitigate, do the following:}                                                                                                                                                                                                                                                                                                                                                                                                      \\ \hline
    \rowcolor{gray!50}
\multicolumn{2}{|>{\raggedright\arraybackslash}p{22ex}|}% estimated width of the first two columns
               {On what container would you apply controls?}
    & \multicolumn{4}{>{\raggedright\arraybackslash}p{\dimexpr\linewidth-4\tabcolsep-3\arrayrulewidth-22ex\relax}|}%
                     {What administrative, technical, and physical controls
    would you apply on this container? What residual
    risk would still be accepted by the organization?}                                                                            \\ \hline
\multicolumn{2}{|l|}{}                                                                                                                                                                                                       & \multicolumn{4}{l|}{}                                                                                                                                                                                                                                                            \\ \hline
\end{tabular*}
    \end{table}
\end{document}

You must log in to answer this question.

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