[Tex/LaTex] Prettify booktabs table with subheadings/categories

booktabstables

I basically want to list attribute names and a attribute description in a table. The attributes belong to a certain category. The idea is to list all attributes in one table to avoid creating multiple tables for each category. At the moment I am simply subdividing the table by using midrules for each category. The result looks ok, but I wonder if there is a more beautiful way to do this (e.g. indenting the rows below each category).

\documentclass{article}
\usepackage{booktabs}
\begin{document}

\begin{table}[h]
\centering
\begin{tabular}{ll}
\toprule
\textbf{Attribute} & \textbf{Description} \\ \midrule
\multicolumn{2}{l}{{Category 1}} \\ \midrule
A1 & D1 \\
A2 & D2 \\ \midrule
\multicolumn{2}{l}{{Category 2}} \\ \midrule
A3 & D3 \\
A4 & D4 \\
\bottomrule
\end{tabular}
\end{table}

\end{document}

Best Answer

Maybe I'm old-fashioned, but I still like simple tables:

enter image description here

\documentclass{article}
\usepackage{booktabs,multirow}
\begin{document}
\begin{table}[h]
\centering
\begin{tabular}{ccc}
\toprule
\textbf{Category} & \textbf{Attribute} & \textbf{Description} \\ \midrule\\[-.9em]
\multirow{2}{*}{1}
  & A1 & D1 \\
  & A2 & D2 \\[.5em]
\multirow{2}{*}{2}
  & A3 & D3 \\
  & A4 & D4 \\[.5em]
\multirow{2}{*}{3}
  & A2 & D1 \\
  & A3 & D4 \\
\bottomrule
\end{tabular}
\end{table}

\end{document}
Related Question