5

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}
4

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).

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.