6

I'd like to know how to indent a table within the itemize environment.

\documentclass{article}
\begin{document}
Hello. I love \LaTeX! I have a question:
\begin{itemize}
    \item
        How can I indent the table below?

        \begin{tabular}{|rcccl|}
            \hline\\[-10pt]
            this & table & should & be & indented \\
            \hline
        \end{tabular}

\end{itemize}
\end{document}
1

1 Answer 1

5

You could prepend the tabular with an \hspace*{<len>} where <len> is any known (La)TeX length unit. For example, below I've spaced the tabular by 2em:

enter image description here

\documentclass{article}
\begin{document}
Hello. I love \LaTeX! I have a question:
\begin{itemize}
    \item
        How can I indent the table below?

        \hspace*{2em}\begin{tabular}{|rcccl|}
            \hline
            this & table & should & be & indented \\
            \hline
        \end{tabular}

\end{itemize}
\end{document}​

Using the starred version of \hspace*{<len>} here is not compulsory - \hspace{<len>} would also work.

Note how it is necessary to "unskip" the distance inserted after \hline via \\. I've just removed it from my MWE. Of course, other lengths also exist that you could use (\labelsep comes to mind, which is the length between the bullet and the start of the item text).

2
  • Great answer, thank you! May I ask what the function of the * is in general?
    – Will
    Nov 19, 2011 at 0:08
  • See Help with \hspace for some detail on the use of * or not.
    – Werner
    Nov 19, 2011 at 0:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .