I want to display a table inside an enumerate
environment such that the first row aligns with the item label. My current code is the following:
\documentclass{article}
\usepackage{enumitem}
\usepackage{booktabs}
\setenumerate{listparindent=\parindent, parsep=0pt}
\begin{document}
\begin{enumerate}[align=left, label=\large\sffamily\bfseries \alph*)]
\item
\begin{tabular}[t]{cccc}
\toprule
$m$ & $P(R=a,M=m)$ & $P(R=b,M=m)$ & $P(R=c,M=m)$ \\
\midrule
1 & 0.1 & 0.2 & 0.3 \\
2 & 0.2 & 0.1 & 0.1 \\
\bottomrule
\end{tabular}
\item
\(
\displaystyle
P(0) = P(0|B) P(B) + P(0|G) P(G)
\)
\end{enumerate}
\end{document}
Unfortunately (despite using the t
option of the tabular
environment), the alignment is not as expected due to the \toprule
command. If I remove it, everthing is fine. How may I solve this?
Furthermore, how can I center the table horizontally within the current line? I tried to use a floating table by surrounding it with \begin{table}\end{table}
, but this changed the vertical placement even more.
\toprule
: It also occurs when the standard LaTeX\hline
command is used.