How to create a table with different alignments in each row?

I would like to create a table that looks like this, preferably one that allows me to use enumitem in the 'table' :

As you can see, the alignment for the first row is centered but the subsequent rows are left aligned. Thanks.

• You could use one big p type column for the table and for the first row use \multicolumn{1}{c}{Learning Outcomes}. Jul 23, 2018 at 7:23
• Another viable solution would be a package like tcolorbox (which might be overkill for this simple looking result, but would add easy page breakability and allow more fancy looking boxes). Jul 23, 2018 at 7:30
• Is it possible to use arrays for this? Jul 23, 2018 at 7:33
• Do you mean the environment array? tabular is effectively the same but with text mode (what's what you want, as the contents are text not maths). Jul 23, 2018 at 7:33
• Or did you mean to achieve the stuff in the braces which I wrote to describe the advantages of tcolorbox? Page breakable would be hard to do, as a tabular is one cell. longtable could fix that (it is page breakable), but I think not in the midst of a p row. And the fancy looks are not possible with tabular. Jul 23, 2018 at 7:49

If you want to use a tabular you could use

\documentclass[border=2mm]{standalone}

\usepackage[table]{xcolor}

\begin{document}
\begin{tabular}[]{|p{\dimexpr\linewidth-2\arrayrulewidth-2\tabcolsep\relax}|}
\hline
\rowcolor{gray!25}
\multicolumn{1}{|c|}{Learning Outcomes}\\
\hline
\begin{enumerate}
\item thingy
\item thingy
\end{enumerate}\\
\hline
\end{tabular}
\end{document}


Small appetizer for tcolorbox (the breakable key makes the box page breakable if it is a big one):

\documentclass[border=2mm]{standalone}

\usepackage{tcolorbox}
\tcbuselibrary{breakable}
title=\centering#1,breakable}

\begin{document}
\begin{mybox}{Learning Outcomes}
\begin{enumerate}
\item thingy
\item thingy
\end{enumerate}
\end{mybox}
\end{document}


• What do the bits after begin tabular do? Especially \dimexpr, \tabcolsep and \relax. Jul 23, 2018 at 7:41
• @ChungRenKhoo \dimexpr lets you calculate a dimension based on simple maths. It absorbs every dimension/number following after it which are connected by correct maths operations. \relax stops this absorption to make sure that it can't absorb more than I want it to. So the stuff between \dimexpr and \relax is the width of the p type column. \linewidth should be self explanatory, \arrayrulewidth is the width of the vertical rules, \tabcolsep is the separation between the text and those rules (basically the padding which is added on both sides of each table column). Jul 23, 2018 at 7:46
• @ChungRenKhoo This makes sure that the table takes up the whole line but doesn't produce an overfull \hbox error. Jul 23, 2018 at 7:47
• If I would like to add more columns to the second box (it looks amazing btw) how do I go about doing that? e.g. Instead of just "Learning Outcomes", what if I want to have another column for "Random Stuff"? Jul 23, 2018 at 9:42
• @ChungRenKhoo there is the raster column key in tcolorbox, but I don't know whether you'd like the output. You can take a look at the documentation. Jul 23, 2018 at 11:21