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.
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityIf 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}
\newtcolorbox{mybox}[1]{colframe=gray,fonttitle=\bfseries,adjusted
title=\centering#1,breakable}
\begin{document}
\begin{mybox}{Learning Outcomes}
\begin{enumerate}
\item thingy
\item thingy
\end{enumerate}
\end{mybox}
\end{document}
\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).
\hbox
error.
raster column
key in tcolorbox
, but I don't know whether you'd like the output. You can take a look at the documentation.
p
type column for the table and for the first row use\multicolumn{1}{c}{Learning Outcomes}
.tcolorbox
(which might be overkill for this simple looking result, but would add easy page breakability and allow more fancy looking boxes).array
?tabular
is effectively the same but with text mode (what's what you want, as the contents are text not maths).tcolorbox
? Page breakable would be hard to do, as atabular
is one cell.longtable
could fix that (it is page breakable), but I think not in the midst of ap
row. And the fancy looks are not possible withtabular
.