3

In some slides I am writing with the beamer class, I want to eliminate the additional horizontal and vertical spaces that appears in list environments like itemize and enumerate, so that the environment does not look strange when used in a tabular environment. See the example below.

\documentclass[smaller]{beamer}

\begin{document}

\begin{frame}{Frame test}
  \begin{tabular}{|l|p{4cm}|}\hline
    Foo & This is a test.\\\hline
    Bar & \begin{itemize}
            \item First item.
            \item Second item.
          \end{itemize}\\\hline
    Baz & Last test.\\\hline
  \end{tabular}
\end{frame}

\end{document}

demo of undesired spaces with enumerate

In this sample document, I want the bullets vertically aligned with the entries of the second column in the first and third lines. Also I want no extra spaces before and after the list, and between the items in the list.

I already know that the enumitem package and the beamer class are not compatible, therefore it is not an option.

Any clues?

1 Answer 1

3

Use a nested tabular with some array finesse:

enter image description here

\documentclass[smaller]{beamer}% http://ctan.org/pkg/beamer
\let\Tiny\tiny
\usepackage{array}% http://ctan.org/pkg/array
\newcommand{\itemizeitem}{%
  \usebeamerfont{itemize item}%
  \usebeamercolor[fg]{itemize item}%
  \usebeamertemplate{itemize item}}
\newenvironment{tabitemize}[1]
  {\renewcommand{\item}{&}% Fake \item
   \begin{tabular}[t]{@{}>{\itemizeitem}l@{\hspace{\labelsep}}#1@{}}}
  {\end{tabular}}
\begin{document}

\begin{frame}{Frame test}
  \begin{tabular}{|l|l|}\hline
    Foo & This is a test. \\
    \hline
    Bar & \begin{tabitemize}{p{4cm}}
            \item First item. \\
            \item Second item.
          \end{tabitemize} \\
    \hline
    Baz & Last test. \\
    \hline
  \end{tabular}
\end{frame}

\end{document}

The environment tabitemize provides a faked itemize in a very similar interface. The first column (hidden as an \item) merely inserts the traditional \item content using the beamer template. The mandatory argument specifies the width of the itemized content using a tabular-style column specification.

You must log in to answer this question.

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