16

I'm trying to make alignment points in a list environment. The following code gives me an error, but it almost compiles to what I want, just missing the bullet points. I must be misunderstanding something about align and/or tabular and how they work with linebreaks. Guidance appreciated!

\documentclass{beamer}

\begin{document}

\begin{frame}
    \frametitle{Title}
    \begin{itemize}
    \begin{tabular}{ll}
        \item Topic Apple: &Something to say about it \\
        \item Topic Watermelons: &Something different
    \end{tabular}
    \end{itemize}
\end{frame}

\end{document}
3
  • Oh, I should mention that this isn't beamer-specific...I was hasty there because this arose while I was working on a presentation. If I just use the article class then I still have the same issue. Sorry about that.
    – evencoil
    Commented Nov 16, 2010 at 12:26
  • 1
    Well, it is sort-of beamer-specific, since beamer's handling of lists is so much different from the usual one that generic LaTeX solutions will possibly not work here. Commented Nov 16, 2010 at 12:46
  • That's true--what I meant was just that the place to start might be with a standard class and then see if the solution also works in beamer.
    – evencoil
    Commented Nov 16, 2010 at 13:05

3 Answers 3

10

You can't do this particular mixture of itemize and tabular out of the box. But the listliketab package can help. The purpose of that package is to make tables looks like lists.

\documentclass{beamer}
\usepackage{listliketab}
\begin{document}

\begin{frame}
    \frametitle{Title}
    \begin{listliketab} 
    \storestyleof{itemize} 
        \begin{tabular}{Lll}
            \textbullet & Topic Apple: &Something to say about it \\
            \textbullet & Topic Watermelons: &Something different
        \end{tabular} 
    \end{listliketab}
\end{frame}
\end{document}

Works in beamer and other all other classes (that I know of).

4
  • thanks, that works great. Do you know how I can inherit the bullet style from my beamer template when I use \storestyleof ?
    – evencoil
    Commented Nov 16, 2010 at 17:07
  • Oh...lets see, so I think the way to go about this is to replace itemize with \usebeamertemplate*{itemize item}. But if I do that I get an error "You can't use `\raise' in internal vertical mode."--looking at the beamer templates they do have \raise commands in them.
    – evencoil
    Commented Nov 16, 2010 at 17:23
  • 1
    Gee I'm a smart one...replace \textbullet by \usebeamertemplate*{itemize item} and it works. Because, you know, that makes sense, unlike what I just wrote.
    – evencoil
    Commented Nov 16, 2010 at 17:25
  • That's right. \usebeamertemplate* is better here than \usebeamertemplate without the star. I had to look it up to find out why, but basically it will surround the item label with a group. Commented Nov 16, 2010 at 19:28
4

Since other suggestions here didn't work for my two-column document style, here is my plain-TeX hack to achieve something similar:

\begin{itemize}
\setlength{\itemsep}{0cm}%
\setlength{\parskip}{0cm}%
\item{\ \hbox to 3cm{Topic Apple: \hfill}\texttt{Something} to say about it}
\item{\ \hbox to 3cm{Topic Watermelons: \hfill}\texttt{Something} different}
\end{itemize}

Here is a brief explanation (before I forget it :) ):

  • the \itemsep and \parskip solve a different problem in my document (I include them since I'm not sure if they have an effect on the rest or not)
  • The first space '\' in the \item, is to cheat the \itemize environment - so it thinks it starts with plain text (otherwise, Latex will typeset everything in the first \hbox above the bullet point)
  • The '\hbox to 3cm{}' creates a box 3cm wide, in which the contents will be typeset - however, by default, the text contents (i.e., the 'glues') in this \hbox will be stretched across the entire width of the \hbox
  • To solve this stretching problem, we enter a '\hfill' at the end of the \hbox: thus, the text in the \hbox is typeset first, and then the \hfill inserts a space stretching to the end of the 3cm width - which effectively shows the text as 'raggedright' (i.e., left aligned)
  • (I had a '\texttt{}' word where I wanted the alignment indent to happen in my own case, so I included it here too)

Of course, to have this code usable, one should use a length variable before it:

\newlength{\tmplen}
\setlength{\tmplen}{3cm}

and then use \tmplen in the \items instead, as in:

...
\item{\ \hbox to \tmplen{Topic Apple: \hfill}\texttt{Something} to say about it}
...

... since you'll have to manually set the box width with this approach.

Well, hope this helps someone,

Cheers!

4

How about this:

\documentclass{beamer}

\begin{document}

\begin{frame}
    \frametitle{Title}
    \begin{tabular}{@{\textbullet}ll}
        Topic Apple: &Something to say about it \\
        Topic Watermelons: &Something different
    \end{tabular}
\end{frame}

\end{document}

Which results in

alt text

You can also change the \textbullet by, for example adding another column which will hold the item marker (which you can then control using beamer).

5
  • That seems like a good solution; do you happen to know what I need to put in to get beamer to replicate my itemize/enumerate style and the correct spacing after the bullet?
    – evencoil
    Commented Nov 16, 2010 at 13:40
  • Nice. But there should be some space after the \textbullet. Commented Nov 16, 2010 at 13:40
  • I tried to add \usebeamertemplate{itemize item} into the tabular definition, but got errors....my tex-foo isn't good enough to do this properly...anyone else want to take it from here? Commented Nov 16, 2010 at 15:17
  • Oh, adding the space is easy, just add \hspace*{\labelsep} after the bullet. Commented Nov 16, 2010 at 15:18
  • Thanks for that - but this doesn't seem to preserve neither line width, nor indentation, in two-column documents...
    – sdaau
    Commented Dec 28, 2010 at 7:20

You must log in to answer this question.

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