TeX - LaTeX Asked on May 24, 2021
I saw a table created in PowerPoint and wanted to know how to do it in LaTeX. The table is shown below. The aspects of the table that I’m most interested in are the rotated table headers as well as Knowledge Areas
and Process
labels outside the table.
Here is what I’ve come up with so far after seeing Rotated column titles in tabular
suggested in the comments (thanks!)
documentclass{article}
usepackage{adjustbox}
usepackage{array}
usepackage{booktabs}
usepackage{multirow}
newcolumntype{R}[2]{%
>{adjustbox{angle=#1,lap=width-(#2)}bgroup}%
l%
<{egroup}%
}
newcommand*rot{multicolumn{1}{R{90}{1em}}}% no optional argument here, please!
begin{document}
begin{table} centering
begin{tabular}{clcccccccccc}
& & multicolumn{10}{c}{Knowledge Areas}
& & rot{Integration} & rot{Scope} & rot{Time} & rot{Cost}
& rot{Quality} & rot{Human Resource} & rot{Communication}
& rot{Risk} & rot{Procurement} & rot{Stakeholder Management}
midrule
multirow{5}{*}{{Processes}}
& Initiating & * & & & & & & * & & & *
& Planning & * & * & * & * & * & * & * & * & * & *
& Executing & * & & & & * & * & * & & * & *
& Monitoring and Control & * & * & * & * & * & & * & * & * & *
& Closing & * & & & & & & * & & * & *
bottomrule
end{tabular}
caption{Some caption}
end{table}
end{document}
With the result looking like:
I’m not so concerned about the row coloring (sorry, should have mentioned that before). There are just a few things I don’t know how to do:
Stakeholder Management
stack on top of each other?Processes
on the left-hand side? The rot
command I used in the table header didn’t work, presumably because it is in the multirow
command.Using rlap
makes it easier to position text without additional space. And if you want the label "Processes" outside then use cmidrule{2-12}
and cmidrule[1pt]{2-12}
instead.
documentclass{article}
usepackage{array,graphicx}
usepackage{booktabs}
usepackage{pifont}
newcommand*rot{rotatebox{90}}
newcommand*OK{ding{51}}
begin{document}
begin{table} centering
begin{tabular}{@{} cl*{10}c @{}}
& & multicolumn{10}{c}{Knowledge Areas} [2ex]
& & rot{Integration} & rot{Scope} & rot{Time} & rot{Cost}
& rot{Quality} & rot{Human Resource} & rot{Communication}
& rot{Risk} & rot{Procurement} & rot{shortstack[l]{StakeholderManagement}}
cmidrule{2-12}
& Initiating & OK & & & & & & OK & & & OK
& Planning & OK & OK & OK & OK & OK & OK & OK & OK & OK & OK
& Executing & OK & & & & OK & OK & OK & & OK & OK
& Monitoring and Control & OK & OK & OK & OK & OK & & OK & OK & OK & OK
rot{rlap{~Processes}}
& Closing & OK & & & & & & OK & & OK & OK
cmidrule[1pt]{2-12}
end{tabular}
caption{Some caption}
end{table}
end{document}
and the same colored:
documentclass{article}
usepackage{array,graphicx}
usepackage{booktabs}
usepackage{pifont}
usepackage[table]{xcolor}
newcommand*rot{rotatebox{90}}
newcommand*OK{ding{51}}
begin{document}
begin{table} centering
begin{tabular}{@{} cr*{10}c }
& & multicolumn{10}{c}{Knowledge Areas} [2ex]
rowcolor{blue!30} cellcolor{white}
& & rot{Integration} & rot{Scope} & rot{Time} & rot{Cost}
& rot{Quality} & rot{Human Resource~} & rot{Communication}
& rot{Risk} & rot{Procurement} & rot{shortstack[l]{StakeholderManagement}}
cmidrule{2-12}
rowcolor{black!15} cellcolor{white}
& Initiating &OK & & & & & &OK & & &OK
& Planning &OK &OK &OK &OK &OK &OK &OK &OK &OK &OK
rowcolor{black!15} cellcolor{white}
& Executing &OK & & & &OK &OK &OK & &OK &OK
& Monitoring and Control
&OK &OK &OK &OK &OK & &OK &OK &OK &OK
rowcolor{black!15} cellcolor{white}
rot{rlap{~Processes}}
& Closing &OK & & & & & &OK & &OK &OK
cmidrule[1pt]{2-12}
end{tabular}
caption{Some caption}
end{table}
end{document}
Correct answer by user2478 on May 24, 2021
When I tried to read your table, I found it impossible to read the column headings because of the rotation, which is why I recommend a solution without rotation. All it is is a simple reorganisation of the rows and columns.
It isn't perfect. Perhaps aligning the Processes to the right is better.
You can simplify the table as well because all knowledge areas require planning, so why put it in the table? Just mention it in the caption. Removing the column for planning should make the table less wide, which is always a good thing because it makes it easier to scan the table from left to right and back.
documentclass{article}
usepackage{booktabs}
newcommand*ON[0]{$surd$}
begin{document}
begin{table}
begin{center}
begin{tabular}{@{}lccccc@{}}
& multicolumn{5}{c}{textbf{Processes}}
cmidrule{2-6}
& & & & textbf{Monitoring}
textbf{Knowledge Areas}
& textbf{Initiating}
& textbf{Planning}
& textbf{Executing}
& textbf{& Control}
& textbf{Costing}
midrule
textbf{Integration} & ON & ON & ON & ON & ON
textbf{Scope} & & ON & & ON &
textbf{Time} & & ON & & ON &
textbf{Cost} & & ON & & ON &
textbf{Quality} & & ON & ON & ON &
textbf{Human Resource} & & ON & ON & &
textbf{Communication} & ON & ON & ON & ON & ON
textbf{Risk} & & ON & & ON &
textbf{Procurement} & & ON & ON & ON & ON
textbf{Stakeholder
Management} & ON & ON & ON & ON & ON
bottomrule
end{tabular}
caption{Some caption}
end{center}
end{table}
end{document}
Answered by user10274 on May 24, 2021
I had made a similar table for my use.
documentclass[oneside, 10pt, a4paper]{article}
usepackage{multirow}
usepackage{graphicx}
usepackage{booktabs}
newcommand{mcrot}[4]{multicolumn{#1}{#2}{rlap{rotatebox{#3}{#4}~}}}
newcommand*{twoelementtable}[3][l]%
{%
renewcommand{arraystretch}{0.8}%
begin{tabular}[t]{@{}#1@{}}%
#2tabularnewline
#3%
end{tabular}%
}
begin{document}
begin{table}[h] label{tab:activityTracking}
centering
caption{Tracking daily activities.}
begin{tabular}{ *2{ll|} *6c | *6c }
multicolumn{2}{c}{Date} & multicolumn{1}{c}{Start} & multicolumn{1}{c}{Stop}
& mcrot{1}{l}{60}{Activity 1} & mcrot{1}{l}{60}{Analysis} & mcrot{1}{l}{60}{twoelementtable{No. of}{processes}} & phantom{p}& mcrot{1}{l}{60}{Result} & mcrot{1}{l}{60}{Backup}
& mcrot{1}{l}{60}{Activity 2} & mcrot{1}{l}{60}{Analysis} & mcrot{1}{l}{60}{twoelementtable{No. of}{processes}} & phantom{p} & mcrot{1}{l}{60}{Result} & mcrot{1}{l}{60}{Backup}
midrule midrule
multirow{4}{*}{rotatebox{90}{textbf{January}}}
& 11 & 1:30~am & 10:45~am
& x & x & multicolumn{2}{c}{-} & - & x
& - & x & multicolumn{2}{c}{x} & x & x
& 12 & &
& - & - & multicolumn{2}{c}{x} & - & -
& - & - & multicolumn{2}{c}{x} & - & -
& 13 & &
& - & - & multicolumn{2}{c}{x} & - & -
& - & - & multicolumn{2}{c}{x} & - & -
& 14 & &
& - & - & multicolumn{2}{c}{-} & - & -
& - & - & multicolumn{2}{c}{x} & - & -
bottomrule
end{tabular}
end{table}
end{document}
Answered by mythealias on May 24, 2021
You can easily create that table with {NiceTabular}
of nicematrix
.
documentclass{article}
usepackage{booktabs}
usepackage{nicematrix}
begin{document}
begin{table} centering
begin{NiceTabular}{clcccccccccc}
& & Block{1-10}{Knowledge Areas} [1mm]
& & rotate Integration & rotate Scope & rotate Time & rotate Cost
& rotate Quality & rotate Human Resource & rotate Communication
& rotate Risk & rotate Procurement & Block{1-1}<rotate>{Stakeholder hfillManagement}
midrule
Block{5-1}{rotate Processes}
& Initiating & * & & & & & & * & & & *
& Planning & * & * & * & * & * & * & * & * & * & *
& Executing & * & & & & * & * & * & & * & *
& Monitoring and Control & * & * & * & * & * & & * & * & * & *
& Closing & * & & & & & & * & & * & *
bottomrule
end{NiceTabular}
caption{Some caption}
end{table}
end{document}
You need several compilations (because nicematrix
uses PGF/Tikz nodes under the hood).
Answered by F. Pantigny on May 24, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP