Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.10 KB | None | 0 0
  1. documentclass[11pt]{article}
  2. usepackage{multirow}
  3. usepackage[table]{xcolor}
  4.  
  5. begin{document}
  6. begin{center}
  7. begin{table}[!htbp]
  8. noindent
  9. begin{tabular}{|c|p{3cm}|p{3cm}|p{3cm}|}
  10. hline
  11. multirow{2}{3cm}{centering cellcolor{gray!50} Effectiveness of Controls} & multicolumn{3}{p{9cm}|}{centering cellcolor{gray!50} Probability of Threat Occurrence (Natural or Environmental Threats) or Threat Motivation and Capability (Human Threats)} \
  12. cline{2-4}
  13. rowcolor{gray!50}
  14. & Low & Moderate & High \
  15. hline
  16. rowcolor{white!50}
  17. cellcolor{gray!50} Low & Moderate & High & High \
  18. hline
  19. rowcolor{white!50}
  20. cellcolor{gray!50} Moderate & Low & Moderate & High \
  21. hline
  22. rowcolor{white!50}
  23. cellcolor{gray!50} High & Low & Low & Moderate \
  24. hline
  25. end{tabular}
  26. caption{Risk Classifications}
  27. label{tab:xyz}
  28.  
  29. end{table}
  30. end{center}
  31. end{document}
  32.  
  33. multirow{2}{dimexpr0.25textwidth-2arrayrulewidth-2tabcolseprelax}[-0.5cm]{...
  34.  
  35. documentclass[11pt,draft]{article}
  36. usepackage{multirow}
  37. usepackage[table]{xcolor}
  38. usepackage{array}
  39. newcolumntype{C}[1]{>{centeringarraybackslash}p{#1}}
  40.  
  41. begin{document}
  42. begin{center}
  43. begin{table}[!htbp]
  44. noindent
  45. begin{tabular}{|c|C{dimexpr0.25textwidth-arrayrulewidth-2tabcolseprelax}
  46. |C{dimexpr0.25textwidth-arrayrulewidth-2tabcolseprelax}
  47. |C{dimexpr0.25textwidth-arrayrulewidth-2tabcolseprelax}|}
  48. hline
  49. multirow{2}{dimexpr0.25textwidth-2arrayrulewidth-2tabcolseprelax}[-0.5cm]{centering cellcolor{gray!50} Effectiveness of Controls} & multicolumn{3}{p{dimexpr 0.75textwidth-arrayrulewidth-2tabcolseprelax}|}{cellcolor{gray!50}centering Probability of Threat Occurrence (Natural or Environmental Threats) or Threat Motivation and Capability (Human Threats)} \
  50. cline{2-4}
  51. cellcolor{gray!50}
  52. & cellcolor{gray!50} Low & cellcolor{gray!50} Moderate & cellcolor{gray!50} High \
  53. hline
  54. %rowcolor{white!50}
  55. cellcolor{gray!50} Low & Moderate & High & High \
  56. hline
  57. rowcolor{white!50}
  58. cellcolor{gray!50} Moderate & Low & Moderate & High \
  59. hline
  60. rowcolor{white!50}
  61. cellcolor{gray!50} High & Low & Low & Moderate \
  62. hline
  63. end{tabular}
  64. caption{Risk Classifications}
  65. label{tab:xyz}
  66.  
  67. end{table}
  68. end{center}
  69. end{document}
  70.  
  71. documentclass{article}
  72. usepackage{cals, caption, xcolor}
  73.  
  74. letnc=nullcell % CALS Shortcuts for spanning cells
  75. letsc=spancontent
  76.  
  77.  
  78. begin{document}
  79.  
  80. begin{table}[!htbp]
  81. begin{calstable}[c] % Centred CALS tabular
  82.  
  83. % Calculate the column width
  84. colwidths{{dimexpr(columnwidth)/4relax}
  85. {dimexpr(columnwidth)/4relax}
  86. {dimexpr(columnwidth)/4relax}
  87. {dimexpr(columnwidth)/4relax}
  88. }
  89.  
  90. % The tabular fills the text area if sum of all columns is 4
  91.  
  92. % Set up the tabular
  93. makeatletter
  94. defcals@framers@width{0.4pt} % Outside horizontal frame rules
  95. defcals@framecs@width{0,4pt} % Outside vertical frame rules
  96. defcals@bodyrs@width{0.4pt} % Rule between header and tabular body
  97. defcals@cs@width{0.4pt} % Inside vertical rules
  98. defcals@rs@width{0.4pt} % Inside horizontal rules
  99. defcals@bgcolor{} % To avoid undefined
  100.  
  101. defgray{ifxcals@bgcolorempty % "Switch" to turn on and off colour
  102. defcals@bgcolor{gray!30}
  103. else defcals@bgcolor{} fi}
  104.  
  105. % R1H1 % Just a comment: Row one, header row one
  106. thead{
  107. brow
  108. grayalignCnc{lrt} % Switch to gray background and centred text, works until switched off
  109. nc{ltb}
  110. nc{tb}
  111. nc{rtb}sc{vfil Probability of Threat Occurrence (Natural or Environmental Threats)}
  112. erow
  113. %R2H2 % Row two, header row two
  114. brow
  115. nc{lrb}sc{vfil Effectiveness of Controls} % "vfil" centres the cell content vertically
  116. cell{vfil Low}
  117. cell{vfil Moderate}
  118. cell{vfil High}gray % Always reset colour at end of header
  119. erow
  120. %R3B1 % Row three, body row one
  121. brow
  122. graycell{Low}gray % Switch to gray background for first cell (column 1)
  123. cell{vfil Moderate}
  124. cell{vfil High}
  125. cell{vfil High}
  126. erow
  127. %R4B2
  128. brow
  129. graycell{Moderate}gray
  130. cell{vfil Low}
  131. cell{vfil Moderate}
  132. cell{vfil High}
  133. erow
  134. %R5B3
  135. brow
  136. graycell{High}gray
  137. cell{vfil Low}
  138. cell{vfil Low}
  139. cell{vfil Moderate}
  140. erow
  141. makeatletter
  142. end{calstable}par
  143. caption{Risk Classifications}
  144. label{tab:xyz}
  145. end{table}
  146. end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement