# Alignment problem with enumerate

This simple table is not working out for me. The first item in the table does not align with the others, see picture. I can not figure out why not. Thank you.

\begin{enumerate}
\begin{tabular}{p{3cm}p{3cm}p{3cm}p{3cm}p{3cm}p{3cm}}
\item c) & \item  c) & \item  c) & \item a)& \item d) & \item b)
\end{tabular}
\end{enumerate}


• Hi and welcome to TeX.SE. It's usually more helpful to post a complete minimal document rather than a code fragment. (So wrap your code in a \documentclass{article}\begin{document}...\end{document}.) What you're doing here seems like a very odd use of enumeration. (And it's actually amazing that it works at all.) So what exactly do you want to achieve? If you simply want to number cells in a table, there are better ways to do this. If you want an "in-line" enumeration, there are also better ways to do that. Dec 22 '15 at 2:10

A list naturally inserts a spacing between elements, as well as at the start and end of the list. As such, there may be different spacing above the first \item, between each successive \items, and after the last \item. In your example it's better to remove all spacing inserted by the list via the nosep option provided by enumitem:

\documentclass{article}

\usepackage{enumitem,tabularx}

\begin{document}

\begin{enumerate}[nosep]
\begin{tabular}{ *{6}{p{25mm}} }
\item c) & \item  c) & \item  c) & \item a) & \item d) & \item b)
\end{tabular}
\end{enumerate}

\noindent
\setcounter{enumi}{0}%
\begin{tabularx}{\textwidth}{ *{6}{>{\refstepcounter{enumi}\theenumi.~\ignorespaces}X} }
c) & c) & c) & a) & d) & b)
\end{tabularx}

\end{document}


Another option is proposed at the end, suggesting you use another way of automating the enumeration within a tabular. Specifically, I've used tabularx to ensure that the tabular width doesn't go beyond \textwidth, while \refstepcounter{enumi}\theenumi.~ is inserted at the start of every cell. enumi is the counter associated with enumeration at the root level, so I'm reusing it here.

The former method has some duplication in it, as both \item and & is used to separate an item, while the later obscures the fact that you're building a list. So, perhaps both have their (dis)advantages.

Another method, perhaps more appropriate in this situation, might be to use inline lists; something supported since enumitem V3.0:

\documentclass{article}

\usepackage[inline]{enumitem}

\begin{document}

\begin{enumerate*}[itemjoin=\hfill]
\item c) \item  c) \item  c) \item a) \item d) \item b)
\end{enumerate*}

\end{document}


You can specify how the items are joined inside an enumerate* - a specific inline enumeration environment. I've used \hfill to stretch content across the text block width.

• But surely this is not an ideal method to achieve this output? Dec 22 '15 at 2:18
• @AlanMunn: It surely isn't. Dec 22 '15 at 2:19
• So then you're encouraging bad practices... Isn't this what the site is trying to avoid. Do I need to downvote you? :) This is a classic XY problem (hence my comment to the OP). Dec 22 '15 at 2:20
• @AlanMunn: Let me clarify. Surely there are better ways of doing it, all depending on the OP's intent. I've added another option for automated listing within (say) tabularx, together with some clarification as to the different methods. I don't think the OP's usage is bad per se, just odd. Dec 22 '15 at 2:28